/* A Brief History of AI - design system */

:root {
  --bg: #07070b;
  --bg-soft: #0d0d14;
  --ink: #ece8df;
  --dim: #9a94a6;
  --faint: #55505f;
  --line: rgba(236, 232, 223, 0.12);
  --accent: #c9a55c;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Space Grotesk", -apple-system, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--bg); }

/* ---------- WebGL canvas ---------- */
#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- HUD: year odometer + progress rail ---------- */
#hud {
  position: fixed;
  right: 28px;
  bottom: 24px;
  z-index: 50;
  text-align: right;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#hud.on { opacity: 1; }
#year-counter {
  font-family: var(--mono);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color 0.8s ease;
}
#era-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--dim);
  margin-top: 6px;
}

#rail {
  position: fixed;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#rail.on { opacity: 1; }
#rail a {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--faint);
  background: transparent;
  display: block;
  transition: all 0.35s ease;
  pointer-events: auto;
}
#rail a:hover { border-color: var(--ink); transform: scale(1.4); }
#rail a.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 60;
  transition: background 0.8s ease;
}

/* ---------- Language toggle ---------- */
#lang-toggle {
  position: fixed;
  top: 18px;
  right: 28px;
  z-index: 70;
  display: flex;
  gap: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  background: rgba(13, 13, 20, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  backdrop-filter: blur(8px);
}
#lang-toggle a {
  color: var(--dim);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 999px;
  transition: all 0.25s ease;
}
#lang-toggle a:hover { color: var(--ink); }
#lang-toggle a.active {
  color: var(--bg);
  background: var(--accent);
}
@media (max-width: 720px) {
  #lang-toggle { top: 12px; right: 12px; }
}

/* ---------- Hero ---------- */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8vw;
  z-index: 2;
}
#hero .kicker {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 26px;
}
#hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(52px, 9.5vw, 138px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  max-width: 12ch;
}
#hero h1 em {
  font-style: italic;
  color: var(--accent);
  transition: color 0.8s ease;
}
#hero .sub {
  margin-top: 34px;
  max-width: 46ch;
  font-size: 19px;
  color: var(--dim);
}
#hero .scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 8vw;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 12px;
}
.scroll-hint .bar {
  width: 60px; height: 1px;
  background: var(--faint);
  position: relative;
  overflow: hidden;
}
.scroll-hint .bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  animation: hint 2.2s ease-in-out infinite;
}
@keyframes hint {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

/* ---------- Chapters ---------- */
.chapter {
  position: relative;
  z-index: 2;
  padding: 18vh 8vw 12vh;
}
.chapter-head { max-width: 1100px; }
.chapter .index-line {
  display: flex;
  align-items: baseline;
  gap: 20px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}
.chapter .index-line .rule {
  flex: 0 0 64px;
  height: 1px;
  background: var(--accent);
  opacity: 0.7;
}
.chapter .years {
  color: var(--dim);
  letter-spacing: 0.14em;
}
.chapter h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(40px, 6.4vw, 96px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  max-width: 16ch;
}
.chapter h2 .accent { color: var(--accent); font-style: italic; }

.prose {
  max-width: 62ch;
  margin-top: 42px;
  font-size: 18px;
  color: #cfcbc2;
}
.prose p + p { margin-top: 1.35em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose .drop::first-letter {
  font-family: var(--serif);
  font-size: 3.4em;
  float: left;
  line-height: 0.85;
  padding-right: 10px;
  color: var(--accent);
}
.prose a { color: var(--accent); text-underline-offset: 3px; }

.offset-right { margin-left: auto; margin-right: 0; }
@media (min-width: 1000px) {
  .two-col {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 6vw;
    align-items: start;
  }
}

/* ---------- Figures ---------- */
figure.shot {
  margin: 9vh 0;
  position: relative;
}
figure.shot .frame {
  overflow: hidden;
  border-radius: 4px;
  clip-path: inset(0 0 100% 0);
  aspect-ratio: 1376 / 768;
}
figure.shot.wide .frame { aspect-ratio: 1584 / 672; }
figure.shot img,
figure.shot video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.12);
  will-change: transform;
}
figure.shot figcaption {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
figure.shot figcaption .tag { color: var(--accent); }
figure.shot.wide { margin-left: -8vw; margin-right: -8vw; }
figure.shot.wide figcaption { padding: 0 8vw; }
figure.shot.narrow { max-width: 760px; }

/* ---------- Pull quote ---------- */
.pull {
  margin: 10vh auto;
  max-width: 900px;
  position: relative;
  padding-left: 34px;
}
.pull::before {
  content: "";
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--accent);
}
.pull blockquote {
  font-family: var(--serif);
  font-size: clamp(24px, 3.2vw, 40px);
  font-weight: 400;
  font-style: italic;
  line-height: 1.25;
  color: var(--ink);
}
.pull cite {
  display: block;
  margin-top: 18px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--dim);
}

/* ---------- Artifacts: tweets ---------- */
.artifacts {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin: 8vh 0;
  align-items: flex-start;
}
.artifacts > * { flex: 1 1 340px; max-width: 480px; }
.artifacts .push { margin-top: 54px; }

.tweet {
  background: #101019;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  font-family: var(--sans);
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.tweet:hover { transform: translateY(-3px); border-color: rgba(236,232,223,0.28); }
.tweet .t-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.tweet .avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  flex-shrink: 0;
}
.tweet .who { line-height: 1.25; }
.tweet .who .name { font-weight: 700; font-size: 15px; color: var(--ink); }
.tweet .who .name .check { color: #1d9bf0; font-size: 13px; }
.tweet .who .handle { font-size: 13.5px; color: var(--dim); }
.tweet .t-body { font-size: 16px; line-height: 1.45; color: #e7e9ea; white-space: pre-line; }
.tweet .t-date {
  margin-top: 12px;
  font-size: 13px;
  color: var(--faint);
}
.tweet .t-stats {
  display: flex;
  gap: 22px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--dim);
  font-family: var(--mono);
}

/* ---------- Artifacts: reddit ---------- */
.reddit {
  background: #0f1113;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  font-family: var(--sans);
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.reddit:hover { transform: translateY(-3px); border-color: rgba(236,232,223,0.28); }
.reddit .r-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--dim);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.reddit .r-head .sub { color: #ff4500; font-weight: 700; }
.reddit .r-title { font-weight: 600; font-size: 16.5px; line-height: 1.35; margin-bottom: 10px; color: var(--ink); }
.reddit .r-body { font-size: 15px; color: #c8cbcd; line-height: 1.5; white-space: pre-line; }
.reddit .r-foot {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  font-size: 12.5px;
  font-family: var(--mono);
  color: var(--dim);
}
.reddit .r-foot .up { color: #ff4500; }

/* ---------- Artifacts: newspaper ---------- */
.clipping {
  background: #efe6d3;
  color: #24201a;
  padding: 30px 30px 26px;
  border-radius: 2px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
  transform: rotate(-1.2deg);
  font-family: Georgia, "Times New Roman", serif;
  transition: transform 0.3s ease;
}
.clipping:hover { transform: rotate(0deg) scale(1.01); }
.clipping .paper-name {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;
  border-bottom: 2px solid #24201a;
  padding-bottom: 8px;
  margin-bottom: 14px;
}
.clipping h4 {
  font-size: 26px;
  line-height: 1.12;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.clipping p { font-size: 14.5px; line-height: 1.5; color: #3a342b; }
.clipping .dateline { font-style: italic; font-size: 12.5px; margin-top: 12px; color: #6e6353; }

/* ---------- Terminal / ELIZA ---------- */
.terminal {
  background: #050805;
  border: 1px solid #1d3a22;
  border-radius: 8px;
  overflow: hidden;
  max-width: 680px;
  margin: 8vh 0;
  box-shadow: 0 0 60px rgba(60, 255, 120, 0.06), inset 0 0 80px rgba(40, 220, 100, 0.04);
}
.terminal .t-bar {
  background: #0b120c;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #58c97a;
  border-bottom: 1px solid #1d3a22;
  display: flex;
  justify-content: space-between;
}
.terminal .t-screen {
  padding: 20px 22px;
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 1.7;
  color: #7dff9f;
  min-height: 240px;
  max-height: 340px;
  overflow-y: auto;
  text-shadow: 0 0 8px rgba(125, 255, 159, 0.35);
}
.terminal .t-screen .you { color: #d9ffe4; }
.terminal .t-screen .you::before { content: "> "; color: #58c97a; }
.terminal .t-input {
  display: flex;
  border-top: 1px solid #1d3a22;
  background: #070c08;
}
.terminal .t-input span {
  padding: 12px 0 12px 22px;
  font-family: var(--mono);
  color: #58c97a;
  font-size: 14.5px;
}
.terminal input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #d9ffe4;
  font-family: var(--mono);
  font-size: 14.5px;
  padding: 12px 22px 12px 8px;
  text-shadow: 0 0 8px rgba(125, 255, 159, 0.35);
}
.terminal-note {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  margin-top: 12px;
  letter-spacing: 0.06em;
}

/* ---------- Stat blocks ---------- */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 9vh 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat {
  flex: 1 1 220px;
  padding: 34px 28px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: none; }
.stat .num {
  font-family: var(--serif);
  font-size: clamp(38px, 4.6vw, 64px);
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat .lbl {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---------- Winter chapter treatment ---------- */
#ch-winter { position: relative; }
#ch-winter .frost {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(140, 190, 235, 0.07), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(140, 190, 235, 0.05), transparent 50%);
}

/* ---------- Horizontal acceleration strip ---------- */
#accel-wrap { position: relative; z-index: 2; }
#accel-pin { overflow: hidden; }
#accel-track {
  display: flex;
  gap: 30px;
  padding: 0 8vw;
  align-items: stretch;
  width: max-content;
}
.accel-card {
  width: 380px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
}
.accel-card .ac-date {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.accel-card h4 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 12px;
}
.accel-card p { font-size: 15px; color: var(--dim); line-height: 1.55; }
.accel-card .ac-foot {
  margin-top: auto;
  padding-top: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}
.accel-card.shock { border-color: rgba(255, 93, 93, 0.4); }
.accel-card.shock .ac-date { color: #ff5d5d; }

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  margin: 10vh 0 4vh;
  position: relative;
  z-index: 2;
}
.marquee .m-track {
  display: flex;
  gap: 48px;
  width: max-content;
  animation: marquee 36s linear infinite;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}
.marquee .m-track b { color: var(--accent); font-weight: 500; }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- Chart ---------- */
.chart-block {
  max-width: 860px;
  margin: 8vh 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 30px 30px 20px;
}
.chart-block h4 {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 6px;
}
.chart-block .chart-big {
  font-family: var(--serif);
  font-size: 40px;
  color: #ff5d5d;
  margin-bottom: 14px;
}
.chart-block svg { width: 100%; height: auto; display: block; }
.chart-block .chart-caption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  margin-top: 12px;
}

/* ---------- Epilogue ---------- */
#epilogue {
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#epilogue .closing {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 52px);
  font-style: italic;
  line-height: 1.3;
  max-width: 22ch;
}
#epilogue .cursor-line {
  margin-top: 40px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--accent);
}
#epilogue .cursor-line::after {
  content: "▋";
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Footer ---------- */
footer {
  position: relative;
  z-index: 2;
  padding: 8vh 8vw 6vh;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--faint);
  line-height: 1.9;
}
footer .cols {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  justify-content: space-between;
}
footer a { color: var(--dim); }

/* ---------- Reveal helpers (GSAP targets) ---------- */
.reveal-line { overflow: hidden; display: block; }
.reveal-line > span { display: block; transform: translateY(110%); }
.fade-up { opacity: 0; transform: translateY(36px); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal-line > span { transform: none; }
  .fade-up { opacity: 1; transform: none; }
  figure.shot .frame { clip-path: none; }
  figure.shot img { transform: none; }
  .marquee .m-track { animation: none; }
  #gl { display: none; }
}

@media (max-width: 720px) {
  #rail { display: none; }
  #year-counter { font-size: 30px; }
  .chapter { padding: 14vh 6vw 10vh; }
  #hero { padding: 0 6vw; }
  figure.shot.wide { margin-left: -6vw; margin-right: -6vw; }
  .accel-card { width: 300px; }
}
