/* ------------------------------------------------------------------
   samskruth.me — "The work underneath"
   A personal site drawn as a set of engineering sheets.
   Light: cream drafting paper with blueprint-blue ink.
   Dark:  a true blueprint — pale lines on Prussian blue.
   ------------------------------------------------------------------ */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-italic-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --paper: #f3eee4;
  --paper-2: #ece5d6;
  --paper-3: #e2d9c7;
  --ink: #1b1e26;
  --ink-2: #4f5460;
  --ink-3: #5c6170;
  --line: rgba(27, 30, 38, 0.16);
  --line-strong: rgba(27, 30, 38, 0.55);
  --grid: rgba(31, 79, 214, 0.075);
  --blue: #1f4fd6;
  --blue-deep: #163c9f;
  --blue-soft: rgba(31, 79, 214, 0.1);
  --oxide: #c2452a;
  --shadow: 0 1px 0 rgba(27, 30, 38, 0.06), 0 12px 32px -16px rgba(27, 30, 38, 0.25);

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --frame: 12px;
  --rail-w: 0px;
  --measure: 62ch;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b2140;
    --paper-2: #10294d;
    --paper-3: #16335c;
    --ink: #e9eef6;
    --ink-2: #aebfd8;
    --ink-3: #7f94b3;
    --line: rgba(233, 238, 246, 0.16);
    --line-strong: rgba(233, 238, 246, 0.6);
    --grid: rgba(142, 197, 255, 0.07);
    --blue: #8ec5ff;
    --blue-deep: #c4e1ff;
    --blue-soft: rgba(142, 197, 255, 0.12);
    --oxide: #ff9d7c;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b2140;
  --paper-2: #10294d;
  --paper-3: #16335c;
  --ink: #e9eef6;
  --ink-2: #aebfd8;
  --ink-3: #7f94b3;
  --line: rgba(233, 238, 246, 0.16);
  --line-strong: rgba(233, 238, 246, 0.6);
  --grid: rgba(142, 197, 255, 0.07);
  --blue: #8ec5ff;
  --blue-deep: #c4e1ff;
  --blue-soft: rgba(142, 197, 255, 0.12);
  --oxide: #ff9d7c;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(56px + var(--frame) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(17px, 1.05vw + 13px, 19px);
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center top;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--blue); color: var(--paper); }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--blue-deep); }
:focus-visible { outline: 2px solid var(--oxide); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-weight: 500; line-height: 1.1; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: clamp(2rem, 4.2vw, 3.25rem); font-variation-settings: "SOFT" 60, "WONK" 1; }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
b, strong { font-weight: 600; }

.wrap {
  width: min(100% - 2 * var(--gutter), 1120px);
  margin-inline: auto;
}

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.5rem 0.9rem;
  font-family: var(--mono); font-size: 0.8rem; border-radius: 3px;
}
.skip:focus { top: 1rem; }

/* ---------- mono bits ---------- */
.kicker, .sheet-no, .fig-no, figcaption, .status, .note, .note-no, .tl-when,
.bom th, .certs, .contact-k, .tb-grid, .colophon, .sheets-nav, .rail-label,
.pl-annot, .pl-node text, .rt-when, .card-sub, .ch-read, .fig-hint, .st-k, .st-tools, .cap-s, .cap-done b, .ch-when, .ch-count, .chip, .tool::after {
  font-family: var(--mono);
  font-feature-settings: "calt" 0;
}
.kicker {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 1.25rem; display: flex; flex-wrap: wrap; gap: 0.6em; align-items: baseline;
}
.sheet-no { color: var(--blue); font-weight: 600; }
.kicker-sep { color: var(--ink-3); }
.kicker-name { letter-spacing: 0.08em; }

/* ---------- drawing frame + rail ---------- */
.frame { position: fixed; inset: var(--frame); pointer-events: none; z-index: 50; border: 1px solid var(--line); }
.frame-corner { position: absolute; width: 10px; height: 10px; border-color: var(--line-strong); border-style: solid; border-width: 0; }
.frame-corner.tl { left: -1px; top: -1px; border-left-width: 1px; border-top-width: 1px; }
.frame-corner.tr { right: -1px; top: -1px; border-right-width: 1px; border-top-width: 1px; }
.frame-corner.bl { left: -1px; bottom: -1px; border-left-width: 1px; border-bottom-width: 1px; }
.frame-corner.br { right: -1px; bottom: -1px; border-right-width: 1px; border-bottom-width: 1px; }

.rail { display: none; }
@media (min-width: 1000px) {
  :root { --rail-w: 44px; }
  .rail {
    display: block; position: absolute; left: 0; top: 0; bottom: 0; width: var(--rail-w);
    border-right: 1px solid var(--line);
  }
  .rail-line { position: absolute; left: 50%; top: 24px; bottom: 24px; width: 1px; background: var(--line); transform: translateX(-50%); }
  .rail-fill { position: absolute; left: 0; top: 0; width: 100%; height: 0%; background: var(--blue); transition: height 80ms linear; }
  .rail-label {
    position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%) rotate(180deg);
    writing-mode: vertical-rl; font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--ink-2); background: var(--paper); padding: 0.6em 0; white-space: nowrap;
  }
  .rail-sep { margin: 0.6em 0; color: var(--ink-3); }
  #rail-sheet { color: var(--blue); font-weight: 600; }
  .wrap {
    width: min(100% - var(--rail-w) - 2 * var(--gutter), 1120px);
    margin-left: max(calc((100% - 1120px) / 2), calc(var(--rail-w) + var(--gutter)));
  }
}

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  padding-top: var(--frame); /* the bar's content sits inside the drawing frame, not across its top line */
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 1rem; white-space: nowrap; }
.brand-mark { color: var(--blue); flex: none; }
.sheets-nav { margin-left: auto; display: flex; gap: 1.25rem; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sheets-nav::-webkit-scrollbar { display: none; }
.sheets-nav a { color: var(--ink-2); text-decoration: none; white-space: nowrap; padding: 0.4em 0; border-bottom: 1px solid transparent; line-height: 1; translate: 0 1.5px; /* caps baseline on the name's baseline */ }
.sheets-nav a b { color: var(--blue); font-weight: 600; margin-right: 0.35em; }
.sheets-nav a:hover, .sheets-nav a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--blue); }
.theme-toggle {
  flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--line-strong); }
/* one icon per state: half disc = follows the system, sun = light, moon = dark */
.ti-light, .ti-dark { display: none; }
:root[data-theme="light"] .ti-auto, :root[data-theme="dark"] .ti-auto { display: none; }
:root[data-theme="light"] .ti-light { display: block; }
:root[data-theme="dark"] .ti-dark { display: block; }
@media (max-width: 640px) {
  html { scroll-padding-top: 0; }
  .top { position: static; padding-top: calc(var(--frame) + 6px); }
  .top-inner { flex-wrap: wrap; row-gap: 0; }
  .brand { order: 1; }
  .theme-toggle { order: 2; margin-left: auto; }
  .sheets-nav { order: 3; width: 100%; margin: 0 0 0.5rem; flex-wrap: wrap; justify-content: space-between; gap: 0.2rem 0.6rem; overflow: visible; }
  .sheets-nav a { padding: 0.55em 0; }
  .sheets-nav a b { display: none; } /* the numbers return on wider screens; the kickers carry them on phones */
  .brand span { font-size: 0.95rem; }
}

/* ---------- sheets ---------- */
.sheet { padding: clamp(4rem, 10vw, 8rem) 0; border-top: 1px solid var(--line); position: relative; }
.sheet:first-of-type { border-top: 0; }
.sheet-head { max-width: 44rem; margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.sheet-intro { font-size: 1.1rem; color: var(--ink-2); margin: 1.25rem 0 0; text-wrap: pretty; }

.prose { max-width: var(--measure); position: relative; text-wrap: pretty; }
.prose p { margin-bottom: 1.1em; }

/* Margin notes: inline on narrow screens, floated into the right gutter on wide ones */
.note {
  display: block; font-size: 0.78rem; line-height: 1.5; color: var(--ink-2);
  border-left: 2px solid var(--blue); padding: 0.1rem 0 0.1rem 0.8rem; margin: 0 0 1.2rem;
}
.note::before { content: "※ "; color: var(--blue); }
@media (min-width: 1240px) {
  .note { position: absolute; left: calc(100% + 2.5rem); width: 15rem; margin: 0.2rem 0 0; border-left-color: var(--line); }
  .note::before { color: var(--oxide); }
}

/* ---------- hero ---------- */
.hero { padding-top: clamp(3rem, 8vw, 6rem); }
.display {
  font-size: clamp(3.4rem, 11vw, 9.5rem);
  line-height: 0.92; letter-spacing: -0.035em; font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
  margin: 0 0 clamp(1.5rem, 4vw, 3rem);
}
.display-line { display: inline-block; }
.display-em {
  font-style: italic; font-weight: 300; color: var(--blue);
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1;
  transition: font-variation-settings 600ms cubic-bezier(.2,.8,.2,1), letter-spacing 600ms cubic-bezier(.2,.8,.2,1);
}
.display:hover .display-em { font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1, "wght" 500; letter-spacing: -0.02em; }
.hero-grid { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); } }
.hero-side { display: flex; flex-direction: column; align-items: flex-start; gap: 1.5rem; }
@media (min-width: 900px) { .hero-side { align-items: flex-end; } }
.hero .note { position: static !important; width: auto !important; margin-top: 0.5rem; border-left-color: var(--blue) !important; }
.hero .note::before { color: var(--blue) !important; }
.portrait-fig { margin: 0; width: min(100%, 20rem); }
.portrait { width: 100%; aspect-ratio: 817 / 970; background: var(--ink); -webkit-mask: var(--portrait-mask, url("/img/portrait-light.png?v=2")) center / contain no-repeat; mask: var(--portrait-mask, url("/img/portrait-light.png?v=2")) center / contain no-repeat; transition: background 400ms ease; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .portrait { --portrait-mask: url("/img/portrait-dark.png?v=2"); } }
:root[data-theme="dark"] .portrait { --portrait-mask: url("/img/portrait-dark.png?v=2"); }
.portrait-fig:hover .portrait { background: var(--blue); }
.portrait-fig figcaption { text-align: right; }
@media (max-width: 899px) { .portrait-fig { width: min(70%, 16rem); } .portrait-fig figcaption { text-align: left; } }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.35rem); line-height: 1.5; }
.lede p:first-child { font-size: 1.08em; }

.status {
  display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2); border: 1px solid var(--line); padding: 0.6rem 0.9rem; border-radius: 999px; background: var(--paper);
  max-width: 100%; line-height: 1.5;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--oxide); box-shadow: 0 0 0 0 color-mix(in srgb, var(--oxide) 50%, transparent); animation: ping 2.4s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--oxide) 50%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.status-sep { color: var(--ink-3); }

/* figures */
.fig { margin: clamp(2rem, 4vw, 3rem) 0 0; position: relative; }
figcaption { font-size: 0.74rem; color: var(--ink-2); margin-top: 0.8rem; letter-spacing: 0.02em; }
.fig-no { color: var(--blue); font-weight: 600; margin-right: 0.6em; }

/* pipeline (Fig. 1) */
.fig-pipeline { border: 1px solid var(--line); background: color-mix(in srgb, var(--paper-2) 70%, transparent); padding: clamp(0.5rem, 2vw, 1.25rem); border-radius: 6px; overflow: hidden; }
.fig-pipeline .pipeline { margin: 0.75rem 0 0.25rem; }
.fig-pipeline figcaption { padding: 0 0.25rem; }
.pipeline { width: 100%; height: auto; display: block; color: var(--ink); }
.pl-wire path { fill: none; stroke: var(--line-strong); stroke-width: 1.4; }
#pl-loop { stroke-dasharray: 4 6; }
.pl-annot text { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; fill: var(--ink-3); text-anchor: middle; }
.pl-node { cursor: pointer; outline: none; }
.pl-node .pl-hit { fill: transparent; stroke: none; }
.pl-node .pl-ring { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; transition: transform 300ms ease, stroke 300ms ease, fill 300ms ease; transform-box: fill-box; transform-origin: center; }
.pl-node:hover .pl-ring, .pl-node:focus-visible .pl-ring { stroke: var(--blue); transform: scale(1.18); }
.pl-node[aria-selected="true"] .pl-ring { fill: var(--blue); stroke: var(--blue); transform: scale(1.25); }
.pl-node[aria-selected="true"] .pl-core { fill: var(--paper); }
.pl-node[aria-selected="true"] text { fill: var(--ink); font-weight: 700; }
.pl-node:focus-visible .pl-hit { stroke: var(--oxide); stroke-width: 1.5; stroke-dasharray: 3 3; }
.pl-node-learn .pl-core { fill: var(--oxide); }
.pl-node .pl-core { fill: var(--ink); stroke: none; }
.pl-node text { font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase; fill: var(--ink-2); text-anchor: middle; paint-order: stroke; stroke: var(--paper); stroke-width: 6px; stroke-linejoin: round; }
.pl-packet { fill: var(--blue); }
.pl-packet-loop { fill: var(--oxide); }

.fig-hint { font-size: 0.74rem; color: var(--ink-2); margin: 0.25rem 0.25rem 0; letter-spacing: 0.02em; }
.fig-hint strong { color: var(--ink); font-weight: 600; }
.stations { position: relative; border-top: 1px solid var(--line); margin: 0.5rem 0.25rem 0; padding-top: 1.1rem; display: grid; }
.station { grid-area: 1 / 1; max-width: 62ch; }
.station[hidden] { display: block; visibility: hidden; } /* stays in the cell, so the figure is as tall as its tallest panel and never jumps */
.station h3 { font-size: 1.35rem; margin-bottom: 0.5rem; font-variation-settings: "SOFT" 50; }
.st-k { display: inline-block; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue); font-weight: 600; margin-right: 0.6em; vertical-align: 0.2em; }
.station p { color: var(--ink-2); margin: 0 0 0.6rem; text-wrap: pretty; }
.st-tools { font-size: 0.72rem; letter-spacing: 0.04em; color: var(--ink-3); margin: 0 !important; }
.station.is-in { animation: st-in 360ms cubic-bezier(.2,.7,.2,1); }
@keyframes st-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* drafting crosshair in the hero figure (desktop, fine pointer only) */
.crosshair { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 200ms; z-index: 2; }
.fig-pipeline.has-pointer .crosshair { opacity: 1; }
.ch-x, .ch-y { position: absolute; background: var(--blue); opacity: 0.55; }
.ch-x { left: 0; right: 0; height: 1px; top: var(--y, 50%); }
.ch-y { top: 0; bottom: 0; width: 1px; left: var(--x, 50%); }
.ch-read { position: absolute; left: calc(var(--x, 50%) + 10px); top: calc(var(--y, 50%) + 8px); font-size: 0.66rem; letter-spacing: 0.1em; color: var(--blue); background: var(--paper); padding: 2px 5px; border: 1px solid var(--line); white-space: nowrap; }
@media (hover: none), (pointer: coarse) { .crosshair { display: none; } }
/* phones: main.js re-lays the figure out as two rows of three (480 units wide, about 0.7px per unit) */
@media (max-width: 640px) {
  .pl-annot { display: none; }
  .pl-node text { font-size: 16px; letter-spacing: 0.08em; }
  .pl-node .pl-ring { r: 17; stroke-width: 2; }
  .pl-node .pl-hit { r: 40; }
  .pl-node .pl-core { r: 5; }
  .pl-packet { r: 6; }
  .pl-wire path { stroke-width: 2; }
  #pl-loop { stroke-dasharray: 5 7; }
  .pipeline { margin: 0.5rem 0; overflow: visible; }
}

/* ---------- card icons (sheet 01) ---------- */
.card-icon { width: 44px; height: 44px; fill: none; stroke: var(--blue); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 1.1rem; display: block; }

/* ---------- capabilities (sheet 01) ---------- */
.cap-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; align-items: start; }
@media (min-width: 720px) { .cap-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1080px) { .cap-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (min-width: 720px) { .cap-d summary { min-height: 12.75rem; } }
.cap { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; transition: background 300ms ease, transform 300ms ease, box-shadow 300ms ease, border-color 300ms ease; }
.cap:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.cap:has(summary:focus-visible) { border-color: var(--oxide); box-shadow: 0 0 0 2px var(--oxide); }
.cap:has(details[open]) { background: var(--paper-2); }
.cap-d summary { list-style: none; cursor: pointer; border-radius: 6px; box-sizing: border-box; padding: clamp(1.3rem, 2.5vw, 1.8rem); display: grid; grid-template-columns: 1fr auto; grid-template-areas: "icon plus" "t plus" "s plus"; column-gap: 1rem; align-items: start; }
.cap-d summary::-webkit-details-marker { display: none; }
.cap-d summary:hover { background: var(--paper-2); }
.cap-d summary:focus-visible { outline: none; }
.cap-d .card-icon { grid-area: icon; width: 36px; height: 36px; margin-bottom: 0.9rem; }
.cap-t { grid-area: t; font-size: 1.3rem; line-height: 1.15; font-weight: 500; letter-spacing: -0.01em; font-variation-settings: "SOFT" 50; text-wrap: balance; }
.cap-s { grid-area: s; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); margin-top: 0.5rem; }
.cap-plus { grid-area: plus; width: 26px; height: 26px; border: 1px solid var(--line-strong); border-radius: 50%; position: relative; align-self: start; transition: transform 300ms ease, border-color 300ms ease; }
.cap-plus::before, .cap-plus::after { content: ""; position: absolute; background: var(--ink); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.cap-plus::before { width: 10px; height: 1.5px; }
.cap-plus::after { width: 1.5px; height: 10px; transition: transform 300ms ease; }
details[open] .cap-plus { transform: rotate(45deg); border-color: var(--blue); }
.cap-body { padding: 0 clamp(1.3rem, 2.5vw, 1.8rem) clamp(1.3rem, 2.5vw, 1.8rem); font-size: 0.96rem; animation: st-in 360ms cubic-bezier(.2,.7,.2,1); }
.cap-body p { color: var(--ink-2); margin: 0 0 0.8rem; text-wrap: pretty; }
.cap-body p:last-child { margin: 0; }
.cap-done { border-left: 2px solid var(--blue); padding-left: 0.8rem; font-size: 0.92rem; }
.cap-done b { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); margin-right: 0.3em; }

/* ---------- notes (sheet 02) ---------- */
.notes { list-style: none; margin: 0; padding: 0; counter-reset: fn; }
.notes li { position: relative; padding: 1.6rem 0 1.6rem 4rem; border-top: 1px solid var(--line); }
.notes li:last-child { border-bottom: 1px solid var(--line); }
.note-no { position: absolute; left: 0; top: 1.85rem; color: var(--blue); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; }
.notes h3 { font-size: 1.45rem; margin-bottom: 0.5rem; font-variation-settings: "SOFT" 40; }
.notes p { color: var(--ink-2); margin: 0; }
.notes .note { margin-top: 0.9rem; }
@media (min-width: 1240px) { .notes .note { margin-top: 0; top: 1.7rem; } }
@media (max-width: 560px) { .notes li { padding-left: 2.6rem; } }

/* ---------- route (sheet 03) ---------- */
.fig-route { margin-top: 0; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.route { width: 100%; height: auto; display: block; overflow: visible; }
.route-path { fill: none; stroke: var(--blue); stroke-width: 1.6; stroke-dasharray: 0.012 0.008; stroke-linecap: round; }
.rt-stop { cursor: pointer; outline: none; }
.rt-hit { fill: transparent; stroke: none; }
.rt-dot { fill: var(--paper); stroke: var(--ink); stroke-width: 1.6; transition: transform 300ms ease, stroke 300ms ease, fill 300ms ease; transform-box: fill-box; transform-origin: center; }
.rt-stop:hover .rt-dot, .rt-stop:focus-visible .rt-dot { stroke: var(--blue); transform: scale(1.3); }
.rt-stop[aria-selected="true"] .rt-dot { fill: var(--blue); stroke: var(--blue); transform: scale(1.4); }
.rt-stop[aria-selected="true"] .rt-name { fill: var(--blue); }
.rt-stop:focus-visible .rt-hit { stroke: var(--oxide); stroke-width: 1.5; stroke-dasharray: 3 3; }
.rt-name { font-size: 15px; fill: var(--ink); text-anchor: middle; font-family: var(--serif); font-weight: 500; }
.rt-when { font-size: 10.5px; letter-spacing: 0.1em; fill: var(--ink-2); text-anchor: middle; }
.rt-here .rt-dot { fill: var(--oxide); stroke: var(--oxide); }
.rt-here[aria-selected="true"] .rt-dot { fill: var(--oxide); stroke: var(--oxide); }
.rt-here[aria-selected="true"] .rt-name { fill: var(--oxide); }
.rt-pulse { fill: none; stroke: var(--oxide); stroke-width: 1; animation: rt-pulse 2.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes rt-pulse { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(3.2); opacity: 0; } }
/* draw-on: the path is hidden until the figure enters view */
.fig-route .route-path { stroke-dashoffset: 0; }
.fig-route:not(.is-drawn) .route-path { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.fig-route.is-drawn .route-path { animation: draw 2.2s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes draw { from { stroke-dasharray: 1 1; stroke-dashoffset: 1; } 99% { stroke-dasharray: 1 1; stroke-dashoffset: 0; } to { stroke-dasharray: 0.012 0.008; stroke-dashoffset: 0; } }
.fig-route:not(.is-drawn) .route-stops g { opacity: 0; }
.fig-route.is-drawn .route-stops g { opacity: 1; transition: opacity 500ms ease; }
.fig-route.is-drawn .route-stops g:nth-child(1) { transition-delay: 0.1s; }
.fig-route.is-drawn .route-stops g:nth-child(2) { transition-delay: 0.55s; }
.fig-route.is-drawn .route-stops g:nth-child(3) { transition-delay: 1.05s; }
.fig-route.is-drawn .route-stops g:nth-child(4) { transition-delay: 1.5s; }
.fig-route.is-drawn .route-stops g:nth-child(5) { transition-delay: 2s; }
@media (max-width: 600px) { .route-path { stroke-width: 3; } .route-stops .rt-dot { r: 11; stroke-width: 3; } .rt-pulse { r: 11; } .rt-hit { r: 44; } .rt-name { font-size: 34px; } .rt-when { font-size: 24px; } .route-stops g:nth-child(odd) .rt-name { transform: translateY(16px); } .route-stops g:nth-child(odd) .rt-when { transform: translateY(30px); } .route-stops g:nth-child(even) .rt-name { transform: translateY(-16px); } .route-stops g:nth-child(even) .rt-when { transform: translateY(-30px); } }

.chapters { position: relative; max-width: 62ch; margin-bottom: clamp(2rem, 5vw, 3.5rem); display: grid; grid-template-rows: auto 1fr; }
.chapter-nav { grid-row: 1; display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.ch-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font-size: 1rem; cursor: pointer; display: grid; place-items: center; transition: background 200ms, border-color 200ms; font-family: var(--serif); }
.ch-btn:hover { background: var(--paper-2); border-color: var(--blue); }
.ch-count { font-size: 0.72rem; letter-spacing: 0.12em; color: var(--ink-2); min-width: 3.5rem; text-align: center; }
.chapter { grid-row: 2; grid-column: 1; }
.chapter[hidden] { display: block; visibility: hidden; }
.chapter.is-in { animation: st-in 360ms cubic-bezier(.2,.7,.2,1); }
.ch-when { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); font-weight: 600; margin: 0 0 0.5rem; }
.chapter h3 { font-size: 1.6rem; margin-bottom: 0.7rem; font-variation-settings: "SOFT" 50; }
.chapter p:last-child { margin: 0; color: var(--ink-2); }
.timeline { list-style: none; margin: 0; padding: 0; max-width: 44rem; border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.tl-when { font-size: 0.74rem; letter-spacing: 0.06em; color: var(--blue); font-weight: 600; }
.tl-what { color: var(--ink-2); font-size: 0.98rem; }
.tl-what b { color: var(--ink); font-weight: 500; }
@media (max-width: 480px) { .timeline li { grid-template-columns: 1fr; gap: 0.15rem; } }

/* ---------- toolbox (sheet 04) ---------- */
.bom { width: 100%; max-width: 54rem; border-collapse: collapse; border: 1px solid var(--line-strong); font-size: 0.98rem; }
.bom th, .bom td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.bom thead th { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); background: var(--paper-2); border-bottom: 1px solid var(--line-strong); }
.bom tbody th { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue); font-weight: 600; width: 11rem; white-space: nowrap; }
.bom tbody tr:last-child th, .bom tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 560px) {
  .bom thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bom tr { display: block; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
  .bom th, .bom td { display: block; border: 0; padding: 0.1rem 0.9rem; width: auto; white-space: normal; }
}
.certs { list-style: none; margin: 1.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.certs li { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.4em 0.9em; }
.certs li::before { content: "✓ "; color: var(--blue); }

.bom-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.chip { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); border: 1px solid var(--line-strong); background: transparent; border-radius: 999px; padding: 0.45em 0.95em; cursor: pointer; transition: background 200ms, color 200ms, border-color 200ms; }
.chip:hover { border-color: var(--blue); color: var(--ink); }
.chip.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tool { display: inline-flex; align-items: baseline; gap: 0.35em; margin: 0 0.9em 0.35em 0; transition: opacity 250ms ease; }
.tool::after { content: attr(data-depth); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line); border-radius: 3px; padding: 0.1em 0.4em; transform: translateY(-1px); }
.tool[data-depth="rare"]::after { content: "when needed"; }
.tool[data-depth="daily"]::after { color: var(--blue); border-color: var(--blue); }
.bom.is-filtered .tool:not(.is-match) { opacity: 0.22; }
.bom td { color: var(--ink); }

/* ---------- hello (sheet 05) ---------- */
.contact { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); max-width: 44rem; border-radius: 6px; overflow: hidden; }
.contact a { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: 1rem 1.25rem; background: var(--paper); text-decoration: none; color: var(--ink); transition: background 200ms; }
.contact a:hover { background: var(--paper-2); }
.contact-k { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.contact-v { font-size: 1.1rem; color: var(--blue); }
.contact a:hover .contact-v { text-decoration: underline; text-underline-offset: 0.18em; }
.offclock { margin-top: 2.5rem; color: var(--ink-2); font-style: italic; }
@media (max-width: 480px) { .contact a { flex-direction: column; gap: 0.2rem; } }

/* contact form */
.hello-grid { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 900px) { .hello-grid { grid-template-columns: minmax(0, 36rem) minmax(16rem, 22rem); gap: 3rem; } }
.contact-form { border: 1px solid var(--line-strong); border-radius: 6px; padding: clamp(1.25rem, 3vw, 2rem); background: color-mix(in srgb, var(--paper-2) 60%, transparent); }
.cf-title { font-size: 1.5rem; margin-bottom: 1.1rem; font-variation-settings: "SOFT" 50; }
.cf-field { margin-bottom: 1rem; }
.cf-field label, .cf-fine, .cf-status, .cf-submit { font-family: var(--mono); }
.cf-field label { display: block; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 0.4rem; }
.cf-field input, .cf-field textarea { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0.65rem 0.8rem; transition: border-color 200ms, box-shadow 200ms; }
.cf-field input:focus, .cf-field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.cf-field textarea { resize: vertical; min-height: 7.5rem; }
.cf-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile { min-height: 65px; margin: 0.25rem 0 1rem; }
.cf-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cf-submit { font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 999px; padding: 0.8em 1.5em; cursor: pointer; transition: background 200ms, transform 200ms; }
.cf-submit:hover { background: var(--blue); border-color: var(--blue); transform: translateY(-1px); }
.cf-submit:disabled { opacity: 0.55; cursor: default; transform: none; }
.cf-status { margin: 0; font-size: 0.74rem; letter-spacing: 0.04em; color: var(--ink-2); }
.cf-status.is-ok { color: var(--blue); }
.cf-status.is-err { color: var(--oxide); }
.contact-form.is-unconfigured .cf-turnstile { display: none; }

/* ---------- title block (footer) ---------- */
.titleblock { border-top: 1px solid var(--line-strong); padding: 2rem 0 calc(2rem + var(--frame)); }
.tb-grid { margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line-strong); }
@media (min-width: 720px) { .tb-grid { grid-template-columns: repeat(6, 1fr); } }
.tb-grid > div { padding: 0.7rem 0.9rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tb-grid > div:nth-child(2n) { border-right: 0; }
.tb-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
@media (min-width: 720px) { .tb-grid > div { border-bottom: 0; } .tb-grid > div:nth-child(2n) { border-right: 1px solid var(--line); } .tb-grid > div:last-child { border-right: 0; } }
.tb-grid dt { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.tb-grid dd { margin: 0.15rem 0 0; font-size: 0.78rem; letter-spacing: 0.04em; color: var(--ink); }
.colophon { font-size: 0.7rem; letter-spacing: 0.04em; color: var(--ink-2); margin: 1.25rem 0 0; }

/* ---------- utilities ---------- */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* phone-only way back to the cover and the sheet list (the top bar is not sticky on phones) */
.to-top { position: fixed; right: calc(var(--frame) + 10px); bottom: calc(var(--frame) + 10px); z-index: 45; width: 44px; height: 44px; border-radius: 50%; display: none; place-items: center; background: var(--paper); color: var(--ink); border: 1px solid var(--line-strong); text-decoration: none; font-family: var(--mono); font-size: 1rem; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity 250ms ease, transform 250ms ease; }
@media (max-width: 640px) { .to-top { display: grid; } .show-top .to-top { opacity: 1; transform: none; pointer-events: auto; } }

/* ---------- motion ---------- */
/* Reveal-on-scroll only once main.js has run (it adds .js), so the content is never hidden without it. */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 700ms cubic-bezier(.2,.7,.2,1), transform 700ms cubic-bezier(.2,.7,.2,1); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .fig-route:not(.is-drawn) .route-path { stroke-dasharray: 0.012 0.008; stroke-dashoffset: 0; }
  .fig-route:not(.is-drawn) .route-stops g { opacity: 1; }
  .rt-pulse, .status-dot, .station.is-in, .chapter.is-in, .cap-body { animation: none; }
  .cap:hover { transform: none; }
  .cf-submit:hover { transform: none; }
  .crosshair { display: none; }
  .to-top { transition: none; }
}

@media print {
  .frame, .top, .crosshair, .theme-toggle { display: none; }
  body { background: #fff; color: #000; }
  .js .reveal { opacity: 1; transform: none; }
  .to-top { display: none; }
}
