/* =====================================================================================
   SCRAMBLED website styles. (The words are in content.js, not here.)
   Built from the game's own parts: LED signs for headings, keypad keys for buttons,
   the mode-select terminal, the wardrobe shelf and the community boards.
   ===================================================================================== */

/* The game's 5x7 LED sign font: round dots for signs, square pixels for key labels. */
@font-face { font-family: "Scrambled LED"; src: url("fonts/ScrambledLED.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Scrambled Pixel"; src: url("fonts/ScrambledPixel.woff2") format("woff2"); font-display: swap; }

:root {
  --night: #0E1020;
  --night-2: #151830;
  --panel: #0A0C1A;
  --keycap: #1A1D36;
  --frame: #2A2E55;
  --shell: #FFF6E6;
  --ink: #2A1F14;
  --wood: #9A6A3E;
  --yolk: #FFB000;
  --text: #F4F1FA;
  --text-dim: #ABA7C6;
  --unlit: rgba(255, 255, 255, 0.07);

  --display: "Scrambled LED", "Courier New", monospace;
  --label: "Scrambled Pixel", "Courier New", monospace;
  --body: "Rubik", "Trebuchet MS", system-ui, sans-serif;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 400; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--yolk); outline-offset: 3px; border-radius: 8px; }

.wrap {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---------- keys: the keypad keys from the game ---------- */
.key {
  --c: var(--yolk);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #23274A, var(--keycap));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 5px 0 #07080F, 0 8px 18px rgba(0, 0, 0, 0.35);
  color: var(--text-dim);
  font-family: var(--label);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, box-shadow 0.1s ease, color 0.2s;
}
.key:hover { transform: translateY(-2px); color: var(--text); }
.key:active { transform: translateY(4px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 0 #07080F; }
.key-lit { color: var(--c); text-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 5px 0 #07080F, 0 8px 22px color-mix(in srgb, var(--c) 25%, transparent); }
.key-lit:hover { color: var(--c); }
.key.soon { cursor: default; opacity: 0.85; }
.key.soon:hover, .key.soon:active { transform: none; }
.key-small { min-height: 42px; padding: 0 18px; font-size: 0.8rem; }
.key-row { display: flex; flex-wrap: wrap; gap: 16px; }
.play { width: 0; height: 0; border-left: 11px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }

/* ---------- LED headings ---------- */
.led-title {
  font-family: var(--display);
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  line-height: 1;
  color: var(--yolk);
  text-shadow: 0 0 0.05em rgba(255, 196, 64, 0.95), 0 0 0.25em rgba(232, 106, 0, 0.45);
}
.band-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 28px; margin-bottom: 32px; }
.band-head p { color: var(--text-dim); max-width: 46ch; }

/* ---------- the trailer (or, while it loads, a field of LEDs) behind the page ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--night); }
#bg-leds { position: absolute; top: 0; left: 0; image-rendering: pixelated; }
.led-mask { position: absolute; inset: 0; background: radial-gradient(circle, transparent 0 32%, var(--night) 44%) 0 0 / 14px 14px; }
#bg-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.9s ease; }
.has-video #bg-video { opacity: 1; }
.has-video #bg-leds, .has-video .led-mask { display: none; }
.scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(14, 16, 32, 0.72) 0%, rgba(14, 16, 32, 0.25) 55%, rgba(14, 16, 32, 0.05) 100%),
    linear-gradient(180deg, rgba(14, 16, 32, 0.55) 0%, rgba(14, 16, 32, 0) 20%, rgba(14, 16, 32, 0) 68%, rgba(14, 16, 32, 0.75) 100%);
}

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; transition: background-color 0.3s, box-shadow 0.3s; }
.topbar.scrolled { background: rgba(14, 16, 32, 0.88); backdrop-filter: blur(10px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07); }
.topbar-row { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.brand { font-family: var(--display); font-size: 1.5rem; line-height: 1; color: var(--yolk); text-decoration: none; text-shadow: 0 0 10px rgba(255, 176, 0, 0.55); }
.topbar-links { display: flex; gap: 26px; margin-left: auto; }
.topbar-links a, .footer-links > a:not(.key) { font-family: var(--label); font-size: 0.875rem; letter-spacing: 0.1em; text-decoration: none; padding-block: 6px; }
.topbar-links a:hover, .footer-links > a:not(.key):hover { color: var(--yolk); }

/* ---------- the hero: an LED sign over the trailer ---------- */
.hero { min-height: min(86vh, 840px); display: flex; align-items: flex-end; padding-block: 72px 84px; margin-top: -68px; }
.hero-inner { display: flex; flex-direction: column; align-items: flex-start; }

/* The sign's unlit dots sit exactly between the lit ones: the font's dots are 0.1em apart. */
.sign {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 26px;
  padding: 0.2em 0.3em 0.1em;
  font-family: var(--display);
  font-size: clamp(40px, 14.5vw, 150px);
  line-height: 1;
  color: var(--yolk);
  overflow-wrap: anywhere;
  background-color: rgba(8, 9, 20, 0.8);
  background-image: radial-gradient(circle, var(--unlit) 0 0.036em, transparent 0.044em);
  background-size: 0.1em 0.1em;
  background-position: -0.05em -0.05em;
  border-radius: 0.08em;
  box-shadow: 0 0 0 0.03em rgba(255, 255, 255, 0.06), 0 30px 80px rgba(0, 0, 0, 0.5);
  text-shadow: 0 0 0.05em rgba(255, 196, 64, 0.95), 0 0 0.22em rgba(232, 106, 0, 0.55);
}
.hero .sign span { animation: power-on 1.1s steps(1, end) both; }
@keyframes power-on { 0% { opacity: 0; } 18% { opacity: 1; } 26% { opacity: 0.2; } 34% { opacity: 1; } 48% { opacity: 0.45; } 56%, 100% { opacity: 1; } }
.sign-small { font-size: clamp(34px, 8vw, 84px); text-transform: uppercase; }
.tagline { font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.5; max-width: 36ch; margin-bottom: 32px; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75); }

/* ---------- bands ---------- */
.band { position: relative; padding-block: clamp(72px, 9vw, 120px); }

/* ---------- modes: the mode-select terminal ---------- */
.modes-band { background: var(--night-2); }
.terminal {
  background: var(--panel);
  border: 2px solid var(--frame);
  border-radius: 26px;
  padding: clamp(14px, 2.4vw, 26px);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
}
.mode-keys { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: clamp(16px, 2.4vw, 26px); }
.mode-keys .key { min-height: 46px; padding: 0 18px; font-size: 0.82rem; }
.mode-keys .key[aria-selected="true"] { color: var(--c); text-shadow: 0 0 10px color-mix(in srgb, var(--c) 70%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 60%, transparent), 0 2px 0 #07080F; transform: translateY(3px); }
.mode-stage { --c: var(--yolk); display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: center; }
.mode-screen {
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  max-width: 100%;
  background: #000;
  box-shadow: 0 0 0 3px #1D2040, 0 0 50px -12px var(--c);
  transition: box-shadow 0.4s;
}
.mode-screen img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.25s; }
.mode-screen img.swap { opacity: 0; }
.mode-info { min-width: 0; padding-right: 8px; }
.mode-name { font-family: var(--display); font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.05; color: var(--c); text-shadow: 0 0 0.25em color-mix(in srgb, var(--c) 45%, transparent); margin-bottom: 16px; }
.mode-text { font-size: 1.15rem; margin-bottom: 20px; }
.mode-wearing { font-family: var(--label); font-size: 0.8rem; letter-spacing: 0.08em; color: var(--text-dim); line-height: 1.6; }
.mode-wearing #mode-wearing { color: var(--c); }
@media (max-width: 820px) {
  .mode-stage { grid-template-columns: minmax(0, 1fr); }
  .mode-keys { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
  .mode-keys .key { flex: 0 0 auto; }
}

/* ---------- wardrobe: eggs on a shelf ---------- */
.shelf-band { background: var(--shell); color: var(--ink); }
.shelf-band .led-title { color: var(--ink); text-shadow: none; }
.shelf-band .band-head p { color: #6B5A45; }
.shelf { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); row-gap: 44px; }
.item { margin: 0; display: flex; flex-direction: column; align-items: center; }
.item img { width: 82%; height: auto; transition: transform 0.25s ease; transform-origin: 50% 95%; }
.item:hover img { transform: rotate(-6deg) translateY(-4px); }
.plank { align-self: stretch; height: 14px; background: var(--wood); box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.18), 0 10px 14px -8px rgba(42, 31, 20, 0.45); }
.item:first-child .plank { border-radius: 6px 0 0 6px; }
.item:last-child .plank { border-radius: 0 6px 6px 0; }
.tag { margin-top: 14px; font-family: var(--label); font-size: 0.72rem; letter-spacing: 0.08em; background: var(--ink); color: var(--shell); padding: 6px 9px 5px; border-radius: 6px; text-align: center; }
@media (max-width: 900px) {
  .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .item:nth-child(4n + 1) .plank { border-radius: 6px 0 0 6px; }
  .item:nth-child(4n) .plank { border-radius: 0 6px 6px 0; }
}
@media (max-width: 500px) { .tag { font-size: 0.62rem; padding: 5px 6px 4px; } }

/* ---------- screenshots ---------- */
.shots-band { background: var(--night-2); }
.shots { display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px)); }
.shot { flex: 0 0 auto; width: min(80vw, 520px); margin: 0; scroll-snap-align: center; }
.shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 14px; }
.shot figcaption { margin-top: 10px; color: var(--text-dim); font-size: 0.95rem; }

/* ---------- the window back to the trailer ---------- */
.window { min-height: clamp(360px, 60vh, 640px); display: flex; align-items: center; padding-block: 80px; }

/* ---------- community boards ---------- */
.boards-band { background: var(--night-2); }
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.board {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
  padding: clamp(22px, 3vw, 34px);
  background: var(--panel);
  border: 6px solid var(--frame);
  border-radius: 20px;
}
.board-name { font-family: var(--display); font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1; color: var(--c); text-shadow: 0 0 0.05em var(--c), 0 0 0.3em color-mix(in srgb, var(--c) 45%, transparent); }
.board-text { color: var(--text-dim); max-width: 36ch; flex: 1; }
.board-discord, .board-discord .key { --c: #8C96FF; }
.board-youtube, .board-youtube .key { --c: #FF5A5A; }
@media (max-width: 700px) { .boards { grid-template-columns: minmax(0, 1fr); } }

/* ---------- footer ---------- */
.footer { background: var(--night); padding-block: 56px 40px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.footer-row { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: space-between; }
.footer-brand { display: flex; flex-direction: column; gap: 10px; }
.footer-brand .brand { font-size: 2rem; }
.footer-brand p { color: var(--text-dim); }
.footer-links { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; }
.fine-print { margin-top: 36px; color: var(--text-dim); font-size: 0.875rem; }

/* ---------- trailer pop-up ---------- */
dialog { width: min(1100px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; background: #000; color: var(--text); overflow: hidden; }
dialog::backdrop { background: rgba(5, 6, 14, 0.9); }
dialog video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.dialog-close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 44px; height: 44px; border: 0; border-radius: 999px; background: rgba(14, 16, 32, 0.8); color: var(--text); font-family: var(--label); font-size: 1rem; cursor: pointer; }
.dialog-missing { display: none; padding: 80px 32px; text-align: center; font-family: var(--label); letter-spacing: 0.06em; color: var(--yolk); }
dialog.missing video { display: none; }
dialog.missing .dialog-missing { display: block; }

/* shown only if content.js has a typo */
.oops { position: relative; z-index: 20; margin: 0; padding: 18px; background: #B00020; color: #fff; font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero .sign span { animation: none; }
  .key, .item img, .mode-screen img { transition: none; }
}
