/* =====================================================================
   Extem — "Why us" cinema.
   Pinned full-screen stage: one sentence per scroll step, previous
   fades out. Driven by js/why.js. Theme + RTL aware.
   ===================================================================== */

.why {
  position: relative;
  /* 7 sentences → roughly half a viewport of scroll each */
  height: 500vh;
}

.why-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: grid;
  place-items: center;
  padding: 0 7%;
  overflow: clip;
}

.why-eyebrow {
  position: absolute;
  top: 11vh;
  display: inline-block;
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: 999px;
  color: #d9f6ff;
  border: 1px solid rgba(126, 240, 255, 0.45);
  background: rgba(3, 26, 51, 0.35);
  box-shadow: 0 0 18px rgba(56, 214, 245, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  text-shadow: 0 0 14px rgba(126, 240, 255, 0.5);
}
[data-theme="dark"] .why-eyebrow {
  border-color: rgba(138, 180, 248, 0.4);
  background: rgba(3, 16, 30, 0.45);
  box-shadow: 0 0 18px rgba(138, 180, 248, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-shadow: 0 0 14px rgba(138, 180, 248, 0.5);
}

/* stacked sentences share one cell — each centers itself, so short
   and tall lines all sit dead-center instead of riding high */
.why-stage {
  display: grid;
  width: 100%;
  max-width: 880px;
}
.why-s {
  grid-area: 1 / 1;
  align-self: center;
  margin: 0;
  font-size: clamp(24px, 3.4vw, 38px);
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  text-wrap: pretty;
  color: #0b2c46;
  text-shadow: 0 2px 16px rgba(255, 255, 255, 0.55);
  opacity: 1;
  transform: none;
}
[data-theme="dark"] .why-s {
  color: #e8e8f2;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.65);
}
[dir="rtl"] .why-s {
  font-family: "Tajawal", "Montserrat", sans-serif;
  letter-spacing: 0;
  line-height: 1.8;
}
/* JS-gated states: hidden until scrolled into its step */
.js .why-s {
  opacity: 0;
  transform: translateY(26px) scale(0.985);
  filter: blur(8px);
  transition: opacity 0.6s ease, transform 0.6s ease, filter 0.6s ease;
  pointer-events: none;
}
.js .why-s.on {
  opacity: 1;
  transform: none;
  filter: blur(0);
  pointer-events: auto;
}

.why-dots {
  position: absolute;
  bottom: 7vh;
  display: flex;
  gap: 9px;
}
.why-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(11, 44, 70, 0.22);
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
[data-theme="dark"] .why-dots i {
  background: rgba(217, 246, 255, 0.25);
}
.why-dots i.on {
  background: #1899c9;
  box-shadow: 0 0 10px rgba(24, 153, 201, 0.8);
  transform: scale(1.25);
}
/* Entrance: eyebrow + dots fade in only once the section is entered,
   so the stage never sits there pre-lit before you arrive. */
.js .why-eyebrow,
.js .why-dots {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.js .why.why-live .why-eyebrow,
.js .why.why-live .why-dots {
  opacity: 1;
  transform: none;
}

/* Flat navbar while the cinema owns the screen.
   Dark needs its own rule: brand.css pins an !important background
   at higher specificity there. */
.navbar.nav-flat {
  background: transparent !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-color: transparent;
  box-shadow: none !important;
}
[data-theme="dark"] .navbar.nav-flat {
  background: transparent !important;
  border-color: transparent;
  box-shadow: none !important;
}
[data-theme="dark"] .why-dots i.on {
  background: #8ab4f8;
  box-shadow: 0 0 10px rgba(138, 180, 248, 0.9);
}

@media (max-width: 480px) {
  .why-s {
    font-size: clamp(21px, 5.6vw, 26px);
  }
}

/* Reduced motion / no smooth pin: plain stacked readable text */
@media (prefers-reduced-motion: reduce) {
  .why {
    height: auto;
    padding: 80px 7%;
  }
  .why-pin {
    position: static;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
  }
  .why-eyebrow,
  .why-dots {
    position: static;
  }
  .why-stage {
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .js .why-s,
  .why-s {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .why-dots {
    display: none;
  }
}
