/* Strip website styles.
 *
 * Sections: tokens · base · layout · components · hero · explainer (stage + player) · page sections.
 * The stage geometry (tile size, step, film top) mirrors the constants in explainer.js; keep the
 * two in sync when changing either.
 */

/* Tokens ------------------------------------------------------------------------------------- */

:root {
  color-scheme: dark;

  --bg: #0b0b11;
  --bg-glow: #15161f;
  --surface: #191920;
  --surface-bar: #23232b;
  --border: rgb(255 255 255 / 0.1);
  --border-strong: rgb(255 255 255 / 0.18);
  --fill: rgb(255 255 255 / 0.06);

  --text: #f4f4f8;
  --text-soft: #cfcfd8;
  --text-muted: #9a9aa6;
  --text-faint: #6a6a76;

  --blue: #9cc0ff;
  --violet: #b58cf2;
  --gold: #ffd479;
  --rose: #ff7a90;
  --mint: #5fc9a0;
  --indigo: #7aa2f7;
  --orange: #ffb27a;
  --on-accent: #0e0e14;

  --font-sans: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius-sm: 9px;
  --radius: 13px;
  --gutter: 16px;
  --max-width: 1120px;

  /* The film's "roll" easing, shared by the stage and its transitions. */
  --ease-film: cubic-bezier(0.4, 0.82, 0.32, 1);
}

@media (min-width: 720px) {
  :root { --gutter: 28px; }
}

/* Any element can set the local accent with data-tone; .pill and .scene read --tone. */
[data-tone="blue"] { --tone: var(--blue); }
[data-tone="violet"] { --tone: var(--violet); }
[data-tone="gold"] { --tone: var(--gold); }
[data-tone="rose"] { --tone: var(--rose); }
[data-tone="mint"] { --tone: var(--mint); }
[data-tone="indigo"] { --tone: var(--indigo); }
[data-tone="orange"] { --tone: var(--orange); }

/* Base --------------------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--text); line-height: 1.15; margin: 0; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.4rem); letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; }
p { margin: 0; }

a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: #c2d8ff; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--fill);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85em;
  text-align: center;
}

code { font-family: var(--font-mono); font-size: 0.9em; }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: var(--on-accent);
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Layout ------------------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: calc(760px + 2 * var(--gutter)); }

.section { padding-block: clamp(56px, 9vw, 104px); scroll-margin-top: 56px; /* sticky header */ }
.section + .section { border-top: 1px solid rgb(255 255 255 / 0.05); }

.section__header { display: grid; gap: 12px; margin-bottom: clamp(28px, 4vw, 44px); max-width: 680px; }
.section__header > p:not(.pill) { color: var(--text-muted); font-size: 1.05rem; }
.section__header--center { margin-inline: auto; text-align: center; justify-items: center; }

/* Components --------------------------------------------------------------------------------- */

.pill {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 20px;
  background: var(--tone, var(--blue));
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}
.pill--blue { --tone: var(--blue); }
.pill--outline {
  background: color-mix(in srgb, var(--tone) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 34%, transparent);
  color: var(--tone, var(--blue));
  letter-spacing: 0.05em;
  text-transform: none;
  font-weight: 600;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.2s;
}
.button:hover { transform: translateY(-1px); }
.button--primary { background: var(--blue); color: #0c0c12; }
.button--primary:hover { background: #b5d0ff; color: #0c0c12; }
.button--ghost { background: var(--fill); border: 1px solid var(--border); color: var(--text); }
.button--ghost:hover { background: rgb(255 255 255 / 0.1); color: var(--text); }

.icon-button {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--fill);
  color: var(--text);
  font: 600 0.9rem var(--font-sans);
  cursor: pointer;
}
.icon-button:hover { background: rgb(255 255 255 / 0.1); }
.icon-button--wide { min-width: 96px; }

.muted { color: var(--text-muted); font-size: 0.92rem; }

/* Site header & footer ----------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(11 11 17 / 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgb(255 255 255 / 0.05);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }

.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand:hover { color: var(--text); }
.brand__mark { width: 16px; height: 16px; border-radius: 4px; background: linear-gradient(135deg, var(--blue), var(--violet)); }

.site-nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 26px); font-size: 0.9rem; }
.site-nav a { color: var(--text-muted); text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.site-nav__github {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--fill);
}
@media (max-width: 760px) {
  .site-nav__secondary { display: none; }
}
/* On phones, keep only the GitHub link; the page is a single scroll anyway. */
@media (max-width: 560px) {
  .site-nav a:not(.site-nav__github) { display: none; }
}

.site-footer { border-top: 1px solid rgb(255 255 255 / 0.05); padding-block: 32px; font-size: 0.9rem; color: var(--text-faint); }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a { color: var(--text-muted); }

/* Hero --------------------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(88px, 14vw, 168px) clamp(72px, 10vw, 128px);
  background:
    radial-gradient(rgb(255 255 255 / 0.045) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(120% 90% at 50% 0%, var(--bg-glow) 0%, var(--bg) 60%);
  text-align: center;
}
.hero__content { position: relative; display: grid; justify-items: center; gap: 20px; }
.hero__title { font-size: clamp(2.5rem, 7.5vw, 4.4rem); font-weight: 800; letter-spacing: -0.02em; }
.hero__lead { max-width: 600px; color: var(--text-muted); font-size: clamp(1.05rem, 2vw, 1.15rem); text-wrap: pretty; }
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 12px; }
.hero__note { color: var(--text-faint); font-size: 0.85rem; }

/* Decorative film drifting behind the hero text; filled by explainer.js. */
.hero__drift {
  position: absolute;
  inset: 26% 0 auto;
  height: 132px;
  overflow: hidden;
  opacity: 0.14;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
}
.hero__drift-track { display: flex; gap: 22px; width: max-content; animation: film-drift 60s linear infinite; }
.hero__drift .window-tile { position: relative; flex: none; width: 168px; height: 108px; }
.hero__drift .window-tile__titlebar,
.hero__drift .window-tile__line { display: none; }
.hero__drift .window-tile__accent { top: 0; }
.hero__drift .window-tile__glyph { font-size: 42px; opacity: 0.6; }

@keyframes film-drift {
  to { transform: translateX(-50%); }
}

/* Window tile (shared by hero + stage) ------------------------------------------------------- */

.window-tile {
  --tile-accent: var(--blue);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.45);
}
.window-tile__titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  background: var(--surface-bar);
  border-bottom: 1px solid rgb(255 255 255 / 0.05);
}
.window-tile__light { width: 8px; height: 8px; border-radius: 50%; background: #ff5f57; }
.window-tile__light:nth-child(2) { background: #febc2e; }
.window-tile__light:nth-child(3) { background: #28c840; }
.window-tile__title { margin-left: 5px; color: var(--text-soft); font-size: 12px; font-weight: 600; }
.window-tile__accent { position: absolute; left: 0; right: 0; top: 26px; height: 3px; background: var(--tile-accent); }
.window-tile__line { position: absolute; left: 14px; right: 14px; top: 44px; height: 9px; border-radius: 5px; background: rgb(255 255 255 / 0.1); }
.window-tile__line--short { top: 62px; right: 46px; background: rgb(255 255 255 / 0.06); }
.window-tile__glyph {
  position: absolute;
  right: 14px;
  bottom: 8px;
  color: var(--tile-accent);
  font-size: 58px;
  font-weight: 800;
  line-height: 1;
  opacity: 0.18;
}

/* Explainer: player ---------------------------------------------------------------------------- */

.explainer__player {
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(rgb(255 255 255 / 0.04) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(120% 100% at 50% 0%, var(--bg-glow) 0%, var(--bg) 70%);
  overflow: hidden;
}
.explainer__player:focus-visible { outline-offset: 4px; border-radius: 20px; }

.scenes { list-style: none; margin: 0; padding: clamp(20px, 4vw, 36px); display: grid; gap: 40px; }
.scene { display: grid; gap: 12px; max-width: 680px; }
.scene__tags { display: flex; flex-wrap: wrap; gap: 10px; }
.scene h3 { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -0.01em; }
.scene p:not(.scene__tags) { color: var(--text-muted); font-size: 1.02rem; text-wrap: pretty; }

/* Without JavaScript the scenes read as a plain list and the stage/controls stay hidden. */
.no-js .stage,
.no-js .player-controls { display: none; }

/* With JavaScript, one centered scene card at a time. */
.js .scenes { display: block; min-height: 12.5rem; padding-top: 8px; text-align: center; }
@media (max-width: 560px) {
  .js .scenes { min-height: 19rem; } /* room for the longest scene so controls don't jump */
}
.js .scene { display: none; margin-inline: auto; justify-items: center; }
.js .scene.is-active { display: grid; animation: scene-in 0.5s ease; }

@keyframes scene-in {
  from { opacity: 0; transform: translateY(10px); }
}

.player-controls { display: grid; justify-items: center; gap: 14px; padding: 0 16px 28px; }
.player-controls__dots { display: flex; gap: 6px; }
.player-controls__dot {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.player-controls__dot::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: auto;
  border-radius: 5px;
  background: rgb(255 255 255 / 0.22);
  transition: width 0.3s, background-color 0.3s;
}
.player-controls__dot[aria-current="step"] { width: 34px; }
.player-controls__dot[aria-current="step"]::before { width: 22px; background: var(--tone, var(--blue)); }
.player-controls__buttons { display: flex; align-items: center; gap: 10px; }
.player-controls__counter { margin-left: 8px; color: var(--text-faint); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

/* Explainer: stage ------------------------------------------------------------------------------
 * A fixed logical canvas (height 320, width set by JS) scaled to the container. All positions
 * inside are in stage units; see the geometry constants in explainer.js.
 */

.stage {
  position: relative;
  height: calc(320px * var(--stage-scale, 1));
  overflow: hidden;
  cursor: pointer;
}
.stage__canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--stage-width, 1040px);
  height: 320px;
  transform: scale(var(--stage-scale, 1));
  transform-origin: 0 0;
}

.film {
  position: absolute;
  left: 0;
  top: 70px;
  transition: transform 0.9s var(--ease-film);
}
.film__sprockets {
  position: absolute;
  left: -456px;
  width: 2508px;
  height: 14px;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--bg) 0 9px, #23232c 9px 24px);
  opacity: 0.85;
}
.film__sprockets--top { top: -22px; }
.film__sprockets--bottom { top: 166px; }

.stage .window-tile {
  position: absolute;
  top: 0;
  width: 210px;
  height: 158px;
  transition: opacity 0.6s ease, box-shadow 0.6s ease;
}
.stage .window-tile[hidden] { display: none; }
/* The first frame snaps into place instead of animating in from the defaults. */
.stage.is-instant .film,
.stage.is-instant .window-tile { transition: none; }
.stage .window-tile.is-ringed { box-shadow: 0 0 0 2.5px var(--tile-accent), 0 16px 40px rgb(0 0 0 / 0.55); }
.stage .window-tile.is-pinned {
  top: 70px;
  z-index: 33;
  box-shadow: 0 0 0 2.5px var(--gold), 0 16px 42px rgb(0 0 0 / 0.5);
}

/* Dark fades so the film runs off into the edges. */
.stage__fade { position: absolute; top: 30px; width: 160px; height: 240px; z-index: 36; pointer-events: none; }
.stage__fade--left { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.stage__fade--right { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }

/* Gates: the fixed slots ("projector gates") the film rolls through. */
.gate {
  position: absolute;
  top: 62px;
  width: 226px;
  height: 174px;
  z-index: 40;
  border-radius: 15px;
  pointer-events: none;
}
.gate--center { border: 2.5px solid var(--blue); box-shadow: 0 0 0 1px rgb(156 192 255 / 0.22), 0 0 34px rgb(120 160 255 / 0.4); }
.gate--side { border: 2px dashed rgb(255 255 255 / 0.28); }
.gate--pin { border: 2.5px solid var(--gold); box-shadow: 0 0 30px rgb(255 212 121 / 0.35); }
.gate__label {
  position: absolute;
  left: 50%;
  top: -27px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.gate--center .gate__label { color: #bcd4ff; }
.gate--side .gate__label { color: rgb(255 255 255 / 0.55); }
.gate--pin .gate__label { color: var(--gold); }

/* The "your screen" frame used by the problem scene. */
.viewport-frame {
  position: absolute;
  top: 40px;
  width: 706px;
  height: 218px;
  z-index: 38;
  border: 3px solid #8fbaff;
  border-radius: 18px;
  box-shadow: 0 0 0 1px rgb(143 186 255 / 0.2), 0 18px 60px rgb(0 0 0 / 0.5);
  pointer-events: none;
}
.viewport-frame[hidden] { display: none; }
.viewport-frame__label {
  position: absolute;
  left: 13px;
  top: -27px;
  color: #8fbaff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

/* Key caps + hint under the film. */
.stage__keys {
  position: absolute;
  left: 0;
  right: 0;
  top: 268px;
  z-index: 46;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.stage__key {
  padding: 6px 13px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 3px;
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.08);
  color: #e8e8ee;
  font: 700 15px var(--font-mono);
  animation: key-pulse 2.3s ease-in-out infinite;
}
.stage__key.is-active { background: var(--violet); border-color: var(--violet); color: var(--on-accent); }
.stage__hint { margin-left: 6px; color: var(--text-muted); font-size: 14px; }
.stage__hint[data-tone] { color: var(--tone); }

@keyframes key-pulse {
  0%, 100% { transform: translateY(0); opacity: 0.78; }
  50% { transform: translateY(-2px); opacity: 1; }
}

/* Payoff ------------------------------------------------------------------------------------- */

.payoff__title { font-size: clamp(2.1rem, 6vw, 3.4rem); font-weight: 800; letter-spacing: -0.02em; }

.modes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  max-width: 820px;
  margin-inline: auto;
}
.mode {
  display: grid;
  gap: 4px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 0.05);
  text-align: center;
}
.mode p { color: var(--text-muted); font-size: 0.92rem; }
.mode .mode__rule { color: #80808c; font-size: 0.8rem; margin-bottom: 6px; }
.mode--gold { background: rgb(255 212 121 / 0.08); border-color: rgb(255 212 121 / 0.3); }
.mode--gold h3 { color: var(--gold); }
.mode--gold .mode__rule { color: #b8a06a; }

/* Screenshots -------------------------------------------------------------------------------- */

/* Real captures (scripts/screenshots/), as opposed to the concept art in the walkthrough. */
.shot { margin: 0; display: grid; gap: 12px; }
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
}
.shot figcaption { color: var(--text-muted); font-size: 0.9rem; text-wrap: pretty; }

.showcase { margin-top: clamp(-72px, -6vw, -40px); padding-bottom: clamp(48px, 7vw, 88px); position: relative; }
.shot--hero figcaption { max-width: 720px; margin-inline: auto; text-align: center; }
/* Two ultrawide layout shots under the hero. */
.gallery--layouts { margin: 32px 0 0; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
@media (max-width: 900px) { .gallery--layouts { grid-template-columns: 1fr; } }

.split { display: grid; gap: clamp(28px, 4vw, 48px); align-items: center; }
@media (min-width: 960px) {
  .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}
.split .section__header { margin-bottom: 24px; justify-items: start; }
.split .checklist { color: var(--text-soft); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: clamp(28px, 4vw, 44px);
}

/* Features ----------------------------------------------------------------------------------- */

.features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}
.feature {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.03);
}
.feature p { color: var(--text-muted); font-size: 0.95rem; }

/* Keyboard table ----------------------------------------------------------------------------- */

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; }
.keys-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.keys-table th,
.keys-table td { padding: 12px 18px; text-align: left; border-bottom: 1px solid rgb(255 255 255 / 0.06); }
.keys-table th { color: var(--text-faint); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.keys-table tr:last-child td { border-bottom: 0; }
.keys-table td:first-child { white-space: nowrap; }

.keys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 32px; }
.keys-grid h3 { margin-bottom: 12px; }
.keys-grid .keys-table td:first-child { width: 55%; }

/* Get started -------------------------------------------------------------------------------- */

.callout {
  margin-bottom: 32px;
  padding: 16px 20px;
  border: 1px solid rgb(255 178 122 / 0.35);
  border-radius: var(--radius);
  background: rgb(255 178 122 / 0.08);
  color: #f3d3bb;
}
.callout strong { color: var(--orange); }

.start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; }
.start-grid h3 { margin-bottom: 14px; }
.start-grid--notes { margin-top: 32px; padding-top: 32px; border-top: 1px solid rgb(255 255 255 / 0.06); }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { position: relative; padding-left: 28px; }
.checklist li::before { content: "✓"; position: absolute; left: 4px; color: var(--mint); font-weight: 700; }

.code {
  margin: 0 0 14px;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #111118;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* FAQ ---------------------------------------------------------------------------------------- */

.faq { display: grid; gap: 10px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius); background: rgb(255 255 255 / 0.03); }
.faq summary {
  padding: 16px 20px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  list-style-position: inside;
}
.faq details p { padding: 0 20px 18px; color: var(--text-muted); }
