/*
 * The pictures. scripts/render.mjs draws each one in its finished state from
 * a small shared vocabulary (chip, box, wire, lane), and every rule here
 * describes that finished state in the ground's own colours. Motion (later)
 * plays each picture from a "before" to what is styled here; with reduced
 * motion or no JavaScript, this is simply what the reader sees.
 *
 * Pictures are decorative (aria-hidden): the meaning is in the text beside them.
 */

.pic-svg { width: 100%; height: auto; overflow: visible; font-family: var(--font-sign); }
.pic-svg text { fill: var(--ink); font-size: 15px; }
.pic-label { fill: var(--ink-2) !important; font-size: 12px !important; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.pic-label-accent { fill: var(--accent) !important; }
.pic-mono { font-family: var(--font-mono); font-size: 14px !important; fill: var(--ink-2) !important; }

/* ───────────────────────── vocabulary ───────────────────────── */

.chip rect { fill: none; stroke: var(--line); stroke-width: 1.3; }
.chip text { font-size: 13px !important; fill: var(--ink-2) !important; font-weight: 550; }
.chip-strong rect { stroke: var(--ink-2); }
.chip-strong text { fill: var(--ink) !important; font-weight: 650; letter-spacing: .08em; font-size: 14px !important; }
.chip-accent rect { fill: color-mix(in oklch, var(--accent) 12%, transparent); stroke: var(--accent); }
.chip-accent text { fill: var(--accent) !important; font-weight: 650; }
.chip-accent-2 rect { fill: color-mix(in oklch, var(--accent-2) 12%, transparent); stroke: var(--accent-2); }
.chip-accent-2 text { fill: var(--accent-2) !important; font-weight: 650; }
.chip-solid rect { fill: var(--accent); stroke: var(--accent); filter: drop-shadow(0 0 10px var(--glow)); }
.chip-solid text { fill: var(--bg) !important; font-weight: 700; letter-spacing: .04em; }
.chip.is-dim { opacity: .45; }

.box rect { fill: color-mix(in oklch, var(--bg), var(--ink) 6%); stroke: var(--line); stroke-width: 1.4; }
.box.is-lit rect { fill: color-mix(in oklch, var(--bg), var(--accent) 14%); stroke: var(--accent); }
.box.is-dim { opacity: .5; }
.box.is-wait rect { stroke: var(--accent-2); stroke-dasharray: 5 4; fill: none; }
.box-label { font-size: 15px !important; font-weight: 600; }
.box-sub { fill: var(--ink-2) !important; font-size: 11px !important; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.box-display .box-label { font-family: var(--font-display); font-weight: 400; font-size: 26px !important; }
.box-mono .box-label { font-family: var(--font-mono); font-weight: 500; font-size: 13px !important; }
.box-mono.is-lit .box-label { fill: var(--accent) !important; }

.wire { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.wire.is-dim { stroke: var(--ink-2); opacity: .5; }
.feed { fill: none; stroke: var(--line); stroke-width: 1.5; }
.arrow-head { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.divider { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 5; }
.token circle { fill: var(--accent); filter: drop-shadow(0 0 7px var(--accent)); }

/* ───────────────────────── hero field ───────────────────────── */

.field-line {
  margin: 0;
  height: 2.5rem;
  line-height: 2.5rem;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 19px;
  color: var(--accent);
  opacity: .13;
}
.field-line:nth-child(3n + 1) { margin-left: -9rem; }
.field-line:nth-child(3n + 2) { margin-left: -2rem; }
.field-line:nth-child(3n) { margin-left: -14rem; }
.field-line.is-glow { opacity: .95; text-shadow: 0 0 8px var(--accent), 0 0 22px var(--glow); }
@media (prefers-reduced-motion: no-preference) {
  .field-line { animation: drift 80s linear infinite alternate; }
  .field-line.drift-r { animation-direction: alternate-reverse; animation-duration: 95s; }
  .field-line.is-glow { animation-duration: 140s; }
}
@keyframes drift { from { transform: translateX(-60px); } to { transform: translateX(60px); } }

/* ───────────────────────── threading ───────────────────────── */

.lane text { font-family: var(--font-mono); font-size: 13px !important; fill: var(--ink-2) !important; }
.lane line { stroke: var(--line); stroke-width: 2; stroke-dasharray: 2 6; stroke-linecap: round; }
.lane.is-ours line { stroke: var(--accent); stroke-dasharray: none; stroke-width: 3; opacity: .6; }
.lane.is-ours text { fill: var(--accent) !important; }
.lane-card rect { fill: color-mix(in oklch, var(--bg), var(--ink) 10%); stroke: var(--accent); stroke-width: 1.5; }
.lane-card text { font-weight: 650; font-size: 14px !important; }
.lane-card.is-ghost { opacity: .35; }
.lane-card.is-ghost rect { fill: none; stroke: var(--ink-2); stroke-dasharray: 4 4; }
.split { fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .4; }

/* ───────────────────────── fraud · mastercard ───────────────────────── */

.breaker circle { fill: var(--accent); }
.breaker path { stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; }
.bar { fill: color-mix(in oklch, var(--accent) 55%, transparent); }
.bar:nth-child(3n) { fill: color-mix(in oklch, var(--accent-2) 55%, transparent); }

/* ───────────────────────── identity ───────────────────────── */

.envelope rect, .envelope path { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.envelope text { font-family: var(--font-display); font-size: 26px !important; fill: var(--ink-2) !important; }
.envelope.is-dim { opacity: .55; }
.rest rect { fill: color-mix(in oklch, var(--bg), var(--accent) 12%); stroke: var(--accent); stroke-width: 1.5; }
.rest-k { font-family: var(--font-display); font-size: 30px !important; fill: var(--accent) !important; }
.lock rect { fill: var(--accent); }
.lock path { fill: none; stroke: var(--accent); stroke-width: 4; }
.span text { font-family: var(--font-mono); font-size: 13px !important; fill: var(--ink-2) !important; }
.span rect { fill: color-mix(in oklch, var(--ink) 28%, transparent); }
.span.is-lit rect { fill: var(--accent); }

/* ───────────────────────── toolkit ───────────────────────── */

.code-pic { display: grid; gap: var(--space-md); }
.code-pane { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: color-mix(in oklch, var(--bg), var(--well-tone) var(--well-amt)); }
.code-file { padding: .45rem .9rem; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: .75rem; color: var(--ink-2); }
.code-pane pre { padding: .9rem 1rem; font-size: clamp(.78rem, .7rem + .25vw, .95rem); line-height: 1.7; color: var(--ink); white-space: pre; overflow-x: auto; }
.tk-kw { color: var(--accent); }
.tk-ann { color: var(--accent-2); }
.tk-str { color: var(--accent-2); }

/* ───────────────────────── claude code ───────────────────────── */

.terminal {
  border: 1px solid color-mix(in oklch, var(--accent) 45%, transparent);
  border-radius: 10px; overflow: hidden;
  background: color-mix(in oklch, var(--bg), var(--well-tone) calc(var(--well-amt) * 1.4));
  box-shadow: 0 0 60px -12px var(--glow);
}
.term-bar { display: flex; align-items: center; gap: .4rem; padding: .55rem .8rem; border-bottom: 1px solid var(--line); }
.term-bar span { width: .6rem; height: .6rem; border-radius: 50%; background: var(--line); }
.term-bar b { margin-left: .6rem; font: 600 .78rem/1 var(--font-mono); color: var(--ink-2); }
.term-body { padding: 1rem 1.1rem 1.2rem; font-size: clamp(.74rem, .68rem + .25vw, .9rem); line-height: 1.75; white-space: pre-wrap; }
.term-line { display: block; }
.term-prompt { color: var(--accent); }
.term-dim { color: var(--ink-2); }
.term-head { color: var(--ink); font-weight: 700; margin-top: .5rem; }
.term-text { color: var(--ink); }

/* ───────────────────────── academics ───────────────────────── */

.spine { stroke: var(--line); stroke-width: 2; }
.stop circle { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.stop.is-now circle { fill: var(--accent); filter: drop-shadow(0 0 6px var(--glow)); }
.stop-year { font-family: var(--font-display); font-size: 30px !important; fill: var(--accent) !important; }
.stop-label { font-size: 17px !important; font-weight: 550; }

/* ───────────────────────── claude code · background ───────────────────────── */

/*
 * A constellation of nodes and wires over two slow auroras. It is densest
 * behind the terminal and fades out behind the words (the mask), so the copy
 * always sits on a calm ground.
 */
.sheet-inner { position: relative; z-index: 1; }
.ai-bg {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 42%, rgb(0 0 0 / .35) 62%, rgb(0 0 0 / .12) 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 42%, rgb(0 0 0 / .35) 62%, rgb(0 0 0 / .12) 100%);
}
.ai-bg:not(.is-flip) { -webkit-mask-image: linear-gradient(270deg, #000 0%, #000 42%, rgb(0 0 0 / .35) 62%, rgb(0 0 0 / .12) 100%); mask-image: linear-gradient(270deg, #000 0%, #000 42%, rgb(0 0 0 / .35) 62%, rgb(0 0 0 / .12) 100%); }
.ai-aurora { position: absolute; inset: -20%; }
.ai-aurora::before, .ai-aurora::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px);
}
.ai-aurora::before {
  width: 55%; height: 60%; left: 8%; top: 18%;
  background: radial-gradient(closest-side, oklch(72% 0.16 205 / .55), oklch(60% 0.18 250 / .25) 55%, transparent);
}
.ai-aurora::after {
  width: 45%; height: 55%; left: 26%; top: 36%;
  background: radial-gradient(closest-side, oklch(62% 0.22 320 / .45), oklch(55% 0.2 290 / .2) 60%, transparent);
}
.ai-net { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.ai-wire { fill: none; stroke: oklch(85% 0.1 210 / .22); stroke-width: 1; }
.ai-pulse { stroke: oklch(90% 0.14 200 / .95); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 18 400; stroke-dashoffset: 0; filter: drop-shadow(0 0 4px oklch(85% 0.15 205)); }
.ai-node { fill: oklch(92% 0.08 210 / .75); }
.ai-node.is-hub { fill: oklch(90% 0.15 200); filter: drop-shadow(0 0 6px oklch(80% 0.16 205)) drop-shadow(0 0 16px oklch(70% 0.2 300 / .7)); }

/* Light theme: the same network, drawn in ink on the lavender paper. */
:root[data-theme="light"] .ai-wire { stroke: oklch(40% 0.12 270 / .2); }
:root[data-theme="light"] .ai-node { fill: oklch(42% 0.14 265 / .55); }
:root[data-theme="light"] .ai-pulse { stroke: oklch(55% 0.17 230 / .9); }
:root[data-theme="light"] .ai-aurora::before { background: radial-gradient(closest-side, oklch(80% 0.12 205 / .55), transparent); }
:root[data-theme="light"] .ai-aurora::after { background: radial-gradient(closest-side, oklch(80% 0.13 320 / .45), transparent); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .ai-wire { stroke: oklch(40% 0.12 270 / .2); }
  :root:not([data-theme="dark"]) .ai-node { fill: oklch(42% 0.14 265 / .55); }
  :root:not([data-theme="dark"]) .ai-pulse { stroke: oklch(55% 0.17 230 / .9); }
  :root:not([data-theme="dark"]) .ai-aurora::before { background: radial-gradient(closest-side, oklch(80% 0.12 205 / .55), transparent); }
  :root:not([data-theme="dark"]) .ai-aurora::after { background: radial-gradient(closest-side, oklch(80% 0.13 320 / .45), transparent); }
}

/* Motion: pulses run the wires, hubs breathe, the auroras drift. Still when reduced. */
@media (prefers-reduced-motion: no-preference) {
  .ai-pulse { animation: ai-run 4.8s linear infinite; }
  .ai-d1 { animation-delay: -1s; } .ai-d2 { animation-delay: -2s; } .ai-d3 { animation-delay: -3s; }
  .ai-d4 { animation-delay: -4s; } .ai-d5 { animation-delay: -1.6s; } .ai-d6 { animation-delay: -3.4s; }
  .ai-twinkle { animation: ai-twinkle 3.6s ease-in-out infinite alternate; }
  .ai-aurora::before { animation: ai-drift 22s ease-in-out infinite alternate; }
  .ai-aurora::after { animation: ai-drift 28s ease-in-out infinite alternate-reverse; }
}
@keyframes ai-run { from { stroke-dashoffset: 418; } to { stroke-dashoffset: 0; } }
@keyframes ai-twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes ai-drift { from { transform: translate(-6%, -4%) scale(1); } to { transform: translate(8%, 6%) scale(1.15); } }

/* ───────────────────────── recovery · conveyor ───────────────────────── */

.rc-lane { stroke: var(--ink-2); stroke-width: 3; opacity: .5; stroke-linecap: round; }
.rc-chevrons { fill: none; stroke: var(--ink-2); stroke-width: 1.6; opacity: .45; }
.rc-card .rc-face { fill: color-mix(in oklch, var(--bg), var(--ink) 10%); stroke: var(--ink-2); stroke-width: 1.4; }
.rc-card text { font-family: var(--font-mono); font-size: 12px !important; font-weight: 600; }
.rc-poison .rc-face { stroke: var(--accent); stroke-width: 2; fill: color-mix(in oklch, var(--bg), var(--accent) 16%); }
.rc-bad { fill: oklch(58% 0.2 27); stroke: oklch(70% 0.18 27); stroke-width: 2; opacity: 0; }
.rc-flow { opacity: 0; }
.rc-retry { stroke: oklch(70% 0.18 27); stroke-dasharray: 5 4; }
.rc-retry-k { fill: oklch(78% 0.14 27) !important; }
.rc-drop, .rc-replay { stroke-dasharray: 6 5; }
.rc-note { font-size: 13px !important; font-weight: 600; fill: var(--ink-2) !important; letter-spacing: .04em; }
.rc-tray rect { fill: color-mix(in oklch, var(--bg), var(--well-tone) var(--well-amt)); stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 8 5; }
.rc-tray-k { font-family: var(--font-display); font-size: 26px !important; fill: var(--accent) !important; }
.rc-tray-s { font-size: 12px !important; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; fill: var(--ink-2) !important; }
:root[data-theme="light"] .rc-retry-k { fill: oklch(48% 0.18 27) !important; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .rc-retry-k { fill: oklch(48% 0.18 27) !important; } }

/* Redesign: the cache box. */
.box.is-cache rect { fill: color-mix(in oklch, var(--bg), var(--accent-2) 16%); stroke: var(--accent-2); stroke-width: 1.8; }
.box.is-cache .box-label { fill: var(--ink) !important; }
