/* ==========================================================================
   TECTO MARK — SCROLL-DRIVEN CANVAS CHARACTER HERO SEQUENCE
   Native continuation of the Tecto Mark design system:
   Near-black (#07080A), Plus Jakarta Sans, Electric Blue (#3B82F6),
   letter-spaced mono labels, and responsive canvas frame scrubber.
   ========================================================================== */

/* ── Container for All 5 Scenes ─────────────────────────────────────────── */
.hero-sequence {
  position: relative;
  width: 100%;
  background: var(--bg-main, #07080A);
  color: var(--text-primary, #FFFFFF);
  overflow: clip;
}

/* ── Individual Scene Section (Scroll Track) ────────────────────────────── */
.hero-scene {
  position: relative;
  width: 100%;
  height: 220vh; /* Smooth scrub range for 240 frames */
  background: var(--bg-main, #07080A);
}

/* Stacking z-indexes so each scene smoothly layers over the previous one */
#hero-scene-1 { z-index: 10; }
#hero-scene-2 { z-index: 20; }
#hero-scene-3 { z-index: 30; }
#hero-scene-4 { z-index: 40; }
#hero-scene-5 { z-index: 50; }

/* ── Sticky Viewport (100vh pinned stage) ───────────────────────────────── */
.scene-sticky {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding-top: var(--nav-h, 72px);
  background: var(--bg-main, #07080A);
  contain: layout paint;
}

/* ── Canvas Layer ───────────────────────────────────────────────────────── */
.scene-canvas-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  background: transparent;
  transform: translateZ(0);
  will-change: contents;
}

/* ── Cinematic Dark Vignette & Vibrant Character Spotlight ──────────────── */
.scene-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    /* Left-side dark scrim focused purely over text, clearing out completely before the character */
    linear-gradient(90deg,
      rgba(6, 7, 9, 0.94) 0%,
      rgba(6, 7, 9, 0.85) 28%,
      rgba(6, 7, 9, 0.40) 42%,
      rgba(6, 7, 9, 0.08) 54%,
      transparent 64%
    ),
    /* Subtle top & bottom edge blends that keep the 3D character brightly lit */
    linear-gradient(180deg,
      rgba(6, 7, 9, 0.5) 0%,
      transparent 12%,
      transparent 84%,
      rgba(6, 7, 9, 0.65) 100%
    ),
    /* Vibrant Electric-Blue / Cyan volumetric spotlight behind the 3D character */
    radial-gradient(ellipse 76% 72% at 74% 50%, rgba(37, 99, 235, 0.42) 0%, rgba(0, 210, 255, 0.22) 38%, transparent 75%);
}

/* Bottom fade on Scene 5 to dissolve cleanly into the marquee / trust bar */
#hero-scene-5 .scene-overlay {
  background:
    linear-gradient(90deg,
      rgba(6, 7, 9, 0.94) 0%,
      rgba(6, 7, 9, 0.85) 28%,
      rgba(6, 7, 9, 0.40) 42%,
      rgba(6, 7, 9, 0.08) 54%,
      transparent 64%
    ),
    linear-gradient(180deg,
      rgba(6, 7, 9, 0.5) 0%,
      transparent 12%,
      rgba(6, 7, 9, 0.4) 75%,
      rgba(6, 7, 9, 0.95) 100%
    ),
    radial-gradient(ellipse 75% 70% at 74% 50%, rgba(37, 99, 235, 0.32) 0%, rgba(56, 189, 248, 0.16) 38%, transparent 74%);
}

/* ── Signature Tecto Mark Ambient Grid & Grid Overlay ───────────────────── */
.scene-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  z-index: 3;
}

/* ── Foreground Content Layout ──────────────────────────────────────────── */
.scene-inner {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: var(--container, 1320px);
  margin: 0 auto;
  padding: 0 var(--gutter, clamp(16px, 4vw, 56px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.scene-content {
  max-width: 680px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transform: translateZ(0);
}

/* Hardware accelerated scroll-synced text elements */
.scene-eyebrow,
.scene-headline,
.scene-sub,
.scene-actions {
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
}

/* All scene contents are active and visible */
.scene-content {
  max-width: 680px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transform: translateZ(0);
  visibility: visible;
  opacity: 1;
}

.scene-eyebrow,
.scene-headline,
.scene-sub,
.scene-actions {
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.scene-line-text {
  display: inline-block;
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

/* ── Eyebrow Label Tag ──────────────────────────────────────────────────── */
.scene-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #93C5FD;
  margin-bottom: 22px;
  padding: 6px 16px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.38);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 22px rgba(37, 99, 235, 0.25);
}

.scene-eyebrow .dot {
  width: 7px;
  height: 7px;
  background: #38BDF8;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 12px #38BDF8;
  animation: sceneDotPulse 2s ease-in-out infinite;
}

@keyframes sceneDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* ── Scene Headline (Masked 3D Typography) ────────────────────────────── */
.scene-headline {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
  font-size: clamp(2.5rem, 4.6vw, 4.8rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 22px;
  text-transform: uppercase;
  color: #FFFFFF;
  perspective: 1200px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
}

.scene-line-mask {
  display: block;
  overflow: hidden;
  padding-bottom: 4px;
  margin-bottom: -2px;
}

.scene-line-text {
  display: inline-block;
  transform-origin: 0% 100%;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.scene-headline .accent-word {
  background: linear-gradient(135deg, #2563EB 0%, #00D2FF 50%, #67E8F9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  filter: drop-shadow(0 0 28px rgba(0, 210, 255, 0.75));
}

/* ── Scene Subcopy ──────────────────────────────────────────────────────── */
.scene-sub {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: clamp(1.02rem, 1.25vw, 1.24rem);
  line-height: 1.72;
  letter-spacing: -0.012em;
  color: rgba(255, 255, 255, 0.92);
  max-width: 580px;
  margin-bottom: 34px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.95);
}

/* ── Action Buttons ─────────────────────────────────────────────────────── */
.scene-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* ── Scene Counter Badge (Desktop top right of card) ─────────────────────── */
.scene-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  align-self: flex-start;
  margin-top: 20px;
  pointer-events: none;
}

.scene-counter {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--text-muted, rgba(255, 255, 255, 0.48));
}

.scene-counter .scene-current {
  color: #FFFFFF;
  font-weight: 700;
  font-size: 1.1rem;
}

.scene-badge-phase {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-light, #60A5FA);
}

/* ── Interactive Scene HUD Timeline (Pinned Right) ──────────────────────── */
.scene-hud {
  position: fixed;
  right: clamp(16px, 2.5vw, 36px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 100;
  pointer-events: auto;
}

.scene-hud-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(14, 16, 21, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s var(--ease-smooth, cubic-bezier(0.16, 1, 0.3, 1));
}

.scene-hud-item:hover {
  background: rgba(20, 23, 32, 0.9);
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateX(-4px);
}

.scene-hud-num {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
  transition: color 0.3s;
}

.scene-hud-label {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.3s, max-width 0.3s;
}

.scene-hud-item:hover .scene-hud-label,
.scene-hud-item.active .scene-hud-label {
  opacity: 1;
  max-width: 100px;
}

.scene-hud-bar {
  width: 18px;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  transition: width 0.3s, background 0.3s;
}

.scene-hud-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent, #3B82F6);
  transition: width 0.1s linear;
}

.scene-hud-item.active {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.scene-hud-item.active .scene-hud-num {
  color: #FFFFFF;
}

.scene-hud-item.active .scene-hud-bar {
  width: 28px;
  background: rgba(59, 130, 246, 0.3);
}

/* ── HUD Hide When Scrolling Beyond Hero ────────────────────────────────── */
.scene-hud.hud-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* ── Corner Badge & Scroll Indicator ────────────────────────────────────── */
.scene-corner-tag {
  display: none !important;
}

.scene-scroll-indicator {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim, rgba(255, 255, 255, 0.4));
  pointer-events: none;
  z-index: 6;
}

.scene-scroll-indicator .scroll-line {
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, var(--accent, #3B82F6), transparent);
  animation: sceneScrollDrop 1.8s ease-in-out infinite;
}

@keyframes sceneScrollDrop {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  50.1% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ── Lightweight Preload HUD (Matches Dark Theme) ───────────────────────── */
.scene-preload-hud {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.7);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.scene-preload-hud.loaded {
  opacity: 0;
  transform: translateY(10px);
}

.scene-preload-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--accent, #3B82F6);
  border-radius: 50%;
  animation: sceneSpin 0.8s linear infinite;
}

@keyframes sceneSpin {
  to { transform: rotate(360deg); }
}

/* ── Responsive Adaptations ─────────────────────────────────────────────── */

/* Tablet (1024px and down) */
@media (max-width: 1024px) {
  .hero-scene {
    height: 200vh;
  }
  .scene-inner {
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
  }
  .scene-content {
    max-width: 580px;
  }
  .scene-meta {
    display: none;
  }
  .scene-hud {
    right: 12px;
    gap: 8px;
  }
  .scene-hud-label {
    display: none !important;
  }
  .scene-corner-tag {
    display: none;
  }
}

/* Mobile (768px and down) */
@media (max-width: 768px) {
  .hero-scene {
    height: 180vh;
  }
  .scene-sticky {
    padding-top: calc(var(--nav-h-compact, 56px) + 12px);
    padding-bottom: 24px;
    align-items: flex-end;
  }
  .scene-inner {
    padding: 0 20px 32px;
  }
  .scene-content {
    max-width: 100%;
  }
  .scene-eyebrow {
    font-size: 0.65rem;
    margin-bottom: 14px;
    padding: 4px 10px;
  }
  .scene-headline {
    font-size: clamp(2rem, 7.5vw, 3rem);
    line-height: 1.08;
    margin-bottom: 14px;
  }
  .scene-sub {
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 22px;
  }
  .scene-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .scene-actions .btn-primary,
  .scene-actions .btn-secondary {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .scene-hud {
    display: none; /* Hide vertical HUD on small mobile screens to keep view uncluttered */
  }
  .scene-scroll-indicator {
    display: none;
  }

  /* Tailored Mobile Overlay: Dark scrim at bottom where copy sits */
  .scene-overlay {
    background:
      linear-gradient(180deg,
        rgba(7, 8, 10, 0.45) 0%,
        rgba(7, 8, 10, 0.15) 30%,
        rgba(7, 8, 10, 0.82) 58%,
        rgba(7, 8, 10, 0.98) 85%,
        rgba(7, 8, 10, 1) 100%
      ),
      radial-gradient(ellipse 70% 50% at 50% 35%, rgba(59, 130, 246, 0.14) 0%, transparent 70%);
  }
  #hero-scene-5 .scene-overlay {
    background:
      linear-gradient(180deg,
        rgba(7, 8, 10, 0.45) 0%,
        rgba(7, 8, 10, 0.15) 30%,
        rgba(7, 8, 10, 0.82) 58%,
        rgba(7, 8, 10, 0.98) 85%,
        rgba(7, 8, 10, 1) 100%
      ),
      radial-gradient(ellipse 70% 50% at 50% 35%, rgba(59, 130, 246, 0.14) 0%, transparent 70%);
  }
}

