/* Site styles for pruthvirajpudi.com, built on tokens.css (load that file first).

   Layers, lowest to highest priority:
     reset       browser normalisation
     tokens      design tokens (tokens.css)
     base        element defaults: type, links, focus, selection, motion preferences
     layout      page container and section rhythm
     components  everything with a class name, grouped by feature
     utilities   single-purpose helpers that should win (.muted, .sr-only, ...)

   The components below are the pre-redesign set, ported from the old minified style.css
   with their geometry unchanged. They are replaced feature by feature in Phases 4 and 7
   (docs/BUILD-PLAN.md); new components use the type, space and radius tokens directly.

   Legacy breakpoints: 1100px, 800px, 600px, 520px. New components use 560 / 760 / 980 / 1180.
   Legacy measures are in em, converted from the old Manrope ch values: Geist's zero is 9% wider
   than Manrope's while its average glyph is the same width, so ch would lengthen every line. */

@layer reset, tokens, base, layout, components, utilities;

/* ==========================================================================
   Reset
   ========================================================================== */

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

  h1, h2, h3, h4, p {
    margin: 0;
  }

  img {
    display: block;
    max-width: 100%;
    height: auto;
  }

  svg {
    display: block;
  }

  [hidden] {
    display: none !important;
  }

  /* Controls that only work with js/main.js; the head script sets data-js before the first paint. */
  :root:not([data-js]) [data-js-only] {
    display: none !important;
  }

  button,
  select {
    font: inherit;
  }

  button {
    cursor: pointer;
  }

  button:disabled {
    cursor: default;
  }

  button, a, summary, select {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

@layer base {
  html {
    scroll-padding-top: 108px;
  }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: var(--weight-regular) var(--text-body) / var(--leading-body) var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1, h2, h3 {
    letter-spacing: -0.04em;
    text-wrap: balance;
  }

  h1, h2 {
    font-weight: var(--weight-semibold);
    line-height: 1.08;
  }

  h1 {
    font-size: clamp(3rem, 6.5vw, 6rem);
  }

  h2 {
    font-size: clamp(2.3rem, 4.3vw, 4rem);
  }

  h3, h4 {
    line-height: 1.3;
  }

  em {
    font-style: normal;
    color: var(--rust-text);
  }

  p + p {
    margin-top: 1em;
  }

  a {
    color: inherit;
    text-underline-offset: 5px;
  }

  a:hover {
    color: var(--rust-text);
  }

  /* One focus ring everywhere: 3px, offset, in the action colour for each theme. */
  :focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 5px;
  }

  main:focus {
    outline: none;
  }

  ::selection {
    background: var(--ink);
    color: var(--bg);
  }

  @media (max-width: 520px) {
    html {
      scroll-padding-top: 96px;
    }
  }

  /* Cross-document page transitions; browsers without support load pages normally. */
  @view-transition {
    navigation: auto;
  }

  @media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root) {
      animation-duration: 120ms;
    }

    ::view-transition-new(root) {
      animation-duration: 280ms;
    }
  }

  /* A theme switch opens the new theme as a circle from the button (js/main.js animates the clip-path),
     so the default cross-fade is off for it. */
  :root.theme-vt::view-transition-old(root),
  :root.theme-vt::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation: none !important;
      transition: none !important;
      scroll-behavior: auto !important;
    }

    ::view-transition-group(*) {
      animation: none !important;
    }
  }

  /* The footer switch turned motion off: the same as the OS setting, page transitions included. */
  :root[data-motion="off"] *,
  :root[data-motion="off"] *::before,
  :root[data-motion="off"] *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  :root[data-motion="off"]::view-transition-group(*),
  :root[data-motion="off"]::view-transition-old(*),
  :root[data-motion="off"]::view-transition-new(*) {
    animation: none !important;
  }
}

/* ==========================================================================
   Layout
   ========================================================================== */

@layer layout {
  /* Legacy container: 1380px. The Signal v2 container is --container (1280px). */
  .shell {
    max-width: 1380px;
    margin: auto;
    padding-inline: 48px;
    min-width: 0;
  }

  .section {
    padding-block: var(--space-16);
  }

  .section.compact {
    padding-top: var(--space-1);
  }

  @media (max-width: 1100px) {
    .shell {
      padding-inline: 36px;
    }
  }

  @media (max-width: 800px) {
    .shell {
      padding-inline: 28px;
    }

    .section {
      padding-block: var(--space-12);
    }
  }

  @media (max-width: 520px) {
    .shell {
      padding-inline: 22px;
    }

    .section {
      padding-block: var(--space-10);
    }

    .section.compact {
      padding-top: 0;
    }
  }
}

/* ==========================================================================
   Components
   ========================================================================== */

@layer components {
  /* ---- Icons ---------------------------------------------------------- */

  .icon {
    width: 1.15em;
    height: 1.15em;
    display: inline-block;
    vertical-align: -0.18em;
    flex-shrink: 0;
    fill: currentColor;
  }

  /* The signal mark (src/_includes/icons/signal.njk): a line to a node after a link's text, in place of an
     arrow. It tilts up for a link that opens a new tab, points back for "Previous" and up for "Back to top".
     On hover the line reaches further and the node fills. */
  .icon-signal {
    width: 1.5em;
    height: 0.75em;
    vertical-align: 0.02em;
    fill: none;
    overflow: visible;
  }

  .icon-signal .sig-line {
    transform-box: fill-box;
    transform-origin: 0 50%;
  }

  a[target="_blank"] .icon-signal {
    transform: rotate(-30deg);
  }

  .sig-back .icon-signal {
    transform: scaleX(-1);
  }

  .to-top .icon-signal {
    width: 1.2em;
    transform: rotate(-90deg);
  }

  :is(a, button):is(:hover, :focus-visible) .sig-node {
    fill: currentColor;
  }

  /* A brand logo standing in for the arrow keeps its own colours. */
  .icon-logo {
    object-fit: contain;
  }

  @media (prefers-reduced-motion: no-preference) {
    .icon-signal :is(.sig-line, .sig-node) {
      transition: transform 280ms var(--ease-out), fill 200ms var(--ease-standard);
    }

    :is(a, button):hover .sig-line {
      transform: scaleX(1.25);
    }

    :is(a, button):hover .sig-node {
      transform: translateX(3px);
    }
  }

  /* ---- Buttons: primary, secondary, ghost, icon and choice ------------ */
  /* Declared before the site chrome so chrome rules (menu toggle, resume link) can hide them. */

  .btn {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    min-height: 48px;
    padding: var(--space-3) 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--ink);
    font: var(--weight-semibold) var(--text-button) / 1.4 var(--font-sans);
    letter-spacing: -0.01em;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    flex-shrink: 0;
  }

  .btn .icon {
    width: 19px;
    height: 19px;
  }

  .btn:hover {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--ink-500);
  }

  .btn:disabled {
    opacity: 0.35;
    cursor: default;
  }

  /* Rust fill with a lit top edge and a soft glow (DESIGN-SYSTEM §5, Buttons). */
  .btn--primary {
    background: var(--rust);
    border-color: var(--rust);
    color: var(--on-rust);
    overflow: hidden;
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 0.3),
      0 1px 2px rgb(0 0 0 / 0.2),
      0 12px 28px -12px color-mix(in srgb, var(--rust) 80%, transparent);
  }

  .btn--primary:hover {
    background: var(--rust);
    border-color: var(--rust);
    color: var(--on-rust);
  }

  .btn--primary::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--press-shade);
    transform: translateX(-101%);
  }

  .btn--primary:hover::before {
    transform: translateX(0);
  }

  .btn--secondary {
    background: var(--card);
  }

  .btn--ghost,
  .btn--ghost:hover {
    border-color: transparent;
  }

  .btn--icon {
    width: 48px;
    padding: var(--space-3);
  }

  .btn--choice[aria-pressed="true"] {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
  }

  /* Press feedback uses `scale`, not `transform`, so it still works on magnetic buttons, whose transform
     GSAP drives (js/motion/magnetic.js); those drop the transform transition, which would lag behind it. */
  @media (prefers-reduced-motion: no-preference) {
    .btn,
    .btn::before {
      transition:
        background-color 200ms,
        color 200ms,
        border-color 200ms,
        transform 350ms var(--ease-out),
        scale 350ms var(--ease-out);
    }

    .btn.is-magnetic {
      transition:
        background-color 200ms,
        color 200ms,
        border-color 200ms,
        scale 350ms var(--ease-out);
    }

    .btn .icon {
      transition: transform var(--duration-base) var(--ease-out);
    }

    .btn:is(.btn--primary, .btn--secondary, .btn--ghost):hover > .icon:not(.icon-signal) {
      transform: translateX(3px);
    }

    .btn:active:not(:disabled) {
      scale: 0.97;
    }
  }

  /* ---- Site chrome: skip link, header, navigation, footer ------------- */

  .skip-link {
    position: fixed;
    z-index: var(--z-skip);
    left: 20px;
    top: -100px;
    padding: var(--space-3) 20px;
    background: var(--ink);
    color: var(--bg);
  }

  .skip-link:focus {
    top: var(--space-3);
  }

  /* The nav is a glass pill floating over the page (DESIGN-SYSTEM §5, Nav). It is fixed, so every page but
     home, whose night hero runs under it, starts below it. It slides away while reading down (js/main.js). */
  .site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: var(--z-header);
    padding-top: 12px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    pointer-events: none;
  }

  .site-header.is-hidden {
    transform: translateY(calc(-100% - 24px));
  }

  @media (prefers-reduced-motion: no-preference) {
    .site-header {
      transition: transform 300ms var(--ease-standard);
    }
  }

  body:not(.home) > main {
    padding-top: var(--header-space);
  }

  .header-inner {
    max-width: var(--container);
    min-height: 60px;
    margin: auto;
    padding: 8px 8px 8px 22px;
    display: flex;
    align-items: center;
    gap: 28px;
    border-radius: 30px;
    background: color-mix(in srgb, var(--bg) 76%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
    box-shadow: inset 0 0 0 1px var(--line), var(--hi), 0 14px 32px -20px rgb(9 23 28 / 0.5);
    pointer-events: auto;
  }

  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .header-inner {
      background: var(--bg);
    }
  }

  .brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.9375rem;
    line-height: 1.2;
    font-weight: var(--weight-semibold);
    text-decoration: none;
    letter-spacing: -0.035em;
    white-space: nowrap;
  }

  .brand > svg {
    width: 27px;
    height: 30px;
    fill: var(--ink);
  }

  .brand > svg rect:last-child {
    fill: var(--rust);
  }

  .brand-sub {
    font-weight: var(--weight-regular);
  }

  .header-inner nav {
    display: flex;
    align-items: center;
    gap: 26px;
    margin-left: auto;
  }

  .header-inner nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: var(--text-small);
    font-weight: var(--weight-medium);
    position: relative;
  }

  .header-inner nav a::after {
    content: "";
    height: 2px;
    background: var(--rust-text);
    position: absolute;
    bottom: 3px;
    left: 0;
    right: 0;
    transform: scaleX(0);
    transform-origin: left;
  }

  .header-inner nav a:hover::after,
  .header-inner nav a[aria-current]::after {
    transform: scaleX(1);
  }

  .header-inner nav .mobile-resume {
    display: none;
  }

  .header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
  }

  .header-inner .btn {
    min-height: 44px;
  }

  .header-inner .btn--icon {
    width: 44px;
  }

  /* The theme toggle shows the icon of the theme it switches to. */
  .theme-sun {
    display: none;
  }

  :root[data-theme="dark"] .theme-moon {
    display: none;
  }

  :root[data-theme="dark"] .theme-sun {
    display: inline-flex;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-moon {
      display: none;
    }

    :root:not([data-theme="light"]) .theme-sun {
      display: inline-flex;
    }
  }

  .menu-toggle {
    display: none;
  }

  .site-footer {
    max-width: 1380px;
    margin: auto;
    padding: var(--space-6) 48px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }

  .site-footer p {
    font-size: var(--text-label);
    color: var(--ink-500);
  }

  .site-footer nav {
    display: flex;
    gap: 22px;
    font-size: 0.8125rem;
  }

  .site-footer nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    text-decoration: none;
  }

  /* The Motion switch (DESIGN-SYSTEM §6.3). The track ring is ink-500 so the control reads at 3:1 or more. */
  .motion-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 var(--space-1);
    border: 0;
    border-radius: var(--radius-chip);
    background: none;
    color: var(--ink-500);
    font: var(--weight-medium) var(--text-label) / 1 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .motion-toggle[aria-disabled="true"] {
    cursor: default;
  }

  .mt-state {
    color: var(--ink);
  }

  .mt-track {
    position: relative;
    width: 32px;
    height: 18px;
    border-radius: var(--radius-pill);
    box-shadow: inset 0 0 0 1.5px var(--ink-500);
  }

  .mt-track i {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ink-500);
  }

  .motion-toggle[aria-checked="true"] .mt-track {
    background: var(--rust);
    box-shadow: none;
  }

  .motion-toggle[aria-checked="true"] .mt-track i {
    transform: translateX(14px);
    background: var(--on-rust);
  }

  @media (prefers-reduced-motion: no-preference) {
    .mt-track i {
      transition: transform var(--duration-base) var(--ease-standard);
    }
  }

  @media (max-width: 1100px) {
    .header-inner {
      gap: 20px;
    }

    .header-inner nav {
      gap: 18px;
    }

    .brand-sub {
      display: none;
    }
  }

  /* Links collapse into the pill's menu under 981 px; open, the pill grows into a rounded panel. */
  @media (max-width: 980px) {
    .header-inner {
      flex-wrap: wrap;
      gap: var(--space-2);
      padding-left: 20px;
    }

    .menu-toggle:not([hidden]) {
      display: inline-flex;
      margin-left: auto;
    }

    .header-actions {
      gap: 10px;
    }

    .header-actions > .resume-link {
      display: none;
    }

    .header-inner nav {
      order: 4;
      margin: 0;
      width: 100%;
      justify-content: center;
      flex-wrap: wrap;
      gap: var(--space-1) var(--space-6);
      padding-block: var(--space-2);
    }

    .header-inner nav[data-enhanced="true"]:not(.open) {
      display: none;
    }

    .header-inner nav .mobile-resume {
      display: flex;
      align-items: center;
      gap: 6px;
    }
  }

  @media (max-width: 800px) {
    .site-footer {
      padding-inline: 28px;
    }

    .footer-location {
      display: none;
    }
  }

  @media (max-width: 520px) {
    .header-inner {
      padding-left: 16px;
    }

    .brand {
      font-size: var(--text-small);
    }

    .brand > svg {
      width: 23px;
      height: 26px;
    }

    .site-footer {
      padding: 20px 22px;
      gap: 10px;
    }

    .site-footer nav {
      flex-wrap: wrap;
      gap: var(--space-3) 20px;
    }
  }

  /* ---- Shared text roles ---------------------------------------------- */

  .eyebrow {
    font-size: 0.8125rem;
    font-weight: var(--weight-semibold);
    letter-spacing: 0.02em;
  }

  .actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-8);
  }

  @media (max-width: 520px) {
    .actions {
      margin-top: var(--space-6);
    }
  }

  /* ---- Project cards and card rails ----------------------------------- */

  .card-shelf {
    min-width: 0;
  }

  .card-rail {
    display: flex;
    align-items: stretch;
    gap: 20px;
    overflow: auto;
    padding: var(--space-1) 3px var(--space-4);
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 3px;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }

  .card-rail > .project-card {
    flex: 0 0 calc((100% - 40px) / 3);
    scroll-snap-align: start;
    min-width: 0;
  }

  .project-card {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius-tile);
    background: var(--card);
    overflow: hidden;
  }

  .card-image {
    background: var(--surface);
    padding: var(--space-3);
    aspect-ratio: 1.85;
    overflow: hidden;
  }

  .card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--figure-bg);
    border-radius: 4px;
    padding: 0;
  }

  .card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 18px;
    min-width: 0;
  }

  .card-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    font-size: var(--text-label);
    color: var(--ink-500);
  }

  .card-top .eyebrow {
    font-size: var(--text-label);
    font-weight: var(--weight-medium);
    letter-spacing: 0;
  }

  .card-top .provenance {
    margin-left: auto;
  }

  /* Dataset provenance (DESIGN-SYSTEM §3): study, practice, public, synthetic or anonymised work. */
  .provenance {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    font: var(--weight-medium) var(--text-label) / 1.6 var(--font-mono);
    color: var(--ink-500);
    white-space: nowrap;
  }

  .card-copy {
    margin: 10px 0 var(--space-4);
  }

  .card-copy :is(h2, h3) {
    font-size: 1.2rem;
    font-weight: var(--weight-semibold);
    line-height: 1.35;
    letter-spacing: -0.025em;
    margin-bottom: 10px;
  }

  .card-copy :is(h2, h3) a {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: var(--space-3);
    text-decoration: none;
  }

  /* The title link covers the whole card; the card shows the focus ring instead. */
  .card-copy :is(h2, h3) a::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius-tile);
  }

  .card-copy a:focus-visible {
    outline: 0;
  }

  .project-card:has(a:focus-visible) {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
  }

  .card-arrow {
    display: inline-flex;
    flex-shrink: 0;
    padding-top: 2px;
    color: var(--ink-500);
  }

  .card-arrow .icon {
    width: 22px;
    height: 11px;
  }

  .card-copy > p {
    color: var(--ink-500);
    font-size: var(--text-small);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
  }

  .card-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: var(--text-label);
    color: var(--ink-500);
  }

  .card-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-content: center;
    gap: var(--space-3);
    text-align: center;
    color: var(--ink-500);
    font-family: var(--font-mono);
  }

  .card-placeholder > span:first-child {
    font-size: 1.7rem;
  }

  .card-placeholder > span:last-child {
    font-size: var(--text-label);
  }

  /* A rail holding a single card lays it out as one wide row. */
  .card-rail > .project-card:only-child {
    flex-basis: 100%;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: center;
    gap: 0;
  }

  .card-rail > .project-card:only-child .card-image {
    height: 100%;
    min-height: 200px;
    aspect-ratio: auto;
    padding: var(--space-4);
  }

  .card-rail > .project-card:only-child .card-content {
    padding: var(--space-6) 28px;
  }

  .card-rail > .project-card:only-child .card-copy > p {
    max-width: 40.26em; /* 66ch in Manrope */
  }

  .card-rail > .project-card:only-child .card-copy :is(h2, h3) {
    font-size: 1.4rem;
  }

  @media (max-width: 1100px) {
    .card-rail > .project-card {
      flex-basis: calc((100% - 30px) / 2.5);
    }
  }

  @media (max-width: 800px) {
    .card-rail > .project-card {
      flex-basis: calc((100% - 24px) / 2);
    }

    .card-rail > .project-card:only-child {
      grid-template-columns: 220px minmax(0, 1fr);
    }

    .card-rail > .project-card:only-child .card-content {
      padding: 22px;
    }
  }

  @media (max-width: 520px) {
    .card-rail {
      gap: 14px;
    }

    .card-rail > .project-card {
      flex-basis: 88%;
    }

    .card-image {
      aspect-ratio: 1.8;
      padding: 10px;
    }

    .card-content {
      padding: var(--space-4);
    }

    .card-copy :is(h2, h3) {
      font-size: 1.15rem;
    }

    .card-copy > p {
      font-size: var(--text-small);
    }

    .card-bottom {
      gap: 6px 9px;
      font-size: 0.6875rem;
    }

    .card-rail > .project-card:only-child {
      display: flex;
      gap: 0;
    }

    .card-rail > .project-card:only-child .card-image {
      width: 100%;
      height: auto;
      min-height: 0;
      aspect-ratio: 2;
      padding: 10px;
    }

    .card-rail > .project-card:only-child .card-content {
      padding: 18px;
    }

    .card-rail > .project-card:only-child .card-copy :is(h2, h3) {
      font-size: 1.2rem;
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .card-image img {
      transition: transform 650ms var(--ease-out);
    }

    .project-card:is(:hover, :focus-within) .card-image img {
      transform: scale(1.045);
    }

    .project-card {
      transition:
        transform 280ms var(--ease-out),
        border-color 220ms;
    }

    .project-card:hover {
      transform: translateY(-3px);
      border-color: var(--ink-500);
    }

    .project-card .card-arrow {
      transition: transform 280ms var(--ease-out);
    }

    .project-card:hover .card-arrow {
      transform: translateX(3px);
    }
  }

  /* ---- Tool tags and tool marks (logo tiles) -------------------------- */

  .tool-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.35;
    max-width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  .tool-tag > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .tool-mark {
    display: inline-grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--logo-bg);
    border: 1px solid var(--logo-ring);
  }

  .tool-mark img {
    display: block;
    width: 26px;
    height: 26px;
    object-fit: contain;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
  }

  .tool-tag .tool-mark {
    width: var(--space-6);
    height: var(--space-6);
    flex-basis: var(--space-6);
    border-radius: 5px;
    border: 0;
    background: var(--logo-bg);
  }

  .tool-tag .tool-mark img {
    width: 18px;
    height: 18px;
  }

  @media (prefers-reduced-motion: no-preference) {
    .tool-mark {
      transition:
        transform 240ms var(--ease-out),
        border-color 240ms;
    }
  }

  /* ---- Rail footer: position counter and controls --------------------- */

  .rail-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding-inline: 3px;
    gap: var(--space-4);
  }

  .rail-position {
    font: var(--weight-medium) var(--text-label) var(--font-mono);
    color: var(--ink-500);
    font-variant-numeric: tabular-nums slashed-zero;
  }

  .rail-controls {
    display: flex;
    gap: var(--space-2);
  }

  /* ---- Learning cards -------------------------------------------------- */

  .learning-card {
    padding: var(--space-6);
    flex-direction: row;
    gap: var(--space-6);
  }

  .learning-card .card-content {
    padding: 0;
  }

  .learning-card .card-date {
    color: var(--ink-500);
    font: var(--weight-medium) var(--text-label) var(--font-mono);
    font-variant-numeric: tabular-nums slashed-zero;
  }

  .learning-card .note-marker {
    flex-shrink: 0;
    width: var(--space-12);
    height: 58px;
    display: grid;
    place-items: center;
    color: var(--rust-text);
    border: 1px solid var(--line);
    border-radius: var(--radius-chip);
  }

  .note-marker .icon {
    width: 26px;
    height: 26px;
  }

  .card-rail > .learning-card:only-child {
    display: flex;
    gap: var(--space-6);
    align-items: start;
  }

  .card-rail > .learning-card:only-child .card-content {
    padding: 0;
  }

  .learning-card .card-bottom {
    border: 0;
    padding-top: 0;
  }

  .learning-card .card-copy {
    margin-bottom: 14px;
  }

  @media (max-width: 520px) {
    .learning-card {
      padding: 20px;
      gap: var(--space-4);
    }

    .card-rail > .learning-card:only-child {
      flex-direction: row;
      gap: var(--space-4);
    }

    .learning-card .note-marker {
      width: var(--space-8);
      height: 42px;
    }

    .note-marker .icon {
      width: 20px;
      height: 20px;
    }

    .card-rail > .learning-card:only-child .card-content {
      padding: 0;
    }
  }

  /* ---- Empty states ---------------------------------------------------- */

  .empty-state {
    display: flex;
    align-items: start;
    gap: 20px;
    padding: 30px;
    background: var(--surface);
    border-radius: var(--radius-tile);
    color: var(--ink-500);
  }

  .empty-state h2,
  .empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: var(--space-3);
    color: var(--ink);
  }

  .empty-state p {
    max-width: 39.65em; /* 65ch in Manrope */
  }

  .empty-mark {
    color: var(--rust-text);
    font-family: var(--font-mono);
  }

  @media (max-width: 520px) {
    .empty-state {
      padding: 22px;
    }
  }

  /* ---- Breadcrumbs ----------------------------------------------------- */

  .breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
    color: var(--ink-500);
    font-size: 0.8125rem;
  }

  .breadcrumbs li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
  }

  .breadcrumbs a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    text-decoration: none;
  }

  .breadcrumbs [aria-current] {
    color: var(--ink);
  }

  /* ---- Collection pages: projects and learning indexes, 404 ----------- */

  .collection-page {
    padding-top: var(--space-10);
    padding-bottom: 90px;
    min-height: 70vh;
  }

  .collection-page > .section-heading {
    margin-top: 44px;
  }

  .collection-page .detail-summary {
    margin-top: var(--space-6);
  }

  .collection-header {
    margin: 28px 0 34px;
  }

  .collection-header h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
  }

  .collection-page .collection-header .detail-summary {
    margin-top: var(--space-4);
    max-width: 33.55em; /* 55ch in Manrope */
  }

  .project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-6);
  }

  .project-grid .card-image {
    aspect-ratio: 1.6;
    padding: 0;
  }

  /* The framed covers (assets/projects/covers/) are transparent around the artefact, so the card's surface
     shows through in both themes. */
  .project-grid .card-image img[srcset] {
    background: transparent;
    border-radius: 0;
  }

  .card-metric {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px var(--space-2);
    margin-top: auto;
    padding: var(--space-6) 0 var(--space-3);
  }

  .card-metric + .card-bottom {
    margin-top: 0;
  }

  .card-metric strong {
    font: var(--weight-medium) 1.6rem / 1 var(--font-sans);
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums slashed-zero;
  }

  .card-metric span {
    font: var(--weight-medium) var(--text-label) / 1.4 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-500);
  }

  @media (max-width: 1100px) {
    .project-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 800px) {
    .project-grid {
      gap: 20px;
    }
  }

  @media (max-width: 600px) {
    .collection-header {
      margin: 20px 0 28px;
    }

    .collection-page .collection-header h1 {
      font-size: 2.4rem;
    }
  }

  @media (max-width: 520px) {
    .project-grid {
      grid-template-columns: 1fr;
      gap: var(--space-6);
    }

    .collection-page {
      padding-top: var(--space-6);
      padding-bottom: var(--space-12);
    }

    .collection-page > .section-heading {
      margin-top: 26px;
    }

    .collection-page h1 {
      font-size: 2.4rem;
    }
  }

  /* ---- Project filters: by type and by tool, kept in the address ------- */

  .filters {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-6) var(--space-8);
    padding: var(--space-6) 0;
    border-block: 1px solid var(--line);
    margin-top: 30px;
  }

  .filters fieldset {
    min-width: 0;
    border: 0;
    padding: 0;
    margin: 0;
  }

  .filters legend {
    display: block;
    margin-bottom: 10px;
    font-size: var(--text-label);
    font-weight: var(--weight-semibold);
  }

  .filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .filter-chips .btn {
    gap: var(--space-2);
  }

  .filter-chips [data-count] {
    font-family: var(--font-mono);
    font-size: var(--text-label);
    font-variant-numeric: tabular-nums slashed-zero;
    opacity: 0.75;
  }

  /* A tool with no project under the chosen type stays clickable but recedes. */
  .filter-chips [data-empty]:not([aria-pressed="true"]) {
    color: var(--ink-500);
    border-style: dashed;
  }

  .filter-chips--tools .btn {
    padding-left: 6px;
  }

  .filter-chips .tool-mark {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
  }

  .filter-chips .tool-mark img {
    width: 18px;
    height: 18px;
  }

  .reset-filter {
    align-self: end;
  }

  /* One line is kept for the result even before js/main.js writes it, so nothing below moves. */
  .filter-result {
    box-sizing: content-box;
    min-height: 1lh;
    font-size: 0.8125rem;
    color: var(--ink-500);
    padding: 20px 0;
  }

  .filter-empty {
    margin-top: var(--space-6);
  }

  :root:not([data-js]) .filters ~ .project-grid {
    margin-top: var(--space-6);
  }

  @media (max-width: 1100px) {
    .filters {
      grid-template-columns: minmax(0, 1fr) auto;
    }

    .filters fieldset:nth-of-type(2) {
      grid-column: 1 / -1;
      grid-row: 2;
    }

    .reset-filter {
      grid-column: 2;
      grid-row: 1;
    }
  }

  @media (max-width: 600px) {
    .filters {
      grid-template-columns: minmax(0, 1fr);
      gap: 18px;
    }

    .filters fieldset:nth-of-type(2),
    .reset-filter {
      grid-column: 1;
      grid-row: auto;
    }

    .reset-filter {
      justify-self: start;
    }

    .filter-chips .btn {
      padding-inline: var(--space-3);
    }

    .filter-chips--tools .btn {
      flex: none;
      padding-left: 6px;
    }

    /* The tools in one row that scrolls sideways (fading out where more wait), so the cards start on the
       first screen. The 4 px of padding keeps focus rings inside the scrolling box; the wider end lets the
       last chip scroll clear of the fade. */
    .filter-chips--tools {
      flex-wrap: nowrap;
      overflow-x: auto;
      margin: -4px;
      padding: 4px 36px 4px 4px;
      scrollbar-width: none;
      -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
      mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
    }

    .filter-chips--tools::-webkit-scrollbar {
      display: none;
    }
  }

  /* ---- Detail pages: project and learning articles -------------------- */

  .detail-page {
    padding-top: 36px;
    padding-bottom: 90px;
  }

  .detail-header {
    padding: 38px 0 46px;
    border-bottom: 1px solid var(--line);
  }

  .detail-header h1 {
    max-width: 1000px;
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin: var(--space-6) 0;
  }

  /* A project name over 36 characters (src/project.njk sets data-long) steps down a size. */
  .detail-header h1[data-long] {
    font-size: clamp(1.875rem, 3.75vw, 3rem);
  }

  .detail-header > .actions {
    gap: var(--space-3);
  }

  .detail-summary {
    font-size: 1.125rem;
    line-height: 1.8;
    max-width: 39.65em; /* 65ch in Manrope */
    color: var(--ink-500);
  }

  .detail-header .context {
    margin-top: 20px;
  }

  /* At a glance (DESIGN-SYSTEM §9): the question, the data and its provenance, the tools (each a link to the
     projects index filtered by it) and the links; beside it on wide screens, the metric row, every result
     with its baseline. */
  .glance-box {
    display: grid;
    gap: var(--space-6);
    margin-top: var(--space-10);
    padding: clamp(20px, 3vw, 36px);
    border-radius: var(--radius-card);
    background: var(--card);
    box-shadow: var(--hi), var(--shadow-card);
  }

  .glance-title {
    font: var(--weight-medium) var(--text-label) / 1 var(--font-mono);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--rust-text);
  }

  .glance {
    display: grid;
    align-content: start;
    gap: var(--space-4);
    margin: 0;
  }

  .glance > div {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    align-items: baseline;
    gap: var(--space-4);
  }

  .glance > div + div {
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
  }

  .glance dt {
    font: var(--weight-medium) var(--text-label) / 1.5 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-500);
  }

  .glance dd {
    max-width: 40em;
    margin: 0;
    line-height: 1.6;
  }

  .glance .provenance {
    margin-left: var(--space-1);
  }

  .glance .chips {
    margin-top: 0;
    padding: 0;
    list-style: none;
  }

  .glance .chips li {
    padding: 0;
  }

  .glance .chips a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
    border-radius: inherit;
    color: inherit;
    text-decoration: none;
  }

  .glance .chips a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .glance-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-6);
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .glance-links a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 30px;
    font-weight: var(--weight-semibold);
    text-underline-offset: 4px;
  }

  .glance-links .icon {
    width: 16px;
    height: 16px;
  }

  .metric-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    align-content: start;
    gap: var(--space-3);
    padding: 0;
    margin: 0;
    list-style: none;
  }

  .metric-row li {
    padding: var(--space-6) var(--space-6) var(--space-4);
    border-radius: var(--radius-tile);
    background: var(--surface);
  }

  .metric-row .metric {
    margin-top: 0;
    padding-top: 0;
    font-size: clamp(2.5rem, 2rem + 2.2vw, 3.75rem);
  }

  @media (min-width: 981px) {
    .glance-box {
      grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
      column-gap: var(--space-10);
    }

    .glance-title {
      grid-column: 1 / -1;
    }

    .metric-row {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  .detail-layout {
    display: grid;
    grid-template-columns: 225px minmax(0, 1fr);
    gap: 70px;
    padding-top: var(--space-12);
  }

  .detail-main {
    min-width: 0;
  }

  .detail-meta {
    position: sticky;
    top: 110px;
    align-self: start;
    max-height: calc(100vh - 130px);
    overflow: auto;
    font-size: var(--text-small);
    padding-right: 10px;
  }

  .article-nav h2 {
    font-size: var(--text-small);
    letter-spacing: 0;
    margin-bottom: var(--space-3);
  }

  .article-nav ol {
    list-style: none;
    padding: 0;
    margin: 0;
    color: var(--ink-500);
  }

  .article-nav a {
    display: block;
    min-height: var(--space-10);
    padding: var(--space-2) 0;
    text-decoration: none;
    font-size: 0.8125rem;
    line-height: 1.6;
  }

  /* What I'd recommend: the write-up's conclusion, set apart from the sections above it. */
  .prose .recommendation {
    padding: var(--space-4) var(--space-6);
    border-left: 3px solid var(--rust);
    border-radius: 0 var(--radius-tile) var(--radius-tile) 0;
    background: var(--surface);
    color: var(--ink);
    font-size: 1.0625rem;
  }

  /* Figures: the drawn-to-scale chart, then the artefact itself (or the live report). */
  .figures {
    display: grid;
    gap: var(--space-8);
    max-width: 52em;
    margin-top: var(--space-16);
    counter-reset: fig;
  }

  .figures-title {
    font-size: 1.9rem;
    line-height: 1.2;
    scroll-margin-top: 15px;
  }

  .fig.fig--image::before {
    content: "Fig. " counter(fig, decimal-leading-zero) " · " attr(data-fig-label);
  }

  .fig--image img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--figure-bg);
  }

  .fig figcaption a {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    text-underline-offset: 3px;
  }

  .fig figcaption .icon {
    width: 14px;
    height: 14px;
  }

  /* A Power BI report: its placeholder image until the reader loads it, then the report itself. */
  .report {
    display: grid;
  }

  .report > * {
    grid-area: 1 / 1;
  }

  /* Bottom right, where the cover leaves room, so it hides none of the numbers. */
  .report-load {
    place-self: end;
    margin: clamp(10px, 2.5%, 20px);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.25);
  }

  .report iframe {
    display: block;
    width: 100%;
    aspect-ratio: 1.65;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--figure-bg);
  }

  /* Previous / next: the neighbouring projects in the published order. */
  .pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-16);
    padding-top: var(--space-8);
    border-top: 1px solid var(--line);
  }

  .pager-count {
    grid-column: 1 / -1;
    font: var(--weight-medium) var(--text-label) / 1.5 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-500);
  }

  .pager-count a {
    text-underline-offset: 3px;
  }

  .pager-link {
    display: grid;
    align-content: start;
    gap: var(--space-2);
    padding: var(--space-6);
    border-radius: var(--radius-tile);
    background: var(--card);
    box-shadow: var(--hi), var(--shadow-card);
    color: var(--ink);
    text-decoration: none;
  }

  .pager-link--next {
    grid-column: 2;
    justify-items: end;
    text-align: right;
  }

  .pager-dir {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font: var(--weight-medium) var(--text-label) / 1 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rust-text);
  }

  .pager-dir .icon {
    width: 16px;
    height: 16px;
  }

  /* The signal mark keeps its 2:1 shape wherever a component sizes its icons square. */
  :is(.btn, .glance-links, .fig figcaption, .pager-dir) .icon-signal {
    width: 1.5em;
    height: 0.75em;
  }

  .pager-title {
    font: var(--weight-medium) clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem) / 1.2 var(--font-sans);
    letter-spacing: -0.02em;
  }

  .pager-meta {
    font: var(--weight-regular) var(--text-label) / 1.5 var(--font-mono);
    color: var(--ink-500);
  }

  .pager-link:hover .pager-title {
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
  }

  @media (max-width: 1100px) {
    .detail-layout {
      gap: 44px;
    }
  }

  @media (max-width: 800px) {
    .detail-layout {
      grid-template-columns: 1fr;
      gap: 30px;
    }

    .detail-meta {
      position: static;
      max-height: none;
      overflow: visible;
      padding: 0 0 var(--space-6);
      border-bottom: 1px solid var(--line);
    }

    .article-nav ol {
      columns: 2;
      column-gap: var(--space-8);
    }

    .article-nav li {
      break-inside: avoid;
    }
  }

  @media (max-width: 600px) {
    .glance > div {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--space-2);
    }

    .pager {
      grid-template-columns: minmax(0, 1fr);
    }

    .pager-link--next {
      grid-column: 1;
      justify-items: start;
      text-align: left;
    }
  }

  @media (max-width: 520px) {
    .detail-summary {
      font-size: var(--text-body);
      line-height: 1.75;
    }

    .detail-header {
      padding: 26px 0 30px;
    }

    .detail-header .eyebrow {
      font-size: var(--text-label);
    }

    .detail-header h1 {
      margin-block: 18px;
    }

    /* Two columns still: one would put a screenful of section links before the project begins. */
    .article-nav a {
      min-height: 44px;
    }

    .detail-page {
      padding-bottom: var(--space-12);
    }
  }

  /* ---- Prose: rendered CMS content ------------------------------------ */

  .prose {
    min-width: 0;
    max-width: 43.92em; /* 72ch in Manrope */
  }

  .reading-width {
    max-width: 760px;
    margin: var(--space-10) auto 0;
  }

  .prose h2 {
    font-size: 1.9rem;
    margin: 42px 0 18px;
    line-height: 1.2;
  }

  .prose h3,
  .prose h4 {
    margin: 28px 0 var(--space-3);
  }

  .prose h2[id] {
    scroll-margin-top: 15px;
  }

  .prose p,
  .prose li {
    font-size: 1rem;
    color: var(--ink-500);
    line-height: 1.85;
  }

  .prose li + li {
    margin-top: var(--space-2);
  }

  .prose ul,
  .prose ol {
    padding-left: 22px;
  }

  .prose figure {
    margin: 0 0 var(--space-8);
  }

  .prose figure img {
    width: 100%;
    height: auto;
    background: var(--figure-bg);
    border-radius: 10px;
    border: 1px solid var(--line);
  }

  .prose figcaption {
    font-size: var(--text-caption);
    line-height: 1.7;
    color: var(--ink-500);
    margin-top: var(--space-3);
  }

  .prose blockquote {
    margin: 30px 0;
    padding: var(--space-6) 0;
    border-block: 1px solid var(--line);
    font-size: 1.45rem;
    font-weight: var(--weight-semibold);
    line-height: 1.5;
    letter-spacing: -0.025em;
  }

  .prose pre {
    overflow: auto;
    background: var(--code-bg);
    color: var(--code-ink);
    padding: var(--space-6);
    border-radius: 10px;
    font-size: 0.8125rem;
    line-height: 1.8;
  }

  .prose code {
    font-family: var(--font-mono);
    overflow-wrap: anywhere;
  }

  .prose a {
    overflow-wrap: anywhere;
  }

  .table-scroll {
    overflow-x: auto;
  }

  .prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
  }

  .prose th,
  .prose td {
    padding: var(--space-3);
    border: 1px solid var(--line);
    text-align: left;
  }

  .prose th {
    background: var(--surface);
  }

  @media (max-width: 800px) {
    .prose {
      max-width: none;
    }
  }

  @media (max-width: 520px) {
    .prose h2 {
      font-size: 1.6rem;
    }

    .prose p,
    .prose li {
      font-size: 0.9375rem;
    }

    .prose pre {
      padding: 18px;
      font-size: var(--text-label);
    }

    .prose blockquote {
      font-size: 1.2rem;
    }
  }

  /* ---- Project figures (src/_includes/figures/, drawn to scale) ------- */
  /* Signal v2 component, rendered from Phase 4. g-* classes are motion hooks and need no styles. */

  .fig {
    position: relative;
    display: flex;
    margin: 0;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-3);
    min-width: 0;
    padding: 44px clamp(14px, 2vw, 24px) clamp(14px, 2vw, 24px);
    border-radius: var(--radius-card);
    background-color: var(--surface);
    background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 11%, transparent) 1px, transparent 1.5px);
    background-size: 18px 18px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent);
    font-variant-numeric: tabular-nums slashed-zero;
    counter-increment: fig;
  }

  .fig::before {
    content: "Fig. " counter(fig, decimal-leading-zero) " · drawn to scale";
    position: absolute;
    top: 18px;
    left: clamp(14px, 2vw, 24px);
    font: var(--weight-medium) 11px / 1 var(--font-mono);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-500);
  }

  .fig svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .fig figcaption {
    font: var(--weight-regular) var(--text-caption) / 1.5 var(--font-mono);
    color: var(--ink-500);
  }

  .f-grid { stroke: var(--line); stroke-width: 1; }
  .f-lab { font: var(--weight-regular) 11px var(--font-mono); fill: var(--ink-500); }
  .f-val { font: var(--weight-semibold) 12px var(--font-sans); fill: var(--ink); }
  .f-txt { font: var(--weight-medium) 13px var(--font-sans); fill: var(--ink); }
  .f-big { font: var(--weight-medium) 40px var(--font-sans); letter-spacing: -0.05em; fill: var(--ink); }
  .f-big.hi { fill: var(--rust); }
  .f-gm { font: var(--weight-semibold) 12px var(--font-sans); fill: var(--rust-text); }
  .f-bar, .f-ok { fill: var(--petrol); }
  .f-hi, .f-rej { fill: var(--rust); }
  .f-lo { fill: var(--petrol-soft); }
  .f-raw { fill: var(--ink-500); opacity: 0.45; }
  .f-line { fill: none; stroke: var(--rust); stroke-width: 2.5; stroke-linejoin: round; }
  .f-pt { fill: var(--card); stroke: var(--rust); stroke-width: 2.5; }
  .f-dup { fill: none; stroke: var(--rust); stroke-width: 2.5; }
  .f-link { fill: none; stroke: var(--ink-500); stroke-width: 1.4; opacity: 0.55; }
  .f-chip { fill: var(--card); stroke: var(--line); }
  .f-chip-t { font: var(--weight-medium) 10px var(--font-mono); fill: var(--ink-500); }
  .f-on { font: var(--weight-semibold) 11px var(--font-mono); fill: var(--card); }
  .f-bronze { fill: var(--bronze); }
  .f-silver { fill: var(--silver); }
  .f-gold { fill: var(--gold); }
  .f-in { font: var(--weight-semibold) 12px var(--font-sans); fill: var(--white); }
  .f-in.dk { fill: var(--ink-950); }
  .f-sub { font: var(--weight-regular) 10px var(--font-mono); fill: rgb(255 255 255 / 0.85); }
  .f-sub.dk { fill: rgb(19 43 50 / 0.8); }

  /* Figure zoom (js/main.js): any figure on a project page or a home panel opens in a modal dialog. A drawing
     keeps at least 720 px of width there and scrolls sideways on a phone, so its smallest labels read at
     about 16 px; a report image shows at its own detail. */
  [data-zoomable] {
    position: relative;
    cursor: zoom-in;
  }

  .zoom-open {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: color-mix(in srgb, var(--card) 90%, transparent);
    color: var(--ink);
    cursor: zoom-in;
  }

  .zoom-open:hover {
    border-color: var(--ink-500);
  }

  .zoom-open .icon {
    width: 18px;
    height: 18px;
  }

  .zoom {
    width: min(1180px, 100vw - 32px);
    max-width: none;
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 0;
    border-radius: var(--radius-card);
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 30px 80px rgb(0 0 0 / 0.35);
    overflow: hidden;
  }

  .zoom[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .zoom::backdrop {
    background: rgb(8 20 24 / 0.72);
  }

  /* The gutter stays, so locking the page does not shift it sideways (or make a pinned scene re-measure). */
  html:has(.zoom[open]) {
    overflow: hidden;
    scrollbar-gutter: stable;
  }

  .zoom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-2) var(--space-2) var(--space-2) var(--space-6);
    border-bottom: 1px solid var(--line);
  }

  .zoom-title {
    font: var(--weight-medium) var(--text-label) / 1.4 var(--font-mono);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-500);
  }

  .zoom-close {
    display: inline-grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
  }

  .zoom-close:hover {
    background: var(--surface);
  }

  .zoom-close .icon {
    width: 20px;
    height: 20px;
  }

  /* A grid, so on a phone (where the dialog fills the screen) the figure sits in the middle of the stage. */
  .zoom-stage {
    display: grid;
    overflow: auto;
    overscroll-behavior: contain;
    padding: var(--space-6);
    background-color: var(--surface);
    background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 11%, transparent) 1px, transparent 1.5px);
    background-size: 18px 18px;
    font-variant-numeric: tabular-nums slashed-zero;
  }

  .zoom-stage svg,
  .zoom-stage img {
    display: block;
    width: 100%;
    min-width: 720px;
    height: auto;
    margin: auto;
  }

  .zoom-stage svg {
    max-width: 1040px;
    overflow: visible;
  }

  .zoom-stage img {
    border-radius: 8px;
    background: var(--figure-bg);
  }

  .zoom-caption {
    padding: var(--space-3) var(--space-6) var(--space-4);
    border-top: 1px solid var(--line);
    font: var(--weight-regular) var(--text-caption) / 1.5 var(--font-mono);
    color: var(--ink-500);
  }

  .zoom-caption:empty {
    display: none;
  }

  @media (max-width: 600px) {
    .zoom {
      inset: 0;
      width: 100%;
      height: 100%;
      max-height: none;
      margin: 0;
      border-radius: 0;
    }

    .zoom-bar {
      padding-top: calc(var(--space-2) + env(safe-area-inset-top, 0px));
      padding-left: max(var(--space-4), env(safe-area-inset-left, 0px));
      padding-right: max(var(--space-2), env(safe-area-inset-right, 0px));
    }

    .zoom-stage {
      padding: var(--space-4);
    }

    .zoom-caption {
      padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    :root:not([data-motion="off"]) .zoom[open] {
      animation: zoom-in 240ms var(--ease-out);
    }

    :root:not([data-motion="off"]) .zoom[open]::backdrop {
      animation: zoom-fade 240ms var(--ease-out);
    }
  }

  @keyframes zoom-in {
    from {
      opacity: 0;
      scale: 0.97;
    }
  }

  @keyframes zoom-fade {
    from {
      opacity: 0;
    }
  }
}

/* ==========================================================================
   Signal v2: the home page (src/index.njk, src/_includes/home/)
   DESIGN-SYSTEM §5. Static first: every state shown here is the finished one, so the page is complete
   without JavaScript and with reduced motion. Breakpoints 560 / 760 / 980 / 1180.
   ========================================================================== */

@layer components {
  /* ---- Container and shared section parts ----------------------------- */

  .wrap {
    --wrap-gutter: 16px;
    width: 100%;
    max-width: calc(var(--container) + 2 * var(--wrap-gutter));
    margin-inline: auto;
    padding-left: max(var(--wrap-gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--wrap-gutter), env(safe-area-inset-right, 0px));
  }

  @media (min-width: 560px) {
    .wrap {
      --wrap-gutter: 24px;
    }
  }

  @media (min-width: 980px) {
    .wrap {
      --wrap-gutter: 32px;
    }
  }

  /* New components space their children with gap, so the base paragraph margin and list styles go. */
  :where(.hero, .proof, .work, .process, .experience, .toolkit, .contact) :where(p + p) {
    margin-top: 0;
  }

  :where(.hero, .proof, .work, .process, .experience, .toolkit, .contact) :where(ul, ol) {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .work,
  .process,
  .experience,
  .toolkit {
    padding-block: var(--section-pad);
  }

  .experience {
    padding-bottom: 0;
  }

  .sec-no {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font: var(--weight-medium) var(--text-label) / 1.3 var(--font-mono);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-500);
  }

  .sec-no::before {
    content: "";
    width: 28px;
    height: 1px;
    background: currentColor;
    opacity: 0.6;
  }

  .sec-head {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: var(--space-6) var(--space-12);
    align-items: end;
    margin-bottom: var(--space-10);
  }

  .sec-head h2 {
    margin-top: var(--space-4);
    font-size: var(--text-h2);
    line-height: 1.02;
    letter-spacing: var(--tracking-h2);
  }

  .sec-head > p {
    max-width: var(--measure-pitch);
    color: var(--ink-500);
  }

  /* A link with an arrow: "Read the case study →". */
  .more,
  .panel-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    font: var(--weight-semibold) var(--text-small) / 1 var(--font-sans);
    color: var(--rust-text);
    text-decoration: none;
  }

  .more:hover,
  .panel-links a:hover {
    color: var(--rust-text);
    text-decoration: underline;
    text-underline-offset: 4px;
  }

  /* ---- Night scenes: hero, proof, contact (the same in both themes) --- */

  .night {
    --bg: var(--night);
    --card: var(--night-2);
    --surface: var(--night-2);
    --ink: var(--n-ink);
    --ink-700: var(--n-ink);
    --ink-500: var(--n-muted);
    --ink-400: var(--n-tertiary);
    --line: var(--n-hair);
    --line-strong: var(--n-hair-strong);
    --rust: var(--rust-d);
    --rust-text: var(--rust-200);
    --on-rust: var(--night);
    --focus-ring: var(--mint);
    --logo-bg: #f1f5f1;
    --logo-ring: var(--n-hair-strong);
    --hi: inset 0 1px 0 rgb(255 255 255 / 0.06);
    color-scheme: dark;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: var(--night);
    color: var(--n-ink);
  }

  .night > .wrap {
    position: relative;
    z-index: 1;
  }

  /* Film grain, night scenes only (DESIGN-SYSTEM §2.5). */
  .night::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0.08;
    mix-blend-mode: overlay;
    background-image: var(--texture-grain);
  }

  /* One soft petrol-and-mint light per scene; it stays still (motion is Phase 5's job). */
  .night::before {
    content: "";
    position: absolute;
    z-index: 0;
    pointer-events: none;
  }

  .hero::before {
    width: min(1100px, 90vw);
    height: min(900px, 80vh);
    right: -18vw;
    top: -22vh;
    background: radial-gradient(closest-side, rgb(116 211 196 / 0.18), rgb(47 111 122 / 0.1) 55%, transparent);
  }

  .proof::before {
    width: min(1000px, 80vw);
    height: min(1000px, 90vh);
    right: -10vw;
    top: 5%;
    background: radial-gradient(closest-side, rgb(47 111 122 / 0.3), transparent);
  }

  .contact::before {
    inset: auto -10% -45% -10%;
    height: 110%;
    background:
      radial-gradient(38% 50% at 22% 55%, rgb(116 211 196 / 0.18), transparent 70%),
      radial-gradient(30% 42% at 86% 62%, rgb(255 142 114 / 0.1), transparent 70%);
  }

  .grad {
    background-image: var(--grad-mint);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding-bottom: 0.08em;
  }

  @media (forced-colors: active) {
    .grad {
      background: none;
      color: CanvasText;
    }
  }

  /* Buttons on night scenes: a hairline over blurred glass. */
  .btn--glass,
  .btn--glass:hover {
    color: inherit;
    border-color: color-mix(in srgb, currentColor 24%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08);
  }

  .btn--glass {
    background: color-mix(in srgb, currentColor 5%, transparent);
  }

  .btn--glass:hover {
    background: color-mix(in srgb, currentColor 11%, transparent);
  }

  /* ---- Hero ------------------------------------------------------------ */

  /* The hero runs under the floating nav pill, so it fills the screen and its top padding clears the pill. */
  .hero {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-block: calc(var(--header-space) + var(--space-12)) var(--space-10);
  }

  /* The lattice poster: fitted by width and anchored to the bottom edge (preserveAspectRatio). */
  .hero-scene {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
  }

  .hero-scene svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  /* Darken the field behind the text so the dots read as a backdrop, not as noise under the words. */
  .hero-scene::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
      linear-gradient(90deg, rgb(9 23 28 / 0.82), rgb(9 23 28 / 0.35) 55%, rgb(9 23 28 / 0) 85%),
      linear-gradient(180deg, var(--night) 0%, rgb(9 23 28 / 0) 30%);
  }

  .lattice-poster--narrow {
    display: none;
  }

  @media (orientation: portrait) {
    .lattice-poster--wide {
      display: none;
    }

    .lattice-poster--narrow {
      display: block;
    }
  }

  .hero-in {
    position: relative;
  }

  .hero-eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    font: var(--weight-medium) 0.8125rem / 1.3 var(--font-mono);
    color: var(--n-muted);
  }

  .status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    background: rgb(116 211 196 / 0.1);
    box-shadow: inset 0 0 0 1px rgb(116 211 196 / 0.25);
    color: var(--mint);
  }

  .status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mint);
  }

  .hero h1 {
    margin: var(--space-6) 0 0 -0.04em;
    font-size: var(--text-hero);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-hero);
  }

  .hero-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-6) var(--space-12);
    align-items: end;
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--n-hair-strong);
  }

  .pitch {
    max-width: var(--measure-pitch);
    font-size: var(--text-lead);
    line-height: 1.55;
    color: var(--n-muted);
  }

  .pitch strong {
    font-weight: var(--weight-semibold);
    color: var(--n-ink);
  }

  .cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .proof-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-8);
  }

  .proof-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-4);
    border-radius: var(--radius-tile);
    background: rgb(15 36 43 / 0.74);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 0 0 1px var(--n-hair-strong), inset 0 1px 0 rgb(255 255 255 / 0.06);
  }

  .proof-value {
    font: var(--weight-medium) var(--text-tile) / 1 var(--font-sans);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums slashed-zero;
    white-space: nowrap;
  }

  .proof-label {
    margin-top: var(--space-2);
    font: var(--weight-medium) var(--text-label) / 1.3 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--n-ink);
  }

  .proof-base {
    font-size: var(--text-small);
    line-height: 1.45;
    color: var(--n-muted);
  }

  .proof-link {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-top: auto;
    padding-top: var(--space-2);
    font-size: var(--text-small);
    color: var(--mint);
    text-decoration: none;
  }

  /* The whole tile opens the project. */
  .proof-link::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
  }

  .proof-tile:hover {
    box-shadow: inset 0 0 0 1px rgb(116 211 196 / 0.45), inset 0 1px 0 rgb(255 255 255 / 0.06);
  }

  .proof-link:hover {
    color: var(--mint);
    text-decoration: underline;
    text-underline-offset: 4px;
  }

  /* Legend for the lattice: the hero is a chart, so it says what the dots are. */
  /* A glass panel at every width: below 981 px it sits in the flow, over the densest part of the field. */
  .hud {
    margin-top: var(--space-6);
    padding: 14px var(--space-4) var(--space-4);
    border-radius: var(--space-4);
    background: rgb(9 23 28 / 0.62);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: inset 0 0 0 1px var(--n-hair), inset 0 1px 0 rgb(255 255 255 / 0.08);
    font: var(--weight-medium) 0.6875rem / 1.3 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--n-muted);
  }

  .hud ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) 18px;
    margin-top: var(--space-2);
  }

  .hud li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 24px;
  }

  .hud i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
  }

  .hud-kept {
    background: var(--petrol-d);
  }

  .hud-churned {
    background: var(--coral);
  }

  .hud a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--n-ink);
  }

  .hud a:hover {
    color: var(--mint);
  }

  @media (min-width: 981px) {
    .hud {
      position: absolute;
      top: 0;
      right: max(var(--wrap-gutter), env(safe-area-inset-right, 0px));
      margin: 0;
      background: rgb(9 23 28 / 0.5);
    }

    .hud ul {
      display: grid;
      gap: var(--space-2);
      margin-top: var(--space-3);
    }
  }

  /* ---- Proof: the Orders pipeline ------------------------------------- */

  .proof {
    padding-block: var(--section-pad);
  }

  .proof-in {
    display: grid;
    grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
    gap: clamp(28px, 5vw, 72px);
    align-items: center;
  }

  .proof h2 {
    margin-top: var(--space-4);
    font-size: clamp(2rem, 1.4rem + 2.4vw, 3.4rem);
    line-height: 1.02;
    letter-spacing: var(--tracking-h2);
  }

  .captions {
    display: grid;
    gap: 14px;
    margin-top: var(--space-8);
    counter-reset: caption;
  }

  .captions li {
    position: relative;
    padding: var(--space-4) 18px var(--space-4) 52px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgb(255 255 255 / 0.035), rgb(255 255 255 / 0.01));
    box-shadow: inset 0 0 0 1px var(--n-hair), inset 0 1px 0 rgb(255 255 255 / 0.05);
    color: var(--n-muted);
    font-size: 0.9375rem;
    line-height: 1.5;
    counter-increment: caption;
  }

  .captions li::before {
    content: counter(caption, decimal-leading-zero);
    position: absolute;
    left: 18px;
    top: 17px;
    font: var(--weight-medium) var(--text-label) / 1.5 var(--font-mono);
    color: var(--mint);
  }

  .captions strong {
    font-weight: var(--weight-semibold);
    color: var(--n-ink);
  }

  .pipe-fig {
    margin: 0;
    min-width: 0;
    padding: clamp(14px, 2vw, 24px);
    border: 1px solid transparent;
    border-radius: 24px;
    background:
      linear-gradient(180deg, var(--night-2), var(--night)) padding-box,
      linear-gradient(160deg, rgb(116 211 196 / 0.4), rgb(255 255 255 / 0.06) 38%, rgb(255 255 255 / 0.03)) border-box;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 50px 100px -40px rgb(0 0 0 / 0.75);
  }

  .pipe-svg {
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .pipe-svg--narrow {
    display: none;
  }

  @media (max-width: 560px) {
    .pipe-svg:not(.pipe-svg--narrow) {
      display: none;
    }

    .pipe-svg--narrow {
      display: block;
    }
  }

  .p-node { fill: var(--night-3); stroke: var(--n-hair-strong); stroke-width: 1.2; }
  .p-lane { fill: none; stroke: var(--n-hair-strong); stroke-width: 1.5; stroke-dasharray: 3 6; }
  .p-gate { fill: var(--mint); }
  .p-t { font: var(--weight-medium) 13px var(--font-mono); fill: var(--n-ink); }
  .p-s { font: var(--weight-regular) 11px var(--font-mono); fill: var(--n-muted); }
  .p-big { font: var(--weight-semibold) 30px var(--font-sans); letter-spacing: -0.04em; }
  .p-src rect { fill: none; stroke: var(--n-tertiary); stroke-width: 1.2; stroke-dasharray: 3 3; }
  .p-clean { fill: var(--mint); }
  .p-rejected { fill: var(--coral); }
  .p-held { fill: var(--amber); }
  .p-rev rect:nth-of-type(1) { fill: var(--mint); }
  .p-rev rect:nth-of-type(2) { fill: var(--mint-600); }
  .p-rev rect:nth-of-type(3) { fill: var(--mint-700); }
  .p-rev text { font: var(--weight-semibold) 11px var(--font-mono); fill: var(--on-mint); }

  .pipe-fig figcaption {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-top: 14px;
    font: var(--weight-medium) var(--text-label) / 1.5 var(--font-mono);
    color: var(--n-muted);
  }

  .pipe-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px var(--space-3);
  }

  .pipe-tools > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .pipe-tools .tool-mark,
  .chips .tool-mark {
    flex-basis: 22px;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
  }

  .pipe-tools .tool-mark img,
  .chips .tool-mark img {
    width: 14px;
    height: 14px;
  }

  .pipe-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-4);
  }

  .pipe-links a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 32px;
    color: var(--mint);
    text-decoration: none;
  }

  .pipe-links a:hover {
    color: var(--mint);
    text-decoration: underline;
    text-underline-offset: 4px;
  }

  /* ---- Work: one panel per project ------------------------------------ */

  .panels {
    display: grid;
    gap: 20px;
    counter-reset: fig;
  }

  .panel-in {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
    gap: clamp(24px, 3.5vw, 48px);
    padding: clamp(22px, 3.2vw, 44px);
    border-radius: var(--radius-panel);
    background: var(--card);
    box-shadow: var(--hi), var(--shadow-card);
  }

  /* The copy reads in three groups (what it is, the numbers, the evidence), spread over the panel's height. */
  .panel-copy {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    min-width: 0;
  }

  .panel-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px var(--space-4);
    font: var(--weight-medium) var(--text-label) / 1.3 var(--font-mono);
    color: var(--ink-500);
  }

  .panel-idx {
    color: var(--rust-text);
  }

  .panel-in h3 {
    margin-top: var(--space-4);
    font-size: clamp(1.4rem, 1.1rem + 0.9vw, 1.75rem);
    line-height: var(--leading-heading);
    letter-spacing: var(--tracking-h3);
  }

  .metric {
    margin-top: auto;
    padding-top: var(--space-6);
    font: var(--weight-medium) var(--text-metric) / 0.92 var(--font-sans);
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums slashed-zero;
    white-space: nowrap;
  }

  .metric-label {
    margin-top: var(--space-3);
    font: var(--weight-medium) var(--text-label) / 1.4 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-700);
  }

  .metric-base {
    margin-top: 2px;
    font: var(--weight-regular) var(--text-small) / 1.5 var(--font-mono);
    color: var(--ink-500);
  }

  .panel-sum {
    max-width: var(--measure);
    margin-top: var(--space-3);
    color: var(--ink-500);
  }

  /* The numbers: a rule, the headline metric with its label and baseline, then the project's other metrics. */
  .panel-stat {
    display: grid;
    gap: var(--space-4);
  }

  .stat-rule {
    display: block;
    height: 1px;
    background: var(--line-strong);
    transform-origin: 0 50%;
  }

  /* The headline metric keeps to its own width, so the other metrics sit beside it where the panel has the
     room and drop below it where it does not. */
  .stat-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-4) var(--space-6);
  }

  .stat-main {
    flex: none;
    width: min-content;
    min-width: min(100%, 15rem);
    max-width: 100%;
  }

  .stat-main:only-child {
    width: auto;
  }

  .panel-in .metric {
    margin-top: 0;
    padding-top: 0;
    font-size: clamp(3rem, 1.75rem + 3.6vw, 5rem);
  }

  .stat-more {
    display: grid;
    flex: 1 1 160px;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3) 20px;
    padding-top: 6px;
  }

  .stat-more li {
    display: grid;
    align-content: start;
    gap: 3px;
    padding-left: var(--space-3);
    border-left: 1px solid var(--line-strong);
  }

  .stat-more b {
    font: var(--weight-semibold) 1.125rem / 1.1 var(--font-sans);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums slashed-zero;
    white-space: nowrap;
  }

  .stat-more li > span {
    font: var(--weight-medium) 0.6875rem / 1.35 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-700);
  }

  .stat-more small {
    font: var(--weight-regular) 0.6875rem / 1.4 var(--font-mono);
    color: var(--ink-500);
  }

  /* The evidence: the finding as a marked note, the tools, then the way in. */
  .panel-foot {
    display: grid;
    gap: var(--space-3);
    justify-items: start;
  }

  .panel-find {
    position: relative;
    max-width: var(--measure);
    padding-left: var(--space-4);
    font-size: var(--text-small);
    line-height: 1.5;
  }

  .panel-find::before {
    content: "";
    position: absolute;
    inset: 3px auto 3px 0;
    width: 2px;
    border-radius: 2px;
    background: var(--rust);
  }

  .find-tag {
    margin-right: 2px;
    font: var(--weight-medium) 0.6875rem / 1 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rust-text);
  }

  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--space-4);
  }

  .chips li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
    border-radius: var(--radius-pill);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent);
    font: var(--weight-medium) 0.8125rem / 1 var(--font-sans);
  }

  /* On a panel the chips are outlined and their marks a little larger, so the logos read. */
  .panel-in .chips {
    margin-top: 0;
  }

  .panel-in .chips li {
    padding: 3px var(--space-3) 3px 3px;
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .panel-in .chips .tool-mark {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
    box-shadow: 0 0 0 1px var(--logo-ring);
  }

  .panel-in .chips .tool-mark img {
    width: 15px;
    height: 15px;
  }

  .panel-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 20px;
  }

  /* The way in is a pill; the repository or live report stays a quiet link beside it. */
  .panel-links .more {
    min-height: 40px;
    margin-block: 2px;
    padding: 0 var(--space-4) 0 18px;
    border-radius: var(--radius-pill);
    background: var(--ink);
    color: var(--bg);
  }

  .panel-links .more:hover {
    background: var(--rust);
    color: var(--on-rust);
    text-decoration: none;
  }

  /* The figure's stage: corner ticks, as on a drawing sheet. */
  .panel-in .fig {
    margin: 0;
  }

  .panel-in .fig::after {
    --tick: color-mix(in srgb, var(--ink) 34%, transparent);
    content: "";
    position: absolute;
    inset: 6px;
    pointer-events: none;
    background:
      linear-gradient(var(--tick) 0 0) 0 0 / 12px 1px,
      linear-gradient(var(--tick) 0 0) 0 0 / 1px 12px,
      linear-gradient(var(--tick) 0 0) 100% 0 / 12px 1px,
      linear-gradient(var(--tick) 0 0) 100% 0 / 1px 12px,
      linear-gradient(var(--tick) 0 0) 0 100% / 12px 1px,
      linear-gradient(var(--tick) 0 0) 0 100% / 1px 12px,
      linear-gradient(var(--tick) 0 0) 100% 100% / 12px 1px,
      linear-gradient(var(--tick) 0 0) 100% 100% / 1px 12px;
    background-repeat: no-repeat;
  }

  @media (prefers-reduced-motion: no-preference) {
    .panel-links .more {
      transition: background-color 200ms var(--ease-standard), color 200ms var(--ease-standard);
    }

    /* No transform transitions on anything GSAP moves (chips, cards, pips): the two would fight. A chip's
       hover turns its mark instead. */
    .panel-in .chips li {
      transition: box-shadow 240ms var(--ease-standard);
    }

    @media (hover: hover) {
      .panel-in .chips li:hover {
        box-shadow: inset 0 0 0 1px var(--ink-500);
      }

      .panel-in .chips li:hover .tool-mark {
        transform: scale(1.12) rotate(-6deg);
      }
    }
  }

  /* ---- How I work ------------------------------------------------------ */

  .process {
    background: var(--surface);
  }

  .steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }

  .step {
    display: flex;
    flex-direction: column;
    padding: clamp(20px, 2.6vw, 32px);
    border-radius: 24px;
    background: var(--card);
    box-shadow: var(--hi), var(--shadow-card);
  }

  .step-no {
    font: var(--weight-medium) var(--text-label) / 1.3 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rust-text);
  }

  .step h3 {
    margin-top: var(--space-3);
    font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.9rem);
    line-height: 1.1;
    letter-spacing: var(--tracking-h3);
  }

  .step > p:not(.step-no) {
    margin-top: var(--space-3);
    padding-bottom: var(--space-6);
    color: var(--ink-500);
  }

  .evidence {
    display: grid;
    gap: 10px;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }

  .evidence li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-3);
    align-items: baseline;
    font-size: var(--text-small);
    line-height: 1.5;
  }

  .ev-tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-chip);
    background: var(--surface);
    font: var(--weight-medium) 0.6875rem / 1 var(--font-mono);
    color: var(--rust-text);
    text-decoration: none;
  }

  .ev-tag:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  /* ---- Experience ------------------------------------------------------ */

  .xp-intro {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: var(--space-8) clamp(40px, 7vw, 112px);
    align-items: center;
  }

  .xp-head h2 {
    margin-top: var(--space-4);
    font-size: var(--text-h2);
    line-height: 1.02;
    letter-spacing: var(--tracking-h2);
  }

  .xp-head .about-text {
    margin-top: var(--space-6);
  }

  /* The portrait as a staff badge: a light card in both themes with a lanyard slot. The photo's white studio
     backdrop is multiplied onto a warm wash, so the card reads as one finished object. */
  .id-card {
    position: relative;
    margin: 0;
    padding: 26px 12px 18px;
    border-radius: 24px;
    background: var(--logo-bg);
    color: var(--ink-950);
    box-shadow: 0 0 0 1px var(--logo-ring), 0 28px 56px -32px rgb(9 23 28 / 0.6);
  }

  .id-card::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 44px;
    height: 6px;
    margin-left: -22px;
    border-radius: 3px;
    background: var(--bg);
    box-shadow: inset 0 1px 2px rgb(9 23 28 / 0.3);
  }

  .id-photo {
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(165deg, #f8d9c8 0%, #f4ebe2 48%, #d4ebe5 100%);
    isolation: isolate;
  }

  .id-photo .headshot {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: multiply;
  }

  .id-meta {
    display: grid;
    gap: 3px;
    padding: 14px 6px 0;
  }

  .id-meta strong {
    font-size: 1.125rem;
    font-weight: var(--weight-semibold);
    line-height: 1.2;
    letter-spacing: -0.02em;
  }

  .id-meta span {
    font: var(--weight-medium) 0.6875rem / 1.45 var(--font-mono);
    color: #4f6168;
  }

  .id-meta span:first-of-type {
    color: var(--rust-600);
  }

  .about-text {
    max-width: var(--measure);
    color: var(--ink-500);
  }

  .about-text p + p {
    margin-top: 0.8em;
  }

  /* The to-scale strip: one gridline per year, bars placed by month (src/_data/career.js). */
  .strip {
    margin: var(--space-10) 0 0;
    padding-top: 22px;
  }

  .strip-track {
    position: relative;
    height: 56px;
    border-radius: var(--radius-tile);
    background: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(100% / var(--years, 13)));
  }

  .s-bar {
    position: absolute;
    height: 20px;
    border-radius: var(--radius-chip);
  }

  .s-ops { background: var(--petrol); }
  .s-edu { background: var(--petrol-soft); box-shadow: inset 0 0 0 1.5px var(--petrol); }
  .s-vol { background: var(--rust); }

  .s-bar.s-ops,
  .s-bar.s-vol {
    top: 6px;
  }

  .s-bar.s-edu {
    top: 30px;
  }

  .s-ops + .s-ops {
    box-shadow: -3px 0 0 var(--bg);
  }

  .s-bar > span {
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    font: var(--weight-medium) 0.65625rem / 1 var(--font-mono);
    color: var(--ink-500);
    white-space: nowrap;
  }

  .s-end > span {
    left: auto;
    right: 0;
  }

  /* Study bars sit in the lower row, so their labels go inside them, and only when they fit: a label
     longer than its bar wraps past the empty first item onto a second line, which the bar clips. */
  .s-bar.s-edu {
    display: flex;
    flex-wrap: wrap;
    overflow: hidden;
  }

  .s-bar.s-edu::before {
    content: "";
    height: 100%;
  }

  .s-edu > span,
  .s-edu.s-end > span {
    position: static;
    padding-inline: var(--space-2);
    line-height: 20px;
    color: var(--ink);
  }

  .s-now {
    position: absolute;
    top: -8px;
    bottom: -4px;
    width: 0;
    border-left: 1.5px dashed var(--rust);
  }

  .s-now b {
    position: absolute;
    top: -16px;
    right: 4px;
    font: var(--weight-medium) 0.625rem / 1 var(--font-mono);
    color: var(--rust-text);
  }

  .s-axis {
    position: relative;
    height: 16px;
    margin-top: var(--space-2);
    font: var(--weight-regular) 0.6875rem / 1 var(--font-mono);
    color: var(--ink-500);
  }

  .s-axis span {
    position: absolute;
    transform: translateX(-50%);
  }

  .s-axis span:first-child {
    transform: none;
  }

  .s-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px var(--space-4);
    margin-top: 14px;
    font: var(--weight-regular) 0.6875rem / 1 var(--font-mono);
    color: var(--ink-500);
  }

  .s-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .s-legend i {
    width: 14px;
    height: 9px;
    border-radius: 3px;
  }

  .xp {
    margin-top: var(--space-12);
  }

  .xp > li {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: var(--space-2) 40px;
    padding-block: 26px;
    border-top: 1px solid var(--line);
  }

  .xp-when {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    font: var(--weight-medium) var(--text-label) / 1.6 var(--font-mono);
    color: var(--ink-500);
  }

  /* A dot in the strip's colour for each entry. */
  .xp-when span:first-child::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: var(--space-2);
    border-radius: 50%;
    background: var(--petrol);
  }

  .xp-edu .xp-when span:first-child::before {
    background: var(--petrol-soft);
    box-shadow: inset 0 0 0 1.5px var(--petrol);
  }

  .xp-vol .xp-when span:first-child::before {
    background: var(--rust);
  }

  .xp h3 {
    font-size: clamp(1.15rem, 1rem + 0.6vw, 1.45rem);
    line-height: 1.2;
    letter-spacing: -0.03em;
  }

  .xp-org {
    margin-top: var(--space-1);
    font: var(--weight-medium) var(--text-small) / 1.5 var(--font-mono);
    color: var(--ink-700);
  }

  .xp-what > ul,
  .xp-what > p:last-child:not(.xp-org) {
    max-width: var(--measure);
    margin-top: 10px;
    color: var(--ink-500);
  }

  .xp-what > ul {
    display: grid;
    gap: var(--space-1);
    padding-left: 1.1em;
    list-style: disc;
  }

  /* ---- Toolkit --------------------------------------------------------- */

  .tk-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
  }

  .tk-board {
    display: grid;
    gap: 20px;
    min-width: 0;
  }

  /* The published projects as a numbered key; each tool card then carries one pip per project, filled where
     the project uses the tool. */
  .tk-key {
    display: grid;
    gap: var(--space-3);
  }

  .tk-key-label {
    font: var(--weight-medium) var(--text-label) / 1.3 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-500);
  }

  .tk-projects {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
  }

  .tk-p {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
    min-height: 48px;
    padding: 6px var(--space-3) 6px var(--space-2);
    border-radius: 14px;
    background: var(--card);
    box-shadow: var(--hi), 0 0 0 1px var(--line);
    color: var(--ink);
    font: var(--weight-semibold) 0.8125rem / 1.25 var(--font-sans);
    letter-spacing: -0.01em;
    text-decoration: none;
  }

  .tk-pno {
    display: grid;
    place-items: center;
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: var(--space-2);
    background: var(--rust);
    color: var(--on-rust);
    font: var(--weight-semibold) var(--text-label) / 1 var(--font-mono);
  }

  .tk-p:hover,
  .tk-p.is-lit {
    box-shadow: var(--hi), 0 0 0 1.5px var(--rust);
    color: var(--ink);
  }

  .tk-groups {
    display: grid;
    gap: var(--space-6);
  }

  .tk-group {
    display: grid;
    gap: var(--space-3);
  }

  /* The filter hides a group with a class, not the hidden attribute, so the motion layer can animate it. */
  .tk-group.is-out {
    display: none;
  }

  .tk-band {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    font-size: 1rem;
    font-weight: var(--weight-semibold);
    letter-spacing: -0.02em;
  }

  .tk-band span {
    font: var(--weight-medium) var(--text-label) / 1 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-500);
  }

  .tk-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 10px;
  }

  .tk-card {
    display: grid;
    align-content: space-between;
    gap: var(--space-4);
    min-width: 0;
    padding: 14px;
    border: 1px solid transparent;
    border-radius: 18px;
    background: var(--card);
    box-shadow: var(--hi), var(--shadow-card);
  }

  .tk-card--learning {
    border: 1px dashed var(--line-strong);
    background: transparent;
    box-shadow: none;
  }

  .tk-tool {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
  }

  .tk-tool .tool-mark {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-tile);
  }

  .tk-tool .tool-mark img {
    width: 26px;
    height: 26px;
  }

  .tk-card--learning .tool-mark {
    border-style: dashed;
  }

  .tk-name {
    display: grid;
    gap: 2px;
    min-width: 0;
    font-size: 0.9375rem;
    font-weight: var(--weight-semibold);
    line-height: 1.25;
    letter-spacing: -0.01em;
  }

  .tk-name small {
    font: var(--weight-regular) 0.6875rem / 1.3 var(--font-mono);
    letter-spacing: 0;
    color: var(--ink-500);
  }

  .tk-use {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: 20px;
  }

  .tk-pips {
    display: flex;
    gap: var(--space-1);
  }

  .tk-pip {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-chip);
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--ink-500);
    font: var(--weight-medium) 0.625rem / 1 var(--font-mono);
    font-style: normal;
  }

  .tk-pip.is-used {
    background: var(--rust);
    box-shadow: none;
    color: var(--on-rust);
    font-weight: var(--weight-semibold);
  }

  .tk-pip.is-hot {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--rust) 30%, transparent);
  }

  .tk-n {
    white-space: nowrap;
    font: var(--weight-semibold) 0.875rem / 1 var(--font-mono);
  }

  .tk-n span {
    font-weight: var(--weight-regular);
    color: var(--ink-500);
  }

  .tk-learning {
    display: inline-block;
    padding: 4px 8px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-pill);
    font: var(--weight-medium) 0.625rem / 1 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-500);
  }

  /* Pointing at a project lights the tools it uses and quietens the rest; pointing at a tool lights its
     projects in the key (js/main.js sets the classes). */
  .tk-card.is-lit {
    border-color: var(--rust);
  }

  /* The card's contents fade, not the card: the motion layer animates the card's own opacity and transform,
     so neither gets a CSS transition here. */
  .tk-card.is-dim > * {
    opacity: 0.4;
  }

  @media (hover: hover) {
    .tk-card:hover {
      border-color: var(--line-strong);
    }

    .tk-card.is-lit:hover {
      border-color: var(--rust);
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .tk-p {
      transition: box-shadow var(--duration-base) var(--ease-standard);
    }

    .tk-card {
      transition: border-color var(--duration-base) var(--ease-standard);
    }

    .tk-card > * {
      transition: opacity var(--duration-base) var(--ease-standard);
    }

    .tk-pip {
      transition: box-shadow 240ms var(--ease-standard);
    }

    @media (hover: hover) {
      .tk-card:hover .tool-mark {
        transform: scale(1.08) rotate(-4deg);
      }
    }
  }

  .tk-side {
    display: grid;
    gap: var(--space-3);
  }

  /* The tool cards run longer than the side cards, so those stay in view beside them on wide screens. */
  @media (min-width: 981px) {
    .tk-side {
      position: sticky;
      top: calc(var(--header-space, 96px) + var(--space-4));
    }
  }

  .side-card {
    padding: 22px;
    border-radius: 22px;
    background: var(--card);
    box-shadow: var(--hi), var(--shadow-card);
  }

  .side-label {
    font: var(--weight-medium) var(--text-label) / 1.3 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-500);
  }

  .creds ul {
    margin-top: 6px;
  }

  .cred {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: var(--space-4);
    align-items: center;
    padding-block: var(--space-4);
    border-top: 1px solid var(--line);
  }

  .cred:first-child {
    border-top: 0;
  }

  .cred-badge {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
  }

  .cred-badge img {
    width: 64px;
    height: 64px;
    object-fit: contain;
  }

  /* No badge image yet: the issuer's logo, or a seal, on a round tile. */
  .cred-badge--seal {
    border-radius: 50%;
    background: var(--logo-bg);
    box-shadow: 0 0 0 1px var(--logo-ring), inset 0 0 0 5px var(--surface);
    color: var(--rust-text);
  }

  .cred-badge--seal img {
    width: 26px;
    height: 28px;
  }

  .cred-badge--seal .icon {
    width: 28px;
    height: 28px;
  }

  .cred-text {
    display: grid;
    gap: 3px;
    justify-items: start;
    min-width: 0;
  }

  .cred-text strong {
    font-size: 0.9375rem;
    font-weight: var(--weight-semibold);
    line-height: 1.3;
  }

  .cred-text > span {
    font: var(--weight-regular) var(--text-label) / 1.5 var(--font-mono);
    color: var(--ink-500);
  }

  .cred-verify {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    font: var(--weight-medium) var(--text-label) / 1 var(--font-mono);
    color: var(--rust-text);
    text-decoration: none;
  }

  .cred-verify:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .cred-verify .icon {
    width: 15px;
    height: 15px;
  }

  .cred-text em {
    font: var(--weight-medium) var(--text-label) / 1.5 var(--font-mono);
    font-style: normal;
    color: var(--ink-500);
  }

  .note h3 {
    margin-top: 10px;
    font-size: 1.25rem;
    line-height: 1.2;
    letter-spacing: -0.03em;
  }

  .note h3 a {
    text-decoration: none;
  }

  .note h3 a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
  }

  .note > p:not(.side-label) {
    margin-top: var(--space-2);
    font-size: var(--text-small);
    color: var(--ink-500);
  }

  /* ---- Contact --------------------------------------------------------- */

  .contact {
    padding-block: clamp(96px, 14vw, 180px) var(--space-12);
  }

  .contact h2 {
    margin-top: 22px;
    font-size: var(--text-hero);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-hero);
  }

  .c-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-6);
    align-items: end;
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid var(--n-hair-strong);
  }

  .mail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    min-width: 0;
  }

  .mail-addr {
    min-width: 0;
    padding-block: 4px;
    font: var(--weight-medium) clamp(1.1rem, 0.85rem + 1.2vw, 1.8rem) / 1.2 var(--font-mono);
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
    color: var(--n-ink);
    text-decoration-color: var(--n-hair-strong);
    text-underline-offset: 6px;
  }

  .mail-addr:hover {
    color: var(--mint);
  }

  .copied {
    font: var(--weight-medium) var(--text-label) / 1 var(--font-mono);
    color: var(--mint);
  }

  .copy-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: rgb(255 255 255 / 0.05);
    box-shadow: inset 0 0 0 1px var(--n-hair-strong);
    color: var(--n-ink);
    cursor: pointer;
  }

  .copy-btn:hover {
    background: rgb(255 255 255 / 0.11);
  }

  .copy-btn > [aria-hidden] {
    grid-area: 1 / 1;
    display: inline-flex;
  }

  .copy-btn .icon {
    width: 18px;
    height: 18px;
  }

  .copy-done,
  .copy-btn[data-state="copied"] .copy-icon {
    opacity: 0;
  }

  .copy-btn[data-state="copied"] .copy-done {
    opacity: 1;
    color: var(--mint);
  }

  /* LinkedIn, GitHub and the resume as logo tiles with a small caption. */
  .dock {
    display: flex;
    gap: var(--space-4);
  }

  .dock-item {
    display: grid;
    justify-items: center;
    gap: 9px;
    border-radius: 18px;
    font: var(--weight-medium) 0.6875rem / 1 var(--font-mono);
    letter-spacing: 0.04em;
    color: var(--n-muted);
    text-decoration: none;
  }

  .dock-tile {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgb(255 255 255 / 0.05);
    box-shadow: inset 0 0 0 1px var(--n-hair-strong), inset 0 1px 0 rgb(255 255 255 / 0.08);
    color: var(--n-ink);
  }

  .dock-tile img,
  .dock-tile .icon {
    width: 26px;
    height: 26px;
  }

  .dock-tile--doc {
    color: var(--rust-200);
  }

  .dock-item:hover {
    color: var(--n-ink);
  }

  .dock-item:hover .dock-tile {
    background: rgb(255 255 255 / 0.1);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.08);
  }

  @media (prefers-reduced-motion: no-preference) {
    .copy-btn > [aria-hidden] {
      transition: opacity 160ms var(--ease-standard);
    }

    .dock-tile {
      transition: transform 240ms var(--ease-out), background-color 200ms var(--ease-standard);
    }

    .dock-item:hover .dock-tile {
      transform: translateY(-3px);
    }
  }

  .c-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-16);
    font: var(--weight-regular) var(--text-label) / 1.5 var(--font-mono);
    color: var(--n-muted);
  }

  /* ---- Breakpoints ----------------------------------------------------- */

  @media (max-width: 1180px) {
    .steps {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .proof-tiles {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 980px) {
    .sec-head,
    .hero-foot,
    .proof-in,
    .panel-in,
    .tk-grid,
    .c-row {
      grid-template-columns: minmax(0, 1fr);
    }

    .metric {
      margin-top: var(--space-4);
      padding-top: 0;
    }
  }

  @media (max-width: 760px) {
    .steps {
      grid-template-columns: minmax(0, 1fr);
    }

    /* The portrait card turns sideways above the heading: photo on the left, name beside it. */
    .xp-intro {
      grid-template-columns: minmax(0, 1fr);
    }

    .id-card {
      display: grid;
      grid-template-columns: 112px minmax(0, 1fr);
      align-items: center;
      gap: var(--space-4);
      max-width: 420px;
      padding: 12px;
      border-radius: 20px;
    }

    .id-card::before {
      display: none;
    }

    .id-photo {
      border-radius: 12px;
    }

    .id-meta {
      padding: 0;
    }

    .xp > li {
      grid-template-columns: minmax(0, 1fr);
    }

    .xp-when {
      flex-direction: row;
      flex-wrap: wrap;
      gap: var(--space-1) var(--space-3);
    }
  }

  @media (max-width: 560px) {
    .hero {
      padding-top: calc(var(--header-space) + var(--space-6));
    }

    /* Give the drawn-to-scale figures the panel's full width so their labels stay legible. */
    .panel-in {
      padding: 18px;
    }

    .panel-in .fig {
      margin-inline: -8px;
      padding-inline: 10px;
    }

    .panel-links .more {
      padding-inline: var(--space-4) 14px;
    }

    .tk-projects,
    .tk-cards {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: var(--space-2);
    }

    .tk-card {
      gap: var(--space-3);
      padding: var(--space-3);
      border-radius: var(--space-4);
    }

    .tk-tool {
      gap: var(--space-2);
    }

    .tk-tool .tool-mark {
      flex-basis: 36px;
      width: 36px;
      height: 36px;
      border-radius: 10px;
    }

    .tk-tool .tool-mark img {
      width: 21px;
      height: 21px;
    }

    .tk-name {
      font-size: 0.875rem;
      line-height: 1.2;
    }

    .tk-name small {
      display: none;
    }

    .tk-pips {
      gap: 3px;
    }

    .tk-pip {
      width: 16px;
      height: 16px;
      border-radius: 5px;
      font-size: 0.5625rem;
    }

    .s-bar:not(.s-edu) > span,
    .s-now b {
      display: none;
    }

    .s-axis span:nth-child(even) {
      display: none;
    }
  }

  /* ---- Motion states (js/motion/, DESIGN-SYSTEM §6) --------------------- */
  /* Everything below applies only while the motion layer runs; without it the page is the finished
     static version above. Transform and opacity only. */

  /* Hero intro: the head script sets data-intro before first paint so these parts do not flash in and
     out; js/motion/home.js removes it once GSAP holds them. The failsafe shows them after 2.5 s anyway. */
  @media (prefers-reduced-motion: no-preference) {
    :root[data-intro] :is(.hero-eyebrow > *, .proof-tile, .hud, .scroll-cue) {
      opacity: 0;
      animation: intro-failsafe 0s 2.5s forwards;
    }
  }

  @keyframes intro-failsafe {
    to {
      opacity: 1;
    }
  }

  /* Hero lattice (js/motion/hero.js): the head script sets data-scene before first paint, so the poster does
     not show and then swap. It becomes "live" once the WebGL scene has drawn, and is removed when the scene
     cannot run or is switched off, which brings the poster back. The failsafe shows it after 3 s anyway. */
  .lattice-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    .lattice-poster,
    .lattice-canvas {
      transition: opacity 0.8s var(--ease-standard);
    }

    :root[data-scene] .lattice-poster {
      opacity: 0;
    }

    :root[data-scene="pending"] .lattice-poster {
      animation: intro-failsafe 0.6s 3s both;
    }

    :root[data-scene="live"] .lattice-canvas {
      opacity: 1;
    }
  }

  /* Scroll cue under the proof tiles: three passes of the dot (under 5 s), gone on the first scroll. */
  .scroll-cue {
    display: none;
  }

  @media (min-width: 981px) and (min-height: 700px) {
    .hero {
      padding-bottom: var(--space-16);
    }

    .scroll-cue {
      position: absolute;
      z-index: 1;
      left: 50%;
      bottom: 14px;
      display: flex;
      align-items: center;
      gap: 10px;
      translate: -50% 0;
      font: var(--weight-medium) var(--text-label) / 1 var(--font-mono);
      letter-spacing: var(--tracking-label);
      text-transform: uppercase;
      color: var(--n-muted);
    }
  }

  .scroll-cue i {
    position: relative;
    width: 1px;
    height: 28px;
    overflow: hidden;
    background: var(--n-hair-strong);
  }

  .scroll-cue i::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 10px;
    background: var(--mint);
  }

  .scroll-cue.is-gone {
    opacity: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    .scroll-cue {
      transition: opacity 300ms var(--ease-standard);
    }

    .scroll-cue i::after {
      animation: cue-drop 1.6s var(--ease-standard) 3 both;
    }
  }

  @keyframes cue-drop {
    from {
      transform: translateY(-10px);
    }

    to {
      transform: translateY(28px);
    }
  }

  /* Section headings rise line by line inside masks (SplitText names the mask of each .ln line .ln-mask).
     The mask is padded so descenders are not clipped, and the padding is taken back so the height holds. */
  .ln-mask {
    padding-bottom: 0.14em;
    margin-bottom: -0.14em;
  }

  /* Proof scene: the caption for the current step is ringed in mint; the others keep full contrast.
     The meter shows only while the scene is pinned and scrubbed. */
  .captions li::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgb(116 211 196 / 0.6), 0 0 0 4px rgb(116 211 196 / 0.08);
    opacity: 0;
    pointer-events: none;
  }

  .is-live .captions li.is-on::after {
    opacity: 1;
  }

  .is-live .captions li.is-on {
    transform: translateX(6px);
  }

  .pipe-meter {
    display: none;
  }

  .is-scrub .pipe-meter {
    display: block;
    position: relative;
    height: 2px;
    margin-top: var(--space-6);
    overflow: hidden;
    border-radius: 2px;
    background: var(--n-hair-strong);
  }

  .pipe-meter i {
    position: absolute;
    inset: 0;
    background: var(--mint);
    transform: scaleX(0);
    transform-origin: 0 50%;
  }

  @media (prefers-reduced-motion: no-preference) {
    .captions li,
    .captions li::after {
      transition: transform 500ms var(--ease-out), opacity 300ms var(--ease-standard);
    }
  }

  /* Marquee: each project's headline number, then the tools applied in them (src/_includes/home/marquee.njk). */
  .marquee {
    display: grid;
    gap: clamp(16px, 2.4vw, 28px);
    overflow: hidden;
    padding-block: clamp(40px, 6vw, 80px);
    border-bottom: 1px solid var(--line);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  }

  .mq-row {
    display: flex;
    width: max-content;
  }

  .mq-set {
    display: flex;
    flex: none;
    align-items: center;
  }

  .mq-num {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding-right: 0.5em;
    font: var(--weight-medium) clamp(2.2rem, 1.3rem + 4vw, 5rem) / 1.1 var(--font-sans);
    letter-spacing: -0.05em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .mq-num em {
    max-width: 11em;
    font: var(--weight-medium) var(--text-label) / 1.3 var(--font-mono);
    font-style: normal;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: normal;
    color: var(--ink-500);
  }

  .mq-num::after {
    content: "";
    width: 0.16em;
    height: 0.16em;
    margin-left: 0.3em;
    border-radius: 50%;
    background: var(--rust);
  }

  .mq-tool {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-right: var(--space-3);
    padding: 6px 18px 6px 6px;
    border-radius: var(--radius-pill);
    background: var(--card);
    box-shadow: var(--hi), 0 0 0 1px var(--line);
    font: var(--weight-medium) clamp(1rem, 0.9rem + 0.6vw, 1.35rem) / 1 var(--font-sans);
    letter-spacing: -0.02em;
    white-space: nowrap;
  }

  .mq-tool .tool-mark {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
  }

  .mq-tool .tool-mark img {
    width: 22px;
    height: 22px;
  }

  /* Work reel (desktop, fine pointer): the panels sit side by side and the track slides as the page scrolls.
     The section clips the track so the page never scrolls sideways. The rail above has one segment per
     project: it fills as the reel reaches that project, and a click jumps there. */
  .work {
    overflow-x: clip;
  }

  .reel-rail {
    display: none;
  }

  .is-reel .reel-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-4);
  }

  .reel-seg {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-2);
    min-height: 30px;
    padding: 0 0 var(--space-1);
    border: 0;
    background: none;
    color: var(--ink-500);
    font: var(--weight-medium) var(--text-label) / 1.2 var(--font-sans);
    text-align: left;
    cursor: pointer;
  }

  .reel-fill {
    position: relative;
    grid-column: 1 / -1;
    height: 2px;
    overflow: hidden;
    border-radius: 2px;
    background: var(--line-strong);
  }

  .reel-fill i {
    position: absolute;
    inset: 0;
    background: var(--rust);
    transform: scaleX(0);
    transform-origin: 0 50%;
  }

  .reel-seg:first-child .reel-fill i {
    transform: none;
  }

  .reel-no {
    font: var(--weight-medium) var(--text-label) / 1.2 var(--font-mono);
    font-variant-numeric: tabular-nums;
  }

  .reel-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .reel-seg:hover,
  .reel-seg[aria-current="true"] {
    color: var(--ink);
  }

  .reel-seg[aria-current="true"] .reel-no {
    color: var(--rust-text);
  }

  .is-reel .panels {
    display: flex;
    gap: 24px;
    width: max-content;
  }

  .is-reel .panel {
    flex: none;
    width: min(1100px, 82vw);
  }

  .is-reel .panel-in {
    position: relative;
    height: 100%;
    padding-block: clamp(22px, 2.4vw, 32px);
  }

  /* Panels away from the centre sit slightly back under a veil of the page colour (js/motion/reel.js sets
     both); the veil keeps the text itself at full opacity. Layers are promoted only while the reel is near. */
  .panel-veil {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--bg);
    opacity: 0;
    pointer-events: none;
  }

  .is-reel.is-live :is(.panel-in, .panel-veil) {
    will-change: transform, opacity;
  }

  /* A soft light under the pointer on a figure's stage (fine pointers). */
  .fig-glow {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
  }

  .fig-glow i {
    position: absolute;
    top: -190px;
    left: -190px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--rust) 17%, transparent), transparent);
  }

  @media (prefers-reduced-motion: no-preference) {
    .reel-seg {
      transition: color var(--duration-base) var(--ease-standard);
    }
  }

  /* Reading position: a hairline across the top of the page that fills with the scroll (js/motion/meter.js). */
  .scroll-meter {
    position: fixed;
    inset: 0 0 auto;
    z-index: calc(var(--z-header) + 1);
    height: 2px;
    background: var(--rust);
    transform: scaleX(0);
    transform-origin: 0 50%;
    pointer-events: none;
  }

  /* Stepper (desktop): a rail fills across the four stages; each lit stage keeps a rust ring, and the
     current one lifts. Unlit stages are unchanged, so their text keeps full contrast. */
  .step-rail {
    display: none;
  }

  .is-stepper .step-rail {
    display: block;
    position: relative;
    height: 2px;
    margin-bottom: 18px;
    overflow: hidden;
    border-radius: 2px;
    background: var(--line);
  }

  .step-rail i {
    position: absolute;
    inset: 0;
    background: var(--rust);
    transform: scaleX(0);
    transform-origin: 0 50%;
  }

  .is-stepper .step {
    position: relative;
  }

  .is-stepper .step::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1.5px var(--rust);
    opacity: 0;
    pointer-events: none;
  }

  .is-stepper .step.is-on::after {
    opacity: 0.35;
  }

  .is-stepper .step.is-current::after {
    opacity: 1;
  }

  .is-stepper .step.is-current {
    transform: translateY(-8px);
  }

  @media (prefers-reduced-motion: no-preference) {
    .is-stepper .step,
    .is-stepper .step::after {
      transition: transform 600ms var(--ease-out), opacity 400ms var(--ease-standard);
    }
  }

  /* Toolkit filter: a pill of three choices; hidden without JavaScript. */
  .tk-filter {
    display: flex;
    justify-self: start;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding: var(--space-1);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .tk-filter button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 40px;
    padding: 0 var(--space-4);
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--ink-700);
    font: var(--weight-semibold) var(--text-small) / 1 var(--font-sans);
    cursor: pointer;
  }

  .tk-filter button span {
    font: var(--weight-medium) var(--text-label) / 1 var(--font-mono);
    color: var(--ink-500);
  }

  .tk-filter button:hover {
    background: var(--card);
  }

  .tk-filter button[aria-pressed="true"] {
    background: var(--ink);
    color: var(--bg);
  }

  .tk-filter button[aria-pressed="true"] span {
    color: inherit;
  }

  @media (prefers-reduced-motion: no-preference) {
    .tk-filter button {
      transition: background-color var(--duration-base) var(--ease-standard), color var(--duration-base) var(--ease-standard);
    }

    /* The press answers at once; only the button being released eases back. */
    .tk-filter button[aria-pressed="true"] {
      transition: none;
    }
  }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

@layer utilities {
  .accent {
    color: var(--rust-text);
  }

  .muted,
  .context {
    color: var(--ink-500);
  }

  .context {
    font-size: var(--text-small);
  }

  .num {
    font-variant-numeric: tabular-nums slashed-zero;
  }

  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
