/* =========================================================
   Abhay Kumar — shared design system
   Concept: "The Annual Report". Paper, ink, figures.
   Every page imports this file. Page CSS lives in its own file.
   ========================================================= */

:root {
  --paper: #f2eadb;       /* beige ground */
  --paper-2: #fdfaf4;     /* brighter "sheet": cards, panels */
  --paper-3: #e9dfcb;     /* darker bands, strips, tracks */
  --ink: #14182b;
  --ink-2: #414860;
  --ink-3: #575e74;
  --rule: #d9cdb4;
  --accent: #2347c5;      /* Interactive blue: links, buttons, focus; anything that responds to the pointer */
  --accent-soft: #2347c514;
  --mark: #825400;        /* Ochre: static emphasis (italic heading words, section numbers) */
  --accent-2: var(--mark); /* retired alias, kept so nothing breaks */
  --play: #7a3e8f;        /* Plum: marks the visitor makes in a toy */
  --up: #0b6b4a;
  --down: #b02a20;
  --curtain: var(--ink);
  /* Agent cursors (home § 01 "How I build"): a scoped categorical set, always beside a name tag; --agent-1 is a literal, not an alias of --accent.
   --agent-on is the text colour on their name tags. */
  --agent-1: #1f4fe0; --agent-2: #0f766e; --agent-3: #6d3fc0; --agent-4: #b4440f; --agent-5: #a3246b; --agent-on: #ffffff;

  --serif: "Fraunces", "Times New Roman", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --gutter: clamp(20px, 4vw, 56px);   /* 20px on phones (was 16px); unchanged from 500px up */
  --max: 1240px;
  --header-h: 64px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --ease-io: cubic-bezier(.7, 0, .2, 1);
  /* Springs as easings: step responses of a damped spring, sampled into linear().
     --spring: ζ 0.8 (settles, 1.5% overshoot; use ~.5s). --spring-bounce: ζ 0.55 (12% overshoot; use ~.8s).
     Browsers without linear() keep the cubic-bezier declared here. */
  --spring: cubic-bezier(.2, .9, .3, 1.02);
  --spring-bounce: cubic-bezier(.3, 1.4, .5, 1);
  color-scheme: light;
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.018, 0.065, 0.131, 0.209, 0.293, 0.378, 0.461, 0.539, 0.612, 0.678, 0.738, 0.789, 0.834, 0.872, 0.905, 0.931, 0.953, 0.97, 0.984, 0.994, 1.002, 1.007, 1.011, 1.014, 1.015, 1.015, 1.015, 1.014, 1.013, 1.012, 1.011, 1.01, 1.008, 1.007, 1.006, 1.005, 1.004, 1.003, 1.003, 1);
    --spring-bounce: linear(0, 0.037, 0.13, 0.259, 0.405, 0.553, 0.692, 0.815, 0.917, 0.998, 1.057, 1.096, 1.118, 1.126, 1.123, 1.112, 1.097, 1.078, 1.06, 1.042, 1.026, 1.012, 1.002, 0.994, 0.988, 0.985, 0.984, 0.984, 0.986, 0.987, 0.99, 0.992, 0.994, 0.996, 0.998, 1, 1.001, 1.001, 1.002, 1.002, 1);
  }
}

/* Light is the default for everyone; dark is opt-in via the toggle (data-theme="dark"). */
:root[data-theme="dark"] {
  --paper: #141b34; --paper-2: #1c2546; --paper-3: #10162b; --ink: #f4f0e6; --ink-2: #c5c9da; --ink-3: #a0a6bf;
  --rule: #303a62; --accent: #93adff; --accent-soft: #93adff1a; --mark: #f0b86a; --play: #d9a8ec; --up: #5fd3a2; --down: #ff8e80;
  color-scheme: dark;
  --agent-1: #93adff; --agent-2: #5fd3a2; --agent-3: #c3a6ff; --agent-4: #ff9b78; --agent-5: #e8c45a; --agent-on: #141b34;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; scroll-padding-top: calc(var(--header-h) + 16px);
  hanging-punctuation: first allow-end last; font-kerning: normal; font-optical-sizing: auto; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
::selection { background: var(--accent); color: var(--paper); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* ---------- Type scale ---------- */
.display { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; line-height: .95;
  font-size: clamp(56px, 11vw, 168px); margin: 0; }
.h1 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; line-height: 1.02;
  font-size: clamp(40px, 6.4vw, 96px); margin: 0; }
.h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; line-height: 1.08;
  font-size: clamp(30px, 4vw, 56px); margin: 0; }
.h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; font-size: clamp(22px, 2.2vw, 28px); margin: 0; }
.lede { font-family: var(--serif); font-size: clamp(20px, 2vw, 26px); line-height: 1.4; color: var(--ink-2); max-width: 34ch; }
.body { color: var(--ink-2); max-width: 62ch; }
.eyebrow { font-family: var(--sans); font-weight: 500; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.label { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.figure { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
em, .ital { font-style: italic; }
.display, .h1, .h2, .h3, .lede, .curtain-title, .brand-name, .brand-mark, .next .sub { font-variation-settings: "SOFT" 40, "WONK" 0; font-optical-sizing: auto; }
/* Precision type: headings balance their lines, prose avoids orphans, every number sits on a fixed-width grid. */
.display, .h1, .h2, .h3, .lede { text-wrap: balance; }
p, li, dd, figcaption { text-wrap: pretty; }
.figure, .label, .note, .tag, .mono, kbd, table, time, output { font-variant-numeric: tabular-nums lining-nums; }
kbd { font-family: var(--mono); font-size: 11px; line-height: 1; padding: 3px 5px; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 5px; color: var(--ink-2); background: var(--paper-2); white-space: nowrap; }
.accent { color: var(--mark); }
.up { color: var(--up); } .down { color: var(--down); }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(96px, 14vw, 200px) 0; position: relative; }
.rule { height: 1px; background: var(--rule); border: 0; margin: 0; }
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; }
@media (max-width: 800px) { .grid-12 { grid-template-columns: 1fr; gap: 16px; } .grid-12 > * { grid-column: 1 / -1 !important; } }

/* Section heading row: "§ 02 — Title ........ page marker" */
.sect-head { display: flex; align-items: baseline; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--ink); margin-bottom: clamp(40px, 6vw, 80px); }
.sect-head .num { font-family: var(--mono); font-size: 12px; color: var(--mark); }
.sect-head .title { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.sect-head .fill { flex: 1; border-bottom: 1px dotted var(--rule); transform: translateY(-4px); }
.sect-head .aside { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
@media (max-width: 600px) { .sect-head .aside, .sect-head .fill { display: none; } }   /* the dotted leader shrank to a stub beside long titles */
/* § numbers become buttons that open a slip (detail.js); the caret is drawn from the start so nothing moves when they do. */
html.js :is(.sect-head > .num, .cs-chapter-head > .cs-num):not(:has(a, button))::after { content: "▾"; display: inline-block; margin-left: 3px; font-size: .78em; opacity: .75; }

/* ---------- Buttons / links ---------- */
.btn { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 20px; border: 1px solid var(--ink);
  border-radius: 999px; font-size: 15px; font-weight: 500; transition: background .3s var(--ease), color .3s var(--ease); }
.btn { transition: background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease), transform .5s var(--spring); }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: scale(.965); transition-duration: .3s, .3s, .3s, .09s; }
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); }
.btn .arr { transition: transform .3s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }
.link-u { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .4s var(--ease); }
.link-u:hover { background-size: 100% 1px; }

/* ---------- Header ---------- */
.site-header { position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 50;
  display: flex; align-items: center; transition: transform .5s var(--ease), background .3s; }
.site-header.is-hidden { transform: translateY(-100%); }
.site-header.is-solid { background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; border: 1px solid var(--ink); border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); font-size: 15px; letter-spacing: -.02em; }
.brand-name { font-family: var(--serif); font-size: 18px; }
.brand-tick { font-family: var(--mono); font-size: 11px; color: var(--up); margin-left: 2px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { position: relative; font-size: 14px; padding: 8px 12px; color: var(--ink-2); border-radius: 999px; transition: color .25s; }
.nav a .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-right: 6px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 1px; background: var(--accent); }
.nav .btn { height: 36px; padding: 0 14px; font-size: 13px; margin-left: 8px; }
/* Theme switch: a small physical switch. --k is the knob's travel, 0 (light) → 1 (dark). Without JS the
   attribute sets it; detail.js drives it on a spring (overshoot, a detent at the middle, a draggable knob). */
.theme-toggle { --k: 0; --sv: 0; width: 52px; height: 36px; border-radius: 999px; display: grid; place-items: center; color: var(--ink-2);
  margin-left: 4px; touch-action: none; -webkit-tap-highlight-color: transparent; }
.theme-toggle[aria-pressed="true"] { --k: 1; }
.tt-track { position: relative; display: block; width: 42px; height: 24px; border-radius: 999px; border: 1px solid var(--rule);
  background: color-mix(in oklab, var(--accent) calc(var(--k) * 22%), var(--paper-3));
  box-shadow: inset 0 1px 2px color-mix(in srgb, var(--ink) 12%, transparent); transition: border-color .25s; }
.theme-toggle:hover .tt-track { border-color: color-mix(in oklab, var(--accent) 55%, var(--rule)); }
.tt-knob { position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper-2);
  border: 1px solid color-mix(in oklab, var(--ink) 30%, transparent);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 25%, transparent), inset calc(var(--k) * -4px) calc(var(--k) * -2px) 0 calc(var(--k) * -1px) color-mix(in oklab, var(--accent) 40%, transparent);
  translate: calc(var(--k) * 18px) 0; scale: calc(1 + var(--sv)) calc(1 - var(--sv) * .5);
  transition: translate .6s var(--spring-bounce), box-shadow .4s var(--ease); }
.theme-toggle.is-live .tt-knob { transition: box-shadow .4s var(--ease); }
.theme-toggle:active .tt-knob { scale: 1.08 .94; }
.theme-toggle.is-held .tt-knob { cursor: grabbing; }
.tt-ico { position: absolute; top: 5px; width: 12px; height: 12px; fill: none; stroke: var(--ink-3); stroke-width: 1.1; stroke-linecap: round; pointer-events: none; }
.tt-sun { right: 5px; opacity: calc(1 - var(--k)); }
.tt-moon { left: 5px; opacity: var(--k); fill: var(--ink-3); stroke: none; }
.brand-mark { transition: transform .8s var(--spring-bounce), border-color .3s; }
.brand:hover .brand-mark { transform: rotate(-8deg); border-color: var(--accent); }
.brand:active .brand-mark { transform: rotate(-8deg) scale(.92); transition-duration: .09s; }
/* Search trigger: opens the command palette (craft.js) */
.kbtn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 12px; margin-left: 8px; border-radius: 999px; border: 1px solid var(--rule);
  font-size: 13px; color: var(--ink-3); transition: color .25s, border-color .25s, transform .5s var(--spring); }
.kbtn:hover { color: var(--accent); border-color: var(--accent); }
.kbtn:active { transform: scale(.96); transition-duration: .25s, .25s, .09s; }
.kbtn kbd { border-radius: 999px; padding: 4px 7px; }
/* "?" beside search: the shortcuts sheet */
.kbtn-help { margin-left: 4px; padding: 0 6px; }
.kbtn-help kbd { min-width: 22px; text-align: center; }
.kbtn-help .kbtn-t { display: none; }
@media (min-width: 861px) and (max-width: 1040px) { .kbtn:not(.kbtn-help) .kbtn-t { display: none; } .nav a { padding: 8px 9px; } .nav .btn { margin-left: 4px; } }
.brand-name { white-space: nowrap; }
/* The sliding indicator between nav links lives in detail.css (detail.js adds it). */
@media (min-width: 861px) { .nav { position: relative; } }
/* Skip link: first stop for keyboard visitors */
.skip-link { position: fixed; left: 12px; top: 10px; z-index: 120; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--paper);
  font-size: 14px; font-weight: 500; transform: translateY(-64px); transition: transform .5s var(--spring); }
.skip-link:focus { transform: none; outline-offset: 2px; }
main:focus { outline: none; }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; height: 36px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 999px; }
  .nav { position: fixed; inset: 0; background: var(--paper); flex-direction: column; align-items: flex-start; justify-content: center;
    gap: 6px; padding: 0 var(--gutter); opacity: 0; pointer-events: none; transition: opacity .4s var(--ease); z-index: -1; }
  .nav a { font-family: var(--serif); font-size: 44px; padding: 4px 0; color: var(--ink); }
  .nav a .n { font-size: 12px; vertical-align: super; }
  .nav a[aria-current="page"]::after { left: 0; right: auto; width: 40px; bottom: 6px; }
  .nav .btn { margin: 24px 0 0; height: 46px; font-family: var(--sans); font-size: 15px; }
  .nav { visibility: hidden; transition: opacity .4s var(--ease), visibility 0s .4s; }
  body.menu-open .nav { opacity: 1; pointer-events: auto; visibility: visible; transition-delay: 0s; }
  .nav .kbtn { margin: 20px 0 0; height: 46px; padding: 0 16px; font-size: 15px; color: var(--ink-2); }
  .nav .kbtn kbd { display: none; }
  .nav .kbtn-help { margin: 8px 0 0; }
  .nav .kbtn-help kbd { display: inline-block; }
  .nav .kbtn-help .kbtn-t { display: inline; }
  /* The switch lines up with the column: its track (42 px inside the 52 px button) starts on the same left edge, with room above. */
  .nav .theme-toggle { margin: 14px 0 0 -5px; }
  /* The four pages are full-width rows; Search, Résumé and the theme switch share one tidy row under them. */
  .nav { flex-flow: row wrap; align-content: center; justify-content: flex-start; column-gap: 10px; }
  .nav > a:not(.btn) { flex: 0 0 100%; }
  .nav .kbtn, .nav .kbtn-help, .nav .btn { margin: 28px 0 0; height: 46px; }
  .nav .theme-toggle { margin: 28px -5px 0 auto; width: 52px; height: 46px; }   /* its 42px track ends on the right gutter */
  body.menu-open { overflow: hidden; }
  /* A backdrop filter makes the header the containing block for its fixed children, which would squeeze the
     full-screen menu into the header bar once the page has scrolled. */
  body.menu-open .site-header { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .brand-name { display: none; }
  /* Phones and tablets: one header band on every page. Nearly opaque (text scrolling under it doesn't ghost through)
     with a hairline once the page has moved. */
  .site-header { border-bottom: 1px solid transparent; transition: transform .5s var(--ease), background .3s, border-color .3s; }
  .site-header.is-solid { background: color-mix(in srgb, var(--paper) 94%, transparent); border-bottom-color: color-mix(in srgb, var(--rule) 70%, transparent); }
  body.menu-open .site-header { border-bottom-color: transparent; }
}
/* Phones: § numbers stay tappable but drop the dotted underline and caret (they read as a dropdown at this size). */
@media (max-width: 700px) { html.js :is(.sect-head > .num, .cs-chapter-head > .cs-num):not(:has(a, button))::after { content: none; } }

/* Reading progress rule under header */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; pointer-events: none; }
.progress i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--read, 0)); }

/* ---------- Ticker tape ---------- */
.ticker { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); overflow: hidden; white-space: nowrap;
  font-family: var(--mono); font-size: 13px; color: var(--ink-2); padding: 12px 0; }
.ticker-track { display: inline-flex; gap: 48px; padding-right: 48px; animation: tick 48s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker b { color: var(--ink); font-weight: 500; }
@keyframes tick { to { transform: translateX(-50%); } }

/* ---------- Next chapter (end-of-page continuation) ---------- */
.next { display: block; border-top: 1px solid var(--ink); padding: clamp(48px, 8vw, 96px) var(--gutter) clamp(56px, 8vw, 110px); position: relative; overflow: hidden; }
.next.wrap { max-width: calc(var(--max) - 2 * var(--gutter)); width: calc(100% - 2 * var(--gutter)); padding-left: 0; padding-right: 0; }
.next .label { display: flex; justify-content: space-between; }
.next .h1 { margin-top: 18px; display: flex; align-items: baseline; gap: .3em; transition: transform .6s var(--ease); }
.next .h1 .arr { font-family: var(--sans); font-weight: 300; transition: transform .6s var(--ease); }
.next:hover .h1 { transform: translateX(12px); }
.next:hover .h1 .arr { transform: translateX(16px); color: var(--accent); }
.next .sub { color: var(--ink-3); margin-top: 10px; font-family: var(--serif); font-style: italic; font-size: 20px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 28px 0 36px; font-size: 13px; color: var(--ink-3); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; align-items: center; }
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a:hover { color: var(--ink); }
.site-footer .mono { font-family: var(--mono); font-size: 12px; }
.site-footer a { transition: color .25s; }
.site-footer a[aria-current="page"] { color: var(--ink); }
/* Coarse pointers: the footer links are 40 px tall to a finger, with no change to the layout (rows keep a 20 px gap between hit areas' edges). */
@media (pointer: coarse) { .site-footer nav a { padding: 10px 0; margin: -10px 0; } }
/* The copyright line is a button: back to the top (detail.js springs it). */
.ak-top-b { font: inherit; letter-spacing: inherit; color: inherit; padding: 4px 6px; margin: -4px -6px; border-radius: 6px; transition: color .2s, background-color .2s; }
.ak-top-b:hover { color: var(--ink); background: var(--accent-soft); }
/* "N things on this page respond · Show me" (detail.js counts them and rings the ones in view) */
.ak-touch-line { flex-basis: 100%; margin: 0; }
.ak-showme { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; min-height: 36px; margin: -4px 0 -4px -10px; padding: 4px 12px 4px 10px;
  border-radius: 999px; font-size: 13px; color: var(--ink-2); text-align: left; transition: color .2s, background-color .2s; }
.ak-showme-n { font-family: var(--mono); font-weight: 500; font-size: 12.5px; color: var(--accent); font-variant-numeric: tabular-nums; }
.ak-showme-sep { color: var(--ink-3); }
.ak-showme-go { color: var(--accent); background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; }
.ak-showme:hover { background: var(--accent-soft); color: var(--ink); }
/* Live facts about this visit (craft.js fills it after load): quiet, small, and each one a button. */
.site-vitals { position: relative; flex-basis: 100%; margin: 0; padding-top: 12px; border-top: 1px dotted var(--rule); display: flex; flex-wrap: wrap; align-items: center;
  gap: 2px 14px; font-size: 11px !important; color: var(--ink-3); }
.site-vitals[hidden] { display: none; }
.site-vitals b { font-weight: 500; color: var(--ink-3); }
.site-vitals a { color: var(--ink-3); }
.sv-b { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 6px; margin: 0 -6px; border-radius: 6px; font: inherit; color: var(--ink-3);
  text-decoration: underline dotted; text-decoration-color: color-mix(in srgb, var(--ink-3) 45%, transparent); text-underline-offset: 3px; transition: color .2s, background-color .2s; }
.sv-b:hover, a.sv-b:hover { color: var(--accent); background: var(--accent-soft); text-decoration-color: currentColor; }
.sv-b b { font-weight: 500; color: inherit; }
@media (pointer: coarse) { .sv-b { min-height: 36px; } }
/* "Ready in" replays the load as a line drawn along the rule above the facts. */
.sv-bar { position: absolute; left: 0; right: 0; top: -1px; height: 2px; pointer-events: none; opacity: 0; transition: opacity .4s; }
.sv-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--sv-k, 0)); }
.sv-bar.on { opacity: 1; }
/* Back-to-top cord (site.js puts it in the footer; detail.js gives it a spring). It hangs from the footer's top rule,
   in room the footer keeps free for it, so nothing moves when it arrives. */
.site-footer .wrap { position: relative; padding-right: calc(var(--gutter) + 52px); }
.ak-rope { position: absolute; top: -28px; right: var(--gutter); width: 44px; height: 66px; color: var(--ink-3);
  touch-action: none; cursor: grab; -webkit-tap-highlight-color: transparent; border-radius: 10px; }
.ak-rope::before { content: ""; position: absolute; left: 17px; top: -1px; width: 10px; height: 3px; border-radius: 0 0 3px 3px; background: var(--ink-3); }
.ak-rope-svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.ak-rope-cord { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.ak-rope-bead { position: absolute; left: 15px; top: 27px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper-2);
  border: 1.5px solid var(--ink-2); box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 20%, transparent); pointer-events: none;
  transition: border-color .2s, background-color .2s, scale .35s var(--spring); }
.ak-rope-t { position: absolute; left: 0; right: 0; top: 46px; text-align: center; font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); pointer-events: none; transition: color .2s, opacity .2s; }
.ak-rope:hover { color: var(--ink-2); }
.ak-rope:hover .ak-rope-bead, .ak-rope.is-held .ak-rope-bead { border-color: var(--accent); scale: 1.12; }
.ak-rope.is-held { cursor: grabbing; }
.ak-rope.is-held .ak-rope-t { opacity: 0; }
.ak-rope.is-ready .ak-rope-bead { background: var(--accent); border-color: var(--accent); }
.ak-rope.is-ready, .ak-rope.is-ready .ak-rope-t { color: var(--accent); }

/* ---------- Footnotes ----------
   <sup class="ak-fn"><a data-fn href="#fn-1" id="fnref-1">1</a></sup> … <ol class="ak-notes"><li id="fn-1">… <a class="ak-fn-back" href="#fnref-1">↩</a></li></ol>
   Layout here (so nothing shifts when the tactile layer arrives); the slip and its states are in detail.css. */
sup.ak-fn { font-size: .62em; line-height: 0; vertical-align: super; margin-left: .08em; }
sup.ak-fn a { display: inline-block; min-width: 1.6em; padding: .1em .32em; font-family: var(--mono); font-weight: 500; text-align: center;
  color: var(--accent); border-radius: 999px; line-height: 1.2; }
ol.ak-notes { list-style: none; counter-reset: ak-n; margin: clamp(32px, 5vw, 56px) 0 0; padding: 16px 0 0; border-top: 1px solid var(--rule); max-width: 68ch; }
ol.ak-notes > li { counter-increment: ak-n; position: relative; padding: 6px 0 6px 2.4em; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
ol.ak-notes > li::before { content: counter(ak-n); position: absolute; left: 0; top: 7px; min-width: 1.7em; font-family: var(--mono); font-size: 11px;
  color: var(--mark); text-align: right; }
ol.ak-notes a:not(.ak-fn-back) { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.ak-fn-back { margin-left: 4px; font-family: var(--mono); font-size: 12px; color: var(--accent); }
.print-head, .call-print { display: none; }

/* ---------- Page curtain (transitions between pages) ---------- */
.curtain { position: fixed; inset: 0; z-index: 100; background: var(--curtain); color: var(--paper);
  display: grid; place-items: center; pointer-events: none; transform: translateY(100%); }
.curtain-title { font-family: var(--serif); font-size: clamp(36px, 6vw, 80px); letter-spacing: -.02em; opacity: 0; transform: translateY(20px);
  display: flex; align-items: baseline; gap: 16px; }
.curtain-title .n { font-family: var(--mono); font-size: 14px; opacity: .6; }
.curtain-line { position: absolute; left: 0; right: 0; bottom: 30%; height: 80px; opacity: .5; }
html.is-entering .curtain { transform: translateY(0); }
html.is-entering .curtain-title { opacity: 1; transform: none; }
.curtain.out { transition: transform .6s var(--ease-io) .05s; transform: translateY(-100%); }
.curtain.out .curtain-title { transition: opacity .3s, transform .5s var(--ease); opacity: 0; transform: translateY(-20px); }
.curtain.in { transition: transform .4s var(--ease-io); transform: translateY(0); }
.curtain.in .curtain-title { transition: opacity .25s .15s, transform .4s var(--ease) .15s; opacity: 1; transform: none; }

/* ---------- Reveal primitives ---------- */
html.js [data-reveal] { opacity: 0; transform: translateY(24px); }
[data-reveal] { transition: opacity .75s var(--ease), transform .75s var(--ease); transition-delay: var(--d, 0s); }
html.js [data-reveal].in { opacity: 1; transform: none; }
html.js [data-reveal="fade"] { transform: none; }
html.js [data-reveal="rule"] { transform: scaleX(0); transform-origin: 0 50%; opacity: 1; transition: transform 1.1s var(--ease); }
html.js [data-reveal="rule"].in { transform: scaleX(1); }
.split .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .08em; margin-bottom: -.08em; }
.split .w > span { display: inline-block; transform: translateY(105%); transition: transform .75s var(--ease); transition-delay: calc(var(--i) * 28ms + var(--d, 0s)); }
.split.in .w > span { transform: none; }
/* The first screen (site.js marks it .ak-fold): quick, nearly unstaggered, and never blank. The name and the line
   under it start within ~150 ms; a CSS animation forces everything there visible at 1 s even if no frame ever runs. */
html.js .ak-fold[data-reveal] { transition-duration: .5s; transition-delay: min(calc(var(--d, 0s) * .3), .15s); }
html.js .ak-fold.split .w > span { transition-duration: .55s; transition-delay: calc(min(var(--i) * 16ms, .12s) + min(calc(var(--d, 0s) * .3), .06s)); }
html.js .ak-fold[data-reveal]:not(.in), html.js .ak-fold.split:not(.in) .w > span { animation: ak-fold-in 0s 1s both; }
@keyframes ak-fold-in { to { opacity: 1; transform: none; } }

/* Scroll scene: JS writes --p (0 → 1) on [data-scene] as it travels through the viewport (sticky pin). */
[data-scene] { --p: 0; }

/* ---------- Utilities ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hide-sm { } @media (max-width: 700px) { .hide-sm { display: none !important; } }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border: 1px solid var(--rule); border-radius: 999px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em; color: var(--ink-2); }
.card { border: 1px solid var(--rule); border-radius: 14px; background: var(--paper-2); }
.note { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  [data-reveal], .split .w > span { opacity: 1 !important; transform: none !important; }
}

/* ---------- Case-study pager (injected by site.js on case pages) ---------- */
.case-pager { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 28px 0; border-top: 1px solid var(--rule); font-size: 15px; margin-top: clamp(24px, 4vw, 48px); }
.case-pager.wrap { width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--max) - 2 * var(--gutter)); }
.case-pager a { display: inline-flex; flex-direction: column; gap: 4px; color: var(--ink-2); transition: color .25s; }
.case-pager a:hover { color: var(--ink); }
.case-pager .label { color: var(--ink-3); }
.case-pager .t { font-family: var(--serif); font-size: 20px; color: var(--ink); }
.case-pager .all { flex-direction: row; white-space: nowrap; }

/* ---------- View transitions ----------
   Between pages (cross-document, where supported): the header holds still and the page content hands over.
   Moving forward along the reading order (Home → Work → cases → Record → About → Colophon) slides the new
   page in from the right; moving back, from the left; anything else fades up. site.js on the page being left
   picks the direction, the arriving page's head script sets html[data-vt] before its first frame.
   site.js keeps the curtain for browsers without it. Reduced motion opts out entirely. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .site-header { view-transition-name: ak-header; }
  main { view-transition-name: ak-main; }
  ::view-transition-group(root) { animation-duration: .32s; }
  ::view-transition-old(ak-main) { animation: ak-vt-out .18s cubic-bezier(.4, 0, 1, 1) both; }
  ::view-transition-new(ak-main) { animation: ak-vt-in .5s var(--ease) .06s both; }
  html[data-vt="fwd"]::view-transition-old(ak-main) { animation: ak-vt-out-l .22s cubic-bezier(.4, 0, 1, 1) both; }
  html[data-vt="fwd"]::view-transition-new(ak-main) { animation: ak-vt-in-r .55s var(--ease) .05s both; }
  html[data-vt="back"]::view-transition-old(ak-main) { animation: ak-vt-out-r .22s cubic-bezier(.4, 0, 1, 1) both; }
  html[data-vt="back"]::view-transition-new(ak-main) { animation: ak-vt-in-l .55s var(--ease) .05s both; }
  ::view-transition-group(ak-main) { animation: none; }
  /* The header is one element on both pages: it holds still, and its contents simply cross over. */
  ::view-transition-group(ak-header) { animation-duration: .3s; }
  ::view-transition-old(ak-header), ::view-transition-new(ak-header) { animation-duration: .2s; }
  ::view-transition-old(ak-header):only-child { animation: none; }
  /* Theme change: the new palette opens as an iris from the control that asked for it. */
  html.theme-switching, html.theme-switching * { transition: none !important; }
  html.theme-switching .site-header, html.theme-switching main { view-transition-name: none; }
  html.theme-switching::view-transition-old(root) { animation: none; mix-blend-mode: normal; }
  html.theme-switching::view-transition-new(root) { animation: ak-iris .7s var(--ease-io) both; mix-blend-mode: normal; }
}
@keyframes ak-vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes ak-vt-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes ak-vt-out-l { to { opacity: 0; transform: translateX(-24px); } }
@keyframes ak-vt-out-r { to { opacity: 0; transform: translateX(24px); } }
@keyframes ak-vt-in-r { from { opacity: 0; transform: translateX(36px); } }
@keyframes ak-vt-in-l { from { opacity: 0; transform: translateX(-36px); } }
@keyframes ak-iris { from { clip-path: circle(0 at var(--tx, 50%) var(--ty, 0px)); } to { clip-path: circle(var(--tr, 150vmax) at var(--tx, 50%) var(--ty, 0px)); } }

@media (forced-colors: active) {
  :focus-visible { outline-color: Highlight; }
  .btn, .kbtn, .card, .tag, .tt-track, .tt-knob { border-color: CanvasText; }
}

/* ---------- Phones (≤ 700px): tidy shared chrome ---------- */
@media (max-width: 700px) {
  /* The menu: keyboard shortcuts are a desktop affordance. */
  .nav .kbtn-help { display: none; }
  .nav a { font-size: 40px; }
  /* Next page: same weight, less air. */
  .next { padding-top: 40px; padding-bottom: 48px; }
  .next .h1 { display: block; margin-top: 12px; font-size: clamp(36px, 10.5vw, 44px); text-wrap: balance; }
  .next .h1 .arr { display: inline-block; margin-left: .2em; }
  .next .sub { font-size: 18px; }
  /* Footer: copyright, four links in two columns, the "show me" line. The visit facts live in the colophon. */
  .site-footer { padding: 28px 0 32px; }
  .site-footer .wrap { gap: 14px 24px; align-items: flex-start; }
  .site-footer nav { display: grid; grid-template-columns: repeat(2, max-content); gap: 0 28px; flex-basis: 100%; }
  .site-footer nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0; margin: 0; font-size: 14px; color: var(--ink-2); }
  .site-vitals { display: none !important; }
  .site-footer .ak-top-b { display: inline-block; text-align: left; text-wrap: balance; }
}

