/* ============================================================================
   style.css — pixel world shell. Type: Press Start 2P (UI) + VT323 (display)
   + system sans for body copy so long text stays readable.
   ========================================================================== */

@font-face {
  font-family: "PS2P";
  src: url("../assets/fonts/pressstart2p.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("../assets/fonts/vt323.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #0d0f14;
  --ink-2: #1b2030;
  --paper: #fff6e6;
  --paper-2: #ffeed6;
  --muted: #8b93a7;
  --acc: #ffd166;
  --acc-2: #4f9f73;
  --px: 4px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body[data-theme="day"]    { --acc: #ffd166; --acc-2: #4f9f73; }
body[data-theme="horror"] { --acc: #c8ff4a; --acc-2: #2f6b46; }
body[data-theme="city"]   { --acc: #ffd27a; --acc-2: #6d8ac4; }
body[data-theme="studio"] { --acc: #ffc46b; --acc-2: #c9743f; }
body[data-theme="warm"]   { --acc: #ff8f6b; --acc-2: #e4462c; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--acc); color: var(--ink); }

/* pixel type helpers ------------------------------------------------------ */
.px {
  font-family: "PS2P", monospace;
  font-size: 9px;
  line-height: 1.9;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* stage ------------------------------------------------------------------ */
#world {
  position: fixed;
  inset: 0;
  z-index: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#spacer { position: relative; z-index: -1; }

#track {
  position: fixed;
  inset: 0;
  z-index: 2;
  will-change: transform;
  backface-visibility: hidden;
  pointer-events: none;
}

.zone {
  position: absolute;
  bottom: 0;
  height: 100%;
  pointer-events: none;
}
.zone > * { pointer-events: auto; }

/* CRT-ish overlay --------------------------------------------------------- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 3px, rgba(0, 0, 0, 0.035) 3px 4px),
    radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.42) 100%);
  mix-blend-mode: multiply;
}

/* framed artwork in the world -------------------------------------------- */
.frame {
  position: absolute;
  margin: 0;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.2, 1);
  transform: translateY(0);
}
.frame:hover { transform: translateY(-8px); }

.frame-inner {
  position: relative;
  overflow: hidden;
  border: var(--px) solid var(--ink);
  background: #fff;
  box-shadow:
    0 0 0 3px var(--paper),
    0 0 0 6px var(--ink),
    10px 12px 0 6px rgba(0, 0, 0, 0.28);
}

.frame-inner img,
.frame-inner video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame--photo .frame-inner img { cursor: zoom-in; }
.frame--poster .frame-inner { background: #0a1a10; }
.frame--logo .frame-inner { background: #fff; }

.frame-play {
  position: absolute;
  inset: auto 8px 8px auto;
  width: 38px;
  height: 38px;
  border: 3px solid var(--ink);
  background: var(--acc);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
}
.frame-play:hover { background: var(--paper); }

.frame figcaption {
  margin-top: 14px;
  font-family: "PS2P", monospace;
  font-size: 8px;
  line-height: 1.9;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow:
    2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
    2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
}
.frame figcaption span {
  display: block;
  width: fit-content;
  margin-top: 6px;
  font-size: 7px;
  color: var(--acc);
}

/* the newsroom article page ---------------------------------------------- */
.news {
  position: absolute;
  margin: 0;
  padding: 22px 22px 18px;
  background: var(--paper);
  color: var(--ink);
  border: var(--px) solid var(--ink);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 0 7px var(--ink),
    12px 14px 0 7px rgba(0, 0, 0, 0.3);
}
.news-mast {
  font-family: "PS2P", monospace;
  font-size: 7px;
  letter-spacing: 0.14em;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 8px;
  margin-bottom: 12px;
  color: #b3402a;
}
.news h2 {
  font-family: "VT323", monospace;
  font-size: 34px;
  line-height: 0.95;
  margin: 0 0 10px;
  font-weight: 400;
}
.news-by {
  font-family: "PS2P", monospace;
  font-size: 6.5px;
  line-height: 2;
  letter-spacing: 0.03em;
  color: #6b5b4a;
  margin-bottom: 14px;
}
.news-pull {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
  margin: 0 0 14px;
  padding-left: 12px;
  border-left: 4px solid #b3402a;
}
.news-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.news-strip img { width: 100%; display: block; border: 2px solid var(--ink); }
.news-foot {
  margin-top: 12px;
  font-family: "PS2P", monospace;
  font-size: 6px;
  letter-spacing: 0.05em;
  color: #6b5b4a;
  text-transform: uppercase;
}

/* HUD -------------------------------------------------------------------- */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  padding: 14px 20px 0;
  pointer-events: none;
}
.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 14px; }

.hud-tag {
  font-family: "PS2P", monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--acc);
  padding: 6px 9px 5px;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
}
.hud-zone {
  font-family: "PS2P", monospace;
  font-size: 8px;
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
}
.hud-count {
  font-family: "PS2P", monospace;
  font-size: 10px;
  color: #fff;
  text-shadow: 2px 2px 0 var(--ink);
}
.hud-btn {
  pointer-events: auto;
  font-family: "PS2P", monospace;
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--paper);
  background: rgba(13, 15, 20, 0.82);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
  padding: 7px 10px 6px;
  cursor: pointer;
  transition: transform 0.12s steps(2), background 0.12s;
}
.hud-btn:hover { background: var(--acc); color: var(--ink); transform: translate(-1px, -1px); }
.hud-btn.on { background: var(--acc); color: var(--ink); }
.hud-btn.hidden { display: none; }

#hud-progress {
  position: relative;
  margin: 10px auto 0;
  max-width: 640px;
  height: 9px;
  background: rgba(13, 15, 20, 0.45);
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
  cursor: pointer;
  pointer-events: auto;
}
#hud-bar {
  height: 100%;
  width: 0%;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 6px),
    linear-gradient(90deg, var(--acc), var(--acc-2));
  transition: width 0.1s linear;
}

/* hint ------------------------------------------------------------------- */
#hint {
  position: fixed;
  left: 20px;
  bottom: 18px;
  z-index: 5;
  margin: 0;
  font-family: "PS2P", monospace;
  font-size: 7px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 2px 2px 0 var(--ink);
  transition: opacity 0.6s ease 4s;
}
body.loaded #hint { opacity: 0.28; }
body.doc-mode #hint { display: none; }

/* docked entry card ------------------------------------------------------ */
#card {
  position: fixed;
  right: 24px;
  bottom: 90px;
  z-index: 4;
  width: min(392px, calc(100vw - 40px));
  padding: 22px 22px 20px;
  background: rgba(13, 15, 20, 0.9);
  backdrop-filter: blur(8px) saturate(1.1);
  border: var(--px) solid var(--ink);
  box-shadow:
    0 0 0 3px var(--acc),
    0 0 0 7px var(--ink),
    12px 14px 0 7px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.2, 0.9, 0.2, 1);
}
#card.in { opacity: 1; transform: translateY(0); }

.card-kicker {
  font-family: "PS2P", monospace;
  font-size: 7px;
  letter-spacing: 0.1em;
  color: var(--acc);
  margin-bottom: 10px;
}
.card-title {
  font-family: "VT323", monospace;
  font-size: 32px;
  line-height: 0.95;
  font-weight: 400;
  margin: 0 0 10px;
  color: #fff;
}
.card-lead {
  font-size: 13.5px;
  line-height: 1.55;
  color: #d8dbe4;
  margin: 0 0 18px;
}

.btn {
  font-family: "PS2P", monospace;
  font-size: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 11px 14px 10px;
  cursor: pointer;
  transition: transform 0.1s steps(2), box-shadow 0.1s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn--primary { background: var(--acc); }

/* modal ------------------------------------------------------------------ */
#modal {
  border: none;
  padding: 0;
  background: transparent;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
}
#modal::backdrop { background: rgba(6, 8, 12, 0.86); backdrop-filter: blur(4px); }

.modal-box {
  position: relative;
  width: min(880px, calc(100vw - 32px));
  margin: 6vh auto 8vh;
  padding: 34px 34px 30px;
  background: var(--paper);
  color: var(--ink);
  border: var(--px) solid var(--ink);
  box-shadow: 0 0 0 4px var(--acc), 0 0 0 9px var(--ink), 16px 18px 0 9px rgba(0, 0, 0, 0.4);
}
.modal-x {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 44px;
  height: 44px;
  font-size: 16px;
  background: var(--acc);
  border: var(--px) solid var(--ink);
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
}
.modal-kicker {
  font-family: "PS2P", monospace;
  font-size: 7px;
  letter-spacing: 0.1em;
  color: #b3402a;
  margin-bottom: 12px;
}
.modal-title {
  font-family: "VT323", monospace;
  font-size: 52px;
  line-height: 0.9;
  font-weight: 400;
  margin: 0 0 22px;
}
.modal-img {
  display: block;
  width: 100%;
  max-height: 46vh;
  object-fit: contain;
  background: var(--ink);
  border: var(--px) solid var(--ink);
  margin-bottom: 24px;
}
.modal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 24px; }
.modal-grid img { width: 100%; height: 200px; object-fit: cover; display: block; border: 3px solid var(--ink); cursor: zoom-in; }
.modal-body section { margin-bottom: 20px; }
.modal-body h3 {
  font-family: "PS2P", monospace;
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
  color: #b3402a;
}
.modal-body p { font-size: 15px; line-height: 1.65; margin: 0; }
.modal-cap { font-family: var(--sans); font-size: 13px; color: #6b5b4a; }
.modal-appb {
  margin-top: 26px;
  padding: 16px 18px;
  background: var(--paper-2);
  border: 3px dashed rgba(13, 15, 20, 0.35);
}
.modal-appb h4 { font-family: "PS2P", monospace; font-size: 7px; margin: 0 0 10px; letter-spacing: 0.08em; }
.modal-appb ol { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }

/* reading view ----------------------------------------------------------- */
#docmode {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  overflow-y: auto;
  background: var(--paper);
  color: var(--ink);
}
#docmode.on { display: block; }

body.doc-mode { overflow: hidden; }
body.doc-mode #world,
body.doc-mode #track,
body.doc-mode #hud,
body.doc-mode #card { visibility: hidden; }
body.doc-mode::after { display: none; }

.doc-head, .doc-entry, .doc-credits {
  width: min(860px, calc(100vw - 40px));
  margin: 0 auto;
}
.doc-head { padding: 9vh 0 6vh; border-bottom: 4px solid var(--ink); }
.doc-overline { font-family: "PS2P", monospace; font-size: 9px; letter-spacing: 0.16em; color: #b3402a; margin: 0 0 20px; }
.doc-head h1 { font-family: "VT323", monospace; font-size: clamp(60px, 12vw, 128px); line-height: 0.82; margin: 0 0 18px; font-weight: 400; }
.doc-sub { font-size: 19px; line-height: 1.5; max-width: 46ch; margin: 0 0 8px; }
.doc-note { font-size: 14px; color: #6b5b4a; }
.doc-head .btn { margin-top: 22px; }

.doc-entry { padding: 7vh 0 3vh; border-bottom: 3px solid rgba(13, 15, 20, 0.18); }
.doc-kicker { font-family: "PS2P", monospace; font-size: 8.5px; letter-spacing: 0.12em; color: #b3402a; margin-bottom: 14px; }
.doc-entry h2 { font-family: "VT323", monospace; font-size: clamp(36px, 6vw, 62px); line-height: 0.92; margin: 0 0 14px; font-weight: 400; }
.doc-lead { font-size: 17px; line-height: 1.5; color: #4a3b2e; margin: 0 0 26px; }
.doc-entry section { margin-bottom: 20px; }
.doc-entry h3 { font-family: "PS2P", monospace; font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 8px; color: #b3402a; }
.doc-entry p { font-size: 16px; line-height: 1.7; margin: 0; }
.doc-img { width: 100%; max-height: 74vh; object-fit: contain; background: var(--ink); border: 4px solid var(--ink); margin-bottom: 26px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 26px; }
.doc-grid img { width: 100%; display: block; border: 4px solid var(--ink); background: var(--ink); }
.doc-grid figcaption { font-family: "PS2P", monospace; font-size: 7px; line-height: 2; margin-top: 10px; text-transform: uppercase; }
.doc-grid figcaption span { display: block; color: #8a7a6a; }
.doc-credits { padding: 7vh 0 12vh; }
.doc-credits h2 { font-family: "VT323", monospace; font-size: 44px; font-weight: 400; margin: 0 0 20px; }
.doc-credits dl { display: grid; grid-template-columns: 240px 1fr; gap: 10px 24px; margin: 0; font-size: 14px; }
.doc-credits dt { font-family: "PS2P", monospace; font-size: 7px; letter-spacing: 0.06em; text-transform: uppercase; padding-top: 4px; color: #b3402a; }
.doc-credits dd { margin: 0; line-height: 1.6; }

/* noscript --------------------------------------------------------------- */
.noscript { max-width: 720px; margin: 12vh auto; padding: 32px; border: 4px solid #fff; font-family: var(--sans); }
.noscript h1 { font-family: "VT323", monospace; font-size: 48px; font-weight: 400; }

/* responsive ------------------------------------------------------------- */
@media (max-width: 780px) {
  :root { --px: 3px; }
  #hud { padding: 10px 12px 0; }
  .hud-zone { display: none; }
  .hud-btn { font-size: 7px; padding: 6px 8px 5px; }
  #card {
    right: 10px;
    left: 10px;
    bottom: 14px;
    width: auto;
    padding: 16px 16px 14px;
  }
  .card-title { font-size: 26px; }
  .card-lead { font-size: 12.5px; margin-bottom: 12px; }
  .btn { font-size: 7px; padding: 9px 11px 8px; }
  .news { padding: 14px; }
  .news h2 { font-size: 24px; }
  .news-pull { font-size: 12px; }
  .modal-box { padding: 22px 18px; margin: 3vh auto 5vh; }
  .modal-title { font-size: 36px; }
  .modal-x { top: -14px; right: -8px; width: 38px; height: 38px; }
  .doc-credits dl { grid-template-columns: 1fr; gap: 4px; }
  .doc-credits dd { margin-bottom: 14px; }
  #hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .frame, #card, .btn { transition: none; }
}

/* intro hero lockup ------------------------------------------------------- */
.hero {
  position: absolute;
  max-width: min(760px, 72vw);
}
.hero-kicker {
  display: inline-block;
  font-family: "PS2P", monospace;
  font-size: 8px;
  letter-spacing: 0.18em;
  margin: 0 0 18px;
  padding: 7px 10px 6px;
  color: var(--ink);
  background: var(--acc);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(13, 15, 20, 0.55);
}
.hero-title {
  font-family: "VT323", monospace;
  font-weight: 400;
  font-size: clamp(64px, 8.5vw, 132px);
  line-height: 0.78;
  letter-spacing: 0.01em;
  margin: 0 0 22px;
  color: #fff;
  text-shadow:
    5px 0 0 var(--ink), -5px 0 0 var(--ink), 0 5px 0 var(--ink), 0 -5px 0 var(--ink),
    5px 5px 0 var(--ink), -5px -5px 0 var(--ink), 5px -5px 0 var(--ink), -5px 5px 0 var(--ink),
    10px 10px 0 rgba(13, 15, 20, 0.45);
}
.hero-sub {
  font-family: "VT323", monospace;
  font-size: 25px;
  line-height: 1.15;
  margin: 0 0 16px;
  max-width: 34ch;
  color: #fff;
  text-shadow: 3px 3px 0 var(--ink), -1px -1px 0 var(--ink);
}
.hero-meta {
  font-family: "PS2P", monospace;
  font-size: 7px;
  letter-spacing: 0.08em;
  line-height: 2;
  text-transform: uppercase;
  margin: 0;
  max-width: 40ch;
  color: var(--acc);
  text-shadow: 2px 2px 0 var(--ink);
}
@media (max-width: 780px) {
  .hero { max-width: 84vw; }
  .hero-kicker { font-size: 7px; margin-bottom: 12px; }
  .hero-title { font-size: 56px; margin-bottom: 14px; text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 6px 6px 0 rgba(13, 15, 20, 0.45); }
  .hero-sub { font-size: 20px; max-width: 26ch; }
  .hero-meta { font-size: 6px; }
}

/* hero plate: keeps the intro lockup legible over any sky ------------------ */
.hero {
  width: fit-content;
  padding: 26px 30px 28px;
  background: rgba(11, 14, 20, 0.62);
  border: var(--px) solid var(--ink);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.85),
    0 0 0 7px var(--ink),
    12px 14px 0 7px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(3px);
}
body[data-theme="warm"] .hero { background: rgba(40, 16, 12, 0.55); }

/* gentle bobbing keeps the world alive without being showy ---------------- */
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.frame-inner { animation: bob 7s ease-in-out infinite; }
.zone > .frame:nth-of-type(2n) .frame-inner { animation-duration: 8.6s; }
.zone > .frame:nth-of-type(3n) .frame-inner { animation-duration: 6.2s; animation-delay: -2.1s; }
@media (prefers-reduced-motion: reduce) {
  .frame-inner { animation: none; }
}

/* captions sit on a chip so they survive the ground texture --------------- */
.frame figcaption b {
  display: inline-block;
  padding: 4px 7px 3px;
  background: rgba(11, 14, 20, 0.82);
}
.frame figcaption span { padding: 3px 7px 2px; background: rgba(11, 14, 20, 0.62); }

@media (max-width: 780px) {
  .hero { padding: 18px 16px 20px; }
}

/* mobile: keep the docked card out of the player's way ------------------- */
@media (max-width: 780px) {
  #card {
    right: 8px;
    left: 8px;
    bottom: 8px;
    padding: 12px 14px 12px;
  }
  .card-kicker { margin-bottom: 6px; }
  .card-title { font-size: 22px; margin-bottom: 10px; line-height: 1.05; }
  .card-lead { display: none; }
  #card .btn { padding: 9px 12px 8px; }
}
