/* ============================================================
   Fislab — Cinematic hero (Atom → Energy → Big Bang → Expansion)
   Loaded ONLY by index.html. Safe to delete to revert the feature:
   without the `webgl-hero` class the hero renders as the original.
   ============================================================ */

/* ---- Stage / pin -------------------------------------------------
   Default (no JS, no WebGL, reduced motion) = the original hero:
   a normal full-height section, no pinning, no extra scroll. */
.hero-stage {
  position: relative;
  width: 100%;
}

.hero-pin {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* Only once the WebGL scene is live do we grow the stage, so a CDN/WebGL
   failure can never leave dead scroll space. */
html.webgl-hero .hero-stage {
  height: var(--hero-stage-vh, 200vh);
}

html.webgl-hero .hero-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

/* Moderately short windows (a laptop browser that isn't maximized, extra
   toolbars, etc.) still fit the pinned cinematic hero once the copy is
   tightened up a bit — this is far more common than a truly tiny viewport,
   so it must stay pinned rather than skip the whole story on first scroll. */
@media (max-height: 760px) {
  html.webgl-hero #heroContent {
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
    gap: 2rem;
  }
  html.webgl-hero #heroContent h1 {
    font-size: clamp(1.8rem, 4vw, 3rem);
  }
}

/* Only truly tiny viewports (embedded widgets, a phone in landscape with the
   keyboard up, etc.) can't fit the copy at all — don't pin there. */
@media (max-height: 420px) {
  html.webgl-hero .hero-stage { height: auto; }
  html.webgl-hero .hero-pin {
    position: relative;
    height: auto;
    overflow: visible;
  }
}

/* ---- Background: deep green, no grid, soft atmospheric glow ---- */
.hero-pin.hero-dark {
  background:
    radial-gradient(120% 90% at 30% 45%, rgba(0, 78, 56, 0.55), transparent 62%),
    radial-gradient(90% 70% at 78% 18%, rgba(0, 54, 39, 0.45), transparent 70%),
    linear-gradient(180deg, #04160f 0%, #020a07 62%, #010705 100%);
}

/* the volumetric halo that sits behind the atom */
.hero-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(46% 52% at 30% 52%, rgba(61, 220, 151, 0.20), transparent 68%),
    radial-gradient(26% 28% at 30% 52%, rgba(140, 255, 205, 0.16), transparent 72%);
  filter: blur(18px);
}

@media (max-width: 767px) {
  .hero-atmosphere {
    background:
      radial-gradient(60% 34% at 50% 68%, rgba(61, 220, 151, 0.20), transparent 70%);
  }
}

/* ---- WebGL canvas layer (behind all content) ---- */
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 900ms ease;
}

html.webgl-hero .hero-canvas {
  opacity: 1;
}

/* The SVG atom is the fallback — hidden once the WebGL atom takes over */
html.webgl-hero #atomSlot {
  visibility: hidden;
}

/* ---- Hero content layer ---- */
#heroContent {
  will-change: opacity, transform;
}

/* Premium Arabic typography: larger, tighter, more confident than the
   default utility sizes — content itself is unchanged. */
html.webgl-hero #heroContent h1 {
  font-size: clamp(2.4rem, 5.4vw, 4.6rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.45);
}

html.webgl-hero #heroContent p {
  max-width: 34rem;
  text-shadow: 0 1px 24px rgba(0, 0, 0, 0.5);
}

/* ---- Scientific annotations (subtle, not cards) ---- */
.hero-annotations {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

.hero-annot {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-inline-start: 10px;
  border-inline-start: 1px solid rgba(169, 242, 209, 0.32);
  opacity: 0.9;
  white-space: nowrap;
}

.hero-annot__label {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(169, 242, 209, 0.62);
}

.hero-annot__value {
  font-size: 13px;
  font-weight: 600;
  color: rgba(233, 255, 245, 0.92);
  font-variant-numeric: tabular-nums;
}

/* placed around the visualisation, never over the copy */
.hero-annot--a { top: 26%; left: 6%; }
.hero-annot--b { top: 62%; left: 4%; }
.hero-annot--c { bottom: 16%; left: 26%; }

@media (max-width: 1023px) {
  .hero-annot--c { display: none; }
}

@media (max-width: 767px) {
  .hero-annotations { display: none; }
}

/* ---- Scroll cue ---- */
.hero-scroll-cue {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.hero-scroll-cue__dot {
  width: 22px;
  height: 34px;
  border: 1px solid rgba(169, 242, 209, 0.4);
  border-radius: 12px;
  position: relative;
}

.hero-scroll-cue__dot::after {
  content: '';
  position: absolute;
  top: 7px;
  left: 50%;
  width: 3px;
  height: 6px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: rgba(169, 242, 209, 0.85);
  animation: heroScrollDot 1.9s ease-in-out infinite;
}

@keyframes heroScrollDot {
  0%, 100% { transform: translateY(0); opacity: 1; }
  55% { transform: translateY(11px); opacity: 0.25; }
}

.hero-scroll-cue__text {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(169, 242, 209, 0.6);
}

/* ---- Clickable electrons (Phase 1 only) ---- */
.hero-electron-links {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.hero-electron-links a {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transition: opacity 300ms ease;
  background: transparent;
}

.hero-electron-links a:focus-visible {
  opacity: 1;
  outline: 2px solid var(--electron-color);
  outline-offset: 3px;
}

.hero-electron-links[data-active="false"] a {
  pointer-events: none;
}

/* ---- Cinematic captions ---- */
.hero-captions {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
  text-align: center;
  padding: 0 24px;
}

.hero-caption {
  margin: 0;
  opacity: 0;
  color: #eafff5;
  font-family: Montserrat, Inter, system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-shadow: 0 0 30px rgba(var(--glow-rgb), 0.5);
  will-change: opacity, transform;
}

.hero-caption--primary {
  font-size: clamp(20px, 3.4vw, 40px);
  font-weight: 700;
}

.hero-caption--secondary {
  font-size: clamp(13px, 1.6vw, 19px);
  font-weight: 500;
  color: rgba(234, 255, 245, 0.78);
  letter-spacing: 0.22em;
}

/* ---- Phones: drop the square atom slot so the copy fits one screen ---- */
@media (max-width: 767px) {
  html.webgl-hero #atomSlot { display: none; }
  html.webgl-hero #heroContent {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  .hero-scroll-cue { bottom: 14px; }
}

/* ---- Reduced motion / no WebGL: never pin, never show the extras ---- */
@media (prefers-reduced-motion: reduce) {
  html.webgl-hero .hero-stage { height: auto; }
  html.webgl-hero .hero-pin { position: relative; height: auto; }
  .hero-canvas { display: none; }
  .hero-captions { display: none; }
  .hero-scroll-cue__dot::after { animation: none; }
}

html.no-webgl-hero .hero-annotations,
html.no-webgl-hero .hero-scroll-cue {
  display: none;
}
