/* Zip Code Z's page: the box art's moonlit street on top, then the night it leads into.
   Colors are sampled from the box art and the logo (tools/trailer/box_art.gd in the game). */

:root {
  color-scheme: dark;

  --sky: #060919;        /* the box art's zenith, and the page */
  --dusk: #1a152c;
  --plum: #3c1f32;
  --ember: #983335;      /* the burning horizon */
  --blood: #dd3627;      /* the Z */
  --blood-deep: #7d151c; /* the Z's extrusion */
  --bone: #efdeb9;       /* ZIP CODE */
  --moon: #f6edc9;
  --lamp: #ffe08a;       /* a lit window: hover and focus only */
  --ink: #0a0610;        /* the logo's outline */
  --text: #c9c1d4;
  --text-dim: #9890a8;

  /* Screen pixels per texel of the box art; the logo is drawn at the same scale. */
  --t: 2px;

  --pixel: "Press Start 2P", ui-monospace, monospace;
  /* Overpass is drawn from Highway Gothic, the lettering on American street signs. */
  --road: "Overpass", "Helvetica Neue", Arial, sans-serif;
}

@media (min-width: 720px) and (min-height: 700px) { :root { --t: 3px; } }
@media (min-width: 1600px) and (min-height: 1180px) { :root { --t: 4px; } }

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

html { background: var(--sky); }

body {
  margin: 0;
  background: var(--sky);
  color: var(--text);
  font-family: var(--road);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; height: auto; }

p { margin: 0; }

a {
  color: var(--bone);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover { color: var(--lamp); }

:focus-visible {
  outline: 3px solid var(--lamp);
  outline-offset: 3px;
}

/* ---------- The box art, live ---------- */

.hero {
  position: relative;
  height: calc(300 * var(--t));
  overflow: hidden;
  isolation: isolate;
  /* Past the art's edges the sky carries on: each row is the color of the art's own edge, with stars. */
  background:
    url("/zip-code-z/img/stars.png") 0 0 / calc(150 * var(--t)) calc(110 * var(--t)) repeat-x,
    url("/zip-code-z/img/sky-edge.png") 0 0 / 100% calc(320 * var(--t)) no-repeat,
    var(--sky);
  image-rendering: pixelated;
  text-align: center;
}

.art {
  position: absolute;
  top: 0;
  left: 50%;
  width: calc(240 * var(--t));
  height: calc(320 * var(--t));
  max-width: none;
  transform: translateX(-50%);
  image-rendering: pixelated;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  z-index: -1;
}

/* The street runs on into the page. */
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(40 * var(--t));
  background: linear-gradient(transparent, var(--sky));
  z-index: -1;
}

.hero h1 { margin: 0; line-height: 0; }

/* Where box_art.gd puts it: 11 texels down, centered on the moon. */
.logo {
  position: absolute;
  top: calc(11 * var(--t));
  left: 50%;
  width: calc(195 * var(--t));
  height: calc(135 * var(--t));
  max-width: none;
  transform: translateX(-50%);
  image-rendering: pixelated;
}

/* On a phone the logo would touch both edges at full scale. */
@media (max-width: 440px) {
  .logo { width: min(calc(195 * var(--t) * 0.8), 100vw - 40px); height: auto; }
}

.pitch {
  position: absolute;
  top: calc(152 * var(--t));
  left: 0;
  right: 0;
  padding: 0 16px;
}

/* A pool of shadow behind the words, so they read over the fire and the trees. */
.pitch::before {
  content: "";
  position: absolute;
  inset: -40px 0 -48px;
  background: radial-gradient(closest-side, rgb(6 9 25 / 0.78), rgb(6 9 25 / 0.5) 55%, transparent);
  z-index: -1;
}

.tagline {
  font: 12px/1.5 var(--pixel);
  color: var(--bone);
  text-transform: uppercase;
  text-shadow: 2px 2px 0 var(--blood-deep), 4px 4px 0 var(--ink);
}

@media (max-width: 359px) { .tagline { font-size: 10px; } }
@media (min-width: 480px) { .tagline { font-size: 16px; } }
@media (min-width: 900px) { .tagline { font-size: 24px; } }

/* The tagline types itself out, like the trailer's first cards. Press Start 2P is monospaced, so 25ch is the line. */
@media (prefers-reduced-motion: no-preference) {
  .tagline .type {
    display: inline-block;
    vertical-align: bottom;
    width: 25ch;
    overflow: hidden;
    white-space: nowrap;
    animation: type 1.5s steps(25, end) 0.5s both;
  }

  .tagline::after {
    content: "";
    display: inline-block;
    width: 0.75em;
    height: 1em;
    margin-left: 0.15em;
    vertical-align: -0.05em;
    background: var(--blood);
    box-shadow: 4px 4px 0 var(--ink);
    animation: blink 1s steps(2, jump-none) infinite;
  }
}

@keyframes type { from { width: 0; } }
@keyframes blink { 50% { opacity: 0; } }

.lede {
  max-width: 26em;
  margin: 18px auto 0;
  color: var(--moon);
  font-size: 1.0625rem;
  line-height: 1.5;
  text-shadow: 0 2px 0 var(--ink), 0 0 12px var(--sky);
  text-wrap: balance;
}

@media (min-width: 900px) { .lede { font-size: 1.25rem; } }

.status {
  margin-top: 16px;
  font: 10px/1.6 var(--pixel);
  color: var(--lamp);
  text-shadow: 2px 2px 0 var(--ink);
}

@media (min-width: 480px) { .status { font-size: 12px; } }

/* ---------- The trailer ---------- */

main {
  padding: 0 16px clamp(80px, 10vw, 128px);
}

.trailer {
  position: relative;
  max-width: 1104px;
  margin: calc(-14 * var(--t)) auto 0;
}

/* Screens get the logo's treatment: an ink rim and a hard red extrusion down and to the right. */
.screen, .shot img, .verbs img, .band {
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--blood-deep), 6px 6px 0 3px var(--ink);
  background: #000;
}

.screen { position: relative; }

.screen video { width: 100%; aspect-ratio: 16 / 9; }

.play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: linear-gradient(rgb(6 9 25 / 0) 40%, rgb(6 9 25 / 0.55));
  cursor: pointer;
}

.play[hidden] { display: none; }

.play span {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px 14px 18px;
  font: 12px/1 var(--pixel);
  color: var(--bone);
  background: var(--blood);
  box-shadow:
    inset 3px 3px 0 #ff6a4d,
    inset -3px -3px 0 #a3201f,
    0 0 0 3px var(--ink),
    5px 5px 0 3px var(--ink);
  text-shadow: 2px 2px 0 var(--blood-deep);
}

@media (min-width: 640px) { .play span { font-size: 16px; padding: 20px 28px 18px 22px; } }

/* A stepped triangle in 2px steps. */
.play span::before {
  content: "";
  width: 8px;
  height: 14px;
  background: var(--bone);
  clip-path: polygon(0 0, 2px 0, 2px 2px, 4px 2px, 4px 4px, 6px 4px, 6px 6px, 8px 6px, 8px 8px, 6px 8px, 6px 10px, 4px 10px, 4px 12px, 2px 12px, 2px 14px, 0 14px);
}

.play:hover span, .play:focus-visible span { background: #ef4430; }
.play:active span { transform: translate(3px, 3px); box-shadow: inset 3px 3px 0 #ff6a4d, inset -3px -3px 0 #a3201f, 0 0 0 3px var(--ink), 2px 2px 0 3px var(--ink); }
.play:focus-visible { outline: none; }
.play:focus-visible span { outline: 3px solid var(--lamp); outline-offset: 4px; }

figcaption {
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.trailer figcaption { margin-top: 18px; text-align: center; }

/* ---------- Sections ---------- */

main > section {
  max-width: 1104px;
  margin: clamp(96px, 13vw, 168px) auto 0;
}

h2, h3 {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 400;
  color: var(--bone);
  text-wrap: balance;
}

/* Headings get ZIP CODE's extrusion. */
h2 {
  font-size: 20px;
  line-height: 1.6;
  text-shadow: 3px 3px 0 var(--blood-deep), 5px 5px 0 var(--ink);
}

@media (min-width: 640px) { h2 { font-size: 24px; } }
@media (min-width: 1000px) { h2 { font-size: 32px; } }

h3 {
  font-size: 14px;
  line-height: 1.5;
  text-shadow: 2px 2px 0 var(--blood-deep);
}

.copy p, .together p { max-width: 34em; }

h2 + p { margin-top: 28px; }
p + p { margin-top: 1em; }

/* Your address */

.address {
  display: grid;
  gap: 48px;
}

@media (min-width: 960px) {
  .address { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 64px; align-items: start; }
  .address .copy { position: sticky; top: 64px; }
}

.shots { display: grid; gap: 40px; }

.shot { margin: 0; }

/* The four verbs */

.verbs ul {
  display: grid;
  gap: 56px 40px;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 760px) { .verbs ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.verbs h3 { margin-top: 26px; }
.verbs h3 + p { margin-top: 10px; max-width: 32em; }

/* The dead */

.dead h2 {
  color: var(--blood);
  text-shadow: 3px 3px 0 var(--ink);
}

.band {
  margin: 0 0 56px;
  height: clamp(220px, 38vw, 480px);
  overflow: hidden;
}

.band img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 0;
}

.dead-body {
  display: grid;
  gap: 48px;
}

@media (min-width: 960px) {
  .dead-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; }
}

/* A new kind each day: the day is the marker. */
.days {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px dashed rgb(239 222 185 / 0.16);
}

.days li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 4px 16px;
  padding: 16px 0 15px;
  border-bottom: 2px dashed rgb(239 222 185 / 0.16);
  line-height: 1.5;
}

.days .when {
  padding-top: 4px;
  font: 10px/1.6 var(--pixel);
  color: var(--blood);
}

.days strong { color: var(--bone); }

@media (max-width: 380px) {
  .days li { grid-template-columns: 1fr; }
}

/* Play together */

.together { max-width: 1104px; }

@media (min-width: 960px) {
  .together { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 64px; align-items: baseline; }
  .together h2 + p { margin-top: 0; }
}

/* The close */

.last {
  display: grid;
  gap: 40px;
  justify-items: center;
  text-align: center;
}

.box {
  width: min(calc(240 * var(--t)), 100%);
  image-rendering: pixelated;
  box-shadow: 8px 8px 0 var(--blood-deep), 8px 8px 0 3px var(--ink);
  border: 3px solid var(--ink);
}

.last .copy p { margin-left: auto; margin-right: auto; }
.last .status { margin-top: 24px; font-size: 12px; }

@media (min-width: 900px) {
  .last { grid-template-columns: auto minmax(0, 1fr); gap: 72px; align-items: center; justify-items: start; text-align: left; }
  .last .copy p { margin-left: 0; }
  .box { width: calc(240 * 2px); }
}

/* ---------- Footer ---------- */

.footer {
  padding: 28px 16px 40px;
  border-top: 2px dashed rgb(239 222 185 / 0.16);
  color: var(--text-dim);
  font-size: 0.9375rem;
  text-align: center;
}

.footer p + p { margin-top: 0.4em; }
.footer a { color: var(--text); }
