@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/plexmono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/plexmono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  /* Inkarnatrosé, RAL 010 85 20 */
  --rose: #eec7ce;
  --paper: #fbf6f3;
  --ink: #2a1e25;
  --muted: #5e4a54;
  --accent: #9e3d57;
  --on-accent: #fbf6f3;
  --surface: var(--rose);
  --line: rgba(42, 30, 37, 0.16);
  --rail: #b39aa5;

  /* departure board and the inverted NexusMods band */
  --board: #2a1e25;
  --board-fg: #eec7ce;
  --board-dim: #cdb5bd;
  --band: #2a1e25;
  --band-fg: #fbf6f3;
  --band-muted: #cdb5bd;
  --band-accent: #eec7ce;
  --band-card: #3a2a33;

  --serif: "Fraunces", Georgia, serif;
  --sans: "Figtree", system-ui, sans-serif;
  --mono: "Plex Mono", ui-monospace, monospace;

  --r-lg: 20px;
  --r-md: 10px;
  --r-sm: 4px;
  --bounce: cubic-bezier(0.3, 1.6, 0.5, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1e1519;
    --ink: #f6e9ec;
    --muted: #cdb5bd;
    --accent: #eec7ce;
    --on-accent: #1e1519;
    --surface: #4a2e37;
    --line: rgba(246, 233, 236, 0.16);
    --rail: #6e5560;
    --board: #120c0f;
    --band: #eec7ce;
    --band-fg: #2a1e25;
    --band-muted: #5e4a54;
    --band-accent: #84304a;
    --band-card: #f7e1e5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1e1519;
  --ink: #f6e9ec;
  --muted: #cdb5bd;
  --accent: #eec7ce;
  --on-accent: #1e1519;
  --surface: #4a2e37;
  --line: rgba(246, 233, 236, 0.16);
  --rail: #6e5560;
  --board: #120c0f;
  --band: #eec7ce;
  --band-fg: #2a1e25;
  --band-muted: #5e4a54;
  --band-accent: #84304a;
  --band-card: #f7e1e5;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 650;
  line-height: 1.05;
  margin: 0;
}

p { margin: 0; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
dd { margin: 0; }

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  width: min(100% - 32px, 68rem);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-md);
  z-index: 10;
}
.skip:focus { top: 12px; }

.mono,
.toggle { font-family: var(--mono); }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding-block: 1.25rem;
}

.mark-small {
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
}

.toggles { display: flex; gap: 0.5rem; }

.toggle {
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms, transform 200ms var(--bounce);
}
.toggle:hover { border-color: var(--accent); transform: translateY(-2px); }
.toggle:active { transform: translateY(1px); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  gap: 2.5rem;
  align-items: center;
  padding-block: 2rem 3rem;
}
@media (min-width: 900px) {
  .hero { grid-template-columns: 1.15fr 1fr; gap: 2.5rem 4rem; padding-block: 2rem 4rem; }
}

.wordmark {
  grid-column: 1 / -1;
  font-size: clamp(3.5rem, 17vw, 13rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 0.9;
  white-space: nowrap;
  margin-bottom: -0.5rem;
}
/* the rose bar the name sits on */
.letters {
  display: inline-block;
  background: linear-gradient(var(--surface), var(--surface)) 0 88% / 100% 0.32em no-repeat;
  padding-inline: 0.04em;
}
.letters span {
  display: inline-block;
  transition: transform 260ms var(--bounce), color 200ms;
}
/* each letter hops when the pointer touches it */
.letters span:hover { transform: translateY(-0.12em) rotate(-6deg); color: var(--accent); }
.letters span:nth-child(even):hover { transform: translateY(-0.1em) rotate(5deg); }

.tagline {
  font-size: clamp(1.3rem, 2.6vw, 1.65rem);
  line-height: 1.35;
  max-width: 30ch;
  font-weight: 500;
}
.about { margin-top: 1rem; max-width: 52ch; color: var(--muted); }

/* departure board: uppercase mono is the split-flap display style */
.board {
  background: var(--board);
  color: var(--board-fg);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.25rem 0.75rem;
  font-family: var(--mono);
  transform: rotate(1.2deg);
  transition: transform 300ms var(--bounce);
  box-shadow: 0 24px 50px -28px rgba(42, 30, 37, 0.8);
}
.board:hover,
.board:focus-within { transform: rotate(0deg); }

.board-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 0.75rem;
  border-bottom: 1.5px dashed rgba(238, 199, 206, 0.35);
}
.board-title {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--board-dim);
}
.board-clock { font-size: 1.1rem; color: var(--board-fg); }

.board-rows a {
  display: grid;
  grid-template-columns: 2.25rem 1fr auto;
  align-items: center;
  gap: 0.9rem;
  min-height: 56px;
  padding: 0.35rem 0.5rem;
  margin-inline: -0.5rem;
  color: var(--board-fg);
  text-decoration: none;
  border-radius: var(--r-md);
  transition: background-color 150ms;
}
.board-rows li + li a { border-top: 1px solid rgba(238, 199, 206, 0.14); border-radius: 0; }
.board-rows a:hover { background: rgba(238, 199, 206, 0.1); }
.board-rows a:hover .b-to { transform: translateX(4px); }

.b-gleis {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--rose);
  color: #2a1e25;
  border-radius: var(--r-sm);
  font-weight: 500;
}
.b-to {
  font-size: 1.15rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: transform 200ms var(--bounce);
  white-space: nowrap;
}
.b-info { font-size: 0.78rem; color: var(--board-dim); text-align: right; }

/* ---------- live stats ---------- */
.stats { padding-block: 1rem 3rem; }
.stats-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 1rem;
  padding-block: 1.5rem;
  border-block: 1.5px dashed var(--line);
}
@media (min-width: 760px) { .stats-list { grid-template-columns: repeat(4, 1fr); } }
.stats-list dt { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.stats-list dd {
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.25rem);
  line-height: 1.1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stats-src { margin-top: 0.6rem; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }

/* ---------- the line: track, train, stations ---------- */
.line { position: relative; }

.track { display: none; }

@media (min-width: 1240px) {
  .track {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 34rem - 3.5rem - 11px);
    width: 22px;
    z-index: 2;
    pointer-events: none;
    /* two rails and the sleepers between them */
    background:
      linear-gradient(var(--rail), var(--rail)) 3px 0 / 2px 100% no-repeat,
      linear-gradient(var(--rail), var(--rail)) 17px 0 / 2px 100% no-repeat,
      repeating-linear-gradient(to bottom, transparent 0 10px, var(--rail) 10px 13px) 0 0 / 22px 100% no-repeat;
  }
  .gleis::before {
    content: "";
    position: absolute;
    left: calc(-3.5rem - 12px);
    top: 50%;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    border-radius: 50%;
    background: var(--paper);
    border: 3px solid var(--rail);
    z-index: 3;
    transition: background-color 300ms, border-color 300ms, transform 300ms var(--bounce);
  }
  .stop-nexus .gleis::before { background: var(--band); }
  .reached .gleis::before { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
}

.train {
  position: absolute;
  left: -3px;
  top: 0;
  z-index: 4;
  will-change: transform;
  filter: drop-shadow(0 4px 6px rgba(42, 30, 37, 0.35));
}
.train-body { fill: var(--rose); stroke: #2a1e25; stroke-width: 2; }
.train-cab { fill: #2a1e25; }

.stop { position: relative; padding-block: 4rem; }
.stop:last-child { padding-bottom: 6rem; }

.gleis {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.gleis-no {
  display: grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  padding-inline: 0.4rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 1rem;
}

.section-head { display: grid; gap: 0.6rem; margin-bottom: 2rem; }
@media (min-width: 900px) {
  .section-head { grid-template-columns: auto 1fr; align-items: end; gap: 2.5rem; }
  .section-head p { max-width: 40ch; justify-self: end; text-align: right; }
}
.section-head h2 { display: flex; align-items: center; gap: 0.6rem; font-size: clamp(2.2rem, 5vw, 3.5rem); }
.section-head p { color: var(--muted); }

.brand { width: 1.2em; height: 1.2em; flex-shrink: 0; }
.brand-h { width: 0.8em; height: 0.8em; flex-shrink: 0; color: var(--accent); }
.brand-xl { width: clamp(4.5rem, 12vw, 7.5rem); height: clamp(4.5rem, 12vw, 7.5rem); flex-shrink: 0; color: var(--accent); }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 52px;
  padding: 0 1.4rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-md);
  font-weight: 650;
  font-size: 1.05rem;
  text-decoration: none;
  transition: transform 220ms var(--bounce);
}
.button:hover { transform: translateY(-3px) rotate(-1deg); }
.button:active { transform: translateY(1px); }

.more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 1.5rem;
  font-weight: 650;
}

/* ---------- Gleis 1: Twitch ---------- */
.twitch-card {
  display: grid;
  gap: 1.5rem;
  align-items: center;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: clamp(1.5rem, 4vw, 3rem);
  transform: rotate(-1deg);
  transition: transform 300ms var(--bounce);
}
.twitch-card:hover,
.twitch-card:focus-within { transform: rotate(0deg) scale(1.01); }
@media (min-width: 760px) { .twitch-card { grid-template-columns: auto 1fr; gap: 3rem; } }
.twitch-card h2 { font-size: clamp(2.2rem, 5vw, 3.5rem); margin-bottom: 0.75rem; }
.twitch-card p { max-width: 50ch; margin-bottom: 1.75rem; font-size: 1.1rem; }
.twitch-card .brand-xl { transition: transform 300ms var(--bounce); }
.twitch-card:hover .brand-xl { transform: rotate(-8deg) scale(1.06); }

/* ---------- Gleis 2: NexusMods (inverted band) ---------- */
.stop-nexus {
  background: var(--band);
  color: var(--band-fg);
  padding-block: 4.5rem 5rem;
  margin-block: 2rem;
  --accent: var(--band-accent);
  --muted: var(--band-muted);
  --on-accent: var(--band);
}

.mods {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}
@media (min-width: 900px) {
  .mods { grid-template-columns: repeat(4, 1fr); }
  .mod-top { grid-column: span 2; grid-row: span 2; }
}

.mod {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--band-card);
  color: var(--band-fg);
  border-radius: var(--r-md);
  overflow: hidden;
  text-decoration: none;
  transition: transform 260ms var(--bounce);
}
.mod:hover { transform: translateY(-4px) rotate(-0.6deg); }
.mods > :nth-child(odd) .mod:hover { transform: translateY(-4px) rotate(0.6deg); }
.mod-img {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: rgba(238, 199, 206, 0.12);
}
.mod-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms ease;
}
.mod:hover .mod-img img { transform: scale(1.06); }
.mod-body { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.9rem 1rem 1rem; flex: 1; }
.mod-name {
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 650;
  font-size: 1.15rem;
  line-height: 1.2;
}
.mod-sum { font-size: 0.95rem; color: var(--band-muted); }
.mod-meta { font-family: var(--mono); font-size: 0.75rem; color: var(--band-muted); margin-top: auto; padding-top: 0.4rem; }
/* the featured image fills whatever height the neighbouring tiles give it */
.mod-top .mod-img { aspect-ratio: auto; flex: 1; min-height: 14rem; }
.mod-top .mod-img img { position: absolute; inset: 0; }

/* phones: small mods become compact rows so the list stays short */
@media (max-width: 599px) {
  .mods > :not(.mod-top) .mod { flex-direction: row; align-items: stretch; }
  .mods > :not(.mod-top) .mod-img { width: 7.5rem; flex-shrink: 0; aspect-ratio: auto; }
  .mods > :not(.mod-top) .mod-img img { position: absolute; inset: 0; }
  .mods > :not(.mod-top) .mod-body { padding: 0.75rem 0.9rem; }
  .mods { gap: 0.75rem; }
}
.mod-top .mod-name { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.mod-top .mod-body { flex: 0; padding: 1.25rem 1.4rem 1.4rem; }
.mod-badge {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--r-sm);
  background: var(--band-accent);
  color: var(--band);
}

/* loading / empty / error */
.state:empty { display: none; }
.state {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.25rem 0;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--muted);
}
.state a { color: var(--accent); }
/* a little train shuttling along a sleeper line while data loads */
.loader {
  position: relative;
  width: 64px;
  height: 10px;
  flex-shrink: 0;
  background: repeating-linear-gradient(to right, currentColor 0 3px, transparent 3px 9px) 0 50% / 100% 2px no-repeat;
}
.loader::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 10px;
  border-radius: 4px;
  background: var(--accent);
  animation: shuttle 1.1s ease-in-out infinite alternate;
}
@keyframes shuttle { to { transform: translateX(46px); } }

/* ---------- Gleis 3: GitHub tickets ---------- */
.tickets {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
}
.ticket a {
  position: relative;
  display: grid;
  height: 100%;
  grid-template-rows: auto auto 1fr auto;
  gap: 0.4rem;
  padding: 1rem 1.25rem 1.1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 260ms var(--bounce), border-color 200ms, background-color 200ms;
  /* punched notches on both sides, like a paper ticket */
  -webkit-mask:
    radial-gradient(circle 9px at 0 2.6rem, transparent 98%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 9px at 100% 2.6rem, transparent 98%, #000) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle 9px at 0 2.6rem, transparent 98%, #000) left / 51% 100% no-repeat,
    radial-gradient(circle 9px at 100% 2.6rem, transparent 98%, #000) right / 51% 100% no-repeat;
}
.ticket:nth-child(3n + 1) a { --tilt: -0.7deg; }
.ticket:nth-child(3n + 2) a { --tilt: 0.5deg; }
.ticket a:hover { transform: translateY(-4px) rotate(0deg); border-color: var(--accent); background: var(--surface); }

.t-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.4rem;
  border-bottom: 2px dashed var(--line);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.t-name {
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 650;
  font-size: 1.3rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.t-desc { font-size: 0.95rem; color: var(--muted); }
.t-foot { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); padding-top: 0.6rem; }

/* ---------- Gleis 4: Instagram ---------- */
.insta-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem 2rem;
  align-items: center;
  padding: clamp(1.25rem, 3.5vw, 2.25rem);
  border: 2px solid var(--ink);
  border-radius: var(--r-lg);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 200ms, transform 260ms var(--bounce);
}
.insta-card:hover { background: var(--surface); transform: rotate(0.8deg); }
.insta-card .brand-xl { width: clamp(3.5rem, 9vw, 5.5rem); height: clamp(3.5rem, 9vw, 5.5rem); transition: transform 300ms var(--bounce); }
.insta-card:hover .brand-xl { transform: rotate(10deg) scale(1.08); }
.insta-body { display: grid; gap: 0.3rem; min-width: 0; }
.insta-h {
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 700;
  font-size: clamp(1.8rem, 4.5vw, 2.75rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.insta-text { color: var(--muted); }
.insta-go { grid-column: 1 / -1; font-weight: 650; color: var(--accent); }
@media (min-width: 760px) {
  .insta-card { grid-template-columns: auto 1fr auto; }
  .insta-go { grid-column: auto; }
}

/* ---------- footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding-block: 2rem 2.5rem;
  border-top: 1.5px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.legal { display: flex; gap: 1.25rem; margin-left: auto; }
.legal a { display: inline-flex; align-items: center; min-height: 44px; }

.fallback {
  margin-block: 2rem;
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--accent);
  border-radius: var(--r-md);
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after { transition: none !important; animation: none !important; }
}
