/* ==========================================================================
   KAV + HYPERKAV — HERO SCROLL-DRIVEN STYLESHEET
   Design de Alta Fidelidade (Apple / Stripe / Linear / Awwwards)
   Paleta Oficial: Azul-Marinho (#050B1A, #0A1633), Laranja (#FF6A1A, #FF9A3C), Ciano (#6FD3FF)
   ========================================================================== */

:root {
  --kav-navy-deep: #050B1A;
  --kav-navy-base: #0A1633;
  --kav-navy-surface: #0E224D;
  --kav-orange: #FF6A1A;
  --kav-orange-glow: rgba(255, 106, 26, 0.35);
  --kav-orange-light: #FF9A3C;
  --kav-amber: #FFA048;
  --kav-cyan: #6FD3FF;
  --kav-cyan-glow: rgba(111, 211, 255, 0.25);
  --kav-text-light: #F0F4FC;
  --kav-text-muted: #94A3B8;
  --kav-glass-bg: rgba(10, 22, 51, 0.72);
  --kav-glass-border: rgba(111, 211, 255, 0.15);
}

/* --------------------------------------------------------------------------
   Container Principal do Hero Scroll
   -------------------------------------------------------------------------- */
.hero-scroll-section {
  position: relative;
  width: 100%;
  height: 500vh;
  background-color: var(--kav-navy-deep);
  color: var(--kav-text-light);
}

/* --------------------------------------------------------------------------
   Viewport Sticky (Fixo em 100vh durante a rolagem)
   -------------------------------------------------------------------------- */
.hero-sticky-viewport {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--kav-navy-base);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   Vídeo 3D em Tela Cheia & Canvas Fallback
   -------------------------------------------------------------------------- */
.hero-media-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}

.hero-scroll-video,
.hero-frames-canvas,
.hero-fallback-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.hero-fallback-canvas {
  display: none;
}

/* Vinheta e Gradientes Suaves de Contraste WCAG AA (Centro Sempre Limpo) */
.hero-vignette-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: 
    linear-gradient(180deg, rgba(5, 11, 26, 0.8) 0%, rgba(5, 11, 26, 0.15) 25%, transparent 40%),
    linear-gradient(0deg, rgba(5, 11, 26, 0.94) 0%, rgba(5, 11, 26, 0.65) 28%, transparent 55%),
    radial-gradient(circle at center, transparent 40%, rgba(5, 11, 26, 0.45) 100%);
}

/* --------------------------------------------------------------------------
   Barra Superior de Progresso, Buffer & Atos
   -------------------------------------------------------------------------- */
.hero-top-hud {
  position: absolute;
  top: 20px;
  left: 0;
  width: 100%;
  z-index: 10;
  padding: 0 84px 0 32px;
  transition: opacity 0.4s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.acts-pill-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--kav-glass-bg);
  border: 1px solid var(--kav-glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px 6px;
  border-radius: 100px;
  pointer-events: auto;
}

.act-pill-btn {
  background: none;
  border: 1px solid transparent;
  padding: 6px 14px;
  border-radius: 100px;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--kav-text-muted);
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.act-pill-btn:hover {
  color: var(--kav-text-light);
  border-color: rgba(255, 106, 26, 0.3);
}

.act-pill-btn.active {
  background: rgba(255, 106, 26, 0.15);
  color: var(--kav-orange-light);
  border-color: var(--kav-orange);
  box-shadow: 0 0 12px var(--kav-orange-glow);
}

.hero-progress-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--kav-cyan);
  letter-spacing: 0.08em;
  background: var(--kav-glass-bg);
  border: 1px solid var(--kav-glass-border);
  backdrop-filter: blur(12px);
  padding: 5px 12px;
  border-radius: 100px;
  white-space: nowrap;
}

.progress-dot-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--kav-orange);
  box-shadow: 0 0 8px var(--kav-orange);
  animation: pulseDotLive 1.6s infinite;
}

@keyframes pulseDotLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

/* Barra de Buffer Real de Download do Vídeo */
.hero-buffer-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: rgba(111, 211, 255, 0.45);
  z-index: 19;
  transition: width 0.25s ease-out, opacity 0.5s ease;
}

/* Barra de Progresso do Scroll no Topo */
.hero-scroll-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 20;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--kav-orange) 0%, var(--kav-orange-light) 60%, var(--kav-cyan) 100%);
  box-shadow: 0 0 10px var(--kav-orange);
  transition: width 0.05s linear;
}

/* --------------------------------------------------------------------------
   Container de Textos de Storytelling (Laterais & Inferior)
   -------------------------------------------------------------------------- */
.hero-story-container {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.hero-story-step {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s ease-out, 
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.2s ease-out;
  pointer-events: none;
  will-change: opacity, transform;
}

.hero-story-step.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  /* entrada mais lenta e marcante; a saída continua rápida (transição base acima) */
  transition-duration: 0.6s, 0.8s, 0.6s;
}

/* Variação Inferior Central (Com margem vertical generosa para não encostar na dica de scroll) */
.hero-story-step.pos-bottom-center {
  bottom: 72px;
  left: 50%;
  transform: translate(-50%, 12px);
  text-align: center;
  max-width: 1180px;
  width: 92%;
}

.hero-story-step.pos-bottom-center.active {
  transform: translate(-50%, 0);
}

.hero-story-step.pos-bottom-left {
  bottom: 84px;
  left: 6%;
  max-width: 760px;
  text-align: left;
}

.hero-story-step.pos-bottom-right {
  bottom: 84px;
  right: 6%;
  max-width: 760px;
  text-align: right;
}

/* Tipografia do Storytelling */
.story-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  background: rgba(255, 106, 26, 0.12);
  border: 1px solid rgba(255, 106, 26, 0.35);
  color: var(--kav-orange-light);
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
}

.story-step-badge.badge-hyperkav {
  background: rgba(111, 211, 255, 0.12);
  border-color: rgba(111, 211, 255, 0.4);
  color: var(--kav-cyan);
}

.story-step-title {
  font-family: var(--font-heading);
  font-size: clamp(2.1rem, 4.6vw, 4.2rem);
  font-weight: 800;
  line-height: 1.08;
  color: #FFFFFF;
  margin-bottom: 16px;
  letter-spacing: -0.035em;
  text-wrap: balance;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.75);
}

/* Segunda parte do título em dourado, como destaque visual */
.story-step-title .hl {
  color: #FFB224;
}

.story-step-subtitle {
  font-family: var(--font-main);
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  line-height: 1.55;
  color: var(--kav-text-light);
  max-width: 600px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

.pos-bottom-right .story-step-subtitle {
  margin-left: auto;
}

.pos-bottom-center .story-step-subtitle {
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   CTA Final (92% - 100%)
   -------------------------------------------------------------------------- */
.story-cta-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  pointer-events: auto;
}

.btn-kav-primary {
  background: linear-gradient(135deg, #FF6A1A 0%, #FF9A3C 100%);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 24px var(--kav-orange-glow);
  padding: 14px 30px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-normal);
}

.btn-kav-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 8px 32px rgba(255, 106, 26, 0.55);
  color: #FFFFFF;
}

.btn-kav-secondary {
  background: var(--kav-glass-bg);
  color: var(--kav-cyan);
  border: 1px solid var(--kav-glass-border);
  backdrop-filter: blur(10px);
  padding: 14px 26px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-normal);
}

.btn-kav-secondary:hover {
  background: rgba(111, 211, 255, 0.1);
  border-color: var(--kav-cyan);
  color: #FFFFFF;
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Indicador Animado de Rolagem (Posicionamento Seguro sem Sobreposição)
   -------------------------------------------------------------------------- */
.hero-scroll-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--kav-text-muted);
  font-family: var(--font-heading);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: opacity 0.25s ease;
  cursor: pointer;
  pointer-events: auto;
}

.mouse-icon {
  width: 20px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  position: relative;
  display: flex;
  justify-content: center;
}

.mouse-wheel {
  width: 4px;
  height: 6px;
  background-color: var(--kav-orange);
  border-radius: 2px;
  position: absolute;
  top: 5px;
  box-shadow: 0 0 6px var(--kav-orange);
  animation: mouseWheelScroller 1.8s infinite ease-in-out;
}

@keyframes mouseWheelScroller {
  0% { transform: translateY(0); opacity: 1; }
  60% { transform: translateY(11px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* --------------------------------------------------------------------------
   Preloader Discreto
   -------------------------------------------------------------------------- */
.hero-loader {
  display: none !important;
  position: absolute;
  inset: 0;
  background-color: var(--kav-navy-deep);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.4s ease;
}

.hero-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader-kav-emblem {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 106, 26, 0.2);
  border-top-color: var(--kav-orange);
  border-radius: 50%;
  animation: spinLoader 0.9s infinite linear;
}

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

.loader-text {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--kav-orange-light);
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Acessibilidade: Modo Prefers-Reduced-Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .hero-scroll-section,
  .hero-scroll-section.reduced-motion-mode {
    height: auto !important;
    min-height: 100vh;
    padding: 120px 0 80px;
  }

  .hero-sticky-viewport {
    position: relative !important;
    height: auto !important;
    min-height: auto;
  }

  .hero-media-wrapper {
    position: relative !important;
    height: 380px !important;
    margin-bottom: 40px;
  }

  .hero-story-container {
    position: relative !important;
    inset: auto !important;
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 0 24px;
    max-width: 900px;
    margin: 0 auto;
    pointer-events: auto !important;
  }

  .hero-story-step {
    position: relative !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    inset: auto !important;
    max-width: 100% !important;
    text-align: left !important;
    pointer-events: auto !important;
    border-left: 3px solid var(--kav-orange);
    padding-left: 20px;
  }

  .hero-top-hud,
  .hero-scroll-hint,
  .hero-scroll-progress-bar,
  .hero-buffer-bar {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Responsividade: Breakpoints 1440px, 1280px, 1024px, 768px, 480px, 360px
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .hero-story-step.pos-bottom-center {
    bottom: 72px;
    max-width: 980px;
  }
}

@media (max-width: 1024px) {
  .hero-story-step.pos-bottom-center {
    bottom: 72px;
    max-width: 880px;
  }

  .hero-story-step.pos-bottom-left,
  .hero-story-step.pos-bottom-right {
    bottom: 84px;
    left: 24px;
    right: 24px;
    max-width: 90%;
    text-align: left;
  }

  .hero-story-step.pos-bottom-right .story-step-subtitle {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .hero-top-hud {
    top: 20px;
    padding: 0 68px 0 16px;
  }

  .act-pill-btn {
    padding: 4px 10px;
    font-size: 0.72rem;
  }

  .hero-progress-meter {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  .hero-story-step.pos-bottom-center {
    bottom: 96px;
    left: 20px;
    right: 20px;
    width: auto;
    max-width: calc(100% - 40px);
    transform: translateY(12px);
    text-align: left;
  }

  .hero-story-step.pos-bottom-center.active {
    transform: translateY(0);
  }

  .hero-story-step.pos-bottom-left,
  .hero-story-step.pos-bottom-right {
    bottom: 96px;
    left: 20px;
    right: 20px;
    width: auto;
    max-width: calc(100% - 40px);
    text-align: left;
    transform: translateY(12px);
  }

  .story-step-title {
    font-size: 2.05rem;
    line-height: 1.1;
  }

  .story-step-subtitle {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .story-cta-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .btn-kav-primary,
  .btn-kav-secondary {
    width: 100%;
    justify-content: center;
  }

  .hero-scroll-hint {
    bottom: 16px;
  }
}

@media (max-width: 480px) {
  .hero-top-hud {
    top: 22px;
    padding: 0 60px 0 10px;
    gap: 6px;
  }

  .hero-progress-meter {
    display: none;
  }

  .acts-pill-nav {
    padding: 3px 5px;
    gap: 4px;
  }

  .act-pill-btn {
    padding: 4px 7px;
    font-size: 0.66rem;
  }

  .hero-progress-meter {
    font-size: 0.66rem;
    padding: 4px 7px;
  }

  .hero-story-step.pos-bottom-center,
  .hero-story-step.pos-bottom-left,
  .hero-story-step.pos-bottom-right {
    bottom: 84px;
    left: 16px;
    right: 16px;
    max-width: calc(100% - 32px);
  }

  .story-step-title {
    font-size: 1.8rem;
    line-height: 1.1;
  }

  .story-step-subtitle {
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .hero-scroll-hint {
    bottom: 14px;
    font-size: 0.68rem;
  }

  .mouse-icon {
    width: 18px;
    height: 28px;
  }
}

@media (max-width: 360px) {
  .hero-top-hud {
    top: 22px;
    padding: 0 56px 0 6px;
    gap: 4px;
  }

  .acts-pill-nav {
    padding: 2px 4px;
    gap: 2px;
  }

  .act-pill-btn {
    padding: 3px 5px;
    font-size: 0.62rem;
  }

  .hero-progress-meter {
    font-size: 0.62rem;
    padding: 3px 5px;
  }
}


/* ==========================================================================
   Texto de impacto (HyperKav): centralizado, grande, com legenda menor abaixo
   ========================================================================== */
.hero-story-step.step-impact .story-step-title {
  font-size: clamp(2.3rem, 5.4vw, 5rem);
}

.hero-story-step.step-impact .story-step-subtitle {
  max-width: 720px;
  font-size: clamp(1.05rem, 1.7vw, 1.5rem);
}

@media (max-width: 768px) {
  .hero-story-step.pos-bottom-center.step-impact { text-align: center; }
  .hero-story-step.step-impact .story-step-subtitle { margin: 0 auto; }
}

.hero-story-step.step-impact .story-step-badge { display: none; }
