/* ==========================================================================
   Chapter 33 — Enterprise UI/UX Visual Enhancement & Hero Animation System
   --------------------------------------------------------------------------
   Upgrade-only, additive stylesheet. Nothing here removes or overrides the
   base hero/gradient/glass rules already shipped in landing.css / style.css
   — every rule below either (a) layers a new effect on top via its own
   class, or (b) is only reached when an admin-controlled data-attribute is
   present on <html>/<body> (set at runtime by assets/js/hero-effects.js
   from /api/ui-visual/settings). If that script never runs, the page looks
   and behaves exactly as it did before this chapter.

   All animations are transform/opacity/background-position driven (GPU
   accelerated), respect prefers-reduced-motion, and are stripped down or
   disabled entirely on narrow/mobile viewports where noted.
   ========================================================================== */

:root{
  --hero-anim-speed: 3.5s;
  --hero-grad-1: #FFD700;
  --hero-grad-2: #FFF7AE;
  --hero-grad-3: #FFFFFF;
  --hero-grad-4: #FFD700;
  --hero-glow-color: rgba(255, 215, 0, .45);
}

/* --------------------------------------------------------------------
   1) HERO HEADLINE — full-headline moving gradient, shine sweep, glow.
   Applied when hero-effects.js adds data-hero-anim="on" to <html> and
   .hero-headline-premium to the H1's inner <span>. Falls back cleanly to
   the existing .text-gradient rule in landing.css when animation is off
   or JS hasn't run yet.
   -------------------------------------------------------------------- */

html[data-hero-anim="on"] .hero-headline-premium{
  position: relative;
  display: inline-block;
  background-image: linear-gradient(100deg,
    var(--hero-grad-1) 0%, var(--hero-grad-2) 25%, var(--hero-grad-3) 50%,
    var(--hero-grad-1) 75%, var(--hero-grad-2) 100%) !important;
  background-size: 300% 100% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  animation: heroHeadlineGradientFlow var(--hero-anim-speed) linear infinite;
  will-change: background-position, filter;
}

html[data-hero-anim="on"][data-hero-glow="on"] .hero-headline-premium{
  filter: drop-shadow(0 0 18px var(--hero-glow-color));
  animation:
    heroHeadlineGradientFlow var(--hero-anim-speed) linear infinite,
    heroHeadlineGlowPulse calc(var(--hero-anim-speed) * 1.4) ease-in-out infinite;
}

@keyframes heroHeadlineGradientFlow{
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}
@keyframes heroHeadlineGlowPulse{
  0%, 100% { filter: drop-shadow(0 0 10px var(--hero-glow-color)); }
  50%      { filter: drop-shadow(0 0 26px var(--hero-glow-color)); }
}

/* Shine / light sweep overlay — a diagonal highlight band that sweeps
   across the whole headline on top of the gradient. Implemented as a
   ::after pseudo-element clipped to the same text, so it works even
   though the parent is background-clip:text. */
html[data-hero-anim="on"][data-hero-shine="on"] .hero-headline-premium{
  isolation: isolate;
}
html[data-hero-anim="on"][data-hero-shine="on"] .hero-headline-premium::after{
  content: attr(data-shine-text);
  position: absolute;
  inset: 0;
  background-image: linear-gradient(115deg,
    transparent 35%, rgba(255,255,255,.9) 48%, rgba(255,255,255,.9) 52%, transparent 65%);
  background-size: 220% 100%;
  background-position: -120% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  pointer-events: none;
  animation: heroShineSweep calc(var(--hero-anim-speed) * 1.6) ease-in-out infinite;
  animation-delay: 1.2s;
}
@keyframes heroShineSweep{
  0%   { background-position: -120% 0; }
  35%  { background-position: 160% 0; }
  100% { background-position: 160% 0; }
}

@media (max-width: 768px){
  /* Mobile Rules: zero layout shift, battery-friendly — drop the glow
     filter (expensive on low-power GPUs) but keep the lightweight
     background-position gradient sweep. */
  html[data-hero-anim="on"] .hero-headline-premium{
    animation: heroHeadlineGradientFlow calc(var(--hero-anim-speed) * 1.15) linear infinite;
    filter: none !important;
  }
  html[data-hero-anim="on"][data-hero-shine="on"] .hero-headline-premium::after{
    animation-duration: calc(var(--hero-anim-speed) * 2.2);
  }
}

/* prefers-reduced-motion: freeze on a single elegant frame instead of animating. */
@media (prefers-reduced-motion: reduce){
  html[data-hero-anim="on"] .hero-headline-premium,
  html[data-hero-anim="on"][data-hero-glow="on"] .hero-headline-premium{
    animation: none !important;
    background-position: 40% 50% !important;
    filter: drop-shadow(0 0 10px var(--hero-glow-color)) !important;
  }
  html[data-hero-anim="on"][data-hero-shine="on"] .hero-headline-premium::after{
    animation: none !important;
    display: none;
  }
}

/* --------------------------------------------------------------------
   2) GLASSMORPHISM utilities — opt-in class, used by hero-effects.js
   and available for any card/panel across the site.
   -------------------------------------------------------------------- */
.az-glass{
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
[data-theme="light"] .az-glass{
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(var(--color-purple-rgb),.14);
  box-shadow: 0 8px 32px rgba(20,10,60,.08);
}
html[data-ui-glass="off"] .az-glass{
  backdrop-filter: none; -webkit-backdrop-filter: none;
}

/* --------------------------------------------------------------------
   3) FLOATING BACKGROUND ELEMENTS — lightweight decorative dots/rings,
   toggled by hero-effects.js appending .az-float-field to a section.
   -------------------------------------------------------------------- */
.az-float-field{ position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.az-float-el{
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.5), rgba(255,255,255,0) 70%);
  opacity: .35;
  animation: azFloatDrift 9s ease-in-out infinite;
  will-change: transform;
}
@keyframes azFloatDrift{
  0%, 100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(14px,-22px) scale(1.12); }
}
@media (max-width: 768px){
  html[data-festival-mobile="light"] .az-float-field .az-float-el:nth-child(n+4){ display:none; }
}

/* --------------------------------------------------------------------
   4) ANIMATED COUNTERS — number pop once counted into view (JS drives
   the counting itself; this just adds the entrance micro-animation).
   -------------------------------------------------------------------- */
.az-counted{ animation: azCounterPop .5s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes azCounterPop{
  0%   { transform: scale(.85); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}

/* --------------------------------------------------------------------
   5) PREMIUM CTA BUTTON EFFECTS — shine sweep + soft lift, layered onto
   the existing .btn-gradient without changing its base styling.
   -------------------------------------------------------------------- */
html[data-ui-cta="on"] .btn-gradient{
  position: relative;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
html[data-ui-cta="on"] .btn-gradient:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(var(--color-purple-rgb),.35);
}
html[data-ui-cta="on"] .btn-gradient::before{
  content:"";
  position: absolute; top:0; left:-60%; width: 40%; height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-20deg);
  transition: left .55s ease;
}
html[data-ui-cta="on"] .btn-gradient:hover::before{ left: 130%; }

/* --------------------------------------------------------------------
   6) PAGE TRANSITIONS — DISABLED (v3.4 flicker fix: whole-body fade
      caused visible flash on navigation; admin-opt-in removed).
   -------------------------------------------------------------------- */
  
/* ==========================================================================
   7) HOVER ANIMATIONS / MICRO INTERACTIONS — small opt-in utilities.
html[data-ui-hover="on"] .card-az.hoverable,
html[data-ui-hover="on"] .platform-strip-item{
  transition: transform .3s cubic-bezier(.23,1.5,.32,1), box-shadow .3s ease;
}
html[data-ui-micro="on"] .icon-btn:active,
html[data-ui-micro="on"] .btn:active{ transform: scale(.96); }
html[data-ui-micro="on"] input.form-control-az:focus,
html[data-ui-micro="on"] select.form-select-az:focus{
  box-shadow: 0 0 0 3px rgba(var(--color-purple-rgb),.18);
  transition: box-shadow .2s ease;
}

/* --------------------------------------------------------------------
   8) SKELETON LOADING — small enhancement on top of the existing
   .skeleton class in style.css (adds a soft sheen sweep).
   -------------------------------------------------------------------- */
html[data-ui-skeleton="on"] .skeleton{
  position: relative; overflow: hidden;
}
html[data-ui-skeleton="on"] .skeleton::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  transform: translateX(-100%);
  animation: azSkeletonSheen 1.6s ease-in-out infinite;
}
@keyframes azSkeletonSheen{ 100%{ transform: translateX(100%); } }

/* ==========================================================================
   9) FESTIVAL MODE — Eid decorative lighting, Ramadan lanterns, Moon &
   stars. Pure CSS/SVG-in-CSS decorations injected by hero-effects.js as
   .az-festival-layer inside the hero section; never intercepts clicks
   and never covers headline/CTA content (kept to the top edge + low
   opacity corners only).
   ========================================================================== */
.az-festival-layer{
  position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none;
}

/* Eid: soft festive string-lights along the top edge */
.az-festival-eid .az-festival-lights{
  position:absolute; top:0; left:0; right:0; height:46px;
  background-image: radial-gradient(circle, #FFD700 0 4px, transparent 5px);
  background-size: 48px 46px;
  background-repeat: repeat-x;
  opacity:.55;
  animation: azLightsTwinkle 2.4s ease-in-out infinite;
}
@keyframes azLightsTwinkle{ 0%,100%{ opacity:.35; } 50%{ opacity:.75; } }

/* Ramadan: hanging lantern silhouettes, corners only */
.az-festival-ramadan .az-lantern{
  position:absolute; top:-14px; width:26px; height:38px;
  border-radius: 40% 40% 55% 55%;
  background: linear-gradient(180deg,#FFD36E,#E8A33D);
  box-shadow: 0 0 14px rgba(255,196,90,.55);
  animation: azLanternSway 3.6s ease-in-out infinite;
  transform-origin: top center;
}
.az-festival-ramadan .az-lantern::before{
  content:""; position:absolute; top:-8px; left:50%; width:2px; height:8px; background:rgba(255,255,255,.4); transform: translateX(-50%);
}
.az-festival-ramadan .az-lantern:nth-child(1){ left:4%; animation-delay:0s; }
.az-festival-ramadan .az-lantern:nth-child(2){ left:14%; top:-6px; animation-delay:.6s; }
.az-festival-ramadan .az-lantern:nth-child(3){ right:4%; animation-delay:.3s; }
.az-festival-ramadan .az-lantern:nth-child(4){ right:14%; top:-6px; animation-delay:.9s; }
@keyframes azLanternSway{
  0%,100%{ transform: rotate(-4deg); }
  50%     { transform: rotate(4deg); }
}

/* Moon & Stars: quiet corner accent */
.az-festival-moon_stars .az-moon{
  position:absolute; top:22px; right:8%; width:34px; height:34px; border-radius:50%;
  background: radial-gradient(circle at 35% 35%, #FFF9E0, #F4E7B0 70%);
  box-shadow: -8px 0 0 -2px rgba(13,6,48,1) inset, 0 0 20px rgba(255,249,224,.5);
  opacity:.85;
}
.az-festival-moon_stars .az-star{
  position:absolute; width:3px; height:3px; background:#fff; border-radius:50%;
  opacity:.8; animation: azStarTwinkle 2.2s ease-in-out infinite;
}
@keyframes azStarTwinkle{ 0%,100%{ opacity:.25; transform:scale(1); } 50%{ opacity:1; transform:scale(1.6); } }

@media (max-width: 768px){
  /* Lightweight effects on mobile — fewer/no animated decorations. */
  html[data-festival-mobile="light"] .az-festival-ramadan .az-lantern:nth-child(n+3){ display:none; }
  html[data-festival-mobile="light"] .az-festival-moon_stars .az-star:nth-child(n+5){ display:none; }
  html[data-festival-mobile="light"] .az-festival-lights{ animation: none; opacity:.4; }
}
@media (prefers-reduced-motion: reduce){
  .az-festival-layer *{ animation: none !important; }
}

/* Global animation kill-switch: if an admin turns Hero Animation fully
   off, or the browser requests reduced motion, every optional effect in
   this file collapses to a static, still-attractive fallback in one go. */
html[data-hero-anim="off"] .hero-headline-premium{ animation:none !important; }
html[data-hero-anim="off"] .hero-headline-premium::after{ display:none !important; }

/* Reference heroes must allow explicitly enabled festival decorations. Keep
   decorations out of pointer hit-testing and confined to the hero edges. */
.hero-reference .az-festival-layer,.digital-store-hero .az-festival-layer{display:block!important;z-index:2;pointer-events:none;user-select:none}
.az-festival-eid .az-festival-lights{filter:drop-shadow(0 2px 5px #f6c85866);opacity:.75}
.az-festival-eid .az-festival-lights:before{content:"";position:absolute;inset:2px 0 auto;height:8px;border-top:1px solid #f6d77388;border-radius:50%}
.az-festival-ramadan .az-lantern{filter:drop-shadow(0 3px 8px #e5b83d66)}
@media(prefers-reduced-motion:reduce){.az-festival-layer,.az-festival-layer *{animation:none!important;transition:none!important}}

.az-festival-ramadan .az-lantern{top:8px;width:24px;border:1px solid #ffdc8a;border-radius:35% 35% 20% 20%;background:linear-gradient(90deg,#b47728,#ffe9a2 45%,#f6b849);box-shadow:inset 0 0 8px #fff3bd,0 0 14px #f5c95766}
.az-festival-ramadan .az-lantern:nth-child(2),.az-festival-ramadan .az-lantern:nth-child(4){top:14px}
.az-festival-ramadan .az-lantern:after{content:"";position:absolute;inset:5px 4px;background:repeating-linear-gradient(90deg,transparent 0 5px,#a16c36bb 5px 6px);border:1px solid #b37b36;border-radius:35%}
@media(max-width:768px){.az-festival-ramadan .az-lantern{top:3px!important;width:17px;height:27px}.az-festival-ramadan .az-lantern:nth-child(1){left:3%}.az-festival-ramadan .az-lantern:nth-child(2){left:auto;right:3%}}
