/* ==========================================================================
   KAV — ABERTURA IMERSIVA
   Vídeo do planeta em tela cheia + logo + boas-vindas, sem menu.
   Menu real (.site-chrome) só entra no fim da rolagem do vídeo do hero.
   ========================================================================== */

html {
  scroll-padding-top: 96px;
}

/* --------------------------------------------------------------------------
   Seção de abertura
   -------------------------------------------------------------------------- */
.intro-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  background: var(--kav-navy-deep);
  pointer-events: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  will-change: opacity;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.intro-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  will-change: transform;
  transform-origin: 50% 85%;
}

/* Leitura do texto + emenda suave com o hero logo abaixo */
.intro-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 11, 26, 0.55) 0%, rgba(5, 11, 26, 0.1) 30%, rgba(5, 11, 26, 0.2) 60%, rgba(5, 11, 26, 0.85) 100%),
    radial-gradient(ellipse at center, rgba(5, 11, 26, 0.35) 0%, transparent 65%);
}

.intro-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 24px;
  max-width: 900px;
  will-change: transform, opacity;
}

.intro-logo-wrap {
  position: relative;
  width: clamp(150px, 21vw, 300px);
  margin-top: -2vh;
  filter: drop-shadow(0 6px 36px rgba(111, 211, 255, 0.35));
  animation: introLogoIn 1.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.intro-logo { display: block; width: 100%; height: auto; }

.intro-sub {
  margin-top: clamp(20px, 3.5vh, 34px);
  max-width: 540px;
  font-family: var(--font-main);
  font-size: clamp(0.98rem, 1.4vw, 1.18rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
  animation: introSubIn 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.intro-scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  translate: -50% 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.85);
}

.intro-scroll-cue > * {
  animation: introTextIn 1s ease 2.2s both;
}

/* IMPORTANTE (desempenho): logo e texto já nascem visíveis (opacity 1). Se começassem em opacity:0
   com fade pela GPU, o Chrome nunca registraria o LCP (PageSpeed mostrava "NO_LCP"). */
@keyframes introLogoIn {
  from { transform: scale(0.9); filter: blur(14px) drop-shadow(0 6px 36px rgba(111, 211, 255, 0.35)); }
  to   { transform: scale(1);   filter: blur(0)    drop-shadow(0 6px 36px rgba(111, 211, 255, 0.35)); }
}
@keyframes introSubIn {
  from { transform: translateY(18px); letter-spacing: .04em; }
  to   { transform: translateY(0);    letter-spacing: 0; }
}

@keyframes introTextIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Menu real: escondido durante a abertura e o vídeo; entra no fim do scroll
   -------------------------------------------------------------------------- */
.site-chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

body.chrome-visible .site-chrome {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Três barrinhas (canto superior direito) + menu em tela cheia
   -------------------------------------------------------------------------- */
.immersive-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 1100;
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.immersive-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
  transition: transform 0.3s ease, opacity 0.2s ease, width 0.3s ease;
}

.immersive-toggle span:nth-child(2) { width: 20px; align-self: flex-end; margin-right: 11px; }
.immersive-toggle:hover span:nth-child(2) { width: 26px; margin-right: 11px; }

.immersive-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.immersive-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.immersive-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.immersive-toggle:focus-visible {
  outline: 2px solid var(--kav-cyan);
  outline-offset: 2px;
  border-radius: 10px;
}

body.chrome-visible .immersive-toggle {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.immersive-menu {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 11, 26, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.immersive-menu.open {
  opacity: 1;
  visibility: visible;
}

.immersive-menu-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 24px;
}

.immersive-menu-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.im-link {
  display: block;
  padding: 8px 20px;
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.82);
  transition: color 0.2s ease, transform 0.2s ease;
}

.im-link:hover,
.im-link:focus-visible {
  color: var(--kav-orange-light);
  transform: translateX(4px);
  outline: none;
}

.immersive-menu .im-link,
.immersive-menu .btn {
  opacity: 0;
  transform: translateY(14px);
}

.immersive-menu.open .im-link,
.immersive-menu.open .btn {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.immersive-menu.open li:nth-child(1) .im-link { transition-delay: 0.05s; }
.immersive-menu.open li:nth-child(2) .im-link { transition-delay: 0.10s; }
.immersive-menu.open li:nth-child(3) .im-link { transition-delay: 0.15s; }
.immersive-menu.open li:nth-child(4) .im-link { transition-delay: 0.20s; }
.immersive-menu.open li:nth-child(5) .im-link { transition-delay: 0.25s; }
.immersive-menu.open li:nth-child(6) .im-link { transition-delay: 0.30s; }
.immersive-menu.open li:nth-child(7) .im-link { transition-delay: 0.35s; }
.immersive-menu.open .btn { transition-delay: 0.45s; }

/* --------------------------------------------------------------------------
   Movimento reduzido
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .intro-logo,
  .intro-sub,
  .intro-scroll-cue > * {
    animation: none;
  }
  .intro-content { will-change: auto; }
}

@media (max-width: 768px) {
  .intro-scroll-cue { bottom: 20px; }
}

/* Movimento reduzido: a abertura vira o primeiro bloco da página, sem scrub */
@media (prefers-reduced-motion: reduce) {
  .intro-layer {
    position: relative;
    inset: auto;
    height: 100vh;
    height: 100dvh;
    order: -1;
  }
}

/* ==========================================================================
   Título da abertura: 2 níveis tipográficos + traçados de luz nas bordas das letras
   ========================================================================== */
.intro-headline {
  width: min(92vw, 1100px);
  margin-top: clamp(40px, 10vh, 104px);
  animation: introSubIn 1s cubic-bezier(0.16, 1, 0.3, 1) both;
}


.hl-wrap { position: relative; }
.hl-wrap .hl { display: block; width: 100%; height: auto; overflow: visible; }
.hl-wrap .hl.trace-layer { position: absolute; inset: 0; pointer-events: none; }
.hl-m { display: none; }

.hl .l1, .hl .l2 { font-family: 'Montserrat', var(--font-heading), system-ui, sans-serif; }
.hl .l1 { font-weight: 700; font-size: 96px; letter-spacing: -0.02em; }
.hl .l2 { font-weight: 300; font-size: 50px; }
.hl .b { font-weight: 700; }
.hl-m .l1 { font-size: 88px; }
.hl-m .l2 { font-size: 34px; }

.hl .base { fill: #fff; }

/* Traço de luz: um trecho curto de contorno percorre a borda de cada letra, bem rápido, com pausa */
.hl .trace {
  fill: none;
  stroke: #E6F8FF;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 64 526;
  animation: hlTrace 3.4s cubic-bezier(0.55, 0, 0.25, 1) infinite;
}
.trace-layer { filter: drop-shadow(0 0 5px rgba(111, 211, 255, 0.95)) drop-shadow(0 0 14px rgba(111, 211, 255, 0.45)); }
.hl .trace { animation-delay: 1.6s; }
.hl .trace:nth-of-type(2) { animation-delay: 1.82s; }
.hl .trace:nth-of-type(3) { animation-delay: 2.04s; }
.hl .trace:nth-of-type(4) { animation-delay: 2.26s; }

@keyframes hlTrace {
  0%   { stroke-dashoffset: 0; opacity: 0; }
  4%   { opacity: 1; }
  34%  { stroke-dashoffset: -590; opacity: 1; }
  38%  { stroke-dashoffset: -590; opacity: 0; }
  100% { stroke-dashoffset: -590; opacity: 0; }
}

@media (max-width: 768px) {
  .hl-d { display: none; }
  .hl-m { display: block; }
  .intro-headline { width: min(94vw, 520px); }
}

@media (prefers-reduced-motion: reduce) {
  .hl .trace { animation: none; opacity: 0; }
  .intro-headline { animation: none; }
}

/* ==========================================================================
   Logo: traço de luz nas bordas + brilho de superfície + respiração suave
   ========================================================================== */
.intro-logo-wrap::before {            /* halo suave que "respira" atrás do logo */
  content: "";
  position: absolute;
  inset: -34%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(111, 211, 255, 0.26), rgba(111, 211, 255, 0) 70%);
  animation: logoBreath 4.2s ease-in-out infinite;
  pointer-events: none;
}

/* brilho que atravessa a superfície das letras (usa o próprio logo como máscara) */
.logo-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  -webkit-mask: url(../assets/img/kav-logo-intro.png) center / 100% 100% no-repeat;
          mask: url(../assets/img/kav-logo-intro.png) center / 100% 100% no-repeat;
  background: linear-gradient(105deg, rgba(255,255,255,0) 38%, rgba(255,255,255,.95) 50%, rgba(255,255,255,0) 62%);
  background-size: 260% 100%;
  background-position: 160% 0;
  animation: logoShine 5.6s cubic-bezier(0.55, 0, 0.3, 1) 2.2s infinite;
}

/* contornos reais do logo (extraídos do próprio PNG) */
.logo-trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(111, 211, 255, 0.95)) drop-shadow(0 0 11px rgba(111, 211, 255, 0.5));
}
.logo-trace path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.lt-base path { stroke: rgba(160, 225, 255, 0.34); stroke-width: 3.2; }

/* entrada: o contorno "se desenha" uma vez e some */
.lt-draw path { stroke: #fff; stroke-width: 7; stroke-dasharray: 100; stroke-dashoffset: 100; animation: logoDraw 1.7s cubic-bezier(0.5, 0, 0.2, 1) 0.15s both; }

/* loop: um traço branco e outro laranja em sentidos opostos, rápidos, com pausa */
.lt-a path { stroke: #fff; stroke-width: 6.5; stroke-dasharray: 15 85; animation: logoRunA 3.8s cubic-bezier(0.6, 0, 0.3, 1) infinite; animation-delay: 2.1s; }
.lt-b path { stroke: #FF8A3C; stroke-width: 6; stroke-dasharray: 10 90; animation: logoRunB 3.8s cubic-bezier(0.6, 0, 0.3, 1) infinite; animation-delay: 3.0s; }
.lt-a path:nth-child(1) { animation-delay: 2.1s; } .lt-a path:nth-child(2) { animation-delay: 2.35s; } .lt-a path:nth-child(3) { animation-delay: 2.6s; }
.lt-b path:nth-child(1) { animation-delay: 3.4s; } .lt-b path:nth-child(2) { animation-delay: 3.65s; } .lt-b path:nth-child(3) { animation-delay: 3.9s; }

@keyframes logoDraw { 0% { stroke-dashoffset: 100; opacity: 1; } 65% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes logoRunA { 0% { stroke-dashoffset: 0; opacity: 0; } 4% { opacity: 1; } 36% { stroke-dashoffset: -100; opacity: 1; } 40%, 100% { stroke-dashoffset: -100; opacity: 0; } }
@keyframes logoRunB { 0% { stroke-dashoffset: 0; opacity: 0; } 4% { opacity: 1; } 36% { stroke-dashoffset: 100; opacity: 1; } 40%, 100% { stroke-dashoffset: 100; opacity: 0; } }
@keyframes logoShine { 0% { background-position: 160% 0; } 28%, 100% { background-position: -60% 0; } }
@keyframes logoBreath { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.06); } }

@media (prefers-reduced-motion: reduce) {
  .lt-draw, .lt-a, .lt-b, .logo-shine { display: none; }
  .intro-logo-wrap::before { animation: none; opacity: .8; }
}
