:root {
  --bg: #fbf3ee;
  --bg-glow: #f7dde6;
  --surface: #fffaf7;
  --text: #2a1f22;
  --muted: #75656a;
  --accent: #b03a6e;
  --accent-ink: #fffaf7;
  --sparkle: #b8913f;
  --rule: #ecdcd3;
  --tag-bg: #f6e1ea;
  --code-bg: #fff6f1;
  --num: #8a5a00;
  --pop-1: var(--surface);
  --pop-2: var(--surface);
  --pop-3: var(--surface);
  --pop-4: var(--surface);
  --shadow: 0 1px 2px rgb(120 60 80 / 0.06), 0 8px 24px rgb(120 60 80 / 0.08);
  --radius: 0.9rem;
  --mark: "✦";
  --ornament: "✦ ✧ ✦";
  --font-display: "Didot", "Bodoni 72", "Bodoni MT", "Playfair Display", Georgia, serif;
  --font-body: Georgia, "Times New Roman", serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="y2k"] {
  --bg: #fdeefa;
  --bg-glow: #e2e4ff;
  --dot: #f5cdea;
  --surface: #ffffff;
  --text: #2b1d3a;
  --muted: #6c5c84;
  --accent: #c0157f;
  --accent-ink: #ffffff;
  --sparkle: #7c5cff;
  --rule: #2b1d3a;
  --tag-bg: #d9f1ff;
  --code-bg: #fff9fe;
  --num: #5b3fd6;
  --pop-1: #ffd6ee;
  --pop-2: #d9f1ff;
  --pop-3: #fff1b3;
  --pop-4: #d6f8e3;
  --shadow: 4px 4px 0 var(--text);
  --radius: 1.25rem;
  --mark: "★";
  --ornament: "★ ♡ ★";
  --font-display: ui-rounded, "Arial Rounded MT Bold", "Nunito", "Varela Round", system-ui, sans-serif;
  --font-body: ui-rounded, "Nunito", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1417;
    --bg-glow: #3a1f2c;
    --surface: #251b20;
    --text: #f3e9e4;
    --muted: #b3a29f;
    --accent: #f09bc0;
    --accent-ink: #1b1417;
    --sparkle: #d8b56a;
    --rule: #3d2e33;
    --tag-bg: #42283a;
    --code-bg: #20171b;
    --num: #e6c27a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }

  :root[data-theme="y2k"] {
    --bg: #1d1430;
    --bg-glow: #33215a;
    --dot: #33255a;
    --surface: #2a1e44;
    --text: #f6eaff;
    --muted: #bba9d6;
    --accent: #ff8fd8;
    --accent-ink: #1d1430;
    --sparkle: #9ef0ff;
    --rule: #f6eaff;
    --tag-bg: #3b2a63;
    --code-bg: #241a3b;
    --num: #9ef0ff;
    --pop-1: #4d2448;
    --pop-2: #213e63;
    --pop-3: #4d421c;
    --pop-4: #1f4a38;
    --shadow: 4px 4px 0 var(--accent);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  background: radial-gradient(60rem 26rem at 50% -6rem, var(--bg-glow), transparent 70%) no-repeat, var(--bg);
}

html[data-theme="y2k"] {
  background:
    radial-gradient(circle, var(--dot) 1.5px, transparent 1.75px) 0 0 / 22px 22px,
    linear-gradient(165deg, var(--bg-glow), var(--bg) 40%);
  background-color: var(--bg);
}

body {
  margin: 0 auto;
  max-width: 48rem;
  padding: 0 1rem;
  color: var(--text);
  font: 1.0625rem/1.6 var(--font-body);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 0.3rem;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-ui);
}

header.site .brand {
  color: var(--text);
  font: 400 1.05rem/1 var(--font-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

header.site .brand::before,
header.site .brand::after {
  content: var(--mark);
  margin: 0 0.45em;
  color: var(--sparkle);
  font-size: 0.8em;
}

header.site .brand::before { margin-left: 0; }

header.site nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-left: auto;
  font-size: 0.9375rem;
}

header.site nav a { color: var(--text); text-decoration: none; }
header.site nav a:hover { color: var(--accent); }

.theme-switch {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
}

@media (max-width: 40rem) {
  header.site .theme-switch { margin-left: auto; }
  header.site nav { order: 1; width: 100%; margin-left: 0; }
}

.theme-switch button {
  padding: 0.25rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 0.8125rem/1.4 var(--font-ui);
  cursor: pointer;
}

.theme-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 400;
}

h1 {
  margin: 2.5rem 0 0.75rem;
  font-size: clamp(2.2rem, 6vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

h2 {
  margin: 2.75rem 0 1rem;
  font-size: 1.5rem;
  line-height: 1.2;
}

h2::before {
  content: var(--mark);
  margin-right: 0.5em;
  color: var(--sparkle);
  font-size: 0.65em;
  vertical-align: 0.2em;
}

.lede {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.15rem;
}

.meta {
  color: var(--muted);
  font: 0.875rem/1.5 var(--font-ui);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-ui);
}

.pills li {
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
}

.pills li:nth-child(4n + 1) { background: var(--pop-1); }
.pills li:nth-child(4n + 2) { background: var(--pop-2); }
.pills li:nth-child(4n + 3) { background: var(--pop-3); }
.pills li:nth-child(4n + 4) { background: var(--pop-4); }

.pills strong {
  margin-right: 0.3em;
  color: var(--text);
  font: 400 1.3rem/1 var(--font-display);
}

.tag {
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--tag-bg);
  font: 600 0.75rem/1.6 var(--font-ui);
  vertical-align: middle;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: 1.1rem 1.2rem 1.15rem;
  border: 1px solid var(--rule);
  border-top: 3px solid var(--sparkle);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

a.card:hover { transform: translateY(-2px); border-color: var(--sparkle); }

.card-kicker {
  color: var(--accent);
  font: 700 0.75rem/1.2 var(--font-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card-title { font: 400 1.2rem/1.25 var(--font-display); }

.stat-value { font: 400 2.4rem/1.05 var(--font-display); }
.stat-value .meta { margin-left: 0.15rem; }

.stat-holders {
  margin: 0.1rem 0 0;
  padding: 0;
  list-style: none;
  font: 0.9375rem/1.45 var(--font-ui);
}

.stat q { font-style: italic; }
.stat .chip { align-self: flex-start; margin-top: auto; }

.columns {
  columns: 14rem;
  padding-left: 0;
  list-style: none;
}

.columns li { padding: 0.1rem 0; break-inside: avoid; }

.columns li::before {
  content: var(--mark);
  margin-right: 0.55em;
  color: var(--sparkle);
  font-size: 0.7em;
}

q::before, q::after { color: var(--accent); }

dl.taglines dt {
  margin-top: 1.1rem;
  font: 600 0.9375rem/1.4 var(--font-ui);
}

dl.taglines dd {
  margin: 0.3rem 0 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--sparkle);
  font-style: italic;
}

form.search label,
.try label {
  display: block;
  font: 600 0.875rem/1.6 var(--font-ui);
}

form.search input,
.try input {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

form.search input:focus,
.try input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 0.9375rem/1.2 var(--font-ui);
  cursor: pointer;
}

.button:disabled { opacity: 0.6; cursor: progress; }

.mark::before { content: var(--mark); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: 500 0.8125rem/1.5 var(--font-ui);
  cursor: pointer;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }

code { font: 0.875em/1.5 var(--font-mono); }

:not(pre) > code {
  padding: 0.1em 0.4em;
  border-radius: 0.35em;
  background: var(--tag-bg);
}

.code-block {
  margin: 0;
  max-height: 30rem;
  overflow: auto;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: calc(var(--radius) * 0.75);
  background: var(--code-bg);
  font: 0.8125rem/1.55 var(--font-mono);
}

.code-block code { font: inherit; }

.j-key { color: var(--accent); }
.j-punct { color: var(--muted); }
.j-num, .j-lit { color: var(--num); }
a.j-str { color: var(--text); text-decoration-color: var(--accent); }

.panel {
  position: relative;
  padding: 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.spin { padding: 2rem 1.25rem 1.5rem; text-align: center; }

.spin::before,
.spin::after {
  content: var(--mark);
  position: absolute;
  color: var(--sparkle);
}

.spin::before { top: 0.75rem; left: 1rem; }
.spin::after { right: 1rem; bottom: 0.75rem; }

.spin-quote { margin: 0 auto 1.25rem; max-width: 32rem; }

.spin-quote p {
  margin: 0 0 0.6rem;
  font: italic 1.6rem/1.3 var(--font-display);
}

.spin-quote p::before { content: "“"; color: var(--accent); }
.spin-quote p::after { content: "”"; color: var(--accent); }

.spin-log { margin: 1rem 0 0; }
.spin-log .chip { font-family: var(--font-mono); font-size: 0.75rem; }

.try-row { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.try-row input { flex: 1; min-width: 0; margin-top: 0; font: 0.9rem/1.4 var(--font-mono); }

.endpoint { padding: 1.1rem 0; border-top: 1px solid var(--rule); }
.endpoint:last-of-type { border-bottom: 1px solid var(--rule); }

.endpoint h3 {
  margin: 0 0 0.35rem;
  font: 600 1rem/1.4 var(--font-ui);
  overflow-wrap: anywhere;
}

.endpoint p { margin: 0.35rem 0; }

.method {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 0.7rem/1.6 var(--font-ui);
  letter-spacing: 0.08em;
  vertical-align: 0.1em;
}

details summary {
  color: var(--muted);
  font: 600 0.875rem/1.6 var(--font-ui);
  cursor: pointer;
}

details[open] summary { margin-bottom: 0.5rem; }

.timeline { margin: 2rem 0 1.25rem; font-family: var(--font-ui); }

.timeline-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.75rem;
  align-items: center;
}

.timeline-row + .timeline-row { margin-top: 0.5rem; }

.timeline-label {
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.timeline-scale { position: relative; height: 1.25rem; }

.timeline-year {
  display: none;
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.75rem;
}

.timeline-year.every-2 { display: block; }

@media (max-width: 40rem) {
  .timeline-row { grid-template-columns: 3.75rem 1fr; gap: 0.5rem; }
  .timeline-year.every-2 { display: none; }
  .timeline-year.every-4 { display: block; }
}

.timeline-track {
  position: relative;
  height: 2.5rem;
  border: 1px solid var(--rule);
  border-radius: 0.6rem;
  background:
    linear-gradient(to right, var(--rule) 1px, transparent 1px) 0 0 / calc(100% / var(--years)) 100% repeat-x,
    var(--row-bg, var(--surface));
}

.timeline-run,
.timeline-break {
  position: absolute;
  top: calc(50% - 1px);
  height: 2px;
  background: var(--accent);
}

.timeline-break {
  height: 0;
  border-top: 2px dashed var(--muted);
  background: none;
}

.timeline-seasons { margin: 0; padding: 0; list-style: none; }

.timeline-seasons li {
  position: absolute;
  top: 50%;
  line-height: 0;
  transform: translate(-50%, -50%);
}

.timeline-dot {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border: 2px solid var(--row-bg, var(--surface));
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.15s ease;
}

.timeline-dot.era-start {
  border-radius: 0.15rem;
  background: var(--sparkle);
  transform: rotate(45deg);
}

a.timeline-dot:hover,
a.timeline-dot:focus-visible { transform: scale(1.4); }

a.timeline-dot.era-start:hover,
a.timeline-dot.era-start:focus-visible { transform: rotate(45deg) scale(1.4); }

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font: 0.875rem/1.5 var(--font-ui);
}

.timeline-legend .timeline-dot { margin-right: 0.3rem; vertical-align: -0.1em; }

.timeline-legend .timeline-break {
  position: static;
  display: inline-block;
  width: 1.5rem;
  margin-right: 0.3rem;
  vertical-align: middle;
}

footer.site {
  margin-top: 3.5rem;
  padding: 1.25rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font: 0.8125rem/1.5 var(--font-ui);
}

footer.site::before {
  content: var(--ornament);
  display: block;
  margin-bottom: 0.75rem;
  color: var(--sparkle);
  letter-spacing: 0.5em;
  text-align: center;
}

[data-theme="y2k"] header.site { border-bottom: 2px dashed var(--rule); }

[data-theme="y2k"] header.site .brand {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: lowercase;
}

[data-theme="y2k"] .theme-switch,
[data-theme="y2k"] .pills li,
[data-theme="y2k"] .chip,
[data-theme="y2k"] form.search input,
[data-theme="y2k"] .try input {
  border: 2px solid var(--rule);
}

[data-theme="y2k"] .theme-switch { box-shadow: 2px 2px 0 var(--text); }

[data-theme="y2k"] h1,
[data-theme="y2k"] h2 {
  font-weight: 800;
  letter-spacing: -0.02em;
}

[data-theme="y2k"] h1 { text-shadow: 3px 3px 0 var(--tag-bg); }

[data-theme="y2k"] .pills strong { font-weight: 800; }

[data-theme="y2k"] .card,
[data-theme="y2k"] .panel,
[data-theme="y2k"] .code-block {
  border: 2.5px solid var(--rule);
}

[data-theme="y2k"] .cards li:nth-child(4n + 1) .card { background: var(--pop-1); transform: rotate(-1.2deg); }
[data-theme="y2k"] .cards li:nth-child(4n + 2) .card { background: var(--pop-2); transform: rotate(1deg); }
[data-theme="y2k"] .cards li:nth-child(4n + 3) .card { background: var(--pop-3); transform: rotate(-0.6deg); }
[data-theme="y2k"] .cards li:nth-child(4n + 4) .card { background: var(--pop-4); transform: rotate(1.4deg); }

[data-theme="y2k"] .cards li:nth-child(n) a.card:hover {
  transform: rotate(0) translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--text);
}

[data-theme="y2k"] .card-kicker {
  align-self: flex-start;
  padding: 0.2rem 0.6rem;
  border: 2px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  letter-spacing: 0.08em;
}

[data-theme="y2k"] .card-title,
[data-theme="y2k"] .stat-value { font-weight: 800; }

[data-theme="y2k"] .stat q { font-style: normal; }

[data-theme="y2k"] dl.taglines dd {
  width: fit-content;
  max-width: 100%;
  padding: 0.45rem 0.85rem;
  border: 2px solid var(--rule);
  border-radius: 1rem 1rem 1rem 0.3rem;
  background: var(--surface);
  font-style: normal;
}

[data-theme="y2k"] .button {
  border: 2.5px solid var(--rule);
  box-shadow: 3px 3px 0 var(--text);
}

[data-theme="y2k"] .button:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--text);
}

[data-theme="y2k"] .spin-quote p { font-style: normal; font-weight: 800; }

[data-theme="y2k"] .endpoint { border-top: 2px dashed var(--rule); }
[data-theme="y2k"] .endpoint:last-of-type { border-bottom: 2px dashed var(--rule); }

[data-theme="y2k"] .timeline-label { color: var(--text); font-weight: 800; }
[data-theme="y2k"] .timeline-track { border: 2px solid var(--rule); border-radius: 999px; }
[data-theme="y2k"] .timeline-run { top: calc(50% - 1.5px); height: 3px; background: var(--rule); }
[data-theme="y2k"] .timeline-dot { width: 0.95rem; height: 0.95rem; border: 2px solid var(--rule); }

@media (max-width: 40rem) {
  .timeline .timeline-dot,
  [data-theme="y2k"] .timeline .timeline-dot { width: 0.6rem; height: 0.6rem; border-width: 1.5px; }
}

@media (prefers-reduced-motion: no-preference) {
  .spin-quote.is-new { animation: arrive 0.45s ease-out; }
}

@keyframes arrive {
  from { opacity: 0; transform: translateY(0.4rem) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .timeline-dot { transition: none; }
}
