/* ATELIER scroll film – the pinned, scroll-driven film at the top of the home page: stage,
   scene panels, meter and the static fallback. The rest of the site is styled in site.css. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #07080a;
  --cream: #f3f0ea;
  --muted: rgb(243 240 234 / 0.62);
  --gold: #cdbb98;
  --gutter: clamp(20px, 4.6vw, 72px);
  --len: 10; /* scroll length in screen heights: nine scenes + the pinned screen itself */
}
* {
  box-sizing: border-box;
}
html {
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font: 400 16px/1.6 "Archivo", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
}

/* ---------- The film ---------- */

.film {
  position: relative;
}
.stage {
  position: relative;
  height: 100vh;
  height: 100lvh; /* constant while the mobile address bar moves: no canvas resize */
  overflow: hidden;
  background: var(--ink);
}
.poster,
.poster img,
.stills img,
.canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.poster img,
.stills img {
  object-fit: cover;
}
.stills img {
  opacity: 0;
}
.canvas {
  opacity: 0;
}
.canvas.is-live {
  opacity: 1;
}
.outro {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(7 8 10 / 0.12) 0%, rgb(7 8 10 / 0.3) 55%, var(--ink) 100%);
  opacity: var(--outro, 0);
  pointer-events: none;
}
.hud {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 100vh;
  height: 100svh; /* text and meter sit in the part of the screen that is always visible */
  pointer-events: none;
}

.story {
  margin: 0;
  padding: 0;
  list-style: none;
}
.scene__still {
  display: none;
}
/* The scene panel: a near-black campaign card that holds its own over bright foam and black
   paint alike. Mostly solid, with a little blur behind it and a hairline edge that catches gold
   at the top-left corner, like light on a painted panel. */
.scene__panel {
  position: relative;
  padding: 20px 24px 22px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.05), rgb(255 255 255 / 0) 46%),
    rgb(9 10 12 / 0.8);
  -webkit-backdrop-filter: blur(14px) saturate(125%);
  backdrop-filter: blur(14px) saturate(125%);
  box-shadow: 0 22px 48px -30px rgb(0 0 0 / 0.75);
}
.scene__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(
    150deg,
    rgb(205 187 152 / 0.62),
    rgb(243 240 234 / 0.13) 34%,
    rgb(243 240 234 / 0.07) 72%,
    rgb(205 187 152 / 0.26)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
/* 02 / 09 ——— SNOW FOAM */
.scene__label {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0 0 14px;
  font-stretch: 125%;
  text-transform: uppercase;
}
.scene__n {
  color: var(--gold);
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.scene__of {
  color: rgb(243 240 234 / 0.5);
  font-size: 10px;
  letter-spacing: 0.16em;
}
.scene__name {
  display: flex;
  flex: 1;
  gap: 12px;
  align-items: center;
  align-self: center;
  margin-left: 6px;
  color: rgb(243 240 234 / 0.78);
  font-weight: 500;
  font-size: 9.5px;
  letter-spacing: 0.3em;
  white-space: nowrap;
}
.scene__name::before {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgb(205 187 152 / 0.5), rgb(243 240 234 / 0.1));
}
.scene__title {
  margin: 0;
  font-weight: 800;
  font-stretch: 118%;
  font-size: clamp(26px, 2.2vw, 36px);
  line-height: 0.98;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}
.scene__text {
  max-width: 32ch;
  margin: 12px 0 0;
  color: rgb(243 240 234 / 0.8);
  font-size: 14px;
  line-height: 1.55;
}
.scene__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
}
.scene__tags li {
  padding: 5px 11px 4px;
  border: 1px solid rgb(205 187 152 / 0.4);
  border-radius: 999px;
  background: rgb(205 187 152 / 0.07);
  color: rgb(243 240 234 / 0.88);
  font-weight: 500;
  font-stretch: 105%;
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

.meter {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(28px, 6svh, 48px);
  width: min(260px, 40vw);
}
.meter {
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.6);
}
.meter__now {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0 0 12px;
  font-stretch: 125%;
  font-size: 9.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}
.meter__n {
  color: var(--cream);
}
.meter__of {
  color: rgb(243 240 234 / 0.45);
}
.meter__name {
  margin-left: auto;
  color: rgb(243 240 234 / 0.72);
}
.meter__ticks {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
}
.meter__ticks i {
  position: relative;
  height: 1px;
  overflow: hidden;
  background: rgb(243 240 234 / 0.22);
}
.meter__ticks i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform: scaleX(var(--fill, 0));
  transform-origin: left;
}
.cue {
  position: absolute;
  bottom: clamp(28px, 6svh, 48px);
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
  color: rgb(243 240 234 / 0.7);
  font-stretch: 125%;
  font-size: 9.5px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}
.cue::after {
  content: "";
  display: block;
  width: 1px;
  height: 28px;
  margin: 10px auto 0;
  background: linear-gradient(var(--cream), transparent);
}
.debug {
  position: absolute;
  top: 74px;
  left: var(--gutter);
  margin: 0;
  padding: 8px 10px;
  background: rgb(0 0 0 / 0.65);
  color: #9fe7a8;
  font: 11px/1.45 ui-monospace, Menlo, monospace;
  white-space: pre;
}

/* ---------- Scroll-driven mode (JS on, motion allowed) ---------- */

.js .film {
  height: calc(var(--len) * 100vh);
  height: calc(var(--len) * 100lvh);
}
.js .stage {
  position: sticky;
  top: 0;
}
.js .scene {
  position: absolute;
  width: min(clamp(360px, 27vw, 430px), calc(100vw - 2 * var(--gutter)));
  opacity: 0;
  will-change: opacity, transform;
}
/* each scene's panel sits where the film is calm (garage, wall, floor) – never on the action */
.js .scene[data-pos^="t"] {
  top: calc(max(22px, env(safe-area-inset-top)) + 64px);
}
.js .scene[data-pos^="b"] {
  bottom: clamp(96px, 13svh, 132px);
}
.js .scene[data-pos$="l"] {
  left: var(--gutter);
}
.js .scene[data-pos$="r"] {
  right: var(--gutter);
}
@media (orientation: portrait) {
  .js .scene {
    right: var(--gutter);
    left: var(--gutter);
    width: auto;
    max-width: 440px;
  }
  .js .scene[data-pos],
  .js .scene[data-pos] {
    top: auto;
    bottom: auto;
  }
  .js .scene[data-pos-portrait="t"] {
    top: calc(max(16px, env(safe-area-inset-top)) + 58px);
  }
  .js .scene[data-pos-portrait="b"] {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}
.js .scene:first-child {
  opacity: 1; /* visible before the script's first frame */
}

/* ---------- Static mode: reduced motion or no JavaScript ---------- */

.static .stage,
.no-js .stage {
  height: auto;
  overflow: visible;
}
.static .poster,
.static .canvas,
.static .stills,
.static .meter,
.static .cue,
.static .outro,
.no-js .outro,
.no-js .poster,
.no-js .canvas,
.no-js .meter,
.no-js .cue {
  display: none;
}
.static .hud,
.no-js .hud {
  position: static;
  height: auto;
}
.static .story,
.no-js .story {
  display: grid;
  gap: 0;
}
.static .scene,
.no-js .scene {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 92vh;
  min-height: 92svh;
  padding: 0 var(--gutter) 12vh;
  overflow: hidden;
  isolation: isolate; /* the still (z-index -1) stays inside the scene, above the stage */
}
.static .scene__still,
.no-js .scene__still {
  display: block;
}
.static .scene__still img,
.no-js .scene__still img {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.static .scene__panel,
.no-js .scene__panel {
  max-width: 430px;
}

/* ---------- Phones ---------- */

@media (max-width: 640px) {
  .scene__panel {
    padding: 17px 19px 18px;
    border-radius: 14px;
  }
  .scene__label {
    margin-bottom: 12px;
  }
  .scene__n {
    font-size: 21px;
  }
  .scene__title {
    font-size: clamp(22px, 6.4vw, 28px);
  }
  .scene__text {
    margin-top: 9px;
    font-size: 13px;
    line-height: 1.5;
  }
  .scene__tags {
    margin-top: 13px;
  }
  .scene__tags li {
    padding: 4px 9px 3px;
    font-size: 8.5px;
  }
  .meter {
    right: var(--gutter);
    bottom: calc(26px + env(safe-area-inset-bottom));
    left: var(--gutter);
    width: auto;
  }
  .cue {
    display: none;
  }
}
