/* ==========================================================================
   OTHMAN RIYADH® — MASTER MOTION DESIGN SYSTEM (PHASE 01)
   Art Direction: Othman Riyadh — The Creative Universe
   Motion Philosophy: Silky, cinematic, intentional & hardware-accelerated.
   Inspired by Ivan Amad & bespoke editorial luxury portfolio standards.
   ========================================================================== */

/* --------------------------------------------------------------------------
   01. MOTION DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Motion Curves (Easings) */
  --ease-swift: cubic-bezier(0.16, 1, 0.3, 1);       /* Expo Out: Snappy acceleration, silk deceleration */
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);      /* Quart Out: Natural organic deceleration for hovers */
  --ease-theatrical: cubic-bezier(0.76, 0, 0.24, 1);/* Cinematic ease for mask clips & curtain reveals */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* Delicate spring for micro badges & toggles */

  /* Motion Timing Scale */
  --dur-micro: 180ms;    /* 150–250ms: Interactive micro-interactions & feedback */
  --dur-card: 300ms;     /* 220–350ms: Card hovers, elevations, thumbnail zoom */
  --dur-section: 600ms;  /* 450–700ms: Section & container scroll reveals */
  --dur-hero: 850ms;     /* 600–900ms: Choreographed theatrical hero entrance */

  /* Stagger Intervals */
  --stagger-fast: 60ms;
  --stagger-normal: 100ms;
  --stagger-slow: 150ms;
}

/* --------------------------------------------------------------------------
   02. HOMEPAGE HERO CHOREOGRAPHY & TEXT MASKS
   -------------------------------------------------------------------------- */

/* Hero Container Baseline */
.hero-environmental-scene {
  position: relative;
  overflow: hidden;
}

/* Background Atmosphere Entrance Settle */
.hero-environment-media {
  will-change: transform, opacity;
  transition: transform 1.2s var(--ease-soft), opacity 1.2s var(--ease-soft);
}

.hero-environmental-scene:not(.hero-scene-loaded) .hero-environment-media {
  opacity: 0.55;
  transform: scale(1.035);
}

.hero-environmental-scene.hero-scene-loaded .hero-environment-media {
  opacity: 1;
  transform: scale(1);
}

/* Header Entrance Glide */
.site-header {
  will-change: transform, opacity;
  transition: transform 0.65s var(--ease-swift),
              opacity 0.65s var(--ease-swift),
              padding 0.3s var(--ease-swift),
              background-color 0.3s var(--ease-swift),
              border-color 0.3s var(--ease-swift),
              box-shadow 0.3s var(--ease-swift);
}

body:not(.site-ready) .site-header {
  opacity: 0;
  transform: translateY(-14px);
}

body.site-ready .site-header {
  opacity: 1;
  transform: translateY(0);
}

/* Typography Text Masks */
.motion-mask-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  line-height: inherit;
}

.motion-mask-inner {
  display: inline-block;
  will-change: transform, opacity;
  transform: translateY(118%);
  opacity: 0;
  transition: transform var(--dur-hero) var(--ease-swift),
              opacity calc(var(--dur-hero) * 0.8) var(--ease-swift);
}

.hero-scene-loaded .motion-mask-inner {
  transform: translateY(0);
  opacity: 1;
}

/* Stagger headline lines */
.hero-scene-loaded .motion-mask-line:nth-child(1) .motion-mask-inner {
  transition-delay: 180ms;
}

.hero-scene-loaded .motion-mask-line:nth-child(2) .motion-mask-inner {
  transition-delay: 290ms;
}

.hero-scene-loaded .motion-mask-line:nth-child(3) .motion-mask-inner {
  transition-delay: 400ms;
}

/* Hero Eyebrow Badge Entrance */
.hero-eyebrow-badge {
  will-change: transform, opacity;
  transition: transform 0.55s var(--ease-swift), opacity 0.55s var(--ease-swift);
}

.hero-environmental-scene:not(.hero-scene-loaded) .hero-eyebrow-badge {
  opacity: 0;
  transform: translateY(14px);
}

.hero-environmental-scene.hero-scene-loaded .hero-eyebrow-badge {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 80ms;
}

/* Hero Role Descriptor (Scene 03) Entrance */
.hero-role-descriptor {
  will-change: transform, opacity;
  transition: transform 0.65s var(--ease-swift), opacity 0.65s var(--ease-swift);
}

.hero-environmental-scene:not(.hero-scene-loaded) .hero-role-descriptor {
  opacity: 0;
  transform: translateY(14px);
}

.hero-environmental-scene.hero-scene-loaded .hero-role-descriptor {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 340ms;
}

/* Hero Supporting Statement Entrance */
.hero-supporting-statement {
  will-change: transform, opacity;
  transition: transform 0.65s var(--ease-swift), opacity 0.65s var(--ease-swift);
}

.hero-environmental-scene:not(.hero-scene-loaded) .hero-supporting-statement {
  opacity: 0;
  transform: translateY(16px);
}

.hero-environmental-scene.hero-scene-loaded .hero-supporting-statement {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 460ms;
}

/* Hero CTA Action Buttons Entrance */
.hero-cta-actions .hero-btn-primary,
.hero-cta-actions .hero-btn-secondary {
  will-change: transform, opacity;
  transition: transform 0.55s var(--ease-swift),
              opacity 0.55s var(--ease-swift),
              background 0.24s var(--ease-soft),
              border-color 0.24s var(--ease-soft),
              box-shadow 0.24s var(--ease-soft),
              color 0.24s var(--ease-soft);
}

.hero-environmental-scene:not(.hero-scene-loaded) .hero-cta-actions .hero-btn-primary {
  opacity: 0;
  transform: translateY(14px) scale(0.97);
}

.hero-environmental-scene.hero-scene-loaded .hero-cta-actions .hero-btn-primary {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition-delay: 560ms;
}

.hero-environmental-scene:not(.hero-scene-loaded) .hero-cta-actions .hero-btn-secondary {
  opacity: 0;
  transform: translateY(14px) scale(0.97);
}

.hero-environmental-scene.hero-scene-loaded .hero-cta-actions .hero-btn-secondary {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition-delay: 640ms;
}

/* Hero Bottom Disciplines Strip Entrance */
.hero-bottom-stage {
  will-change: transform, opacity;
  transition: transform 0.7s var(--ease-swift), opacity 0.7s var(--ease-swift);
}

.hero-environmental-scene:not(.hero-scene-loaded) .hero-bottom-stage {
  opacity: 0;
  transform: translateY(18px);
}

.hero-environmental-scene.hero-scene-loaded .hero-bottom-stage {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 720ms;
}

/* Scroll Cue Pulse */
.hero-scroll-cue {
  will-change: transform, opacity;
  transition: opacity 0.6s var(--ease-swift);
}

.hero-environmental-scene:not(.hero-scene-loaded) .hero-scroll-cue {
  opacity: 0;
}

.hero-environmental-scene.hero-scene-loaded .hero-scroll-cue {
  opacity: 0.85;
  transition-delay: 820ms;
}

@keyframes gentleCueBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

.hero-environmental-scene.hero-scene-loaded .scroll-cue-indicator {
  display: inline-block;
  animation: gentleCueBob 2.2s infinite ease-in-out;
  animation-delay: 1.2s;
}

/* --------------------------------------------------------------------------
   03. UNIFIED SCROLL REVEAL ENGINE
   -------------------------------------------------------------------------- */

/* Standard Reveal Primitive */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  will-change: transform, opacity;
  transition: opacity var(--dur-section) var(--ease-swift),
              transform var(--dur-section) var(--ease-swift);
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Subtle Scale Reveal */
.reveal-scale {
  opacity: 0;
  transform: scale(0.96) translateY(18px);
  will-change: transform, opacity;
  transition: opacity var(--dur-section) var(--ease-swift),
              transform var(--dur-section) var(--ease-swift);
}

.reveal-scale.is-revealed {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Staggered Children System */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(22px);
  will-change: transform, opacity;
  transition: opacity var(--dur-section) var(--ease-swift),
              transform var(--dur-section) var(--ease-swift);
}

.reveal-stagger.is-revealed > * {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger.is-revealed > *:nth-child(1) { transition-delay: 40ms; }
.reveal-stagger.is-revealed > *:nth-child(2) { transition-delay: 100ms; }
.reveal-stagger.is-revealed > *:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger.is-revealed > *:nth-child(4) { transition-delay: 220ms; }
.reveal-stagger.is-revealed > *:nth-child(5) { transition-delay: 280ms; }
.reveal-stagger.is-revealed > *:nth-child(6) { transition-delay: 340ms; }
.reveal-stagger.is-revealed > *:nth-child(7) { transition-delay: 400ms; }
.reveal-stagger.is-revealed > *:nth-child(8) { transition-delay: 460ms; }

/* --------------------------------------------------------------------------
   04. FEATURED WORK INTERACTIONS (DISCIPLINE CARDS)
   -------------------------------------------------------------------------- */

.v2-discipline-card {
  position: relative;
  will-change: transform, border-color, box-shadow;
  transition: transform var(--dur-card) var(--ease-soft),
              border-color var(--dur-card) var(--ease-soft),
              box-shadow var(--dur-card) var(--ease-soft);
  outline: none;
}

/* Refined Subtle Hover Scale (Strict 1.02–1.04 Range) */
.v2-discipline-card .v2-disc-img {
  will-change: transform;
  transition: transform 0.5s var(--ease-soft) !important;
}

@media (hover: hover) and (pointer: fine) {
  .v2-discipline-card:hover {
    transform: translateY(-4px) !important;
    border-color: rgba(245, 197, 66, 0.45) !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55),
                0 0 24px rgba(245, 197, 66, 0.08) !important;
  }

  .v2-discipline-card:hover .v2-disc-img {
    transform: scale(1.03) !important;
  }

  /* Directional Arrow Shift */
  .v2-discipline-card .v2-disc-arrow {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    will-change: transform, color, background-color, border-color;
    transition: all var(--dur-micro) var(--ease-soft);
  }

  .v2-discipline-card .v2-disc-arrow svg {
    display: block;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform var(--dur-micro) var(--ease-soft);
  }

  html[dir="rtl"] .v2-discipline-card .v2-disc-arrow svg {
    transform: scaleX(-1);
  }

  html[dir="ltr"] .v2-discipline-card:hover .v2-disc-arrow svg {
    transform: translate(2px, -2px);
  }

  html[dir="rtl"] .v2-discipline-card:hover .v2-disc-arrow svg {
    transform: scaleX(-1) translate(2px, -2px);
  }

  .v2-discipline-card:hover .v2-disc-title {
    color: #ffffff;
    text-shadow: 0 0 16px rgba(245, 197, 66, 0.2);
  }
}

/* Touch Device Interaction (Zero Sticky Hover) */
@media (hover: none) {
  .v2-discipline-card:active {
    transform: scale(0.99);
    transition-duration: 80ms;
  }
}

/* Accessible Keyboard Focus States */
.v2-discipline-card:focus-visible,
.hero-btn-primary:focus-visible,
.hero-btn-secondary:focus-visible,
.header-nav-link:focus-visible,
.header-cta-pill:focus-visible,
.lang-switch-btn:focus-visible {
  outline: 2px solid var(--accent-gold) !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 4px rgba(245, 197, 66, 0.2) !important;
}

/* --------------------------------------------------------------------------
   05. NAVIGATION & BUTTON MICRO-INTERACTIONS
   -------------------------------------------------------------------------- */

/* Header Nav Links */
.header-nav-link {
  position: relative;
  transition: color var(--dur-micro) var(--ease-soft), opacity var(--dur-micro) var(--ease-soft);
}

.header-nav-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  inset-inline: 0;
  margin-inline: auto;
  width: 0;
  height: 2px;
  background: var(--accent-gold);
  border-radius: 2px;
  transform: none;
  transition: width var(--dur-micro) var(--ease-soft);
}

@media (hover: hover) and (pointer: fine) {
  .header-nav-link:hover::after {
    width: 60%;
  }
  .header-nav-link.active::after {
    width: 100%;
  }
}

/* CTA Pill Micro-Interaction */
.header-cta-pill {
  will-change: transform, box-shadow;
  transition: transform var(--dur-micro) var(--ease-soft),
              box-shadow var(--dur-micro) var(--ease-soft),
              background var(--dur-micro) var(--ease-soft);
}

@media (hover: hover) and (pointer: fine) {
  .header-cta-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 197, 66, 0.25);
  }
  html[dir="ltr"] .header-cta-pill:hover .cta-pill-arrow svg {
    transform: translate(2px, -2px);
  }
  html[dir="rtl"] .header-cta-pill:hover .cta-pill-arrow svg {
    transform: scaleX(-1) translate(2px, -2px);
  }
}

.cta-pill-arrow svg {
  transition: transform var(--dur-micro) var(--ease-soft);
}

/* Primary Hero Button Micro-Interaction */
@media (hover: hover) and (pointer: fine) {
  .hero-btn-primary:hover {
    transform: translateY(-2px) scale(1.015);
    box-shadow: 0 8px 30px rgba(255, 158, 44, 0.45);
  }
  .hero-btn-secondary:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
  }
  html[dir="rtl"] .hero-btn-primary:hover .hero-btn-arrow {
    transform: translateX(-4px);
  }
  html[dir="ltr"] .hero-btn-primary:hover .hero-btn-arrow {
    transform: translateX(4px);
  }
  .hero-btn-secondary:hover .hero-btn-arrow {
    transform: translate(2px, -2px);
  }
}

.hero-btn-arrow {
  display: inline-block;
  transition: transform var(--dur-micro) var(--ease-soft);
}

/* Drawer Menu Smooth Transitions */
.drawer-backdrop {
  opacity: 0;
  visibility: hidden;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: opacity 0.35s var(--ease-swift),
              visibility 0.35s var(--ease-swift),
              backdrop-filter 0.35s var(--ease-swift),
              -webkit-backdrop-filter 0.35s var(--ease-swift);
}

.drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mobile-drawer {
  transform: translateX(100%);
  transition: transform 0.4s var(--ease-swift);
}

html[dir="rtl"] .mobile-drawer {
  transform: translateX(-100%);
}

.drawer-backdrop.active .mobile-drawer {
  transform: translateX(0);
}

/* Drawer Items Stagger Entrance */
.drawer-backdrop.active .drawer-nav-item {
  animation: drawerItemSlide 0.4s var(--ease-swift) forwards;
}

@keyframes drawerItemSlide {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.drawer-backdrop.active .drawer-nav-item:nth-child(1) { animation-delay: 80ms; }
.drawer-backdrop.active .drawer-nav-item:nth-child(2) { animation-delay: 130ms; }
.drawer-backdrop.active .drawer-nav-item:nth-child(3) { animation-delay: 180ms; }
.drawer-backdrop.active .drawer-nav-item:nth-child(4) { animation-delay: 230ms; }
.drawer-backdrop.active .drawer-nav-item:nth-child(5) { animation-delay: 280ms; }
.drawer-backdrop.active .drawer-nav-item:nth-child(6) { animation-delay: 330ms; }
.drawer-backdrop.active .drawer-nav-item:nth-child(7) { animation-delay: 380ms; }

/* --------------------------------------------------------------------------
   06. PROGRESSIVE ENHANCEMENT & ZERO-JS / REDUCED MOTION SAFETY
   -------------------------------------------------------------------------- */

/* CSS Fallback: If JS fails or takes > 2.5s, auto-reveal all content cleanly */
@keyframes autoRevealFallback {
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-environmental-scene:not(.hero-scene-loaded) .motion-mask-inner,
.hero-environmental-scene:not(.hero-scene-loaded) .hero-eyebrow-badge,
.hero-environmental-scene:not(.hero-scene-loaded) .hero-role-descriptor,
.hero-environmental-scene:not(.hero-scene-loaded) .hero-supporting-statement,
.hero-environmental-scene:not(.hero-scene-loaded) .hero-cta-actions .hero-btn-primary,
.hero-environmental-scene:not(.hero-scene-loaded) .hero-cta-actions .hero-btn-secondary,
.hero-environmental-scene:not(.hero-scene-loaded) .hero-bottom-stage,
.hero-environmental-scene:not(.hero-scene-loaded) .hero-scroll-cue,
body:not(.site-ready) .site-header {
  animation: autoRevealFallback 0.01s forwards 2.4s;
}

.reveal-on-scroll:not(.is-revealed),
.reveal-stagger:not(.is-revealed) > * {
  animation: autoRevealFallback 0.01s forwards 3.2s;
}

/* Reduced Motion Override (Strict Accessibility Compliance) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .motion-mask-inner,
  .hero-environmental-scene .hero-environment-media,
  .hero-eyebrow-badge,
  .hero-role-descriptor,
  .hero-supporting-statement,
  .hero-cta-actions .hero-btn-primary,
  .hero-cta-actions .hero-btn-secondary,
  .hero-bottom-stage,
  .hero-scroll-cue,
  .site-header,
  .reveal-on-scroll,
  .reveal-scale,
  .reveal-stagger > *,
  .v2-discipline-card,
  .v2-disc-img,
  .mobile-drawer {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }

  .hero-scene-loaded .scroll-cue-indicator {
    animation: none !important;
  }
}
