:root {
  --bg: #0C0907;
  --surface: #150F0A;
  --surface-2: #1A130D;
  --rule: #2A2118;
  --ink: #EDE3D2;
  --muted: #8A7B66;
  --faint: #5A4E3E;
  --amber: #C98A3B;
  --amber-hi: #D9A65A;
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scrollbar-width: none; background: var(--bg); }
html::-webkit-scrollbar { display: none; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; }

/* ---------- Masthead — absent over the hero, present for the descent ---------- */
.mast {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 45;
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 22px clamp(20px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(12,9,7,0.72), transparent);
  opacity: 0; pointer-events: none;
  transition: opacity 0.9s ease;
}
.mast.on { opacity: 1; pointer-events: auto; }
.mast-brand {
  font-family: var(--serif); font-size: 15px; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--ink);
}
.mast-link {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--muted); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
  padding-bottom: 2px; transition: color 0.2s, border-color 0.2s;
}
.mast-link:hover, .mast-link:focus-visible { color: var(--amber-hi); border-bottom-color: var(--amber-hi); }

/* ---------- The Cask Papers — the colophon ---------- */
.papers {
  padding: clamp(4rem, 10vw, 7rem) clamp(1.2rem, 5vw, 3rem) clamp(3rem, 7vw, 5rem);
  display: flex; flex-direction: column; align-items: center; gap: 2.4rem;
  background: var(--bg);
}
.papers .eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--muted);
}
.papers-ledger {
  width: 100%; max-width: 560px; margin: 0;
  border-top: 1px solid var(--rule);
}
.papers-ledger > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 2rem;
  padding: 0.85rem 0.2rem;
  border-bottom: 1px solid var(--rule);
}
.papers-ledger dt {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--faint); white-space: nowrap;
}
.papers-ledger dd {
  margin: 0; font-family: var(--serif); font-size: 1.02rem; color: var(--ink);
  text-align: right;
}
.papers-close {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem); color: var(--muted);
  margin-top: 1.2rem; text-align: center; text-wrap: balance;
}

/* ---------- The gauge — one physical instrument, not a digital HUD ----------
   Page-level: bound to TOTAL document scroll progress via registerPageHUD. A sealed
   vial of the cask's own spirit, fixed to the left edge for the whole descent. The
   liquid level drops and its colour deepens with scroll — age and angel's-share read
   as one thing happening to the liquid, not two ticking mono-digit readouts. No text. */
.gauge {
  position: fixed;
  z-index: 40;
  left: 24px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  filter: drop-shadow(0 0 0 rgba(217,166,90,0));
  transition: filter 1.1s ease;
}
.gauge.pulse { filter: drop-shadow(0 0 10px rgba(217,166,90,0.45)); }
.gauge { opacity: 1; transition: filter 1.1s ease, opacity 0.9s ease; }
.gauge.done { opacity: 0; }
.gauge-glass { fill: rgba(237,227,210,0.03); stroke: var(--rule); stroke-width: 1.5; }
.gauge-liquid { fill: var(--amber-hi); transition: y 0.1s linear, height 0.1s linear; }

@media (max-width: 640px) {
  .gauge { left: 14px; }
  .gauge svg { width: 18px; height: 150px; }
}

/* ---------- Cinematic scroll sections ---------- */
.cinematic { position: relative; height: 420vh; }
.cinematic.short { height: 320vh; }
.sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--bg);
}
canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 42%, rgba(0,0,0,0.55) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.45) 0%, transparent 22%, transparent 72%, rgba(0,0,0,0.65) 100%);
}

.overlay { position: relative; z-index: 10; text-align: center; padding: 0 24px; width: 100%; height: 100%; }
.reveal-line { transform: translateY(var(--reveal-y, 0px)); }
.line {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) translateY(var(--reveal-y, 0px));
  width: max-content; max-width: 90vw;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.8rem, 5.5vw, 4rem);
  letter-spacing: 0.02em; line-height: 1.15;
  color: var(--ink);
  opacity: 0;
  text-shadow: 0 2px 30px rgba(0,0,0,0.6);
  will-change: opacity, transform;
  text-wrap: balance;
}
.line.wordmark-line { font-size: clamp(2.6rem, 8vw, 6rem); letter-spacing: 0.06em; }
.line.sub { font-size: clamp(1.1rem, 2.6vw, 1.6rem); color: var(--amber-hi); font-style: italic; }

.progress { position: absolute; left: 28px; right: 28px; bottom: 78px; height: 1px; background: var(--rule); z-index: 12; }
.progress-fill { height: 100%; width: 0%; background: var(--amber); }
.scroll-hint {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); z-index: 12;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--faint); animation: bob 2s ease-in-out infinite; transition: opacity 0.4s;
}
@keyframes bob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(6px); } }

/* ---------- Static edition close ---------- */
.edition {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2.2rem; padding: clamp(3rem,8vw,6rem) clamp(1.2rem,5vw,3rem);
  background: radial-gradient(60% 45% at 50% 30%, rgba(201,138,59,.09), transparent 60%), var(--bg);
}
.edition-bottle {
  width: min(280px, 46vw); aspect-ratio: 3/5; border-radius: 4px; overflow: hidden;
  border: 1px solid var(--rule); background: #000;
}
.edition-bottle img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edition-head { text-align: center; max-width: 46ch; }
.edition-head .eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.edition-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem,4.5vw,2.6rem); margin: 0.5rem 0; letter-spacing: 0.02em; text-wrap: balance; }
.edition-head p { color: var(--muted); font-size: 1.05rem; font-style: italic; }

.register {
  width: 100%; max-width: 640px; border: 1px solid var(--rule); background: var(--surface);
  padding: clamp(1.4rem,3.5vw,2.2rem);
}
.register-grid { display: grid; grid-template-columns: repeat(22,1fr); gap: 3px; }
@media (max-width: 620px) { .register-grid { grid-template-columns: repeat(11,1fr); } }
.slot {
  aspect-ratio: 1; border: 1px solid var(--rule); display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 8px; color: transparent;
  transition: background 0.4s, border-color 0.4s, color 0.4s;
}
.slot.filled { background: rgba(201,138,59,0.13); border-color: rgba(201,138,59,0.4); color: var(--faint); }
.slot.spoken { background: transparent; border-color: var(--rule); color: var(--faint); opacity: 0.5; }
.slot.mine { background: var(--amber); border-color: var(--amber-hi); color: #1a1008; font-weight: 600; box-shadow: 0 0 14px rgba(201,138,59,.55); }
.legend { display: flex; gap: 1.4rem; flex-wrap: wrap; margin-top: 1rem; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 0.45rem; }
.sw { width: 10px; height: 10px; border: 1px solid var(--rule); display: inline-block; }
.sw.f { background: rgba(201,138,59,.13); border-color: rgba(201,138,59,.4); }
.sw.s { opacity: .5; }
.sw.m { background: var(--amber); border-color: var(--amber-hi); }

.cta { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; justify-content: center; }
.cta a {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; border: 1px solid var(--amber); padding: 0.85rem 1.8rem;
  transition: background 0.2s, color 0.2s;
}
.cta a:hover, .cta a:focus-visible { background: var(--amber); color: #160f08; }
.cta .note { font-family: var(--mono); font-size: 0.68rem; color: var(--faint); }

/* ---------- Reveal (fade-up, generic) ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- Mobile polish ---------- */
@media (max-width: 600px) {
  .cinematic { height: 340vh; }
  .progress { left: 16px; right: 16px; bottom: 64px; }
  .scroll-hint { bottom: 26px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .scroll-hint { animation: none; }
  .reveal, .reveal-line { transition: none; }
  .gauge, .gauge-liquid, .mast { transition: none; }
}

/* ---------- Demo attribution footer (canon — never remove, never reword) ---------- */
.demo-footer {
  padding: 60px clamp(20px, 5vw, 64px);
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: 16px 40px; align-items: center;
  font-family: var(--mono); font-size: 12px; color: var(--faint);
  background: var(--bg); position: relative; z-index: 2;
}
.demo-footer .credit {
  flex-basis: 100%; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  justify-content: flex-end; padding-top: 20px; border-top: 1px solid var(--rule);
}
.demo-footer .credit .sep { opacity: .45; }
.demo-footer .credit a {
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
  padding-bottom: 1px; transition: color .18s ease, border-color .18s ease;
}
.demo-footer .credit a:hover, .demo-footer .credit a:focus-visible { color: var(--amber-hi); border-bottom-color: var(--amber-hi); }
