/* =========================================================
   EL-SEKANI FOUNDATION — DESIGN SYSTEM v2
   Unified animations, utilities, and global components
   ========================================================= */

/* ---------- ROOT TOKENS ---------- */
:root {
  --esf-primary: #013f64;
  --esf-primary-hover: #045485;
  --esf-primary-light: #e6f0f5;
  --esf-accent: #dfa929;
  --esf-accent-warm: #f5a623;
  --esf-bg-light: #F8FAFC;
  --esf-bg-dark: #0B1120;
  --esf-card-light: #ffffff;
  --esf-card-dark: #172134;
  --esf-text-light: #1E293B;
  --esf-text-dark: #E2E8F0;
  --esf-border-light: #E2E8F0;
  --esf-border-dark: #334155;
  --esf-glass: rgba(255,255,255,0.06);
  --esf-radius: 0.75rem;
  --esf-radius-xl: 1.25rem;
  --esf-shadow-soft: 0 4px 24px rgba(1,63,100,0.08);
  --esf-shadow-glow: 0 0 40px rgba(247,181,56,0.12);
  --esf-transition: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- BASE RESETS ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  text-decoration: none;
}

/* ---------- PAGE TRANSITION LOADER ---------- */
#page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--esf-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#page-loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#page-loader .loader-pulse {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: var(--esf-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- SCROLL-REVEAL ---------- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s var(--esf-transition), transform 0.8s var(--esf-transition);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s var(--esf-transition), transform 0.8s var(--esf-transition);
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}
.reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s var(--esf-transition), transform 0.8s var(--esf-transition);
}
.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}
.reveal-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.8s var(--esf-transition), transform 0.8s var(--esf-transition);
}
.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* Staggered reveal for children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--esf-transition), transform 0.6s var(--esf-transition);
}
.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.12s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.19s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.26s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.33s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.40s; }
.reveal-stagger.visible > *:nth-child(7) { transition-delay: 0.47s; }
.reveal-stagger.visible > *:nth-child(8) { transition-delay: 0.54s; }
.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- FLOATING PARTICLES ---------- */
.particles-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0);
  }
  10% {
    opacity: 0.6;
    transform: scale(1);
  }
  90% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
    transform: translateY(-100vh) scale(0.5);
  }
}

/* ---------- GRADIENT MESH BACKGROUNDS ---------- */
.gradient-mesh {
  position: relative;
}
.gradient-mesh::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(1,63,100,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(247,181,56,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(1,63,100,0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- GLASSMORPHISM ---------- */
.glass {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.25);
}
.dark .glass,
.glass-dark {
  background: rgba(23,33,52,0.7);
  border-color: rgba(255,255,255,0.08);
}

/* ---------- ANIMATED COUNTER ---------- */
.counter-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ---------- IMPACT TICKER ---------- */
.ticker-track {
  display: flex;
  animation: tickerScroll 30s linear infinite;
  width: max-content;
}
.ticker-track:hover {
  animation-play-state: paused;
}
@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---------- CARD INTERACTIONS ---------- */
.card-hover {
  transition: transform 0.35s var(--esf-transition), box-shadow 0.35s var(--esf-transition);
}
.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: var(--esf-shadow-soft);
}
.card-shine {
  position: relative;
  overflow: hidden;
}
.card-shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255,255,255,0.05) 50%,
    transparent 60%
  );
  transform: translateX(-100%) rotate(0deg);
  transition: transform 0.6s ease;
  pointer-events: none;
}
.card-shine:hover::after {
  transform: translateX(100%) rotate(0deg);
}

/* ---------- TEXT GRADIENT ---------- */
.text-gradient {
  background: linear-gradient(135deg, var(--esf-accent), #ffd470);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-gradient-primary {
  background: linear-gradient(135deg, var(--esf-primary), var(--esf-primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- WAVE DIVIDER ---------- */
.wave-divider {
  position: relative;
  overflow: hidden;
}
.wave-divider svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- SCROLL-TO-TOP BUTTON ---------- */
#scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--esf-primary);
  color: white;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 4px 20px rgba(1,63,100,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s var(--esf-transition), background 0.3s ease;
}
#scroll-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#scroll-to-top:hover {
  background: var(--esf-primary-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 28px rgba(1,63,100,0.4);
}

/* ---------- COOKIE CONSENT ---------- */
#cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 1rem 1.5rem;
  background: var(--esf-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  transform: translateY(100%);
  transition: transform 0.5s var(--esf-transition);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
}
#cookie-consent.show {
  transform: translateY(0);
}
#cookie-consent button {
  background: var(--esf-accent);
  color: #1a1a1a;
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#cookie-consent button:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

/* ---------- PROGRESS BAR ---------- */
.progress-bar {
  height: 8px;
  border-radius: 9999px;
  background: rgba(1,63,100,0.1);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--esf-primary), var(--esf-accent));
  transition: width 1.5s var(--esf-transition);
}

/* ---------- STATUS BADGE ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-active {
  background: rgba(16,185,129,0.1);
  color: #059669;
  border: 1px solid rgba(16,185,129,0.2);
}
.badge-active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse-dot 2s ease-in-out infinite;
}
.badge-upcoming {
  background: rgba(247,181,56,0.1);
  color: #d97706;
  border: 1px solid rgba(247,181,56,0.2);
}
.badge-completed {
  background: rgba(1,63,100,0.1);
  color: var(--esf-primary);
  border: 1px solid rgba(1,63,100,0.15);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---------- HOVER GLOW ---------- */
.hover-glow {
  position: relative;
}
.hover-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--esf-accent), var(--esf-primary));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  filter: blur(12px);
}
.hover-glow:hover::before {
  opacity: 0.4;
}

/* ---------- TOOLTIP ---------- */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--esf-primary);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 50;
}
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ---------- ACCESSIBILITY ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .particle,
  .ticker-track,
  .card-shine::after,
  #page-loader .loader-pulse {
    animation: none;
  }
}

/* ---------- FOCUS STYLES (A11Y) ---------- */
:focus-visible {
  outline: 3px solid var(--esf-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- SELECTION ---------- */
::selection {
  background: rgba(1,63,100,0.15);
  color: var(--esf-primary);
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(1,63,100,0.2);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(1,63,100,0.35);
}

/* ---------- TIMELINE (ABOUT PAGE) ---------- */
.timeline-item {
  position: relative;
  padding-left: 2rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -17px;
  top: 10px;
  width: 14px;
  height: 14px;
  border-radius: 9999px;
  background-color: white;
  border: 3px solid var(--esf-primary);
}
.timeline-item p {
  margin: 0.25rem 0;
}

/* ---------- TEAM MODALS ---------- */
.team-modal {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
}
.team-modal.active,
.team-modal:target {
  display: flex;
}
.team-modal .modal-content {
  background-color: white;
  border-radius: 1rem;
  max-width: 32rem;
  width: 100%;
  padding: 2rem;
  position: relative;
  text-align: center;
}
.team-modal .modal-content img {
  height: 10rem;
  width: 10rem;
  border-radius: 50%;
  margin-top: -5rem;
  border: 4px solid white;
  box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}
.team-modal button.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #6b7280;
}
.team-modal button.close-modal:hover {
  color: var(--esf-primary);
}

/* ---------- BUTTONS ---------- */
.btn-primary {
  background-color: var(--esf-primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
  border: none;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--esf-primary-hover);
  transform: translateY(-1px);
}
.btn-secondary {
  background-color: white;
  color: var(--esf-primary);
  border: 1px solid var(--esf-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn-secondary:hover {
  background-color: #f9fafb;
}

/* ---------- FOOTER ---------- */
footer ul {
  list-style: none;
  padding: 0;
}
footer a {
  color: rgba(255,255,255,0.8);
  transition: color 0.2s ease;
}
footer a:hover {
  color: white;
}

/* ---------- DARK MODE OVERRIDES ---------- */
body.dark,
html.dark body {
  background-color: var(--esf-bg-dark);
  color: var(--esf-text-dark);
}
body.dark a,
html.dark body a {
  color: var(--esf-text-dark);
}
body.dark .team-modal .modal-content,
html.dark .team-modal .modal-content {
  background-color: var(--esf-card-dark);
}
body.dark footer a,
html.dark footer a {
  color: rgba(255,255,255,0.8);
}

/* ---------- RESPONSIVE UTILITIES ---------- */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}
@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}
