/* ═══════════════════════════════════════════════════════════════════════════
   Scrollytelling v2 – Naruto Monitor  ·  Snap & Lock Architecture
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Base / Variables ─────────────────────────────────────────────────── */
:root {
  --st-black:      #000000;
  --st-deep:       #1a0033;
  --st-purple:     #a855f7;
  --st-purple-dim: rgba(168, 85, 247, 0.30);
  --st-cyan:       #22d3ee;
  --st-green:      #2bff88;
  --st-surface:    rgba(10, 6, 18, 0.55);
  --st-ease:       cubic-bezier(0.16, 1, 0.3, 1);
  --st-ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
}

.scrolly-body {
  margin: 0;
  background: linear-gradient(180deg, var(--st-black) 0%, #0d001a 40%, var(--st-deep) 100%);
  background-attachment: fixed;
  color: #ffffff;
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;                     /* body doesn't scroll — the snap container does */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Sticky header ────────────────────────────────────────────────────── */
.st-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  height: 60px;
  background: transparent;
  transition: background 0.45s var(--st-ease),
              border-color 0.45s var(--st-ease),
              backdrop-filter 0.45s var(--st-ease);
  border-bottom: 1px solid transparent;
}
.st-header.is-scrolled {
  background: rgba(10, 6, 18, 0.65);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom-color: rgba(168, 85, 247, 0.08);
}
.st-header__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  text-decoration: none;
  transition: color 0.3s;
}
.st-header__logo:hover { color: var(--st-purple); }
.st-header__logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.35));
  transition: filter 0.3s ease;
}
.st-header__logo:hover .st-header__logo-icon {
  filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.6));
}
.st-header__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: 10px;
  border: 1px solid rgba(168, 85, 247, 0.22);
  background: rgba(168, 85, 247, 0.08);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.35s var(--st-ease);
}
.st-header__cta svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  transition: transform 0.25s ease;
}
.st-header__cta:hover {
  background: rgba(168, 85, 247, 0.18);
  border-color: var(--st-purple);
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.15);
}
.st-header__cta:hover svg { transform: translateX(3px); }

/* ── Loading overlay ──────────────────────────────────────────────────── */
.st-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--st-black) 0%, #0d001a 40%, var(--st-deep) 100%);
  transition: opacity 0.8s var(--st-ease-out), visibility 0.8s;
}
.st-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.st-loader__ring {
  width: 56px;
  height: 56px;
  border: 2px solid rgba(168, 85, 247, 0.15);
  border-top-color: var(--st-purple);
  border-radius: 50%;
  animation: loaderSpin 0.8s linear infinite;
}
.st-loader__text {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(168, 85, 247, 0.6);
}
.st-loader__pct {
  margin-top: 0.5rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
@keyframes loaderSpin { to { transform: rotate(360deg); } }

/* ── Progress bar ─────────────────────────────────────────────────────── */
.st-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--st-purple), var(--st-cyan));
  z-index: 9991;
  transition: width 0.6s var(--st-ease-out);
  will-change: width;
  box-shadow: 0 0 12px var(--st-purple-dim);
}

/* ── Canvas — fixed behind the snap container ─────────────────────────── */
.st-canvas-wrap {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: transparent;
}
.st-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  image-rendering: high-quality;
  will-change: contents;
}

/* ── Scanlines / vignette ─────────────────────────────────────────────── */
.st-scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0, 0, 0, 0.04) 2px, rgba(0, 0, 0, 0.04) 4px
  );
  mix-blend-mode: multiply;
}
.st-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ══════════════════════════════════════════════════════════════════════════
   SNAP SCROLL CONTAINER
   Each child .st-snap-section is exactly 100vh and snaps to center.
   ══════════════════════════════════════════════════════════════════════════ */
.st-snap-container {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  /* Hide scrollbar for all browsers */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.st-snap-container::-webkit-scrollbar { display: none; }

.st-snap-section {
  scroll-snap-align: center;
  scroll-snap-stop: always;
  width: 100%;
  height: 100vh;                        /* fallback for older browsers */
  height: 100svh;                       /* stable on mobile — no address-bar jank */
  display: flex;
  align-items: center;
  position: relative;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   STAGGERED MICRO-ANIMATIONS
   [data-stagger] children start invisible and translate up on reveal.
   --stagger index is derived from the attribute value.
   ══════════════════════════════════════════════════════════════════════════ */
[data-stagger] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--st-ease-out),
              transform 0.7s var(--st-ease-out);
  will-change: opacity, transform;
}
/* Cascade delays based on stagger index */
[data-stagger="0"] { transition-delay: 0.05s; }
[data-stagger="1"] { transition-delay: 0.18s; }
[data-stagger="2"] { transition-delay: 0.32s; }
[data-stagger="3"] { transition-delay: 0.48s; }
[data-stagger="4"] { transition-delay: 0.62s; }

/* Revealed state — IntersectionObserver adds this class */
[data-stagger].st-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════════════════
   TEXT PANELS — Glass-morphism cards
   ══════════════════════════════════════════════════════════════════════════ */
.st-panel {
  pointer-events: none;
  padding: 4rem 2rem;
}
.st-panel__inner {
  width: 450px;
  max-width: 100%;
  padding: 2rem 2.25rem;
  border-radius: 16px;
  background: rgba(10, 6, 18, 0.60);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(168, 85, 247, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* ── Asymmetric positioning ───────────────────────────────────────────── */
.st-panel--left {
  justify-content: flex-start;
}
.st-panel--left .st-panel__inner {
  margin-left: 6vw;
}

.st-panel--right {
  justify-content: flex-end;
}
.st-panel--right .st-panel__inner {
  margin-right: 6vw;
}

.st-panel--center {
  justify-content: center;
}
.st-panel--center .st-panel__inner {
  width: 520px;
  margin: 0 auto;
  text-align: center;
}

/* ── Typography ───────────────────────────────────────────────────────── */
.st-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  border: 1px solid var(--st-purple-dim);
  background: rgba(168, 85, 247, 0.08);
  color: var(--st-purple);
  margin-bottom: 1rem;
}
.st-heading {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin-bottom: 1rem;
}
.st-heading span {
  background: linear-gradient(135deg, #ffffff 10%, #e2d0ff 50%, var(--st-purple) 85%, var(--st-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.st-body {
  font-size: 0.95rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.6);
  max-width: 440px;
  font-weight: 400;
  letter-spacing: 0.005em;
}

/* Divider line accent */
.st-divider {
  width: 48px;
  height: 2px;
  margin: 1.25rem 0;
  background: linear-gradient(90deg, var(--st-purple), transparent);
  border-radius: 2px;
}
.st-panel--right .st-divider,
.st-panel--center .st-divider {
  margin-left: auto;
  margin-right: 0;
  background: linear-gradient(270deg, var(--st-purple), transparent);
}
.st-panel--center .st-divider {
  margin: 1.25rem auto;
  background: linear-gradient(90deg, transparent, var(--st-purple), transparent);
}

/* ── Stat counter pill ────────────────────────────────────────────────── */
.st-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-top: 1.25rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.07);
  border: 1px solid rgba(168, 85, 247, 0.18);
}
.st-stat__value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--st-green);
  font-variant-numeric: tabular-nums;
}
.st-stat__label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
}

/* ── Hero card modifier (snap section 0) ──────────────────────────────── */
.st-heading--hero {
  font-size: clamp(2rem, 5vw, 3.4rem);
}
.st-hero-card {
  position: relative;
  z-index: 2;
}
.st-hero__scroll-cue {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  animation: scrollCuePulse 2.2s ease-in-out infinite;
}
.st-hero__scroll-cue span {
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(168, 85, 247, 0.5);
}
.st-hero__scroll-cue svg {
  width: 20px;
  height: 20px;
  stroke: var(--st-purple);
  opacity: 0.5;
}
@keyframes scrollCuePulse {
  0%, 100% { opacity: 1; transform: translateX(-50%) translateY(0); }
  50%      { opacity: 0.4; transform: translateX(-50%) translateY(8px); }
}

/* ── CTA buttons ──────────────────────────────────────────────────────── */
.st-cta-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 2rem;
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.18);
  background: rgba(168, 85, 247, 0.08);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.35s var(--st-ease);
}
.st-cta-btn:hover {
  background: rgba(168, 85, 247, 0.18);
  border-color: var(--st-purple);
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.2), 0 0 80px rgba(168, 85, 247, 0.08);
  transform: translateY(-1px);
}
.st-cta-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  transition: transform 0.25s ease;
}
.st-cta-btn:hover svg { transform: translateX(3px); }
.st-cta-btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.65);
}
.st-cta-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
  color: #fff;
}

/* ── Frame counter ────────────────────────────────────────────────────── */
.st-frame-counter {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  font-family: 'Inter', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: rgba(168, 85, 247, 0.35);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Cards sit at the bottom of the viewport on mobile */
  .st-snap-section.st-panel {
    align-items: flex-end;
    padding: 0 5vw 2rem;
  }
  .st-panel--left,
  .st-panel--right,
  .st-panel--center {
    justify-content: center;
  }
  .st-panel__inner {
    width: 90vw;
    max-width: none;
    position: relative;
    z-index: 2;                          /* above the gradient overlay */
  }
  .st-panel--left .st-panel__inner,
  .st-panel--right .st-panel__inner {
    margin-left: 0;
    margin-right: 0;
  }

  /* Dark gradient overlay — readable white text over bright neon frames */
  .st-snap-section.st-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.38) 40%,
      transparent 100%
    );
    pointer-events: none;
    z-index: 1;
  }

  /* Text scaling */
  .st-heading {
    font-size: clamp(1.3rem, 5vw, 1.5rem);
  }
  .st-heading--hero {
    font-size: clamp(1.4rem, 6vw, 1.75rem);
  }
  .st-body {
    font-size: 0.875rem;
    line-height: 1.65;
  }
  .st-tag {
    font-size: 0.6rem;
  }
  .st-stat__value {
    font-size: 1.3rem;
  }

  /* Header compact */
  .st-header {
    height: 52px;
  }
  .st-header__cta {
    padding: 0.45rem 1rem;
    font-size: 0.75rem;
  }
  .st-header__logo-icon {
    width: 26px;
    height: 26px;
  }

  /* Hide scroll cue on mobile — snap behavior is obvious */
  .st-hero__scroll-cue {
    display: none;
  }
}
