@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;600;700;800&display=swap');

/* Define Design Tokens */
:root {
  --primary-hue: 154;
  --primary-sat: 44%;
  --primary-lightness: 20%;
  
  --primary: hsl(var(--primary-hue), var(--primary-sat), var(--primary-lightness));
  --primary-rgb: 29, 74, 53;
  --primary-light: hsl(var(--primary-hue), var(--primary-sat), calc(var(--primary-lightness) + 12%));
  --primary-dark: hsl(var(--primary-hue), var(--primary-sat), calc(var(--primary-lightness) - 8%));
  
  --accent-hue: 38;
  --accent-sat: 72%;
  --accent: hsl(var(--accent-hue), var(--accent-sat), 54%);
  --accent-light: hsl(var(--accent-hue), var(--accent-sat), 65%);
  --accent-dark: hsl(var(--accent-hue), var(--accent-sat), 42%);
  
  --bg: hsl(45, 20%, 98%);
  --bg-rgb: 250, 249, 246;
  --surface: hsla(0, 0%, 100%, 0.7);
  --surface-solid: hsl(0, 0%, 100%);
  --surface-border: rgba(29, 74, 53, 0.08);
  --surface-border-focus: rgba(29, 74, 53, 0.25);
  
  --text: hsl(154, 40%, 10%);
  --text-muted: hsl(154, 15%, 35%);
  --text-light: hsl(0, 0%, 100%);
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow: rgba(24, 58, 40, 0.06);
  --shadow-hover: rgba(24, 58, 40, 0.12);
  
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --border-radius-xl: 32px;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
  --primary-lightness: 35%;
  --primary: hsl(var(--primary-hue), var(--primary-sat), var(--primary-lightness));
  --primary-rgb: 50, 128, 92;
  --primary-light: hsl(var(--primary-hue), var(--primary-sat), calc(var(--primary-lightness) + 10%));
  --primary-dark: hsl(var(--primary-hue), var(--primary-sat), calc(var(--primary-lightness) - 10%));
  
  --bg: hsl(154, 30%, 8%);
  --bg-rgb: 14, 25, 19;
  --surface: hsla(154, 30%, 12%, 0.7);
  --surface-solid: hsl(154, 30%, 12%);
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-border-focus: rgba(50, 128, 92, 0.4);
  
  --text: hsl(45, 20%, 95%);
  --text-muted: hsl(154, 12%, 70%);
  
  --glass-bg: rgba(14, 25, 19, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-hover: rgba(0, 0, 0, 0.5);
}

/* Custom properties registration for smooth scroll timeline animation */
@property --drawer-backdrop {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

/* Reset and Global Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

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

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

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

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Layout Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-padding {
  padding: 80px 0;
}

.text-center {
  text-align: center;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 var(--shadow);
}

/* Header & Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: background-color var(--transition-normal), box-shadow var(--transition-normal);
}

.site-header.scrolled {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--surface-border);
  box-shadow: 0 4px 20px var(--shadow);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.logo svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--text);
  position: relative;
  padding: 8px 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: width var(--transition-fast);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--surface-border);
  color: var(--text);
  background: var(--surface);
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--primary);
  color: var(--text-light);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.menu-toggle {
  display: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-family: var(--font-heading);
  font-weight: 600;
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px var(--shadow);
}

.btn-primary {
  background: var(--primary);
  color: var(--text-light);
}

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-hover);
  color: var(--text-light);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--primary);
  color: var(--text-light);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-accent {
  background: var(--accent);
  color: var(--text-light);
}

.btn-accent:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
}

/* Hero Section */
.hero {
  padding-top: 140px;
  padding-bottom: 80px;
  min-height: 90vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-content h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--primary);
}

[data-theme="dark"] .hero-content h1 {
  color: var(--text);
}

.hero-content h1 span {
  color: var(--accent);
}

.hero-content p {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 40px;
  max-width: 540px;
}

.hero-buttons {
  display: flex;
  gap: 16px;
}

.hero-visual {
  position: relative;
}

.hero-card {
  border-radius: var(--border-radius-xl);
  overflow: hidden;
  box-shadow: 0 20px 48px var(--shadow);
  border: 1px solid var(--glass-border);
}

.hero-badge {
  position: absolute;
  bottom: -24px;
  left: -24px;
  padding: 20px 32px;
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-badge .number {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.hero-badge .label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Section Header */
.section-header {
  margin-bottom: 56px;
}

.section-header h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--primary);
}

[data-theme="dark"] .section-header h2 {
  color: var(--text);
}

.section-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* About Section & Community Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
}

.info-card {
  padding: 40px;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px var(--shadow-hover);
  border-color: var(--primary-light);
}

.card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-md);
  background: rgba(29, 74, 53, 0.05);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

[data-theme="dark"] .card-icon {
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary-light);
}

.info-card:hover .card-icon {
  background: var(--primary);
  color: var(--text-light);
  transform: scale(1.05);
}

.info-card h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

.info-card p {
  color: var(--text-muted);
}

/* Details Split Section */
.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.split-image {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 40px var(--shadow);
  border: 1px solid var(--surface-border);
}

.split-content h3 {
  font-size: 2rem;
  margin-bottom: 20px;
  color: var(--primary);
}

[data-theme="dark"] .split-content h3 {
  color: var(--text);
}

.split-content p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.policy-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.policy-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-weight: 500;
}

.policy-list li svg {
  color: var(--accent);
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Scroll-Snap Image Gallery */
.gallery-container {
  position: relative;
  max-width: 100%;
}

.gallery-scroller {
  display: flex;
  gap: 24px;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  padding: 24px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.gallery-item {
  min-width: 500px;
  scroll-snap-align: center;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 32px var(--shadow);
  position: relative;
  transition: all var(--transition-normal);
  aspect-ratio: 4 / 3;
}

/* Responsive sizes for gallery items */
@media (max-width: 768px) {
  .gallery-item {
    min-width: 85vw;
  }
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateY(20px);
  opacity: 0;
  transition: all var(--transition-normal);
}

.gallery-item:hover .gallery-caption {
  transform: translateY(0);
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item h4 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
}

.gallery-item p {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* CSS Scroll-driven animations for Gallery (Scale effect) */
@supports ((animation-timeline: view()) and (animation-range: entry)) {
  @keyframes galleryScale {
    0% {
      transform: scale(0.85);
      opacity: 0.6;
    }
    50% {
      transform: scale(1);
      opacity: 1;
    }
    100% {
      transform: scale(0.85);
      opacity: 0.6;
    }
  }

  .gallery-scroller > * {
    animation: galleryScale auto linear both;
    animation-timeline: view(inline);
  }
}

/* Interactive Eligibility Quiz */
.quiz-box {
  max-width: 600px;
  margin: 0 auto;
  border-radius: var(--border-radius-lg);
  padding: 48px;
  box-shadow: 0 16px 40px var(--shadow);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.quiz-step {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.quiz-step.active {
  display: flex;
  animation: fadeIn var(--transition-normal);
}

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

.quiz-progress {
  height: 4px;
  background: var(--surface-border);
  border-radius: 2px;
  position: relative;
  margin-bottom: 24px;
}

.quiz-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width var(--transition-normal);
  border-radius: 2px;
}

.quiz-step-title {
  font-size: 1.6rem;
  font-weight: 600;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-option {
  padding: 16px 24px;
  border-radius: var(--border-radius-md);
  border: 2px solid var(--surface-border);
  background: var(--surface-solid);
  font-weight: 500;
  text-align: left;
  transition: all var(--transition-fast);
}

.quiz-option:hover {
  border-color: var(--primary-light);
  background: rgba(29, 74, 53, 0.02);
}

[data-theme="dark"] .quiz-option:hover {
  background: rgba(255, 255, 255, 0.02);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: rgba(29, 74, 53, 0.05);
  color: var(--primary);
}

[data-theme="dark"] .quiz-option.selected {
  border-color: var(--primary-light);
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary-light);
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
}

.quiz-result-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

[data-theme="dark"] .quiz-result-title {
  color: var(--primary-light);
}

/* Contact Section & Map Mock */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 48px;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.contact-item {
  display: flex;
  gap: 20px;
}

.contact-item svg {
  color: var(--primary);
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

[data-theme="dark"] .contact-item svg {
  color: var(--primary-light);
}

.contact-item-details h4 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.contact-item-details p, .contact-item-details a {
  color: var(--text-muted);
}

.map-mockup {
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 12px 32px var(--shadow);
  border: 1px solid var(--surface-border);
  height: 380px;
  position: relative;
  background: var(--surface-solid);
}

.map-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface-solid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  padding: 24px;
}

.map-placeholder svg {
  width: 48px;
  height: 48px;
  color: var(--accent);
}

.map-pin {
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-heading);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 0.9rem;
}

/* Interactive Forms (General styling) */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-group label {
  font-weight: 500;
  font-size: 0.9rem;
}

.form-control {
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  border: 2px solid var(--surface-border);
  background: var(--surface-solid);
  font-family: inherit;
  color: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(29, 74, 53, 0.1);
}

[data-theme="dark"] .form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(50, 128, 92, 0.2);
}

/* Popover Navigation Drawer */
.popover-drawer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  border: none;
  background: none;
  z-index: 1000;
  display: none; /* Controlled by showPopover() or display toggle fallback */
  padding: 0;
}

/* When the popover is active and open */
.popover-drawer:popover-open {
  display: block;
}

/* Custom backdrop managed through CSS variables */
.popover-drawer::backdrop {
  background: rgba(14, 25, 19, calc(var(--drawer-backdrop, 0) * 0.6));
  backdrop-filter: blur(calc(var(--drawer-backdrop, 0) * 8px));
  -webkit-backdrop-filter: blur(calc(var(--drawer-backdrop, 0) * 8px));
}

.drawer-scroller {
  width: 100vw;
  height: 100vh;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scroll-initial-target: nearest; /* Modern property support */
  display: flex;
  overscroll-behavior-x: contain;
}

.drawer-spacer {
  min-width: 100vw;
  height: 100vh;
  scroll-snap-align: center;
}

.drawer-sheet {
  min-width: min(380px, 85vw);
  height: 100vh;
  background: var(--bg);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
  scroll-snap-align: center;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  overflow-y: auto;
  border-left: 1px solid var(--surface-border);
}

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

.drawer-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.drawer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.drawer-links a {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.drawer-links a:hover {
  color: var(--accent);
}

/* Footer styling */
.site-footer {
  background: var(--primary);
  color: var(--text-light);
  padding: 80px 0 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 64px;
  margin-bottom: 64px;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.footer-brand .logo {
  color: white;
}

.footer-brand p {
  opacity: 0.7;
  font-size: 0.95rem;
}

.footer-links-col h4 {
  color: white;
  font-size: 1.1rem;
  margin-bottom: 24px;
  font-family: var(--font-heading);
}

.footer-links-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-links-col a {
  color: rgba(255, 255, 255, 0.7);
}

.footer-links-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  opacity: 0.7;
}

@media (max-width: 768px) {
  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}

/* Responsive Overrides */
@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  .hero-content p {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-buttons {
    justify-content: center;
  }
  .split-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .nav-links {
    display: none;
  }
  .menu-toggle {
    display: flex;
  }
}
