/* ============================================================
   COMPONENTS — nav, ticker, file card, index, data grids, carousel
   ============================================================ */

/* ---------- NAV ----------
   Figma component set: status (close|open|back) x size
   (Mobile 56 / Tablet 80 / Desktop 96). On desktop the links sit in
   160px cells divided by hairlines, and the theme/language toggles
   live in a 48px column on the right. */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-24);
  /* Inset on the left only — the control cells run to the right edge
     so their borders meet the viewport, which is what makes the bar
     read as a strip of the grid rather than a floating box. */
  padding-left: var(--nav-pad);
  padding-right: 0;
  height: var(--nav-h);
  border-bottom: 1px solid var(--border-strong);

  /* Your call, and it's the better one: the bar carries the grid
     rather than faking transparency. It is opaque, so nothing scrolls
     through it — but because it is pinned at y=0 and the field behind
     is fixed too, the two grids line up exactly. It reads as
     transparent and always will. */
  background-color: var(--bg-primary);
  background-image:
    repeating-linear-gradient(to right,  var(--grid-line) 0 1px, transparent 1px var(--grid-module)),
    repeating-linear-gradient(to bottom, var(--grid-line) 0 1px, transparent 1px var(--grid-module));
}
@media (min-resolution: 2dppx) {
  .nav {
    background-image:
      repeating-linear-gradient(to right,  var(--grid-line) 0 0.5px, transparent 0.5px var(--grid-module)),
      repeating-linear-gradient(to bottom, var(--grid-line) 0 0.5px, transparent 0.5px var(--grid-module));
  }
}

/* ---------- BUTTON ----------
   Figma 146:868 — three hierarchies, four states each.
   Shared: 16px body, sentence case, 2px radius, 8px padding, 4px gap.
   Tertiary drops the box entirely: no background, no border, no
   padding, 24px tall — only the label and its icon, and the state
   lives purely in the color. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  /* A grid item is blockified, so inline-flex alone does not stop a
     button from stretching to its column. Buttons size to their label
     unless a layout explicitly says otherwise. */
  justify-self: start;
  gap: var(--space-4);
  min-height: 40px;
  padding: var(--space-8);
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: inherit;
  font-size: var(--fs-body); line-height: var(--lh-body);
  letter-spacing: var(--ls-none);
  text-transform: none;
  text-decoration: none;          /* these are buttons, not links */
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.btn .ico { width: 24px; height: 24px; }

.btn--primary {
  background: var(--interactive-default);
  border-color: var(--interactive-default);
  color: var(--content-inverse);
}
.btn--primary:hover  { background: var(--interactive-hover);  border-color: var(--interactive-hover); }
.btn--primary:active { background: var(--interactive-active); border-color: var(--interactive-active); }
/* Disabled is interactive/disabled at 50% — the opacity is on the paint
   in Figma, not on the frame, so the label and icon keep their own
   strength instead of the whole control fading. */
.btn--primary[disabled], .btn--primary[aria-disabled="true"] {
  background: var(--interactive-disabled-50);
  border-color: var(--interactive-disabled-50);
  cursor: not-allowed;
}

.btn--secondary {
  background: none;
  border-color: var(--interactive-default);
  color: var(--interactive-default);
}
.btn--secondary:hover  { border-color: var(--interactive-hover);  color: var(--interactive-hover); }
.btn--secondary:active { border-color: var(--interactive-active); color: var(--interactive-active); }
.btn--secondary[disabled], .btn--secondary[aria-disabled="true"] {
  border-color: var(--interactive-disabled-50);
  color: var(--interactive-disabled-50);
  cursor: not-allowed;
}

.btn--tertiary {
  min-height: 24px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--interactive-default);
}
.btn--tertiary:hover  { color: var(--interactive-hover); }
.btn--tertiary:active { color: var(--interactive-active); }
.btn--tertiary[disabled], .btn--tertiary[aria-disabled="true"] {
  color: var(--interactive-disabled-50); cursor: not-allowed;
}

/* The bar draws its own slice of the coordinate field so the numbers
   carry through it rather than disappearing behind it. Filled by
   site.js alongside the field itself. */
.nav__coords {
  position: absolute; inset: 0;
  overflow: hidden; pointer-events: none;
  opacity: 0.8;                 /* matches the field's own veil */
}
.nav > :not(.nav__coords) { position: relative; }  /* keep content above */

/* The logo is inlined from the sprite so the wordmark can follow
   currentColor into dark mode. As an <img> it was sealed off from the
   page's colors and stayed dark on the navy. */
@media (min-width: 1024px) { .nav { gap: 0; } }

/* The logo is inlined from the sprite so the wordmark can follow
   currentColor into dark mode. As an <img> it was sealed off from the
   page's colors and stayed dark on the navy. */
.nav__logo .logo, .nav-panel__logo {
  width: auto; height: 24px;
  color: var(--content-secondary);
  display: block;
}
@media (min-width: 768px) { .nav__logo .logo { height: 32px; } }

.nav__logo { display: inline-flex; align-items: center; color: var(--content-secondary); flex: none; }
.nav__logo img { width: auto; height: 24px; }
@media (min-width: 768px) { .nav__logo img { height: 32px; } }
@media (min-width: 1024px) {
  .nav__logo {
    width: 229px; height: var(--nav-h); justify-content: center;
    border-inline: 1px solid var(--border-strong);
  }
}

.nav__back {
  display: inline-flex; align-items: center; gap: var(--space-8);
  text-decoration: none; color: var(--content-secondary);
}
.nav__back:hover { text-decoration: underline; }
/* At ≥1024 the nav drops its left padding, because on the home the first
   thing in it is a bordered cell. Here it is text, so the back link has to
   carry the page margin itself or it sits on the viewport edge. */
@media (min-width: 1024px) { .nav__back { padding-inline-start: var(--margin-page); } }

/* Desktop links: equal 160px cells with hairline dividers. */
.nav__links { display: none; }
@media (min-width: 1024px) {
  /* Figma groups the logo and the four cells into one contiguous run
     (Frame 35, 869px) with the controls pushed to the far edge. With
     three plain flex children, space-between would strand the links in
     the middle instead. */
  .nav__links { display: flex; align-self: stretch; margin-right: auto; }
  /* The cell is the bordered 160px box; the button sits centerd inside
     it at its own width. Stretching the button to fill the cell (what
     I had) turns the whole box into a hover target and gives the
     tertiary state a background it does not have. */
  .nav__cell {
    display: grid; place-items: center;
    width: 160px;
    border-inline: 1px solid var(--border-strong);
    margin-inline-start: -1px;            /* collapse shared edges */
  }
  /* The item's justify-self beats the cell's justify-items, so the
     component default has to be overridden here to keep it centerd. */
  .nav__cell .btn { justify-self: center; }
  .nav__cell .btn[aria-current="page"] { color: var(--interactive-active); }
}

/* Right-hand controls: 48px column, each cell outlined.
   Hidden below desktop on the home, where they live in the open panel
   instead — but the case-study nav has no panel, so there they stay. */
.nav__controls { display: none; }
/* The case-study bar has no panel to hide the controls in, so they
   stay on the bar at every width — as full-height cells flush right,
   the same geometry the open state uses. */
/* (removed) `.nav__back ~ .nav__controls` used to reveal the controls on the
   old case-study header. The controls are desktop-only now; the rule would
   have leaked them onto mobile and tablet. */
@media (min-width: 1024px) {
  .nav__controls {
    display: flex; flex-direction: column; flex: none;
    width: 48px; height: var(--nav-h);
  }
}
.nav__toggle {
  display: grid; place-items: center;
  width: var(--nav-h); height: var(--nav-h);
  border-left: 1px solid var(--border-strong);
  color: var(--content-secondary);
  transition: color var(--dur-fast), background var(--dur-fast);
}
@media (min-width: 1024px) {
  .nav__toggle {
    width: 48px; height: 48px;
    border: 1px solid var(--interactive-default);
  }
  .nav__toggle + .nav__toggle { margin-block-start: -1px; }
  /* Disabled: subtle outline; top edge stays transparent so the enabled toggle above keeps its full border */
  .nav__toggle[disabled] { border-color: var(--border-default); border-top-color: transparent; }
}
.nav__toggle:hover { color: var(--content-primary); background: var(--surface-card1); }
.nav__toggle[disabled],
.nav__toggle[disabled]:hover { color: var(--content-tertiary); background: none; cursor: not-allowed; }
.nav__toggle .ico { width: 24px; height: 24px; }
.nav__toggle .icon-moon { display: none; }
[data-theme="dark"] .nav__toggle .icon-moon { display: block; }
[data-theme="dark"] .nav__toggle .icon-sun  { display: none; }

/* Below desktop the control is a full-height square cell flush with
   the right edge, divided from the bar by a single left rule — not a
   44px tap target floating in the padding, which is what I had. */
.nav__burger {
  display: grid; place-items: center;
  width: var(--nav-h); height: var(--nav-h);
  flex: none;
  border-left: 1px solid var(--border-strong);
  color: var(--content-secondary);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.nav__burger:hover { color: var(--content-primary); background: var(--surface-card1); }
@media (min-width: 1024px) { .nav__burger { display: none; } }
.nav__burger .ico { width: 24px; height: 24px; }

/* ---------- NAV OPEN (mobile + tablet) ----------
   Figma 489:6197 (376) and 479:5525 (768). Three stacked blocks — header,
   menu, footer — each carrying its own full-bleed hairline, so the inline
   padding lives on the blocks and not on the panel. */
.nav-panel {
  position: fixed; inset: 0; z-index: 50;
  /* Opaque, but carrying the same grid as the page behind it — the
     panel sits on the field, it does not replace it. */
  background-color: var(--bg-primary);
  background-image:
    repeating-linear-gradient(to right,  var(--grid-line) 0 1px, transparent 1px var(--grid-module)),
    repeating-linear-gradient(to bottom, var(--grid-line) 0 1px, transparent 1px var(--grid-module));
  display: grid; grid-template-rows: auto 1fr auto;
  overflow-y: auto;
  transform: translateY(-100%);
  transition: transform var(--dur-base) var(--ease-out);

  /* MenuRow: Figma fixes the row at 80/96 while the text block is 56/68,
     so the nominal 20px top padding is partly eaten by the type. These
     are the *effective* values — they reproduce 80 and 96 exactly. */
  --menu-pt: 4px;
  --menu-h: 80px;
  --panel-pt: 48px;
  --foot-py: var(--space-24);
  --foot-gap: var(--space-20);
}
.nav-panel[data-open="true"] { transform: none; }

/* ---------- HEADER ----------
   Same geometry as the closed nav: logo inset by --nav-pad, two square
   control cells flush right, each with a left rule, bottom hairline. */
.nav-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h); flex: none;
  padding-left: var(--nav-pad);
  border-bottom: 1px solid var(--border-strong);
}
.nav-panel__logo { width: auto; height: 24px; color: var(--content-secondary); }
.nav-panel__actions { display: flex; align-items: stretch; flex: none; align-self: stretch; }
.nav-panel__actions .nav__burger { height: auto; }

/* ---------- MENU ROWS ----------
   [28px numeral] 16 [name over its gloss] 16 [circled arrow], all three
   bottom-aligned on the row's baseline, hairline between rows. */
.nav-panel__links {
  display: grid; align-content: center;
  padding: var(--panel-pt) var(--nav-pad);
}
.menu-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 24px;
  align-items: end;
  gap: var(--space-16);
  min-height: var(--menu-h);
  padding: var(--menu-pt) var(--space-16) var(--space-20);
  border-bottom: 1px solid var(--border-strong);
  text-decoration: none;
  color: var(--content-primary);
}
.menu-row:last-child { border-bottom: 0; }
.menu-row__num {
  font-size: var(--fs-footnote); line-height: var(--lh-footnote);
  letter-spacing: var(--ls-num); color: var(--content-accent);
  font-variant-numeric: tabular-nums;
  align-self: stretch;
  /* Figma anchors the numeral 28px below the row's top edge, measured from
     the nominal 20px padding — not the effective one the type eats into. */
  padding-top: calc(28px - var(--menu-pt));
  transition: color var(--dur-fast) var(--ease-out);
}
.menu-row__text { display: grid; gap: var(--space-4); }
.menu-row__name {
  font-family: var(--font-serif); font-weight: var(--weight-semibold);
  font-size: var(--fs-title-2); line-height: var(--lh-title-2);
  display: block;
  transition: color var(--dur-fast) var(--ease-out);
}
/* Figma sets this lowercase with no tracking — it is a gloss, not a label. */
.menu-row__gloss {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  letter-spacing: var(--ls-none); text-transform: none;
  color: var(--content-tertiary); display: block;
}
.menu-row .ico {
  width: 24px; height: 24px; color: var(--content-subtle);
  transition: color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-snap);
}
.menu-row:hover, .menu-row:focus-visible { outline: none; }
.menu-row:hover .menu-row__name,
.menu-row:focus-visible .menu-row__name { color: var(--interactive-hover); }
.menu-row:hover .ico,
.menu-row:focus-visible .ico { color: var(--interactive-hover); transform: translateX(4px); }
.menu-row:focus-visible .menu-row__num { color: var(--interactive-hover); }
.menu-row:active .ico { transform: translateX(2px); }

/* Rows deal in from the top when the panel opens — transform + opacity
   only, and never on the way out (the panel slide covers that). */
@media (prefers-reduced-motion: no-preference) {
  .js .nav-panel .menu-row {
    opacity: 0; transform: translateY(-8px);
    transition: opacity var(--dur-base) var(--ease-out),
                transform var(--dur-base) var(--ease-snap);
  }
  .js .nav-panel[data-open="true"] .menu-row {
    opacity: 1; transform: none;
    transition-delay: calc(var(--dur-fast) + var(--i, 0) * var(--stagger));
  }
  .nav-panel .menu-row:nth-child(1) { --i: 0; }
  .nav-panel .menu-row:nth-child(2) { --i: 1; }
  .nav-panel .menu-row:nth-child(3) { --i: 2; }
  .nav-panel .menu-row:nth-child(4) { --i: 3; }
  .nav-panel .menu-row:nth-child(n+5) { --i: 4; }
}

/* ---------- FOOTER: FIELD SETTINGS + AVAILABILITY ----------
   One block, top hairline full-bleed, 24/20 at mobile and 36/40 at tablet. */
.nav-panel__foot {
  display: grid; gap: var(--foot-gap);
  padding: var(--foot-py) var(--nav-pad);
  border-top: 1px solid var(--border-strong);
}
/* The chip hugs its text in the design, at both sizes. */
.nav-panel__foot > .availability { justify-self: start; }
.field-settings { display: grid; gap: var(--foot-gap); }
.field-settings__head {
  font-size: var(--fs-caption); line-height: var(--lh-caption);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--content-tertiary); margin: 0;
}
.field-settings__rows { display: grid; gap: 0; }
.field-settings__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-12); min-height: 40px;
}
.field-settings__row > .t-footnote,
.field-settings__key {
  font-size: var(--fs-caption); line-height: var(--lh-caption);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--content-tertiary); flex: none;
}

/* Two boxed options with a 1px gutter — not a shared border, so the
   selected one can carry its own full outline. */
.seg { display: flex; gap: 1px; flex: none; }
.seg__btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-4);
  width: 120px; min-height: 40px;
  /* Figma's 1px stroke sits outside the 40/44 box; border-box puts it
     inside, so the padding gives that pixel back on each edge. */
  padding: calc(var(--space-8) - 1px) var(--space-8);
  border: 1px solid var(--border-default);
  font-size: var(--fs-body); line-height: var(--lh-body);
  letter-spacing: var(--ls-none); text-transform: none;
  color: var(--content-subtle);
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.seg__btn .ico { width: 24px; height: 24px; flex: none; }
.seg__btn:hover:not([disabled]):not(.is-on) {
  color: var(--content-secondary); border-color: var(--border-strong);
}
.seg__btn.is-on { border-color: var(--interactive-default); color: var(--content-primary); }
.seg__btn[disabled] { color: var(--interactive-disabled-50); cursor: not-allowed; }

/* ---------- AVAILABILITY ---------- */
.availability {
  display: flex; align-items: flex-start; gap: var(--space-8);
  min-height: 44px; padding: var(--space-12) 14px;
  border-radius: 8px;
  background: var(--status-success-subtle);
  color: var(--status-success);
  font-size: var(--fs-caption); line-height: var(--lh-caption);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  margin: 0;
}
/* The marker is an 8px dot, centerd on the first line of type. */
.availability::before {
  content: ""; flex: none;
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
  margin-top: calc((var(--lh-caption) - 8px) / 2);
}

@media (min-width: 768px) {
  .nav-panel {
    --menu-pt: 8px;
    --menu-h: 96px;
    --foot-py: 36px;
    --foot-gap: var(--space-20);
  }
  .nav-panel__links { align-content: start; }
  /* Tablet sets the two controls side by side, the second flushed right. */
  .field-settings { gap: var(--space-12); }
  .field-settings__rows {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-12);
  }
  .field-settings__row { justify-content: flex-start; gap: var(--space-24); min-height: 44px; }
  .field-settings__row:last-child { justify-content: flex-end; }
  .seg__btn { min-height: 44px; }
}

/* ---------- TICKER ----------
   Two identical groups; translating -50% loops seamlessly. */
/* The track holds two identical groups, so translating it by exactly half
   its width lands group 2 where group 1 started — the loop is seamless and
   never resets visibly. */
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- FILE CARD (record + scope) ---------- */
/* Figma: a 44px row, label and value side by side — label 84 wide at
   14px in content/tertiary, value 16px in content/primary, 12 apart.
   I had them stacked, the label in brand/primary, the value one step
   too small and a shade too light. */
.field {
  display: grid; grid-template-columns: 84px minmax(0, 1fr);
  align-items: baseline; gap: var(--space-12);
  min-height: 40px; padding-block: 10px;
  border-bottom: 1px solid var(--border-strong);
}
.field__label {
  font-size: var(--fs-caption); line-height: var(--lh-caption);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--content-tertiary);
}
.field__value {
  font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--content-primary); text-align: right;
}

/* The availability note is its own block in the right column, on
   status/success/subtle at radius 8 — not an inline tag.

   The marker is the 8px dot, same as every other availability in the
   file. I had swapped it for a CheckCircle: a check says "done", and
   what this states is that a channel is open. Figma draws an ellipse. */
.availability--block {
  align-items: flex-start;
  min-height: 64px; border-radius: 8px;
  padding: var(--space-12) var(--space-16);
  gap: var(--space-8);
  text-transform: none; letter-spacing: var(--ls-none);
  font-size: var(--fs-caption); line-height: var(--lh-caption);
  margin-top: var(--space-8);
}
/* Sits on the first line, not centerd against a two-line block. */
.availability--block::before { margin-top: 6px; }

/* ---------- TAG ----------
   Figma set 86:1005, two variants. Not a pill with a dot — I had
   invented that. Each is a 20px-tall row of icon + 14px label at a 4px
   gap, and the icon is what distinguishes them.

   completed  CheckCircle, status/success, no background
   classified LockKey, pale label on bg/inverse — the only one that
              carries a plate, which is what makes it read as a stamp */
.tag {
  display: inline-flex; justify-self: start; align-items: center;
  gap: var(--space-4);
  min-height: 20px;
  font-size: var(--fs-caption); line-height: var(--lh-caption);
  letter-spacing: var(--ls-none); text-transform: uppercase;
  color: var(--status-success);
}
.tag .ico { width: 16px; height: 16px; }

.tag--classified {
  padding-inline: var(--space-8);
  background: var(--bg-inverse);
  color: var(--status-warning-subtle);
}

/* ---------- THE LOCK ----------
   The padlock shuts as the card lands: the file classifies itself in
   front of you. Two stacked icons cross-fading, which is why the
   shackle appears to snap down — Phosphor draws it raised in
   LockKeyOpen and seated in LockKey.

   Shut is the resting state, so with no JS, no motion preference, or a
   card that never animates, the icon tells the truth. The open frame
   only exists during the animation. Runs once, on entry — a lock that
   keeps re-locking on a loop would pull the eye off the work. */
.lock { display: inline-grid; width: 16px; height: 16px; flex: none; }
.lock .ico { grid-area: 1 / 1; width: 16px; height: 16px; }
.lock__open { opacity: 0; }
.lock__shut { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .op-card.is-in .lock__open {
    animation: lock-open 1.2s var(--ease-out) both;
    animation-delay: calc(var(--i) * var(--stagger) + 260ms);
  }
  .op-card.is-in .lock__shut {
    animation: lock-shut 1.2s var(--ease-snap) both;
    animation-delay: calc(var(--i) * var(--stagger) + 260ms);
  }
}
/* Pure cross-fade. The scale pulse I had made the lock read as sliding
   into the word next to it rather than shutting in place — at 16px a
   6% bounce is a pixel of travel, and a pixel of travel beside static
   text looks like the two are colliding. The shackle change carries
   the gesture on its own. */
@keyframes lock-open {
  0%, 46%   { opacity: 1; }
  62%, 100% { opacity: 0; }
}
@keyframes lock-shut {
  0%, 46%   { opacity: 0; }
  62%, 100% { opacity: 1; }
}
/* Nothing in the lock may move: both frames occupy the same 16px grid
   cell and only their opacity changes. No transform, no layout. */
.lock, .lock .ico { transform: none !important; }


/* ---------- SECTION INDEX (desktop only) ---------- */

/* ---------- DOCUMENT LOG (timeline) ---------- */
@media (min-width: 768px) {
}

/* ---------- METRIC GRIDS ---------- */

/* ---------- PROCESS STEPS ---------- */

/* ---------- RESEARCH FINDINGS ---------- */

/* ---------- TOKEN CAROUSEL ---------- */


/* ---------- THEME LOOP (4 themes, CSS only) ----------
   Landscape iPad mockups (1.275) with a transparent drop shadow,
   centerd inside a 3:2 stage. Timing is driven by two variables:
   change --loop-hold and the keyframe percentages follow. */
.theme-loop {
  position: relative;
  aspect-ratio: 3 / 2;
  background: var(--bg-primary);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;          /* centers both axes */
  overflow: hidden;
  /* 4 slides x (2.4s hold + 0.5s cross-fade) */
  --loop-cycle: 11.6s;
}
.theme-loop img {
  grid-area: 1 / 1;
  justify-self: center; align-self: center;
  max-width: 85%; max-height: 83%;   /* 10% smaller than before */
  width: auto; height: auto;
  object-fit: contain;
  opacity: 0;
  animation: theme-fade var(--loop-cycle) linear infinite;
}
.theme-loop img:nth-child(1) { animation-delay: 0s; }
.theme-loop img:nth-child(2) { animation-delay: calc(var(--loop-cycle) * 0.25); }
.theme-loop img:nth-child(3) { animation-delay: calc(var(--loop-cycle) * 0.5); }
.theme-loop img:nth-child(4) { animation-delay: calc(var(--loop-cycle) * 0.75); }

/* Of the 11.6s cycle: 0.5s in (4.31%), 2.4s hold (to 25%),
   0.5s out (to 29.31%), then invisible until its next turn. */
@keyframes theme-fade {
  0%      { opacity: 0; }
  4.31%   { opacity: 1; }
  25%     { opacity: 1; }
  29.31%  { opacity: 0; }
  100%    { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-loop img { animation: none; opacity: 0; }
  .theme-loop img:nth-child(1) { opacity: 1; }
}

/* ---------- CONTACT CARD (case study) ----------
   Renamed from .comms: the home now has a section by that name, and
   this bordered card was leaking its stroke and surface onto it. Two
   different things, two names. */
.copy-btn {
  font-size: var(--fs-footnote); letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--brand-primary); flex: none;
}
.copy-btn:active { transform: scale(0.96); }

/* ---------- NEXT OPERATION ---------- */

/* ---------- FOOTER ---------- */
/* ---------- FOOTER ----------
   Figma "Coordinates and Copyright": no rule above it and no surface —
   just two centerd lines in content/subtle, 10px on phone and tablet,
   12 on desktop, with 56/64 of air. The lines stack below 1024 and sit
   side by side on desktop at a 6px gap.

   I had a 1px top border and content/tertiary; neither is in the file.
   The section already ends on the dashed rule of the last FREQ row, so
   a second line straight after it read as a double. */
.footer {
  position: relative; isolation: isolate;
  display: grid; gap: 6px;
  justify-items: center; text-align: center;
  padding: var(--space-56) var(--margin-page);
  color: var(--content-subtle);
  --sig-x: 154px; --sig-top: 54px;
}

/* The signature is the first child in the file, so it paints behind
   the lines — a watermark, not a label. status/success/subtle, which
   is why it is recolored to currentColor on the way into the sprite:
   the mark flips with the theme instead of staying mint on navy.

   min() keeps it inside the viewport. Figma's +154 offset from center
   would put its right edge at 446 on a 375 phone and hand the page
   back its horizontal scrollbar. */
.footer__signature {
  position: absolute; z-index: -1;
  top: var(--sig-top);
  left: 50%;
  margin-left: min(var(--sig-x), 50vw - 105px - var(--space-20));
  width: 105px; height: 80px;
  color: var(--status-success-subtle);
  pointer-events: none;
}
.footer__line {
  margin: 0;
  font-size: var(--fs-footnote); line-height: var(--lh-footnote);
  letter-spacing: var(--ls-label); text-transform: uppercase;
}
/* Not in the design — your line. Kept a step quieter than the record
   itself, so the credit reads as a signature and not as a claim. */
.footer__made { color: var(--content-subtle); opacity: 0.8; }

@media (min-width: 1024px) {
  .footer {
    grid-auto-flow: column; justify-content: center;
    padding-block: var(--space-64);
    --sig-x: 315px; --sig-top: 59px;
  }
}

/* ---------- TERMINAL TYPE ----------
   Section labels print themselves in, character by character, with a
   block caret running ahead of the text. Scoped to the labels on
   purpose: they are short, monospaced and already read like terminal
   output. Typing a paragraph would hold the content hostage for
   seconds, which is the one thing spec §0 says never to do.

   clip-path, not a width or a text swap: it only affects painting, so
   the text is in the DOM from the first frame — selectable, findable,
   read in full by a screen reader — and nothing reflows.

   The clip is on an inner span, not on the label, because the caret
   has to sit outside it: clipped along with the text, it would only
   appear at the very end. The caret travels in 1ch steps on the same
   step count, which lands it exactly on the reveal edge — that only
   works because the label is monospaced.

   The hidden state lives inside no-preference: with reduced motion the
   global rule kills animations, and a span left clipped to zero would
   simply never appear. */
@media (prefers-reduced-motion: no-preference) {
  .js .type { position: relative; }
  .js .type .type__text { clip-path: inset(0 100% 0 0); display: inline-block; }
  /* both fills wait out the delay, so a queued line shows nothing at
     all until its turn — not a stray caret sitting on empty space */
  .js .type.is-typed .type__text {
    animation: type-in var(--type-dur, 600ms) var(--type-delay, 0ms) both;
  }

  .type__caret {
    position: absolute; left: 0; top: 50%;
    width: 0.6ch; height: 1em; margin-top: -0.5em;
    background: currentColor;
    animation: caret-move var(--type-dur, 600ms) var(--type-delay, 0ms) both,
               caret-blink 640ms steps(1) var(--type-delay, 0ms) infinite both;
  }
  .js .type.is-done .type__caret { display: none; }
}
@keyframes type-in    { to { clip-path: inset(0 0 0 0); } }
@keyframes caret-move { to { transform: translateX(calc(var(--chars, 0) * 1ch)); } }
@keyframes caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ---------- SCROLL REVEAL ---------- */
.js .reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ===================================================================
   UX CASE STUDY — Figma P-01 Foundations (1029:3475)
   Content column is 1024 at 1440 (208 page margin each side). Below
   1024 everything collapses to one column and the 492/640/304 splits
   become full width.
   =================================================================== */

/* ---------- SECTION SCAFFOLD ----------
   Figma: section padding 80/208, label row then content at gap 32
   (01–03) or 24 (04–06). --case-gap carries that difference. */
.case-sec, .case-head__inner {
  display: grid; gap: var(--case-gap, var(--space-32));
  /* No width here. `.section > :not(.bleed)` already gives these a definite
     width including the page margin; setting width:100% at the same
     specificity beat that rule and ran every section edge to edge. */
  min-width: 0;
}
/* Sections 01–03 nest the label and split in a wrapper at gap 32 and put
   56 before the trailing block; 04–06 run flat at 24. Rather than add a
   wrapper element, the trailing block makes up the 24px difference. */
@media (min-width: 1024px) {
  .case-sec:not(.case-sec--tight) > .media,
  .case-sec:not(.case-sec--tight) > .findings-block { margin-top: var(--space-24); }
}

/* The numbered rail: accent numeral, 12px gap, tertiary label. Both are
   fs16/24 in Figma — the label is NOT the 10px tracked caption used on
   the home. */
.sec-rail, .op-row {
  display: flex; align-items: center; gap: var(--space-12);
  margin: 0; min-width: 0;
}
.op-row { justify-content: space-between; }
.sec-rail__num, .op-row__file {
  font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--content-accent);
  font-variant-numeric: tabular-nums; flex: none;
}
.sec-rail .section-label, .op-row .section-label {
  font-size: var(--fs-body); line-height: var(--lh-body);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--content-tertiary);
}

/* ---------- SPLITS ----------
   Three ratios out of Figma. Careful with the gutters: 01 and 05 are
   space-between frames whose declared itemSpacing is never applied —
   two 492 halves in a 1024 column leave a real gap of 40, not the 80
   or 24 the file claims. Only 02/06 and 03 use a literal gutter.
   .split        492 | 492  gap 40   (01 Context, 05 Results)
   .split--wide  640 | 304  gap 80   (title block, 02 My role, 06)
   .split--bottom 492 | 452 gap 80   (03 Process, bottom-aligned) */
.split {
  display: grid; gap: var(--space-32); min-width: 0;
  align-items: start;
}
@media (min-width: 1024px) {
  .split, .split--even {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px;
  }
  .split--wide {
    grid-template-columns: minmax(0, 640px) minmax(0, 304px);
    gap: 80px; justify-content: space-between;
  }
  .split--bottom {
    grid-template-columns: minmax(0, 492px) minmax(0, 452px);
    gap: 80px; justify-content: space-between; align-items: end;
  }
}
.case-sec__narrative, .case-head__text {
  display: grid; gap: var(--space-24); align-content: start; min-width: 0;
}
@media (min-width: 1024px) { .case-head__text { gap: var(--space-32); } }

.case-title {
  font-family: var(--font-serif); font-weight: var(--weight-semibold);
  font-size: var(--fs-display); line-height: var(--lh-display);
  letter-spacing: var(--ls-none); color: var(--content-primary);
  margin: 0;
}

/* ---------- FULL-BLEED COVER ----------
   Figma 1440x640 = 2.25:1, flush under the nav, no radius. */
.cover { width: 100%; }
.cover img { display: block; width: 100%; height: auto; aspect-ratio: 2.25; object-fit: cover; }

/* ---------- TICKER ----------
   Figma has this on bg/secondary with tertiary type — not the dark bar
   it used to be. 46px tall = 14 + 18 + 14. */
.ticker {
  background: var(--bg-secondary);
  border-block: 1px solid var(--border-default);
  overflow: hidden;
  padding-block: 14px;
  --ticker-speed: 48s;
}
.ticker__track { display: flex; width: max-content; animation: ticker-scroll var(--ticker-speed) linear infinite; }
.ticker:focus-within .ticker__track, .ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__group { display: flex; flex-shrink: 0; }
.ticker__item {
  font-size: var(--fs-caption); line-height: 18px;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--content-tertiary);
  white-space: nowrap;
}
/* The separator is a brand-colored dot flanked by wide space — Figma
   draws it as its own 67px text node rather than as padding. */
.ticker__item::after {
  content: "·"; color: var(--brand-primary);
  letter-spacing: 0; padding-inline: 30px;
}
@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
  .ticker { overflow-x: auto; }
}

/* ---------- DATA RECORD ----------
   Case-study fields stack: label over value, both fs16/24, 12px block
   padding, hairline under each. Distinct from the home's profile .field,
   which is a two-column label/value row. */
.record { display: grid; min-width: 0; }
.record .field {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 2px; align-items: start;
  min-height: 72px; padding-block: var(--space-12);
  border-bottom: 1px solid var(--border-default);
}
.record .field__label {
  font-size: var(--fs-body); line-height: var(--lh-body);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--content-tertiary);
}
.record .field__value {
  font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--content-primary); text-align: left;
}
/* Figma right-aligns the last field's value, because it carries the tag. */
.record .field--end .field__value { justify-self: end; text-align: right; }

/* ---------- DOCUMENT LOG ----------
   Four columns at 238 with a 24 gutter; the year sits above a rule and
   the note hangs below it. Stacks below 768. */
.log { display: grid; gap: var(--space-24); min-width: 0; }
@media (min-width: 768px) { .log { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.log__col { display: grid; gap: var(--space-12); padding-block: var(--space-12); align-content: start; }
.log__year {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  letter-spacing: var(--ls-num); color: var(--content-accent);
  font-variant-numeric: tabular-nums;
}
.log__text {
  margin: 0; padding-top: var(--space-16);
  border-top: 1px solid var(--border-strong);
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-primary);
}

/* ---------- PROCESS STEPS ----------
   Numeral, 40px gutter, then title over its note. Hairline between
   steps, none after the last. */
.steps { display: grid; min-width: 0; }
.step {
  display: grid; grid-template-columns: 20px minmax(0, 1fr);
  gap: var(--space-24); align-items: start;
  padding-block: var(--space-16);
  border-bottom: 1px solid var(--border-default);
}
@media (min-width: 1024px) { .step { gap: 40px; } }
.step:last-child { border-bottom: 0; }
.step__num {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-accent); font-variant-numeric: tabular-nums;
}
.step__body { display: grid; gap: var(--space-4); min-width: 0; }
.step__title {
  font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--content-primary);
}
.step__text {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-tertiary);
}
/* Figma bottom-aligns the illustration with the last step. */
.media--process { align-self: end; }

/* ---------- RESEARCH FINDINGS ---------- */
.findings-block { display: grid; gap: var(--space-32); min-width: 0; }
.findings { display: grid; gap: var(--space-32); min-width: 0; }
@media (min-width: 768px) { .findings { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.finding {
  display: grid; gap: var(--space-20); align-content: start;
  padding: var(--space-24) var(--space-20);
  background: var(--surface-card1); border-radius: var(--radius-card);
}
.finding__id {
  font-size: var(--fs-footnote); line-height: var(--lh-footnote);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--brand-primary);
}
.finding__quote {
  margin: 0;
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-secondary);
}
.findings__source {
  margin: 0; max-width: 640px;
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-subtle);
}

/* ---------- SYSTEM DECISIONS ----------
   Figma sets these as a single Space Mono Regular run — no bold lead-in,
   so there is no <strong> to style. */
.decisions { display: grid; gap: var(--space-24); min-width: 0; }

/* ---------- TOKEN CAROUSEL ----------
   The bar is a MenuRow: rules top and bottom, title inline with its
   note, bare caret buttons (not the circled ones I had). */
/* 290 at Figma's 375 frame, 774 at its 1440 one; fluid between, and it
   can never outgrow the narrowest column it has to sit in. */
.carousel {
  display: grid; gap: var(--space-20); min-width: 0;
  --slide-w: clamp(240px, 78vw, 774px);
}
.carousel__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-16); min-height: 80px; padding-block: var(--space-20);
  border-block: 1px solid var(--border-strong);
}
.carousel__title {
  margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-16);
  /* Regular, not semibold: the only Fraunces Regular in the whole page. */
  font-family: var(--font-serif); font-weight: var(--weight-regular);
  font-size: var(--fs-title-3); line-height: var(--lh-title-3);
  color: var(--content-primary);
}
.carousel__note {
  font-family: var(--font-mono); font-weight: var(--weight-regular);
  font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--content-tertiary);
}
.carousel__controls { display: flex; align-items: center; gap: var(--space-24); flex: none; }
.carousel__count {
  font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--content-accent); font-variant-numeric: tabular-nums;
}
.carousel__btn {
  width: 24px; height: 24px; display: grid; place-items: center;
  color: var(--interactive-default);
  transition: color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-snap);
}
.carousel__btn .ico { width: 24px; height: 24px; }
.carousel__btn:hover:not([disabled]) { color: var(--interactive-hover); }
.carousel__btn:active { transform: scale(0.9); }
.carousel__btn[disabled] { color: var(--interactive-disabled-50); cursor: not-allowed; }
.carousel__track {
  display: flex; gap: 40px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  /* The rail is inset by half the leftover so the active slide sits dead
     centre and its neighbours peek — 125 a side at Figma's 1024 column.
     The slide width has to be a length, never a percentage: a percentage
     flex-basis resolves against the track's CONTENT box, which this very
     padding shrinks, so the two would chase each other. */
  padding-inline: max(0px, calc((100% - var(--slide-w)) / 2));
  scroll-padding-inline: max(0px, calc((100% - var(--slide-w)) / 2));
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__slide {
  flex: 0 0 var(--slide-w);
  scroll-snap-align: center;
  aspect-ratio: 774 / 670;
  border-radius: var(--radius-default);
}
/* The centred slide reads at full strength, the neighbours fall back to
   half so it is obvious which one is current. Gated on .js: without it
   nothing marks the active slide, and every image would sit at 50%. */
.js .carousel__slide {
  opacity: 0.5;
  transition: opacity var(--dur-base) var(--ease-out);
}
.js .carousel__slide.is-active { opacity: 1; }

/* ---------- FIELD DATA ----------
   A bordered table, not a loose grid: one outer rule with radius 32 and
   a rule between every cell. Overflow hidden so the corners clip. */
.field-data {
  display: grid; grid-template-columns: minmax(0, 1fr);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-default);
  overflow: hidden; min-width: 0;
}
@media (min-width: 768px) { .field-data { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.field-data .metric {
  display: grid; gap: var(--space-4); align-content: start;
  min-height: 120px; padding: var(--space-24) var(--space-20);
  /* Shared edges: every cell draws its right and bottom rule, and the
     container clips the ones that fall on the outer edge. */
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  margin-right: -1px; margin-bottom: -1px;
}
@media (min-width: 1024px) {
  .field-data .metric { min-height: 168px; padding: 40px 64px; }
}
.metric__value {
  font-family: var(--font-serif); font-weight: var(--weight-semibold);
  font-size: var(--fs-title-1); line-height: var(--lh-title-1);
  letter-spacing: var(--ls-none); color: var(--content-primary);
}
.metric__label {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-tertiary);
}

/* ---------- RESULTS METRIC ROWS ----------
   Value left, label right, both sitting on the row's baseline, hairline
   under each. Replaces the borderless 3-up grid. */
.business-value { max-width: 492px; }
.metric-rows { display: grid; min-width: 0; }
.metric-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-16);
  padding-block: var(--space-16);
  border-bottom: 1px solid var(--border-default);
}
.metric-row__value {
  font-family: var(--font-serif); font-weight: var(--weight-semibold);
  font-size: var(--fs-title-2); line-height: var(--lh-title-2);
  letter-spacing: var(--ls-none); color: var(--content-primary);
  flex: none;
}
.metric-row__label {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-tertiary); text-align: right;
}

/* ---------- PULL QUOTE ----------
   Figma keeps this in the body face, not the serif display face. */
.pull-quote {
  display: grid; gap: var(--space-16); align-content: start;
  margin: 0; padding: var(--space-24);
  background: var(--surface-default); border-radius: 24px;
}
@media (min-width: 1024px) { .pull-quote { padding: 40px; } }
.pull-quote__text {
  margin: 0;
  font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--content-secondary);
}
.pull-quote__by { display: grid; gap: 2px; }
.pull-quote__name {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-accent);
}
.pull-quote__role {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-tertiary);
}

/* ---------- COMMS CTA ----------
   A 640 card centerd in the column, on the mint surface, radius 16. */
.comms-cta { justify-items: center; }
.open-channel {
  display: grid; gap: var(--space-16); align-content: start;
  max-width: 640px;
  padding: var(--space-32) var(--space-24);
  background: var(--surface-card2); border-radius: 16px;
}
@media (min-width: 1024px) { .open-channel { padding: 64px; } }
.open-channel__label {
  margin: 0;
  font-size: var(--fs-body); line-height: var(--lh-body);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--status-success);
}
.open-channel__title {
  margin: 0;
  font-family: var(--font-serif); font-weight: var(--weight-semibold);
  font-size: var(--fs-title-3); line-height: var(--lh-title-3);
  color: var(--content-primary);
}
.open-channel__note {
  margin: 0;
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-tertiary);
}
.mail-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-12); min-height: 44px;
  padding: var(--space-12) var(--space-20);
  background: var(--surface-default); border-radius: 8px;
}
@media (min-width: 1024px) { .mail-row { padding-inline: var(--space-32); } }
.mail-row__addr {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-primary); overflow-wrap: anywhere;
}
.mail-row__copy {
  flex: none;
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--content-link);
  transition: color var(--dur-fast) var(--ease-out);
}
.mail-row__copy:hover { color: var(--interactive-hover); }

/* ---------- NEXT OPERATION ----------
   The same MenuRow as the nav panel, with the name over its gloss and a
   double caret. No numeral column here. */
.next-section { padding-block-start: 0; }
.menu-row--next {
  grid-template-columns: minmax(0, 1fr) 24px;
  border-top: 0;
}
.menu-row--next .menu-row__name { font-size: var(--fs-title-2); line-height: var(--lh-title-2); }
.menu-row--next .ico { color: var(--content-tertiary); }

/* ---------- SECTION INDEX (fixed rail, ≥1280) ---------- */
.index {
  position: fixed; left: 48px; top: 50%;
  transform: translateY(-50%);
  z-index: 30; display: none; gap: var(--space-20);
  grid-auto-flow: row;
  /* Hidden while the hero is on screen — it has nothing to point at yet,
     and it competes with the cover. JS adds .is-visible once the title
     block has scrolled past. */
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
}
.index.is-visible {
  opacity: 1; visibility: visible;
  transition: opacity var(--dur-base) var(--ease-out), visibility 0s;
}
@media (min-width: 1360px) { .index { display: grid; } }
.index__item {
  display: flex; align-items: center; gap: var(--space-12);
  font-size: var(--fs-footnote); line-height: var(--lh-footnote);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--brand-primary);
  text-decoration: none;
  transition: opacity var(--dur-fast) var(--ease-out);
  opacity: 0.6;
}
/* Figma: the active item's dot is filled, the rest are outlined. */
.index__item::before {
  content: ""; flex: none;
  width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid currentColor;
  transition: background var(--dur-fast);
}
.index__item:hover { opacity: 0.9; }
.index__item.is-active { opacity: 1; }
.index__item.is-active::before { background: currentColor; }

/* The metric block carries its own provenance line — a survey result with
   no method stated reads as a guess. */
.metric-rows__source {
  margin: var(--space-16) 0 0;
  font-size: var(--fs-footnote); line-height: var(--lh-footnote);
  color: var(--content-subtle);
}

/* ===================================================================
   UX CASE STUDY — MOBILE (Figma P-01 Foundations Mobile, 1029:3198)
   Mobile is not a narrowed desktop: several components change shape,
   not just size. Written mobile-first here, with the desktop values in
   the ≥1024 blocks above and below.
   =================================================================== */

/* Figma: 32/20 on the case study, against 24/20 on the home. */
[data-page="case"] .section { padding-block: var(--padding-section-lg); }
/* Field data is deliberately airier — 80 top and bottom at both sizes. */
[data-page="case"] .section--data { padding-block: var(--space-80); }

/* Section rhythm: 16 between blocks on mobile, 12 in the title block. */
.case-sec { --case-gap: var(--space-16); }
.case-sec--tight { --case-gap: var(--space-16); }
.case-sec--data  { --case-gap: var(--space-24); }
.case-head__inner { --case-gap: var(--space-12); }
@media (min-width: 1024px) {
  .case-sec { --case-gap: var(--space-32); }
  .case-sec--tight { --case-gap: var(--space-24); }
  .case-sec--data  { --case-gap: var(--space-24); }
  /* Figma desktop title block is 56; this was missing, so it inherited the
     mobile 12 because --case-gap was always defined and the fallback in the
     old rule could never fire. */
  .case-head__inner { --case-gap: var(--space-56); }
}

/* The rail is one step down on mobile: 14/20 rather than 16/24. */
.sec-rail__num, .op-row__file,
.sec-rail .section-label, .op-row .section-label {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
}
@media (min-width: 1024px) {
  .sec-rail__num, .op-row__file,
  .sec-rail .section-label, .op-row .section-label {
    font-size: var(--fs-body); line-height: var(--lh-body);
  }
}

/* The cover is cropped shorter on mobile — 375x220, not the 2.25:1 of
   the desktop frame. */
.cover img { aspect-ratio: 375 / 220; }
@media (min-width: 768px) { .cover img { aspect-ratio: 2.25; } }

/* Ticker: 39 tall on mobile (12 + 15 + 12) at 10px, 46 at 12px above. */
.ticker { padding-block: var(--space-12); }
.ticker__item { font-size: var(--fs-footnote); line-height: 15px; }
.ticker__item::after { padding-inline: 24px; }
@media (min-width: 768px) {
  .ticker { padding-block: 14px; }
  .ticker__item { font-size: var(--fs-caption); line-height: 18px; }
  .ticker__item::after { padding-inline: 30px; }
}

/* ---------- RECORD: two shapes, not two sizes ----------
   Mobile is a label/value row, 44 tall. Desktop stacks them at 72. */
.record .field {
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-12); align-items: baseline;
  min-height: 44px;
}
.record .field__label, .record .field__value {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
}
.record .field__value { text-align: right; }
/* No Tag component on mobile — the status is plain success-colored text. */
.record .tag .ico { display: none; }
@media (min-width: 1024px) {
  .record .field {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px; align-items: start; min-height: 72px;
  }
  .record .field__label, .record .field__value {
    font-size: var(--fs-body); line-height: var(--lh-body);
  }
  .record .field__value { text-align: left; }
  .record .field--end .field__value { text-align: right; }
  .record .tag .ico { display: block; }
}

/* ---------- DOCUMENT LOG ----------
   Mobile is a two-column table with a DATE / ACTIVITY header; desktop is
   four columns with the year above a rule. */
.log { display: grid; gap: 0; }
.log__head {
  display: grid; grid-template-columns: 44px minmax(0, 1fr);
  gap: var(--space-12); padding-block: var(--space-12);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--fs-caption); line-height: var(--lh-caption);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--content-tertiary);
}
.log__col {
  display: grid; grid-template-columns: 44px minmax(0, 1fr);
  gap: var(--space-12); padding-block: var(--space-12);
  border-bottom: 1px solid var(--border-default);
}
.log__year, .log__text {
  font-size: var(--fs-caption); line-height: var(--lh-caption);
}
.log__text { margin: 0; padding-top: 0; border-top: 0; color: var(--content-primary); }
@media (min-width: 768px) {
  .log { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-24); }
  .log__head { display: none; }
  .log__col {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-12); border-bottom: 0; align-content: start;
  }
  .log__year { font-size: var(--fs-callout); line-height: var(--lh-callout); }
  .log__text {
    padding-top: var(--space-16);
    border-top: 1px solid var(--border-strong);
    font-size: var(--fs-callout); line-height: var(--lh-callout);
  }
}

/* ---------- STEPS ---------- */
.step { gap: var(--space-16); }
.step__num { font-size: var(--fs-caption); line-height: var(--lh-caption); }
@media (min-width: 1024px) {
  .step__num { font-size: var(--fs-callout); line-height: var(--lh-callout); }
}

/* ---------- FINDINGS ----------
   Mobile drops the card and marks the quote with a left accent rule
   instead; the "Finding 01" label is not in the mobile frame. */
.findings { gap: var(--space-16); }
.finding {
  gap: 0; padding: var(--space-16);
  border-radius: var(--radius-card);
}
.finding__id { display: none; }
.finding__quote { font-size: var(--fs-caption); line-height: var(--lh-caption); }
.findings__source { font-size: var(--fs-caption); line-height: var(--lh-caption); }
/* Figma puts the process illustration after the findings on mobile. */
.case-sec .findings-block { order: -1; }
@media (min-width: 1024px) {
  .findings { gap: var(--space-32); }
  .finding {
    gap: var(--space-20); padding: 28px var(--space-32);
    border-radius: var(--radius-card);
  }
  .finding__id { display: block; }
  .finding__quote, .findings__source {
    font-size: var(--fs-callout); line-height: var(--lh-callout);
  }
  .case-sec .findings-block { order: 0; }
}

/* ---------- CAROUSEL ---------- */
.carousel { gap: var(--space-12); }
.carousel__bar { min-height: 92px; gap: var(--space-24); }
/* Mobile stacks the title over its note; desktop sets them side by side. */
.carousel__title { flex-direction: column; gap: var(--space-4); align-items: flex-start; }
.carousel__note { font-size: var(--fs-callout); line-height: var(--lh-callout); }
.carousel__count { font-size: var(--fs-callout); line-height: var(--lh-callout); }
.carousel__track { gap: var(--space-20); }
.carousel__slide { border-radius: var(--radius-default); }
@media (min-width: 1024px) {
  .carousel { gap: var(--space-20); }
  .carousel__bar { min-height: 80px; gap: var(--space-16); }
  .carousel__title { flex-direction: row; gap: var(--space-16); align-items: baseline; }
  .carousel__note, .carousel__count {
    font-size: var(--fs-body); line-height: var(--lh-body);
  }
  .carousel__track { gap: 40px; }
}

/* ---------- FIELD DATA ----------
   Two columns on mobile (168 each), three on desktop (341 each). */
.field-data { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-data .metric { min-height: 144px; padding: var(--space-20) var(--space-24); }
.metric__value { font-size: var(--fs-title-1); line-height: var(--lh-title-1); }
.metric__label { font-size: var(--fs-caption); line-height: var(--lh-caption); }
@media (min-width: 1024px) {
  .metric__label { font-size: var(--fs-callout); line-height: var(--lh-callout); }
}

/* ---------- RESULTS ----------
   Mobile rows are 48 tall at 8px padding; the closing paragraph comes
   last rather than leading the section. */
.metric-row { padding-block: var(--space-8); }
.metric-row__label { font-size: var(--fs-caption); line-height: var(--lh-caption); }
.business-value { order: 1; }
@media (min-width: 1024px) {
  .metric-row { padding-block: var(--space-16); }
  .metric-row__label { font-size: var(--fs-callout); line-height: var(--lh-callout); }
  .business-value { order: 0; }
}

/* ---------- PULL QUOTE / THEME LOOP ----------
   Neither carries a radius in the mobile frame. */
.pull-quote { padding: var(--space-24); border-radius: 0; }
.pull-quote__text { font-size: var(--fs-body); line-height: var(--lh-body); }
.pull-quote__name, .pull-quote__role {
  font-size: var(--fs-caption); line-height: var(--lh-caption);
}
.theme-loop { border-radius: 0; border: 0; }
@media (min-width: 1024px) {
  .pull-quote { padding: 40px; border-radius: var(--radius-card); }
  .pull-quote__name, .pull-quote__role {
    font-size: var(--fs-callout); line-height: var(--lh-callout);
  }
  .theme-loop { border-radius: var(--radius-default); }
}

/* ---------- COMMS ---------- */
.open-channel { padding: var(--space-24); }
.open-channel__label { font-size: var(--fs-callout); line-height: var(--lh-callout); }
.open-channel__note, .mail-row__addr, .mail-row__copy {
  font-size: var(--fs-caption); line-height: var(--lh-caption);
}
.mail-row { padding-inline: var(--space-16); }
@media (min-width: 1024px) {
  .open-channel { padding: 64px; }
  .open-channel__label { font-size: var(--fs-body); line-height: var(--lh-body); }
  .open-channel__note, .mail-row__addr, .mail-row__copy {
    font-size: var(--fs-callout); line-height: var(--lh-callout);
  }
}

/* The next-operation row is inset on mobile, flush to the column above. */
.menu-row--next { padding-inline: var(--space-16); }
@media (min-width: 1024px) { .menu-row--next { padding-inline: 0; } }

/* ===================================================================
   CASE-STUDY HEADER
   The header is not the site nav below desktop. Figma:
     mobile  1029:3199 — [< Back to operations | right rule]  …  [mail cell]
     tablet  1381:3691 — [logo]                               …  [burger cell]
     desktop 1029:3476 — the full site nav
   Height is 56 below desktop on this page, against the home's 56/80.
   =================================================================== */
/* ===================================================================
   CASE-STUDY SCOPE
   Everything the case study needs that differs from the home lives here,
   under [data-page="case"], so the home keeps the values it shipped with.
   The home is NOT to be changed from this block.
   =================================================================== */
[data-page="case"] {
  --nav-h: 56px;
  /* margin/page interpolated 20 -> 40 across 375 -> 768 instead of stepped:
     a step makes the column narrower as the viewport widens (727 at 767,
     688 at 768). Hits Figma's pinned 20 and 40 exactly. */
  --margin-page: clamp(20px, calc(20px + (100vw - 375px) * 0.0509), 40px);
  /* Caps, not widths. Below desktop there is no cap — the margin decides,
     so the column grows with the viewport instead of freezing at 335. */
  --layout-content: 100%;
  --layout-bleed:   100%;
  /* radius/default steps 16 -> 24 -> 32 in the Layout collection. */
  --radius-default: 16px;
}
@media (min-width: 768px) {
  [data-page="case"] { --radius-default: 24px; }
}
@media (min-width: 1024px) {
  [data-page="case"] {
    --nav-h: 96px;
    --layout-content: 1024px;
    --layout-bleed:   1200px;
    --radius-default: 32px;
    /* margin/page is 120 at the Desktop mode. Interpolated 40 -> 120 across
       1024 -> 1440 so the bleed reaches 1200 exactly at 1440 without
       starving the 1024-1280 range, where a flat 120 leaves only 784. */
    --margin-page: clamp(40px, calc(40px + (100vw - 1024px) * 0.1923), 120px);
  }
}

/* The back cell starts flush at x=0, so the header carries no left inset
   until the desktop nav takes over. */
.nav--case { padding-left: 0; }

/* Default everything off, then switch on per breakpoint — cheaper to read
   than four overrides chasing each other. */
.nav--case .nav__back,
.nav--case .nav__logo,
.nav--case .nav__mail,
.nav--case .nav__burger { display: none; }

/* ---- mobile AND tablet: back link + mail ----
   Figma's tablet frame (1381:3691) draws the logo and the burger here
   instead, which drops the only way back to the index. Lore's call: the
   case-study header is the same below desktop. */
@media (max-width: 1023px) {
  .nav--case .nav__back {
    display: inline-flex; align-items: center; gap: var(--space-4);
    align-self: stretch; padding-inline: var(--space-16);
    border-right: 1px solid var(--border-strong);
    color: var(--interactive-default);
    font-size: var(--fs-body); line-height: var(--lh-body);
    text-decoration: none;
  }
  .nav--case .nav__back:hover { color: var(--interactive-hover); text-decoration: none; }
  .nav--case .nav__back .ico { width: 24px; height: 24px; flex: none; }
  .nav--case .nav__mail {
    display: grid; place-items: center;
    width: var(--nav-h); height: var(--nav-h); flex: none;
    border-left: 1px solid var(--border-strong);
    color: var(--interactive-default);
    transition: color var(--dur-fast), background var(--dur-fast);
  }
  .nav--case .nav__mail:hover { color: var(--interactive-hover); background: var(--surface-card1); }
  .nav--case .nav__mail .ico { width: 24px; height: 24px; }
}

/* ---- desktop: the full site nav ---- */
@media (min-width: 1024px) {
  .nav--case .nav__logo { display: inline-flex; }
}


/* ===================================================================
   A·MAR CASE STUDY (Figma 1422:1064)
   Pieces this case needs that Foundations does not. The brand colours
   and faces are A·mar's, not the site's: they appear only inside its
   own artifacts, so they are set on those blocks and never themed.
   =================================================================== */
.cover--brand, .collage, .specimen {
  --amar-wine:  #65243c;
  --amar-plum:  #736574;
  --amar-sage:  #aeb081;
  --amar-mist:  #e8e5e0;
  --amar-cream: #faf6eb;
  --amar-white: #fefcf9;
  --amar-ink:   #3d3d3d;
  --amar-display: "Tenor Sans", serif;
  --amar-text:    "Work Sans", sans-serif;
}

/* Cover: the logotype centred on the wine field, same crop as the photo
   covers (2.25:1, 375/220 on mobile). */
.cover--brand {
  display: grid; place-items: center;
  aspect-ratio: 375 / 220;
  background: var(--amar-wine);
}
@media (min-width: 768px) { .cover--brand { aspect-ratio: 2.25; } }
.cover--brand img {
  width: clamp(160px, 27.8vw, 400px); height: auto; aspect-ratio: 400 / 160;
}

/* 01 collage: four photos, a screen wash over them, and a brand card in
   the middle. Sized in cqw so the card keeps Figma's 240/492 proportion
   at every column width. */
.collage {
  position: relative; container-type: inline-size;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
}
.collage::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: rgba(130, 123, 103, 0.4); mix-blend-mode: screen;
  pointer-events: none;
}
.collage__card {
  position: absolute; z-index: 2; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: grid; width: 48.8cqw;
  padding: 4.88cqw 2.44cqw;
  background: var(--amar-white); text-align: center;
}
.collage__kicker {
  font-family: var(--amar-text); font-size: 1.46cqw; line-height: 1.95cqw;
  letter-spacing: 0.49cqw; text-transform: uppercase; color: var(--amar-ink);
}
.collage__line {
  font-family: var(--amar-display); font-size: 3.41cqw; line-height: 4.39cqw;
  color: var(--amar-wine);
}

/* 03 specimen: 240 | 212 of 452. Wine column carries the type and the
   tagline; the right column stacks the swatches 146/80/80/80/70. */
.specimen {
  position: relative; container-type: inline-size;
  display: grid; grid-template-columns: 240fr 212fr;
  background: var(--amar-cream);
}
.specimen::before { content: ""; grid-area: 1 / 1; background: var(--amar-wine); }
.specimen__type, .specimen__tagline { position: absolute; color: var(--amar-cream); }
.specimen__type {
  left: 3.5cqw; top: 1cqw;
  font-family: var(--amar-display); font-size: 17.7cqw; line-height: 1.25;
}
.specimen__tagline {
  left: 3.54cqw; bottom: 3.54cqw;
  font-family: var(--amar-text); font-size: 3.1cqw; line-height: 1.43;
}
.specimen__swatches { grid-area: 1 / 2; display: grid; grid-template-rows: 146fr 80fr 80fr 80fr 70fr; }
.specimen__swatches i:nth-child(1) { background: var(--amar-plum); }
.specimen__swatches i:nth-child(2) { background: var(--amar-mist); }
.specimen__swatches i:nth-child(3) { background: var(--amar-cream); }
.specimen__swatches i:nth-child(4) { background: var(--amar-white); }
.specimen__swatches i:nth-child(5) { background: var(--amar-sage); }

/* 05 CTA: secondary button over the bare URL. */
.case-cta { display: grid; gap: var(--space-24); justify-items: start; }
.case-cta .btn .ico { width: 24px; height: 24px; }
.case-cta__url {
  font-size: var(--fs-callout); line-height: var(--lh-callout);
  color: var(--content-tertiary);
}

/* ---------- RECAP LOOP (Laboratoria+ Recap, Figma 1528:9787) ----------
   Six full-frame screens instead of four floating mockups: each export
   already carries its stage, so it fills the box. Each screen holds
   3.5s and cross-fades in 0.3s — longer reads, quicker cuts than the
   theme loop. */
.theme-loop--recap { --loop-cycle: 22.8s; }
.theme-loop--recap img {
  max-width: none; max-height: none; width: 100%; height: 100%;
  object-fit: cover;
  animation-name: recap-fade;
}
.theme-loop--recap img:nth-child(2) { animation-delay: calc(var(--loop-cycle) * 1 / 6); }
.theme-loop--recap img:nth-child(3) { animation-delay: calc(var(--loop-cycle) * 2 / 6); }
.theme-loop--recap img:nth-child(4) { animation-delay: calc(var(--loop-cycle) * 3 / 6); }
.theme-loop--recap img:nth-child(5) { animation-delay: calc(var(--loop-cycle) * 4 / 6); }
.theme-loop--recap img:nth-child(6) { animation-delay: calc(var(--loop-cycle) * 5 / 6); }
/* Of the 22.8s cycle: 0.3s in (1.32%), hold to 16.67%, 0.3s out
   (to 17.98%), then invisible until its next turn. */
@keyframes recap-fade {
  0%      { opacity: 0; }
  1.32%   { opacity: 1; }
  16.67%  { opacity: 1; }
  17.98%  { opacity: 0; }
  100%    { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-loop--recap img { animation: none; opacity: 0; }
  .theme-loop--recap img:nth-child(1) { opacity: 1; }
}
