/* Chakwa's page, in the game's "Ledger by Lantern" look (docs/UI_STYLE.md):
   warm soot, bone text, temple-red stamps, a lamp flame on what you point at,
   pixels doubled, motion in steps. */

@font-face {
  font-family: "VT323";
  src: url("fonts/VT323-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --soot: #0e0c0b;
  --soot-edge: #1c1714;
  --text: #c8bfb2;
  --dim: #968c80;
  --menu: #a0968a;
  --faint: #4f4a45;
  --accent: #a3302a;
  --mark: #8a2222;
  --margin: #6e1d18;
  --border: #5a524a;
  --lamp: #d49a42;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  overflow-x: hidden;
  background: var(--soot);
  color: var(--text);
  font-family: "VT323", ui-monospace, monospace;
  -webkit-font-smoothing: none;
}

body {
  background: none;   /* html keeps the soot; a body fill would cover the video */
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 100svh;   /* one screen; it scrolls only when a window is too short to fit */
  padding: 0 var(--gutter);
}

img { image-rendering: pixelated; }
button { font: inherit; color: inherit; }

/* ---- background ---- */

.bg, .shade, .grain { position: fixed; inset: 0; pointer-events: none; }
.bg { z-index: -3; background: var(--soot) url("media/bg_poster.jpg") center / cover; }
.bg video {
  width: 100%; height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  filter: saturate(.9) contrast(1.05);
}
.shade {
  z-index: -2;
  background:
    radial-gradient(ellipse 120% 90% at 60% 40%, transparent 30%, rgba(14, 12, 11, .75) 100%),
    linear-gradient(90deg, rgba(14, 12, 11, .85) 0%, rgba(14, 12, 11, .45) 45%, transparent 75%),
    linear-gradient(0deg, rgba(14, 12, 11, .9) 0%, transparent 35%);
}
.grain {
  z-index: -1;
  opacity: .5;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .28) 0 2px, transparent 2px 4px);
}

/* ---- top bar ---- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: clamp(12px, 3vh, 28px);
}
.para { width: clamp(84px, 10vw, 128px); height: auto; mix-blend-mode: screen; image-rendering: auto; }

.link {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 6px 0;
  font-size: clamp(18px, 2vw, 22px);
  color: var(--menu);
  cursor: pointer;
  letter-spacing: 1px;
}
.link:hover, .link:focus-visible { color: var(--text); outline: none; }
.tri {
  width: 0; height: 0;
  border-left: 10px solid var(--accent);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

/* ---- hero ---- */

.hero {
  align-self: center;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 16px);
}
h1 { margin: 0 0 clamp(0px, 1vh, 8px) -8px; line-height: 0; }
h1 img { width: clamp(200px, min(34vw, 50vh), 502px); height: auto; }

.tag {
  margin: 0;
  font-size: clamp(24px, min(3.4vw, 6vh), 48px);
  line-height: 1;
  color: var(--text);
  text-shadow: 0 2px 0 #000;
}
.blurb {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.1;
  color: var(--dim);
  text-shadow: 0 2px 0 #000;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  margin-top: clamp(4px, 1.5vh, 16px);
}

/* soot panel buttons; the lamp flame marks the one under the pointer */
.btn {
  position: relative;
  display: inline-flex; flex-direction: column; justify-content: center;
  min-height: 60px;
  padding: 8px 20px 8px 44px;
  background: rgba(14, 12, 11, .88);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px var(--soot-edge), 0 4px 0 rgba(0, 0, 0, .6);
  color: var(--menu);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  line-height: 1;
}
.btn span { font-size: clamp(24px, 2.4vw, 28px); }
.btn small { font-size: 18px; color: var(--dim); margin-top: 2px; }
.btn::before {
  content: "";
  position: absolute; left: 12px; top: 50%;
  width: 24px; height: 32px; margin-top: -16px;
  background: url("img/flame.png") 0 0 / 72px 32px no-repeat;
  image-rendering: pixelated;
  opacity: 0;
}
.btn:hover, .btn:focus-visible { color: var(--text); border-color: var(--lamp); outline: none; }
.btn:hover::before, .btn:focus-visible::before { opacity: 1; animation: flame .36s steps(3) infinite; }
.btn:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--soot-edge), 0 2px 0 rgba(0, 0, 0, .6); }
@keyframes flame { to { background-position: -72px 0; } }

.btn.primary { background: rgba(110, 29, 24, .92); border-color: var(--accent); color: var(--text); }
.btn.primary small { color: #d8b8a8; }
.btn.primary::before { opacity: .9; animation: flame .36s steps(3) infinite; }
.btn.primary:hover, .btn.primary:focus-visible { border-color: var(--lamp); }
.btn[aria-disabled="true"] { pointer-events: none; opacity: .6; }

/* the waitlist: a button that opens into an email field */
.wait { display: flex; }
.wait-form { display: flex; gap: 0; }
.wait-form[hidden], .listed[hidden], .btn[hidden] { display: none; }
.wait-form input[type="email"] {
  width: clamp(190px, 22vw, 260px);
  min-height: 60px;
  padding: 0 14px;
  background: rgba(14, 12, 11, .92);
  border: 2px solid var(--lamp);
  border-right: 0;
  box-shadow: inset 0 0 0 2px var(--soot-edge);
  color: var(--text);
  font: inherit;
  font-size: 24px;
  border-radius: 0;
}
.wait-form input::placeholder { color: var(--faint); }
.wait-form input:focus { outline: none; }
.wait-form .go { padding: 8px 16px 8px 40px; border-color: var(--lamp); }
.wait-form .go::before { left: 10px; }
.wait-form .go:disabled { cursor: wait; opacity: .7; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.listed { display: flex; align-items: center; gap: 14px; min-height: 60px; }
.listed p { margin: 0; max-width: 16ch; font-size: 18px; line-height: 1; color: var(--dim); }
.stamp {
  padding: 4px 12px;
  border: 4px solid var(--accent);
  color: var(--accent);
  font-size: 30px;
  letter-spacing: 3px;
  text-transform: uppercase;
  transform: rotate(-7deg);
  background: rgba(14, 12, 11, .6);
  -webkit-mask: repeating-linear-gradient(115deg, #000 0 5px, rgba(0, 0, 0, .7) 5px 6px, #000 6px 11px, rgba(0, 0, 0, .55) 11px 12px);
  mask: repeating-linear-gradient(115deg, #000 0 5px, rgba(0, 0, 0, .7) 5px 6px, #000 6px 11px, rgba(0, 0, 0, .55) 11px 12px);
}
.listed.fresh .stamp { animation: thump .3s steps(3) both; }
@keyframes thump {
  from { transform: rotate(-7deg) scale(1.8); opacity: 0; }
  to { transform: rotate(-7deg) scale(1); opacity: 1; }
}

/* the like: a pixel heart and its count */
.like {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 60px;
  padding: 0 16px;
  background: rgba(14, 12, 11, .88);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 2px var(--soot-edge), 0 4px 0 rgba(0, 0, 0, .6);
  cursor: pointer;
  font-size: 24px;
  color: var(--menu);
}
.like svg { fill: none; stroke: var(--menu); stroke-width: .5; overflow: visible; }
.like:hover, .like:focus-visible { border-color: var(--lamp); color: var(--text); outline: none; }
.like[aria-pressed="true"] svg { fill: var(--accent); stroke: var(--accent); }
.like[aria-pressed="true"] { color: var(--text); }
.like.beat svg { animation: beat .3s steps(3); }
@keyframes beat { 50% { transform: scale(1.35); } }

.msg { margin: 0; min-height: 1em; font-size: 20px; color: var(--lamp); text-shadow: 0 2px 0 #000; }
.msg:empty { display: none; }
.waiting { margin: 0; font-size: clamp(20px, 2vw, 24px); color: var(--dim); text-shadow: 0 2px 0 #000; }
.waiting b { color: var(--text); font-weight: normal; }

/* ---- gallery: small photographs along the bottom ---- */

.gallery {
  display: flex;
  justify-content: flex-end;
  gap: clamp(8px, 1.2vw, 16px);
  padding: 8px 4px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery button {
  flex: 0 0 auto;
  padding: 4px 4px 12px;
  background: #b9ad9c;
  border: 0;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .7);
  cursor: zoom-in;
  transform: rotate(var(--r, -2deg));
}
.gallery button:nth-child(2n) { --r: 2deg; }
.gallery button:nth-child(3n) { --r: -1deg; }
.gallery button:hover, .gallery button:focus-visible { transform: rotate(0) translateY(-4px); outline: 2px solid var(--lamp); outline-offset: 2px; }
.gallery img {
  display: block;
  width: clamp(88px, min(9vw, 15vh), 150px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  filter: sepia(.25) contrast(1.05);
}

.foot {
  padding: 8px 0 clamp(10px, 2vh, 20px);
  font-size: 16px;
  color: var(--faint);
  text-align: right;
}

/* ---- viewers (screenshot, trailer) ---- */

.viewer {
  max-width: none; max-height: none;
  width: 100vw; height: 100svh;
  margin: 0; padding: var(--gutter);
  border: 0;
  background: rgba(8, 7, 6, .94);
  color: var(--text);
}
.viewer[open] { display: grid; place-items: center; }
.viewer::backdrop { background: transparent; }
.viewer img, .viewer video {
  max-width: 100%; max-height: calc(100svh - 2 * var(--gutter));
  border: 2px solid var(--border);
  box-shadow: 0 0 0 4px var(--soot), 0 8px 0 rgba(0, 0, 0, .6);
}
.viewer .frame {
  width: min(100%, 1280px, calc((100svh - 2 * var(--gutter)) * 16 / 9));
  aspect-ratio: 16 / 9;
  border: 2px solid var(--border);
  box-shadow: 0 0 0 4px var(--soot), 0 8px 0 rgba(0, 0, 0, .6);
  background: #000;
}
.viewer iframe { display: block; width: 100%; height: 100%; border: 0; }
.viewer .close, .viewer .nav {
  position: absolute;
  background: rgba(14, 12, 11, .9);
  border: 2px solid var(--border);
  color: var(--menu);
  font-size: 32px; line-height: 1;
  width: 48px; height: 48px;
  cursor: pointer;
}
.viewer .close { top: 16px; right: 16px; }
.viewer .nav { top: 50%; margin-top: -24px; }
.viewer .prev { left: 16px; }
.viewer .next { right: 16px; }
.viewer .close:hover, .viewer .nav:hover, .viewer .close:focus-visible, .viewer .nav:focus-visible { border-color: var(--lamp); color: var(--text); outline: none; }

/* ---- small screens ---- */

@media (max-width: 720px) {
  .shade {
    background:
      radial-gradient(ellipse 140% 90% at 50% 30%, transparent 20%, rgba(14, 12, 11, .7) 100%),
      linear-gradient(0deg, rgba(14, 12, 11, .95) 0%, rgba(14, 12, 11, .55) 60%, rgba(14, 12, 11, .2) 100%);
  }
  .hero { align-self: end; padding-bottom: 8px; }
  .actions { display: grid; grid-template-columns: 1fr auto; }
  .actions .primary { grid-column: 1 / -1; }
  .wait, .wait-form { min-width: 0; }
  .wait > .btn { width: 100%; }
  .wait:has(.wait-form:not([hidden])) { grid-column: 1 / -1; }
  .like { justify-self: start; }
  .wait-form { width: 100%; }
  .wait-form input[type="email"] { flex: 1; width: auto; min-width: 0; font-size: 20px; }
  .wait-form .go { padding: 8px 12px; }
  .wait-form .go::before { display: none; }
  .btn small { font-size: 16px; }
  .gallery { justify-content: flex-start; }
  .foot { text-align: left; }
  .viewer .nav { top: auto; bottom: 16px; margin: 0; }
}
@media (min-width: 721px) and (max-height: 700px) { .blurb { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .btn::before, .btn.primary::before, .listed.fresh .stamp, .like.beat svg { animation: none !important; }
}
