/* hue.capital pass 8: after film 1. The seamless middle (one fixed black: warmth, gold dust, a faint red pulse, the
   gold hairline and the quote), film 2 (same box model as film 1) with the push-in onto the note, the sign-up written
   on the note (the end of the page, with the fine print on the paper). No keyhole motif below film 1, no stills. */
:root {
  --bg: #0e0d0c;
  --gold: #d8a075;
  --hair: rgba(243, 238, 228, 0.12);
  --paper-ink: #1c1510;      /* ink on the note (pass 8: the note is darker than the old sheet) */
  --paper-mute: #3a2b20;
  --paper-rule: rgba(28, 21, 16, 0.55);

  --fs-micro: 11px;
  --fs-small: 13px;
  --fs-line: clamp(38px, min(6.6vw, 9.6vh), 112px);

  /* The middle. Change the look here; timing lives in MID (js/middle.js).
     --glow-rgb / --glow-a: the amber warmth (sampled from the chandelier and the keyhole brass, #d8a075) and its peak
     alpha. --glow-breathe: one breath (in or out). --red-a: the red pulse's peak alpha behind the quote (keep it a few
     percent). --red-pulse: one pulse. --dust-rgb: the specks' light. --hair-w: the hairline's full width at the quote. */
  --glow-rgb: 216, 160, 117;
  --glow-a: 0.13;
  --glow-breathe: 7.5s;
  --red-a: 0.05;
  --red-pulse: 6.5s;
  --dust-rgb: 246, 220, 180;
  --hair-w: min(240px, 56vw); /* the one rule in the middle, under the quote */
  --mid-gap: clamp(22px, 3.6vh, 36px);
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.num { font-variant-numeric: tabular-nums lining-nums; color: var(--gold); }

/* ---------- Hero tweaks (inside the intro stage) ---------- */
.colophon { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.col-l { justify-self: start; text-align: left; }
.col-c { display: none; } /* pass 8 fix: no animated line in the colophon */

/* ---------- The middle ---------- */
.page { position: relative; z-index: 2; background: transparent; }

/* The black that never moves. Under everything (z 0), above the html background, below film 1's canvas. */
.ether {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
  background: var(--bg);
  visibility: hidden; opacity: 0;
  contain: strict;
}
.eth-drift { position: absolute; inset: 0; will-change: transform, opacity; }
.eth-glow {
  position: absolute; left: 50%; top: 44%;
  width: 150vmax; height: 110vmax; margin: -55vmax 0 0 -75vmax;
  background: radial-gradient(closest-side, rgba(var(--glow-rgb), var(--glow-a)), rgba(var(--glow-rgb), calc(var(--glow-a) * 0.42)) 42%, rgba(var(--glow-rgb), 0) 100%);
  animation: breathe var(--glow-breathe) ease-in-out infinite alternate;
  will-change: transform, opacity;
}
@keyframes breathe {
  from { transform: scale(0.94); opacity: 0.72; }
  to { transform: scale(1.05); opacity: 1; }
}
/* Red, rare: one faint pulse behind the quote line, a few percent at most. */
.eth-red {
  position: absolute; left: 50%; top: calc(var(--slit, 50vh) - 18vh);
  width: 90vmin; height: 46vmin; margin: -23vmin 0 0 -45vmin;
  will-change: opacity;
}
.eth-red-in {
  width: 100%; height: 100%;
  background: radial-gradient(closest-side, rgba(200, 16, 46, var(--red-a)), rgba(200, 16, 46, 0) 100%);
  animation: red-pulse var(--red-pulse) ease-in-out infinite alternate;
}
@keyframes red-pulse { from { opacity: 0.25; } to { opacity: 1; } }
/* Gold dust: each speck drifts and glints on its own clock (js/middle.js sets the variables). */
.eth-dust { position: absolute; inset: -8% 0; will-change: transform, opacity; }
.eth-dust i {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--dust-rgb), 1) 0, rgba(var(--dust-rgb), 0.5) 38%, rgba(var(--dust-rgb), 0) 70%);
  opacity: 0;
  animation: dust-drift var(--d) ease-in-out var(--dl) infinite alternate, dust-glint var(--g) ease-in-out var(--gl) infinite;
}
@keyframes dust-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--dx), var(--dy), 0); } }
@keyframes dust-glint { 0%, 100% { opacity: 0; } 45% { opacity: calc(var(--o) * 0.35); } 55% { opacity: var(--o); } 65% { opacity: calc(var(--o) * 0.3); } }
/* Off screen, nothing runs and nothing shows: the glow and dust exist only while the middle is in view. */
.ether:not(.is-live) { visibility: hidden !important; }
.ether:not(.is-live) .eth-glow, .ether:not(.is-live) .eth-red-in, .ether:not(.is-live) .eth-dust i { animation-play-state: paused; }

/* The quote, its label and the short rule: a fixed overlay above film 2's stage (z 3 inside .page). --slit is the
   row of the rule (film 2's slit row through the canvas's cover fit, near the middle of the screen). The overlay is
   hidden before film 2's canvas shows, so nothing synthetic is ever drawn over the film. */
.mid-top {
  position: fixed; inset: 0; z-index: 3;
  pointer-events: none;
  visibility: hidden; opacity: 0;
}
.hair {
  position: absolute; left: 50%; top: var(--slit, 50vh);
  width: var(--hair-w); height: 1px; margin: -0.5px 0 0 calc(var(--hair-w) / -2);
  will-change: opacity;
}
.hair-line {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(var(--glow-rgb), 0), rgba(var(--glow-rgb), 0.95) 22%, #f3d5ab 50%, rgba(var(--glow-rgb), 0.95) 78%, rgba(var(--glow-rgb), 0));
}
.mq { position: absolute; inset: 0; }
.mq-quote {
  position: absolute; left: 0; right: 0;
  bottom: calc(100% - var(--slit, 50vh) + var(--mid-gap));
  display: flex; justify-content: center;
  padding: 0 var(--gutter);
}
.mq-label {
  position: absolute; left: 0; right: 0;
  top: calc(var(--slit, 50vh) + var(--mid-gap));
  margin: 0; justify-content: center;
}
.label {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--sans); font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: 0.26em; text-transform: uppercase; color: var(--grey-1);
}
.line {
  margin: 0; max-width: 15ch;
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: var(--fs-line); line-height: 1.0; letter-spacing: -0.025em;
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1;
  text-align: center; text-wrap: balance;
}
.quote { margin: 0; }
/* No masks (pass 8 fix): each word fades, rises and un-blurs on its own (js/soft.js). */
.lm { display: inline-block; vertical-align: top; }
.lw { display: inline-block; }

/* #mid is scroll length only: its height (js/middle.js) puts film 2's track at T + MID.film2At. */
.mid { height: 110vh; }

/* ---------- Film 2 ---------- */
/* Transparent: the stage rises over the middle's black with its canvas at opacity 0, so nothing moves into view;
   the canvas dissolves up only once the stage is stuck (film2.js). */
.track2 { position: relative; height: 860vh; background: transparent; }
.stage2 {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  background: transparent;
}
/* Squish-safe box: the canvas backing store is measured from this box (film2.js). */
.film2-wrap { position: absolute; inset: 0; overflow: hidden; }
.film2-wrap .film { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #000; will-change: transform, opacity; }
.sheet-still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* The sign-up as a letter (pass 8 fix). #signup and #seal are the size of the paper and carry its quad as a matrix3d
   (placeSheet in film2.js), so this layout is on the paper's own grid, in container units of the paper:
   --m is the side margin (12cqw, 8cqw on a narrow paper); the column starts 20 percent down, clear of the pin.
   Fixed rows, so the ink layer and the seal layer line up: "You are invited" at 20, "Members first." under it, the
   ruled line at 41, the seal under it at the right, the HUGH sign-off at the bottom right. The rest stays blank.
   Two faces on the paper: Fraunces roman (SOFT 0) and one formal script (--script, Pinyon Script). The seal's label
   is the one sans, because it is a stamp, not handwriting. */
.sheet, .seal { position: absolute; left: 0; top: 0; z-index: 2; transform-origin: 0 0; container-type: size; }
/* Hidden in CSS until film 2 has drawn its final frame in this session (film2.js adds .is-letter-ready), so a restored
   scroll, a slow script or a jump can never show the letter or its button early. */
.stage2:not(.is-letter-ready) .sheet, .stage2:not(.is-letter-ready) .seal { visibility: hidden !important; }
.js .sh-item { opacity: 0; visibility: hidden; }
.sheet { mix-blend-mode: multiply; pointer-events: none; }
.seal { pointer-events: none; }
.letter { position: absolute; inset: 0; color: var(--paper-ink); --script: 'Pinyon Script', 'Great Vibes', 'Parisienne', cursive; font-family: var(--serif); }
.letter > *, .letter form { position: absolute; left: var(--m); right: var(--m); margin: 0; pointer-events: auto; }
/* A subtle 1 px ink spread, no shadows. */
.letter { text-shadow: 0 0 1px rgba(28, 21, 16, 0.35); }
.sheet-invite {
  top: 18cqh;
  font-family: var(--script); font-weight: 400; font-style: normal;
  font-size: clamp(30px, 13cqw, 68px); line-height: 1.05; letter-spacing: 0;
  color: var(--paper-ink);
}
.sheet-line {
  top: calc(18cqh + clamp(30px, 13cqw, 68px) * 1.05 + 1.6cqh);
  font-family: var(--serif); font-style: normal; font-weight: 400;
  font-size: clamp(11px, 3.6cqw, 17px); line-height: 1.3; letter-spacing: 0.02em;
  font-variation-settings: 'opsz' 14, 'SOFT' 0, 'WONK' 0;
  color: var(--paper-mute);
}
/* The sign-off: HUGH at the left of the seal's row, signature beside the seal. */
.sheet-sign {
  top: calc(41cqh + max(40px, 7cqh) + 4.5cqh + (var(--seal-h) - 1em) / 2); right: auto;
  font-family: var(--serif); font-weight: 500; font-size: clamp(10px, 3.2cqw, 15px); line-height: 1;
  letter-spacing: 0.46em;
  font-variation-settings: 'opsz' 72, 'SOFT' 0, 'WONK' 0; color: var(--paper-mute);
}
.letter form { top: 41cqh; }
.field { position: relative; height: max(40px, 7cqh); border-bottom: 1px solid var(--paper-rule); }
.field input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  padding: 0 0 0.12em; margin: 0;
  background: transparent; border: 0; border-radius: 0; box-shadow: none;
  /* The typed value in the header's exact ink, at full opacity. The script's hairlines antialias lighter than the
     header's larger strokes, so a hair of stroke in the same ink brings the line to the header's darkness. */
  color: var(--paper-ink); caret-color: var(--paper-ink); opacity: 1;
  -webkit-text-stroke: 0.45px var(--paper-ink);
  font-family: var(--script); font-weight: 400; font-size: clamp(22px, 7.5cqw, 36px); line-height: 1.1;
  letter-spacing: 0.01em; font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'clig' 0, 'calt' 0;
  text-align: left;
  -webkit-appearance: none; appearance: none;
}
.field input::placeholder { color: var(--paper-mute); opacity: 1; font-family: var(--script); -webkit-text-stroke: 0; }
/* Focus: a darker, heavier ink rule, not a glow. */
.field:focus-within { border-bottom: 2px solid var(--paper-ink); }
.field input:focus, .field input:focus-visible { outline: none; }
.field.is-error { border-bottom-color: #7d0f1f; }
.signup-done {
  position: absolute; left: 0; right: 0; bottom: 0.1em; margin: 0;
  font-family: var(--script); font-weight: 400; font-size: clamp(22px, 7.5cqw, 36px); line-height: 1.1;
  color: var(--paper-ink);
}
.signup-done:focus { outline: none; }
.signup-msg { margin: 1.4cqh 0 0; font-family: var(--serif); font-variation-settings: 'opsz' 14, 'SOFT' 0, 'WONK' 0; font-size: clamp(10px, 2.8cqw, 13px); line-height: 1.35; color: #7d0f1f; min-height: 1em; }
/* The button is the engraved seal (css/seal.css, js/seal.js), in the letter's ink stack. --seal-h is its height:
   48 px at 1440, 44 px on phones. */
.sheet, .seal { --seal-h: clamp(44px, 9.8cqw, 48px); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.seal.is-done { display: none; }

/* No footer (pass 8 fix): the page ends with the letter. No fine print on the letter (Sage). */

/* ---------- Phone ---------- */
@media (max-width: 640px) {
  .colophon { grid-template-columns: 1fr; gap: 6px; text-align: center; }
  .col-l { justify-self: center; text-align: center; }
  .col-c, .col-r { display: none; }
  .br-wide { display: none; }
  .label { letter-spacing: 0.2em; gap: 10px; }
}

/* Reduced motion: no ether, the quote sits still in the flow with its hairline, film 2 is its last frame, still,
   already pushed in, with the form on the note. */
.is-reduced .ether { display: none; }
.is-reduced .sh-item { opacity: 1; visibility: visible; }
.is-reduced .mid-top { position: relative; inset: auto; z-index: auto; visibility: visible; opacity: 1; height: 100svh; --slit: 50svh; }
.is-reduced .hair { top: var(--slit); }
.is-reduced .mid { display: none; }
.is-reduced .track2 { height: auto; }
.is-reduced .stage2 { position: relative; height: 100svh; }
.is-reduced .film2-wrap .film { display: none; }
