/* ---------- fonts (SIL Open Font License) ---------- */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

/* Colors from the "Sweetie 16" pixel art palette. */
:root {
  --bg: #1a1c2c;
  --bg-card: #333c57;
  --ink: #0b0c14;
  --text: #f4f4f4;
  --muted: #94b0c2;
  --line: #566c86;
  --shadow: #000;

  --precursors: #73eff7;
  --early90s: #ffcd75;
  --late90s: #ef7d57;
  --s2000s: #a7f070;
  --modern: #41a6f6;

  --px: 4px; /* size of one "pixel" */

  --font-title: "IBM Plex Mono", monospace;
  --font-body: "IBM Plex Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  font: 16px/1.6 var(--font-body);
  background-color: var(--bg);
  /* faint checkerboard */
  background-image: repeating-conic-gradient(#1f2236 0 25%, transparent 0 50%);
  background-size: 32px 32px;
}

/* CRT scanlines over the whole page */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .18) 2px 4px);
  z-index: 100;
}

a { color: var(--early90s); }
a:hover { color: var(--text); background: var(--late90s); }

/* Pixel box: a 4px border with cut corners and a stepped drop shadow.
   Used by cards, era titles, buttons and year boxes. */
.event, .era-title, .era-nav button, .year {
  --b: var(--ink);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--b),
    0 var(--px) 0 0 var(--b),
    calc(var(--px) * -1) 0 0 0 var(--b),
    var(--px) 0 0 0 var(--b),
    calc(var(--px) * 2) var(--px) 0 0 var(--shadow),
    var(--px) calc(var(--px) * 2) 0 0 var(--shadow);
}

/* ---------- hero ---------- */
.hero {
  text-align: center;
  padding: 4.5rem 1.5rem 3rem;
  border-bottom: var(--px) dashed var(--line);
}
.eyebrow {
  margin: 0;
  color: var(--s2000s);
  font: 600 .85rem/1 var(--font-title);
  text-transform: uppercase;
  letter-spacing: .2em;
}
.hero h1 {
  font: 600 clamp(1.8rem, 5vw, 3.2rem)/1.2 var(--font-title);
  margin: 1.4rem 0 1.6rem;
  text-shadow: var(--px) var(--px) 0 #5d275d;
}
.hero h1 span {
  color: var(--early90s);
  text-shadow: var(--px) var(--px) 0 #b13e53;
}
.cursor {
  font-style: normal;
  color: var(--s2000s);
  text-shadow: none;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.lead {
  max-width: 44rem;
  margin: 0 auto 2.2rem;
  color: var(--muted);
  font-size: 1.05rem;
}

/* ---------- era nav ---------- */
.era-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.2rem;
}
.era-nav button {
  font: .85rem/1 var(--font-title);
  color: var(--text);
  background: var(--bg-card);
  border: 0;
  padding: .7rem 1.1rem;
  cursor: pointer;
}
.era-nav button:hover { background: #3b5dc9; }
.era-nav button:active { transform: translate(var(--px), var(--px)); }
.era-nav button.active { background: var(--early90s); color: var(--bg); }

/* ---------- era colors ---------- */
[data-era="precursors"] { --c: var(--precursors); }
[data-era="early90s"]   { --c: var(--early90s); }
[data-era="late90s"]    { --c: var(--late90s); }
[data-era="2000s"]      { --c: var(--s2000s); }
[data-era="modern"]     { --c: var(--modern); }

/* ---------- timeline ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem; }

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 4rem;
  align-items: start;
}
/* dashed pixel line in the middle */
.timeline::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: var(--px);
  transform: translateX(-50%);
  background: repeating-linear-gradient(var(--line) 0 12px, transparent 12px 20px);
}

.era-title {
  --b: var(--c);
  grid-column: 1 / -1;
  position: relative;
  z-index: 1;
  justify-self: center;
  text-align: center;
  margin: 2.5rem 0 2rem;
  padding: 1rem 1.6rem .8rem;
  background: var(--bg);
  scroll-margin-top: 1rem;
}
.era-title span {
  display: block;
  color: var(--c);
  font: 600 1.35rem/1.2 var(--font-title);
}
.era-title small {
  display: block;
  color: var(--muted);
  font: .85rem/1.3 var(--font-body);
  margin-top: .3rem;
}

.event {
  position: relative;
  background: var(--bg-card);
  border-top: calc(var(--px) * 2) solid var(--c);
  padding: 1rem 1.3rem 1.2rem;
  margin-bottom: 2rem;
  transition: transform .3s steps(3), opacity .3s steps(3);
}

/* alternate sides: JS sets .left/.right, nth-of-type is the no-JS fallback */
.event:nth-of-type(odd):not(.right), .event.left { grid-column: 1; }
.event:nth-of-type(even):not(.left), .event.right { grid-column: 2; margin-top: 3rem; }

/* square dot on the line */
.event::before {
  content: "";
  position: absolute;
  top: 1rem;
  width: 20px; height: 20px;
  background: var(--bg);
  border: var(--px) solid var(--c);
}
.event:nth-of-type(odd):not(.right)::before, .event.left::before { right: -42px; }
.event:nth-of-type(even):not(.left)::before, .event.right::before { left: -42px; }

.event.major::before { background: var(--c); outline: var(--px) solid var(--bg); }
.event.major { background: #3b4669; }
/* blinking pixel after the title of key events */
.event.major h3::after {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  margin-left: .5em;
  background: var(--c);
  animation: blink 1.2s steps(1) infinite;
}

.event time {
  display: inline-block;
  color: var(--c);
  font: 600 .85rem/1.4 var(--font-title);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.event h3 {
  margin: .3rem 0 .6rem;
  font: 600 1.15rem/1.3 var(--font-title);
}
.event p { margin: 0; color: #dfe6ec; }
.event strong { color: var(--c); font-weight: 600; }

/* card images */
.event figure {
  margin: -1rem -1.3rem 1rem;
  background: var(--ink);
  border-bottom: var(--px) solid var(--ink);
  overflow: hidden;
}
.event figure a { display: block; }
.event figure a:hover { background: none; }
/* Images are 480px wide: shown at their real size, never stretched.
   Tall images are cropped (not resized) by max-height + object-fit.
   On small screens they only shrink. */
.event img {
  display: block;
  margin: 0 auto;
  width: min(100%, 480px);
  height: auto;
  max-height: 260px;
  object-fit: cover;
  object-position: top;
}
.event figcaption {
  padding: .4rem 1.3rem .5rem;
  font-size: .75rem;
  color: var(--muted);
}
.event figcaption a { color: var(--muted); }

/* scroll reveal (only when JS is on) */
.js .event.hidden { opacity: 0; transform: translateY(24px); }

/* era filter */
.filtered-out { display: none !important; }

/* ---------- releases grid ---------- */
.releases { margin-top: 5rem; }
.releases h2 {
  font: 600 1.7rem/1.3 var(--font-title);
  margin-bottom: .8rem;
  text-shadow: var(--px) var(--px) 0 #5d275d;
}
.note { color: var(--muted); margin-top: 0; }

.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.6rem;
  margin-top: 2rem;
  align-items: start;
}
.year {
  background: var(--bg-card);
  border-top: var(--px) solid var(--c);
  padding: .8rem 1rem;
}
.year b { color: var(--c); font: 600 1.1rem/1.4 var(--font-title); }
.year ul { margin: .4rem 0 0; padding: 0; list-style: none; font-size: .85rem; color: #dfe6ec; }
.year li::before { content: "> "; color: var(--c); }

/* ---------- footer ---------- */
footer {
  border-top: var(--px) dashed var(--line);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
footer p { max-width: 50rem; margin: 0 auto; }

/* ---------- mobile: one column, line on the left ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .timeline { grid-template-columns: 1fr; padding-left: 1.8rem; }
  .timeline::before { left: 8px; transform: none; }
  .era-title { justify-self: start; margin-left: -1.8rem; }
  /* !important: beat the left/right selectors above */
  .event { grid-column: 1 !important; margin-top: 0 !important; }
  .event::before { left: -1.8rem !important; right: auto !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .event { transition: none; }
  .cursor, .event.major h3::after { animation: none; }
  .js .event.hidden { opacity: 1; transform: none; }
}
