/* Xennials Will Save the World — site styles.
   Built strictly on J4M5 tokens: no hard-coded colors in components. */

/* ---------- Utilities ---------- */
body { overflow-x: clip; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
section[id], #cred { scroll-margin-top: 84px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link { position: fixed; top: -64px; left: 12px; z-index: 100; transition: top .15s; }
.skip-link:focus-visible { top: 12px; }
.wrap { width: min(1160px, 100% - 40px); margin-inline: auto; }
.section { padding-block: 76px; }
.eyebrow { color: var(--gem-sapphire-deep); margin: 0 0 10px; }
.section-title {
  margin: 0 0 12px; font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.15;
}
.section-lede { margin: 0 0 34px; max-width: 62ch; font-size: 17px; color: var(--muted-foreground); }
p { text-wrap: pretty; }

/* ---------- Header ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--foreground); padding: 6px 10px; border-radius: var(--shape-pill); }
.brand:hover { background: var(--background); box-shadow: 2px 3px 0 var(--overprint); }
.brand-word { font-size: 14px; letter-spacing: 0.1em; }
.nav-links { display: flex; gap: 2px; margin-inline: auto; }
#theme-toggle { flex: none; }
#theme-toggle .icon-sun { display: none; }
#theme-toggle[data-mode="dark"] .icon-sun { display: block; }
#theme-toggle[data-mode="dark"] .icon-moon { display: none; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 40px; align-items: center; padding-top: 56px; padding-bottom: 24px;
}
.hero-title {
  margin: 0 0 18px; font-size: clamp(44px, 6.4vw, 72px); line-height: 1.02;
  max-width: 12ch;
}
.lede { margin: 0 0 26px; max-width: 58ch; font-size: 18px; line-height: 1.6; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 26px; }
.era-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 26px; }
.era-label { color: var(--muted-foreground); transition: color .2s; }
body[data-era="analog"] #era-label-analog,
body[data-era="digital"] #era-label-digital { color: var(--gem-sapphire-deep); }
#era-caption { flex-basis: 100%; margin: -4px 0 0; }
.dispatch {
  display: grid; gap: 6px; padding: 16px 20px; border-radius: var(--shape-tile);
  --surface: var(--mineral-sand-100); max-width: 58ch;
  box-shadow: inset 0 0 0 1px var(--border);
}
.dispatch-tag { color: var(--gem-topaz-deep); font-size: 11px; }
.dispatch p { margin: 0; font-size: 14.5px; line-height: 1.5; }

.hero-art { position: relative; min-height: 460px; }
.blob { position: absolute; display: block; }
.blob-a { width: 92%; top: 0; right: 0; }
.blob-b { width: 74%; top: 22%; right: 0; }
.blob-c { width: 34%; bottom: 4%; left: 2%; --dot: var(--gem-sapphire-glow); background: none; }
.hero-sticker-1 { position: absolute; top: 6%; left: 4%; background: var(--gem-topaz); color: var(--on-bright); }
.hero-sticker-2 { position: absolute; bottom: 44%; left: 0; background: var(--gem-sapphire); color: var(--on-gem); font-size: 11px; }

/* ---------- Cassette (CSS illustration) ---------- */
.cassette {
  position: relative; display: grid; gap: 12px; padding: 16px;
  border-radius: var(--shape-tile); box-shadow: inset 0 0 0 1.5px var(--border);
  --surface: var(--mineral-stone-100);
}
.hero-cassette { position: absolute; bottom: 0; right: 2%; width: min(300px, 80%); }
.cassette-label {
  display: grid; gap: 2px; padding: 10px 14px; border-radius: var(--shape-control);
  background: var(--background); box-shadow: inset 0 0 0 1px var(--border);
}
.cassette-label .j-slab { font-size: 12px; color: var(--foreground); }
.cassette-sub { font-size: 10px !important; color: var(--muted-foreground); }
.cassette-window {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 18px; border-radius: var(--shape-control);
  background: var(--secondary); box-shadow: inset 0 2px 0 oklch(0 0 0 / 0.08);
}
.reel {
  position: relative; width: 54px; height: 54px; flex: none;
  border-radius: var(--shape-pebble); background: var(--background);
  box-shadow: inset 0 0 0 2px var(--border);
}
.spoke {
  position: absolute; inset: 12px; border-radius: var(--shape-pebble);
  background:
    linear-gradient(var(--muted-foreground), var(--muted-foreground)) center / 2px 100% no-repeat,
    linear-gradient(var(--muted-foreground), var(--muted-foreground)) center / 100% 2px no-repeat;
  opacity: .55;
}
.tape-line { flex: 1; height: 3px; border-radius: 2px; background: var(--mineral-stone-500); opacity: .5; }
.cassette-screw { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--mineral-stone-500); opacity: .6; }
.cassette-screw.s1 { top: 7px; left: 7px; } .cassette-screw.s2 { top: 7px; right: 7px; }
.cassette-screw.s3 { bottom: 7px; left: 7px; } .cassette-screw.s4 { bottom: 7px; right: 7px; }
.cassette.spinning .spoke { animation: reel-spin 1.6s linear infinite; }
@keyframes reel-spin { to { transform: rotate(360deg); } }

/* ---------- The Case ---------- */
.case-grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-areas: "a q1" "b c" "q2 d"; gap: 26px; align-items: stretch;
}
.case-item { display: grid; gap: 10px; align-content: start; }
.case-item:nth-of-type(1) { grid-area: a; }
.case-item:nth-of-type(2) { grid-area: b; }
.case-item:nth-of-type(3) { grid-area: c; }
.case-item:nth-of-type(4) { grid-area: d; }
.case-num { color: var(--muted-foreground); font-size: 12px; }
.case-card { margin: 0; }
.case-card h3 { margin: 0; font-size: 22px; font-weight: 750; letter-spacing: -0.01em; }
.case-card p { margin: 0; max-width: 60ch; font-size: 15px; line-height: 1.6; }
.case-card .j-card-desc { font-size: 13.5px; }
.case-quote { display: grid; align-content: center; gap: 18px; padding: 26px; justify-items: start; }
.case-quote:nth-of-type(1) { grid-area: q1; }
.case-quote-2 { grid-area: q2; }
.pull { margin: 0; font-size: clamp(28px, 3.2vw, 38px); line-height: 1.15; max-width: 14ch; }
.case-quote .j-sticker { background: var(--gem-sapphire); color: var(--on-gem); }
.case-quote-2 .j-sticker { background: var(--gem-topaz); color: var(--on-bright); }
.term-note { margin-top: 30px; --surface: var(--mineral-sand-100); max-width: 88ch; }
.term-note span { line-height: 1.55; }

/* ---------- Hall of Fame ---------- */
.fame-rail {
  display: flex; gap: 4px; padding: 6px; border-radius: var(--shape-pill);
  overflow-x: auto; scrollbar-width: thin; max-width: 100%;
}
.fame-rail button {
  border: 0; background: transparent; padding: 9px 16px; border-radius: var(--shape-pill);
  font: 600 14px var(--font-sans); color: var(--muted-foreground); cursor: pointer; white-space: nowrap;
}
.fame-rail button:hover { color: var(--foreground); }
.fame-rail button[aria-selected="true"] {
  background: var(--background); color: var(--foreground); box-shadow: 2px 3px 0 var(--overprint);
}
.fame-count { margin: 12px 2px 18px; }
.fame-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.fame-card { margin: 0; --surface: var(--card); box-shadow: inset 0 0 0 1px var(--border); }
.fame-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.fame-card h3 { margin: 0; font-size: 19px; font-weight: 750; letter-spacing: -0.01em; }
.fame-card .j-sticker { font-size: 11px; padding: 3px 9px; background: var(--secondary); color: var(--secondary-foreground); flex: none; box-shadow: 1px 2px 0 var(--overprint); }
.fame-card .j-badge { align-self: flex-start; }
.fame-card p { margin: 0; font-size: 14.5px; line-height: 1.55; }
.fame-src { margin-top: auto; color: var(--muted-foreground); font-size: 12px; text-decoration: none; }
.fame-src:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Timeline ---------- */
.timeline { display: grid; gap: 8px; }
.tl-era { display: grid; gap: 16px; justify-items: start; }
.tl-era-tag { background: var(--secondary); color: var(--secondary-foreground); }
.tl-list {
  list-style: none; margin: 0 0 0 96px; padding: 0 0 0 26px;
  border-left: 2px solid var(--border); display: grid; gap: 12px; width: calc(100% - 96px);
}
.tl-row {
  position: relative; display: grid; gap: 4px; padding: 14px 18px;
  border-radius: var(--shape-tile); --surface: var(--card);
  box-shadow: inset 0 0 0 1px var(--border);
}
.tl-row::after {
  content: ""; position: absolute; left: -33px; top: 20px; width: 10px; height: 10px;
  border-radius: var(--shape-pebble); background: var(--mineral-chalk-500);
}
.tl-gem { --surface: var(--gem-sapphire-light); }
.tl-gem::after { background: var(--gem-sapphire); }
.tl-year { position: absolute; left: -122px; top: 16px; width: 88px; text-align: right; color: var(--muted-foreground); font-size: 12px; }
.tl-row p { margin: 0; font-size: 14.5px; line-height: 1.55; max-width: 68ch; }
.tl-hinge {
  margin: 26px 0 26px 96px; padding: 22px 26px; border-radius: var(--shape-card);
  --overprint: var(--gem-topaz-light); display: grid; gap: 6px; justify-items: start;
}
.tl-hinge .j-slab { color: var(--gem-topaz-deep); font-size: 11px; }
.tl-hinge-line { margin: 0; font-size: clamp(26px, 3vw, 34px); line-height: 1.1; }
.tl-hinge p:last-child { margin: 0; font-size: 14.5px; color: var(--muted-foreground); max-width: 56ch; }

/* ---------- The Test ---------- */
.test-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 30px; align-items: start; }
.test-intro .section-lede { margin-bottom: 24px; }
.cred-card { margin: 0; --surface: var(--mineral-sage-100); }
.cred-card h3 { margin: 0; font-size: 19px; font-weight: 750; }
.cred-card form { display: grid; gap: 16px; justify-items: start; }
.cred-card .j-field { width: 100%; }
.cred-result { display: grid; gap: 10px; justify-items: start; padding-top: 6px; border-top: 1px solid var(--border); }
.cred-result .j-sticker { font-size: 12px; }
.cred-result p { margin: 0; font-size: 14.5px; line-height: 1.55; }
.cred-sticker-yes { background: var(--gem-emerald); color: var(--on-gem); }
.cred-sticker-cusp { background: var(--gem-topaz); color: var(--on-bright); }
.cred-sticker-no { background: var(--secondary); color: var(--secondary-foreground); }

.quiz-card { margin: 0; min-height: 430px; }
.quiz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.quiz-head h3 { margin: 0; font-size: 21px; font-weight: 750; }
.quiz-progress { color: var(--muted-foreground); font-size: 11px; }
.quiz-dots { display: flex; gap: 7px; }
.quiz-dots span { width: 11px; height: 11px; border-radius: var(--shape-pebble); background: var(--secondary); box-shadow: inset 0 0 0 1px var(--border); transition: background-color .2s; }
.quiz-dots span.done { background: var(--primary); box-shadow: none; }
.quiz-q { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.4; }
.quiz-answers { display: grid; gap: 10px; }
.quiz-answer {
  height: auto; min-height: 48px; justify-content: flex-start; text-align: left;
  white-space: normal; padding: 12px 18px; border-radius: var(--shape-control);
  font-size: 14.5px; line-height: 1.4;
}
.quiz-answer:hover { background: var(--muted); }
#quiz-result { display: grid; gap: 14px; justify-items: start; }
.quiz-verdict-sticker { background: var(--gem-topaz); color: var(--on-bright); font-size: 13px; }
.quiz-verdict { margin: 0; font-size: clamp(28px, 3vw, 36px); line-height: 1.1; }
#quiz-verdict-copy { margin: 0; font-size: 15px; line-height: 1.6; max-width: 52ch; }
.quiz-result-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Mixtape ---------- */
.mix-layout { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 44px; align-items: center; }
.mix-cassette { width: 100%; }
.mix-controls { display: grid; gap: 14px; justify-items: start; }
.mix-controls .j-hint { margin: -6px 0 4px; }
.mix-secret { --surface: var(--mineral-heather-100); max-width: 46ch; }

/* ---------- The Ode ---------- */
.ode { padding-block: 96px 88px; }
.ode-lines { margin: 0; }
.ode-lines p {
  margin: 0; font-size: clamp(28px, 4.4vw, 48px); line-height: 1.28;
  letter-spacing: -0.015em; max-width: 24ch;
}
.ode-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 36px; }
.ode-sticker { background: var(--gem-sapphire); color: var(--on-gem); font-size: 13px; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--border); margin-top: 40px; padding-block: 40px 48px; }
.foot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.foot-grid .j-slab { margin: 0 0 8px; color: var(--foreground); font-size: 12px; }
.foot-copy { margin: 0; font-size: 13.5px; line-height: 1.6; max-width: 46ch; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 70; width: max-content; max-width: calc(100vw - 32px); }
#toast { margin: 0; }

/* ---------- Dialogs ---------- */
#tracklist-dialog { width: min(100%, 560px); }
.tracklist { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.tracklist .j-slab { margin: 0 0 8px; color: var(--gem-sapphire-deep); font-size: 12px; }
.tracklist ol { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.tracklist li { font-size: 13.5px; line-height: 1.45; }
.trail-choices { display: grid; gap: 10px; justify-items: start; }
#trail-dialog p { margin: 0; font-size: 15px; line-height: 1.55; }

/* ---------- Era modes ---------- */
body[data-era="analog"] { --offset-x: 9px; --offset-y: 10px; --halftone-size: 6px; }
body[data-era="digital"] { --offset-x: 4px; --offset-y: 5px; --halftone-size: 4px; }
body[data-era="digital"] .riso-misreg { text-shadow: none; }
body[data-era="digital"] .tl-gem::after { background: var(--gem-sapphire-glow); }
body[data-era="digital"] .quiz-dots span.done { background: var(--gem-sapphire-glow); }

/* ---------- Reveal (progressive enhancement: hidden only when JS is running) ---------- */
html.js-reveal .reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease-out, transform .5s ease-out; }
html.js-reveal .reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 40px; }
  .hero-art { min-height: 380px; order: 2; }
  .case-grid { grid-template-columns: 1fr; grid-template-areas: "a" "q1" "b" "c" "q2" "d"; }
  .test-layout { grid-template-columns: 1fr; }
  .mix-layout { grid-template-columns: 1fr; gap: 28px; }
  .foot-grid { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 899px) {
  .nav-links { display: none; }
  .j-nav { justify-content: space-between; }
}
@media (max-width: 767px) {
  html { scroll-padding-bottom: 96px; }
  .section { padding-block: 56px; }
  .site-foot { padding-bottom: 110px; }
  .toast-wrap { bottom: 86px; }
  .tl-list { margin-left: 0; width: 100%; padding-left: 20px; }
  .tl-year { position: static; width: auto; text-align: left; color: var(--gem-sapphire-deep); }
  .tl-row::after { left: -27px; }
  .tl-hinge { margin-left: 0; }
  .hero-art { min-height: 330px; }
  .hero-cassette { width: min(260px, 74%); }
  .tracklist { grid-template-columns: 1fr; }
  .ode-lines p { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html.js-reveal .reveal { opacity: 1; transform: none; transition: none; }
  .cassette.spinning .spoke { animation: none; }
}
