/* ==========================================================================
   1. CORE VARIABLES & TOKEN DEFINITIONS
   ========================================================================== */
:root {
  --core-navy: #1c1f42;
  --deep-indigo: #33326f;
  --bright-blue: #416bc2;
  --gentle-sky: #8daac4;
  --warm-sand: #d9c8af;
  --soft-light: #f9f2e9;
  --clean-white: #fbfaf7;
  --text-dark: #222222;
  --text-muted: #555555;
}

/* ==========================================================================
   2. GLOBAL RESET & BASELINE BOX MODEL
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box !important;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Lato', sans-serif;
  background-color: var(--clean-white);
  color: var(--text-dark);
  line-height: 1.6;
  padding-top: 70px !important; /* Forces layout content downwards to clear fixed header */
  transition: padding 0.3s ease;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Bitter', serif;
  font-weight: 700;
  color: var(--core-navy);
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.section-tag {
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--bright-blue);
  margin-bottom: 10px;
  display: block;
}

/* ==========================================================================
   3. UNIFIED ACCENT BUTTON COMPONENT ARCHITECTURE
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: var(--deep-indigo);
  color: white;
}

.btn-primary:hover {
  background-color: var(--core-navy);
}

.btn-secondary {
  background-color: transparent;
  border: 2px solid white;
  color: white;
}

.btn-secondary:hover {
  background-color: white;
  color: var(--core-navy);
}

.btn-accent {
  background-color: var(--warm-sand);
  color: var(--core-navy);
}

.btn-accent:hover {
  background-color: #cbbba2;
}

.btn-outline-indigo {
  background: transparent;
  border: 2px solid var(--deep-indigo);
  color: var(--deep-indigo);
}

.btn-outline-indigo:hover {
  background: var(--deep-indigo);
  color: white;
}

/* ==========================================================================
   4. FIXED COMPACT HEADER & DROPDOWN MAPPING
   ========================================================================== */
header#mainHeader {
  background-color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  position: fixed !important; /* Locks layout behavior uniformly across all pages */
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2000 !important; /* High stack order ensures it hovers over any Hero or Section wrapper */
  transition: all 0.3s ease-in-out;
}

header.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* Base structural row height layout */
.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px; /* Locked standard height blueprint */
  padding: 0 20px;
  max-width: 1200px;
  margin: 0 auto;
  transition: all 0.3s ease-in-out;
}

header.scrolled .nav-container {
  height: 56px; /* Smooth scale dynamic container compaction */
}

.logo-link {
  display: flex;
  align-items: center;
}

.logo-link h1 {
  font-size: 1.1rem !important; 
  margin: 0 !important; /* Clears destructive heading margins */
}

.logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  transition: all 0.3s ease-in-out;
}

header.scrolled .logo-img {
  height: 30px;
}

.btn-navbar-donate {
  background-color: var(--deep-indigo);
  color: white;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 20px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-navbar-donate:hover {
  background-color: var(--bright-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(65, 107, 194, 0.3);
  color: white !important;
}

/* Navigation Element Tree */
nav ul {
  display: flex;
  list-style: none;
  gap: 25px;
  align-items: center;
  margin: 0 !important;
  padding: 0 !important;
}

nav ul li {
  position: relative;
  display: flex;
  align-items: center;
}

nav ul li a {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--core-navy);
  padding: 8px 0; /* Clear tall paddings that cause structural expansion */
  display: inline-flex;
  align-items: center;
  gap: 5px;
  position: relative;
  transition: all 0.3s ease;
}

/* Tracking Hover Underlines */
nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--bright-blue);
  transition: width 0.3s ease;
}

nav ul li a:hover::after, 
nav ul li.active > a::after {
  width: 100%;
}

nav ul li a:hover {
  color: var(--bright-blue);
}

/* --- TIGHT PACKAGED DROPDOWN CONFIGURATION --- */
nav ul li .dropdown {
  position: absolute;
  top: 100%;
  left: 0; /* Pantay sa kaliwang gilid ng link kagaya ng mockup mo */
  background-color: white;
  min-width: 230px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  border-radius: 4px;
  display: block; /* Ginawang block para iwas hiwa-hiwalay ng spacing */
  padding: 4px 0;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-in-out;
  z-index: 1010;
  border: 1px solid rgba(0,0,0,0.08);
  margin: 0 !important;
}

nav ul li:hover > .dropdown {
  opacity: 1;
  visibility: visible;
}

nav ul li .dropdown li {
  width: 100%;
  display: block;
  position: relative;
}

nav ul li .dropdown li a {
  padding: 8px 16px; /* Siksik at malinis na vertical link gaps */
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

nav ul li .dropdown li a::after {
  display: none !important; /* Tinatanggal ang hover tracking line sa loob ng dropdown */
}

nav ul li .dropdown li a:hover {
  background-color: var(--soft-light);
  color: var(--deep-indigo);
}

/* Second Level Flyouts (Nested Dropdowns) */
nav ul li .dropdown .has-nested {
  position: relative;
}

nav ul li .dropdown .nested-dropdown {
  position: absolute;
  top: -5px; /* Saktong dikit sa gilid ng parent element box framework */
  left: 100%;
  background-color: white;
  min-width: 210px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  border-radius: 4px;
  display: block;
  padding: 4px 0;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-in-out;
  border: 1px solid rgba(0,0,0,0.08);
  margin: 0 !important;
}

nav ul li .dropdown .has-nested:hover .nested-dropdown {
  opacity: 1;
  visibility: visible;
}

nav ul li .dropdown .nested-dropdown li a {
  padding: 8px 16px; /* Pinapantay ang padding para uniform pati sub-items */
}

/* Third Level Flyouts (NEW: Deep Nested Dropdowns for Community Development) */
nav ul li .dropdown .nested-dropdown .has-deep-nested {
  position: relative;
}

nav ul li .dropdown .nested-dropdown .deep-nested-dropdown {
  position: absolute;
  top: -5px; /* Aligned straight right relative to Community Development element container */
  left: 100%;
  background-color: white;
  min-width: 210px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  border-radius: 4px;
  display: block;
  padding: 4px 0;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-in-out;
  border: 1px solid rgba(0,0,0,0.08);
  margin: 0 !important;
  z-index: 1020;
}

nav ul li .dropdown .nested-dropdown .has-deep-nested:hover .deep-nested-dropdown {
  opacity: 1;
  visibility: visible;
}

nav ul li .dropdown .nested-dropdown .deep-nested-dropdown li a {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* ==========================================================================
   5. SITEWIDE FOOTER DESIGN BLOCK
   ========================================================================== */
footer {
  background-color: var(--core-navy);
  color: rgba(255,255,255,0.7);
  padding: 70px 0 20px;
  font-size: 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr 1.2fr;
  gap: 40px;
  margin-bottom: 5px;
}

.footer-col h4 {
  color: white;
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.footer-col ul {
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
}

.footer-col ul li {
  margin-bottom: 12px;
}

.footer-col ul li a:hover {
  color: var(--clean-white);
}

.footer-about .footer-logo-container {
  margin-bottom: 15px;
}

.footer-logo {
  height: 150px;
  width: auto;
  object-fit: contain;
}

.footer-about p {
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.social-icons {
  display: flex;
  gap: 12px;
}

.social-icons a {
  width: 35px;
  height: 35px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.social-icons a:hover {
  background: var(--bright-blue);
}

.newsletter-form {
  display: flex;
  margin-top: 15px;
}

.newsletter-form input {
  padding: 12px;
  border: none;
  border-radius: 4px 0 0 4px;
  flex-grow: 1;
  font-family: inherit;
}

.newsletter-form button {
  background: var(--bright-blue);
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-weight: bold;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 20px;
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.footer-bottom-links {
  display: flex;
  gap: 20px;
}

/* ==========================================================================
   6. RESPONSIVE LAYER ADAPTATIONS
   ========================================================================== */
@media (max-width: 992px) {
  .grid-two-col, .centers-grid, .footer-grid {
    grid-template-columns: 1fr;
  }
  .impact-grid, .activities-grid, .testimonial-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cta-container {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  nav {
    display: none;
  }
}

@media (max-width: 600px) {
  body {
    padding-top: 60px !important;
  }
  .nav-container {
    height: 60px;
  }
  header.scrolled .nav-container {
    height: 50px;
  }
  .impact-grid, .activities-grid, .testimonial-grid {
    grid-template-columns: 1fr;
  }
}