/* =========================================================
   Landing-style presentation: 1 slide = 1 viewport
   Each .slide stays 1920×1080 fixed (for PNG export);
   .slide-wrap scales it to fit the viewport.
   ========================================================= */

html, body {
  height: 100%;
  margin: 0;
  background: #000;
  scroll-behavior: smooth;
  overflow: hidden;
}

main.deck {
  height: 100vh;
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
main.deck::-webkit-scrollbar { display: none; } /* Webkit */

.slide-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  /* Same base bg as .slide — keeps the "card edge" invisible when the
     scaled slide doesn't fill the viewport (mobile / narrow viewports).
     Matches the canonical ambient on every slide, vignette included. */
  background:
    radial-gradient(ellipse 90% 75% at 50% 50%, transparent 0%, rgba(0,0,0,0.55) 100%),
    radial-gradient(ellipse 70% 60% at 30% 35%, rgba(0,120,95,0.28), transparent 65%),
    radial-gradient(ellipse 80% 70% at 75% 80%, rgba(0,171,120,0.10), transparent 70%),
    radial-gradient(ellipse 50% 40% at 15% 80%, rgba(255,97,47,0.06), transparent 60%),
    var(--c-evergreen, #0F433B);
}

.slide-wrap > .slide {
  /* Scale fixed-size 1920×1008 to fit viewport, preserving aspect ratio.
     Note: dividing length by *length* (px) yields a unitless number,
     which is what scale() requires. (length / number → length is invalid.) */
  transform: scale(min(calc(100vw / 1920px), calc((100vh - 32px) / 1008px)));
  transform-origin: center center;
  flex-shrink: 0;
  margin: 0;
  border-radius: 0;
}
@supports (height: 100dvh) {
  .slide-wrap > .slide {
    transform: scale(min(calc(100vw / 1920px), calc((100dvh - 32px) / 1008px)));
  }
}

/* =========================================================
   Top progress bar
   ========================================================= */
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,0.06);
  z-index: 100;
}
.progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-fire), #FF8B5F);
  width: 0;
  transition: width 0.2s ease-out;
}

/* =========================================================
   Right-side nav rail (dots)
   ========================================================= */
.rail {
  position: fixed;
  right: max(28px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 100;
}
.rail__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.28);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}
.rail__dot:hover {
  background: rgba(255,255,255,0.4);
  transform: scale(1.2);
}
.rail__dot[aria-current="true"] {
  background: var(--c-fire);
  border-color: var(--c-fire);
  box-shadow: 0 0 0 5px rgba(255,97,47,0.18);
}
.rail__dot::before {
  content: attr(data-label);
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.55);
  padding: 6px 12px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.rail__dot:hover::before { opacity: 1; }
/* Active dot has orange-glow visual emphasis (above);
   label tooltip shows only on hover so it doesn't overlap slide content. */

/* =========================================================
   Scroll hint on first slide
   ========================================================= */
.scroll-hint {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  z-index: 100;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.scroll-hint__chev {
  width: 18px;
  height: 18px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px,-2px);
  animation: bounce 1.6s infinite ease-in-out;
}
.scroll-hint.hide { opacity: 0; }

@keyframes bounce {
  0%,100% { transform: rotate(45deg) translate(-2px,-2px); }
  50%     { transform: rotate(45deg) translate(2px,2px); }
}

/* =========================================================
   Scroll-triggered reveals
   Initial state — elements hidden, transform set.
   .slide-wrap.in-view triggers reveal on its contents.
   ========================================================= */

/* All reveals are SCOPED to .slide-wrap parent — so PNG render (single
   bare slide, no wrap) shows elements in their default visible state. */

.slide-wrap [data-anim] {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
  transition-delay: var(--d, 0ms);
}
.slide-wrap.in-view [data-anim] {
  opacity: 1;
  transform: translateY(0);
}
.slide-wrap [data-anim="fade"] { transform: none; }
.slide-wrap.in-view [data-anim="fade"] { opacity: 1; }

.slide-wrap [data-anim="scale"] { transform: scale(0.94); }
.slide-wrap.in-view [data-anim="scale"] { transform: scale(1); }

/* Bars grow from left */
.slide-wrap [data-anim="bar"] {
  opacity: 0;
  transform-origin: left center;
  transform: scaleX(0);
  transition:
    opacity 0.5s ease,
    transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
  transition-delay: var(--d, 0ms);
}
.slide-wrap.in-view [data-anim="bar"] {
  opacity: 1;
  transform: scaleX(1);
}

/* SVG path + nodes fade in (preserves dashed style) */
.slide-wrap .pipe-fade {
  opacity: 0;
  transition: opacity 0.7s ease;
  transition-delay: var(--d, 0ms);
}
.slide-wrap.in-view .pipe-fade { opacity: 1; }

/* Counter targets — initial hidden, JS fills text and reveals */
.counter {
  display: inline-block;
}

/* Disable scroll-snap inside slides (e.g. tooltips) */
.slide * { scroll-snap-align: none; }

/* =========================================================
   Mobile / touch optimization
   Target: iPhone Pro Max landscape (~932×430), and similar.
   ========================================================= */

/* Hide hover-only tooltips on touch devices (no mouse) */
@media (hover: none) {
  .rail__dot::before { display: none; }
}

/* Landscape phone (Pro Max ≈ 932×430), compact rail + chrome */
@media screen and (max-height: 500px) and (orientation: landscape),
       screen and (max-width: 932px) and (orientation: landscape) {
  .rail {
    gap: 10px;
    right: max(14px, env(safe-area-inset-right));
  }
  .rail__dot {
    width: 10px;
    height: 10px;
  }
  .rail__dot[aria-current="true"] {
    box-shadow: 0 0 0 4px rgba(255,97,47,0.18);
  }
  .scroll-hint {
    bottom: max(10px, env(safe-area-inset-bottom));
    font-size: 9px;
    letter-spacing: 0.20em;
  }
  .scroll-hint__chev { width: 12px; height: 12px; }
  .progress { height: 2px; }
}

/* Portrait phone — usable but not optimized. Hide chrome to reduce clutter. */
@media screen and (max-width: 600px) and (orientation: portrait) {
  .rail, .scroll-hint, .progress { display: none; }
}
