:root {
  --night: #05080f;
  --ink: #ece6d8;
  --dim: #a9a79f;
  --lamp: #ff9a3d;
  --line: rgb(236 230 216 / 0.18);
  --target: 24px;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  color-scheme: dark;
}

@media (pointer: coarse) {
  :root { --target: 44px; }
}

html {
  background: var(--night);
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-block-size: 100dvh;
  color: var(--ink);
  font: 400 1rem/1.5 "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1 { text-wrap: balance; }

/* ---------- the 3D canvas and the layers above it ---------- */

#scene,
#poster,
#shade,
#veil {
  position: fixed;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
}

#scene {
  display: block;
  touch-action: none;
  outline: none;
}

/* The photo, shown until the 3D version of it has loaded. Its size and position are set from
   script so it lines up with the 3D framing. */
#poster {
  background: var(--night) url("../static/poster.jpg") no-repeat 50% 100% / auto 100%;
  transition: opacity 1.4s ease;
}
#poster.gone { opacity: 0; }

/* Darkens the edges on the opening screen so the text stays readable. */
#shade {
  pointer-events: none;
  background:
    linear-gradient(to right, var(--night) 0%, transparent 16%, transparent 84%, var(--night) 100%),
    radial-gradient(120% 90% at 50% 55%, transparent 50%, rgb(3 5 10 / 0.55) 100%),
    linear-gradient(to bottom, rgb(3 5 10 / 0.35) 0%, transparent 28%, transparent 66%, rgb(3 5 10 / 0.6) 100%);
  transition: opacity 1s ease;
}
#shade.gone { opacity: 0; }

/* Full-screen fade used between the opening shot and the forest. */
#veil {
  pointer-events: none;
  background: #02040a;
  opacity: 0;
  transition: opacity 0.7s ease;
}
#veil.on { opacity: 1; }

/* ---------- buttons ---------- */

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  min-block-size: var(--target);
  min-inline-size: var(--target);
}

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

#enter,
#resume {
  padding: 0.8em 2.2em;
  border: 1px solid rgb(236 230 216 / 0.55);
  border-radius: 999px;
  background: rgb(5 8 15 / 0.35);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.8rem;
  backdrop-filter: blur(6px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}

:is(#enter, #resume):hover {
  border-color: var(--lamp);
  color: #fff3e2;
  box-shadow: 0 0 32px rgb(255 154 61 / 0.3);
}

/* ---------- opening screen ---------- */

#title {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  padding:
    max(var(--pad), env(safe-area-inset-top, 0px))
    max(var(--pad), env(safe-area-inset-right, 0px))
    max(var(--pad), env(safe-area-inset-bottom, 0px))
    max(var(--pad), env(safe-area-inset-left, 0px));
  text-align: center;
  transition: opacity 0.6s ease;
}
#title.gone {
  opacity: 0;
  pointer-events: none;
}

#title header {
  align-self: start;
  padding-block-start: clamp(1rem, 7vh, 5rem);
}

#band-name {
  margin: 0;
  font-weight: 200;
  font-size: clamp(3.2rem, 13vw, 9rem);
  line-height: 1;
  letter-spacing: 0.32em;
  margin-inline-end: -0.32em; /* the last letter's tracking would push the word off centre */
  text-shadow: 0 0 60px rgb(5 8 15 / 0.8);
}

#tagline {
  margin: 1.2rem 0 0;
  color: var(--dim);
  font-size: 0.82rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
}

.start {
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 1rem;
  min-block-size: 7rem;
}

#load-text,
#keys {
  margin: 0;
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-wrap: balance; /* on a narrow phone the line splits evenly instead of leaving one word alone */
}

/* ---------- while walking ---------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#hint {
  position: absolute;
  inset-inline: 0;
  inset-block-end: max(1.4rem, env(safe-area-inset-bottom, 0px));
  margin: 0;
  padding-inline: 1rem;
  color: var(--dim);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 1px 12px #000;
  transition: opacity 1.2s ease;
}
#hint.gone { opacity: 0; }

/* Touch: a thumb stick appears under the left thumb. */
#stick {
  position: absolute;
  inline-size: 104px;
  block-size: 104px;
  margin: -52px 0 0 -52px;
  border: 1px solid rgb(236 230 216 / 0.3);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#stick.on { opacity: 1; }
#stick-knob {
  position: absolute;
  inset: 50% auto auto 50%;
  inline-size: 44px;
  block-size: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgb(236 230 216 / 0.35);
}

#pause {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  background: rgb(3 5 10 / 0.55);
  backdrop-filter: blur(3px);
}
#pause p {
  margin: 0;
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
}

[hidden] { display: none !important; }

.noscript {
  position: fixed;
  inset: auto 0 2rem;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  #poster,
  #shade,
  #veil,
  #title,
  #hint { transition-duration: 0.2s; }
}
