/* =====================================================================
   Motion layer — scroll reveals, hero smoke, scroll progress, gauges,
   countdown and page transitions. Everything is decorative: content is
   visible without JS, and prefers-reduced-motion switches it all off.
   ===================================================================== */

/* ---------- Page transitions (cross-document View Transitions) ---------- */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root) { animation: vt-out .22s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .32s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateX(-2%) skewX(-2deg); } }
@keyframes vt-in { from { opacity: 0; transform: translateX(2%) skewX(2deg); } }

/* ---------- Scroll progress (a red skid mark across the top) ---------- */
.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: linear-gradient(90deg, var(--red), var(--red-hot));
  transform-origin: 0 50%; transform: scaleX(var(--progress, 0));
  pointer-events: none;
}
[dir="rtl"] .scroll-progress { transform-origin: 100% 50%; }
@supports (animation-timeline: scroll()) {
  .scroll-progress { animation: progress linear both; animation-timeline: scroll(root); }
  @keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ---------- Scroll reveals ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .6s var(--ease), transform .75s var(--ease);
  transition-delay: var(--d, 0s);
  will-change: opacity, transform;
}
.js [data-reveal="slide"] { transform: translateX(-48px) skewX(-10deg); }
[dir="rtl"].js [data-reveal="slide"], .js[dir="rtl"] [data-reveal="slide"] { transform: translateX(48px) skewX(10deg); }
.js [data-reveal="skew"] { transform: translateY(32px) skewY(4deg) scale(.96); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Hero: drifting tyre smoke + parallax ---------- */
.hero { isolation: isolate; }
.hero-smoke { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.hero-smoke span {
  position: absolute; bottom: -20%; width: 70vmax; height: 40vmax; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(230,230,235,.16), rgba(230,230,235,0));
  filter: blur(30px);
  animation: smoke 22s linear infinite;
}
.hero-smoke span:nth-child(1) { left: -20%; animation-duration: 26s; }
.hero-smoke span:nth-child(2) { left: 15%; bottom: -30%; animation-duration: 32s; animation-delay: -10s; opacity: .8; }
.hero-smoke span:nth-child(3) { left: 45%; bottom: -25%; animation-duration: 38s; animation-delay: -20s; opacity: .6; }
@keyframes smoke {
  0%   { transform: translate3d(-10%, 10%, 0) scale(.8); opacity: 0; }
  15%  { opacity: 1; }
  70%  { opacity: .7; }
  100% { transform: translate3d(35%, -45%, 0) scale(1.5); opacity: 0; }
}
@supports (animation-timeline: view()) {
  .hero { animation: hero-parallax linear both; animation-timeline: view(); animation-range: exit; }
  @keyframes hero-parallax { to { background-position-y: 30%; } }
  .hero-inner { animation: hero-lift linear both; animation-timeline: view(); animation-range: exit; }
  @keyframes hero-lift { to { transform: translateY(-60px); opacity: .2; } }
}

/* ---------- Countdown ---------- */
.countdown {
  display: inline-flex; flex-direction: column; gap: 8px; margin-top: 28px;
  padding: 14px 18px 12px; text-decoration: none;
  background: rgba(11,11,12,.72); border: 1px solid var(--border); border-left: 4px solid var(--red);
  backdrop-filter: blur(6px);
  transition: border-color .2s var(--ease);
}
[dir="rtl"] .countdown { border-left-width: 1px; border-right: 4px solid var(--red); }
.countdown:hover { border-color: var(--red); }
.countdown-label {
  font: italic 800 .85rem/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .12em;
  color: var(--red-hot);
}
.countdown-clock { display: flex; gap: 18px; }
.countdown-clock span { display: flex; flex-direction: column; align-items: center; min-width: 46px; }
.countdown-clock b {
  font: italic 900 2.25rem/1 var(--font-display); font-variant-numeric: tabular-nums; color: #fff;
}
.countdown-clock i { font: 600 .72rem/1.4 var(--font-body); font-style: normal; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 559px) {
  .countdown { width: 100%; }
  .countdown-clock { gap: 10px; justify-content: space-between; }
  .countdown-clock b { font-size: 1.9rem; }
}

/* ---------- Stats: tachometer gauges ---------- */
.section-stats {
  background:
    radial-gradient(ellipse at 50% 120%, rgba(197,41,38,.22), transparent 60%),
    var(--bg);
  border-top: 1px solid var(--border);
}
.section-stats .title, .section-stats .eyebrow { text-align: center; justify-content: center; }
.gauges {
  list-style: none; margin: 2.5rem 0 0; padding: 0;
  display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.gauge { text-align: center; }
.gauge-dial { width: min(220px, 100%); margin: 0 auto; overflow: visible; }
.gauge-track, .gauge-fill { fill: none; stroke-width: 9; stroke-linecap: butt; }
.gauge-track { stroke: #26262b; }
.gauge-fill {
  stroke: var(--red);
  stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p));
  transition: stroke-dashoffset 1.4s var(--ease) .2s;
}
.gauge-tick { stroke: #55555c; stroke-width: 2; }
.gauge-needle {
  stroke: #fff; stroke-width: 3; stroke-linecap: round;
  transform-origin: 60px 64px; transform: rotate(calc(var(--p) * 1.8deg - 90deg));
  transition: transform 1.6s cubic-bezier(.34, 1.56, .64, 1) .2s;
  filter: drop-shadow(0 0 4px rgba(232,49,43,.6));
}
.gauge-hub { fill: var(--red); stroke: #fff; stroke-width: 2; }
.js .gauge:not(.is-in) .gauge-fill { stroke-dashoffset: 100; }
.js .gauge:not(.is-in) .gauge-needle { transform: rotate(-90deg); }
.gauge-value {
  margin: .25rem 0 0; max-width: none;
  font: italic 900 clamp(2.5rem, 6vw, 3.5rem)/1 var(--font-display); font-variant-numeric: tabular-nums;
}
.gauge-label {
  margin: .35rem auto 0; max-width: none;
  font: italic 800 .9rem/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}

/* ---------- Language switcher ---------- */
.lang-switch { list-style: none; margin: 0 0 0 8px; padding: 0; display: flex; gap: 2px; }
[dir="rtl"] .lang-switch { margin: 0 8px 0 0; }
.lang-switch a {
  display: inline-grid; place-items: center; min-width: 40px; min-height: 40px; padding: 0 8px;
  font: 700 .85rem/1 var(--font-body); font-style: normal; letter-spacing: .04em;
  color: var(--muted); text-decoration: none; border: 1px solid transparent;
}
/* System font for the "ع" button, so English/French pages don't download the Arabic web font */
.lang-switch a[lang="ar"] { font-family: system-ui, "Segoe UI", Tahoma, sans-serif; font-size: 1rem; }
[dir="rtl"] .lang-switch a[lang="ar"] { font-family: var(--font-body); }
.lang-switch a:hover { color: var(--fg); }
.lang-switch a[aria-current="true"] { color: #fff; border-color: var(--red); }
@media (max-width: 1023px) {
  .lang-switch { margin: 16px 0 0; justify-content: center; gap: 8px; }
  .lang-switch a { min-width: 56px; min-height: 44px; border-color: var(--border); }
}

/* ---------- Small hover flourishes ---------- */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .6s var(--ease);
}
.btn:hover::after { transform: translateX(120%); }

/* ---------- Reduced motion: everything still, nothing hidden ---------- */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hero-smoke { display: none; }
  .hero, .hero-inner { animation: none; }
  .gauge-fill, .gauge-needle { transition: none; }
  .btn::after { display: none; }
}

/* Open mobile menu: leave room under the hanging logo badge */
@media (max-width: 1023px) { .site-nav { padding-top: 36px; } }
/* Anchor the hamburger/close bars to the same edge in LTR and RTL */
.nav-toggle-label span::before, .nav-toggle-label span::after { left: 0; }

/* ---------- Lighter background images on phones (≈900 px instead of 1,600–1,920) ---------- */
@media (max-width: 767px) {
  .hero {
    background-image:
      linear-gradient(90deg, rgba(11,11,12,.94) 0%, rgba(11,11,12,.7) 42%, rgba(11,11,12,.1) 100%),
      linear-gradient(0deg, rgba(11,11,12,.85) 0%, rgba(11,11,12,0) 40%),
      var(--hero-img-sm, var(--hero-img, var(--ph)));
  }
  [dir="rtl"] .hero {
    background-image:
      linear-gradient(270deg, rgba(11,11,12,.94) 0%, rgba(11,11,12,.7) 42%, rgba(11,11,12,.1) 100%),
      linear-gradient(0deg, rgba(11,11,12,.85) 0%, rgba(11,11,12,0) 40%),
      var(--hero-img-sm, var(--hero-img, var(--ph)));
  }
  .section-events {
    background-image:
      radial-gradient(ellipse at center, rgba(11,11,12,.55) 0%, rgba(11,11,12,.9) 70%),
      var(--events-img-sm, var(--events-img, var(--ph)));
  }
  .footer-stripe { background-image: var(--banner-img-sm, var(--banner-img, var(--ph))); }
}
