/* ============================================================================
   Anest-Box — Kit de Matrícula (scroll-driven reveal)
   ARCHITECTURE: native position:sticky inside the section. iOS Safari handles
   sticky at the compositor level, immune to momentum-scroll JS pauses.
   Ancestor transforms/overflow are cleared at init (see anest-box.js).
   ============================================================================ */

.anest-box-root {
  --abx-base: #111111;
  --abx-edge-blue: #06091A;
  --abx-navy-900: #0F1D4A;
  --abx-cyan-400: #54BEEA;
  --abx-cyan-500: #2AA6E0;
  --abx-white: #FFFFFF;
  --abx-ink-50:  #F8F9FC;
  --abx-fg: rgba(255,255,255,0.65);
  --abx-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --abx-font-display: 'Orbitron', 'Exo 2', system-ui, sans-serif;
  --abx-font-body:    'Exo 2', 'Inter', system-ui, sans-serif;
  --abx-p: 0;

  /* Section = scroll spacer. 550vh gives enough scroll for the box to
     open fully (reached at progress ~0.72), then ~28% of scroll remaining
     for badges (0.72-0.85) and CTA (0.85-0.92) to arrive on a clean,
     fully-open box. */
  position: relative;
  display: block;
  width: 100%;
  max-width: 100vw;
  height: 250vh;
  color: var(--abx-white);
  /* Clip horizontal overflow from absolute-positioned badges that extend
     outside the box on certain viewport widths. `clip` (NOT `hidden`) is
     the only safe option here — `hidden` would create a scrolling
     containing block and break the position:sticky inside. */
  overflow-x: clip;
  font-family: var(--abx-font-body);
  -webkit-font-smoothing: antialiased;
  background: var(--abx-base);
}

.anest-box-root *,
.anest-box-root *::before,
.anest-box-root *::after { box-sizing: border-box; }

/* ============================================================================
   STICKY WRAPPER — the actual visible stage during scroll. Native CSS sticky.
   Wrapped by JS at runtime. Height 100dvh = honors iOS dynamic viewport.
============================================================================ */

.abx-sticky {
  position: sticky;
  top: 0;
  width: 100%;
  /* Height strategy: use svh = small-viewport-height. On iOS Safari this is
     ALWAYS the guaranteed-visible height (never includes hidden URL bar area).
     This prevents the CTA (at flex-end) from rendering below Safari's chrome.
     Fallback chain: older browsers use 100vh; Safari 15.4+ uses 100svh. */
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  /* #111 at edges, navy atmospheric pools in middle */
  background:
    radial-gradient(ellipse 75% 45% at 50% 50%, rgba(84, 190, 234, 0.09) 0%, transparent 62%),
    radial-gradient(ellipse 65% 35% at 50% 58%, rgba(26, 50, 110, 0.24) 0%, transparent 62%),
    linear-gradient(
      180deg,
      #111111 0%,
      #111111 22%,
      #0E1019 30%,
      #0A0C18 40%,
      #06091A 50%,
      #0A0C18 60%,
      #0E1019 70%,
      #111111 78%,
      #111111 100%
    );
  /* Flex column: header top → stage → CTA, todos próximos com gap fixo.
     Antes: stage tinha flex:1 1 auto → estica em telas grandes → CTA distante.
     Agora: gap de 32px mantém CTA sempre logo abaixo do box independente do
     tamanho da viewport ou zoom. */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
}

/* ============================================================================
   HEADER (title + subtitle)
============================================================================ */

.abx-header {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;                         /* tighter: h2 ↔ subtitle */
  padding: 56px 20px 0;
  width: 100%;
  max-width: 1100px;
  z-index: 2;
}
/* The extra specificity + !important beats any WP theme or Elementor H2 rules
   that sometimes weigh in with font-weight: 700 / font-size: inherit. */
.anest-box-root .abx-title,
.abx-sticky .abx-title,
h2.abx-title {
  font-family: var(--abx-font-display) !important;
  font-weight: 400 !important;
  font-size: 36px !important;
  line-height: 1.2 !important;
  text-align: center !important;
  color: #fff !important;
  letter-spacing: 0 !important;
  max-width: min(1000px, 94vw);
  margin: 0 !important;
  text-wrap: balance;
  will-change: opacity;
}
.abx-accent {
  color: var(--abx-cyan-400);
  position: relative;
}
.abx-accent::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--abx-cyan-500), transparent);
  opacity: calc(0.35 + var(--abx-p) * 0.65);
  transform-origin: center;
  transform: scaleX(calc(0.4 + var(--abx-p) * 0.6));
}
.abx-sub {
  /* Matches the reference: near-white (very slightly muted), light weight,
     humanist body font (Exo 2), generous line-height. */
  font: 300 17px/1.6 var(--abx-font-body);
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
  max-width: min(640px, 92vw);
  margin: 0;
  letter-spacing: 0.01em;
  will-change: opacity;
}

/* ============================================================================
   STAGE — takes remaining space, centers the box
============================================================================ */

.abx-stage {
  /* flex 0 0 auto: tamanho exato do conteúdo (o box). Não estica em
     viewports grandes — assim o CTA fica sempre próximo do box. */
  flex: 0 0 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.abx-box {
  position: relative;
  width: 100%;
  /* Smaller box so text panels can sit FULLY outside it without overlapping.
     Desktop ≥1440vw: box = 500px, each side free = 470px. */
  max-width: min(500px, 50svh, calc(100vw - 700px));
  aspect-ratio: 1 / 1;
}
.abx-box::after {
  content: "";
  position: absolute;
  left: 12%; right: 12%; bottom: 6%;
  height: 4%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.6), transparent 65%);
  filter: blur(14px);
  opacity: calc(0.4 + var(--abx-p) * 0.35);
  pointer-events: none;
  z-index: 0;
}

/* Video source (hidden decoder) */
.abx-src {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
  top: 0; left: 0;
}

/* Canvas (WebGL alpha composite) */
.abx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: translateZ(0);
  will-change: transform;
  background: transparent;
  z-index: 1;
}

/* Connector lines SVG */
.abx-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 3;
}
.abx-lines path {
  fill: none;
  stroke: rgba(42, 166, 224, 0.55);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-dasharray: 2 4;
}

/* Badges */
.abx-items {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  inset: 0;
  z-index: 4;
}
.abx-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  opacity: 0;
  --abx-ty: 8px;
  transform: translateY(var(--abx-ty));
  will-change: transform, opacity;
}
/* ALL items: dot sits at TOP-LEFT of item (above card, left-aligned). */
.abx-item { align-items: flex-start; }

/* AirPods specifically: card ABOVE the dot. The dot then sits at the BOTTOM
   of the item, closer to the box — visually the card "rests" on the dot,
   appropriate for a badge that floats ABOVE the box. */
.abx-item[data-abx-key="airpods"] {
  flex-direction: column-reverse;
}

.abx-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--abx-cyan-500);
  box-shadow: 0 0 0 3px rgba(42,166,224,0.18), 0 0 14px rgba(42,166,224,0.55);
}
.abx-meta {
  background: linear-gradient(180deg, rgba(16,24,48,0.92), rgba(8,14,32,0.92));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.6);
  text-align: left;
}
.abx-num {
  font: 600 9px/1 var(--abx-font-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--abx-cyan-400);
  opacity: 0.85;
}
.abx-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  max-width: 16ch;
}
/* Description text — HIDDEN on mobile (small badges only), VISIBLE on desktop
   where we show Apple-style expanded text panels around the box. */
.abx-desc {
  display: none;
}

/* ============================================================================
   DESKTOP: expanded text panels Apple-style
   Larger meta bubbles with description visible, positioned outside the box.
============================================================================ */
@media (min-width: 769px) {
  .abx-meta {
    /* Compact enough to sit fully outside the box on standard desktops. */
    min-width: 240px;
    max-width: 280px;
    padding: 14px 18px;
    border-radius: 10px;
    gap: 3px;
  }
  .abx-num {
    font-size: 9.5px;
    letter-spacing: 0.22em;
  }
  .abx-label {
    font-size: 16px;
    line-height: 1.28;
    max-width: none;
    font-weight: 600;
    letter-spacing: -0.005em;
  }
  .abx-desc {
    display: block;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.45;
    font-weight: 300;
    margin-top: 4px;
    font-family: var(--abx-font-body);
  }
  .abx-dot {
    width: 10px; height: 10px;
    box-shadow: 0 0 0 4px rgba(42,166,224,0.20), 0 0 18px rgba(42,166,224,0.65);
  }
}

/* ============================================================================
   CTA — in flow at bottom of sticky. NOT fixed (ios fixed-broken). Sticky
   keeps it pinned to the viewport naturally while we're in the section.
============================================================================ */

.abx-cta,
.abx-cta:link,
.abx-cta:visited,
.abx-cta:hover,
.abx-cta:active,
.abx-cta:focus {
  text-decoration: none !important;
  text-decoration-line: none !important;
  border-bottom: 0 !important;
}
.abx-cta *,
.abx-cta *:hover {
  text-decoration: none !important;
  border-bottom: 0 !important;
}
.abx-cta {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  /* margin removido: o gap da sticky agora controla a distância pro box */
  margin: 0 auto;
  z-index: 10;
  background: var(--abx-white);
  color: var(--abx-navy-900);
  /* PADRONIZADO: Exo 2, 800, 16px, uppercase, mesmas dims dos outros CTAs */
  font-family: 'Exo 2', 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 16px 32px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 14px 34px -8px rgba(10,20,54,0.55);
  transition:
    transform 400ms var(--abx-ease-out),
    opacity 360ms ease-out,
    background 220ms var(--abx-ease-out),
    box-shadow 220ms var(--abx-ease-out);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  white-space: nowrap;
}
/* Shimmer glint no hover (mesmo dos outros CTAs) */
.abx-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.4) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.abx-cta--visible:hover::before { transform: translateX(100%); }
/* Arrow injetada via pseudo-element pra não precisar mexer no HTML do snippet */
.abx-cta::after {
  content: '';
  position: relative;
  z-index: 1;
  display: inline-block;
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%230a1436' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 10h10M11 6l4 4-4 4'/></svg>") center/contain no-repeat;
  transition: transform 260ms var(--abx-ease-out);
}
.abx-cta--visible:hover::after { transform: translateX(4px); }
.abx-cta-label { position: relative; z-index: 1; }
.abx-cta.abx-cta--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.abx-cta:hover {
  transform: translateY(-2px);
  background: var(--abx-ink-50);
  box-shadow: 0 22px 44px -10px rgba(10,20,54,0.65);
}
.abx-cta:active { transform: translateY(0); }
.abx-cta-arrow {
  /* legacy span — escondido (substituído por ::after) */
  display: none;
}

/* ============================================================================
   MOBILE
============================================================================ */

@media (max-width: 768px) {
  /* Mobile recebe a mesma redução de scroll aplicada no desktop —
     viewports verticais já são altos, então 170vh é suficiente pra
     box abrir + badges + CTA aparecerem com folga, sem scroll extra. */
  .anest-box-root { height: 170vh; }

  .abx-header {
    gap: 16px;                       /* tighter on mobile */
    padding: 36px 20px 0;
  }
  .anest-box-root .abx-title,
  .abx-sticky .abx-title,
  h2.abx-title { font-size: 26px !important; line-height: 1.2 !important; }
  .abx-sub    { font-size: 14px; line-height: 1.5; }

  /* Tight gap between subtitle and box on mobile (was padding 14px). */
  .abx-stage  { padding: 0 14px; }
  .abx-box    { max-width: min(88vw, 50vh); }

  /* Mobile: same compact panel layout as before BUT with the description
     visible (replicating desktop style). Panels stay in their current
     positions, just slightly taller due to the extra line(s). */
  .abx-meta   { min-width: 0; max-width: 46vw; padding: 8px 11px; border-radius: 7px; gap: 2px; }
  .abx-num    { font-size: 8px; letter-spacing: 0.16em; }
  .abx-label  { font-size: 11.5px; line-height: 1.22; max-width: none; font-weight: 600; }
  .abx-desc {
    display: block;
    font-size: 10px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.72);
    font-weight: 300;
    margin-top: 2px;
    font-family: var(--abx-font-body);
  }
  .abx-dot    { width: 6px; height: 6px; }

  .abx-cta {
    margin: 0 auto calc(36px + env(safe-area-inset-bottom, 0px));
    padding: 14px 24px;
    font-size: 14px;
    letter-spacing: 0.04em;
  }
  .abx-cta::after { width: 16px; height: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .abx-accent::after, .abx-cta, .abx-cta-arrow, .abx-canvas { transition: none !important; }
}
