/* =========================================
   1. DESIGN SYSTEM & TOKENS
   ========================================= */
:root {
  /* Colors */
  --color-primary: #0C5441;
  /* AMID Green */
  --color-primary-hover: #073d2f;
  --color-secondary: #F2C200;
  /* AMID Yellow */
  --color-secondary-hover: #d9ad00;
  --color-accent: #C1272D;
  /* AMID Red */
  --color-cyan: #0A6F6A;
  /* AMID Cyan */

  --color-text-main: #111111;
  --color-text-muted: #555555;
  --color-text-light: #f8f9fa;

  --color-surface-white: #ffffff;
  --color-surface-light: #f3f4f6;
  --color-border: rgba(0, 0, 0, 0.08);

  /* Typography */
  --font-family-base: 'Inter', system-ui, -apple-system, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  /* Spacing */
  --space-1: 0.25rem;
  /* 4px */
  --space-2: 0.5rem;
  /* 8px */
  --space-3: 0.75rem;
  /* 12px */
  --space-4: 1rem;
  /* 16px */
  --space-6: 1.5rem;
  /* 24px */
  --space-8: 2rem;
  /* 32px */
  --space-12: 3rem;
  /* 48px */
  --space-16: 4rem;
  /* 64px */

  /* UI Elements */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

  --transition-base: all 0.2s ease-in-out;
  --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   2. RESET & BASE
   ========================================= */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  color: var(--color-text-main);
  /* AMID Brand Tints: Green, Yellow, Red, Cyan */
  background: linear-gradient(-45deg, #e6f5f0, #fffdf2, #fbf0f1, #e6f6f5);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  
  /* Page Transition Setup */
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

body.loaded {
  opacity: 1;
}

/* Ensure content is visible if JS fails or for accessibilty if needed (fallback) */
@media (prefers-reduced-motion: reduce) {
  body {
    opacity: 1 !important;
    transition: none !important;
  }
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-4);
  color: var(--color-primary);
}

a {
  text-decoration: none;
  color: var(--color-primary);
  transition: var(--transition-base);
}

a:hover {
  color: var(--color-secondary);
}

section {
  padding: var(--space-12) 0;
}

/* =========================================
   3. COMPONENTS
   ========================================= */

/* Buttons */
.btn {
  font-weight: 600;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  transition: var(--transition-base);
  letter-spacing: 0.02em;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary,
.btn-amid-primary,
.btn-success {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn-amid-primary:hover,
.btn-success:hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary,
.btn-warning {
  background-color: var(--color-secondary);
  border-color: var(--color-secondary);
  color: var(--color-text-main);
}

.btn-secondary:hover,
.btn-warning:hover {
  background-color: var(--color-secondary-hover);
  border-color: var(--color-secondary-hover);
  transform: translateY(-2px);
}

.btn-outline-light {
  border: 2px solid white;
  color: white;
  background: transparent;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* Cards */
.card,
.impact-box,
.area-card,
.project-card,
.story-card,
.welcome-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-white);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
  overflow: hidden;
  height: 100%;
}

.card:hover,
.impact-box:hover,
.area-card:hover,
.project-card:hover,
.story-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: transparent;
}

/* Navbar */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) 0;
}

.navbar-brand {
  padding-top: 5px;
  padding-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-symbol {
  height: 60px;
  /* Slightly larger for visibility */
  width: auto;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.1;
}

.brand-title {
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--color-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.brand-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-main);
  letter-spacing: 0.05em;
  line-height: 1.2;
  max-width: 220px;
}

.nav-link {
  font-weight: 500;
  color: var(--color-text-muted) !important;
  padding: var(--space-2) var(--space-3) !important;
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-primary) !important;
  background: rgba(12, 84, 65, 0.05);
}

/* =========================================
   4. SECTIONS & UTILITES
   ========================================= */

/* Hero Base */
.hero-section,
.hero-landing {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  color: white;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

/* === HERO PHOTO SLIDESHOW === */
.hero-slider {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

.hero-slide.active {
  opacity: 1;
  animation: kenBurns 8s ease-in-out forwards;
}

.hero-slide.leaving {
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

@keyframes kenBurns {
  0%   { transform: scale(1.00) translateX(0); }
  100% { transform: scale(1.08) translateX(-1%); }
}

/* Dots indicator */
.hero-dots {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 5;
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  padding: 0;
}

.hero-dot.active {
  background: white;
  width: 24px;
  border-radius: 4px;
}

/* Overlay gradient for legibility */
.hero-section::before,
.hero-landing::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(12, 84, 65, 0.88) 0%, rgba(10, 50, 40, 0.75) 50%, rgba(193, 39, 45, 0.7) 100%);
  z-index: 1;
}

.hero-content,
.container {
  position: relative;
  z-index: 2;
}

.hero-title,
.hero-landing h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
  margin-bottom: var(--space-4);
  font-weight: 800;
}

.hero-subtitle,
.hero-landing p.lead {
  font-size: var(--font-size-lg);
  opacity: 0.9;
  max-width: 650px;
  margin-bottom: var(--space-8);
}

/* Badges */
.badge-top,
.hero-badge,
.involve-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.hero-badge,
.badge-top {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(4px);
}

/* Section Titles */
.section-title {
  color: var(--color-primary);
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-3);
  position: relative;
  display: inline-block;
}

.section-label {
  color: var(--color-cyan);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 700;
  margin-bottom: var(--space-2);
  display: block;
}

/* Progress Bar */
.progress {
  height: 0.6rem;
  background-color: var(--color-surface-light);
  border-radius: var(--radius-full);
}

.progress-bar {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-full);
}

/* Icons */
.area-icon,
.pillar-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--space-4);
  background: var(--color-primary);
  color: white;
  transition: var(--transition-base);
}

.area-card:hover .area-icon {
  transform: scale(1.1) rotate(5deg);
}

/* =========================================
   5. ANIMATIONS (AOS-style reveal)
   ========================================= */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    transition: none;
    opacity: 1;
    transform: none;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================
   6. FOOTER
   ========================================= */
footer {
  background-color: var(--color-text-main);
  color: var(--color-text-light);
  padding: var(--space-12) 0 var(--space-6);
}

footer a {
  color: #aaaaaa;
}

footer a:hover {
  color: var(--color-secondary);
}

/* =========================================
   7. PAGE SPECIFIC OVERRIDES
   ========================================= */
/* GoFund Page Sticky */
.sticky-top {
  z-index: 1020;
}

@media (max-width: 991.98px) {
  .sticky-top-mobile-fix {
    position: static !important;
  }
}

/* --- Pre-launch fixes (22.12.2025) --- */

/* Navbar brand alignment and responsive typography */
.navbar-brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 0;
}

.navbar-brand img{
  width:44px;
  height:44px;
  object-fit:contain;
  image-rendering:auto;
}

.brand-text{
  display:flex;
  flex-direction:column;
  line-height:1.15;
  min-width:0;
}

.brand-name{
  font-weight:700;
  letter-spacing:0.2px;
}

.brand-subtitle{
  display:block;
  font-size:0.75rem;
  opacity:0.85;
  white-space:normal;
}

@media (max-width: 576px){
  .navbar-brand img{ width:38px; height:38px; }
  .brand-subtitle{ font-size:0.72rem; }
}

/* Replace inline styles with classes (CSP-friendly) */
.icon-bg-cyan{ background: var(--amid-cyan); }
.icon-bg-red{ background: var(--amid-red); }
.icon-bg-yellow-dark{ background: var(--amid-yellow); color:#111; }

.bg-amid-cyan{ background:#0A6F6A; }
.bg-amid-red{ background:#C1272D; }
.bg-amid-yellow-dark{ background:#F2C200; color:#111; }

.text-amid-cyan{ color:#0A6F6A; }
.text-amid-green{ color:#0C5441; }
.text-amid-red{ color:#C1272D; }
.text-amid-yellow{ color:#F2C200; }

.w-40p{ width:40% !important; }
.w-25p{ width:25% !important; }
.w-15p{ width:15% !important; }
.w-10p{ width:10% !important; }

.icon-40{ width:40px; height:40px; }

.h-40px{ height:40px; }
.h-8px{ height:8px; }
.h-400px{ height:400px; }

.sticky-top-100{ top:100px; z-index:10; }

/* =========================================
   ENHANCED ANIMATIONS (upgrade patch)
   ========================================= */

/* Direction variants */
.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s cubic-bezier(0.5, 0, 0, 1), transform 0.8s cubic-bezier(0.5, 0, 0, 1);
}
.reveal-left.active { opacity: 1; transform: translateX(0); }

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s cubic-bezier(0.5, 0, 0, 1), transform 0.8s cubic-bezier(0.5, 0, 0, 1);
}
.reveal-right.active { opacity: 1; transform: translateX(0); }

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.7s cubic-bezier(0.5, 0, 0, 1), transform 0.7s cubic-bezier(0.5, 0, 0, 1);
}
.reveal-scale.active { opacity: 1; transform: scale(1); }

/* Stagger delays */
.reveal-delay-1 { transition-delay: 0.1s !important; }
.reveal-delay-2 { transition-delay: 0.2s !important; }
.reveal-delay-3 { transition-delay: 0.3s !important; }
.reveal-delay-4 { transition-delay: 0.4s !important; }
.reveal-delay-5 { transition-delay: 0.5s !important; }

/* Hero content staggered entrance */
.hero-section.active .hero-badge { animation: heroFadeUp 0.6s cubic-bezier(0.5,0,0,1) 0.2s both; }
.hero-section.active .hero-title { animation: heroFadeUp 0.7s cubic-bezier(0.5,0,0,1) 0.35s both; }
.hero-section.active .hero-subtitle { animation: heroFadeUp 0.7s cubic-bezier(0.5,0,0,1) 0.5s both; }
.hero-section.active .hero-cta { animation: heroFadeUp 0.6s cubic-bezier(0.5,0,0,1) 0.65s both; }
.hero-section.active .hero-meta { animation: heroFadeUp 0.6s cubic-bezier(0.5,0,0,1) 0.75s both; }

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

/* Card hover lift */
.card { transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s ease; }
.card:hover { transform: translateY(-6px); box-shadow: 0 16px 40px rgba(12, 84, 65, 0.12) !important; }

/* Project card image overlay */
.project-card-img {
  position: relative; overflow: hidden;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  height: 200px;
}
.project-card-img img { width:100%; height:100%; object-fit:cover; transition: transform 0.5s cubic-bezier(0.4,0,0.2,1); }
.card:hover .project-card-img img { transform: scale(1.08); }
.project-card-badge {
  position: absolute; top: 0.75rem; left: 0.75rem;
  font-size: 0.7rem; font-weight: 700; padding: 0.25rem 0.65rem;
  border-radius: 999px; letter-spacing: 0.05em; text-transform: uppercase;
  backdrop-filter: blur(6px);
}

@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(12, 84, 65, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(12, 84, 65, 0); }
}
.badge-active { animation: pulseGreen 2s infinite; }

/* Floating label animation for stats */
@keyframes countUp { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }
.stat-number { display: inline-block; }
.stat-number.counting { animation: countUp 0.5s ease both; }

/* Team photo hover zoom */
.team-photo-img:hover {
  transform: scale(1.06);
}

/* Smooth overall for position:relative containers */
.overflow-hidden > .team-photo-img {
  transition: transform 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* Hero min-height tweak for mobile */
@media (max-width: 768px) {
  .hero-section { min-height: 60vh; }
  .hero-dots { bottom: 0.75rem; }
}

/* =============================================
   LIGHTBOX
   ============================================= */
#amid-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  backdrop-filter: blur(8px);
}
#amid-lightbox.lb-open {
  opacity: 1;
  pointer-events: all;
}
#amid-lightbox .lb-img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#amid-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  transform: scale(0.94);
  transition: transform 0.35s cubic-bezier(0.5,0,0,1);
}
#amid-lightbox.lb-open img {
  transform: scale(1);
}
#amid-lightbox .lb-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(4px);
}
#amid-lightbox .lb-close:hover { background: rgba(255,255,255,0.25); transform: scale(1.1); }
#amid-lightbox .lb-prev,
#amid-lightbox .lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.25s ease;
  backdrop-filter: blur(4px);
}
#amid-lightbox .lb-prev { left: 1rem; }
#amid-lightbox .lb-next { right: 1rem; }
#amid-lightbox .lb-prev:hover, #amid-lightbox .lb-next:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-50%) scale(1.1);
}
#amid-lightbox .lb-counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.65);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}
/* Make all images clickable */
.lb-trigger {
  cursor: zoom-in;
  transition: filter 0.3s ease, transform 0.35s ease;
}
.lb-trigger:hover {
  filter: brightness(1.08);
}

/* =============================================
   PARALLAX SECTIONS
   ============================================= */
.parallax-section {
  position: relative;
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.parallax-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(12,84,65,0.82) 0%, rgba(10,50,40,0.75) 100%);
  z-index: 0;
}
.parallax-section > .container { position: relative; z-index: 1; }
@media (max-width: 768px) {
  .parallax-section { background-attachment: scroll; }
}

/* =============================================
   MICRO-INTERACTIONS & GLOBAL POLISH
   ============================================= */
/* Button ripple effect */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  transform: scale(0);
  border-radius: inherit;
  transition: transform 0.4s ease;
}
.btn:active::after { transform: scale(2); opacity: 0; }

/* Nav link underline animation */
.nav-link {
  position: relative;
}
.nav-link:not(.btn):not(.dropdown-toggle)::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-secondary);
  transition: width 0.3s ease;
  border-radius: 2px;
}
.nav-link:not(.btn):not(.dropdown-toggle):hover::after,
.nav-link.active:not(.btn)::after { width: 100%; }

/* Section scroll indicator line */
.section-title::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 2px;
  margin-top: 0.5rem;
  transition: width 0.4s ease;
}
.section-title:hover::after { width: 80px; }

/* Smooth scroll offset for anchors */
[id] { scroll-margin-top: 80px; }

/* Form field focus glow */
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.2rem rgba(12,84,65,0.18);
}

/* Toast notification */
#amid-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9998;
  background: var(--color-primary);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(120%);
  transition: transform 0.45s cubic-bezier(0.5,0,0,1);
  max-width: 360px;
}
#amid-toast.show { transform: translateY(0); }
