/* ============================================================
   chandhan.com: the contact sheet.
   The home page is black photo paper: one full-bleed print, then
   the work as frames on a strip, marked in grease pencil. Every
   other page is the back of a print: paper, typed labels, hairlines.
   One accent, the grease pencil red. No gradients on chrome, no
   shadows, no tints. Legacy tokens (--fg, --rule, --ok ...) stay
   defined because the demos read them at mount.
   ============================================================ */

:root {
  /* the sheet */
  --ink: #0b0b0b; --sheet: #121212; --frame: #171717; --frame-2: #1f1f1f;
  --rule-d: #2b2b2b; --rule-d2: #1e1e1e;
  --silver: #c6c8c3; --silver-2: #8f918c; --silver-3: #5f615d;
  /* the print back */
  --paper: #f2f3f0; --paper-2: #e7e8e4; --paper-3: #dcdedb;
  --text: #151515; --text-2: #575a56; --text-3: #767974;
  --rule-l: #d2d4cf; --rule-l2: #e2e4df;
  /* the pencil */
  --red: #d92a24; --red-2: #f0433d;

  --cond: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --grot: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --type: "Courier Prime", "Courier New", Courier, monospace;
  --marker: "Permanent Marker", "Segoe Print", cursive;

  --nav-h: 48px; --wide: 1160px; --measure: 66ch;
  --gutter: max(24px, calc(50% - var(--wide) / 2 + 24px));
  --s-1: 4px; --s-2: 8px; --s-3: 16px; --s-4: 24px; --s-5: 40px; --s-6: 64px; --s-7: 96px;
  --t-xs: 0.75rem; --t-sm: 0.875rem; --t-base: 1rem; --t-read: 1.0625rem; --t-md: 1.125rem; --t-lg: 1.375rem; --t-xl: 1.875rem;
  --dur-1: 140ms; --dur-2: 260ms; --dur-3: 700ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1); --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* legacy tokens the demos and the search palette read: paper values by default */
  --bg: var(--paper); --panel: #ffffff; --panel-2: var(--paper-2);
  --fg: var(--text); --muted: var(--text-2); --dim: var(--text-3);
  --rule: var(--rule-l); --rule-2: var(--rule-l2);
  --accent: var(--red); --accent-2: var(--red-2);
  --ok: #2f7a4d; --warn: #a85a00; --bad: var(--red); --info: #4b5f9c;
  --mono: var(--type); --sans: var(--grot);
  color-scheme: light;
}
.home {
  --bg: var(--ink); --panel: var(--frame); --panel-2: var(--frame-2);
  --fg: var(--paper); --muted: var(--silver-2); --dim: var(--silver-3);
  --rule: var(--rule-d); --rule-2: var(--rule-d2);
  --ok: #6fcf97; --warn: #f0a24a; --info: #9fb0e6;
  color-scheme: dark;
}

/* ---------------- ground ---------------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: var(--text-3) var(--paper); }
:root:has(.home) { scrollbar-color: var(--silver-3) var(--ink); }
body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--fg);
  background-color: var(--bg);
  font-family: var(--grot);
  font-size: var(--t-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
input, textarea, select { caret-color: var(--red); }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--rule); transition: text-decoration-color var(--dur-1); }
p a:hover, li a:hover, dd a:hover { text-decoration-color: var(--red); }
img { max-width: 100%; height: auto; display: block; }
main { flex: 1; width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--s-4); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--red); color: #fff; padding: 8px 12px; font-family: var(--cond); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; text-decoration: none; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* film-edge notation: condensed, small, tracked, uppercase */
.edge, .print-edge, .nav-links a, .nav-search, .d-kind, .fact dt, .col-label, .lane-k,
.row-head, .proof-k, .card-kind, .card-more, .btn, .back, .m-kind, .label, .callout-k, .evidence,
.decisions th, .toc-k, .r-sec h2, .palette-kind, .palette-group, .stats .l, .demo-controls label,
.demo-controls button, .demo-btn, .rl-links, .readout, .xp-when, .foot-edge, .honest-k {
  font-family: var(--cond);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8125rem;
}
/* grease pencil: two or three words, never a paragraph */
.tldr-k, .wrong-k, .pencil {
  font-family: var(--marker);
  font-weight: 400;
  color: var(--red);
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.125rem;
  line-height: 1.2;
}
/* typewriter: code, data, dates, measurements */
code, pre, kbd, .num, [data-clock], .demo-readout, .demo-controls select, .demo-controls input, .demo-controls textarea,
.palette-foot, .stats .n, .leg-num, .shots figcaption, .r-meta, .tl-when, .rl-k, .r-role time, .r-when, .print-no, .foot-credit, .edu .xp-when, .xp-when b {
  font-family: var(--type);
}
.num, [data-clock], .stats .n, .demo-readout, .leg-num { font-variant-numeric: tabular-nums; }
kbd { font-size: 0.6875rem; padding: 0 5px; border: 1px solid var(--rule); color: var(--muted); }

/* ---------------- nav: the top edge of the sheet ---------------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-4);
  min-height: var(--nav-h);
  padding: 8px var(--gutter);
  background: var(--ink); color: var(--silver);
  border-bottom: 1px solid var(--rule-d);
}
.nav-name { font-family: var(--cond); font-weight: 700; font-size: 0.8125rem; letter-spacing: 0.14em; color: var(--paper); text-decoration: none; border: 1px solid var(--silver-2); padding: 3px 7px 1px; transition: border-color var(--dur-1); }
.nav-name:hover { border-color: var(--paper); }
.nav-links { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.nav-links a { color: var(--silver); text-decoration: none; padding: 4px 0 4px; background: linear-gradient(var(--red), var(--red)) no-repeat 0 100% / 0 2px; transition: color var(--dur-1), background-size 280ms var(--ease-out); }
.nav-links a:hover { color: var(--paper); background-size: 100% 2px; }
.nav-links a[aria-current="page"] { color: var(--paper); background-size: 100% 2px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.nav-search { display: inline-flex; align-items: center; gap: 8px; background: transparent; color: var(--silver); border: 1px solid var(--rule-d); padding: 5px 9px 4px; cursor: pointer; transition: color var(--dur-1), border-color var(--dur-1); }
.nav-search:hover { color: var(--paper); border-color: var(--silver-2); }
.nav-search kbd { color: var(--silver-2); border-color: var(--rule-d); }
.nav-search svg { display: block; }

/* ---------------- home: the sheet ---------------- */
.home main { max-width: none; padding: 0; }
.home main > section:not(.hero):not(.filmstrip) { max-width: var(--wide); margin: 0 auto; padding: var(--s-6) var(--s-4); }
.home section + section:not(.filmstrip) { border-top: 1px solid var(--rule-d); }
h2 { margin: 0 0 var(--s-4); font-size: var(--t-xl); font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
h3 { margin: 0; font-size: var(--t-md); font-weight: 600; line-height: 1.25; letter-spacing: -0.005em; }

/* the print */
.hero { position: relative; height: max(560px, calc(100svh - var(--nav-h) - 150px)); overflow: hidden; background: var(--ink); color: var(--paper); }
.hero-photo, .hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-photo img { object-fit: cover; object-position: 50% 100%; animation: develop 1800ms var(--ease-out) both; }
@keyframes develop { from { filter: contrast(0.3) brightness(1.8); } to { filter: none; } }
/* the photograph sits behind the frame: it drifts slower than the page on scroll */
@media (min-width: 701px) { @supports (animation-timeline: scroll()) {
  .hero-photo img { animation: develop 1800ms var(--ease-out) both, drift linear both; animation-timeline: auto, scroll(root); animation-range: normal, 0 90vh; }
  @keyframes drift { from { object-position: 50% 100%; } to { object-position: 50% 62%; } }
} }
/* dodging: the print lifts under the pointer */
.hero-loupe { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; mix-blend-mode: soft-light; background: radial-gradient(260px circle at var(--lx, 50%) var(--ly, 50%), rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 70%); transition: opacity var(--dur-2); }
@media (hover: hover) and (pointer: fine) { .hero:hover .hero-loupe { opacity: 1; } }
@keyframes settle { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.edge-top > * { animation: settle 700ms var(--ease-out) both; }
.edge-top > *:nth-child(2) { animation-delay: 140ms; } .edge-top > *:nth-child(3) { animation-delay: 280ms; } .edge-top > *:nth-child(4) { animation-delay: 420ms; }
.hero-text > * { animation: settle 800ms var(--ease-out) both; }
.hero-text > *:nth-child(1) { animation-delay: 600ms; } .hero-text > *:nth-child(2) { animation-delay: 760ms; } .hero-text > *:nth-child(3) { animation-delay: 920ms; }
.pencil { animation: write 900ms var(--ease-out) 1300ms both; }
/* burned in at both edges, the way a print is dodged and burned: the notation reads over the sky, the thesis over the cloud deck */
.hero::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 160px; pointer-events: none; z-index: 1; background: linear-gradient(to bottom, rgba(11, 11, 11, 0.82) 0%, rgba(11, 11, 11, 0) 100%); }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 52%; pointer-events: none; background: linear-gradient(to top, rgba(11, 11, 11, 0.8) 0%, rgba(11, 11, 11, 0.55) 50%, rgba(11, 11, 11, 0) 100%); }
.edge { display: flex; gap: var(--s-4); flex-wrap: wrap; align-items: baseline; margin: 0; color: var(--silver); }
.edge > span + span::before, .edge > span + a::before { content: ""; display: inline-block; width: 6px; height: 8px; background: var(--silver-3); clip-path: polygon(0 0, 100% 50%, 0 100%); margin-right: var(--s-3); vertical-align: 1px; }
.edge-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; padding: 12px var(--gutter); border-bottom: 1px solid rgba(255, 255, 255, 0.16); }
.edge-name { color: var(--paper); }
.edge-live { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--paper); }
.edge > .edge-live::before { content: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: none; }
.hero-text { position: absolute; left: var(--gutter); right: var(--gutter); bottom: var(--s-5); z-index: 2; max-width: 41rem; }
.hero h1 { margin: 0 0 var(--s-3); font-weight: 500; font-size: clamp(1.6rem, 3vw, 2.6rem); line-height: 1.12; letter-spacing: -0.022em; text-wrap: balance; color: var(--paper); text-shadow: 0 1px 2px rgba(11, 11, 11, 0.6); }
.lede { margin: 0 0 var(--s-4); font-size: var(--t-read); line-height: 1.55; color: var(--paper); max-width: 58ch; text-shadow: 0 1px 2px rgba(11, 11, 11, 0.6); }
.lede b { color: var(--paper); font-weight: 500; }
.hero-cta { display: flex; gap: var(--s-2); flex-wrap: wrap; margin: 0; }
.pencil { position: absolute; right: var(--gutter); bottom: var(--s-4); z-index: 2; margin: 0; font-size: 1.5rem; text-decoration: none; transform: rotate(-5deg); transform-origin: right bottom; border-bottom: 2px solid transparent; transition: border-color var(--dur-1); }
.pencil:hover { border-bottom-color: currentColor; }

/* buttons: paper on the sheet, ink on the print back */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px 9px; background-color: var(--fg); background-image: linear-gradient(var(--red), var(--red)); background-repeat: no-repeat; background-size: 0% 100%; color: var(--bg); border: 1px solid var(--fg); text-decoration: none; cursor: pointer; font: inherit; font-family: var(--cond); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8125rem; transition: background-size 320ms var(--ease-out), color var(--dur-1), border-color var(--dur-1), transform var(--dur-1); }
.btn:hover { background-size: 100% 100%; border-color: var(--red); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-quiet { background-color: transparent; color: var(--fg); border-color: var(--rule); }
.hero .btn-quiet { border-color: rgba(255, 255, 255, 0.38); }
.btn-quiet:hover { background-size: 100% 100%; color: #fff; border-color: var(--red); }
.btn svg { width: 14px; height: 14px; }

/* the strip: frames on black paper */
.filmstrip { background: var(--ink); color: var(--paper); padding: var(--s-3) var(--gutter) var(--s-6); }
.edge-strip { padding: 10px 0; border-top: 1px solid var(--rule-d); border-bottom: 1px solid var(--rule-d); margin-bottom: var(--s-3); }
.edge-strip a { margin-left: auto; color: var(--paper); text-decoration: none; border-bottom: 2px solid var(--red); padding-bottom: 1px; }
.edge-strip a:hover { color: var(--red); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.strip-cards { grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.strip-cards .print:nth-child(2) { --d: 140ms; } .strip-cards .print:nth-child(3) { --d: 280ms; } .strip-cards .print:nth-child(4) { --d: 420ms; }
.strip-cards .card-summary, .strip-cards .card-more { display: none; }
.strip-cards .print-cap { padding: 8px 12px 10px; }
.print { display: flex; min-width: 0; }
.print > a { position: relative; display: flex; flex-direction: column; width: 100%; background: var(--frame); color: var(--paper); text-decoration: none; border: 1px solid var(--rule-d); transition: border-color var(--dur-2); }
.print > a:hover, .print > a:focus-visible { border-color: var(--silver-2); }
.print-edge { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px 4px; font-size: 0.6875rem; letter-spacing: 0.14em; color: var(--silver-2); border-bottom: 1px solid var(--rule-d2); white-space: nowrap; overflow: hidden; }
.print-no { font-size: 0.75rem; color: var(--silver); letter-spacing: 0; }
/* a print with a paper border at its top: the exposure is written in the margin, never on the image */
.print-img { position: relative; display: flex; flex-direction: column; aspect-ratio: 3 / 2; background: var(--paper); }
.print-img:not(:has(.print-proof)) { padding-top: 32px; }
.print-img img { width: 100%; height: 100%; flex: 1; min-height: 0; object-fit: cover; object-position: 50% 0; filter: contrast(0.62) brightness(1.15); transition: filter var(--dur-3) var(--ease-out); }
.print-img .print-text { position: absolute; inset: 32px 0 0 0; height: auto; background: var(--frame-2); }
.print > a:hover img, .print > a:focus-visible img { filter: none; }
.print-text { display: flex; align-items: flex-end; height: 100%; padding: 12px; font-family: var(--type); font-size: 0.75rem; line-height: 1.5; color: var(--silver-2); }
/* the exposure written on the print, and the grease-pencil ring around it */
.print-proof { position: relative; order: -1; align-self: flex-start; margin: 7px 12px 6px; padding: 2px 8px 1px; color: var(--red); font-family: var(--type); font-weight: 700; font-size: 0.75rem; line-height: 1.3; }
.mark { position: absolute; left: -15%; top: -62%; width: 130%; height: 224%; color: var(--red); pointer-events: none; opacity: 0; overflow: visible; filter: url(#grease); transition: opacity var(--dur-1); }
.mark path { fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 600ms var(--ease-out) 100ms; }
.mark .p2 { opacity: 0.55; transition-delay: 320ms; }
.print > a:hover .mark, .print > a:focus-visible .mark, .k-work .mark { opacity: 1; }
.print > a:hover .mark path, .print > a:focus-visible .mark path, .k-work .mark path { stroke-dashoffset: 0; }
.print-cap { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; flex: 1; }
.card-title { margin: 0; font-size: 0.9375rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; color: var(--paper); }
.card-summary { margin: 0; font-size: 0.8125rem; line-height: 1.45; color: var(--silver-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-more { margin-top: auto; padding-top: 8px; font-size: 0.6875rem; color: var(--silver-2); transition: color var(--dur-1); }
.print > a:hover .card-more { color: var(--red); }
/* the darkroom: a print is undeveloped until it enters the sheet, then its exposure is written and its ring drawn */
.js .print > a { opacity: 0; transform: translateY(14px); transition: opacity 600ms var(--ease-out) var(--d, 0ms), transform 700ms var(--ease-out) var(--d, 0ms), border-color var(--dur-2); }
.js .print.is-in > a { opacity: 1; transform: none; }
.js .print-img img { filter: contrast(0.3) brightness(1.8); transition: filter 1100ms var(--ease-out) var(--d, 0ms); }
.js .print.is-in .print-img img { filter: contrast(0.62) brightness(1.15); }
.js .print.is-in > a:hover img, .js .print.is-in > a:focus-visible img { filter: none; transition-delay: 0ms; }
.js .print-proof > span { opacity: 0; transform: translateX(-6px); transition: opacity 500ms var(--ease-out) calc(700ms + var(--d, 0ms)), transform 500ms var(--ease-out) calc(700ms + var(--d, 0ms)); }
.js .print.is-in .print-proof > span { opacity: 1; transform: none; }
.js .k-work .mark { opacity: 0; }
.js .k-work .mark path { stroke-dashoffset: 1; }
.js .print.is-in.k-work .mark { opacity: 1; transition-delay: calc(1200ms + var(--d, 0ms)); }
.js .print.is-in.k-work .mark path { stroke-dashoffset: 0; transition-delay: calc(1200ms + var(--d, 0ms)); }
.js .print.is-in.k-work .mark .p2 { transition-delay: calc(1500ms + var(--d, 0ms)); }

/* caption block: what I build */
.lanes { display: grid; border-top: 1px solid var(--rule); }
.lane { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-4); padding: var(--s-3) 0; border-bottom: 1px solid var(--rule); }
.lane-k { color: var(--muted); padding-top: 3px; }
.lane p { margin: 0; max-width: var(--measure); color: var(--fg); }

/* experience: the backs of two prints, laid on the sheet */
.xp { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); align-items: start; }
.xp > li { display: block; padding: var(--s-4); background: var(--paper); color: var(--text); }
.xp > li > .xp-when { display: flex; flex-wrap: wrap; gap: 0 10px; font-family: var(--type); text-transform: none; letter-spacing: 0; font-size: 0.75rem; color: var(--text-2); padding-bottom: var(--s-3); margin-bottom: var(--s-3); border-bottom: 1px solid var(--rule-l); }
.xp > li > .xp-when b { font-weight: 700; color: var(--text); }
.xp > li > .xp-when b::after { content: "\00b7"; margin-left: 10px; color: var(--text-3); font-weight: 400; }
/* laid on the sheet as the visitor arrives */
.js .xp > li { opacity: 0; transform: translateY(18px) rotate(-0.8deg); transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out); }
.js .xp > li:nth-child(2) { transition-delay: 160ms; }
.js .xp > li.is-in { opacity: 1; transform: none; }
.xp h3 { margin: 0 0 2px; font-size: var(--t-lg); letter-spacing: -0.01em; line-height: 1.2; }
.xp h3 span { display: block; font-size: var(--t-base); font-weight: 400; color: var(--text-2); margin-top: 2px; }
.xp ul { margin: var(--s-3) 0 0; padding-left: 18px; max-width: var(--measure); }
.xp li li { margin: 6px 0; font-size: var(--t-sm); color: var(--text-2); }
.xp li li::marker { color: var(--red); }
.xp-link { display: inline-block; margin-top: var(--s-3); font-size: var(--t-sm); color: var(--text); text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.edu { list-style: none; margin: var(--s-4) 0 0; padding: 0; }
.edu li { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 4px var(--s-4); padding: var(--s-3) 0; border-top: 1px solid var(--rule); align-items: baseline; }
.edu .xp-when { text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 0.8125rem; font-weight: 400; }
.edu b { font-weight: 600; margin-right: 8px; }
.edu .edu-line { grid-column: 2; color: var(--muted); font-size: var(--t-sm); }

/* contact: the last band */
.contact { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-4); }
.col-label { margin: 0; color: var(--muted); }
.big-mail { display: inline-block; margin: -0.1em 0 var(--s-4); font-weight: 600; font-size: clamp(1.5rem, 4.6vw, 3.4rem); line-height: 1.05; letter-spacing: -0.028em; text-decoration: none; border-bottom: 3px solid transparent; transition: border-color var(--dur-2); }
.big-mail:hover { border-bottom-color: var(--red); }
.contact-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin: 0 0 var(--s-4); }
.contact-note { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.contact-note [data-clock] { color: var(--fg); }

/* ---------------- footer: the bottom edge ---------------- */
footer { background: var(--ink); color: var(--silver-2); border-top: 1px solid var(--rule-d); padding: var(--s-4) var(--gutter) var(--s-6); display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-family: var(--cond); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.75rem; }
footer a { color: var(--silver); text-decoration: none; border-bottom: 1px solid var(--rule-d); transition: color var(--dur-1), border-color var(--dur-1); }
footer a:hover { color: var(--paper); border-bottom-color: var(--red); }
.foot-edge { color: var(--paper); }
.foot-live b { color: var(--paper); }
.foot-credit { flex-basis: 100%; color: var(--silver-2); text-transform: none; letter-spacing: 0.02em; font-weight: 400; font-size: 0.75rem; }

/* ============================================================
   PRINT BACKS: every page that is not the sheet
   ============================================================ */
.detail main, .resume main, .page main { padding-top: 0; }
.back { text-decoration: none; color: var(--muted); }
.back:hover { color: var(--fg); }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 20; background: var(--red); transform: scaleX(0); transform-origin: 0 50%; will-change: transform; }

.d-head { padding: 0 0 var(--s-4); border-bottom: 1px solid var(--fg); }
.d-kind { display: flex; flex-wrap: wrap; gap: 0 var(--s-3); margin: 0 0 var(--s-5); padding: 12px 0; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 0.75rem; }
.d-kind span + span::before { content: ""; display: inline-block; width: 6px; height: 8px; background: var(--dim); clip-path: polygon(0 0, 100% 50%, 0 100%); margin-right: var(--s-3); vertical-align: 1px; }
.d-head h1 { margin: 0 0 var(--s-4); font-weight: 600; font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.08; letter-spacing: -0.025em; text-wrap: balance; }
.d-lede { margin: 0; max-width: var(--measure); font-size: var(--t-md); line-height: 1.6; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-3) var(--s-4); margin: 0; padding: var(--s-3) 0; border-bottom: 1px solid var(--rule); }
.fact dt { color: var(--muted); font-size: 0.6875rem; margin-bottom: 3px; }
.fact dd { margin: 0; font-size: var(--t-sm); font-family: var(--type); }
.fact dd a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.fact dd a:hover { border-bottom-color: var(--red); }
.d-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; padding: var(--s-4) 0 0; }

.tldr { margin: var(--s-4) 0 0; padding: var(--s-3) var(--s-4); background: var(--panel); border: 1px solid var(--rule); }
.tldr-k { display: block; margin-bottom: var(--s-2); }
.tldr ul { margin: 0; padding-left: 18px; }
.tldr li { margin: 4px 0; }
.tldr li::marker { color: var(--red); }

.block { padding: var(--s-5) 0; border-bottom: 1px solid var(--rule-2); }
.block:last-of-type { border-bottom: 0; }
.block h2 { font-size: var(--t-lg); margin-bottom: var(--s-4); }
.block h3 { margin: var(--s-4) 0 var(--s-2); font-size: var(--t-base); }
.block p, .bullets li, .block li { font-size: var(--t-read); line-height: 1.7; }
.block p { max-width: var(--measure); margin: 0; }
.block p + p, .block p + ul, .block ul + p, .block .demo + p, .block p + .demo, .block figure + p { margin-top: var(--s-3); }
.bullets { max-width: var(--measure); margin: 0; padding-left: 20px; }
.bullets li { margin-bottom: var(--s-2); }
.bullets li::marker { color: var(--red); }
code { font-size: 0.92em; background: var(--panel-2); padding: 1px 5px; white-space: nowrap; }
pre { font-size: var(--t-sm); line-height: 1.5; background: var(--panel); border: 1px solid var(--rule); padding: var(--s-3) var(--s-4); overflow-x: auto; margin: var(--s-3) 0; }
pre code { background: none; padding: 0; font-size: inherit; white-space: pre; }

.wrong { max-width: var(--measure); margin: var(--s-4) 0; padding: var(--s-3) var(--s-4) var(--s-4); background: var(--panel); border: 1px solid var(--fg); }
.wrong-k { display: block; margin-bottom: var(--s-2); }
.wrong p { margin: 0; }
.wrong p + p { margin-top: var(--s-2); }
.wrong ul { margin: var(--s-2) 0 0; padding-left: 18px; }
.wrong li { margin: 4px 0; }
.honest { max-width: var(--measure); margin: var(--s-4) 0 0; padding: var(--s-3) var(--s-4); border: 1px dashed var(--dim); color: var(--muted); }
.honest-k { display: block; margin-bottom: var(--s-2); color: var(--fg); }
.honest ul { margin: 0; padding-left: 18px; }
.honest li { margin: 4px 0; line-height: 1.6; }
.callout { max-width: var(--measure); margin: var(--s-4) 0; padding: var(--s-3) var(--s-4); background: var(--panel); border: 1px solid var(--rule); }
.callout p { margin: 0; }
.callout p + p { margin-top: var(--s-3); }
.callout-k { display: block; margin-bottom: var(--s-2); color: var(--muted); }

.decisions { width: 100%; border-collapse: collapse; margin: var(--s-3) 0 0; font-size: var(--t-sm); }
.decisions th { text-align: left; font-size: 0.6875rem; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--fg); }
.decisions td { padding: 10px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.decisions td:first-child { font-weight: 600; }
.table-wrap { overflow-x: auto; margin: var(--s-3) 0 0; }
.stats { display: flex; flex-wrap: wrap; margin: var(--s-3) 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stats li { padding: var(--s-3) var(--s-4) var(--s-3) 0; margin-right: var(--s-4); border-right: 1px solid var(--rule); }
.stats li:last-child { border-right: 0; }
.stats .n { display: block; font-size: var(--t-lg); }
.stats .l { display: block; font-size: 0.6875rem; color: var(--muted); margin-top: 4px; }
.evidence { margin-top: var(--s-5); padding-top: var(--s-3); border-top: 1px solid var(--rule); font-size: 0.75rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px var(--s-4); }
.evidence a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.evidence a:hover { color: var(--fg); border-bottom-color: var(--red); }

.toc { grid-column: 2; grid-row: 1 / -1; align-self: start; position: sticky; top: calc(var(--nav-h) + 24px); padding-left: var(--s-4); border-left: 1px solid var(--rule); }
.toc-k { display: block; margin-bottom: var(--s-3); font-size: 0.6875rem; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: var(--s-2); }
.toc a { display: block; font-size: var(--t-sm); line-height: 1.35; color: var(--muted); text-decoration: none; transition: color var(--dur-1); }
.toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--type); font-size: 0.75rem; color: var(--dim); margin-right: 8px; }
.toc a:hover, .toc a.here { color: var(--fg); }
.toc a.here::before { color: var(--red); }
@media (min-width: 1160px) {
  .detail.has-toc main { display: grid; grid-template-columns: minmax(0, 1fr) 200px; column-gap: var(--s-6); align-items: start; }
  .detail.has-toc main > :not(.toc) { grid-column: 1; }
}

.block .rows { background: var(--panel); border: 1px solid var(--rule); padding: var(--s-2) var(--s-4) var(--s-4); margin-top: var(--s-4); }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); padding: var(--s-3) 0; border-top: 1px solid var(--rule-2); }
.row-head { font-size: 0.6875rem; color: var(--muted); border-top: 0; padding: 0 0 var(--s-1); }
.claim { margin: 0; font-size: var(--t-sm); }
.claim strong { font-weight: 600; }
.proof { margin: 0; color: var(--muted); font-size: var(--t-sm); padding-left: var(--s-3); border-left: 1px solid var(--rule); }
.proof-k { display: none; color: var(--fg); margin-bottom: var(--s-1); font-size: 0.6875rem; }

/* a photograph on a print back: paper margin, develops on hover, like the proof prints */
.d-print { margin: var(--s-4) 0 0; padding-top: 32px; background: var(--paper); border: 1px solid var(--fg); overflow: hidden; }
.d-print img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; filter: contrast(0.62) brightness(1.15); transition: filter var(--dur-3) var(--ease-out); animation: develop 1800ms var(--ease-out) both; }
.d-print:hover img { filter: none; }
.shot { margin: var(--s-4) 0; }
.shot img { border: 1px solid var(--rule); background: var(--panel); }
.shot figcaption, .demo figcaption { margin-top: var(--s-2); font-size: var(--t-sm); color: var(--muted); }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s-3); margin: var(--s-4) 0; }
.shots figure { margin: 0; }
.shots img { border: 1px solid var(--rule); }
.shots figcaption { font-size: 0.75rem; color: var(--muted); margin-top: 6px; }

.diagram { background: var(--panel); border: 1px solid var(--rule); padding: var(--s-4); margin: var(--s-4) 0 var(--s-2); overflow-x: auto; }
.diagram svg { display: block; width: 100%; height: auto; min-width: 520px; }
.dg-box { fill: var(--panel-2); stroke: var(--rule); }
.dg-box-accent { fill: var(--panel-2); stroke: var(--fg); stroke-width: 1.4; }
.dg-t { font-family: var(--type); font-size: 9.5px; fill: var(--fg); }
.dg-s { font-family: var(--type); font-size: 8px; fill: var(--muted); }
.dg-line { stroke: var(--dim); fill: none; }
.dg-arrow { fill: var(--muted); }
.dg-cap { font-family: var(--type); font-size: 8px; fill: var(--muted); letter-spacing: 0.08em; }
.diagram-note { font-size: var(--t-sm); color: var(--muted); margin: 0; }

.more { padding: var(--s-5) 0 0; border-top: 1px solid var(--fg); }
.more h2 { font-size: var(--t-lg); }
.more-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s-2); margin-top: var(--s-3); }
.more-list a { display: block; background: var(--panel); border: 1px solid var(--rule); padding: var(--s-3) var(--s-4); text-decoration: none; transition: border-color var(--dur-2); }
.more-list a:hover { border-color: var(--fg); }
.more-list .m-kind { display: block; font-size: 0.6875rem; color: var(--muted); margin-bottom: var(--s-1); }
.more-list .m-name { font-weight: 600; font-size: var(--t-sm); }

.rl { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4) 0; border-top: 1px solid var(--rule-2); }
.rl:first-of-type { border-top: 0; }
.rl-k { font-size: 0.75rem; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.rl-k b { display: block; color: var(--fg); font-weight: 400; }
.rl h3 { margin-bottom: var(--s-2); }
.rl p { margin: 0 0 var(--s-2); max-width: var(--measure); }
.rl p:last-child { margin-bottom: 0; }
.rl .note { color: var(--muted); font-size: var(--t-sm); }
.rl-links { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-2); font-size: 0.75rem; }
.rl-links a { text-decoration: none; border-bottom: 1px solid var(--rule); color: var(--muted); }
.rl-links a:hover { color: var(--fg); border-bottom-color: var(--red); }

/* timeline rows (about page) */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 4px var(--s-4); padding: var(--s-3) 0; border-top: 1px solid var(--rule-2); align-items: baseline; }
.tl li:first-child { border-top: 0; }
.tl-when { font-size: 0.8125rem; color: var(--muted); }
.tl-what { font-size: var(--t-base); }
.tl-what b { font-weight: 600; margin-right: 8px; }
.tl-line { grid-column: 2; color: var(--muted); font-size: var(--t-sm); }
.tl-link { grid-column: 3; grid-row: 1; font-size: var(--t-sm); white-space: nowrap; text-decoration-color: var(--red); }

/* ---------------- demos: each one framed as a print ---------------- */
.demo { margin: var(--s-4) 0; }
.demo-stage { position: relative; min-height: 280px; background: var(--panel); border: 1px solid var(--fg); overflow: hidden; }
.js .demo-stage { filter: contrast(0.5) brightness(1.5); transition: filter 900ms var(--ease-out); }
.js .demo.is-live .demo-stage { filter: none; }
.demo-stage canvas { display: block; width: 100%; }
.demo-controls { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; padding: 10px 12px; border-top: 1px solid var(--rule-2); font-size: 0.75rem; color: var(--muted); }
.demo-controls label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.6875rem; }
.demo-controls input[type="range"] { accent-color: var(--red); width: 120px; }
.demo-controls select, .demo-controls input[type="text"], .demo-controls input[type="number"], .demo-controls textarea { font: inherit; font-family: var(--type); background: var(--panel-2); color: var(--fg); border: 1px solid var(--rule); padding: 4px 8px; }
.demo-controls button, .demo-btn { font: inherit; font-family: var(--cond); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; background: var(--panel-2); color: var(--fg); border: 1px solid var(--rule); padding: 6px 10px 5px; cursor: pointer; transition: border-color var(--dur-1), background-color var(--dur-1), color var(--dur-1); }
.demo-controls button:hover, .demo-btn:hover { border-color: var(--fg); }
.demo-controls button[aria-pressed="true"], .demo-btn[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.demo-readout { display: flex; flex-wrap: wrap; gap: 4px var(--s-3); font-size: 0.75rem; color: var(--muted); }
.demo-readout b { color: var(--fg); font-weight: 700; }
.demo-readout .ok { color: var(--ok); } .demo-readout .bad { color: var(--bad); } .demo-readout .warn { color: var(--warn); }
.demo textarea { width: 100%; min-height: 96px; resize: vertical; }
.demo-note { font-size: 0.75rem; color: var(--dim); text-transform: none; letter-spacing: 0; }
.demo-static { padding: var(--s-4); color: var(--muted); font-size: var(--t-sm); }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(9px, 1fr)); grid-auto-rows: 24px; gap: 3px; padding: var(--s-3); }
.frame { background: var(--panel-2); opacity: 0.7; transition: background-color 260ms ease, opacity 260ms ease; }
.frame.read { opacity: 1; }
.frame.read.f-clean { background: var(--ok); } .frame.read.f-ai { background: var(--info); } .frame.read.f-flag { background: var(--warn); } .frame.read.f-unknown { background: var(--dim); }
.legend { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-4); }
.leg { display: flex; align-items: center; gap: 7px; font-size: var(--t-sm); }
.swatch { width: 9px; height: 9px; flex: none; }
.leg-clean .swatch { background: var(--ok); } .leg-ai .swatch { background: var(--info); } .leg-flag .swatch { background: var(--warn); } .leg-unknown .swatch { background: var(--dim); }
.leg-name { color: var(--muted); }
.leg-num { font-size: 0.75rem; }

/* ---------------- résumé: a typed sheet ---------------- */
.resume .r-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-4); flex-wrap: wrap; padding: 0 0 var(--s-4); border-bottom: 1px solid var(--fg); }
.resume .r-head h1 { margin: 0; font-weight: 600; font-size: clamp(1.9rem, 4vw, 2.75rem); letter-spacing: -0.025em; line-height: 1.05; }
.resume .r-head p { margin: 6px 0 0; color: var(--muted); }
.r-sec { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4) 0; border-bottom: 1px solid var(--rule-2); }
.r-sec h2 { font-size: 0.6875rem; color: var(--muted); margin: 6px 0 0; letter-spacing: 0.14em; }
.r-role { margin-bottom: var(--s-4); }
.r-role:last-child { margin-bottom: 0; }
.r-role header { display: flex; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; align-items: baseline; }
.r-role h3 { font-size: var(--t-md); }
.r-role h3 span { font-weight: 400; color: var(--muted); }
.r-role time, .r-when { font-size: 0.8125rem; color: var(--muted); }
.r-role ul { margin: var(--s-2) 0 0; padding-left: 18px; max-width: var(--measure); }
.r-role li { margin: 6px 0; font-size: var(--t-sm); line-height: 1.6; }
.r-role li a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.r-role li a:hover { border-bottom-color: var(--red); }
.r-skills p { margin: 0 0 6px; font-size: var(--t-sm); max-width: var(--measure); }
.r-skills b { font-weight: 600; }
.r-meta { font-size: 0.75rem; color: var(--muted); padding: var(--s-3) 0; }
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .nav, footer, .r-actions, .skip, .progress { display: none !important; }
  .resume .r-head { border-color: #000; }
  .r-role li a { border: 0; }
  a { color: inherit; text-decoration: none; }
  .r-sec { break-inside: avoid; }
}

/* ---------------- search: a dark panel on any page ---------------- */
.palette { border: 0; padding: 0; background: transparent; max-width: none; width: 100%; height: 100%; max-height: none; margin: 0; }
.palette::backdrop { background: rgba(11, 11, 11, 0.72); }
.palette-panel { width: min(640px, calc(100% - 32px)); margin: 10vh auto 0; background: var(--ink); color: var(--paper); border: 1px solid var(--rule-d); box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7); overflow: hidden; }
.palette-field { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--rule-d); color: var(--silver-2); }
.palette-input { flex: 1; font: inherit; font-size: 16px; background: transparent; border: 0; color: var(--paper); outline: none; }
.palette-input::placeholder { color: var(--silver-3); }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow: auto; overscroll-behavior: contain; }
.palette-group { padding: 8px 10px 4px; font-size: 0.6875rem; color: var(--silver-2); }
.palette-list [role="option"] { display: grid; gap: 2px; padding: 8px 10px; cursor: pointer; }
.palette-list [role="option"][aria-selected="true"] { background: var(--frame-2); }
.palette-list [role="option"][aria-selected="true"] .palette-kind { color: var(--red); }
.palette-kind { font-size: 0.6875rem; color: var(--silver-2); }
.palette-title { font-weight: 600; font-size: var(--t-sm); }
.palette-snip { font-size: 0.75rem; color: var(--silver-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-empty { padding: 14px 10px; color: var(--silver-2); font-size: var(--t-sm); }
.palette-foot { display: flex; gap: var(--s-3); padding: 8px 14px; border-top: 1px solid var(--rule-d); font-size: 0.6875rem; color: var(--silver-3); }
.palette-foot span { display: inline-flex; align-items: center; gap: 4px; }
.palette-foot kbd { color: var(--silver-2); border-color: var(--rule-d); }
body.palette-open { overflow: hidden; }

/* ---------------- motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .print-img img, .d-print img, .demo-stage { filter: none !important; }
  .mark path { stroke-dashoffset: 0; }
  .js .print > a, .js .xp > li, .js .print-proof > span { opacity: 1; transform: none; }
  .js .k-work .mark { opacity: 1; }
  .hero-loupe { display: none; }
  .pencil, .edge-top > *, .hero-text > * { clip-path: none; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .strip-cards { grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .nav-links { order: 3; flex-basis: 100%; gap: var(--s-3); }
  .nav-links a { font-size: 0.75rem; }
  .hero { height: max(520px, calc(100svh - 84px - 110px)); }
  .hero-text { bottom: var(--s-4); }
  .pencil { position: static; display: inline-block; margin: 0 var(--s-3) var(--s-3); font-size: 1.35rem; }
  .lane, .contact, .xp, .edu li, .rl, .r-sec { grid-template-columns: 1fr; gap: var(--s-2); }
  .edu .edu-line { grid-column: 1; }
  .row { grid-template-columns: 1fr; gap: var(--s-2); }
  .row-head { display: none; }
  .proof-k { display: block; }
  .toc { display: none; }
}
@media (max-width: 700px) {
  /* on a phone the print sits above its caption instead of under it */
  .hero { height: auto; }
  .hero::before, .hero::after { display: none; }
  .hero-photo { position: relative; display: block; aspect-ratio: 3 / 2; height: auto; }
  .hero-photo img { position: relative; height: 100%; object-position: 50% 50%; }
  .edge-top { position: static; border-bottom: 1px solid var(--rule-d); background: var(--ink); }
  .hero-text { position: static; max-width: none; padding: var(--s-4) var(--s-3) var(--s-3); }
  .edge-strip > span:nth-child(2) { display: none; }
  .strip-cards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 6px; padding-bottom: var(--s-2); scrollbar-width: thin; }
  .strip-cards .print { flex: 0 0 74vw; scroll-snap-align: start; }
  .cards, .cards-2 { grid-template-columns: 1fr; }
  .tl li { grid-template-columns: 1fr; }
  .tl-line, .tl-link { grid-column: 1; grid-row: auto; }
  .edge-top { gap: var(--s-2) var(--s-3); font-size: 0.6875rem; }
  .edge-top > span:nth-child(3) { display: none; }
  .edge-live { margin-left: 0; }
  .stats li { border-right: 0; margin-right: 0; padding-right: 0; flex-basis: 100%; }
}
@media (max-width: 600px) {
  main { padding-left: var(--s-3); padding-right: var(--s-3); }
  .home main > section:not(.hero):not(.filmstrip) { padding: var(--s-5) var(--s-3); }
  .filmstrip { padding-left: var(--s-3); padding-right: var(--s-3); }
  .nav-search span, .nav-search kbd { display: none; }
  .nav-search { padding: 6px; }
  .hero h1 { font-size: clamp(1.5rem, 6.4vw, 2rem); }
  .lede { font-size: var(--t-base); }
  .palette-panel { width: 100%; margin: 0; min-height: 100%; }
}
