/* ===== Tokens (Rainbow Report HUD, now with extra silliness) — single dark theme by design ===== */
:root {
  color-scheme: dark;
  --ground: #07070f;
  --panel: #0e0d1b;
  --line: rgba(255,255,255,0.09);
  --line-strong: rgba(255,255,255,0.2);
  --text: #eeebf8;
  --muted: #a4a0bb;
  --faint: #716d88;
  --terminal: #00ffb4;
  --terminal-dim: rgba(0,255,180,0.5);
  --cyan: #00ccff;
  --pink: #ff69b4;
  --r: #ff4444; --o: #ff8800; --y: #ffdd00; --g: #44ff44; --b: #00ccff; --i: #6644ff; --v: #aa44ff;
  --rainbow: linear-gradient(90deg, var(--r), var(--o), var(--y), var(--g), var(--b), var(--i), var(--v));
  --juice: .5;  /* Rainbow-o-meter, 0..1 */

  --f-display: "Exo 2", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --f-read: "Literata", Georgia, serif;
  --f-doodle: "Caveat", "Comic Sans MS", "Marker Felt", cursive;
  --wrap: 1080px;
}
* { box-sizing: border-box; }
html, body { background: var(--ground); }
body { margin: 0; color: var(--text); font-family: var(--f-display); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px dashed var(--y); outline-offset: 3px; }

/* Atmosphere */
#glows { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.fx-scan { position: fixed; inset: 0; pointer-events: none; z-index: 50; background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,255,180,0.016) 2px 4px); }
.fx-vig { position: fixed; inset: 0; pointer-events: none; z-index: 49; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.5) 100%); }
.progress, .wipe { position: fixed; left: 0; top: 0; height: 4px; background: var(--rainbow); z-index: 70; }
.progress { width: 0; }
.wipe { width: 100%; transform: scaleX(0); transform-origin: left; opacity: 0; }
.wipe.go { animation: wipe .6s ease-out; }
@keyframes wipe { 0% { transform: scaleX(0); opacity: 1; } 70% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }

.wrap { position: relative; z-index: 1; max-width: var(--wrap); margin: 0 auto; padding-inline: 20px; }

/* ===== Header ===== */
.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; background: rgba(7,7,15,0.88); backdrop-filter: blur(8px); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-block: 12px; }
.wordmark { text-decoration: none; display: inline-flex; flex-direction: column; gap: 1px; }
.wordmark b { font-weight: 900; font-size: 22px; letter-spacing: .06em; display: inline-flex; }
.wordmark b span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.wordmark:hover b span { animation-duration: .6s; }
.wordmark small { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; color: var(--terminal-dim); }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px) rotate(-3deg); } }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; padding: 8px 12px; color: var(--muted); border-radius: 999px; transition: transform .15s; }
.nav a:hover { color: var(--text); transform: rotate(-3deg) scale(1.08); }
.nav a[aria-current="page"] { color: var(--terminal); text-decoration: underline wavy var(--pink); text-underline-offset: 6px; text-decoration-thickness: 2px; }

/* Ticker */
.ticker { border-block: 1px solid var(--line); overflow: hidden; white-space: nowrap; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .12em; color: var(--terminal); background: rgba(0,255,180,.04); }
.ticker-track { display: inline-block; padding-block: 6px; animation: tick 38s linear infinite; }
.ticker-track span { margin-right: 28px; }
.ticker-track span:nth-child(7n+1) { color: var(--r); } .ticker-track span:nth-child(7n+2) { color: var(--o); }
.ticker-track span:nth-child(7n+3) { color: var(--y); } .ticker-track span:nth-child(7n+4) { color: var(--g); }
.ticker-track span:nth-child(7n+5) { color: var(--b); } .ticker-track span:nth-child(7n+6) { color: #9a80ff; }
.ticker-track span:nth-child(7n+7) { color: var(--v); }
@keyframes tick { to { transform: translateX(-50%); } }

/* ===== Type ===== */
.eyebrow { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--terminal); }
.eyebrow .dim { color: var(--faint); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.h1 { font-weight: 900; font-size: clamp(36px, 6.4vw, 66px); line-height: 1.02; letter-spacing: -.01em;
  text-shadow: 3px 3px 0 var(--r), 6px 6px 0 var(--o), 9px 9px 0 var(--y), 12px 12px 0 var(--g), 15px 15px 0 var(--b), 18px 18px 0 var(--i), 21px 21px 0 var(--v);
  padding-bottom: 18px; }
.h1.small-stack { text-shadow: 2px 2px 0 var(--r), 4px 4px 0 var(--o), 6px 6px 0 var(--y), 8px 8px 0 var(--g), 10px 10px 0 var(--b), 12px 12px 0 var(--i), 14px 14px 0 var(--v); padding-bottom: 12px; }
.h2 { font-weight: 800; font-size: clamp(24px, 3.2vw, 30px); line-height: 1.15; }
.h3 { font-weight: 700; font-size: 19px; line-height: 1.25; }
.lede { color: var(--muted); font-size: 18px; max-width: 60ch; margin: 0; }
.meta { font-family: var(--f-mono); font-size: 12px; color: var(--faint); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.doodle { font-family: var(--f-doodle); font-weight: 700; color: var(--pink); font-size: 24px; line-height: 1; display: inline-block; transform: rotate(-4deg); }
.doodle.y { color: var(--y); } .doodle.c { color: var(--cyan); } .doodle.g { color: var(--g); }
.page { padding-block: 48px 80px; display: grid; gap: 56px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px dotted var(--line-strong); padding-bottom: 12px; }

/* Panels: tilted, squishy, rainbow on hover */
.hud { position: relative; background: var(--panel); border: 2px solid var(--line-strong); border-radius: 14px; padding: 24px; transition: transform .25s cubic-bezier(.3,1.6,.5,1), border-color .2s, box-shadow .2s; }
.tilt-a { transform: rotate(-1.2deg); } .tilt-b { transform: rotate(1deg); } .tilt-c { transform: rotate(-.5deg); }
a.hud:hover { transform: rotate(0) translateY(-6px) scale(1.02); border-color: transparent;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, var(--rainbow) border-box; box-shadow: 0 14px 0 -4px rgba(255,105,180,.25); }
a.hud:active { transform: scale(.97); }

/* Core bars */
.cores { display: flex; gap: 3px; align-items: flex-end; height: 20px; }
.cores i { width: 7px; background: currentColor; opacity: .18; height: 100%; border-radius: 3px; }
.cores i.on { opacity: 1; box-shadow: 0 0 8px currentColor; animation: pump 1.6s ease-in-out infinite; }
.cores i.on:nth-child(2) { animation-delay: .1s; } .cores i.on:nth-child(3) { animation-delay: .2s; } .cores i.on:nth-child(4) { animation-delay: .3s; }
.cores i.on:nth-child(5) { animation-delay: .4s; } .cores i.on:nth-child(6) { animation-delay: .5s; } .cores i.on:nth-child(7) { animation-delay: .6s; }
@keyframes pump { 50% { transform: scaleY(.6); } }
.cores i { transform-origin: bottom; }

/* Buttons: chunky, offset shadow, squish */
.btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  font-weight: 900; font-size: 14px; letter-spacing: .1em; text-transform: uppercase;
  padding: 12px 20px; border: 2px solid var(--terminal); color: #04110c; background: var(--terminal); border-radius: 999px;
  box-shadow: 4px 4px 0 var(--pink); transition: transform .12s, box-shadow .12s; }
.btn:hover { animation: wiggle .35s ease-in-out 2; }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--pink); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--text); box-shadow: 4px 4px 0 var(--cyan); }
.btn.small { padding: 7px 14px; font-size: 12px; }
@keyframes wiggle { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }

/* ===== Home ===== */
.hero { display: grid; gap: 22px; padding-block: 40px 8px; position: relative; }
.transmission { font-family: var(--f-mono); font-size: 13px; color: var(--terminal); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.transmission .freq { color: var(--faint); }
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--terminal); vertical-align: -2px; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }

.feed { display: grid; }
.feed a { display: grid; grid-template-columns: 150px 1fr auto; gap: 16px; align-items: baseline; text-decoration: none; padding: 16px 8px; border-bottom: 2px dotted var(--line); border-radius: 8px; transition: transform .15s, background .15s; }
.feed a:hover { background: rgba(255,255,255,.04); transform: translateX(6px); }
.feed a:hover .h3 { color: var(--y); }
.chip { font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.feed .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
@media (max-width: 640px) { .feed a { grid-template-columns: 1fr; gap: 4px; } }

.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.door { text-decoration: none; display: grid; gap: 12px; align-content: start; }
.door .count { font-weight: 900; font-size: 56px; line-height: 1; font-variant-numeric: tabular-nums; background: var(--rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; }
.door p { margin: 0; color: var(--muted); }
.door .go { font-weight: 800; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--terminal); }
.door .doodle { position: absolute; right: 18px; top: -14px; }

/* ===== Lists ===== */
.grid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 24px; }
.item { text-decoration: none; display: grid; gap: 12px; align-content: start; }
.item:hover .h3 { color: var(--y); }
.item p { margin: 0; color: var(--muted); font-size: 15px; }
.item-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.status { font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; border: 2px solid; }
.status.ongoing { color: var(--terminal); } .status.complete { color: var(--cyan); }

.toc { display: grid; }
.toc a { display: grid; grid-template-columns: 70px 1fr auto; gap: 16px; align-items: baseline; padding: 14px 8px; border-bottom: 2px dotted var(--line); text-decoration: none; border-radius: 8px; transition: transform .15s; }
.toc a:hover { transform: translateX(6px); background: rgba(255,255,255,.04); }
.toc a:hover .h3 { color: var(--y); }
.toc .num { font-family: var(--f-mono); color: var(--faint); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .toc a { grid-template-columns: 50px 1fr; } .toc a .meta { grid-column: 2; } }

.crumbs { font-family: var(--f-mono); font-size: 12px; color: var(--faint); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--y); }

/* ===== Reader (stays calm so the words are easy to read) ===== */
.reader { max-width: 68ch; margin: 0 auto; padding-block: 48px 80px; display: grid; gap: 32px; }
.reader-head { display: grid; gap: 12px; padding-bottom: 24px; border-bottom: 2px dotted var(--line-strong); }
.reader-head .h1 { font-size: clamp(32px, 5vw, 48px); }
.prose { font-family: var(--f-read); font-size: 19px; line-height: 1.72; color: #e2def0; }
.prose p { margin: 0 0 1.1em; }
.prose p:first-child::first-letter { font-family: var(--f-display); font-weight: 900; float: left; font-size: 3.6em; line-height: .9; padding: 6px 12px 0 0;
  background: var(--rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; }
.prose .break { text-align: center; margin: 1.6em 0; font-size: 22px; letter-spacing: .5em; }
.prose .break span:nth-child(1) { color: var(--r); } .prose .break span:nth-child(2) { color: var(--y); } .prose .break span:nth-child(3) { color: var(--b); }
.end-mark { text-align: center; display: grid; gap: 6px; }
.end-mark .meta { letter-spacing: .3em; color: var(--terminal-dim); }
.pager { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 24px; border-top: 2px dotted var(--line-strong); }
.share-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.toast { font-family: var(--f-doodle); font-size: 22px; font-weight: 700; color: var(--y); }
.copy-fallback { font-family: var(--f-mono); font-size: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 8px; width: 100%; max-width: 420px; }

/* ===== Glossary ===== */
.search { width: 100%; max-width: 420px; background: var(--panel); border: 2px solid var(--line-strong); color: var(--text); font-family: var(--f-mono); font-size: 14px; padding: 12px 16px; border-radius: 999px; }
.search:focus { border-color: var(--pink); outline: none; }
.search::placeholder { color: var(--faint); }
.gloss-group { display: grid; gap: 8px; }
.gloss-group h2 { font-family: var(--f-mono); font-weight: 500; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.gloss { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 16px; padding: 14px 8px; border-bottom: 2px dotted var(--line); border-radius: 8px; }
.gloss:hover { background: rgba(255,255,255,.035); }
.gloss dt { font-weight: 800; font-size: 19px; }
.gloss dd { margin: 0; color: var(--muted); }
.gloss.grayscale dt { color: #bdbdbd; font-style: italic; }
.gloss.grayscale:hover dt { animation: drain 1.2s ease-in-out infinite alternate; }
@keyframes drain { to { color: #555; letter-spacing: .08em; } }
.gloss.rainbow dt { background: var(--rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (max-width: 600px) { .gloss { grid-template-columns: 1fr; gap: 4px; } }
.empty { font-family: var(--f-doodle); font-size: 26px; color: var(--pink); }

/* ===== About ===== */
.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 24px; }
.about .hud p { color: var(--muted); margin: 12px 0 0; }

/* ===== Rainbow-o-meter ===== */
.meter-btn { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 60; width: 58px; height: 58px; border-radius: 50%;
  border: 2px solid var(--text); background: var(--panel); cursor: pointer; box-shadow: 4px 4px 0 var(--pink); display: grid; place-items: center; transition: transform .15s; }
.meter-btn:hover { transform: rotate(-12deg) scale(1.08); }
.meter-btn svg { width: 38px; height: 22px; }
.meter { position: fixed; right: 18px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); z-index: 60; width: min(300px, calc(100vw - 36px));
  background: var(--panel); border: 2px solid var(--text); border-radius: 16px; padding: 18px; box-shadow: 6px 6px 0 var(--cyan); display: grid; gap: 10px; transform: rotate(-1deg); }
.meter[hidden] { display: none; }
@media (max-width: 600px) {
  .h1, .h1.small-stack { text-shadow: 1px 1px 0 var(--r), 2px 2px 0 var(--o), 3px 3px 0 var(--y), 4px 4px 0 var(--g), 5px 5px 0 var(--b), 6px 6px 0 var(--i), 7px 7px 0 var(--v); padding-bottom: 8px; }
}
.meter label { font-weight: 900; letter-spacing: .08em; text-transform: uppercase; font-size: 14px; }
.meter input[type=range] { width: 100%; accent-color: var(--pink); height: 28px; }
.meter .ends { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 10.5px; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; }
.meter .readout { font-family: var(--f-doodle); font-size: 26px; font-weight: 700; color: var(--y); min-height: 1em; }

/* MAXIMUM RAINBOW mode */
body.max .h1 { animation: hue 3s linear infinite, wobble 1.8s ease-in-out infinite; }
body.max .hud { animation: hue 5s linear infinite; }
body.max .site-head { box-shadow: 0 3px 0 0 var(--pink), 0 6px 0 0 var(--y), 0 9px 0 0 var(--cyan); }
body.max .reader .h1, body.max .reader .hud { animation: none; }
@keyframes hue { to { filter: hue-rotate(360deg); } }
@keyframes wobble { 0%,100% { transform: rotate(-1deg); } 50% { transform: rotate(1deg) scale(1.01); } }
body.calm .wordmark b span, body.calm .cores i.on, body.calm .ticker-track { animation: none; }

/* Reading pages: the frame calms down so people can focus */
body.reading .wordmark b span, body.reading .ticker-track, body.reading .cores i.on, body.reading .cursor { animation: none !important; }
body.reading.max .h1, body.reading.max .hud { animation: none !important; }
body.reading.max .site-head { box-shadow: none; }
body.reading .ticker { opacity: .55; }
body.reading .btn:hover { animation: none; }
body.reading .h1.small-stack { text-shadow: 2px 2px 0 var(--r), 3px 3px 0 var(--y), 4px 4px 0 var(--b), 5px 5px 0 var(--v); padding-bottom: 6px; }
body.reading .prose p:first-child::first-letter { animation: none; }

.confetti { position: fixed; z-index: 80; pointer-events: none; width: 9px; height: 14px; border-radius: 2px; }

/* ===== Footer ===== */
.site-foot { position: relative; z-index: 1; border-top: 2px dotted var(--line-strong); }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-block: 24px 96px; }

/* No-JS fallback */
.noscript { padding-block: 48px; display: grid; gap: 16px; }

@media (max-width: 480px) { .nav a { padding: 7px 8px; font-size: 11.5px; letter-spacing: .08em; } .head-row { padding-block: 10px; } .hud { padding: 20px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tilt-a, .tilt-b, .tilt-c { transform: none; }
}
