/* ════════════════════════════════════════════════════════════════════════
   THE POUR — a cinematic, scroll-driven Cocktail Library experience.
   Deliberately off the reference-site design system (sanctioned demo):
   near-black bar-at-2am palette, oversized display type, WebGL stage.
   Mobile-first responsive; reduced-motion gets a static, readable page.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --xp-bg:      #0D0A08;   /* espresso black */
  --xp-ink:     #EFE8DB;   /* warm cream */
  --xp-ink-dim: #A79C8C;
  --xp-amber:   #E08E45;   /* poured light */
  --xp-copper:  #B96A3B;
  --xp-serif: 'Playfair Display', Georgia, serif;
  --xp-sans:  'Work Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: auto; }
html, body { background: var(--xp-bg); }
body {
  color: var(--xp-ink);
  font-family: var(--xp-sans);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}
::selection { background: var(--xp-amber); color: var(--xp-bg); }

.xp-noscript {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; text-align: center; padding: 2rem; background: var(--xp-bg);
  font-family: var(--xp-serif); font-size: 1.25rem;
}
.xp-noscript a { color: var(--xp-amber); }

/* ── Stage & atmosphere ─────────────────────────────────────────────── */
#stage {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  display: block;
}
.xp-grain {
  position: fixed; inset: -60px; z-index: 3; pointer-events: none;
  opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: xp-grain 900ms steps(3) infinite;
}
@keyframes xp-grain {
  0% { transform: translate(0,0); } 33% { transform: translate(-24px,14px); }
  66% { transform: translate(18px,-20px); } 100% { transform: translate(0,0); }
}
.xp-vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(6,4,3,.55) 100%);
}

/* ── Loader ─────────────────────────────────────────────────────────── */
.xp-loader {
  position: fixed; inset: 0; z-index: 80;
  background: var(--xp-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.4rem;
  transition: opacity .7s ease, visibility .7s;
}
.xp-loader.is-done { opacity: 0; visibility: hidden; }
.xp-loader-word {
  font-family: var(--xp-serif); font-style: italic; font-weight: 500;
  font-size: clamp(1.4rem, 4vw, 2rem); color: var(--xp-ink-dim);
  letter-spacing: .02em;
}
.xp-loader-bar {
  width: min(220px, 40vw); height: 1px; background: rgba(239,232,219,.15);
  overflow: hidden;
}
.xp-loader-bar i {
  display: block; height: 100%; width: 100%;
  background: var(--xp-amber);
  transform: scaleX(0); transform-origin: left;
}

/* ── HUD ─────────────────────────────────────────────────────────────── */
.xp-hud {
  position: fixed; z-index: 20; inset: 0 0 auto 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.4rem clamp(1.25rem, 4vw, 3rem);
  pointer-events: none;
}
.xp-hud a { pointer-events: auto; }
.xp-mark {
  font-family: var(--xp-serif); font-weight: 600;
  font-size: 1.05rem; color: var(--xp-ink); text-decoration: none;
  letter-spacing: .01em;
}
.xp-exit {
  font-family: var(--xp-sans); font-weight: 500; font-size: .64rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--xp-ink-dim); text-decoration: none;
  border: 1px solid rgba(239,232,219,.25); padding: .65rem .9rem;
  transition: color .2s, border-color .2s, background .2s;
}
.xp-exit:hover { color: var(--xp-bg); background: var(--xp-amber); border-color: var(--xp-amber); }

.xp-rail {
  position: fixed; left: clamp(1rem, 3vw, 2.2rem); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 1.1rem;
}
.xp-dot {
  position: relative; width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid rgba(239,232,219,.4); background: transparent;
  transition: background .3s, border-color .3s, transform .3s;
}
.xp-dot span {
  position: absolute; left: 1.4rem; top: 50%; transform: translateY(-50%);
  font-size: .58rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--xp-ink-dim); opacity: 0; transition: opacity .25s;
  white-space: nowrap;
}
.xp-dot:hover span { opacity: 1; }
.xp-dot.is-active { background: var(--xp-amber); border-color: var(--xp-amber); transform: scale(1.25); }

.xp-progress {
  position: fixed; left: 0; right: 0; bottom: 0; height: 2px; z-index: 20;
  background: rgba(239,232,219,.08);
}
.xp-progress i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--xp-copper), var(--xp-amber));
  transform: scaleX(0); transform-origin: left;
}

/* ── Scenes ─────────────────────────────────────────────────────────── */
.xp-scene {
  position: relative; z-index: 10;
  min-height: 130vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 18vh clamp(1.5rem, 6vw, 6rem);
}
.xp-hero, .xp-finale { min-height: 100vh; align-items: center; text-align: center; }
.xp-finale { min-height: 120vh; }

.xp-kicker {
  font-family: var(--xp-sans); font-weight: 500;
  font-size: .64rem; letter-spacing: .26em; text-transform: uppercase;
  color: var(--xp-amber); margin-bottom: 1.4rem;
}
.xp-display {
  font-family: var(--xp-serif); font-weight: 600;
  font-size: clamp(3.4rem, 14vw, 11.5rem);
  line-height: .92; letter-spacing: -.02em;
  color: var(--xp-ink);
}
.xp-display .ch { display: inline-block; will-change: transform; }
.xp-display .wd { display: inline-block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; vertical-align: top; }
.xp-lede {
  font-family: var(--xp-serif); font-style: italic;
  font-size: clamp(1.05rem, 2.4vw, 1.4rem); line-height: 1.6;
  color: var(--xp-ink-dim); max-width: 34em; margin-top: 2rem;
}
.xp-cue {
  margin-top: 7vh; width: 1px; height: 64px; overflow: hidden;
  background: rgba(239,232,219,.15);
}
.xp-cue i {
  display: block; width: 100%; height: 100%;
  background: linear-gradient(var(--xp-amber), transparent);
  animation: xp-pour 2.2s ease-in-out infinite;
}
@keyframes xp-pour { 0% { transform: translateY(-100%);} 60%,100% { transform: translateY(100%);} }
/* When the WebGL glass is live, the engine re-homes the cue onto the coupe's
   stem (top/height set inline from the camera projection) so the pour runs
   down the glass itself. Negative z-index tucks it behind the hero type but
   in front of the page background (the fixed canvas shows through). Without
   WebGL the static block above stays the fallback. */
.xp-cue--stem {
  position: absolute; left: 50%; margin: 0; transform: translateX(-50%);
  z-index: -1; height: auto;
  background: rgba(239,232,219,.10);
}
.xp-cue--stem i { animation-duration: 2.8s; }

/* Chapters */
.xp-chapter { position: relative; max-width: 1200px; width: 100%; margin: 0 auto; }
.xp-chapter--right { text-align: right; }
.xp-chapter--right .xp-copy { margin-left: auto; }
.xp-chapter-no {
  position: absolute; top: -1.2em; left: -.05em; z-index: -1;
  font-family: var(--xp-serif); font-weight: 400;
  font-size: clamp(7rem, 26vw, 22rem); line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(224,142,69,.28);
  user-select: none;
}
.xp-chapter--right .xp-chapter-no { left: auto; right: -.05em; }
.xp-display--chapter { font-size: clamp(3rem, 11vw, 8.5rem); }
.xp-copy { max-width: 30em; margin-top: 2.2rem; }
.xp-copy p { color: var(--xp-ink-dim); font-size: clamp(.95rem, 1.6vw, 1.05rem); }
.xp-copy .xp-kicker { margin-bottom: .8rem; }
.xp-stat { display: flex; align-items: baseline; gap: .8rem; margin-top: 1.6rem; }
.xp-chapter--right .xp-stat { justify-content: flex-end; }
.xp-stat b {
  font-family: var(--xp-serif); font-weight: 600;
  font-size: clamp(2.6rem, 6vw, 4rem); line-height: 1; color: var(--xp-ink);
  font-variant-numeric: tabular-nums;
}
.xp-stat span {
  font-size: .64rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--xp-ink-dim);
}
.xp-link {
  display: inline-block; margin-top: 1.6rem;
  font-size: .64rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--xp-amber); text-decoration: none;
  border-bottom: 1px solid rgba(224,142,69,.35); padding-bottom: .35rem;
  transition: border-color .25s, color .25s;
}
.xp-link:hover { border-color: var(--xp-amber); }

/* Finale */
.xp-cta {
  display: inline-block; margin-top: 3rem;
  font-family: var(--xp-sans); font-weight: 500;
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--xp-bg); background: var(--xp-amber);
  padding: 1.15rem 2.1rem; text-decoration: none;
  transition: background .25s, transform .25s;
}
.xp-cta:hover { background: var(--xp-ink); transform: translateY(-2px); }
.xp-fine {
  margin-top: 3.5rem; font-family: var(--xp-serif); font-style: italic;
  color: var(--xp-ink-dim); font-size: 1rem;
}

/* ── Cursor (fine pointers only) ────────────────────────────────────── */
.xp-cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .xp-cursor {
    display: block; position: fixed; z-index: 60; top: 0; left: 0;
    pointer-events: none; will-change: transform;
  }
  .xp-cursor i {
    display: block; width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid rgba(224,142,69,.55);
    transform: translate(-50%,-50%);
    transition: width .25s, height .25s, background .25s, border-color .25s;
  }
  .xp-cursor.is-link i { width: 56px; height: 56px; background: rgba(224,142,69,.12); }
}

/* ── Pre-reveal states (JS removes; failsafe class restores) ──────────
   Titles hide via OPACITY on the heading, never via a CSS transform on the
   chars — GSAP reads a stylesheet translateY(%) back as cached pixels and a
   later yPercent tween can never clear it (see docs/PROJECT_STATE.md). */
.xp-js [data-fade] { opacity: 0; transform: translateY(24px); }
.xp-js .xp-display { opacity: 0; }
.xp-reveal-all [data-fade] { opacity: 1 !important; transform: none !important; }
.xp-reveal-all .xp-display { opacity: 1 !important; }
.xp-reveal-all .xp-display .ch { transform: none !important; }

/* ── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .xp-scene { min-height: 110vh; padding: 14vh 1.4rem; }
  .xp-rail { display: none; }
  .xp-exit { font-size: .56rem; padding: .55rem .7rem; }
  .xp-chapter-no { top: -.9em; }
  .xp-chapter--right { text-align: left; }
  .xp-chapter--right .xp-copy { margin-left: 0; }
  .xp-chapter--right .xp-stat { justify-content: flex-start; }
  .xp-lede { margin-top: 1.5rem; }
}

/* ── Reduced motion: static, readable, no WebGL/grain loops ─────────── */
@media (prefers-reduced-motion: reduce) {
  #stage, .xp-grain, .xp-loader, .xp-cursor { display: none !important; }
  .xp-cue i { animation: none; }
  .xp-js [data-fade], .xp-js .xp-display .ch { opacity: 1; transform: none; }
  .xp-scene { min-height: 70vh; }
  body { background: #14100D; }
}
