/* ===========================================================
   SSDA — Sahana Social Development Alliance
   Mobile-first stylesheet. Brand accent colors (--primary /
   --secondary) are injected inline from site_settings; everything
   else lives here so the palette stays consistent and legible.
=========================================================== */

:root{
  --primary: #3e3f94;
  --secondary: #d42931;
  --ink: #1c2422;
  --ink-soft: #4b5a55;
  --bg: #ffffff;
  --bg-alt: #f5f8f6;
  --border: #e3e9e6;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(30, 32, 74, 0.1);
  --shadow-lg: 0 12px 40px rgba(30, 32, 74, 0.16);
  --font-body: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-head: 'Merriweather', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.25; margin: 0 0 0.5em; }
p { margin: 0 0 1em; color: var(--ink-soft); }
.container { max-width: 1600px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--primary); color: #fff;
  padding: 10px 16px; z-index: 999; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  border: 2px solid transparent; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
  min-height: 44px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-outline { background: transparent; border-color: #fff; color: #fff; }
.btn-outline:hover { background: #fff; color: var(--primary); }
.btn-secondary { background: var(--secondary); color: #fff; }

/* ---------- Header ---------- */
.site-header {
  /* No backdrop-filter here: on most browser engines, backdrop-filter (like
     transform/filter/perspective) makes this element the containing block
     for any fixed-position descendant. That trapped .site-nav's mobile
     slide-out panel inside this ~68px-tall header box instead of letting it
     size against the actual viewport - confirmed via local Playwright test. */
  position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.97);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { height: var(--logo-height, 44px); width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-family: var(--font-head); font-size: 1rem; color: var(--primary); white-space: normal; }
.brand-text small { color: var(--ink-soft); font-size: 0.72rem; }

.nav-toggle {
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; background: none; border: none; cursor: pointer; padding: 0;
}
.nav-toggle span { width: 26px; height: 2.5px; background: var(--ink); border-radius: 2px; transition: all .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.site-nav {
  /* top/right/bottom/left used instead of the "inset" shorthand: some embedded
     browser/webview engines don't fully support "inset", which silently makes
     this panel shrink-to-fit and mis-position instead of covering the screen. */
  position: fixed; top: 68px; right: 0; bottom: 0; left: 0; width: 100%;
  background: #fff; display: flex; flex-direction: column;
  padding: 20px; gap: 4px; transform: translateX(100%); transition: transform .25s ease; overflow-y: auto;
}
.site-nav.open { transform: translateX(0); }
.site-nav a { padding: 14px 12px; border-radius: 10px; font-weight: 500; min-height: 44px; display: flex; align-items: center; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--bg-alt); color: var(--primary); }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav {
    position: static; top: auto; right: auto; bottom: auto; left: auto; width: auto;
    transform: none; flex-direction: row; align-items: center; padding: 0; background: none; overflow: visible;
  }
  .site-nav a { padding: 8px 14px; }
}

/* ---------- Projects dropdown + Volunteer CTA in the main nav ---------- */
.nav-dropdown-toggle { display: flex; align-items: center; gap: 4px; }
.nav-dropdown-toggle .caret { font-size: 0.65em; }
.nav-dropdown-menu {
  display: block; position: static; background: none; border: 0; box-shadow: none;
  padding: 0 0 0 14px; min-width: 0;
}
.nav-dropdown-menu a { display: flex; padding: 10px 12px; font-weight: 500; font-size: 0.95rem; }
.btn-nav-cta {
  background: var(--secondary); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
}
.btn-nav-cta:hover { filter: brightness(1.08); }

@media (min-width: 900px) {
  .nav-dropdown { position: relative; }
  .nav-dropdown-menu {
    display: none; position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 260px; padding: 8px; margin-top: 6px;
  }
  .nav-dropdown-menu a { border-radius: 8px; padding: 10px 12px; }
  .nav-dropdown-menu a:hover { background: var(--bg-alt); color: var(--primary); }
  .nav-dropdown:hover .nav-dropdown-menu, .nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
  .btn-nav-cta { margin-top: 0; margin-left: 6px; }
}

/* ---------- Hero (full-bleed image slider with overlaid text) ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #23245e 100%);
  color: #fff; position: relative; overflow: hidden;
  min-height: 440px; display: flex; align-items: center;
}
@media (min-width: 700px) { .hero { min-height: 560px; } }

/* Slides and the video/image fallback both fill the section as absolutely
   positioned layers (no backdrop-filter anywhere here - see the note on
   .site-header above: it creates a containing block that can trap other
   fixed/absolute descendants in unexpected ways, so plain rgba layers are
   used instead wherever a "glass" look is wanted). */
.hero-slider, .hero-media-fallback { position: absolute; inset: 0; z-index: 0; }
.hero-slides { position: absolute; inset: 0; }
.hero-slide {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1s ease;
  transform: scale(1); transform-origin: center center;
}
/* Slow "Ken Burns" drift while a slide is showing, instead of a plain swap -
   the image gently zooms in for as long as this slide stays on screen
   (matched to the admin-configured slide interval via the --hero-interval
   custom property set inline, above). .hero already has overflow:hidden so
   the zoomed-in edges never show outside the banner. Reduced-motion users
   still get the crossfade, just without the movement. */
.hero-slide.active { opacity: 1; animation: heroKenBurns var(--hero-interval, 6000ms) ease-out forwards; }
@keyframes heroKenBurns {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-slide.active { animation: none; }
}
.hero-media-fallback img, .hero-media-fallback iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0;
}
.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(100deg, rgba(15,16,46,0.78) 0%, rgba(15,16,46,0.5) 50%, rgba(15,16,46,0.22) 100%);
}
/* padding-left/right:20px (not 0) matches .container's own side padding -
   without it, the hero text sits with zero breathing room from the edge of
   the screen on mobile, and (worse) visibly touches/clips against the
   browser edge in the Right text-position option below, since there's no
   longer any outer margin to hide the missing inset. */
.hero-inner { position: relative; z-index: 2; max-width: 640px; padding: 70px 20px; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); margin-bottom: 0.4em; }
.hero p.lead { color: rgba(255,255,255,0.92); font-size: 1.05rem; max-width: 540px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

/* Where the hero text block sits over the banner photo - set in
   Admin > Page Content > Homepage - Hero > "Text position". All 3 options
   are spelled out explicitly (rather than leaving Left to just fall back
   to whatever the box's old default position happened to be) so picking
   Left visibly pushes the block to the left edge, matching how Right
   visibly pushes it to the right edge - before this, Left had no rule of
   its own, so selecting it looked like nothing happened. */
.hero-align-left { margin-left: 0; margin-right: auto; text-align: left; }
.hero-align-left p.lead { margin-left: 0; margin-right: auto; }
.hero-align-left .hero-actions { justify-content: flex-start; }
.hero-align-center { margin-left: auto; margin-right: auto; text-align: center; }
.hero-align-center p.lead { margin-left: auto; margin-right: auto; }
.hero-align-center .hero-actions { justify-content: center; }
.hero-align-right { margin-left: auto; margin-right: 0; text-align: right; }
.hero-align-right p.lead { margin-left: auto; margin-right: 0; }
.hero-align-right .hero-actions { justify-content: flex-end; }

.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4); color: #fff; font-size: 1.1rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s ease;
}
.hero-arrow:hover { background: rgba(255,255,255,0.32); }
.hero-arrow.prev { left: 12px; }
.hero-arrow.next { right: 12px; }
@media (min-width: 700px) { .hero-arrow.prev { left: 24px; } .hero-arrow.next { right: 24px; } }
/* Below 700px the left-aligned hero text spans nearly the full width, leaving
   no side margin for the arrows without overlapping it - dots + swipe/autoplay
   still work, so the arrows just step aside on small screens. */
@media (max-width: 699px) { .hero-arrow { display: none; } }

.hero-dots { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3; display: flex; gap: 8px; }
.hero-dot {
  width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,0.45); border: 0; padding: 0;
  cursor: pointer; transition: background .2s ease, transform .2s ease;
}
.hero-dot.active { background: var(--secondary); transform: scale(1.3); }

/* ---------- Category strip (dark band of focus-area links under the hero) ---------- */
.category-strip { background: var(--primary); }
.category-strip-inner { display: flex; flex-wrap: wrap; }
.category-strip-item {
  flex: 1 1 160px; text-align: center; color: #fff; font-weight: 600; font-size: 0.82rem;
  padding: 16px 12px; border-right: 1px solid rgba(255,255,255,0.15); border-bottom: 1px solid rgba(255,255,255,0.15);
  position: relative; transition: background .2s ease;
}
.category-strip-item::after {
  content: ""; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  width: 26px; height: 2px; background: var(--secondary); opacity: 0; transition: opacity .2s ease;
}
.category-strip-item:hover, .category-strip-item:focus-visible { background: rgba(255,255,255,0.08); }
.category-strip-item:hover::after, .category-strip-item:focus-visible::after { opacity: 1; }
@media (min-width: 900px) {
  .category-strip-item { border-bottom: 0; }
  .category-strip-item:last-child { border-right: 0; }
}

/* Small colored tag pill on category cards, cycling through a fixed decorative
   palette purely to tell cards apart at a glance - independent of the brand
   primary/secondary colors used for buttons, links and headings. */
.cat-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.cat-tag-0 { background: #e6f0ff; color: #1d4ed8; }
.cat-tag-1 { background: #fdeef2; color: #be123c; }
.cat-tag-2 { background: #fff4e0; color: #b45309; }
.cat-tag-3 { background: #e8f7f0; color: #0f766e; }
.cat-tag-4 { background: #f3ecff; color: #6d28d9; }
.cat-tag-5 { background: #eaf7e6; color: #3f7d20; }

/* ---------- Stats strip ---------- */
.stats-strip { background: var(--bg-alt); padding: 28px 0; border-bottom: 1px solid var(--border); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; text-align: center; }
.stats-grid .stat strong { display: block; font-family: var(--font-head); font-size: 1.8rem; color: var(--primary); }
.stats-grid .stat span { color: var(--ink-soft); font-size: 0.85rem; }
@media (min-width: 700px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 680px; margin: 0 auto 40px; text-align: center; }
.eyebrow {
  display: inline-block; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem;
  font-weight: 700; color: var(--primary); background: rgba(62,63,148,0.1); padding: 6px 14px; border-radius: 999px; margin-bottom: 14px;
}
.section-head h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-media { aspect-ratio: 4/3; background: var(--bg-alt); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: contain; object-position: center; }
.card-body { padding: 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 1.05rem; margin: 0; }
.card-tag { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--secondary); font-weight: 700; }
.card-body p { font-size: 0.92rem; margin: 0; flex: 1; }
.card-link { margin-top: 8px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 6px; }

/* ---------- About page blocks ---------- */
.mv-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .mv-grid { grid-template-columns: 1fr 1fr; } }
.mv-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.mv-card h3 { color: var(--primary); }

.timeline-note { border-left: 4px solid var(--secondary); padding: 4px 0 4px 20px; margin: 24px 0; }

/* ---------- Project detail ---------- */
.project-hero { padding: 40px 0 0; }
.breadcrumb { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 12px; }
.breadcrumb a { color: var(--primary); }
.project-sponsor {
  display: inline-block; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 16px;
}
.project-media-main { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin: 24px 0; }
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.gallery a { border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; background: var(--bg-alt); }
.gallery img { width: 100%; height: 100%; object-fit: contain; object-position: center; transition: transform .2s ease; }
.gallery a:hover img { transform: scale(1.06); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1fr 1.1fr; } }
.contact-info-list { display: flex; flex-direction: column; gap: 18px; margin: 24px 0; }
.contact-info-item { display: flex; gap: 14px; align-items: flex-start; }
.contact-info-item .icon {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(62,63,148,0.1); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.map-embed { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); aspect-ratio: 16/10; }
.map-embed iframe { width: 100%; height: 100%; border: 0; }

.form-field { margin-bottom: 18px; display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-weight: 600; font-size: 0.9rem; }
.form-field input, .form-field textarea, .form-field select {
  padding: 13px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 0.95rem;
  min-height: 44px; background: #fff;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.form-field .hint { font-weight: 400; font-size: 0.82rem; color: var(--ink-soft, #666); }
.form-field .hint.success { color: #1e7a4c; }
.form-row { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .form-row.two { grid-template-columns: 1fr 1fr; } }
.form-alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-weight: 500; }
.form-alert.success { background: #e5f5eb; color: #1e7a4c; }
.form-alert.error { background: #fdeaea; color: #b3261e; }

/* ---------- CTA ---------- */
.cta-band { background: var(--primary); color: #fff; padding: 56px 0; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,0.85); max-width: 560px; margin: 0 auto 24px; }

/* ---------- Footer ---------- */
.site-footer { background: #191a4a; color: #c6c8e8; padding-top: 48px; }
.footer-inner { display: grid; gap: 32px; grid-template-columns: 1fr; padding-bottom: 32px; }
@media (min-width: 800px) { .footer-inner { grid-template-columns: 1.4fr 1fr 1fr; } }
.footer-col h3 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.footer-col p, .footer-col a { color: #aeb1d9; display: block; margin-bottom: 8px; font-size: 0.92rem; }
.footer-col a:hover { color: #fff; }
.social-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding: 18px 0; font-size: 0.82rem; color: #8688b8; }

/* ---------- 404 ---------- */
.error-page { text-align: center; padding: 100px 20px; }
.error-page h1 { font-size: 5rem; color: var(--primary); margin-bottom: 0; }

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
