/*
 * PARTIDO STUDIO — house style.
 *
 * The palette, the type and the restraint are carried over from Turn Off AI,
 * which is the studio's clearest statement of what it builds. Warm paper, soft
 * charcoal, hairline rules doing the structural work. No gradients, no glass,
 * no cards with shadows, no icons in coloured circles.
 *
 * No remote fonts. Every face below ships with the OS, so the page paints in
 * one pass and nothing reflows a paragraph after the fact. The Traditional
 * Chinese faces sit in the stack so a mixed draft renders at one weight.
 */

:root {
  --paper: #faf7f2;
  --paper-raised: #f5f1ea;

  /* 12.4:1 on --paper. Soft charcoal, never pure black. */
  --ink: #2e2a26;
  /* 5.3:1 — AA for secondary text. */
  --ink-muted: #6b6259;
  /* 4.6:1 — still AA, for metadata that can be missed without loss. */
  --ink-faint: #7b7167;

  --rule: #e4ddd2;

  /* The one accent. Signals only: index marks, links on hover. 5.9:1. */
  --accent: #8a4b26;

  --focus: #3f6b5f;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Songti TC", "PingFang TC", "Hiragino Sans CJK TC", "Noto Serif CJK TC",
    "Microsoft JhengHei", "Source Han Serif TC", serif;

  --font-ui: ui-sans-serif, -apple-system, "Segoe UI", "PingFang TC",
    "Hiragino Sans", "Noto Sans CJK TC", "Microsoft JhengHei", sans-serif;

  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* 65–75 Latin characters. */
  --measure: 38rem;
  --page: 64rem;

  --transition-slow: 420ms;
  --transition-quick: 220ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* The nav is sticky; anchors must not land under it. */
  scroll-padding-top: 5rem;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/*
 * A near-imperceptible grain, fixed to the viewport so it cannot tile visibly
 * or scroll with the text. Under 1% luminance: it costs no contrast.
 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(
    circle at 50% 0%,
    rgba(120, 96, 64, 0.028),
    rgba(120, 96, 64, 0) 70%
  );
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: rgba(138, 75, 38, 0.14);
}

/* ---------------------------------------------------------------- motion -- */

/*
 * The page settles rather than slides. Opacity only: the stagger is what makes
 * it feel alive, and nothing has to move to get that.
 */
.settle {
  opacity: 0;
  animation: settle 900ms ease forwards;
}

.d1 { animation-delay: 60ms; }
.d2 { animation-delay: 220ms; }
.d3 { animation-delay: 400ms; }
.d4 { animation-delay: 600ms; }
.d5 { animation-delay: 820ms; }

@keyframes settle {
  from { opacity: 0; }
  to { opacity: 1; }
}

/*
 * Rings of still water. One cycle takes 26 seconds, which is slower than the
 * eye tracks as movement, and the stroke sits at 6% alpha in the same warm
 * brown as the grain, so it cannot touch text contrast. The origin is low and
 * left, clear of the reading column.
 */
.ripple {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ripple::after {
  content: "";
  position: absolute;
  top: 74%;
  left: 18%;
  width: min(130vw, 74rem);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(120, 96, 64, 0.045) 0%,
    rgba(120, 96, 64, 0.018) 45%,
    rgba(120, 96, 64, 0) 70%
  );
}

.ring {
  position: absolute;
  top: 74%;
  left: 18%;
  width: min(64vw, 50rem);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(120, 96, 64, 0.065);
  transform: translate(-50%, -50%) scale(0.12);
  opacity: 0;
  animation: ripple 26s cubic-bezier(0.16, 0.66, 0.3, 1) infinite;
}

.ring:nth-child(2) { animation-delay: 6.5s; }
.ring:nth-child(3) { animation-delay: 13s; }
.ring:nth-child(4) { animation-delay: 19.5s; }

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(0.12);
    opacity: 0;
  }
  10% { opacity: 1; }
  100% {
    transform: translate(-50%, -50%) scale(2.1);
    opacity: 0;
  }
}

/*
 * Reduced motion stops the water rather than speeding it up: the rings stay,
 * held still at four radii, so the page keeps its depth with nothing moving.
 *
 * Delays are zeroed as well as durations. Every .settle element starts at
 * opacity 0 and is revealed by the animation's fill, so killing only the
 * duration would leave a visitor staring at a blank page for most of a second.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0.01ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0.01ms !important;
  }

  .ring {
    animation: none;
    opacity: 1;
  }
  .ring:nth-child(1) { transform: translate(-50%, -50%) scale(0.45); }
  .ring:nth-child(2) { transform: translate(-50%, -50%) scale(0.85); }
  .ring:nth-child(3) { transform: translate(-50%, -50%) scale(1.3); }
  .ring:nth-child(4) { transform: translate(-50%, -50%) scale(1.8); }
}

@media (prefers-contrast: more) {
  :root {
    --ink: #1f1c19;
    --ink-muted: #4a423a;
    --ink-faint: #4a423a;
    --rule: #b8ad9e;
  }
}

/* ------------------------------------------------------------- structure -- */

.page {
  position: relative;
  z-index: 1;
  max-width: var(--page);
  margin: 0 auto;
  padding-inline: clamp(1.5rem, 6vw, 4rem);
}

/*
 * Sections are separated by a hairline that runs the full width of the column,
 * not by a box. The rule is the only structural device on the page.
 */
.section {
  padding-block: clamp(3.5rem, 9vw, 6rem);
  border-top: 1px solid var(--rule);
}

.measure {
  max-width: var(--measure);
}

/* A small caps-ish label. Letterspaced rather than bold, which stays quiet. */
.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.75rem;
}

/* ------------------------------------------------------------------ nav --- */

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--rule);
  /* Opaque, not frosted: backdrop-filter over a grain is a blur of a blur. */
  background: var(--paper);
}

.navInner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.1rem clamp(1.5rem, 6vw, 4rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.wordmark svg {
  flex: none;
  color: var(--ink);
}

.navLinks {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 0.9rem;
}

.navLinks a {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--transition-quick) ease;
}

.navLinks a:hover {
  color: var(--ink);
}

/* ----------------------------------------------------------------- hero --- */

.hero {
  padding-block: clamp(4.5rem, 15vh, 9rem) clamp(3.5rem, 9vw, 6rem);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6.2vw, 3.6rem);
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 20ch;
  /* Evens the lines rather than leaving one word stranded on the last one. */
  text-wrap: balance;
}

.lede {
  font-size: clamp(1.05rem, 2.1vw, 1.2rem);
  line-height: 1.7;
  color: var(--ink-muted);
  margin: 1.75rem 0 0;
  text-wrap: pretty;
}

/* --------------------------------------------------------------- works ---- */

.works {
  display: grid;
  gap: clamp(3rem, 7vw, 4.5rem);
  margin-top: 2.5rem;
}

/*
 * An index number in the margin, the entry beside it. Asymmetric on purpose:
 * a centred two-up grid of equal cards would make the studio's two products
 * look like a feature comparison.
 */
.work {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 0 1.5rem;
  align-items: start;
}

.workIndex {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  padding-top: 0.55rem;
  font-variant-numeric: tabular-nums;
}

.workName {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
}

.workName a {
  color: var(--ink);
  text-decoration: none;
  transition: color var(--transition-quick) ease;
}

.workName a:hover {
  color: var(--accent);
}

/* The arrow drifts on hover. 2px, which reads as intent rather than animation. */
.workName a .arrow {
  display: inline-block;
  font-size: 0.62em;
  color: var(--ink-faint);
  transform: translateY(-0.15em);
  transition: transform var(--transition-quick) ease,
    color var(--transition-quick) ease;
}

.workName a:hover .arrow {
  color: var(--accent);
  transform: translate(2px, -0.25em);
}

.workLine {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0.7rem 0 0;
  max-width: 40ch;
  text-wrap: balance;
}

.workBody {
  color: var(--ink-muted);
  margin: 1.1rem 0 0;
  max-width: var(--measure);
  text-wrap: pretty;
}

/*
 * Facts, set as a hairline-separated row. Mono earns its keep here and only
 * here. The middots are drawn in CSS rather than typed into the markup so a
 * screen reader reads three facts, not "fact middot fact middot fact", and so
 * the separator disappears when the row wraps to one item per line on a phone.
 */
.workFacts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0;
  margin: 1.35rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.workFacts span + span::before {
  content: "·";
  margin: 0 0.7em;
  color: var(--ink-faint);
  opacity: 0.55;
}

/* ---------------------------------------------------------------- notes --- */

.notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: clamp(1.75rem, 4vw, 2.75rem);
  margin-top: 2.5rem;
}

.note h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  margin: 0 0 0.55rem;
  color: var(--ink);
}

.note p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-muted);
}

/* ----------------------------------------------------------------- list --- */

/*
 * A plain hairline-separated list. Used where the old site had a grid of
 * emoji tiles: four short phrases do not need four boxes to be four things.
 */
.list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  max-width: var(--measure);
  border-top: 1px solid var(--rule);
}

.list li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------- embed --- */

/*
 * A third-party player. It is framed by a hairline and given the house radius
 * so it sits on the paper as an object rather than floating on it; its own
 * colours are Spotify's and are left alone.
 */
.embed {
  margin-top: 1.5rem;
  max-width: 44rem;
  border: 1px solid var(--rule);
  /* Matched to the radius Spotify bakes into its own player, so the hairline
     hugs the artwork instead of showing paper in four corners. */
  border-radius: 12px;
  overflow: hidden;
  /* Fills the frame exactly: an iframe is inline by default and would leave a
     descender-sized strip of paper along the bottom edge. */
  line-height: 0;
}

.embed iframe {
  display: block;
  width: 100%;
  border: 0;
}

/* -------------------------------------------------------------- contact --- */

.contact h2,
.section > h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.6vw, 2.1rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0;
  max-width: 24ch;
  text-wrap: balance;
}

.contactBody {
  color: var(--ink-muted);
  margin: 1.25rem 0 0;
  max-width: var(--measure);
  text-wrap: pretty;
}

/*
 * The primary action is a filled shape with no gradient and no shadow, at a
 * 2px radius. Ink on paper reads as more considered than any accent could.
 */
.button {
  display: inline-block;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 1.6rem;
  margin-top: 2rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--transition-quick) ease;
}

.button:hover {
  opacity: 0.86;
}

.quietLink {
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color var(--transition-quick) ease;
}

.quietLink:hover {
  color: var(--ink);
}

/* --------------------------------------------------------------- footer --- */

.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--rule);
  margin-top: 0;
}

.footerInner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2.5rem clamp(1.5rem, 6vw, 4rem) 3.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.footerInner a {
  color: var(--ink-faint);
  text-decoration: none;
  transition: color var(--transition-quick) ease;
}

.footerInner a:hover {
  color: var(--ink);
}

/* ----------------------------------------------------------- responsive --- */

@media (max-width: 34rem) {
  /* The margin index would eat a third of a phone screen. It goes inline. */
  .work {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .workIndex {
    padding-top: 0;
    margin-bottom: 0.4rem;
  }

  .navInner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }
}
