/* St Lucie Smoke & Cigars — 3D hero for the home page (index-3d.html). Production copy.
   Sits on top of css/site.css and reuses its colours, type and buttons. */

:root { --hdr: 77px; }                              /* sticky header height (site.css: 76px + 1px line) */
@media (min-width: 900px) { :root { --hdr: 105px; } }

/* Which hero is shown. With no JavaScript neither class is set, and the static hero shows. */
html:not(.h3d-on) .h3d { display: none; }
html.h3d-on .h3d-static { display: none; }
.h3d-optin { display: none; margin: 1.1rem 0 0; font-size: 0.85rem; }
.h3d-optin a { color: var(--gold-2); }
html.h3d-calm .h3d-optin { display: block; }

/* ---------- The tall block and the pinned stage ---------- */
.h3d {
  position: relative;
  height: 640vh;                                    /* scroll length of the whole sequence */
  height: 640lvh;                                   /* "lvh" = the screen with the phone's address bar tucked away. Said outright so the block and the stage can never change size (and re-make the 3D canvas) while the bar slides during a scroll */
  background: #120d0b;
  color: var(--cream);
}
.h3d-stage {
  position: sticky;
  top: var(--hdr);
  height: calc(100vh - var(--hdr));
  height: calc(100lvh - var(--hdr));
  overflow: hidden;
  background:
    radial-gradient(120% 85% at 50% 108%, #2e2420 0%, #1c1614 46%, #120d0b 100%);
  isolation: isolate;
}

/* Colour washes behind the cigar; they cross-fade as the scene changes */
.h3d-bg, .h3d-glow, .h3d-canvas, .h3d-vignette, .h3d-grain { position: absolute; inset: 0; }
.h3d-glow { opacity: 0; transition: opacity 1.1s ease; }
.h3d-glow--hero { background: radial-gradient(56% 64% at 72% 46%, rgba(196, 126, 58, 0.24) 0%, rgba(170, 100, 44, 0.08) 46%, rgba(170, 100, 44, 0) 74%); }
.h3d-glow--band { background: radial-gradient(52% 70% at 64% 48%, rgba(190, 128, 56, 0.24) 0%, rgba(150, 92, 40, 0.08) 48%, rgba(150, 92, 40, 0) 74%); }
.h3d-glow--w0   { background: radial-gradient(56% 62% at 50% 38%, rgba(206, 150, 78, 0.27) 0%, rgba(180, 120, 56, 0.09) 46%, rgba(180, 120, 56, 0) 74%); }
.h3d-glow--w1   { background: radial-gradient(56% 62% at 50% 40%, rgba(168, 78, 38, 0.30) 0%, rgba(120, 52, 26, 0.10) 46%, rgba(120, 52, 26, 0) 74%); }
.h3d-glow--w2   { background: radial-gradient(56% 62% at 50% 40%, rgba(96, 62, 58, 0.34) 0%, rgba(60, 38, 36, 0.12) 46%, rgba(60, 38, 36, 0) 74%); }
.h3d-glow--lit  { background: radial-gradient(60% 60% at 62% 66%, rgba(204, 84, 24, 0.22) 0%, rgba(140, 50, 16, 0.07) 45%, rgba(140, 50, 16, 0) 72%); }
.h3d-stage[data-scene="hero"] .h3d-glow--hero,
.h3d-stage[data-scene="band"] .h3d-glow--band,
.h3d-stage[data-scene="trio"][data-wrap="0"] .h3d-glow--w0,
.h3d-stage[data-scene="trio"][data-wrap="1"] .h3d-glow--w1,
.h3d-stage[data-scene="trio"][data-wrap="2"] .h3d-glow--w2,
.h3d-stage[data-scene="lit"] .h3d-glow--lit { opacity: 1; }

.h3d-canvas canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 0.6s ease; }
.h3d-ready .h3d-canvas canvas { opacity: 1; }
.h3d-vignette { pointer-events: none; background: radial-gradient(115% 100% at 50% 46%, rgba(10, 7, 6, 0) 52%, rgba(10, 7, 6, 0.62) 100%); }
.h3d-grain { pointer-events: none; opacity: 0.07; background-size: 128px 128px; }

/* ---------- Copy over the stage (real text) ---------- */
.h3d-ui {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: calc(100vh - var(--hdr));
  height: calc(100svh - var(--hdr));                /* stays above the phone's address bar */
}
.h3d-scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.5rem max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter))) 4.5rem;
  opacity: 0;
  transform: translate3d(-26px, 0, 0);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.h3d-scene.is-on { opacity: 1; transform: none; }
.h3d-scene.is-on a, .h3d-scene.is-on button { pointer-events: auto; }
.h3d-copy { max-width: 33rem; }
.h3d h1, .h3d h2 { color: var(--cream); }
.h3d h1 { font-size: clamp(2.5rem, 4.7vw, 4.3rem); margin-bottom: 1.25rem; }
.h3d h1 em { font-style: italic; color: var(--gold-2); }
.h3d h2 { font-size: clamp(2rem, 3.6vw, 3rem); }
.h3d .sub { font-size: 1.12rem; line-height: 1.6; color: rgba(246, 240, 228, 0.86); max-width: 40ch; margin: 0 0 2rem; }
.h3d-copy > p { font-size: 1.1rem; color: rgba(246, 240, 228, 0.84); max-width: 42ch; }
.h3d-copy .actions { margin-top: 1.6rem; }
.h3d .hero-hours { margin: 1.6rem 0 0; font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-2); }
.h3d-cta .btn { min-width: 170px; }

/* ---------- Wrapper line-up (the carousel) ---------- */
.h3d-scene--trio { justify-content: flex-end; align-items: center; text-align: center; transform: translate3d(0, 22px, 0); }
.h3d-carousel { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 34rem; }
.h3d-carousel .eyebrow { margin-bottom: 0.5rem; }
.h3d-carousel .eyebrow::before { display: none; }
.h3d-carousel-row { display: flex; align-items: center; justify-content: center; gap: 0.75rem; width: 100%; }
.h3d-wraps { display: grid; flex: 1 1 auto; min-width: 0; }
.h3d-wrap { grid-area: 1 / 1; opacity: 0; transform: translate3d(0, 10px, 0); transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.h3d-wrap.is-on { opacity: 1; transform: none; }
.h3d-wrap:not(.is-on) a { pointer-events: none; }
.h3d-wrap h2 { margin: 0 0 0.2rem; font-size: clamp(2.2rem, 4.2vw, 3.3rem); font-weight: 600; }
.h3d-wrap h2 a { color: var(--cream); text-decoration: none; }
.h3d-wrap h2 a:hover { color: var(--gold-2); }
.h3d-wrap p { margin: 0; color: rgba(246, 240, 228, 0.82); font-size: 1.02rem; }
.h3d-arrow {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; padding: 0;
  border: 1px solid rgba(217, 184, 106, 0.6);
  border-radius: 50%;
  background: rgba(28, 22, 20, 0.35);
  color: var(--gold-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.2s;
}
.h3d-arrow:hover { background: rgba(194, 154, 61, 0.16); border-color: var(--gold-2); }
.h3d-arrow[aria-disabled="true"] { opacity: 0.3; cursor: default; }
.h3d-dots { display: flex; gap: 6px; margin-top: 0.9rem; }
.h3d-dots i { width: 22px; height: 2px; background: rgba(246, 240, 228, 0.25); transition: background 0.3s; }
.h3d-dots i.is-on { background: var(--gold); }
.h3d-more { margin-top: 0.8rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-2); text-decoration: none; padding: 0.5rem 0.25rem; }
.h3d-more:hover { color: var(--cream); }

/* ---------- Scroll cue and progress line ---------- */
.h3d-progress { position: absolute; left: 50%; bottom: 1.15rem; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 0.55rem; pointer-events: none; }
.h3d-progress-label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.26em; text-transform: uppercase; color: var(--gold-2); transition: opacity 0.5s; white-space: nowrap; }
.h3d-stage.is-under-way .h3d-progress-label { opacity: 0; }
.h3d-progress-track { display: block; width: 132px; height: 1px; background: rgba(246, 240, 228, 0.22); overflow: hidden; }
.h3d-progress-track i { display: block; height: 100%; background: var(--gold-2); transform: scaleX(0); transform-origin: 0 50%; will-change: transform; }   /* its own layer: it moves on every scrolled frame, and this way nothing else is repainted */

/* ---------- Desktop / landscape: copy on the left, cigar on the right ---------- */
@media (min-width: 900px) {
  .h3d-scene--trio { padding-bottom: 3.4rem; }
  .h3d-progress { left: max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter))); transform: none; align-items: flex-start; }
}

/* ---------- Phones / portrait: copy top or bottom, cigar in the middle ---------- */
@media (max-width: 899px) {
  .h3d-scene { padding: 1.25rem var(--gutter) 3.6rem; text-align: center; align-items: center; transform: translate3d(0, 22px, 0); }
  .h3d-scene.is-on { transform: none; }
  .h3d h1 { font-size: clamp(2.05rem, 9.4vw, 3rem); margin-bottom: 0; }
  .h3d .sub { display: none; }
  .h3d-scene--hero { justify-content: space-between; padding-top: clamp(1rem, 3.6svh, 2rem); }
  .h3d-cta { width: 100%; max-width: 26rem; }
  .h3d-cta .actions { justify-content: center; }
  .h3d-cta .btn { min-width: 0; flex: 1 1 140px; }
  .h3d .hero-hours { margin-top: 0.9rem; font-size: 0.68rem; letter-spacing: 0.12em; }
  .h3d-scene--band, .h3d-scene--lit { justify-content: flex-end; }
  .h3d-scene--band::before, .h3d-scene--lit::before, .h3d-scene--trio::before {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 58%; z-index: -1;
    background: linear-gradient(180deg, rgba(18, 13, 11, 0) 0%, rgba(18, 13, 11, 0.80) 22%, rgba(18, 13, 11, 0.93) 40%, rgba(18, 13, 11, 0.97) 100%);
  }
  .h3d h2 { font-size: clamp(1.75rem, 7.4vw, 2.4rem); }
  .h3d-copy > p { font-size: 1rem; margin-left: auto; margin-right: auto; }
  .h3d-copy .eyebrow::before { display: none; }
  .h3d-copy .actions { justify-content: center; margin-top: 1.1rem; }
  .h3d-scene--lit .actions .btn { flex: 1 1 140px; }
  .h3d-wrap h2 { font-size: clamp(2rem, 9vw, 2.7rem); }
  .h3d-glow--hero { background: radial-gradient(90% 46% at 50% 48%, rgba(196, 126, 58, 0.24) 0%, rgba(170, 100, 44, 0.08) 48%, rgba(170, 100, 44, 0) 76%); }
  .h3d-glow--band { background: radial-gradient(90% 46% at 50% 34%, rgba(190, 128, 56, 0.24) 0%, rgba(150, 92, 40, 0.08) 48%, rgba(150, 92, 40, 0) 76%); }
  .h3d-glow--w0, .h3d-glow--w1, .h3d-glow--w2 { background-size: 100% 100%; background-position: 50% 0; }
  .h3d-glow--lit { background: radial-gradient(95% 44% at 50% 52%, rgba(204, 84, 24, 0.22) 0%, rgba(140, 50, 16, 0.07) 48%, rgba(140, 50, 16, 0) 76%); }
  .h3d-progress { bottom: 0.9rem; }
  .h3d-progress-track { width: 96px; }
}

/* Short screens (small phones, phones on their side): tighten the type */
@media (max-height: 640px) {
  .h3d h1 { font-size: clamp(1.8rem, 7.2vh, 3rem); }
  .h3d .sub, .h3d .hero-hours { display: none; }
  .h3d h2 { font-size: clamp(1.5rem, 6vh, 2.4rem); }
  .h3d-wrap h2 { font-size: clamp(1.6rem, 6.4vh, 2.6rem); }
  .h3d-copy > p { font-size: 0.95rem; margin-bottom: 0.6em; }
  .h3d-copy .actions { margin-top: 0.8rem; }
  .h3d-more { margin-top: 0.3rem; }
  .h3d-progress-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .h3d-scene, .h3d-wrap, .h3d-glow, .h3d-canvas canvas { transition: none; }
}
