@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('./bricolage-grotesque-wght.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('./ibm-plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

:root {
  --void: #05070a;
  --ink: #f4f2ed;
  --muted: rgba(244, 242, 237, 0.66);
  --accent: #f2c235;
  --red: #c8332a;
  --line: rgba(244, 242, 237, 0.16);
  --display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }

/* -------------------------------------------------- layer 0: the film */
#stage {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#film,
#poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#poster {
  object-fit: cover;
  transition: opacity 0.8s ease 0.15s;
}

body.ready #poster { opacity: 0; }
/* Without the film the poster is the picture, and the page becomes an ordinary
   long read with every line laid out in order. */
body[data-mode='static'] #film { display: none; }
body[data-mode='static'] .act {
  height: auto;
  min-height: 100vh;
}
body[data-mode='static'] .beat {
  position: relative;
  opacity: 1 !important;
  transform: none !important;
}
body[data-mode='static'] #hint { display: none; }

/* -------------------------------------------------- layer 1: grade */
#vignette,
#grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

#vignette {
  background: radial-gradient(ellipse at 50% 45%, transparent 42%, rgba(0, 0, 0, 0.62) 100%);
}

#grain {
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* -------------------------------------------------- layer 3: fixed UI */
#progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(244, 242, 237, 0.1);
  z-index: 5;
}

#bar {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem clamp(1.1rem, 4vw, 3rem);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark svg { display: block; }

#chapter {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 1.15rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(8, 10, 14, 0.5);
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-solid {
  background: var(--accent);
  border-color: var(--accent);
  color: #16130a;
}

.btn-solid:hover { background: #ffd95c; border-color: #ffd95c; color: #16130a; }

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

/* -------------------------------------------------- layer 2: content */
main {
  position: relative;
  z-index: 2;
}

.act {
  height: 260vh;
  position: relative;
}

.beat {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 clamp(1.2rem, 6vw, 6rem);
  opacity: 0;
  will-change: opacity, transform;
}

.beat[data-place='right'] { justify-content: flex-end; text-align: right; }
.beat[data-place='centre'] { justify-content: center; text-align: center; }
.beat[data-place='lower'] {
  justify-content: center;
  align-items: flex-end;
  text-align: center;
  padding-bottom: clamp(2.5rem, 8vh, 5rem);
}
.beat[data-place='lower'] h2 { font-size: clamp(1.8rem, 3.2vw, 2.9rem); }
.beat[data-place='lower'] .panel { max-width: 40rem; }

.panel {
  max-width: 34rem;
  padding: 2rem;
  margin: 0 -2rem;
}

.beat[data-place='centre'] .panel { max-width: 42rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.1rem;
}

.beat h2 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 5.4rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.035em;
  text-wrap: balance;
  text-shadow: 0 0.5rem 2.5rem rgba(0, 0, 0, 0.75);
}

.beat p {
  margin: 1.35rem 0 0;
  max-width: 32ch;
  font-size: clamp(1rem, 1.15vw, 1.14rem);
  line-height: 1.62;
  color: var(--muted);
  text-shadow: 0 0.3rem 1.6rem rgba(0, 0, 0, 0.85);
}

.beat[data-place='right'] p { margin-left: auto; }
.beat[data-place='centre'] p,
.beat[data-place='lower'] p { margin-left: auto; margin-right: auto; }

/* Contrast scrim, only under the side the copy sits on. */
.beat::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(5, 7, 10, 0.82) 0%, rgba(5, 7, 10, 0.5) 34%, transparent 62%);
}

.beat[data-place='right']::before {
  background: linear-gradient(270deg, rgba(5, 7, 10, 0.82) 0%, rgba(5, 7, 10, 0.5) 34%, transparent 62%);
}

.beat[data-place='centre']::before {
  background: radial-gradient(ellipse at 50% 50%, rgba(5, 7, 10, 0.8) 0%, rgba(5, 7, 10, 0.55) 45%, transparent 78%);
}

.beat[data-place='lower']::before {
  background: linear-gradient(0deg, rgba(5, 7, 10, 0.92) 0%, rgba(5, 7, 10, 0.62) 34%, transparent 62%);
}

#hint {
  position: fixed;
  left: 50%;
  bottom: 1.9rem;
  transform: translateX(-50%);
  z-index: 4;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.4s ease;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

#hint span {
  display: block;
  width: 1px;
  height: 26px;
  background: linear-gradient(var(--accent), transparent);
}

/* -------------------------------------------------- outro */
#outro {
  position: relative;
  z-index: 3;
  background: #07090d;
  border-top: 1px solid var(--line);
  padding: clamp(4.5rem, 12vh, 9rem) clamp(1.2rem, 6vw, 6rem) 3rem;
}

.outro-grid {
  display: grid;
  gap: clamp(2.4rem, 5vw, 5rem);
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: start;
  max-width: 74rem;
  margin: 0 auto;
}

#outro h3 {
  margin: 0.9rem 0 0;
  font-size: clamp(2.1rem, 4.4vw, 3.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

#outro p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.66;
  max-width: 38ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 2rem;
}

.spec {
  border-top: 1px solid var(--line);
  margin: 0;
}

.spec div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.spec dt {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.spec dd {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--muted);
}

footer {
  max-width: 74rem;
  margin: clamp(3rem, 8vh, 6rem) auto 0;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 2rem;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(244, 242, 237, 0.45);
}

/* -------------------------------------------------- narrow screens */
@media (max-width: 860px) {
  nav { padding: 1rem; }
  #chapter { display: none; }
  .act { height: 240vh; }
  .beat,
  .beat[data-place='right'],
  .beat[data-place='centre'] {
    justify-content: flex-start;
    align-items: flex-end;
    text-align: left;
    padding: 0 1.2rem 5.5rem;
  }
  .beat p { margin-left: 0; margin-right: 0; }
  .beat::before,
  .beat[data-place='right']::before,
  .beat[data-place='centre']::before {
    background: linear-gradient(0deg, rgba(5, 7, 10, 0.92) 0%, rgba(5, 7, 10, 0.6) 46%, transparent 78%);
  }
  .panel { padding: 0; margin: 0; }
  .outro-grid { grid-template-columns: minmax(0, 1fr); }
  .spec div { grid-template-columns: minmax(0, 1fr); gap: 0.3rem; }
}

/* -------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .act { height: auto; min-height: 100vh; }
  .beat {
    position: relative;
    opacity: 1 !important;
    transform: none !important;
  }
  #poster { transition: none; }
  #hint { display: none; }
}
