/* =====================================================================
   SHUKRIYA NOBOJAGORON FOUNDATION — Design System
   Palette matched to the organization's real logo: deep forest green
   (the circular badge) + warm gold (the sun/hands) + lime accent (ring)
   Typography: Noto Sans Bengali (Bangla, default) / Poppins (English)
   ===================================================================== */

:root {
  /* --- Color tokens --- */
  --color-teal-900: #0C3D22;
  --color-teal-700: #17693C;
  --color-teal-600: #1F7F49;
  --color-teal-100: #E4F0E7;
  --color-gold-600: #D79A2C;
  --color-gold-500: #E4B558;
  --color-gold-100: #FBF0DC;
  --color-lime:     #8DC63F;
  --color-ivory:    #FBF9F3;
  --color-ink:      #1B241D;
  --color-ink-soft: #4B5450;
  --color-terracotta: #B65C3D; /* emergency-only accent, used sparingly */
  --color-line:     #DEE5DF;

  /* --- Type tokens ---
     SolaimanLipi is self-hosted from public/assets/fonts/ — no CDN
     dependency at all for the Bangla typeface, so it can never break due
     to a third-party service being down, rate-limited, or discontinued. */
  --font-bn: 'SolaimanLipi', 'Noto Sans Bengali', sans-serif;
  --font-en: 'Poppins', sans-serif;
  --font-body: var(--font-bn);

  /* Both languages render at a normal, comfortable reading size —
     slightly above the bare browser default (16px) for accessibility,
     but no longer oversized. */
  --fs-base: 16px;
  --fs-sm:   0.875rem;
  --fs-lg:   1.05rem;
  --fs-h1:   clamp(1.75rem, 3vw + 0.75rem, 2.75rem);
  --fs-h2:   clamp(1.45rem, 1.8vw + 0.85rem, 2.05rem);
  --fs-h3:   clamp(1.15rem, 1.1vw + 0.8rem, 1.45rem);

  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 10px 30px -12px rgba(11, 58, 51, 0.18);
}

html[lang="en"] { --font-body: var(--font-en); }

/* Self-hosted Bangla font — actual font files ship in this project under
   public/assets/fonts/ (SIL Open Font License, downloaded directly from
   the original public mirror). No Google Fonts CDN, no third-party
   mirror dependency at *runtime*: this can never go down or get
   corrupted by a flaky external host. 'Noto Sans Bengali' in the
   --font-bn stack above is kept only as a same-origin-free
   browser/system fallback if someone removes the local files; the
   @font-face below is what actually loads. Also preloaded (see
   layouts/header.php) so the font is ready before text paints, instead
   of visibly swapping in after — see the RESPONSIVE section's note on
   layout-shift prevention for why that swap was causing page jitter. */
@font-face {
  font-family: 'SolaimanLipi';
  src: url('../fonts/SolaimanLipi.woff') format('woff'),
       url('../fonts/SolaimanLipi.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--color-ink);
  background: var(--color-ivory);
  line-height: 1.7;
}

h1, h2, h3, h4, .display-font {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--color-teal-900);
  line-height: 1.3;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

a { color: var(--color-teal-700); text-decoration: none; }
a:hover { color: var(--color-gold-600); }

/* Visible keyboard focus everywhere — accessibility requirement */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--color-gold-600);
  outline-offset: 2px;
}

.btn {
  border-radius: 50px;
  font-weight: 600;
  padding: 0.65rem 1.6rem;
  font-size: var(--fs-sm);
}
.btn-primary {
  background: var(--color-teal-700);
  border-color: var(--color-teal-700);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--color-teal-900);
  border-color: var(--color-teal-900);
}
.btn-gold {
  background: var(--color-gold-600);
  border-color: var(--color-gold-600);
  color: #fff;
}
.btn-gold:hover { background: var(--color-gold-500); color: #fff; }
.btn-outline-primary {
  color: var(--color-gold-600);
  border-color: var(--color-gold-600);
  background: transparent;
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
  background: var(--color-gold-600);
  border-color: var(--color-gold-600);
  color: #fff;
}
.btn-outline-light-teal {
  border: 1.5px solid rgba(255,255,255,.6);
  color: #fff;
}
.btn-outline-light-teal:hover { background: rgba(255,255,255,.12); color: #fff; }

/* =====================================================================
   HEADER / MEGA MENU
   ===================================================================== */
.top-bar {
  background: var(--color-teal-900);
  color: rgba(255,255,255,.85);
  font-size: 0.85rem;
  overflow: hidden;
  max-height: 44px;
  transition: max-height .25s ease, padding .25s ease, opacity .2s ease;
}
.top-bar.top-bar-hidden {
  max-height: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  opacity: 0;
}
.top-bar a { color: #fff; }
.top-bar .lang-switch a {
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}
.top-bar .lang-switch a.active {
  background: var(--color-gold-600);
  color: #1E2422;
}

.site-header {
  background: #fff;
  box-shadow: 0 2px 18px rgba(11,58,51,.06);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.site-header .brand-mark {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--color-teal-900);
}
.site-header .brand-mark small {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-gold-600);
  letter-spacing: .04em;
}

.navbar { position: relative; }
.navbar-toggler {
  border: none !important;
  box-shadow: none !important;
  padding: .25rem .4rem;
  color: var(--color-teal-900);
  font-size: 1.6rem;
  line-height: 1;
}
.navbar-toggler .icon-close { display: none; }
.navbar-toggler[aria-expanded="true"] .icon-hamburger { display: none; }
.navbar-toggler[aria-expanded="true"] .icon-close { display: inline-block; }

.main-nav .nav-link {
  color: var(--color-ink) !important;
  font-weight: 600;
  padding: 0.9rem 1rem !important;
}
.main-nav .nav-link:hover,
.main-nav .nav-link:focus { color: var(--color-teal-700) !important; }

.mega-menu {
  border: none;
  border-top: 3px solid var(--color-gold-600);
  box-shadow: var(--shadow-card);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 1.25rem 1.5rem;
  min-width: 580px;
  max-width: min(680px, 92vw);
}
.mega-menu h6 {
  color: var(--color-gold-600);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: .06em;
  font-weight: 700;
  margin-bottom: .4rem;
}
.mega-menu a.dropdown-item {
  padding: .28rem 0;
  color: var(--color-ink);
  border-radius: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}
.mega-menu a.dropdown-item:hover { background: transparent; color: var(--color-gold-600); }

/* =====================================================================
   HERO — "Ledger of Giving" signature: a ruled-passbook backdrop behind
   the headline, echoing the transparency the org is built on.
   ===================================================================== */
.hero {
  position: relative;
  background: linear-gradient(160deg, var(--color-teal-900), var(--color-teal-700) 70%);
  color: #fff;
  overflow: hidden;
  padding: 5.5rem 0 6rem;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom, rgba(255,255,255,.05) 0, rgba(255,255,255,.05) 1px,
    transparent 1px, transparent 48px
  );
  pointer-events: none;
}
.hero .eyebrow {
  color: var(--color-gold-500);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 0.85rem;
}
.hero h1 { color: #fff; }
.hero p.lead { color: rgba(255,255,255,.85); font-size: var(--fs-lg); max-width: 640px; }

/* ---- Hero image slider ---- */
.hero-carousel { position: relative; }
.hero-slide {
  height: min(560px, 70vh);
  min-height: 360px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  position: relative;
}
.hero-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(12,61,34,.88) 0%, rgba(12,61,34,.55) 55%, rgba(12,61,34,.25) 100%);
}
.hero-slide-content {
  position: relative;
  z-index: 1;
  color: #fff;
  max-width: 640px;
}
.hero-slide-content h1 { color: #fff; margin-bottom: .75rem; }
.hero-slide-content p.lead { color: rgba(255,255,255,.9); }
.hero-carousel .carousel-indicators { margin-bottom: 1rem; }
.hero-carousel .carousel-indicators [data-bs-target] {
  width: 9px; height: 9px; border-radius: 50%;
  background-color: rgba(255,255,255,.6);
  border: none;
}
.hero-carousel .carousel-indicators .active { background-color: var(--color-gold-600); }
.hero-carousel .carousel-control-prev,
.hero-carousel .carousel-control-next { width: 5%; opacity: 0.8; }

/* ---- Quick donate — its own section, directly below the hero/slider ---- */
.quick-donate-section {
  background: var(--color-teal-100);
  padding: 2.5rem 0;
}

/* ---- Mobile card carousels (projects/campaigns/testimonials) ---- */
.card-carousel .carousel-item { padding-bottom: 2.25rem; }
.card-carousel-indicators {
  position: static;
  margin: 0.5rem 0 0;
}
.card-carousel-indicators [data-bs-target] {
  width: 8px; height: 8px; border-radius: 50%;
  background-color: var(--color-line);
  border: none;
  opacity: 1;
}
.card-carousel-indicators .active { background-color: var(--color-gold-600); }

/* ---- Partner logo cards ---- */
.partner-logo-card {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 110px;
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.partner-logo-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.partner-logo-card img { max-height: 56px; max-width: 100%; object-fit: contain; }

.quick-donate-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.75rem;
  color: var(--color-ink);
}
.quick-donate-card .amount-chip {
  border: 1.5px solid var(--color-line);
  border-radius: 50px;
  padding: .5rem 0;
  font-weight: 700;
  color: var(--color-teal-700);
  cursor: pointer;
  background: #fff;
}
.quick-donate-card .amount-chip.active,
.quick-donate-card .amount-chip:hover {
  background: var(--color-teal-700);
  border-color: var(--color-teal-700);
  color: #fff;
}

/* =====================================================================
   STATS STRIP — tabular "ledger" figures
   ===================================================================== */
.stats-strip {
  background: var(--color-teal-100);
  padding: 3rem 0;
}
.stat-figure {
  font-weight: 800;
  font-size: clamp(1.8rem, 2.5vw, 2.6rem);
  color: var(--color-teal-900);
  font-variant-numeric: tabular-nums;
}
.stat-label { color: var(--color-ink-soft); font-size: var(--fs-sm); }

/* =====================================================================
   CARDS: projects / campaigns / blog / news
   ===================================================================== */
.section { padding: 4.5rem 0; }
.section-title .eyebrow-line {
  display: inline-block;
  width: 42px; height: 3px;
  background: var(--color-gold-600);
  margin-bottom: .75rem;
}

.card-nf {
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  height: 100%;
  border: 1px solid var(--color-line);
  transition: transform .2s ease;
}
.card-nf:hover { transform: translateY(-4px); }
.card-nf .card-img { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.card-nf .card-body { padding: 1.25rem 1.35rem 1.5rem; }
.card-nf .badge-type {
  background: var(--color-gold-100);
  color: var(--color-gold-600);
  font-weight: 700;
  font-size: .72rem;
  padding: .25rem .65rem;
  border-radius: 50px;
}

/* Same visual look as .card-nf, but WITHOUT height:100% — for stacked
   info panels (e.g. the donor dashboard) where multiple cards sit one
   above another in the same column. .card-nf's height:100% is correct
   for grid rows (project/campaign/blog cards matching a sibling's
   height) but causes runaway height stretching when stacked instead:
   each card independently claims 100% of the flex-stretched column
   height, so two stacked cards demand roughly double the actual space
   they need — exactly the empty-space/overflow bug this fixes. */
.panel-card {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-line);
}

.progress-nf {
  height: 8px;
  border-radius: 50px;
  background: var(--color-teal-100);
  overflow: hidden;
}
.progress-nf > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--color-gold-600), var(--color-gold-500));
}

.emergency-banner {
  background: var(--color-terracotta);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 2rem;
}

/* =====================================================================
   FOOTER
   ===================================================================== */
.site-footer {
  background: var(--color-teal-900);
  color: rgba(255,255,255,.78);
  padding: 4rem 0 1.5rem;
}
.site-footer h6 {
  color: #fff;
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.site-footer a { color: rgba(255,255,255,.78); }
.site-footer a:hover { color: var(--color-gold-500); }
.site-footer .social-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.15);
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  font-size: 0.85rem;
}

/* =====================================================================
   AUTH FORMS
   ===================================================================== */
.auth-card {
  max-width: 460px;
  margin: 3.5rem auto;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2.25rem;
}
.form-control, .form-select {
  font-size: var(--fs-base);
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  border-color: var(--color-line);
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-teal-600);
  box-shadow: 0 0 0 .2rem rgba(15,76,66,.15);
}

.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 2.75rem; }
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--color-ink-soft);
  padding: 4px;
  cursor: pointer;
  line-height: 1;
}
.password-toggle:hover { color: var(--color-teal-700); }

/* =====================================================================
   FLOATING ACTION BUTTONS — WhatsApp live chat + back-to-top
   ===================================================================== */
.floating-actions {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.floating-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 8px 24px -6px rgba(0,0,0,.35);
  border: none;
  color: #fff;
  transition: transform .15s ease, opacity .2s ease;
}
.floating-btn:hover { transform: translateY(-3px); color: #fff; }
.floating-btn-whatsapp { background: #25D366; }
.floating-btn-top {
  background: var(--color-teal-900);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}
.floating-btn-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
@media (max-width: 575.98px) {
  .floating-actions { right: 0.85rem; bottom: 0.85rem; gap: 0.6rem; }
  .floating-btn { width: 46px; height: 46px; font-size: 1.2rem; }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

/* Global safety nets — prevent any stray element from forcing horizontal
   scroll on narrow phones (the single most common "not mobile friendly"
   complaint: a fixed-width image, iframe, or table pushing the viewport).
   IMPORTANT: overflow-x:hidden on <html>/<body> is deliberately NOT used
   here — it silently breaks `position: sticky` (the header) in most
   browsers, since it forces the page into a new scroll-container context.
   Overflow prevention is handled per-element below instead. */
html { max-width: 100%; }
body { max-width: 100%; }
img, iframe, video { max-width: 100%; height: auto; }
.table-responsive { -webkit-overflow-scrolling: touch; }

/* Everything below the sticky header lives inside this wrapper (see
   layouts/header.php / footer.php) — safe to clip horizontal overflow
   here specifically, since it's not an ancestor of the sticky header
   itself, so this can't break position:sticky the way overflow-x:hidden
   on <body> does. */
.page-content-wrap { overflow-x: hidden; max-width: 100%; }

/* Explicit belt-and-braces clipping for the carousel components —
   Bootstrap's own .carousel-inner{overflow:hidden} should already
   contain these, but this guarantees it regardless of any CSS load
   order or specificity edge case, since carousels were the most likely
   source of the horizontal-overflow bug reported here. */
.hero-carousel, .hero-carousel .carousel-inner,
.card-carousel, .card-carousel .carousel-inner {
  overflow: hidden;
  max-width: 100%;
}

/* ---- ≤991.98px: tablets / mobile nav takes over ---- */
@media (max-width: 991.98px) {
  .section { padding: 3rem 0; }
  .hero { padding: 3rem 0 3.5rem; text-align: center; }
  .hero p.lead { margin-inline: auto; }

  /* The mobile menu overlays the page (hero/slider stays put underneath)
     instead of pushing content down when opened. */
  .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 16px 32px -12px rgba(11,58,51,.25);
    border-top: 1px solid var(--color-line);
    padding: 0.5rem 1rem 1rem;
    z-index: 999;
  }

  /* The classic Bootstrap 5 mega-menu-in-mobile-nav bug: dropdown-menu
     stays position:absolute even inside the collapsed navbar, so it
     overlaps/clips instead of expanding inline. Force it to flow with
     the stacked mobile menu instead. */
  .navbar-collapse .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 3px solid var(--color-gold-600);
    border-radius: 0;
    background: var(--color-teal-100);
    margin: 0.5rem 0 0.75rem;
    padding: 1rem 1rem 0.25rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .navbar-collapse .mega-menu .row { row-gap: 1rem; }
  .navbar-collapse .mega-menu h6 { margin-top: 0; }
  /* The mega-menu's columns use Bootstrap's md breakpoint (768px), but the
     collapsed mobile nav is narrow well past that point too (a tablet at
     900px still renders the collapsed hamburger menu) — force every column
     to stack full-width whenever it's inside that collapsed nav, regardless
     of screen width, so text never gets squeezed into a sliver. */
  .navbar-collapse .mega-menu [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
  /* Touch-friendly tap targets (44px is the standard minimum touch size). */
  .navbar-collapse .mega-menu a.dropdown-item {
    padding: 0.7rem 0.25rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .main-nav .nav-link { padding: 0.65rem 0.25rem !important; }
  .navbar-collapse { max-height: 80vh; overflow-y: auto; }
}

/* ---- ≤767.98px: phones (landscape and up) ---- */
@media (max-width: 767.98px) {
  .top-bar { font-size: 0.72rem; }
  .top-bar .container { flex-wrap: wrap; row-gap: 6px; }
  .top-bar .d-flex.gap-3 { gap: 10px !important; }
  .top-bar .lang-switch a { padding: 2px 8px; }

  .site-header .brand-mark { font-size: 1.05rem; line-height: 1.25; }
  .site-header .brand-mark small { font-size: 0.62rem; }
  .navbar { padding-top: 0.6rem !important; padding-bottom: 0.6rem !important; }

  .quick-donate-card, .auth-card { padding: 1.35rem; }
  .card-nf .card-body { padding: 1rem 1.1rem 1.25rem; }

  .hero-slide { height: min(420px, 60vh); min-height: 320px; }
  .hero-slide-content { max-width: 100%; text-align: center; margin: 0 auto; }
  .hero-slide-overlay { background: linear-gradient(180deg, rgba(12,61,34,.35) 0%, rgba(12,61,34,.85) 75%); }
  .quick-donate-section .row-cols-md-6 > .col { flex: 0 0 33.333%; max-width: 33.333%; }

  .footer-bottom { flex-direction: column; text-align: center; gap: 0.5rem; }
}

/* ---- ≤575.98px: small phones ---- */
@media (max-width: 575.98px) {
  :root { --fs-base: 15.5px; }

  .quick-donate-card .row.row-cols-3 { --bs-columns: 2; }
  .stat-figure { font-size: 1.5rem; }
  .hero { padding: 2.5rem 0 3rem; }
  .btn-lg { padding: 0.6rem 1.25rem; font-size: 0.95rem; }
  .emergency-banner { padding: 1.25rem; text-align: center; }
  .emergency-banner.d-flex { flex-direction: column; align-items: center !important; justify-content: center !important; }
  .emergency-banner .badge { margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card-nf { transition: none; }
}
