/* shinnlok.com · hand-written. Layers: tokens, base, shell, home, log, post, search, motion, splash. */

@layer tokens, base, shell, home, log, books, post, search, motion, splash;

/* Registered so the bar sun's core colour can interpolate (see .nav::before and nav-sun). */
@property --sun-c { syntax: '<color>'; inherits: false; initial-value: #e0ad48; }

@layer tokens {
  /* Black ink on white paper. Vermilion for emphasis, blue for links. Dark: navy, cream, brass. */
  :root {
    --bg: #0d1626;
    --bg-2: #132038;
    --bg-3: #1b2b47;
    --ink: #efe7d8; /* the film's bone (intro COL.ink), so the flying name and the bar's letters are one colour */
    --ink-2: #b9b2a2;
    --muted: #9a9584;
    --line: rgb(239 232 216 / 0.12);
    --line-2: rgb(239 232 216 / 0.22);
    --accent: #e0ad48;
    --accent-text: #e8b957;
    --accent-dim: rgb(224 173 72 / 0.14);
    --accent-glow: rgb(224 173 72 / 0.5);
    --link: #8fd3c7;
    --sky: rgb(70 120 180 / 0.26);
    --sun: rgb(224 173 72 / 0.34);
    --sand: rgb(224 173 72 / 0.07);
    --peach: rgb(224 120 72 / 0.2);
    --haze: rgb(143 211 199 / 0.1);
    --glass: rgb(17 24 38 / 0.55);
    --glass-edge: rgb(255 255 255 / 0.14);
    --glass-hi: rgb(255 255 255 / 0.1);
    --glass-shadow: 0 10px 30px -12px rgb(0 0 0 / 0.6);
    --sea: #8fd3c7;
    --shadow: 0 30px 80px -20px rgb(0 0 0 / 0.6);
    --grain-opacity: 0.05;
    --grain-blend: overlay;
    --spot: rgb(224 173 72 / 0.07);

    --grid: radial-gradient(color-mix(in oklab, var(--line-2) 65%, transparent) 1px, transparent 1.4px);
    --squiggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M2 6.5c8-5 12 4.5 20 0s12-5 19.5-.5 12.5 5 20 .5 12-5 19.5-.5 12.5 4.5 20 .5 9-3.5 17-1' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
    --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
    --sans: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --wrap: 76rem;
    --gutter: clamp(1rem, 4vw, 2.5rem);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    /* The splash flight (splash.js reads it): a close fit to the film's inOutExpo pull, leaving at speed. */
    --ease-flight: cubic-bezier(0.5, 0, 0.1, 1);
    /* The film's two constants, the same in both themes: the bone of its lines and the vermilion pinhole in the O.
       --pin is only the pinhole (wordmark, splash, icons); everything else keeps --accent. */
    --bone: #efe7d8;
    --pin: #e8391e;
    color-scheme: dark;
  }
  @media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
      --bg: #fbfaf6;
      --bg-2: #f1efe8;
      --bg-3: #e6e3da;
      --ink: #0e0e0e;
      --ink-2: #3d3d3b;
      --muted: #5c5b57;
      --line: rgb(14 14 14 / 0.12);
      --line-2: rgb(14 14 14 / 0.24);
      --accent: #d9381e;
      --accent-text: #c22f17;
      --accent-dim: rgb(217 56 30 / 0.09);
      --accent-glow: rgb(217 56 30 / 0.45);
      --link: #0f6fa8;
      --sky: rgb(15 111 168 / 0.18);
      --sun: rgb(255 176 72 / 0.42);
      --sand: rgb(230 160 60 / 0.3);
      --peach: rgb(255 150 100 / 0.22);
      --haze: rgb(15 111 168 / 0.12);
      --glass: rgb(255 255 255 / 0.5);
      --glass-edge: rgb(14 14 14 / 0.08);
      --glass-hi: rgb(255 255 255 / 0.85);
      --glass-shadow: 0 6px 20px -12px rgb(14 14 14 / 0.25);
      --sea: #0f6fa8;
      --shadow: 0 30px 80px -24px rgb(14 14 14 / 0.25);
      --grain-opacity: 0.05;
      --grain-blend: multiply;
      --spot: rgb(217 56 30 / 0.045);
    color-scheme: light;
    }
  }
  :root[data-theme="light"] {
    --bg: #fbfaf6;
    --bg-2: #f1efe8;
    --bg-3: #e6e3da;
    --ink: #0e0e0e;
    --ink-2: #3d3d3b;
    --muted: #5c5b57;
    --line: rgb(14 14 14 / 0.12);
    --line-2: rgb(14 14 14 / 0.24);
    --accent: #d9381e;
    --accent-text: #c22f17;
    --accent-dim: rgb(217 56 30 / 0.09);
    --accent-glow: rgb(217 56 30 / 0.45);
    --link: #0f6fa8;
    --sky: rgb(15 111 168 / 0.18);
    --sun: rgb(255 176 72 / 0.42);
    --sand: rgb(230 160 60 / 0.3);
    --peach: rgb(255 150 100 / 0.22);
    --haze: rgb(15 111 168 / 0.12);
    --glass: rgb(255 255 255 / 0.5);
    --glass-edge: rgb(14 14 14 / 0.08);
    --glass-hi: rgb(255 255 255 / 0.85);
    --glass-shadow: 0 6px 20px -12px rgb(14 14 14 / 0.25);
    --sea: #0f6fa8;
    --shadow: 0 30px 80px -24px rgb(14 14 14 / 0.25);
    --grain-opacity: 0.05;
    --grain-blend: multiply;
    --spot: rgb(217 56 30 / 0.045);
    color-scheme: light;
  }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 5.5rem;
    scrollbar-gutter: stable;
  }
  @media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
  body {
    min-height: 100svh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'ss01', 'cv11';
    transition: background-color 0.35s ease, color 0.35s ease;
    overflow-x: clip;
  }
  ::selection { background: var(--accent); color: var(--bg); }
  a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 0.18em; transition: color 0.2s ease, text-decoration-color 0.2s ease; }
  a:hover { color: var(--link); text-decoration-color: currentColor; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
  button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
  img, svg { display: block; max-width: 100%; }
  ul, ol { padding: 0; }
  h1, h2, h3, h4 { font-weight: 500; line-height: 1.1; text-wrap: balance; letter-spacing: -0.015em; }
  p { text-wrap: pretty; }
  kbd { font-family: var(--mono); font-size: 0.7em; padding: 0.15em 0.4em; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); }
  code { font-family: var(--mono); font-size: 0.88em; }
  .wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }
  .skip { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: 0.6rem 1rem; background: var(--ink); color: var(--bg); border-radius: 6px; }
  .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .skip:focus { top: 1rem; }
  body::before {
    content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: var(--grain-opacity);
    mix-blend-mode: var(--grain-blend);
  }
  .kicker {
    font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  }
  .kicker a { text-decoration: none; }
  .kicker a:hover { color: var(--link); }
  .kicker .sep { color: var(--line-2); }
  .pulse { width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd98a, var(--accent) 65%); box-shadow: 0 0 0.5em var(--sun); }
  .display {
    font-family: var(--display); font-weight: 400; font-size: clamp(2.2rem, 4.6vw, 3.8rem); letter-spacing: -0.02em; line-height: 1;
    font-variation-settings: 'opsz' 144;
  }
  .display em, .hero-title em { font-style: italic; color: var(--accent); font-variation-settings: 'opsz' 144; }
  .section-sub { color: var(--ink-2); font-size: 1.15rem; max-width: 46ch; margin-top: 1rem; line-height: 1.55; }
  .tag { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 0.22em 0.55em; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
  .btn {
    display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1.3rem; border: 1px solid var(--line-2); border-radius: 999px;
    text-decoration: none; font-weight: 500; transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
  }
  .btn:hover { border-color: var(--accent); background: var(--accent-dim); color: var(--ink); }
  .btn-arrow { display: inline-block; transition: translate 0.3s var(--ease-out); color: var(--accent); }
  .btn:hover .btn-arrow { translate: 4px 0; }
}

@layer shell {
  .top { position: sticky; top: 0.75rem; z-index: 40; padding: 0 0 0.75rem; }
  .top::after { display: none; }
  .nav {
    display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; height: 3.5rem; padding: 0 0.6rem 0 1.25rem; position: relative;
    background: linear-gradient(90deg, color-mix(in oklab, var(--sky) 100%, var(--glass)), color-mix(in oklab, var(--peach) 90%, var(--glass)) 55%, color-mix(in oklab, var(--sand) 90%, var(--glass))), var(--glass);
    border-radius: 6px;
    -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
    box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 1px 0 var(--glass-hi), var(--glass-shadow);
    transition: box-shadow 0.4s ease, background-color 0.4s ease;
  }
  /* The bar holds a slice of the site's sky. Its sun rolls out of the wordmark's pinhole as you start to read, drops to the
     lower edge, and crosses it as you read down the page (see motion). At rest, and without scroll timelines, the pinhole is the sun. */
  /* --mark-h is the wordmark's height; --sun-x is the O's centre, 4.874 times that height from the mark's left edge
     (0.782 of a mark 6.23 times as wide as it is tall). One source, so the sun cannot drift off the O. */
  .nav { --mark-h: 1.05rem; --sun-x: calc(1.25rem + var(--mark-h) * 4.874 - 3.5px); }
  @media (max-width: 760px) { .nav { --mark-h: 0.95rem; } }
  /* --sun-c is the sun's core: it leaves the pinhole in the pin's vermilion and warms to the theme's sun as it drops (motion). */
  .nav::before { content: ''; position: absolute; bottom: 3px; left: var(--sun-x); opacity: 0; width: 7px; height: 7px; border-radius: 50%; --sun-c: var(--accent); background: radial-gradient(circle at 35% 30%, #ffd98a, var(--sun-c) 65%); box-shadow: 0 0 10px 2px var(--sun); pointer-events: none; }
  /* Wordmark: SHINN LOK as a compass monoline, every edge a circle, a band or a cut. The O carries the sun as its pinhole. */
  .mark { display: inline-flex; align-items: center; align-self: stretch; text-decoration: none; color: var(--ink); }
  .mark:hover { color: var(--ink); }
  .mark-word { display: block; height: var(--mark-h); width: auto; overflow: visible; }
  /* The pinhole is drawn at r=14 for the film; in the bar it is scaled up so it reads as a sun, not a speck. */
  .mark-word .pin { fill: var(--pin); scale: 2.2; transition: scale 0.4s var(--ease-out), filter 0.4s ease; transform-box: fill-box; transform-origin: center; }
  .mark:hover .mark-word .pin, .mark:focus-visible .mark-word .pin { scale: 3; filter: drop-shadow(0 0 3px var(--sun)); }
  .nav-links { display: flex; gap: 2rem; list-style: none; font-size: 1rem; font-weight: 500; letter-spacing: 0.005em; }
  .nav-links a { text-decoration: none; color: var(--ink); position: relative; padding: 0.3rem 0; opacity: 0.86; transition: opacity 0.2s ease; }
  .nav-links a::after { content: ''; position: absolute; left: -2px; right: -2px; bottom: -3px; height: 6px; background: var(--sea); -webkit-mask: var(--squiggle) center / 100% 100% no-repeat; mask: var(--squiggle) center / 100% 100% no-repeat; scale: 0 1; transform-origin: left; transition: scale 0.35s var(--ease-out); }
  .nav-links a:hover, .nav-links a[aria-current] { opacity: 1; }
  .nav-links a:hover::after, .nav-links a[aria-current]::after { scale: 1 1; }
  .nav-tools { display: flex; align-items: center; gap: 0.35rem; }
  .tool:active, .chip:active, .btn:active, .search-close:active { scale: 0.96; transition-duration: 0.05s; }
  .row-link:active::before { opacity: 1; }
  .post-end-tags a, .foot-links a, .contact-links a, .kicker a { padding-block: 0.4rem; }
  @media (max-width: 760px) { .tool, .search-close { min-height: 44px; min-width: 44px; } }
  .tool { display: inline-flex; align-items: center; gap: 0.5rem; height: 2.25rem; padding: 0 0.7rem; border-radius: 4px; color: var(--ink-2); transition: background 0.2s ease, color 0.2s ease; }
  .tool:hover { background: color-mix(in oklab, var(--ink) 8%, transparent); color: var(--ink); }
  .tool kbd { border: 1px solid var(--line); border-bottom-width: 1px; padding: 0.1em 0.35em; }
  .theme .moon { display: none; }
  @media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .theme .sun { display: none; } :root:not([data-theme="dark"]) .theme .moon { display: block; } }
  :root[data-theme="light"] .theme .sun { display: none; }
  :root[data-theme="light"] .theme .moon { display: block; }
  :root[data-theme="dark"] .theme .sun { display: block; }
  :root[data-theme="dark"] .theme .moon { display: none; }
  .menu { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 2.25rem; padding: 0; }
  .menu span { display: block; width: 18px; height: 1.5px; background: currentColor; margin-inline: auto; transition: translate 0.3s var(--ease-out), rotate 0.3s var(--ease-out); }
  @media (max-width: 760px) {
    .nav-links { position: absolute; top: calc(100% + 0.5rem); left: 0; right: 0; flex-direction: column; gap: 0; padding: 0.5rem 1.25rem 0.75rem; background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8); border-radius: 6px; box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 1px 0 var(--glass-hi), var(--glass-shadow); display: none; font-size: 1.15rem; }
    .nav-links a { display: block; padding: 0.75rem 0; }
    .nav-links a::after { display: none; }
    body.menu-open .nav-links { display: flex; }
    body.menu-open .menu span:first-child { translate: 0 3.25px; rotate: 45deg; }
    body.menu-open .menu span:last-child { translate: 0 -3.25px; rotate: -45deg; }
    .menu { display: flex; }
    .tool kbd { display: none; }
  }
  .foot { margin-top: clamp(5rem, 10vw, 9rem); padding: 2rem 0 2.5rem; border-top: 1px solid var(--line-2); position: relative; background: var(--bg); font-size: 0.85rem; color: var(--muted); }
  .foot-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem 2rem; }
  .foot-links { display: flex; gap: 1.5rem; }
  .foot-links a { text-decoration: none; }
  .nf { padding: clamp(4rem, 9vw, 8rem) 0 2rem; }
  .nf-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 2rem 4rem; align-items: center; }
  .nf-actions { margin-top: 2rem; }
  .nf-doodle { width: 100%; max-width: 15rem; justify-self: center; overflow: visible; }
  .nf-box { fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .nf-hand { fill: var(--muted); font-family: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive; font-weight: 600; font-size: 24px; }
  .nf-label { margin-top: clamp(3.5rem, 7vw, 5rem); font-weight: 500; line-height: 1.6; }
  .nf .rows { margin-top: 1rem; }
  @media (max-width: 760px) { .nf-grid { grid-template-columns: 1fr; } .nf-doodle { max-width: 11rem; justify-self: start; } }
}

@layer home {
  .hero { position: relative; min-height: calc(100svh - 4.25rem); display: flex; flex-direction: column; justify-content: center; padding: 4rem 0 5rem; isolation: isolate; }
  /* Late light: sky, a peach band at the horizon, sand below. Two washes drift against each other; the sun is its own layer (.hero-sun) so it can move without repainting the sky. */
  .hero::before, .log-head::before {
    content: ''; position: absolute; inset: -4.25rem calc(50% - 50vw) 0; z-index: -1; pointer-events: none;
    background: var(--grid), linear-gradient(to bottom, var(--sky), transparent 38%, var(--peach) 64%, var(--sand) 100%);
    background-size: 22px 22px, auto;
    transition: opacity 0.6s ease;
  }
  .hero::after, .log-head::after {
    content: ''; position: absolute; inset: -4.25rem calc(50% - 50vw) 0; z-index: -1; pointer-events: none;
    background:
      radial-gradient(40rem 22rem at 20% 20%, var(--haze), transparent 70%) no-repeat,
      radial-gradient(56rem 20rem at 80% 90%, var(--sand), transparent 70%) no-repeat;
    background-size: 130% 100%, 130% 100%;
    background-position: 0% 0%, 100% 100%;
    animation: swell 18s ease-in-out infinite alternate;
  }
  @keyframes swell { to { background-position: 100% 0%, 0% 100%; } }
  /* Oversized by 20vw each side and 30vh above, so moving it toward the pointer or down at sunset never brings an edge into view. The sun still sits 82% across and 40% down the hero. */
  .hero-sun {
    position: absolute; inset: calc(-4.25rem - 30vh) calc(50% - 70vw) 0; z-index: -1; pointer-events: none;
    --sx: calc(20vw + (100% - 40vw) * 0.82); --sy: calc(30vh + (100% - 30vh) * 0.4);
    background:
      radial-gradient(9rem 9rem at var(--sx) var(--sy), var(--sun), transparent 58%),
      radial-gradient(44rem 28rem at var(--sx) var(--sy), color-mix(in oklab, var(--sun) 50%, transparent), transparent 65%);
    transform: translate(var(--px, 0px), var(--py, 0px));
    transition: transform 1.2s var(--ease-out);
  }
  /* Dusk: a warmer, deeper horizon that only shows as the sun goes down. Opacity only, so it never repaints. */
  .hero-sun::after {
    content: ''; position: absolute; inset: 0; opacity: 0;
    background: linear-gradient(to bottom, transparent 30%, color-mix(in oklab, var(--peach) 80%, var(--accent)) 72%, transparent);
  }
  /* The hero's light fades out at its foot instead of stopping at a hard line above the next section. */
  .hero::before, .hero::after, .hero-sun { -webkit-mask: linear-gradient(to bottom, #000 72%, transparent); mask: linear-gradient(to bottom, #000 72%, transparent); }
  .log-head { position: relative; isolation: isolate; }
  /* The sky and sun layers bleed past the screen edge on purpose. main spans the full screen, so clipping it sideways keeps the full-bleed sky without trusting body's clip, which iOS Safari doesn't always honor. */
  main { overflow-x: clip; }
  .log-head::before, .log-head::after { inset: -4.25rem calc(50% - 50vw) -9rem; }
  .log-head::before { background: var(--grid), linear-gradient(to bottom, var(--sky), transparent 40%, var(--peach) 62%, var(--sand) 78%, transparent 100%); background-size: 22px 22px, auto; }
  .log-head::after { -webkit-mask: linear-gradient(to bottom, #000 70%, transparent); mask: linear-gradient(to bottom, #000 70%, transparent); }
  .hero-title {
    font-family: var(--display); font-weight: 400; font-size: clamp(2.7rem, 7.6vw, 6.6rem); line-height: 0.98; letter-spacing: -0.03em;
    max-width: 15ch; margin-top: 1.75rem; font-variation-settings: 'opsz' 144;
  }
  .hero-title em { position: relative; display: inline-block; }
  .scribble { position: absolute; left: -0.04em; right: -0.04em; bottom: -0.06em; width: calc(100% + 0.08em); height: 0.22em; overflow: visible; pointer-events: none; }
  .scribble path { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; }
  .hero-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2.5rem 4rem; align-items: end; margin-top: 3rem; }
  .hero-lede { font-size: clamp(1.1rem, 1.5vw, 1.3rem); color: var(--ink-2); max-width: 52ch; line-height: 1.55; }
  /* The Now panel is a glass node card, in the nav's material: a wire, a node per row, the current one lit. */
  .now { display: grid; gap: 0.7rem; font-size: 0.95rem; position: relative; padding: 1.1rem 1.25rem 1.1rem 2.6rem; border-radius: 10px; background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8); box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 1px 0 var(--glass-hi), var(--glass-shadow); }
  .now::before { content: ''; position: absolute; left: 1.3rem; top: 1.5rem; bottom: 1.5rem; width: 1px; background: var(--line-2); }
  .now div { display: grid; grid-template-columns: 5.75rem 1fr; gap: 1rem; position: relative; }
  .now div::before { content: ''; position: absolute; left: calc(-1.3rem - 4.5px); top: 0.5em; width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--glass-hi); }
  .now div:first-child::before { border-color: transparent; background: radial-gradient(circle at 35% 30%, #ffd98a, var(--accent) 65%); box-shadow: 0 0 0.5em var(--sun); }
  .now dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding-top: 0.2em; }
  .now dd { color: var(--ink-2); }
  .now a { color: var(--ink); text-decoration-color: var(--line-2); }
  .now a:hover { color: var(--link); }
  /* The portrait stands in the sun above the Now card, its shoulders sinking behind the glass. */
  .hero-side { display: grid; justify-items: center; }
  .hero-side .now { width: 100%; z-index: 1; }
  .pp { width: min(100%, 20rem); margin: -21rem 0 -3.25rem; position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .pp svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 18px 30px rgb(0 0 0 / 0.22)); }
  .pp-neck { fill: #c48c68; }
  /* The rig: the head tilts from the base of the neck while the body barely shifts, so it reads as a turn. */
  .pp g, .pp image { transform-box: view-box; }
  .pp-body { translate: calc(var(--lx, 0) * 4px) 0; }
  /* The pivot is where the chin meets the cup rim, so that corner never moves and the cup stays in front of a whole chin. */
  .pp-head { rotate: calc(var(--lx, 0) * 2.5deg); transform-origin: 497px 740px; }
  .pp-iris { translate: calc(var(--lx, 0) * 9px) calc(var(--ly, 0) * 3px); }
  .pp-lids { opacity: 0; transition: opacity 0.05s linear; }
  .pp.blink .pp-lids { opacity: 1; }
  /* A click winks: the winking head swaps in while the head tips toward the closed eye and settles back. */
  .pp-wink { opacity: 0; }
  .pp.wink .pp-wink { opacity: 1; }
  .pp.wink :is(.pp-base, .pp-eyes, .pp-lids) { opacity: 0; }
  .pp.wink .pp-head { animation: pp-wink 0.9s var(--ease-out); }
  @keyframes pp-wink {
    25%, 70% { rotate: calc(var(--lx, 0) * 2.5deg + 4deg); }
  }
  @media (max-width: 760px) { .hero { min-height: 0; padding: 3rem 0 3.5rem; } .hero-grid { grid-template-columns: 1fr; gap: 2rem; } .now div { grid-template-columns: 5.5rem 1fr; } .hero-side { justify-items: start; } .pp { width: 12rem; margin: 0 0 -2rem 1rem; } }


  section.work, section.how, section.contact { padding-top: clamp(5rem, 10vw, 9rem); }
  .section-head { display: flex; justify-content: space-between; align-items: end; gap: 2rem; flex-wrap: wrap; }
  .section-head .section-sub { margin-top: 0; }


  .rows { list-style: none; margin-top: 2rem; border-top: 1px solid var(--line); }
  .row { border-bottom: 1px solid var(--line); }
  .row-link { display: grid; grid-template-columns: 6rem minmax(0, 1fr) auto; gap: 1.5rem 2.5rem; padding: 1.6rem 0; text-decoration: none; color: inherit; align-items: start; position: relative; }
  .row-link::before { content: ''; position: absolute; inset: 0 -1rem; border-radius: 10px; background: radial-gradient(22rem 12rem at var(--mx, 30%) var(--my, 50%), var(--accent-dim), transparent 70%), var(--bg-2); opacity: 0; transition: opacity 0.25s ease; z-index: -1; }
  .row-link:hover { color: inherit; }
  .row-link:hover::before { opacity: 1; }
  .row-meta { display: grid; gap: 0.45rem; align-content: start; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--muted); padding-top: 0.35rem; white-space: nowrap; }
  .row-main { display: grid; gap: 0.5rem; }
  .row-title { display: block; font-weight: 400; font-family: var(--display); font-size: 1.45rem; line-height: 1.15; letter-spacing: -0.015em; font-variation-settings: 'opsz' 48; transition: color 0.2s ease; text-wrap: balance; }
  .row-link:hover .row-title { color: var(--link); }
  .row-summary { color: var(--ink-2); font-size: 0.98rem; line-height: 1.5; max-width: 62ch; }
  .row-tail { display: flex; flex-wrap: wrap; justify-content: end; align-items: start; gap: 0.4rem; max-width: 17rem; padding-top: 0.3rem; }
  .row-big .row-link { padding: 2.2rem 0; grid-template-columns: 8rem minmax(0, 1fr) auto; }
  .row-big .row-title { font-size: clamp(1.6rem, 2.6vw, 2.25rem); font-variation-settings: 'opsz' 96; }
  .row-big .row-summary { font-size: 1.05rem; }
  @media (max-width: 900px) { .row-link, .row-big .row-link { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; } .row-meta { grid-auto-flow: column; justify-content: start; align-items: center; gap: 1rem; padding-top: 0; } .row-tail { justify-content: start; max-width: none; } }
  .more { margin-top: 2.5rem; }

  .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 3rem 5rem; }
  .split-side { position: sticky; top: 6rem; align-self: start; }
  .timeline { list-style: none; border-top: 1px solid var(--line); }
  .timeline li { position: relative; display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 1.5rem 2.5rem; padding: 2rem 0; border-bottom: 1px solid var(--line); }
  .t-when { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.06em; color: var(--muted); padding-top: 0.5rem; }
  .timeline h3 { font-family: var(--display); font-size: 1.6rem; font-variation-settings: 'opsz' 48; display: flex; flex-wrap: wrap; align-items: center; column-gap: 0.7rem; }
  .t-logo { width: 2rem; height: 2rem; border-radius: 0.5rem; flex: none; box-shadow: 0 0 0 1px var(--line), 0 6px 16px -8px rgb(0 0 0 / 0.35); }
  .t-note { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); vertical-align: middle; }
  .t-role { color: var(--accent-text); font-size: 0.95rem; margin: 0.25rem 0 0.75rem; }
  .timeline p { color: var(--ink-2); line-height: 1.55; max-width: 58ch; }
  /* GitHub activity in the work section's side pane: years down, weeks across, a quiet green that deepens with busier weeks. */
  .gh { display: block; margin-top: 2.25rem; max-width: 26rem; text-decoration: none; opacity: 0.85; transition: opacity 0.3s ease; }
  .gh:hover { opacity: 1; }
  .gh-defs { position: absolute; }
  .gh svg { display: block; width: 100%; height: auto; overflow: visible; }
  .gh text { font-family: var(--mono); font-size: 9.5px; fill: var(--muted); }
  .gh-label { display: block; margin-top: 0.45rem; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
  .gh { --gh: #3fb950; }
  .gh .l0 { fill: color-mix(in oklab, var(--ink) 5%, transparent); }
  .gh .l1 { fill: color-mix(in oklab, var(--gh) 16%, transparent); }
  .gh .l2 { fill: color-mix(in oklab, var(--gh) 30%, transparent); }
  .gh .l3 { fill: color-mix(in oklab, var(--gh) 46%, transparent); }
  .gh .l4 { fill: color-mix(in oklab, var(--gh) 64%, transparent); }
  @media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: 2rem; } .split-side { position: static; } .timeline li { grid-template-columns: 1fr; gap: 0.75rem; } .t-inst { max-width: 17rem; } }

  .p-n { font-family: var(--mono); font-size: 0.74rem; color: var(--accent-text); letter-spacing: 0.1em; padding-top: 0.55rem; }

  .contact { position: relative; isolation: isolate; }
  .contact::before { content: ''; position: absolute; inset: -4rem calc(50% - 50vw) -6rem; z-index: -1; pointer-events: none; background: radial-gradient(60rem 24rem at 30% 100%, var(--sand), transparent 70%), radial-gradient(40rem 20rem at 90% 80%, var(--haze), transparent 70%); }
  .contact .big-mail {
    display: inline-block; margin-top: 1.25rem; font-family: var(--display); font-size: clamp(1.8rem, 6vw, 4.6rem); letter-spacing: -0.03em; line-height: 1.05;
    text-decoration: none; overflow-wrap: anywhere; font-variation-settings: 'opsz' 144;
    background: linear-gradient(var(--accent), var(--accent)) no-repeat left bottom / 0 2px; transition: background-size 0.5s var(--ease-out), color 0.2s ease; padding-bottom: 0.1em;
  }
  .contact .big-mail:hover { background-size: 100% 2px; color: var(--ink); }
  /* Contact: the last slot, filled when you get there (see motion). */
  .contact .slot { position: relative; width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line-2); }
  .contact .slot::after { content: ''; position: absolute; inset: -1px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd98a, var(--accent) 65%); box-shadow: 0 0 0.5em var(--sun); }
  .contact-note { margin-top: 1.5rem; color: var(--ink-2); max-width: 52ch; font-size: 1.1rem; }
  .contact-links { display: flex; gap: 2rem; margin-top: 2rem; font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.04em; }
  .contact-links a { text-decoration: none; color: var(--ink-2); }
  .contact-links a::before { content: '↗ '; color: var(--accent); }
}

@layer home {
  /* How I work: the drawing of the system sits in a dark instrument panel in both themes. See flowFigure() in build.mjs.
     Every animated part carries its own start time in --t, so the circuit, the suns, and the numbered rules stay in step. */
  .flow-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-areas: 'head fig' 'steps fig'; gap: 2.5rem 5rem; align-items: start; }
  .flow-head { grid-area: head; }
  .flow-steps { grid-area: steps; }
  .flow-fig { grid-area: fig; position: sticky; top: 5.5rem; margin: 0; }
  .inst, .flow-panel {
    --p-bg: #0b1322; --p-bg-2: #121d33; --p-line: rgb(255 255 255 / 0.1); --p-line-2: rgb(255 255 255 / 0.2);
    --p-ink: #eef2f7; --p-ink-2: rgb(238 242 247 / 0.74); --p-muted: rgb(238 242 247 / 0.42);
    --p-signal: #7fe0d0; --p-sun: #e8b957;
    position: relative; isolation: isolate; overflow: hidden; border-radius: 12px; color: var(--p-ink);
    background: radial-gradient(rgb(255 255 255 / 0.085) 0.8px, transparent 1.2px) 0 0 / 14px 14px, linear-gradient(180deg, var(--p-bg-2), var(--p-bg));
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), inset 0 0 0 1px rgb(255 255 255 / 0.07), 0 40px 90px -40px rgb(0 0 0 / 0.7), 0 12px 30px -20px rgb(0 0 0 / 0.5);
  }
  .flow-panel { padding: 1rem 1.15rem 1.15rem; border-radius: 18px; }
  /* The instruments: one small looping scene beside each era, in the panel's glass. Three layers: infrastructure at the back,
     the mechanism in the middle, a product surface in front. Resting styles are the finished picture (reduced motion shows it still);
     the step classes (ap, lt, ct, fly, gr: appear, light, fill, fly, grow at step k of a ten second cycle) start from empty. */
  .t-side { display: grid; gap: 0.9rem; align-content: start; }
  .t-inst { margin: 0; }
  .inst svg { display: block; width: 100%; height: auto; overflow: visible; }
  .inst text { font-family: var(--mono); font-size: 6.5px; font-weight: 500; letter-spacing: 0.1em; fill: var(--p-muted); }
  .l-back { opacity: 0.45; animation: drift 12s ease-in-out infinite alternate; }
  .l-front { animation: bob 7s ease-in-out infinite alternate; }
  @keyframes drift { to { transform: translate(2px, -1.5px); } }
  @keyframes bob { to { transform: translateY(-1.5px); } }
  .i-line { fill: none; stroke: var(--p-line-2); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
  .i-dash { stroke-dasharray: 3 3; }
  .i-card { fill: rgb(255 255 255 / 0.05); stroke: rgb(255 255 255 / 0.16); stroke-width: 1; }
  .i-blk, .i-node, .i-stg, .i-stage, .i-shield { fill: rgb(255 255 255 / 0.04); stroke: var(--p-line-2); stroke-width: 1; }
  .i-glyph { fill: none; stroke: var(--p-ink-2); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; opacity: 0.8; }
  .i-glyph.sig { stroke: var(--p-signal); opacity: 1; }
  .i-glyph.sun { stroke: var(--p-sun); opacity: 1; }
  .i-ln { fill: rgb(238 242 247 / 0.32); }
  .i-ln.sig { fill: var(--p-signal); opacity: 0.85; }
  .i-bub { fill: rgb(255 255 255 / 0.06); stroke: rgb(255 255 255 / 0.1); }
  .i-bub.sig { fill: rgb(127 224 208 / 0.1); stroke: rgb(127 224 208 / 0.3); }
  .i-chip { fill: rgb(127 224 208 / 0.14); stroke: rgb(127 224 208 / 0.5); stroke-width: 1; }
  .i-chip.sun { fill: rgb(232 185 87 / 0.14); stroke: rgb(232 185 87 / 0.55); }
  .i-play { fill: var(--p-signal); }
  .i-person * { fill: none; stroke: var(--p-ink-2); stroke-width: 1.1; }
  .i-person.s * { stroke: var(--p-sun); }
  .i-av { fill: var(--p-signal); }
  .i-av.who { fill: rgb(238 242 247 / 0.5); }
  .i-geo { fill: var(--p-signal); opacity: 0.8; }
  .i-cell { fill: rgb(127 224 208 / 0.06); }
  .i-area { fill: var(--p-signal); opacity: 0.1; }
  .i-ctl { fill: rgb(127 224 208 / 0.04); stroke: var(--p-line-2); stroke-dasharray: 2 3; }
  .i-tick { fill: var(--p-signal); opacity: 0.9; }
  .i-tog { fill: var(--p-signal); stroke: none; animation: tog 10s infinite backwards; }
  .i-knob { fill: var(--p-ink); animation: knob 10s infinite backwards; }
  @keyframes tog { 0%, 8% { fill: rgb(255 255 255 / 0.14); } 11% { fill: var(--p-signal); } 94% { fill: var(--p-signal); } 100% { fill: rgb(255 255 255 / 0.14); } }
  @keyframes knob { 0%, 8% { transform: translateX(0); } 11% { transform: translateX(8px); } 94% { transform: translateX(8px); } 100% { transform: translateX(0); } }
  .i-pulse, .i-head, .i-case, .i-p95, .i-fly, .i-typ { opacity: 0; }
  .i-pulse, .i-head, .i-case, .i-p95, .i-fly { display: none; fill: var(--p-sun); }
  @supports (offset-path: path("M0 0 L1 1")) {
    .i-pulse, .i-head, .i-case, .i-p95, .i-fly { display: inline; offset-rotate: 0deg; }
    .i-pulse { animation: i-pulse 3s linear infinite; animation-delay: calc(var(--k) * 1s); }
    .i-head { animation: i-head 7s linear infinite; }
    .i-case { animation: i-case 10s linear infinite; animation-delay: calc(var(--k) * 0.9s + 4.6s); }
    .i-case.detour { animation-name: i-case-b; }
    .i-p95 { animation: i-p95 5s ease-in-out infinite; }
    .i-fly { animation: none 10s cubic-bezier(0.55, 0, 0.3, 1) infinite; }
  }
  @keyframes i-pulse { 0% { offset-distance: 0%; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }
  .i-step { fill: none; stroke: var(--p-sun); stroke-width: 1.5; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; animation: i-draw 7s linear infinite backwards; }
  @keyframes i-draw { 0% { stroke-dashoffset: 1; opacity: 1; } 70% { stroke-dashoffset: 0; opacity: 1; } 92% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
  @keyframes i-head { 0% { offset-distance: 0%; opacity: 1; } 70% { offset-distance: 100%; opacity: 1; } 76%, 100% { offset-distance: 100%; opacity: 0; } }
  @keyframes i-case { 0% { offset-distance: 0%; opacity: 0; } 2% { opacity: 1; } 14% { offset-distance: 100%; opacity: 1; } 16%, 100% { offset-distance: 100%; opacity: 0; } }
  @keyframes i-case-b { 0% { offset-distance: 0%; opacity: 0; } 2% { opacity: 1; } 20% { offset-distance: 100%; opacity: 1; } 22%, 100% { offset-distance: 100%; opacity: 0; } }
  @keyframes i-p95 { 0% { offset-distance: 0%; opacity: 1; } 100% { offset-distance: 100%; opacity: 1; } }
  .i-flash { opacity: 0; animation: i-flash 5s linear infinite; }
  @keyframes i-flash { 0%, 42% { opacity: 0; } 48% { opacity: 1; } 62% { opacity: 1; } 70%, 100% { opacity: 0; } }
  .i-scan { fill: var(--p-signal); opacity: 0; animation: i-scan 3.5s ease-in-out infinite; }
  @keyframes i-scan { 0% { transform: translateX(0); opacity: 0; } 10% { opacity: 0.9; } 90% { opacity: 0.9; } 100% { transform: translateX(42px); opacity: 0; } }
  .i-scan.h { animation-name: i-scan-h; }
  .i-scan.tall { animation-name: i-scan-tall; animation-duration: 5s; }
  @keyframes i-scan-tall { 0% { transform: translateY(0); opacity: 0; } 8% { opacity: 0.9; } 92% { opacity: 0.9; } 100% { transform: translateY(84px); opacity: 0; } }
  @keyframes i-scan-h { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: 0.9; } 90% { opacity: 0.9; } 100% { transform: translateY(48px); opacity: 0; } }
  .i-typ { fill: var(--p-muted); animation: typ 10s infinite, typb 0.9s ease-in-out infinite; animation-delay: 0s, calc(var(--k) * 0.15s); }
  @keyframes typ { 0%, 10% { opacity: 0; } 12% { opacity: 1; } 23% { opacity: 1; } 25%, 100% { opacity: 0; } }
  @keyframes typb { 50% { transform: translateY(-1.5px); } }
  .i-reveal { transform-box: fill-box; transform-origin: left; animation: i-reveal 10s linear infinite backwards; }
  @keyframes i-reveal { 0%, 46% { transform: scaleX(0); } 92%, 100% { transform: scaleX(1); } }
  .i-ev { fill: var(--p-signal); opacity: 0.8; animation: i-ev 2.4s linear infinite; animation-delay: calc(var(--k) * -0.8s); }
  @keyframes i-ev { 0% { transform: translateX(0); opacity: 0; } 12% { opacity: 0.8; } 86% { opacity: 0.8; } 100% { transform: translateX(44px); opacity: 0; } }
  .i-stg { animation: i-stg 3s infinite; animation-delay: calc(var(--k) * 0.6s); }
  @keyframes i-stg { 0% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 12% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 45% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 60%, 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .i-bar { fill: var(--p-signal); opacity: 0.75; transform-box: fill-box; transform-origin: bottom; animation: i-bar 10s var(--ease-out) infinite backwards; animation-delay: calc(var(--k) * 0.4s + 1s); }
  .i-bar:last-of-type { fill: var(--p-sun); opacity: 0.95; }
  @keyframes i-bar { 0% { transform: scaleY(0.04); } 10%, 88% { transform: scaleY(1); } 96%, 100% { transform: scaleY(0.04); } }
  .ap0, .ap1, .ap2, .ap3, .ap4, .ap8 { animation: none 10s var(--ease-out) infinite backwards; }
  .lt1, .lt2, .lt3, .lt4, .lt5, .lt6, .lt7, .lt8, .lt9, .ct3, .ct5, .ct7 { animation: none 10s linear infinite backwards; }
  .gr2, .gr3, .gr4 { transform-box: fill-box; transform-origin: left; animation: none 10s var(--ease-out) infinite backwards; }
  @keyframes ap0 { 0%, 0% { opacity: 0; transform: translateY(3px); } 4% { opacity: 1; transform: none; } 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: translateY(3px); } }
  .ap0 { animation-name: ap0; }
  @keyframes ap1 { 0%, 8% { opacity: 0; transform: translateY(3px); } 12% { opacity: 1; transform: none; } 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: translateY(3px); } }
  .ap1 { animation-name: ap1; }
  @keyframes ap2 { 0%, 16% { opacity: 0; transform: translateY(3px); } 20% { opacity: 1; transform: none; } 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: translateY(3px); } }
  .ap2 { animation-name: ap2; }
  @keyframes ap3 { 0%, 24% { opacity: 0; transform: translateY(3px); } 28% { opacity: 1; transform: none; } 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: translateY(3px); } }
  .ap3 { animation-name: ap3; }
  @keyframes ap4 { 0%, 32% { opacity: 0; transform: translateY(3px); } 36% { opacity: 1; transform: none; } 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: translateY(3px); } }
  .ap4 { animation-name: ap4; }
  @keyframes ap8 { 0%, 64% { opacity: 0; transform: translateY(3px); } 68% { opacity: 1; transform: none; } 90% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; transform: translateY(3px); } }
  .ap8 { animation-name: ap8; }
  @keyframes lt1 { 0%, 8% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 11% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 92% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .lt1 { animation-name: lt1; }
  @keyframes lt2 { 0%, 16% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 19% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 92% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .lt2 { animation-name: lt2; }
  @keyframes lt3 { 0%, 24% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 27% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 92% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .lt3 { animation-name: lt3; }
  @keyframes lt4 { 0%, 32% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 35% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 92% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .lt4 { animation-name: lt4; }
  @keyframes lt5 { 0%, 40% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 43% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 92% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .lt5 { animation-name: lt5; }
  @keyframes lt6 { 0%, 48% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 51% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 92% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .lt6 { animation-name: lt6; }
  @keyframes lt7 { 0%, 56% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 59% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 92% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .lt7 { animation-name: lt7; }
  @keyframes lt8 { 0%, 64% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 67% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 92% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .lt8 { animation-name: lt8; }
  @keyframes lt9 { 0%, 72% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } 75% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 92% { stroke: var(--p-signal); fill: rgb(127 224 208 / 0.16); } 100% { stroke: var(--p-line-2); fill: rgb(255 255 255 / 0.04); } }
  .lt9 { animation-name: lt9; }
  @keyframes ct3 { 0%, 24% { fill: rgb(127 224 208 / 0.06); } 27% { fill: rgb(127 224 208 / 0.85); } 92% { fill: rgb(127 224 208 / 0.85); } 100% { fill: rgb(127 224 208 / 0.06); } }
  .ct3 { animation-name: ct3; }
  @keyframes ct5 { 0%, 40% { fill: rgb(127 224 208 / 0.06); } 43% { fill: rgb(127 224 208 / 0.85); } 92% { fill: rgb(127 224 208 / 0.85); } 100% { fill: rgb(127 224 208 / 0.06); } }
  .ct5 { animation-name: ct5; }
  @keyframes ct7 { 0%, 56% { fill: rgb(127 224 208 / 0.06); } 59% { fill: rgb(127 224 208 / 0.85); } 92% { fill: rgb(127 224 208 / 0.85); } 100% { fill: rgb(127 224 208 / 0.06); } }
  .ct7 { animation-name: ct7; }
  @keyframes fly0 { 0%, 20% { offset-distance: 0%; opacity: 0; } 22% { opacity: 1; } 32% { offset-distance: 100%; opacity: 1; } 34%, 100% { offset-distance: 100%; opacity: 0; } }
  .fly0 { animation-name: fly0; }
  @keyframes fly1 { 0%, 40% { offset-distance: 0%; opacity: 0; } 42% { opacity: 1; } 52% { offset-distance: 100%; opacity: 1; } 54%, 100% { offset-distance: 100%; opacity: 0; } }
  .fly1 { animation-name: fly1; }
  @keyframes fly2 { 0%, 60% { offset-distance: 0%; opacity: 0; } 62% { opacity: 1; } 72% { offset-distance: 100%; opacity: 1; } 74%, 100% { offset-distance: 100%; opacity: 0; } }
  .fly2 { animation-name: fly2; }
  @keyframes gr2 { 0%, 16% { transform: scaleX(0); } 22% { transform: scaleX(1); } 92% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
  .gr2 { animation-name: gr2; }
  @keyframes gr3 { 0%, 24% { transform: scaleX(0); } 30% { transform: scaleX(1); } 92% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
  .gr3 { animation-name: gr3; }
  @keyframes gr4 { 0%, 32% { transform: scaleX(0); } 38% { transform: scaleX(1); } 92% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
  .gr4 { animation-name: gr4; }
  html.js .timeline li:not(.in) .inst * { animation-play-state: paused; }

  /* A slow aurora behind the circuit. */
  .flow-panel::before { content: ''; position: absolute; inset: -25%; z-index: -1; pointer-events: none; background: radial-gradient(38% 32% at 28% 28%, rgb(127 224 208 / 0.15), transparent 70%), radial-gradient(34% 30% at 74% 72%, rgb(232 185 87 / 0.14), transparent 70%); animation: aurora 18s ease-in-out infinite alternate; }
  @keyframes aurora { to { translate: 6% -4%; rotate: 8deg; } }
  .flow-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--p-muted); padding-bottom: 0.8rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--p-line); }
  .flow-live { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--p-ink-2); }
  .flow-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--p-signal); animation: live 2.4s ease-out infinite; }
  @keyframes live { 0% { box-shadow: 0 0 0 0 rgb(127 224 208 / 0.55); } 70%, 100% { box-shadow: 0 0 0 8px rgb(127 224 208 / 0); } }
  .flow-svg { display: block; width: 100%; height: auto; overflow: visible; }
  .flow-svg text { font-family: var(--sans); fill: var(--p-ink-2); }
  .flow-lab { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.12em; fill: var(--p-muted); }
  .flow-title { font-size: 16px; font-weight: 500; fill: var(--p-ink); letter-spacing: -0.01em; }
  .flow-sub { font-size: 12.5px; fill: var(--p-ink-2); }
  .flow-box { fill: url(#flow-glass); stroke: var(--p-line-2); stroke-width: 1; animation: flow-lit 1.2s var(--ease-out) both; animation-delay: var(--t); }
  .flow-hi { fill: none; stroke: rgb(255 255 255 / 0.14); stroke-width: 1; }
  .flow-glow { fill: none; stroke: var(--p-signal); stroke-width: 7; opacity: 0; animation: flow-glow 1.2s var(--ease-out) both; animation-delay: var(--t); }
  .flow-base { fill: url(#flow-base); }
  /* The busy light: on while a sun is inside the card (keyframes are computed per node in build.mjs). */
  .flow-busy { opacity: 0; animation: none 12s linear infinite; }
  .flow-busy-glow { fill: none; stroke: var(--p-signal); stroke-width: 9; opacity: 0.28; }
  .flow-busy-box { fill: rgb(127 224 208 / 0.14); stroke: var(--p-signal); stroke-width: 1.4; }
  .flow-node .flow-lab, .flow-tag { animation: flow-tag 1.2s var(--ease-out) both; animation-delay: var(--t); }
  .flow-wire { fill: none; stroke: var(--p-line-2); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
  .flow-wire.lit { stroke: var(--p-signal); stroke-width: 1.4; stroke-dasharray: 1; stroke-dashoffset: 1; animation: flow-draw 0.45s var(--ease-out) both; animation-delay: var(--t); }
  .flow-wire.glow { stroke: var(--p-signal); stroke-width: 6; opacity: 0.14; stroke-dasharray: 1; stroke-dashoffset: 1; animation: flow-draw 0.45s var(--ease-out) both; animation-delay: var(--t); }
  .flow-wire.loop { stroke-dasharray: 4 5; }
  .flow-wire.loop.lit { stroke: var(--p-signal); stroke-width: 1.3; opacity: 0; animation: flow-fade 0.5s both; animation-delay: var(--t); }
  .flow-loop-lab { opacity: 0; animation: flow-fade 0.5s both, flow-retry 12s linear infinite; animation-delay: var(--t), var(--t); }
  .flow-slot { fill: rgb(255 255 255 / 0.03); stroke: var(--p-line-2); stroke-width: 1; }
  .flow-done { animation: flow-fill 0.5s both; animation-delay: var(--t); }
  .flow-ring { fill: none; stroke: var(--p-sun); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; animation: flow-ring 12s linear infinite; animation-delay: var(--t); }
  .flow-crew * { fill: none; stroke: var(--p-muted); stroke-width: 1.2; }
  .flow-crew.agent circle { fill: var(--p-muted); stroke: none; }
  .flow-crew.person.lead circle, .flow-crew.person.lead path { fill: var(--p-ink); stroke: var(--p-ink); }
  .flow-crew.agent.lead rect { fill: var(--p-signal); stroke: var(--p-signal); }
  .flow-crew.agent.lead circle { fill: var(--p-bg); }
  .flow-crew.me circle, .flow-crew.me path { fill: var(--p-sun); stroke: var(--p-sun); }
  /* The suns need motion paths; without them the circuit still charges on its own. */
  .flow-token { display: none; }
  @supports (offset-path: path("M0 0 L1 1")) {
    .flow-token { display: inline; offset-rotate: 0deg; offset-distance: 0%; animation: none 12s linear infinite; }
  }
  .flow-halo { fill: var(--p-sun); opacity: 0.22; }
  .flow-core { fill: url(#flow-sun); }
  .flow-ghost circle { fill: var(--p-sun); opacity: var(--o, 0.3); }
  @keyframes flow-lit { 0% { stroke: var(--p-line-2); } 30% { stroke: var(--p-signal); } 100% { stroke: rgb(127 224 208 / 0.5); } }
  @keyframes flow-glow { 0% { opacity: 0; } 30% { opacity: 0.38; } 100% { opacity: 0.12; } }
  @keyframes flow-tag { 0% { fill: var(--p-muted); } 30%, 100% { fill: var(--p-signal); } }
  @keyframes flow-fade { to { opacity: 1; } }
  @keyframes flow-draw { to { stroke-dashoffset: 0; } }
  @keyframes flow-fill { to { fill: var(--p-sun); stroke: var(--p-sun); } }
  @keyframes flow-ring { 0% { opacity: 0.9; scale: 1; } 7% { opacity: 0; scale: 2.6; } 100% { opacity: 0; scale: 2.6; } }
  @keyframes flow-retry { 0%, 10% { fill: var(--p-sun); } 18%, 100% { fill: var(--p-muted); } }
  .flow-steps { list-style: none; border-top: 1px solid var(--line); }
  .flow-steps li { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 0.5rem 1rem; padding: 1.4rem 0; border-bottom: 1px solid var(--line); }
  .flow-steps .p-n { padding-top: 0.4rem; color: var(--muted); animation: flow-num 0.6s both; animation-delay: var(--t); }
  .flow-steps h3 { font-family: var(--display); font-size: clamp(1.25rem, 1.8vw, 1.5rem); font-variation-settings: 'opsz' 72; max-width: 30ch; }
  .flow-steps p { color: var(--ink-2); font-size: 0.98rem; line-height: 1.55; margin-top: 0.45rem; max-width: 46ch; }
  @keyframes flow-num { to { color: var(--accent-text); } }
  /* Nothing in the circuit moves until the panel is on screen (main.js adds .play), and it rests while scrolled away. */
  html.js .flow:not(.play) :is(.flow-svg *, .flow-steps .p-n) { animation-play-state: paused; }
  @media (max-width: 900px) { .flow-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'head' 'fig' 'steps'; gap: 2rem; } .flow-fig { position: static; } }
  /* On a phone the whole drawing scales to the panel instead of scrolling sideways; the rules below it carry the words. */
  @media (max-width: 560px) {
    .flow-panel { padding: 0.75rem 0.6rem 0.7rem; border-radius: 14px; }
    .flow-bar { font-size: 0.58rem; letter-spacing: 0.08em; }
  }
}

@layer log {
  .log-head { padding: clamp(3rem, 7vw, 6rem) 0 2rem; }
  .log-head .display { font-size: clamp(2.7rem, 7.6vw, 6.6rem); margin-top: 1rem; }
  .filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 2.5rem; }
  .log-head .kicker a { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 0.25em; }
  .log-head .kicker a:hover { text-decoration-color: currentColor; }
  .chip { display: inline-flex; align-items: baseline; gap: 0.5em; flex: none; white-space: nowrap; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.5rem 0.9rem; border: 0; border-radius: 999px; color: var(--ink-2); background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
  .chip-n { font-size: 0.9em; color: var(--muted); font-variant-numeric: tabular-nums; }
  .chip[aria-pressed="true"] .chip-n { color: inherit; opacity: 0.7; }
  @media (max-width: 760px) {
    .filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--gutter)); padding: 0 var(--gutter) 0.5rem; scrollbar-width: none; overscroll-behavior-x: contain; }
    .filters::-webkit-scrollbar { display: none; }
  }
  .chip:hover { box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink); }
  .chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); box-shadow: none; }
  .pinned-label { margin: 1rem 0 0.9rem; font-weight: 500; line-height: 1.6; }
  .pinned-label::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd98a, var(--accent) 65%); }
  .pinned .rows { margin-top: 0; border-top: 1px solid var(--line-2); }
  .years { padding-top: 1rem; }
  .year { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(0, 4fr); gap: 0 3rem; padding: 1.5rem 0 3rem; }
  .year[hidden] { display: none; }
  .year-side { position: sticky; top: 5.5rem; align-self: start; display: grid; gap: 0.25rem; padding-top: 2rem; }
  .year-num {
    font-family: var(--display); font-size: clamp(3.5rem, 7.5vw, 7rem); line-height: 1; letter-spacing: -0.04em; font-variation-settings: 'opsz' 144;
    color: transparent; -webkit-text-stroke: 1px var(--line-2); transition: color 0.4s ease, -webkit-text-stroke-color 0.4s ease;
  }
  .year:hover .year-num, .year:focus-within .year-num { color: var(--ink); -webkit-text-stroke-color: var(--ink); }
  .year-count { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
  .year .rows { margin-top: 0; }
  .row[hidden] { display: none; }
  .empty { color: var(--muted); padding: 3rem 0; }
  @media (max-width: 760px) { .year { grid-template-columns: 1fr; gap: 0; padding-bottom: 2rem; } .year-side { position: static; grid-auto-flow: column; align-items: baseline; justify-content: start; gap: 1rem; padding: 1rem 0 0.75rem; } .year-num { font-size: 2.5rem; color: var(--ink); -webkit-text-stroke: 0; } }
}

@layer post {
  .progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: var(--accent); transform-origin: left; scale: 0 1; z-index: 60; }
  @supports (animation-timeline: scroll()) {
    .progress { animation: progress linear both; animation-timeline: scroll(root); }
    @keyframes progress { from { scale: 0 1; } to { scale: 1 1; } }
  }
  /* One centered reading column: kicker, title, deck, body, and the end matter share its left edge. */
  .col { width: min(var(--measure), 100% - 2 * var(--gutter)); margin-inline: auto; }
  .reading { --measure: 36rem; }
  .post-head { padding: clamp(3rem, 7vw, 6rem) 0 2.25rem; border-bottom: 1px solid var(--line); }
  .post-title { font-family: var(--display); font-weight: 400; font-size: clamp(2.2rem, 4.6vw, 3.6rem); letter-spacing: -0.02em; line-height: 1.04; margin-top: 1.25rem; font-variation-settings: 'opsz' 144; }
  .post-deck { font-family: var(--display); font-style: italic; font-size: clamp(1.2rem, 2vw, 1.45rem); color: var(--ink-2); margin-top: 1.25rem; line-height: 1.4; font-variation-settings: 'opsz' 48; }
  .post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem; margin-top: 1.5rem; }
  .short .post-head { padding: clamp(2.5rem, 5vw, 4rem) 0 1.75rem; }
  .short .post-title { font-size: clamp(2rem, 4vw, 3rem); }
  .short .prose { font-size: 1.25rem; }
  .toc { padding-top: 1.5rem; font-size: 0.9rem; }
  .toc-label { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.75rem; }
  .toc ol { list-style: none; display: grid; gap: 0.1rem; border-left: 1px solid var(--line); }
  .toc a { display: block; padding: 0.4rem 0 0.4rem 1rem; color: var(--muted); text-decoration: none; margin-left: -1px; border-left: 1px solid transparent; transition: color 0.2s ease, border-color 0.2s ease; line-height: 1.35; }
  .toc a:hover { color: var(--ink); }
  .toc a.active { color: var(--ink); border-left-color: var(--accent); }
  .prose { font-size: 1.125rem; line-height: 1.62; padding-top: 2rem; }
  .prose > * + * { margin-top: 1.3em; }
  .prose p.dropcap::first-letter { font-family: var(--display); font-size: 3.1em; float: left; line-height: 0.82; padding: 0.06em 0.1em 0 0; color: var(--ink); font-weight: 400; font-variation-settings: 'opsz' 144; }
  @supports (initial-letter: 2) or (-webkit-initial-letter: 2) {
    .prose p.dropcap::first-letter { float: none; font-size: inherit; line-height: inherit; padding: 0; margin-right: 0.08em; -webkit-initial-letter: 3; initial-letter: 3; }
  }
  .prose h2 { font-family: var(--display); font-size: 1.85rem; margin-top: 2.6em; letter-spacing: -0.02em; font-variation-settings: 'opsz' 72; }
  .prose h3 { font-family: var(--display); font-size: 1.35rem; margin-top: 2em; }
  .prose h2 + *, .prose h3 + * { margin-top: 0.8em; }
  .prose .anchor { text-decoration: none; color: inherit; }
  .prose .anchor:hover { color: inherit; }
  .prose .anchor:hover::after { content: ' #'; color: var(--accent); font-weight: 300; }
  .prose a:not(.anchor) { color: var(--link); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent); text-decoration-thickness: 1px; }
  .prose a:not(.anchor):hover { text-decoration-color: currentColor; }
  .prose ul, .prose ol { padding-left: 1.25rem; }
  .prose li + li { margin-top: 0.5em; }
  .prose li::marker { color: var(--accent); }
  .prose blockquote { border-left: 2px solid var(--accent); padding: 0.25rem 0 0.25rem 1.25rem; color: var(--ink-2); font-family: var(--display); font-style: italic; font-size: 1.2em; line-height: 1.5; font-variation-settings: 'opsz' 48; }
  .prose pre { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.25rem; overflow-x: auto; font-size: 0.86rem; line-height: 1.55; font-variant-ligatures: none; }
  .prose :not(pre) > code { font-size: 0.82em; background: var(--bg-3); border-radius: 4px; padding: 0.12em 0.35em; }
  .prose hr { border: 0; height: 12px; width: 120px; margin: 3em auto; background-color: var(--sea); opacity: 0.6; -webkit-mask: var(--squiggle) center / 100% 100% no-repeat; mask: var(--squiggle) center / 100% 100% no-repeat; }
  .prose strong { font-weight: 600; color: var(--ink); }
  .prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
  .prose th, .prose td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
  .prose th { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
  /* Figures: inline SVG drawn with theme tokens so they follow light and dark. */
  .prose .fig { margin: 2.75em 0; }
  .prose .fig svg { display: block; width: 100%; height: auto; max-width: 40rem; margin: 0 auto; overflow: visible; }
  .prose .fig figcaption { margin-top: 0.9rem; font-family: var(--display); font-style: italic; font-size: 0.95rem; line-height: 1.5; color: var(--ink-2); text-align: center; }
  /* Sketch figures follow the theme. */
  .prose .fig:not(.fig-shot) svg text { fill: var(--ink-2); stroke: none; font-family: var(--sans); }
  .prose .fig:not(.fig-shot) svg .t-ink { fill: var(--ink); }
  .prose .fig:not(.fig-shot) svg .t-mute { fill: var(--muted); }
  .prose .fig:not(.fig-shot) svg .t-acc { fill: var(--accent); }
  .prose .fig svg .s-ink { stroke: var(--ink); }
  .prose .fig svg .s-mute { stroke: var(--muted); }
  .prose .fig svg .s-line { stroke: var(--line-2); }
  .prose .fig svg .s-acc { stroke: var(--accent); }
  .prose .fig svg .f-bg { fill: var(--bg); }
  .prose .fig svg .f-acc { fill: var(--accent); }
  .prose .fig svg .f-dim { fill: var(--accent-dim); }
  .prose .fig svg .f-ink { fill: var(--ink); }
  .prose .fig svg .f-line { fill: color-mix(in srgb, var(--muted) 55%, transparent); }
  .prose .fig svg text.hand { font-family: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive; font-weight: 600; }
  /* Screenshot figures keep the colors of the tool they came from, like a pasted image. */
  .prose .fig-shot .shot { background: #fff; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px -12px rgb(0 0 0 / 0.25); }
  .prose .fig-shot .shot svg { max-width: none; }
  :root[data-theme="dark"] .prose .fig-shot .shot { filter: brightness(0.92); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .prose .fig-shot .shot { filter: brightness(0.92); } }
  .prose .fig-ascii pre { font-size: clamp(0.62rem, 1.9vw, 0.82rem); line-height: 1.35; white-space: pre; font-variant-ligatures: none; }
  .end-mark { display: inline-block; width: 0.42em; height: 0.42em; margin-left: 0.3em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd98a, var(--accent) 65%); vertical-align: baseline; translate: 0 -0.02em; }
  .post-end { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.25rem; margin-top: 2.75rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.04em; color: var(--muted); }
  .post-end > a { color: var(--link); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent); text-underline-offset: 0.3em; }
  .post-end-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
  .post-end-tags a { text-decoration: none; text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.08em; padding: 0.22em 0.6em; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
  .post-end-tags a:hover { border-color: var(--link); color: var(--link); }
  .post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: clamp(2.5rem, 6vw, 4rem); border: 1px solid var(--line); background: var(--line); }
  .pn { display: grid; gap: 0.6rem; align-content: start; padding: 1.5rem; background: var(--bg); text-decoration: none; transition: background 0.25s ease; }
  .pn:hover { background: var(--bg-2); color: inherit; }
  .pn.newer { text-align: right; }
  .pn-label { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
  .pn-title { font-family: var(--display); font-size: 1.2rem; line-height: 1.2; font-variation-settings: 'opsz' 48; transition: color 0.2s ease; }
  .pn.back .pn-title { font-style: italic; color: var(--ink-2); }
  .pn:hover .pn-title { color: var(--link); }
  @media (max-width: 640px) { .post-nav { grid-template-columns: 1fr; } .pn.newer { text-align: left; } }
}

@layer search {
  .search { margin: 10vh auto 0; width: min(40rem, 92vw); padding: 0; border: 0; border-radius: 1.4rem; background: color-mix(in oklab, var(--bg) 70%, transparent); color: var(--ink); -webkit-backdrop-filter: blur(28px) saturate(1.8); backdrop-filter: blur(28px) saturate(1.8); box-shadow: inset 0 0 0 1px var(--glass-edge), inset 0 1px 0 var(--glass-hi), var(--shadow); overflow: hidden; }
  .search::backdrop { background: rgb(14 14 14 / 0.25); -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2); }
  .search[open] { animation: pop 0.22s var(--ease-out); }
  @keyframes pop { from { opacity: 0; translate: 0 8px; scale: 0.985; } }
  .search-box { display: flex; align-items: center; gap: 0.85rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); color: var(--muted); }
  .search-box input { flex: 1; font: inherit; font-size: 1.05rem; background: none; border: 0; color: var(--ink); outline: none; }
  .search-box input::placeholder { color: var(--muted); }
  .search-box input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
  .search-results { list-style: none; max-height: 50vh; overflow-y: auto; padding: 0.4rem; }
  .search-results:empty { display: none; }
  .search-results a { display: grid; gap: 0.2rem; padding: 0.7rem 0.8rem; text-decoration: none; border-radius: 8px; }
  .search-results a[aria-selected="true"], .search-results a:hover { background: var(--bg-3); color: inherit; }
  .search-close { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 999px; color: var(--muted); transition: background 0.2s ease, color 0.2s ease; }
  .search-close:hover { background: var(--bg-3); color: var(--ink); }
  .search-empty[hidden] { display: none; }
  .sr-title { font-family: var(--display); font-size: 1.1rem; font-variation-settings: 'opsz' 48; }
  .sr-meta { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; color: var(--muted); }
  .sr-title mark, .sr-meta mark { background: var(--accent-dim); color: var(--accent-text); border-radius: 2px; }
  .search-empty { padding: 1.25rem 1rem; color: var(--muted); font-size: 0.95rem; }
  .search-hint { display: flex; gap: 0.35rem; padding: 0.6rem 1rem 0.8rem; border-top: 1px solid var(--line); font-size: 0.74rem; color: var(--muted); font-family: var(--mono); }
}

@layer motion {
  html.js .reveal { opacity: 0; translate: 0 18px; transition: opacity 0.7s ease, translate 0.9s var(--ease-out); }
  html.js .reveal.in { opacity: 1; translate: 0 0; }
  @media print { html.js .reveal { opacity: 1; translate: none; } .top, .progress { display: none; } }
  .reveal-now { animation: rise 0.9s var(--ease-out) both; }
  .reveal-now:nth-child(2) { animation-delay: 0.1s; }
  .reveal-now:nth-child(3) { animation-delay: 0.2s; }
  .hero-grid .reveal-now:nth-child(1) { animation-delay: 0.55s; }
  .hero-grid .reveal-now:nth-child(2) { animation-delay: 0.7s; }
  @keyframes rise { from { opacity: 0; translate: 0 18px; } }
  /* The headline rises a word at a time, out of a slight blur, then the three scribbles are drawn under it.
     On the home page's first visit this waits under the splash and starts as the name lands (see layer splash). */
  .hero-title .w { display: inline-block; animation: word 0.9s var(--ease-out) both; animation-delay: calc(0.1s + var(--i) * 0.07s); }
  @keyframes word { from { opacity: 0; translate: 0 0.6em; filter: blur(8px); } }
  .scribble path { stroke-dashoffset: 1; animation: draw 0.7s var(--ease-out) forwards; }
  .hero-title .w:nth-child(4) .scribble path { animation-delay: 1s; }
  .hero-title .w:nth-child(7) .scribble path { animation-delay: 1.2s; }
  .hero-title .w:nth-child(13) .scribble path { animation-delay: 1.45s; }
  @keyframes draw { to { stroke-dashoffset: 0; } }

  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: 0.16s ease-out both vt-out; }
  ::view-transition-new(root) { animation: 0.28s ease-out both vt-in; }
  @keyframes vt-out { to { opacity: 0; } }
  @keyframes vt-in { from { opacity: 0; } }
  .top { view-transition-name: top-bar; }

  @supports (animation-timeline: scroll()) {
    .nav::before { animation: nav-sun linear both; animation-timeline: scroll(root); }
    @keyframes nav-sun {
      0% { bottom: calc(50% - 3.5px); scale: 0.6; opacity: 0; --sun-c: var(--pin); }
      1.2% { opacity: 1; }
      3% { bottom: 3px; scale: 1; left: var(--sun-x); }
      6% { --sun-c: var(--accent); }
      to { bottom: 3px; scale: 1; left: calc(100% - 1.25rem - 7px); opacity: 1; --sun-c: var(--accent); }
    }
    /* The sun sets as the hero scrolls away: it sinks toward the horizon and dims. */
    .hero-sun { animation: sunset linear both; animation-timeline: scroll(root); animation-range: 0 100svh; }
    @keyframes sunset { to { translate: 0 42svh; scale: 0.8; opacity: 0.5; } }
    .hero-sun::after { animation: dusk linear both; animation-timeline: scroll(root); animation-range: 0 90svh; }
    @keyframes dusk { to { opacity: 0.7; } }
    /* A ruled line is drawn across each entry as it arrives, a brief light along the edge. */
    .timeline li::before {
      content: ''; position: absolute; top: -1px; left: 0; right: 0; height: 2px; pointer-events: none;
      background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 40%, transparent) 60%, transparent);
      transform-origin: left; animation: rule linear both; animation-timeline: view(); animation-range: entry 0% cover 45%;
    }
    @keyframes rule { from { scale: 0 1; } to { scale: 1 1; opacity: 0.55; } }
    .timeline h3 { animation: lift linear both; animation-timeline: view(); animation-range: entry 0% entry 90%; }
    @keyframes lift { from { opacity: 0; translate: 0 0.8em; } }
    /* The era nearest the middle of the screen is the lit one. */
    .t-when { animation: lit linear both; animation-timeline: view(); animation-range: cover 25% cover 75%; }
    @keyframes lit { 0%, 100% { color: var(--muted); } 35%, 65% { color: var(--accent-text); } }
    /* Contact: the last slot fills as you arrive. */
    .contact .slot::after { animation: land-slot linear both; animation-timeline: view(); animation-range: entry 100% cover 40%; }
    @keyframes land-slot { from { scale: 0; opacity: 0; } to { scale: 1; opacity: 1; } }
    /* The address underlines itself once it is in view; hovering no longer has to find it. */
    .contact .big-mail { animation: underline linear both; animation-timeline: view(); animation-range: entry 60% cover 50%; }
    @keyframes underline { from { background-size: 0 2px; } to { background-size: 100% 2px; } }
    /* Blog: the year you are reading is inked in; the rest stay as outlines. */
    /* The inset narrows the viewport to a reading line 40% down, so exactly one year group crosses it at a time. */
    .year { view-timeline: --year block; view-timeline-inset: 40% 59%; }
    .year-num { animation: year-ink linear both; animation-timeline: --year; animation-range: cover 0% cover 100%; }
    @keyframes year-ink { 0%, 100% { color: transparent; -webkit-text-stroke-color: var(--line-2); } 6%, 94% { color: var(--ink); -webkit-text-stroke-color: var(--ink); } }
    @media (max-width: 760px) { .year-num { animation: none; } }
    /* Posts: the closing dot lands when the last line comes into view. */
    .end-mark { animation: land linear both; animation-timeline: view(); animation-range: entry 30% cover 25%; }
    @keyframes land { from { scale: 0; opacity: 0; } 70% { scale: 1.45; box-shadow: 0 0 0.9em var(--sun); } to { scale: 1; opacity: 1; } }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
    html.js .reveal { opacity: 1; translate: 0 0; }
    .scribble path { animation: none !important; stroke-dashoffset: 0; }
    .hero::after, .log-head::after { animation: none !important; }
    .year-num, .nav::before, .hero-sun, .hero-sun::after, .timeline h3, .t-when, .end-mark, .contact .big-mail, .contact .slot::after { animation: none !important; }
    .timeline li::before { display: none; }
    .inst * { animation: none !important; }
    .hero-title .w { animation: none !important; }
    .flow-token { display: none !important; }
    .flow :is(.flow-svg *, .flow-steps .p-n) { animation-play-state: running !important; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  }
}

@layer books {
  .shelf-side { gap: 0.5rem; }
  .shelf-title { font-family: var(--display); font-weight: 400; font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.05; letter-spacing: -0.02em; font-variation-settings: 'opsz' 96; text-wrap: balance; }
  .shelf-note { color: var(--ink-2); font-size: 0.92rem; line-height: 1.5; max-width: 24ch; }
  .book { border-bottom: 1px solid var(--line); padding: 1.6rem 0; display: grid; gap: 0.4rem; }
  .book-title { font-family: var(--display); font-weight: 400; font-size: 1.45rem; line-height: 1.15; letter-spacing: -0.015em; font-variation-settings: 'opsz' 48; text-wrap: balance; }
  .book-by { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--muted); }
  .book-note { font-size: 1.02rem; line-height: 1.55; max-width: 62ch; color: var(--ink-2); margin-top: 0.2rem; }
  .book-note a { color: var(--link); }
  .filters a.chip { text-decoration: none; color: var(--ink-2); }
  .shelf { scroll-margin-top: 4.5rem; }
  @media (max-width: 760px) { .shelf-side { grid-auto-flow: row; } .shelf-note { max-width: none; } }
}
@layer books {
  .book-title a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-decoration-thickness: 1px; text-underline-offset: 0.18em; transition: color 0.2s ease, text-decoration-color 0.2s ease; }
  .book-title a:hover { color: var(--link); text-decoration-color: currentColor; }
}

@layer splash {
  /* Home page, first arrival per session: the intro plays while the page loads, then the wordmark flies into the bar (src/splash/splash.js). */
  #splash { position: fixed; inset: 0; z-index: 1000; overflow: hidden; background: #0a0a0b; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
  #splash video {
    position: absolute; display: block; transform-origin: 50% 50%; pointer-events: none;
    /* Feather the frame so a letterboxed video melts into the matching ground. */
    -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
    mask-composite: intersect;
  }
  /* Portrait phones: the magnified 16:9 strip would show flat top and bottom edges through the line field, so feather
     it as an ellipse instead. 78% keeps the frame-240 name (16-84% of the width, the middle fifth of the height) solid. */
  #splash.tall video {
    -webkit-mask-image: radial-gradient(farthest-side, #000 78%, transparent);
    -webkit-mask-composite: source-over;
    mask-image: radial-gradient(farthest-side, #000 78%, transparent);
    mask-composite: add;
  }
  /* iOS can paint its start-playback glyph on a muted inline video that has not started (Low Power Mode). */
  #splash video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
  #splash video::-webkit-media-controls { display: none !important; }
  /* The whole splash is the control (click, tap, scroll or a key); this label only says so. */
  #splash .splash-skip {
    position: absolute; right: max(24px, calc(env(safe-area-inset-right) + 16px)); bottom: max(22px, calc(env(safe-area-inset-bottom) + 16px));
    padding: 6px 0 6px 10px; color: color-mix(in srgb, var(--bone) 72%, transparent); font: 500 12px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
    transition: color 0.2s ease, opacity 0.25s ease;
  }
  #splash .splash-skip::after { content: ''; display: inline-block; width: 0.42em; height: 0.42em; margin-left: 0.7em; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; rotate: 45deg; translate: 0 -0.08em; }
  /* Hover only where there is a hover: on touch a tap would leave it stuck bright. */
  @media (hover: hover) { #splash:hover .splash-skip { color: color-mix(in srgb, var(--bone) 95%, transparent); } }
  @media (max-width: 760px) { #splash .splash-skip { right: max(16px, calc(env(safe-area-inset-right) + 16px)); } }
  /* Once the name takes over there is nothing left to skip: it lands alone. */
  #splash.ending .splash-skip { opacity: 0; }
  .splash-logo { position: fixed; z-index: 1001; left: 0; top: 0; display: block; height: auto; overflow: visible; color: var(--bone); transform-origin: 0 0; pointer-events: none; will-change: transform; }
  .splash-logo .pin { fill: var(--pin); transition: none; transform-box: fill-box; transform-origin: center; }
  html.splash-on, html.splash-on body { overflow: hidden; }
  html.splash-on [data-splash-target] { visibility: hidden; }
  /* The bar is a named view-transition group on every page; under the splash it must stay in the root group, below it. */
  html.splash-on .top { view-transition-name: none; }
  /* The hero's entrance waits under the splash and plays as the name lands. The portrait is left out: it rises behind
     the opaque splash, so it is already painted (and counted for LCP) when the splash lifts. */
  html.splash-on:not(.splash-go) :is(.reveal-now:not(.hero-side), .hero-title .w, .scribble path) { animation-play-state: paused; }
  /* Night before dusk: the sky and its dot lattice wait at a third under the splash and build up (their own 0.6 s
     opacity transition) as the name lands, so the black does not dissolve straight into the full dusk gradient. */
  html.splash-on:not(.splash-go) .hero::before { opacity: 0.35; }
  /* Released late, the hero settles faster: a tighter word stagger and shorter delays. splash-go stays on after the
     splash is gone, so these delays never change under a running animation. */
  html.splash-go .hero-title .w { animation-delay: calc(var(--i) * 0.04s); }
  html.splash-go .hero-grid .reveal-now:nth-child(1) { animation-delay: 0.25s; }
  html.splash-go .hero-title .w:nth-child(4) .scribble path { animation-delay: 0.6s; }
  html.splash-go .hero-title .w:nth-child(7) .scribble path { animation-delay: 0.75s; }
  html.splash-go .hero-title .w:nth-child(13) .scribble path { animation-delay: 0.95s; }
  html:not(.splash-on) #splash { display: none; }
}
