/* Noise Gate landing page. Spec: docs/design-spec.md. Phone is the base; one breakpoint at 768px. */

/* 1. Tokens ------------------------------------------------------------ */
:root {
  color-scheme: dark;

  --bg: #0e0c12;
  --surface: #16131c;
  --screw: #1d1924;
  --line: #2a2433;
  --line-strong: #3a3346;
  --text: #f4ead8;
  --muted: #9a8fa8;
  --muted-strong: #b3a9bf;
  --gold: #ffd27a;
  --amber: #ffb43a;
  --pink: #ff3d7f;
  --cyan: #3de0ff;
  --split-pink: rgba(255, 61, 127, .75);
  --split-cyan: rgba(61, 224, 255, .65);

  --font-display: "Big Shoulders Display", Impact, "Arial Narrow", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  --gutter: 16px;
  --panel-pad: 24px;
  --panel-gap: 24px;
  --content-max: 1232px;
  --radius-panel: 10px;
  --radius-shot: 6px;
  --radius-btn: 6px;
  --line-w: 2px;

  /* screw heads: centre inset, fill radius, outer radius (fill + 2px stroke) */
  --screw-in: 16px;
  --screw-r: 5px;
  --screw-R: 7px;

  --label-size: 13px;
  --body-size: 16px;
  --beat-space: 40px;
}

@media (min-width: 768px) {
  :root {
    --gutter: 32px;
    --panel-pad: clamp(32px, 5vw, 64px);
    --panel-gap: 48px;
    --screw-in: 24px;
    --screw-r: 6px;
    --screw-R: 8px;
    --label-size: 15px;
    --body-size: 17px;
    --beat-space: 64px;
  }
}

/* 2. Page frame -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: var(--panel-gap) var(--gutter) 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--body-size)/1.65 var(--font-mono);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body > header,
body > main,
body > footer {
  max-width: var(--content-max);
  margin-inline: auto;
}

main { display: block; margin-top: var(--panel-gap); }
main > * + * { margin-top: var(--panel-gap); }

h1, h2, h3, p, figure { margin: 0; }

img, svg { display: block; }

p { max-width: 62ch; text-wrap: pretty; }

h2, h3, .pitch { text-wrap: balance; }

/* 3. Shared type ------------------------------------------------------- */
.label {
  font: 600 var(--label-size)/1.3 var(--font-mono);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--muted);
}

h2 {
  font: 800 clamp(40px, 6vw, 72px)/1 var(--font-display);
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--text);
}

.eyebrow { margin-bottom: var(--s3); }

h3 {
  margin: 0 0 var(--s4);
  font: 800 clamp(28px, 3.4vw, 40px)/1.05 var(--font-display);
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--gold);
}

/* 4. Panel (rack unit) with four screw heads drawn as backgrounds ------- */
.panel {
  position: relative;
  padding: var(--panel-pad);
  border: var(--line-w) solid var(--line);
  border-radius: var(--radius-panel);
  background:
    radial-gradient(circle at var(--screw-in) var(--screw-in), var(--screw) var(--screw-r), var(--line-strong) calc(var(--screw-r) + .5px) var(--screw-R), transparent calc(var(--screw-R) + .5px)),
    radial-gradient(circle at calc(100% - var(--screw-in)) var(--screw-in), var(--screw) var(--screw-r), var(--line-strong) calc(var(--screw-r) + .5px) var(--screw-R), transparent calc(var(--screw-R) + .5px)),
    radial-gradient(circle at var(--screw-in) calc(100% - var(--screw-in)), var(--screw) var(--screw-r), var(--line-strong) calc(var(--screw-r) + .5px) var(--screw-R), transparent calc(var(--screw-R) + .5px)),
    radial-gradient(circle at calc(100% - var(--screw-in)) calc(100% - var(--screw-in)), var(--screw) var(--screw-r), var(--line-strong) calc(var(--screw-r) + .5px) var(--screw-R), transparent calc(var(--screw-R) + .5px)),
    var(--bg);
}

/* 5. Hero -------------------------------------------------------------- */
.panel--hero {
  display: flex;
  flex-direction: column;
  padding: var(--s5) var(--s4) 0;
  overflow: hidden;
  text-align: center;
}

.hero-corner { display: none; }

.hero-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lockup {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: .21em;
  margin: 0;
  font: 900 clamp(60px, 15.5vw, 200px)/1 var(--font-display);
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.lockup-noise {
  color: var(--text);
  text-shadow: -.03em 0 0 var(--split-pink), .03em 0 0 var(--split-cyan);
}

.lockup-gate {
  color: var(--gold);
  border-top: max(3px, .057em) solid var(--amber);
  border-bottom: max(3px, .057em) solid var(--amber);
  padding: 0 .03em;
}

.subtitle {
  max-width: none;
  margin-top: var(--s6);
  font: 600 clamp(13px, 2vw, 26px)/1.3 var(--font-mono);
  letter-spacing: .40em;
  text-transform: uppercase;
  color: var(--text);
  /* trailing tracking would push the centred line left; pull it back */
  margin-right: -.40em;
}

.pitch {
  max-width: 52ch;
  margin-top: var(--s6);
  font-size: 16px;
  line-height: 1.55;
}

.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
  width: 100%;
  margin-top: 40px;
}

.nextfest-a,
.nextfest-b { display: block; }
.nextfest-sep { display: none; }

.nextfest {
  max-width: none;
  font: 600 var(--label-size)/1.3 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text);
}

@media (max-width: 359px) {
  .subtitle {
    font-size: 12px;
    letter-spacing: .28em;
    margin-right: -.28em;
  }
}

/* Wishlist: "coming soon" state (static text, not a control) */
.wishlist {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 14px 20px;
  border-radius: var(--radius-btn);
  font: 600 16px/1.3 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
}

.wishlist--soon {
  background: var(--screw);
  border: 2px solid var(--line-strong);
  cursor: default;
}

.wishlist-label { color: var(--muted-strong); }

.wishlist-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border: 1px solid var(--amber);
  border-radius: 3px;
  font-size: 12px;
  letter-spacing: .18em;
  color: var(--amber);
}

.wishlist-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

/* Future active state: <a class="wishlist" href="STEAM_URL">Wishlist on Steam</a> */
a.wishlist {
  background: var(--amber);
  color: var(--bg);
  border: 0;
  transition: background-color 120ms ease;
}
a.wishlist:hover { background: var(--gold); }
a.wishlist:active { transform: translateY(1px); }

/* Gated waveform + LED row */
.hero-wave {
  position: relative;
  height: calc(120px + 22px);
  margin: var(--s5) calc(-1 * var(--s4)) 0;
  overflow: hidden;
}

.hero-wave svg {
  position: absolute;
  top: 0;
  left: 50%;
  height: 120px;
  /* phone: uniform scale to 120px tall, centred = the spec's "xMidYMid slice" */
  width: calc(120px * 1232 / 236);
  transform: translateX(-50%);
}

.leds {
  position: absolute;
  /* phone: inset the LED row so the outer LEDs clear the bottom screw heads */
  left: 32px;
  right: 32px;
  bottom: 7px;
  height: 8px;
}

.led {
  position: absolute;
  top: 0;
  width: 16px;
  height: 8px;
  border-radius: 2px;
  background: var(--line-strong);
}
.led:nth-child(1) { left: 18.8%; }
.led:nth-child(2) { left: 34.1%; }
.led:nth-child(3) { left: 49.4%; }
.led:nth-child(4) { left: 64.3%; }
.led:nth-child(5) { left: 79.7%; }
.led:nth-child(6) { left: 93.3%; }
.led--on { background: var(--amber); }

/* 6. Screenshot figure ------------------------------------------------- */
.shot-frame {
  border: 2px solid var(--line);
  border-radius: var(--radius-shot);
  background: #000;
  overflow: hidden;
}

.shot img {
  width: 100%;
  height: auto;
}

.shot figcaption {
  max-width: 62ch;
  margin-top: var(--s3);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: .02em;
  color: var(--muted);
}

.shot figcaption::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  vertical-align: .15em;
  background: var(--amber);
}

/* Hero carousel: slides stack in one grid cell and crossfade. Without JS only the first shows. */
.carousel-viewport { display: grid; }
.carousel-slide {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 700ms ease, visibility 0s linear 700ms;
}
.carousel-slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 700ms ease, visibility 0s;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-top: var(--s2);
}
.carousel-controls[hidden] { display: none; }

.carousel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 0 var(--s2) 0 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.carousel-toggle:hover { color: var(--text); }
.carousel-toggle-icon {
  /* pause: two bars */
  width: 10px;
  height: 12px;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
}
.carousel.is-stopped .carousel-toggle-icon {
  /* play: a triangle */
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid currentColor;
  border-right: 0;
}

.carousel-dots { display: flex; }
.carousel-dot {
  /* the rack's LEDs; the button itself is a 32px target */
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.carousel-dot::before {
  content: "";
  position: absolute;
  inset: 12px 8px;
  border-radius: 2px;
  background: var(--line-strong);
  transition: background-color 200ms ease;
}
.carousel-dot:hover::before { background: var(--muted); }
.carousel-dot[aria-current="true"]::before { background: var(--amber); }

@media (prefers-reduced-motion: reduce) {
  .carousel-slide, .carousel-slide.is-active, .carousel-dot::before { transition: none; }
}

@media (forced-colors: active) {
  .carousel-dot::before { background: ButtonBorder; }
  .carousel-dot[aria-current="true"]::before { background: Highlight; }
}

/* phone: screenshots inside panels bleed into the panel padding; captions stay inset */
@media (max-width: 767px) {
  .beat .shot-frame { margin-inline: -16px; }
}

/* 7. How it plays ------------------------------------------------------ */
.beats { margin-top: 40px; }

.beat + .beat {
  margin-top: var(--beat-space);
  padding-top: var(--beat-space);
  border-top: 2px solid var(--line);
}

.beat .shot { margin-top: var(--s5); }

.step {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  margin-bottom: var(--s2);
}

.step-n {
  font: 800 clamp(40px, 5vw, 64px)/1 var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--amber);
}

/* 8. Status strip ------------------------------------------------------ */
.status-cells {
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
  border: 2px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.status-cell {
  padding: var(--s5) 20px;
  background: var(--surface);
}
.status-cell + .status-cell { border-top: 2px solid var(--line); }

.status-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-led {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255, 180, 58, .6);
}

.status-value {
  margin-top: var(--s3);
  font: 800 30px/1.05 var(--font-display);
  text-wrap: balance;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: var(--text);
}

.status-detail {
  margin-top: var(--s2);
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

/* 9. Press + placeholder chip ------------------------------------------ */
.panel--press .press-body { margin-top: var(--s4); }

.text-link,
.panel--press a {
  color: var(--text);
  text-decoration: underline 2px var(--amber);
  text-underline-offset: 4px;
}
.text-link:hover,
.panel--press a:hover { color: var(--gold); }

/* 404 page: centred on the viewport, lockup above the panel, a flat (gated-shut) trace inside it */
.page-404 {
  display: grid;
  align-content: center;
  min-height: 100svh;
}
.page-404 > main { width: 100%; margin-top: 0; }
.page-404 > footer { width: 100%; }
.lockup--404 {
  max-width: none;
  margin-bottom: var(--s6);
  font-size: clamp(40px, 8vw, 96px);
}
.flatline {
  width: 100%;
  height: 48px;
  margin-top: var(--s6);
}

.panel--error h1 {
  margin-bottom: var(--s4);
  font: 800 clamp(40px, 6vw, 72px)/1 var(--font-display);
  letter-spacing: .01em;
  text-transform: uppercase;
}

.placeholder {
  background: var(--pink);
  color: var(--bg);
  font: 600 .95em var(--font-mono);
  margin-inline: 5px; /* keeps the dashed outline clear of the corner screws */
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
  outline: 2px dashed var(--pink);
  outline-offset: 3px;
}

/* 10. Footer ----------------------------------------------------------- */
body > footer {
  padding: var(--s6) 0;
  text-align: center;
}

body > footer::before {
  content: "";
  display: block;
  width: 120px;
  height: 2px;
  margin: 0 auto var(--s5);
  background: var(--line);
}

footer p {
  max-width: none;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: .02em;
  color: var(--muted);
}
footer p + p { margin-top: var(--s1); }

/* 11. Accessibility helpers ------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 16px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  font: 600 14px/1.3 var(--font-mono);
  text-decoration: none;
}
.skip-link:focus {
  position: fixed;
  left: 16px;
}

/* 12. Desktop (>= 768px) ----------------------------------------------- */
@media (min-width: 768px) {
  .panel--hero {
    min-height: min(706px, 88svh);
    padding: 56px var(--panel-pad) 0;
  }

  /* keep the whole hero panel above a 1280x800 fold */
  body { padding-top: var(--s4); }

  .nextfest-a,
  .nextfest-b { display: inline; }
  .nextfest-sep { display: inline; white-space: pre; }

  .hero-corner {
    display: block;
    position: absolute;
    top: 28px;
    max-width: none;
    font-size: 15px;
    text-transform: none; /* source is already in caps; keeps the lower-case "dB" */
  }
  .hero-corner--left { left: 58px; }
  .hero-corner--right { right: 58px; }

  .subtitle {
    letter-spacing: .54em;
    margin-right: -.54em;
  }

  .pitch { font-size: 20px; max-width: 64ch; margin-top: var(--s5); }

  .cta {
    margin-top: var(--s6);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--s5);
  }

  .wishlist {
    display: inline-flex;
    width: auto;
    max-width: none;
    margin: 0;
  }

  .hero-wave {
    height: calc(160px + 22px);
    margin: var(--s4) calc(-1 * var(--panel-pad)) 0;
  }

  .leds { left: 0; right: 0; }

  .hero-wave svg {
    left: 0;
    width: 100%;
    height: 160px;
    transform: none;
  }

  .shot figcaption { font-size: 14px; }

  .beats { margin-top: var(--s8); }

  .status-cell { padding: var(--s6) 28px; }
  .status-value { font-size: 40px; }

  .panel--press { padding: 40px var(--panel-pad); }

  body > footer { padding: var(--s7) 0 40px; }
}

/* Split beats only once both columns have room (below this they stack, as on phone). */
@media (min-width: 1024px) {
  .beat--split {
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: var(--s7);
    align-items: center;
  }
  .beat--split .shot { margin-top: 0; }
  .beat--flip { grid-template-columns: 7fr 5fr; }
  .beat--flip .shot { order: -1; }
}

/* Status as one 3-cell channel strip only when the values fit on one line. */
@media (min-width: 1100px) {
  .status-cells {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .status-cell { padding: var(--s6) var(--s5); }
  .status-cell + .status-cell {
    border-top: 0;
    border-left: 2px solid var(--line);
  }
  .status-value { font-size: clamp(30px, 2.8vw, 40px); white-space: nowrap; }
}

/* 13. Motion (only when the visitor has not asked for less) ------------ */
@media (prefers-reduced-motion: no-preference) {
  /* Gate opens: the amber trace (its own overlaid <svg>, so clip-path has a real CSS box) reveals left to right, once. */
  .wave-gated {
    animation: gate-open 1500ms cubic-bezier(.2, .7, .2, 1) 300ms both;
  }

  /* Lit LEDs blink on the 120 BPM beat for 8 beats, staggered by 1/3 beat, then stay lit. */
  .led--on { animation: led-beat 500ms steps(1, end) 8; }
  .led--on:nth-child(3) { animation-delay: 167ms; }
  .led--on:nth-child(5) { animation-delay: 333ms; }
}

@keyframes gate-open {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes led-beat {
  0% { opacity: 1; }
  50% { opacity: .35; }
  100% { opacity: 1; }
}

/* 14. Forced colours --------------------------------------------------- */
@media (forced-colors: active) {
  .lockup-noise { text-shadow: none; }
  .wishlist--soon { border-style: dashed; }
  .placeholder { forced-color-adjust: none; }
}

/* Keep the whole hero panel above a 1280x800 fold; below 1024 the corner labels need the extra 8px. */
@media (min-width: 1024px) {
  .panel--hero { padding-top: 48px; }
}
