/* ============================================================
   The Story — silent-film ink cinema.
   Article-first: the raw document is a readable illustrated
   story (no-JS / reduced-motion / mobile / WebGL-fail body).
   html.webgl turns the same markup into the film's scroll
   spacer + intertitle overlays.
   ============================================================ */

@font-face {
  font-family: "Aspekta";
  src: url("/sandbox/site3/assets/fonts/Aspekta-300.woff2") format("woff2");
  font-weight: 300;
  font-display: block;
}

@font-face {
  font-family: "Aspekta";
  src: url("/sandbox/site3/assets/fonts/Aspekta-500.woff2") format("woff2");
  font-weight: 500;
  font-display: block;
}

@font-face {
  font-family: "Aspekta";
  src: url("/sandbox/site3/assets/fonts/Aspekta-700.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

:root {
  --purple: #6663fd;
  --ink: #141414;
  --ink-soft: #3d3d3d;
  --paper: #f4f2ec;
  --font: "Aspekta", system-ui, -apple-system, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --strip-w: 46px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.story-logo {
  position: fixed;
  top: 22px;
  left: 26px;
  z-index: 40;
  opacity: 0.85;
  /* the brand mark rides the story's color: purple at the ends, ink-gray through
     the gray/dark middle. JS toggles .is-mono as you scroll past the title. */
  filter: grayscale(0) brightness(1);
  transition: opacity 0.3s, filter 0.6s ease;
}

.story-logo:hover {
  opacity: 1;
}

.story-logo.is-mono {
  filter: grayscale(1) brightness(0.35);
}

.story-logo.is-dark {
  filter: grayscale(1) brightness(2.4);
}

/* ---------------- Intertitle narration plates ---------------- */
/* Narration reads like a silent-film title plate: a framed cream card, not a
   floating subtitle, so it's unmistakably "we are being narrated to." */

.beat .card {
  text-align: center;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.beat .card p {
  font-size: clamp(19px, 2.5vw, 30px);
  line-height: 1.5;
}

/* ---------------- Silent-film title card ---------------- */

/* An ornate silent-film frame drawn as a scalable inline-SVG border-image:
   a double rule with scrolled corners and small fleurons — real "frilliness". */
/* an ornate silent-film frame — nested corner scrollwork + a double rule, in a
   scalable inline-SVG border-image (corners live in the fixed slice, so they
   never distort; the straight edges just stretch). */
:root {
  /* One ornate engraved frame for every card — dense filigree corner scrolls
     (double C-volutes + a diamond + an acanthus tip) with clean double
     rounded-rule edges. The corner motif lives entirely inside the 96px slice so
     it scales without distortion; the edges just extend. The card's own opaque
     parchment fills the whole border box, so nothing shows through the frame. */
  --ornate-frame:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' fill='none' stroke='%23141414'><defs><g id='c' stroke-linecap='round' stroke-linejoin='round'><path d='M96 32 C68 32 47 44 43 71 C41 84 51 90 60 84 C68 79 63 69 55 73' stroke-width='2'/><path d='M32 96 C32 68 44 47 71 43 C84 41 90 51 84 60 C79 68 69 63 73 55' stroke-width='2'/><path d='M96 46 C76 46 61 56 56 75' stroke-width='0.9'/><path d='M46 96 C46 76 56 61 75 56' stroke-width='0.9'/><path d='M31 31 C42 31 46 35 46 46' stroke-width='1.1'/><path d='M31 31 C31 42 35 46 46 46' stroke-width='1.1'/><path d='M68 68 l7 -7 l7 7 l-7 7 z' fill='%23141414' stroke='none'/><circle cx='54' cy='54' r='2.2' fill='%23141414' stroke='none'/><circle cx='90' cy='90' r='2.4' fill='%23141414' stroke='none'/></g></defs><rect x='13' y='13' width='274' height='274' rx='14' stroke-width='2.8'/><rect x='20' y='20' width='260' height='260' rx='9' stroke-width='1.1'/><use href='%23c'/><use href='%23c' transform='rotate(90 150 150)'/><use href='%23c' transform='rotate(180 150 150)'/><use href='%23c' transform='rotate(270 150 150)'/></svg>");
}

.titlecard {
  position: relative;
  text-align: center;
  color: var(--ink);
  padding: clamp(16px, 2.8vh, 30px) clamp(20px, 2.2vw, 30px);
  border: clamp(24px, 3.2vw, 32px) solid transparent;
  border-image: var(--ornate-frame) 96 stretch;
  background: #f4f1e8;
  background-clip: border-box;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
  max-width: min(82vw, 612px);
}

/* Specificity note: `.beat .card p` (0,2,1) would otherwise clobber this <p>'s
   size, so the selector carries 3 classes (0,3,0) to win the cascade. */
.beat--title .card .titlecard__studio {
  font-family: var(--serif);
  font-size: clamp(8px, 1vw, 12px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-style: italic;
  color: var(--ink-soft);
  white-space: nowrap;
}

.titlecard__rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0;
  color: var(--ink);
}

.titlecard__rule::before,
.titlecard__rule::after {
  content: "";
  height: 1.2px;
  width: min(20vw, 110px);
  background: currentColor;
}

.titlecard__rule span {
  font-size: 12px;
  line-height: 1;
}

.titlecard__title {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 50px);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.12;
}

.titlecard__cast {
  font-family: var(--serif);
  margin-top: 6px;
  font-size: clamp(13px, 1.3vw, 16px);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  line-height: 1.5;
}

.titlecard__cast b {
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.08em;
}

/* "founder of Pip & Co." on its own line, a touch smaller */
.titlecard__cast-sub {
  display: block;
  font-size: 0.72em;
  font-style: italic;
  margin-top: 2px;
}

.scroll-hint {
  margin-top: auto;
  padding-top: 24px;
  padding-bottom: 3svh;
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
  animation: hint-pulse 2.6s ease-in-out infinite;
}

.scroll-hint__sub {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: none;
  color: var(--ink-soft);
}

.scroll-hint__arrow {
  display: block;
  margin-top: 10px;
  font-size: 18px;
  animation: hint-bob 1.8s ease-in-out infinite;
}

@keyframes hint-pulse {

  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

@keyframes hint-bob {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(7px);
  }
}

.card--small p {
  font-size: clamp(17px, 1.9vw, 22px);
}

.card--reveal p {
  font-weight: 500;
  letter-spacing: 0.06em;
}

.plan {
  list-style: none;
  margin-top: 34px;
  display: flex;
  gap: 30px;
  justify-content: center;
  flex-wrap: wrap;
}

.plan li {
  font-size: clamp(13px, 1.3vw, 15px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  counter-increment: plan;
  display: flex;
  align-items: center;
  gap: 12px;
}

.plan li::before {
  content: counter(plan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-size: 12px;
  color: var(--ink);
}

.cta-fin {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(26px, 3vw, 40px);
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 22px;
}

.cta-lede {
  font-family: var(--serif);
  font-style: italic;
  margin-bottom: 30px;
}

.cta-btn {
  display: inline-block;
  background: var(--purple);
  color: #fff;
  text-decoration: none;
  font-size: clamp(16px, 1.7vw, 19px);
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 17px 42px;
  border-radius: 999px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 0 rgba(20, 20, 20, 0.85);
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 rgba(20, 20, 20, 0.85);
}

.cta-micro {
  margin-top: 16px;
  font-size: 13px !important;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cta-alt {
  display: inline-block;
  margin-top: 26px;
  color: var(--ink-soft);
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.cta-alt:hover {
  color: var(--ink);
}

/* ---------------- SMALL-SCREEN NOTICE ---------------- */
/* The film is scroll-driven WebGL shot for a wide viewport, so phones get a
   title plate pointing them at a desktop instead. index.html also skips loading
   the film's vendor code in this mode. */

.marquee {
  display: none;
}

html.small-screen #story,
html.small-screen #gl,
html.small-screen .filmstrip,
html.small-screen .cover,
html.small-screen .sound-toggle {
  display: none;
}

html.small-screen body {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(20, 20, 20, 0.05), transparent 55%),
    var(--paper);
}

html.small-screen .marquee {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 100svh;
  padding: 104px 20px 56px;
  text-align: center;
}

.marquee__plate {
  width: 100%;
  max-width: 440px;
  padding: clamp(14px, 2.4vh, 24px) clamp(10px, 3vw, 22px);
  background: #f4f1e8;
  background-clip: border-box;
  border: clamp(22px, 6.5vw, 30px) solid transparent;
  border-image: var(--ornate-frame) 96 stretch;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
}

.marquee__studio {
  font-family: var(--serif);
  font-size: clamp(9px, 2.6vw, 12px);
  font-style: italic;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.marquee__title {
  font-family: var(--serif);
  font-size: clamp(27px, 8vw, 38px);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.12;
}

.marquee__now {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(14px, 3.8vw, 17px);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  margin-top: 2px;
}

.marquee__body {
  max-width: 33ch;
  font-size: clamp(14px, 3.9vw, 16px);
  line-height: 1.65;
  color: var(--ink-soft);
}

.marquee__body b {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.marquee__alt {
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 5px;
  padding: 15px 12px;
}

/* Landscape phones: shrink the plate so the instruction under it stays above
   the fold — the plate is the flourish, the sentence below it is the point. */
@media (max-height: 620px) {
  html.small-screen .marquee {
    gap: 16px;
    padding: 62px 20px 26px;
  }

  html.small-screen .marquee__plate {
    max-width: 400px;
    padding: 8px 14px;
    border-width: 18px;
  }

  html.small-screen .titlecard__rule {
    margin: 8px 0;
  }

  .marquee__studio {
    font-size: 9px;
  }

  .marquee__title {
    font-size: 25px;
  }

  .marquee__now {
    font-size: 14px;
  }

  .marquee__body {
    max-width: 48ch;
    font-size: 14px;
  }
}

/* ---------------- ARTICLE MODE (default) ---------------- */

html:not(.webgl) #gl,
html:not(.webgl) .filmstrip,
html:not(.webgl) .cover,
html:not(.webgl) .scroll-hint {
  display: none;
}

html:not(.webgl) body {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(20, 20, 20, 0.05), transparent 55%),
    var(--paper);
}

html:not(.webgl) #story {
  max-width: 720px;
  margin: 0 auto;
  padding: 130px 28px 120px;
}

html:not(.webgl) .beat {
  padding: 54px 0;
  position: relative;
}

/* silent-film rule lines between article beats */
html:not(.webgl) .beat + .beat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  border-top: 1px solid rgba(20, 20, 20, 0.35);
  box-shadow: 0 3px 0 -1px rgba(20, 20, 20, 0.35);
}

html:not(.webgl) .beat--empty {
  display: none;
}

html:not(.webgl) .card--rescue {
  padding: 12px 0;
}

/* the bracket motif, article's one illustration */
html:not(.webgl) .beat--cta .card::before {
  content: "";
  display: block;
  width: 120px;
  height: 30px;
  margin: 0 auto 40px;
  background: var(--purple);
  clip-path: polygon(0 0, 12.5% 0, 12.5% 50%, 87.5% 50%, 87.5% 0, 100% 0, 100% 100%, 0 100%);
}

/* ---------------- WEBGL MODE ---------------- */

html.webgl body {
  background: #f4f2ec;
}

html.webgl #gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  touch-action: pan-y;
}

html.webgl #story {
  position: relative;
  height: 6300svh;
  z-index: 1;
  pointer-events: none;
}

html.webgl .beat {
  position: absolute;
  left: 0;
  width: 100%;
}

/* intertitles ride the very bottom, like a silent-film title plate */
html.webgl .beat .card {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8vw 4.5svh;
  opacity: 0;
  visibility: hidden;
}

/* Narration plates are pinned to the VIEWPORT bottom (not scrolling with the
   section), so they can only ever slide up from / down past the bottom edge —
   never scroll up over the story as the beat leaves. */
html.webgl .beat:not(.beat--title):not(.beat--cta) .card {
  position: fixed;
  inset: auto 0 0 0;
  top: auto;
  height: auto;
  padding: 0 8vw 4.5svh;
}

/* the title card sits in the upper portion; Pip + the scroll hint show below it */
html.webgl .beat--title .card {
  justify-content: flex-start;
  padding-top: 6svh;
}

html.webgl .beat--cta .card {
  justify-content: flex-end;
  padding-bottom: 7svh;
}

html.webgl .beat .card.is-on {
  visibility: visible;
  opacity: 1;
}

/* Per-beat scroll windows (the top/height of each .beat) are set from the
   timeline in JS (main.js applyBeatLayout) so the spacer geometry can never
   drift from the beat table. */

/* rescue's three sub-cards also pin to the viewport bottom */
html.webgl [data-beat="rescue"] .card {
  position: fixed;
  inset: auto 0 0 0;
  top: auto;
  height: auto;
  padding: 0 8vw 4.5svh;
}

html.webgl .beat--cta .card {
  pointer-events: auto;
}

/* Narration = a framed silent-film title plate, not a floating subtitle.
   Reads over both the pale and the dark stretches of the film. */
html.webgl .beat:not(.beat--title):not(.beat--cta) .card p {
  display: inline-block;
  max-width: min(80vw, 620px);
  padding: 10px clamp(30px, 3.4vw, 46px);
  background: #f4f1e8;
  background-clip: border-box;
  color: var(--ink);
  /* the same ornate engraved frame as the title, at plate scale */
  border: clamp(22px, 2.6vw, 26px) solid transparent;
  border-image: var(--ornate-frame) 96 stretch;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.34);
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: 0.01em;
  font-size: clamp(18px, 2.15vw, 27px);
  /* slides up into place on show, down out of frame on hide (JS-driven) */
  opacity: 0;
  transform: translateY(150px);
  will-change: transform, opacity;
}

html.webgl [data-beat="dark-night"] .card p {
  font-style: italic;
}

html.webgl [data-beat="rescue"] .card--reveal p {
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: clamp(24px, 3.4vw, 40px);
}

/* ---------------- Film strip ---------------- */

.sound-toggle {
  position: fixed;
  right: calc(var(--strip-w) + 16px);
  bottom: 18px;
  z-index: 40;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.5);
  border: 1px solid rgba(244, 242, 236, 0.22);
  /* MUTED (default): a greyed-out, slashed speaker */
  color: #9c998f;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background 0.2s, transform 0.15s, color 0.2s, border-color 0.2s;
}
html:not(.webgl) .sound-toggle { display: none; }
.sound-toggle:hover { background: rgba(20, 20, 20, 0.72); transform: scale(1.07); }
.sound-toggle svg { width: 21px; height: 21px; display: block; }
.sound-toggle .wave { opacity: 0; transition: opacity 0.2s; }
.sound-toggle .slash { opacity: 1; transition: opacity 0.2s; }
/* ON: full-brightness speaker with sound waves, no slash */
.sound-toggle.is-on { color: #f4f1e8; border-color: rgba(244, 242, 236, 0.4); }
.sound-toggle.is-on .wave { opacity: 1; }
.sound-toggle.is-on .slash { opacity: 0; }

.filmstrip {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--strip-w);
  height: 100svh;
  z-index: 30;
  background: #171717;
  /* sprocket holes */
  background-image:
    radial-gradient(circle at 7px 50%, #f4f2ec 2.6px, transparent 3.4px),
    radial-gradient(circle at calc(100% - 7px) 50%, #f4f2ec 2.6px, transparent 3.4px);
  background-size: 100% 22px;
  border-left: 1px solid rgba(244, 242, 236, 0.16);
}

.filmstrip__frames {
  position: absolute;
  inset: 0 12px;
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  gap: 3px;
}

.filmstrip__frame {
  flex: 1;
  border: 1px solid rgba(244, 242, 236, 0.28);
  border-radius: 2px;
  background: rgba(244, 242, 236, 0.05);
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: background 0.25s;
}

.filmstrip__frame:hover {
  background: rgba(244, 242, 236, 0.18);
}

.filmstrip__frame.is-past {
  background: rgba(244, 242, 236, 0.12);
}

.filmstrip__frame.is-purple {
  border-color: rgba(102, 99, 253, 0.85);
}

.filmstrip__frame.is-purple.is-past {
  background: rgba(102, 99, 253, 0.35);
}

.filmstrip__frame::after {
  content: attr(data-title);
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: #171717;
  color: #f4f2ec;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

.filmstrip__frame:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.filmstrip__playhead {
  position: absolute;
  left: 3px;
  right: 3px;
  height: 26px;
  border: 2px solid var(--purple);
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(102, 99, 253, 0.55);
  pointer-events: none;
  top: 0;
}


/* ---------------- Boot cover ---------------- */

.cover {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover__mark {
  animation: cover-pulse 1.6s ease-in-out infinite;
}

@keyframes cover-pulse {

  0%,
  100% {
    opacity: 0.45;
  }

  50% {
    opacity: 1;
  }
}
