/* ========================================================
   PAGES — Page-specific styles using design tokens
   ======================================================== */

/* Page header banner */
/* NOTE: templates set the banner via inline `center/100% 100%`. The rules below
   force `100% 100%` (with !important to beat inline styles) so every banner
   image stretches to fill the whole container — no letterboxing, no cropping
   on any page. */
.page-hero {
  padding: 3rem 0 !important;
  min-height: 85vh !important; /* Match index.html hero-carousel height so banners fill a full hero container */
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important; /* Vertically center text in the taller container */
  align-items: flex-start !important; /* Keep text left-aligned */
  background-color: var(--border-focus); /* Blue background in light mode (matches index.html hero) */
  color: var(--bg); /* White text for dark blue background */
  background-size: 100% 100% !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}
[data-theme="dark"] .page-hero {
  background-color: var(--bg-alt); /* Dark gray background in dark mode */
  color: var(--fg); /* Light text for dark background */
}
.page-hero .badge {
  display: inline-block !important;
  margin-bottom: 1.75rem !important;
}
.page-hero .section-eyebrow { margin-bottom: 0.5rem; }
.page-hero h1 {
  font-size: var(--text-display) !important; /* Larger title to fill the space */
  margin-bottom: 1.75rem !important;
  line-height: 1.15 !important;
  letter-spacing: -0.02em !important;
  font-weight: 800 !important;
}
.page-hero p {
  color: oklch(from var(--bg) l c h / 80%) !important;
  font-size: var(--text-h2-lg) !important; /* Larger description text */
  max-width: 800px !important;
  margin-bottom: 0 !important;
  line-height: 1.75 !important;
}
[data-theme="dark"] .page-hero p { color: var(--muted); }

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1.25rem;
  transition: var(--t-fast);
}
.back-link:hover { color: var(--primary); }

/* About quote block */
.quote-block {
  background: var(--primary-subtle);
  border-left: 3px solid var(--primary);
  padding: 1.75rem 2rem;
  border-radius: var(--r-md);
}
.quote-block blockquote {
  font-size: var(--text-title);
  font-style: italic;
  color: var(--fg);
  line-height: 1.7;
  margin-bottom: 1rem;
}
.quote-block-accent {
  border-left-color: var(--accent);
}
.quote-attribution { font-size: var(--text-small); font-weight: 700; color: var(--primary); }

/* Student Profile Filters */
.filter-grid {
  align-items: flex-end;
}
.filter-label {
  display: block;
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.filter-select {
  width: 100%;
  border-radius: var(--r-full);
  padding: 0.6rem 1rem;
  font-weight: 600;
  -webkit-appearance: none;
  appearance: none;
}
.search-wrapper {
  position: relative;
}
.search-wrapper .form-control {
  padding-left: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.875rem center;
  background-size: 1rem;
}

/* Programs objective list */
.objective-list { list-style: none; margin-bottom: 1.25rem; }
.objective-list li {
  padding: 0.5rem 0;
  padding-left: 1.375rem;
  position: relative;
  color: var(--fg-2);
  font-size: var(--text-small);
}
.objective-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

/* Impact callout box */
.impact-box {
  background: var(--primary-subtle);
  border: 1px solid var(--primary-muted);
  border-radius: var(--r-md);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
}
.impact-box .label  { font-size: var(--text-xs); font-weight: 700; color: var(--primary); margin-bottom: 0.375rem; }
.impact-box .value  { font-size: var(--text-small); color: var(--fg-2); }

/* Sticky sidebar card */
.sticky-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--space-5));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

/* Get-involved pathway card */
.pathway-card { height: 100%; }
.pathway-steps {
  list-style: none;
  margin-bottom: 1.25rem;
}
.pathway-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: var(--text-small);
  color: var(--muted);
  padding: 0.35rem 0;
}
.step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: var(--text-2xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
[data-theme="dark"] .step-num {
  background: var(--accent-subtle);
  color: var(--accent);
}

/* M-Pesa status messages */
.mpesa-status {
  padding: 0.75rem 1rem;
  border-radius: var(--r-sm);
  font-size: var(--text-small);
  font-weight: 500;
  margin-bottom: 1rem;
  display: none;
}
.mpesa-status.info    { background: var(--info-subtle); color: var(--info); }
.mpesa-status.success { background: var(--success-subtle); color: var(--success); }
.mpesa-status.error   { background: var(--danger-subtle); color: var(--danger); }

/* Flash messages */
.flash-danger,
.flash-success {
  border-radius: var(--r-sm);
  padding: 0.875rem 1.125rem;
  margin-bottom: 1rem;
  font-weight: 500;
}
.flash-danger  { background: var(--danger-subtle); color: var(--danger); border: 1px solid var(--danger-muted); }
.flash-success { background: var(--success-subtle); color: var(--success); border: 1px solid var(--success-muted); }

/* About Page Timeline */
.timeline {
  list-style: none;
  padding-left: 1.5rem;
  border-left: 1px solid var(--border);
  position: relative;
}
.timeline-item {
  position: relative;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.timeline-dot {
  position: absolute;
  left: -2.2rem;
  top: 1.75rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-item .badge { margin-bottom: 0.75rem; }
.timeline-title {
  font-size: var(--text-title);
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}
.timeline-text { font-size: var(--text-small); color: var(--muted); margin-bottom: 0; }


/* Pillar detail intro block (e.g. MENTORSHIP / Tubonge Mentorship Program) */
.pillar-intro {
  max-width: 62rem;
  margin: 0 auto 3.5rem;
}
.pillar-intro-title {
  font-size: var(--text-h2-lg);
  margin: 0.75rem 0 1.125rem;
}
.pillar-intro-text {
  font-size: var(--text-lead);
  line-height: 1.75;
  color: var(--fg-2);
  margin-bottom: 1rem;
}
.pillar-intro-text:last-child { margin-bottom: 0; }
/* Divider only when the intro is followed by the alternating rows. */
.pillar-intro:has(+ .subsection-list) {
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

/* Pillar detail photo gallery (3-column responsive grid above subsections) */
.pillar-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.pillar-gallery-item {
  margin: 0;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}
.pillar-gallery-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}
.pillar-gallery-caption {
  padding: 0.75rem 1rem;
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--fg-2);
  text-align: center;
}

/* Pillar detail subsections (alternating text/image rows) */
.subsection-list {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}
.subsection-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
}
.subsection-row--reverse .subsection-text { order: 2; }
.subsection-row--reverse .subsection-media { order: 1; }
.subsection-title {
  font-size: var(--text-h3-lg);
  margin-bottom: 1rem;
}
/* Subsections can hold several paragraphs (blank-line separated in the DB). */
.subsection-text .lead-lg { margin-bottom: 1rem; }
.subsection-text .lead-lg:last-child { margin-bottom: 0; }
.subsection-media { overflow: hidden; border-radius: var(--r-lg); }
.subsection-img {
  width: 100%;
  height: 100%;
  max-height: 380px;
  object-fit: fill;
  border-radius: var(--r-lg);
  display: block;
}

/* Subsection card slideshow (per-card photo rotation, 3s interval)
   — smooth opacity crossfade via stacked, absolutely-positioned slides. */
.subsection-slideshow {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  aspect-ratio: 16 / 9;
  max-height: 380px;
  width: 100%;
}
.subsection-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  border-radius: var(--r-lg);
}
.subsection-slide.is-active {
  position: relative;
  opacity: 1;
}
.subsection-dots {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.375rem;
}
.subsection-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.3s ease;
}
.subsection-dot.is-active { background: #fff; }
/* Wrapping figure + the activity name written below each carousel photo. */
.subsection-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.subsection-slideshow-caption {
  font-size: var(--text-small);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-align: center;
  transition: opacity 0.4s ease;
}
/* Respect users who prefer reduced motion: show first photo only. */
@media (prefers-reduced-motion: reduce) {
  .subsection-slide { transition: none; }
}

/* Card slideshow (program cards on homepage) — smooth opacity crossfade
   via stacked, absolutely-positioned slides. Smaller than subsection to fit
   card layout. */
.card-slideshow {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  aspect-ratio: 4 / 3;
  max-height: 260px;
  width: 100%;
  background: var(--bg-alt);
}
.card-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--r-lg);
}
.card-slide-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  border-radius: var(--r-lg);
  opacity: 0;
  transition: opacity 1s ease-in-out;
}
.card-slide.is-active .card-slide-img {
  opacity: 1;
}

/* Respect users who prefer reduced motion: show first photo only. */
@media (prefers-reduced-motion: reduce) {
  .card-slide { transition: none; }
}



/* Responsive */
@media (max-width: 640px) {
  .pillar-gallery { grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
  .pillar-gallery-img { height: 160px; }
  .subsection-row { grid-template-columns: 1fr; gap: 1.25rem; }
  .subsection-row--reverse .subsection-text { order: 1; }
  .subsection-row--reverse .subsection-media { order: 2; }
  .subsection-img { max-height: 260px; }
  .page-hero { padding: 2.5rem 0 2rem; }
  .sticky-sidebar { position: static; }
  .quote-block { padding: 1.25rem 1.5rem; }
  .filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
/* ========================================================
   ABOUT PAGE — responsive scaling helpers
   ======================================================== */
.concept-image,
.concept-graphic {
  display: inline-block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.characteristic-item {
  flex: 0 0 auto;
  min-width: 120px;
  text-align: center;
}

.characteristic-icon-container img {
  max-width: 64px;
  height: auto;
}

@media (max-width: 480px) {
  .history-pillar-grid {
    grid-template-columns: 1fr;
  }
  .sdg-grid-images img {
    width: 96px;
    height: 96px;
  }
}

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

}