/* ==========================================================================
   ByAgentX Release Candidate — Progressive Hero Film Enhancement
   File: /assets/release-hero.css
   Owned exclusively by Hero Film / Media lane.
   Loaded at END of <head> on EN (/) and MX (/mx/) home pages via hero-apply.mjs.

   Guarantees:
   - Preserves official approved "lab de noche" film (hero-1080.mp4 2560x1440 /
     hero-720.mp4 1920x1080 / hero.jpg 2560x1440) at full clarity.
   - Desktop: luminous racks on the right stay unobstructed (0% dark veil over
     the racks), while left-column typography retains AAA legibility.
   - Mobile & Portrait: dedicated in-flow visible cinema window at top of hero
     with zero text overlays and zero dark veil hiding the film, cleanly
     separated from the crisp obsidian typography block below.
   - Reduced motion: NO autoplay; crisp unobstructed hero.jpg still with an
     actual manual Play/Resume control that overrides hidden video on click.
   - Autoplay-restricted (e.g. iOS Low Power Mode): prominent manual Play/Resume
     control right on the visible film stage.
   ========================================================================== */

/* ---------- 1. Hero Container & Layering Discipline ---------- */
#top.hero.vhero {
  position: relative;
  isolation: isolate;
  background-color: var(--obsidian, #060809);
}

#top.hero.vhero > .wrap,
#top.hero.vhero .hero-main,
#top.hero.vhero .hero-ticker {
  position: relative;
  z-index: 2;
}

/* ---------- 2. Desktop / Landscape Cinema Stage ---------- */
#top.hero.vhero .hvid {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background-color: var(--obsidian, #060809);
  pointer-events: none;
}

#top.hero.vhero .hvid video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 64% 48%;
  opacity: 1 !important;
  filter: brightness(1.15) contrast(1.06) saturate(1.14);
  transform: translateZ(0);
  will-change: opacity;
}

/* Surgical left-only text legibility scrim — NEVER veils the right-side racks */
#top.hero.vhero .hvid::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      rgba(6, 8, 9, 0.86) 0%,
      rgba(6, 8, 9, 0.68) 28%,
      rgba(6, 8, 9, 0.24) 45%,
      rgba(6, 8, 9, 0) 58%
    ),
    linear-gradient(
      180deg,
      rgba(6, 8, 9, 0.34) 0%,
      rgba(6, 8, 9, 0) 14%,
      rgba(6, 8, 9, 0) 86%,
      rgba(6, 8, 9, 0.78) 100%
    );
}

/* Crisp text legibility over dark obsidian without darkening the racks */
#top.hero.vhero h1,
#top.hero.vhero .lead {
  text-shadow: 0 2px 24px rgba(6, 8, 9, 0.82), 0 1px 6px rgba(6, 8, 9, 0.88);
}

#top.hero.vhero .hero-eyebrow-row,
#top.hero.vhero .hero-meta-line,
#top.hero.vhero .hstats,
#top.hero.vhero .metrics-method {
  text-shadow: 0 1px 14px rgba(6, 8, 9, 0.92);
}

/* Keep the right ~44-48% open as an unmistakable visual film window on desktop */
@media (min-width: 981px) {
  #top.hero.vhero .hero-main {
    grid-template-columns: minmax(0, min(720px, 55%)) minmax(0, 1fr);
  }
}

@media (min-width: 901px) and (max-width: 1200px) {
  #top.hero.vhero .hvid video {
    object-position: 70% 48%;
  }
}

/* ---------- 3. Hero Film Control Pill (Sibling of .hvid — accessible focus) ---------- */
#top.hero.vhero .bx-hero-controls {
  position: absolute;
  right: max(18px, var(--gutter, 32px));
  bottom: var(--bx-hero-ctrl-bottom, 22px);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

#top.hero.vhero .bx-hero-toggle {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(77, 226, 247, 0.36);
  background: rgba(6, 10, 12, 0.82);
  color: #f2eee6;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

#top.hero.vhero .bx-hero-toggle:hover {
  border-color: rgba(77, 226, 247, 0.85);
  background: rgba(8, 16, 20, 0.94);
  transform: translateY(-1px);
}

#top.hero.vhero .bx-hero-toggle:focus-visible {
  outline: 2px solid var(--cyan, #4de2f7);
  outline-offset: 3px;
}

#top.hero.vhero .bx-hero-icon {
  width: 14px;
  height: 14px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 14px;
  color: var(--cyan, #4de2f7);
}

#top.hero.vhero .bx-hero-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan, #4de2f7);
  box-shadow: 0 0 10px rgba(77, 226, 247, 0.9);
  flex: 0 0 7px;
}

/* Prominent high-contrast Play/Resume CTA when autoplay is blocked, paused, or reduced-motion */
#top.hero.vhero[data-hero-state="autoplay-blocked"] .bx-hero-toggle,
#top.hero.vhero[data-hero-state="reduced-motion"] .bx-hero-toggle,
#top.hero.vhero[data-hero-state="paused"] .bx-hero-toggle {
  min-height: 44px;
  padding: 10px 18px;
  border-color: rgba(77, 226, 247, 0.88);
  background: rgba(6, 13, 17, 0.94);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow:
    0 0 0 1px rgba(77, 226, 247, 0.3),
    0 14px 36px rgba(0, 0, 0, 0.65),
    0 0 24px rgba(77, 226, 247, 0.2);
}

#top.hero.vhero[data-hero-state="autoplay-blocked"] .bx-hero-live-dot,
#top.hero.vhero[data-hero-state="reduced-motion"] .bx-hero-live-dot,
#top.hero.vhero[data-hero-state="paused"] .bx-hero-live-dot {
  display: none;
}

#top.hero.vhero .bx-hero-hint {
  pointer-events: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(6, 10, 12, 0.78);
  border: 1px solid rgba(242, 238, 230, 0.16);
  color: #c9c5bb;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

#top.hero.vhero[data-hero-state="playing"] .bx-hero-hint {
  display: none;
}

/* ---------- 4. Mobile & Portrait — DEDICATED VISIBLE FILM AREA ---------- */
@media (max-width: 900px), (orientation: portrait) and (max-width: 1024px) {
  #top.hero.vhero {
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: var(--bx-hero-nav-clearance, calc(var(--ribbon-h, 0px) + var(--nav-h, 66px)));
    padding-bottom: 0;
  }

  /* Dedicated, unobstructed cinema frame right at the top of the hero */
  #top.hero.vhero .hvid {
    position: relative !important;
    inset: auto !important;
    z-index: 1 !important;
    flex: 0 0 auto;
    width: 100%;
    height: clamp(220px, 31svh, 330px);
    background-color: #060809;
    border-bottom: 1px solid rgba(77, 226, 247, 0.28);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  }

  /* Frame all three cyan-lit server racks + drifting mist cleanly inside portrait viewport */
  #top.hero.vhero .hvid video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 82% 48% !important;
    opacity: 1 !important;
    filter: brightness(1.18) contrast(1.06) saturate(1.16);
  }

  /* NO heavy dark overlay over mobile video — only subtle bottom lip for control contrast */
  #top.hero.vhero .hvid::after {
    background: linear-gradient(
      180deg,
      rgba(6, 8, 9, 0.14) 0%,
      rgba(6, 8, 9, 0) 14%,
      rgba(6, 8, 9, 0) 76%,
      rgba(6, 8, 9, 0.44) 100%
    ) !important;
  }

  /* Control bar anchored directly inside bottom edge of dedicated film frame */
  #top.hero.vhero .bx-hero-controls {
    position: relative;
    right: auto;
    bottom: auto;
    z-index: 6;
    width: 100%;
    height: 54px;
    margin-top: -54px;
    padding: 0 12px 10px;
    justify-content: flex-end;
    align-items: flex-end;
  }

  #top.hero.vhero[data-hero-state="autoplay-blocked"] .bx-hero-controls,
  #top.hero.vhero[data-hero-state="reduced-motion"] .bx-hero-controls {
    justify-content: space-between;
  }

  #top.hero.vhero .bx-hero-toggle {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 11px;
  }

  #top.hero.vhero[data-hero-state="autoplay-blocked"] .bx-hero-toggle,
  #top.hero.vhero[data-hero-state="reduced-motion"] .bx-hero-toggle,
  #top.hero.vhero[data-hero-state="paused"] .bx-hero-toggle {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 12px;
  }

  #top.hero.vhero .bx-hero-hint {
    font-size: 10px;
    padding: 5px 9px;
  }

  /* Crisp, clean obsidian typography block directly below the dedicated film frame */
  #top.hero.vhero .hero-main {
    grid-template-columns: 1fr;
    padding-top: 18px;
    padding-bottom: 22px;
    background: var(--obsidian, #060809);
  }

  #top.hero.vhero .hero-nvidia {
    margin-bottom: 10px;
  }

  #top.hero.vhero h1.serif {
    font-size: clamp(36px, 9.5vw, 48px);
    line-height: 0.96;
    margin: 10px 0 12px;
    text-shadow: none;
  }

  #top.hero.vhero .lead {
    font-size: 15.5px;
    line-height: 1.5;
    text-shadow: none;
  }

  #top.hero.vhero .cta {
    margin-top: 16px;
    gap: 10px;
  }
}

/* ---------- 5. Reduced Motion — NO Autoplay + Crisp Poster + Manual Play Override ---------- */
@media (prefers-reduced-motion: reduce) {
  #top.hero.vhero .hvid {
    background-color: var(--obsidian, #060809) !important;
    background-image: url(/assets/lab-sign/hero.jpg?v=20261121-scroll-1) !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-position: 64% 48% !important;
  }

  #top.hero.vhero:not([data-hero-manual-play="true"]) .hvid video {
    display: none !important;
  }

  /* Manual Play/Resume override when user explicitly chooses to play under reduced motion */
  #top.hero.vhero[data-hero-manual-play="true"] .hvid video {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

@media (prefers-reduced-motion: reduce) and (max-width: 900px),
       (prefers-reduced-motion: reduce) and (orientation: portrait) and (max-width: 1024px) {
  #top.hero.vhero .hvid {
    background-position: 82% 48% !important;
  }
}
