:root {
  --velvet-black: #150409;
  --velvet: #340a1e;
  --burgundy: #5c1029;
  --gold: #d4af6a;
  --gold-bright: #f0d38a;
  --rose: #c98fa1;
  --ivory: #f4e9dc;
  --ivory-dim: #cbb4a8;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  background: var(--velvet-black);
  color: var(--ivory);
  font-family: var(--sans);
  overflow-x: hidden;
}

/* ---------- Background canvas layer ---------- */

#bg-canvas-wrap {
  position: sticky;
  top: 0;
  height: 100vh;
  margin-bottom: -100vh;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 30%, var(--velvet) 0%, var(--velvet-black) 70%);
  /* Force its own compositing layer: avoids the iOS Safari smear/ghost
     artifact that plain `position: fixed` backgrounds get during active
     touch-scroll (the browser desyncs the fixed layer's paint from the
     scroll gesture and "snaps" it after — sticky doesn't have this bug). */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
}

#fallback-gradient {
  display: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(212,175,106,0.15), transparent 60%),
    linear-gradient(180deg, var(--velvet-black), var(--velvet) 50%, var(--velvet-black));
}

body.no-webgl #scene { display: none; }
body.no-webgl #fallback-gradient { display: block; }
body.reduced-motion #scene { display: none; }
body.reduced-motion #fallback-gradient { display: block; }

/* ---------- Nav ---------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem clamp(1.2rem, 4vw, 3rem);
  pointer-events: none;
}

.nav-mark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--serif);
  font-size: 1.3rem;
  letter-spacing: 0.35em;
  font-weight: 600;
  color: var(--gold-bright);
  pointer-events: auto;
  text-shadow: 0 0 18px rgba(240, 211, 138, 0.35);
}

.nav-logo {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 0 14px rgba(240, 211, 138, 0.3);
}

@media (max-width: 480px) {
  .nav-mark span { display: none; }
}

.nav-cta {
  pointer-events: auto;
  background: transparent;
  border: 1px solid rgba(212, 175, 106, 0.55);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease;
}
.nav-cta:hover {
  background: rgba(212, 175, 106, 0.12);
  border-color: var(--gold-bright);
}

/* ---------- Rail (section dots) ---------- */

.rail {
  position: fixed;
  right: clamp(1rem, 3vw, 2.2rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.rail-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(244, 233, 220, 0.25);
  border: 1px solid rgba(244, 233, 220, 0.35);
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
}
.rail-dot.active {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
  transform: scale(1.35);
  box-shadow: 0 0 10px rgba(240, 211, 138, 0.7);
}

@media (max-width: 720px) {
  .rail { display: none; }
}

/* ---------- Content panels ---------- */

#content {
  position: relative;
  z-index: 10;
}

.panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 7rem clamp(1.5rem, 8vw, 8rem) 4rem;
}

/* When the 3D engine is running, pin each section to fill the viewport
   exactly while it's active — content stays centered and clear of the
   nav no matter how tall a panel's copy is; the next panel's higher
   z-index slides up and covers the previous one. */
body.engine-active .panel {
  position: sticky;
  top: 0;
  height: 100vh;
}

.panel-inner {
  max-width: 620px;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

.panel-inner.in-view {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.75rem;
  color: var(--gold);
  margin: 0 0 1rem;
}

h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.08;
  margin: 0 0 1.1rem;
  color: var(--ivory);
}

h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); }
h2 { font-size: clamp(2rem, 4.6vw, 3.2rem); }

.panel .body {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.65;
  color: var(--ivory-dim);
  max-width: 46ch;
  margin: 0 0 1.6rem;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0;
  margin: 0;
}

.tags li {
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 106, 0.4);
  color: var(--gold-bright);
  background: rgba(212, 175, 106, 0.06);
}

.cta {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  padding: 0.95rem 1.9rem;
  border-radius: 999px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.cta.primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--velvet-black);
  box-shadow: 0 6px 24px rgba(212, 175, 106, 0.28);
}
.cta.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(212, 175, 106, 0.4);
}

.fine-print {
  margin-top: 1.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: rgba(244, 233, 220, 0.45);
}

.panel-inner.hero h1 { max-width: 14ch; }
.panel-inner.finale { max-width: 560px; }

/* ---------- Progress line ---------- */

#progress-line {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(244, 233, 220, 0.08);
  z-index: 25;
}
#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
}

/* ---------- Footer ---------- */

.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 3rem 1rem 4rem;
  font-size: 0.78rem;
  color: rgba(244, 233, 220, 0.4);
}
.footer-logo {
  display: block;
  width: 84px;
  height: auto;
  margin: 0 auto 1.4rem;
  border-radius: 6px;
  opacity: 0.9;
}
.site-footer a { color: rgba(244, 233, 220, 0.55); text-decoration: none; }
.site-footer a:hover { color: var(--gold-bright); }
.site-footer .dot { margin: 0 0.6rem; opacity: 0.5; }

@media (prefers-reduced-motion: reduce) {
  .panel-inner { transition: opacity 0.3s ease; transform: none !important; opacity: 1; pointer-events: auto; }
}
