/* AUREX VERIFIED — Cinematic Intro (experience #1).
 *
 * Blade Runner 2049 ATMOSPHERE, built entirely from CSS + the
 * original AUREX emblem — no video files, no external assets, no
 * stock templates, no heavy blocking resources. All motion is
 * transform / opacity only, so it stays cheap on phones.
 *
 * Non-blocking by construction:
 * - The section carries the `hidden` attribute in the HTML and is
 *   only revealed by public/js/intro.js. If JS is disabled, if
 *   intro.js fails to load, or if an asset fails, the intro never
 *   appears and the platform underneath is fully usable.
 * - A visible skip control is present from the first frame.
 * - `prefers-reduced-motion` collapses the intro to a static
 *   frame and intro.js finishes it immediately.
 * - Sound is created ONLY inside the sound-toggle click handler
 *   (Web Audio, no audio files, no autoplay anywhere).
 */

.cinematic-intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Vertical overflow is REAL on short phones (P3 layout math
   * 2026-11-13: the full stack is ~664px at 360px wide, over a
   * 640px viewport — and ~96px over a 568px one). `overflow-y:
   * auto` keeps the Enter/Sound buttons reachable by scrolling
   * instead of clipped; `overflow-x` stays hidden so the wide
   * atmosphere layers never make a horizontal scrollbar. */
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.25rem 1rem 1.5rem;
  text-align: center;
  color: var(--white);
  background:
    radial-gradient(120% 55% at 50% 108%, rgba(179, 18, 31, 0.28) 0%, rgba(179, 18, 31, 0.08) 42%, transparent 68%),
    radial-gradient(90% 60% at 50% -10%, rgba(120, 130, 155, 0.22) 0%, transparent 60%),
    linear-gradient(180deg, #050507 0%, #0a0a0e 46%, #0d0b0e 78%, #070608 100%);
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.cinematic-intro[hidden] { display: none; }

.cinematic-intro.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---------- Atmosphere layers (aria-hidden, decorative only) ---------- */

.intro-atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Distant horizon glow: a low, wide ember line, like city light
 * bleeding over a far skyline. Subtle by design — red is an
 * accent here, never a wash. */
.intro-horizon {
  position: absolute;
  left: 50%;
  bottom: 16%;
  width: 130%;
  height: 2.25rem;
  transform: translateX(-50%);
  background: radial-gradient(50% 100% at 50% 50%, rgba(210, 31, 43, 0.5) 0%, rgba(210, 31, 43, 0.12) 55%, transparent 100%);
  filter: blur(6px);
  animation: intro-horizon 6.5s ease both;
}

/* Volumetric fog: two wide, heavily blurred bands drifting
 * sideways on transform only. */
.intro-fog {
  position: absolute;
  left: -25%;
  width: 150%;
  height: 9rem;
  border-radius: 50%;
  filter: blur(28px);
  background: radial-gradient(50% 50% at 50% 50%, rgba(160, 168, 188, 0.16) 0%, transparent 70%);
  animation: intro-fog-drift 14s ease-in-out infinite alternate;
}
.intro-fog--low { bottom: -2rem; animation-duration: 17s; animation-delay: -6s; opacity: 0.85; }
.intro-fog--high { bottom: 22%; height: 7rem; opacity: 0.6; }

/* Fine vertical light shafts, barely there. */
.intro-beam {
  position: absolute;
  top: -10%;
  width: 2.5rem;
  height: 75%;
  background: linear-gradient(180deg, rgba(201, 204, 211, 0.14) 0%, transparent 85%);
  filter: blur(7px);
  transform: skewX(-14deg);
  animation: intro-beam 6.5s ease both;
}
.intro-beam--left { left: 18%; animation-delay: 0.5s; }
.intro-beam--right { right: 18%; animation-delay: 0.9s; }

/* Perspective floor grid: faint lines converging toward the
 * horizon, giving the scene depth without any image asset. */
.intro-grid {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -4%;
  height: 34%;
  background-image:
    linear-gradient(rgba(201, 204, 211, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 204, 211, 0.10) 1px, transparent 1px);
  background-size: 100% 2.2rem, 3.2rem 100%;
  transform: perspective(26rem) rotateX(58deg);
  transform-origin: top center;
  mask-image: linear-gradient(180deg, transparent 0%, #000 45%, transparent 96%);
  animation: intro-grid 6.5s ease both;
}

@keyframes intro-horizon {
  from { opacity: 0; }
  60% { opacity: 1; }
  to { opacity: 1; }
}
@keyframes intro-fog-drift {
  from { transform: translateX(-4%); }
  to { transform: translateX(4%); }
}
@keyframes intro-beam {
  from { opacity: 0; }
  55% { opacity: 1; }
  to { opacity: 0.75; }
}
@keyframes intro-grid {
  from { opacity: 0; }
  50% { opacity: 1; }
  to { opacity: 0.9; }
}

/* ---------- Content ---------- */

.intro-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 30rem;
  width: 100%;
  /* `margin: auto` (not `justify-content` alone) centres the
   * stack when it fits AND keeps its top reachable when it does
   * not: with `justify-content: center` only, a taller-than-
   * viewport stack clips equally top and bottom and the top can
   * never be scrolled to. Auto margins collapse to 0 on overflow,
   * so the stack starts at the top and scrolls normally. */
  margin: auto;
  animation: intro-content-in 1.1s ease both;
}

@keyframes intro-content-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* The ORIGINAL emblem, as given — never cropped, recoloured, or
 * distorted. Metallic presence comes from the drop-shadow + the
 * sheen sweep below, not from touching the image itself. */
.intro-emblem-wrap {
  position: relative;
  width: min(9.5rem, 38vw);
  animation: intro-emblem 2.4s cubic-bezier(0.22, 0.8, 0.3, 1) 0.5s both;
}
.intro-emblem {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 1.4rem rgba(201, 204, 211, 0.28)) drop-shadow(0 0.4rem 2.4rem rgba(0, 0, 0, 0.8));
}
/* Metallic sheen: a diagonal light band sweeping across the
 * emblem once, then settling. Pure CSS, transform only. */
.intro-emblem-wrap::after {
  content: "";
  position: absolute;
  inset: -6% -30%;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.34) 50%, transparent 58%);
  transform: translateX(-120%);
  animation: intro-sheen 1.6s ease 1.9s both;
  pointer-events: none;
}

@keyframes intro-emblem {
  from { opacity: 0; transform: translateY(1.4rem) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes intro-sheen {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}

.intro-eyebrow {
  margin: 1.4rem 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--silver);
  animation: intro-rise 1s ease 1.7s both;
}

.intro-title {
  margin: 0;
  font-size: 2.1rem;
  line-height: 1.05;
  letter-spacing: 0.1em;
  font-weight: 800;
  animation: intro-rise 1s ease 1.9s both;
}
.intro-title span { color: var(--red-bright); }

.intro-rule {
  width: 4.5rem;
  height: 2px;
  margin: 1rem auto 0;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--red-bright), transparent);
  animation: intro-rule 1.1s ease 2.3s both;
}

.intro-tagline {
  margin: 1rem 0 0;
  max-width: 24rem;
  color: var(--silver);
  font-size: 0.98rem;
  line-height: 1.55;
  animation: intro-rise 1s ease 2.5s both;
}

@keyframes intro-rise {
  from { opacity: 0; transform: translateY(0.9rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes intro-rule {
  from { opacity: 0; transform: scaleX(0.2); }
  to { opacity: 1; transform: scaleX(1); }
}

.intro-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: stretch;
  width: 100%;
  max-width: 20rem;
  margin-top: 1.6rem;
  animation: intro-rise 1s ease 2.9s both;
}
.intro-actions .btn { width: 100%; }

/* Honesty line (owner requirement (e)): the intro makes one
 * service promise in its tagline, so the prototype's stage is
 * stated here too — what is ready today, what is planned. */
.intro-readiness {
  margin: 1rem 0 0;
  max-width: 24rem;
  color: var(--silver-dim);
  font-size: 0.78rem;
  line-height: 1.5;
  animation: intro-rise 1s ease 3.2s both;
}

/* ---------- Skip (visible from the FIRST frame — no entrance
 * animation, no delay, always keyboard-focusable) ---------- */

.intro-skip {
  position: absolute;
  z-index: 3;
  top: 0.9rem;
  inset-inline-end: 0.9rem;
  padding: 0.55rem 0.95rem;
  min-height: 2.5rem;
  font-size: 0.92rem;
  background: rgba(10, 10, 12, 0.72);
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.intro-skip:hover {
  background: var(--surface);
  border-color: var(--silver-dim);
}

/* ---------- Progress (decorative; the skip control, not the
 * bar, is the way out) ---------- */

.intro-progress {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  width: min(12rem, 56vw);
  height: 2px;
  margin: 0;
  background: rgba(201, 204, 211, 0.22);
  border-radius: 999px;
  overflow: hidden;
}
.intro-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--red-bright);
  transform: scaleX(0);
  transform-origin: left center;
  animation: intro-progress 6.5s linear 0.3s both;
}[dir="rtl"] .intro-progress-bar { transform-origin: right center; }

@keyframes intro-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ---------- Wider screens ---------- */

@media (min-width: 48rem) {
  .intro-emblem-wrap { width: 12rem; }
  .intro-title { font-size: 3rem; }
  .intro-eyebrow { font-size: 0.75rem; }
  .intro-tagline { font-size: 1.08rem; }
  .intro-actions { flex-direction: row; max-width: none; justify-content: center; }
  .intro-actions .btn { width: auto; min-width: 11rem; }
}

/* ---------- Short viewports (360x640 and shorter phones) ----------
 * P3 layout math 2026-11-13: the full stack is ~664px at 360px
 * wide, ~24px over a 640px viewport and ~96px over a 568px one.
 * This compact mode shrinks the emblem and tightens the vertical
 * rhythm so the whole intro fits a 640px viewport (~578px) with
 * no scrolling at all; on a 568px viewport the remaining ~10px
 * scrolls via `overflow-y: auto` on the container (see above).
 * 390x844 and 430x932 are unaffected (they already fit). */
@media (max-height: 44rem) {
  .cinematic-intro { padding: 0.9rem 1rem 1.1rem; }
  .intro-emblem-wrap { width: min(7rem, 30vw); }
  .intro-eyebrow { margin: 0.8rem 0 0.35rem; }
  .intro-rule { margin: 0.7rem auto 0; }
  .intro-tagline { margin: 0.7rem 0 0; }
  .ax-disclaimer--intro { margin-top: 0.8rem; }
  .intro-readiness { margin: 0.7rem 0 0; }
  .intro-actions { margin-top: 1rem; }
}

/* ---------- Reduced motion: static frame, no drift, no sweep,
 * no progress animation. intro.js also finishes instantly. ---------- */

@media (prefers-reduced-motion: reduce) {
  .cinematic-intro *,
  .cinematic-intro *::before,
  .cinematic-intro *::after {
    animation: none !important;
    transition: none !important;
  }
  .intro-fog,
  .intro-beam,
  .intro-grid,
  .intro-progress { display: none; }
  .intro-emblem-wrap::after { display: none; }
}
