/* ---------------------------------- */
/*         DESIGN SYSTEM              */
/* ---------------------------------- */
:root {
  /* Primary Palette */
  --alafia-primary-900: #094D0E;
  --alafia-primary-800: #0B5F11;
  --alafia-primary-700: #0D7014;
  --alafia-primary-600: #0F8217;
  --alafia-primary-500: #11941A;
  --alafia-primary-400: #2EA642;
  --alafia-primary-100: #B5DCCC;
  --alafia-primary-50: #E2EEE6;

  /* Secondary Palette */
  --alafia-secondary-900: #EDA700;
  --alafia-secondary-500: #895B00;
  --alafia-secondary-50: #FAF2E6;

  /* Neutral Palette */
  --alafia-neutral-900: #1A1A1A;
  --alafia-neutral-700: #4D4D4D;
  --alafia-neutral-500: #808080;
  --alafia-neutral-100: #E6E6E6;
  --alafia-neutral-50: #F5F5F5;
  --alafia-white: #FFFFFF;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Spacing & Radius */
  --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 */
  --space-24: 6rem;   /* 96px */
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows & Transitions */
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------------------------------- */
/*         GLOBAL STYLES              */
/* ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-family);
  background-color: var(--alafia-white);
  /* Stripe-inspired aurora gradient at the top (brand colors) */
  background-image:
    /* Primary green glow center-top */
    radial-gradient(1400px 320px at 50% -60px, rgba(17, 148, 26, 0.38), rgba(255,255,255,0) 72%),
    /* Amber accent top-left */
    radial-gradient(720px 280px at 12% -80px, rgba(237, 167, 0, 0.28), rgba(255,255,255,0) 78%),
    /* Lighter green wash top-right */
    radial-gradient(960px 300px at 88% -100px, rgba(46, 166, 66, 0.24), rgba(255,255,255,0) 75%),
    /* Soft vertical fade */
    linear-gradient(to bottom, rgba(17, 148, 26, 0.12), rgba(255,255,255,0) 640px);
  background-repeat: no-repeat;
  color: var(--alafia-neutral-700);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent horizontal scroll on mobile and avoid right-blank space */
html, body { overflow-x: hidden; }
body { overscroll-behavior-x: none; }

.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.section {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}
.section-alt { background-color: var(--alafia-neutral-50); }
.section-dark {
  background-color: var(--alafia-neutral-900);
  color: var(--alafia-neutral-100);
}

.section-header {
  max-width: 720px;
  margin: 0 auto var(--space-16);
  text-align: center;
}

.section-title {
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: var(--font-bold);
  color: var(--alafia-neutral-900);
  line-height: 1.2;
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  max-width: 600px;
  margin: 0 auto;
}

.section-dark .section-title, .section-dark .section-subtitle {
  color: var(--alafia-white);
}

/* ---------------------------------- */
/*         BUTTONS                    */
/* ---------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: var(--font-medium);
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--alafia-primary-700);
  color: var(--alafia-white);
}
.btn-primary:hover { background-color: var(--alafia-primary-700); transform: translateY(-2px); }

.btn-secondary {
  background-color: var(--alafia-primary-50);
  color: var(--alafia-primary-800);
  border-color: var(--alafia-primary-100);
}
.btn-secondary:hover { background-color: var(--alafia-primary-100); }

/* ---------------------------------- */
/*         HEADER & NAV               */
/* ---------------------------------- */
.header {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 100;
  padding: var(--space-4) 0;
  background-color: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: none;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo { height: 36px; }
.nav-links { display: flex; gap: var(--space-8); }
.nav-link {
  text-decoration: none;
  color: var(--alafia-neutral-700);
  font-weight: var(--font-medium);
  transition: color 0.2s;
}
.nav-link:hover { color: var(--alafia-primary-600); }

.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  width: 24px; height: 24px;
  position: relative;
}
.nav-toggle .line { display: block; width: 100%; height: 2px; background-color: var(--alafia-neutral-900); transition: var(--transition); position: absolute; left: 0; }
.nav-toggle .line:nth-child(1) { top: 4px; }
.nav-toggle .line:nth-child(2) { top: 11px; }
.nav-toggle .line:nth-child(3) { bottom: 4px; }

/* ---------------------------------- */
/*         HERO SECTION               */
/* ---------------------------------- */
.hero { padding: var(--space-16) 0; }
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--space-12);
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: var(--font-bold);
  color: var(--alafia-primary-900);
  line-height: 1.1;
  margin-bottom: var(--space-6);
}

.hero-sub-wrapper { display: flex; flex-direction: column; gap: var(--space-4); }
.hero-sub {
  /* Use grid to guarantee top alignment between icon and multiline text */
  display: grid;
  grid-template-columns: 1.25em 1fr; /* icon then text */
  align-items: start;
  column-gap: var(--space-3);
  font-size: 1.125rem;
  line-height: 1.5; /* consistent leading for multi-line text */
}
.icon-check {
  color: var(--alafia-primary-500);
  /* Size icon relative to text for consistent rhythm */
  width: 1.1em; height: 1.5em;
  line-height: 1;
  display: block;
  stroke: currentColor; /* ensure stroke color propagates */
  stroke-width: 5;      /* thicker checkmark */
  align-self: start;     /* explicit top alignment */
  margin-top: 0.1em;     /* nudge to align with text top */
}
.hero-sub > span { line-height: 1.5; }
#rotate-word {
  color: var(--alafia-primary-600);
  font-weight: var(--font-semibold);
  display: inline-block;
}

.store-buttons {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-8);
}
.store-btn {
  background-color: var(--alafia-neutral-900);
  color: var(--alafia-white);
  border: none; border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex; align-items: center; gap: var(--space-3);
  font-size: 0.9rem; cursor: pointer; transition: var(--transition);
}
.store-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.store-btn strong { font-size: 1rem; }
.icon-app-store { filter: brightness(0) invert(1); }

.hero-visuals {
  position: relative;
  height: 100%;
  min-height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.hero-pattern {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-image: url('assets/pattern-african.svg');
  background-size: 150%;
  background-position: center;
  opacity: 0.1;
  border-radius: var(--radius-lg);
}
.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 15% center;
}

/* ---------------------------------- */
/*         WHY ALAFIA SECTION         */
/* ---------------------------------- */
.why-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
}
.why-card {
  background-color: var(--alafia-neutral-50);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  text-align: center;
  border: 1px solid var(--alafia-neutral-100);
}
.why-icon-wrapper { 
  margin: 0 auto var(--space-4);
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  background-color: var(--alafia-primary-50);
}
.why-icon {
  width: 2.25rem; /* 36px */
  height: 2.25rem; /* 36px */
  color: var(--alafia-primary-600);
}
.why-title { font-size: 1.25rem; color: var(--alafia-neutral-900); margin-bottom: var(--space-2); }

/* ---------------------------------- */
/*         HOW IT WORKS SECTION       */
/* ---------------------------------- */
.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  position: relative;
}
.how-grid::before { /* Dashed line */
  content: '';
  position: absolute;
  top: 32px;
  left: calc(16.66% + 1rem);
  right: calc(16.66% + 1rem);
  height: 2px;
  background-image: linear-gradient(to right, var(--alafia-primary-100) 50%, transparent 50%);
  background-size: 20px 2px;
  z-index: 0;
}
.how-step {
  text-align: center;
  position: relative;
  z-index: 1;
}
.how-number {
  width: 64px; height: 64px;
  margin: 0 auto var(--space-6);
  border-radius: 50%;
  display: grid; place-items: center;
  background-color: var(--alafia-white);
  border: 2px solid var(--alafia-primary-100);
  color: var(--alafia-primary-600);
  font-size: 1.5rem;
  font-weight: var(--font-bold);
}
.how-title { font-size: 1.25rem; color: var(--alafia-neutral-900); margin-bottom: var(--space-2); }

/* ---------------------------------- */
/*         FEATURES SECTION           */
/* ---------------------------------- */
.features-container {
  max-width: 1024px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
}
.feature-card {
  display: grid;
  grid-template-columns: 40px 1fr; /* Icon | Text */
  gap: var(--space-6);
  align-items: flex-start;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}
.feature-card:hover {
  background-color: var(--alafia-primary-50);
  transform: translateY(-4px);
}
.feature-icon svg {
  width: 2rem; /* 32px */
  height: 2rem; /* 32px */
  color: var(--alafia-primary-600);
}
.feature-title { font-size: 1.25rem; color: var(--alafia-neutral-900); margin-bottom: var(--space-2); }

/* ---------------------------------- */
/*         PARTNER SECTION            */
/* ---------------------------------- */
.partner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--space-16);
}
.partner-text .section-title, .partner-text .section-subtitle {
  text-align: left;
  margin-left: 0; margin-right: 0;
}
.partner-text .btn { margin-top: var(--space-8); }

.partner-visual {
  position: relative;
  height: 400px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.partner-pattern {
  position: absolute;
  inset: 0;
  background-image: url('assets/pattern-african.svg');
  background-size: cover;
  opacity: 0.1;
  border-radius: var(--radius-lg);
}
.partner-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------------------------------- */
/*         CTA SECTION                */
/* ---------------------------------- */
.cta-section { background-color: var(--alafia-primary-50); }
.cta-container { text-align: center; }
.cta-title { font-size: clamp(1.7rem, 4vw, 2.2rem); color: var(--alafia-neutral-900); }
.cta-subtitle { margin: var(--space-4) auto var(--space-8); max-width: 500px; }
.cta-actions { display: flex; justify-content: center; gap: var(--space-4); }

/* ---------------------------------- */
/*         FOOTER                     */
/* ---------------------------------- */
.footer { padding: var(--space-16) 0; background-color: var(--alafia-neutral-900); color: var(--alafia-neutral-100); }
.footer-container { display: flex; flex-direction: column; gap: var(--space-12); align-items: center; }
/* Stack footer sections so links center first, brand sits below */
.footer-main { display: flex; flex-direction: column; align-items: center; gap: var(--space-12); }
/* Brand row pinned below links; logo left, text right */
.footer-brand {
  order: 2;
  display: flex; align-items: center; gap: var(--space-4);
  max-width: 560px;
  text-align: left;
  margin: 0 auto; /* center the brand row horizontally */
}
.brand-logo-footer { height: 36px; margin: 0; flex: 0 0 auto; }
.footer-brand p { font-size: 0.875rem; color: var(--alafia-neutral-500); margin: 0; flex: 1; }
.footer-links { display: flex; gap: var(--space-16); flex-wrap: wrap; justify-content: center; order: 1; margin-left: 0; }
.footer-col-title { font-size: 1rem; font-weight: var(--font-semibold); color: var(--alafia-white); margin-bottom: var(--space-4); }
.footer-col a { display: block; text-decoration: none; color: var(--alafia-neutral-500); margin-bottom: var(--space-2); transition: color 0.2s; }
.footer-col a:hover { color: var(--alafia-white); }

/* ---------------------------------- */
/*         MODALS                     */
/* ---------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  visibility: hidden; opacity: 0;
  transition: opacity 0.3s, visibility 0s 0.3s;
}
.modal.is-open { visibility: visible; opacity: 1; transition-delay: 0s; }
.modal-overlay { position: absolute; inset: 0; background-color: rgba(0,0,0,0.6); }
.modal-content {
  position: relative; z-index: 1;
  background-color: var(--alafia-white);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  width: 90%; max-width: 500px;
  transform: scale(0.95);
  transition: transform 0.3s;
}
.modal.is-open .modal-content { transform: scale(1); }

.modal-close {
  position: absolute; top: var(--space-4); right: var(--space-4);
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
  color: var(--alafia-neutral-500); transition: color 0.2s;
}
.modal-close:hover { color: var(--alafia-neutral-900); }

.modal-title { font-size: 1.5rem; color: var(--alafia-neutral-900); margin-bottom: var(--space-2); }
.modal-form { margin-top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.form-group label { display: block; font-weight: var(--font-medium); margin-bottom: var(--space-2); }
.input-field {
  width: 100%; padding: var(--space-3);
  border: 1px solid var(--alafia-neutral-100);
  border-radius: var(--radius-md);
  background-color: var(--alafia-neutral-50);
  transition: var(--transition);
}
.input-field:focus { 
  outline: none; border-color: var(--alafia-primary-500);
  box-shadow: 0 0 0 3px var(--alafia-primary-50);
}

/* Form Validation States */
.input-field.is-invalid {
  border-color: #EF4444; /* --alafia-error */
}
.input-field.is-invalid:focus {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
.error-message {
  color: #EF4444; /* --alafia-error */
  font-size: 0.875rem;
  margin-top: var(--space-2);
  text-align: left;
}

/* ---------------------------------- */
/*         ANIMATIONS                 */
/* ---------------------------------- */
.animate-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.animate-in.is-visible { opacity: 1; transform: translateY(0); }

/* Add staggered delays */
.animate-in:nth-child(2) { transition-delay: 0.1s; }
.animate-in:nth-child(3) { transition-delay: 0.2s; }
.animate-in:nth-child(4) { transition-delay: 0.3s; }

/* ---------------------------------- */
/*         RESPONSIVE DESIGN          */
/* ---------------------------------- */
@media (max-width: 1024px) {
  .hero-grid, .partner-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-visuals { order: 1; margin-bottom: var(--space-8); height: 400px; }
  .store-buttons { justify-content: center; }
  .partner-text { text-align: center; }
  .partner-text .section-title, .partner-text .section-subtitle { text-align: center; margin: 0 auto 1rem; }
  .partner-visual { display: none; }
  /* Override hero text alignment to left on mobile */
  .hero-text { text-align: left; }
  .hero-sub-wrapper { align-items: flex-start; }
}

@media (max-width: 840px) {
  .why-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .section { padding: var(--space-16) 0; }
  /* Pull hero higher on mobile */
  .hero { padding-top: var(--space-8); padding-bottom: var(--space-12); }
  /* Hide only the header CTA button on mobile */
  .header-actions .btn { display: none; }
  .nav-toggle { display: block; z-index: 1001; }
  /* Tighter modal spacing on phones */
  .modal-content { padding: var(--space-6); }
  .modal-form { margin-top: var(--space-3); gap: var(--space-2); }
  .nav-links {
    position: fixed; top: 0; right: 0;
    width: 80vw; height: 100vh;
    padding: var(--space-24) var(--space-8);
    flex-direction: column; align-items: flex-start;
    background-color: var(--alafia-white);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex; /* ensure clickable when opened */
    z-index: 1002; /* above header */
  }
  .nav-links.is-open { transform: translateX(0); }
  .how-grid { grid-template-columns: 1fr; gap: var(--space-12); }
  .how-grid::before { display: none; }
  .features-grid { grid-template-columns: 1fr; }
  .footer-main, .footer-links { flex-direction: column; }
  .footer-links { margin-left: 0; }
}

/* Phones only: left-align footer items on very small screens */
@media (max-width: 640px) {
  .footer-container { align-items: stretch; }
  .footer-main { align-items: flex-start; }
  .footer-links { justify-content: flex-start; }
  .footer-brand { margin-left: 0; margin-right: 0; text-align: left; }
  .footer-socials { display: flex; justify-content: flex-start; }
}
