/*
Theme Name:   Astra Child - Namo Shree Foundation
Theme URI:    https://namoshreefoundation.com
Description:  Custom Astra child theme for Namo Shree Foundation, built from the approved
              style system and content document. Provides global header/footer, page
              templates for Home/About/Our Initiatives/Our Impact/Gallery/Get Involved/
              Contact, and custom post types for Initiatives, Gallery and Updates.
Author:       Namo Shree Foundation
Template:     astra
Version:      1.2.1
Text Domain:  namo-child
*/

:root{
  --navy-900:#051B30; --navy-800:#0B2C4E; --navy-600:#1F4A73; --navy-400:#5C7C9B; --navy-200:#B9C8D8; --navy-100:#EAF0F5;
  --gold-700:#8A6222; --gold-500:#C08B30; --gold-300:#E3BE74; --gold-100:#F7ECD6;
  --green-700:#3E5F22; --green-500:#5C8A2E; --green-300:#9CBE72; --green-100:#E9F1DD;
  --paper-0:#FCFAF6; --paper-50:#F5F1E9; --paper-100:#EDE6D8;
  --ink-900:#1B2530; --ink-700:#52514C; --ink-400:#8B887E; --border:#E2DCCB;
  --error:#A23B2E;
  --font-serif:'Lora',Georgia,'Times New Roman',serif;
  --font-sans:'Source Sans 3',-apple-system,'Segoe UI',Helvetica,Arial,sans-serif;
  --shadow-1:0 1px 2px rgba(11,44,78,.06),0 1px 1px rgba(11,44,78,.04);
  --shadow-2:0 8px 24px rgba(11,44,78,.10);
  --namo-header-h:88px; /* fallback; main.js overrides with the header's real rendered position */
}

/* ---------- Base / reset on top of Astra ---------- */
/* Astra's own base CSS sets `body{overflow-x:hidden}` to stop horizontal
   scroll — but that turns <body> into a scroll container, which is a
   known trigger for position:sticky/fixed detaching from the viewport
   while scrolling on mobile Safari (the gap between the sticky header and
   the fixed mobile-nav panel when the menu is opened after scrolling).
   Moving the clip to <html> and freeing body's overflow-x keeps the
   horizontal-scroll fix while restoring normal sticky/fixed behavior. */
html{ overflow-x:hidden; }
body{
  overflow-x:visible;
  background:var(--paper-0);
  color:var(--ink-900);
  font-family:var(--font-sans);
}
a{ color:var(--navy-800); text-decoration:none; }
a:hover{ color:var(--gold-700); }
h1,h2,h3,h4,h5,h6{ font-family:var(--font-serif); color:var(--navy-800); }
img{ max-width:100%; height:auto; display:block; }
.ast-container{ max-width:1160px; }

.eyebrow{
  font-family:var(--font-sans); font-weight:700; font-size:13px; letter-spacing:.14em;
  text-transform:uppercase; color:var(--gold-700); display:inline-block;
}
.btn-primary, .wp-block-button__link{
  display:inline-flex; align-items:center; gap:8px; background:var(--navy-800); color:#fff !important;
  font-family:var(--font-sans); font-weight:600; font-size:14.5px; padding:14px 28px; border-radius:8px;
  border:none; cursor:pointer;
}
.btn-primary:hover, .wp-block-button__link:hover{ background:var(--navy-600); color:#fff !important; }
.btn-primary.gold{ background:var(--gold-500); color:#2A1D08 !important; }
.btn-secondary{
  display:inline-flex; align-items:center; gap:8px; background:transparent; color:#fff;
  font-family:var(--font-sans); font-weight:600; font-size:14.5px; padding:13px 27px; border-radius:8px;
  border:1.5px solid rgba(255,255,255,.6);
}
.btn-outline-navy{
  display:inline-flex; align-items:center; gap:8px; background:transparent; color:var(--navy-800);
  font-family:var(--font-sans); font-weight:600; font-size:14.5px; padding:13px 27px; border-radius:8px;
  border:1.5px solid var(--navy-800);
}
.tag{
  font-weight:600; font-size:11px; letter-spacing:.04em; text-transform:uppercase;
  padding:5px 12px; border-radius:999px; display:inline-block;
}
.tag-environment{ background:var(--green-100); color:var(--green-700); }
.tag-health{ background:var(--navy-100); color:var(--navy-800); }
.tag-community{ background:var(--gold-100); color:var(--gold-700); }

.photo-frame{ position:relative; overflow:hidden; }
.photo-frame img{ width:100%; height:100%; object-fit:cover; }

/* ---------- Site header ---------- */
.namo-header{
  background:#fff; border-bottom:1px solid var(--border); position:sticky; top:0; z-index:999;
}
.namo-header .inner{
  max-width:1160px; margin:0 auto; padding:0 40px; height:112px;
  display:flex; align-items:center; justify-content:space-between; gap:24px;
}
/* Astra's own "Logo Width" Customizer control governs the actual logo
   size — it applies its chosen width as an inline style on the <img>
   itself, which always wins over an external `height:` rule (that was
   the actual overflow bug: this used to set `height` here, which an
   inline style simply overrides). `max-height` is a different property
   that isn't overridden that way — it clamps the final rendered size
   regardless of what set the base width/height — so it's what reliably
   keeps the logo from growing past the header bar no matter what width
   is chosen in Astra's control. */
.namo-logo{ display:flex; align-items:center; flex:none; margin-right:auto; }
/* Astra's Logo Width control sets an inline `width` on the <img> — with
   only `max-height` fighting that, the image was forced to that fixed
   width while its height got clamped down, squashing the aspect ratio.
   `!important` on width/height here forces it back to a proportional
   scale; max-width/max-height still cap the final rendered size. */
.namo-logo img{ width:auto !important; height:auto !important; max-width:230px; max-height:95px; }
.namo-nav{ display:flex; gap:28px; font-family:var(--font-sans); font-size:14.5px; font-weight:600; }
.namo-nav ul{ list-style:none; display:flex; gap:28px; margin:0; padding:0; }
.namo-nav a{ color:var(--ink-700); white-space:nowrap; }
.namo-nav .current-menu-item > a, .namo-nav a.active{ color:var(--navy-800); }
/* Dropdown for menu items with children (e.g. "Our Initiatives"). Astra's
   wp_nav_menu filters also inject their own toggle button/arrow markup for
   its own JS-driven dropdown system — the inline one is hidden for good
   (it sits inside the <a>, awkward to reuse cleanly); the standalone
   .ast-menu-toggle button is hidden on desktop but reused at mobile width
   below, since it's already a proper separate click target next to the
   link rather than something we'd need to add from scratch. */
.namo-nav li{ position:relative; }
.namo-nav .dropdown-menu-toggle{ display:none; }
.namo-nav .ast-menu-toggle{ display:none; }
.namo-nav .sub-menu{
  display:none; position:absolute; top:100%; left:0; z-index:1000;
  flex-direction:column; gap:0; min-width:230px; margin:0; padding:8px 0;
  background:#fff; border-radius:10px; border:1px solid var(--border); box-shadow:var(--shadow-2);
}
.namo-nav .sub-menu li{ width:100%; }
.namo-nav .sub-menu a{ display:block; padding:10px 18px; white-space:nowrap; }
.namo-nav .sub-menu a:hover{ background:var(--paper-50); color:var(--navy-800); }
.namo-nav .menu-item-has-children > a{ display:inline-flex; align-items:center; gap:6px; }
.namo-nav .menu-item-has-children > a::after{
  content:''; width:7px; height:7px; border-right:2px solid currentColor; border-bottom:2px solid currentColor;
  transform:rotate(45deg); transition:transform .2s ease; margin-top:-3px;
}
/* Hover/focus-within opening + chevron rotation must be desktop-only: on
   mobile, tapping the .ast-menu-toggle button focuses it, which keeps
   :focus-within true (and the submenu forced open via this rule) even
   after main.js removes .is-open — closing the dropdown looked broken
   because this rule was silently overriding the mobile accordion state. */
@media (min-width: 1201px){
  .namo-nav li:hover > .sub-menu, .namo-nav li:focus-within > .sub-menu{ display:flex; }
  .namo-nav li:hover > a::after, .namo-nav li:focus-within > a::after{ transform:rotate(-135deg); margin-top:3px; }
}
.namo-header-actions{ display:flex; align-items:center; gap:16px; flex:none; }
.namo-header-actions .btn-primary{ padding:11px 22px; font-size:13.5px; white-space:nowrap; }
.namo-menu-toggle{
  display:none; background:none; border:none; cursor:pointer; padding:8px; flex-direction:column; gap:5px; flex:none;
}
.namo-menu-toggle:hover, .namo-menu-toggle:focus, .namo-menu-toggle:active{
  background:none; border:none; outline:none; box-shadow:none;
}
.namo-menu-toggle span{ width:24px; height:2px; background:var(--navy-800); display:block; }
/* Duplicates of the CTA buttons, shown only inside the mobile dropdown
   (.namo-nav) once the persistent header bar hides them below — so the
   actions aren't lost, just relocated. Hidden on desktop since .namo-nav
   itself is a plain horizontal bar there. */
.namo-nav-mobile-actions{ display:none; }

/* ---------- Site footer ---------- */
.namo-footer{ background:var(--navy-900); padding:56px 0 32px; }
.namo-footer .inner{ max-width:1160px; margin:0 auto; padding:0 40px; }
.namo-footer-grid{
  display:grid; grid-template-columns:1.5fr 1fr 1fr 1.2fr; gap:32px; padding-bottom:40px;
  border-bottom:1px solid rgba(255,255,255,.12);
}
.namo-footer-logo{ background:var(--paper-0); display:inline-flex; align-items:center; padding:10px 16px; border-radius:10px; }
.namo-footer-logo img{ width:auto; max-height:72px; }
.namo-footer p, .namo-footer a, .namo-footer span, .namo-footer div{ color:var(--navy-200); }
.namo-footer-social{ display:flex; gap:10px; margin-top:18px; }
.namo-footer-social a{
  display:flex; align-items:center; justify-content:center; width:36px; height:36px;
  border-radius:50%; border:1px solid rgba(255,255,255,.18); color:var(--navy-200);
  transition:background .15s ease, border-color .15s ease, color .15s ease;
}
.namo-footer-social a:hover{ background:var(--gold-500); border-color:var(--gold-500); color:#2A1D08; }
.namo-footer h4{ color:#fff; font-family:var(--font-sans); font-weight:600; font-size:13.5px; margin:0 0 8px; }
.namo-footer .col{ font-family:var(--font-sans); font-size:13.5px; line-height:2.3; }
.namo-footer-bottom{
  display:flex; justify-content:space-between; padding-top:24px; font-family:var(--font-sans);
  font-size:12px; flex-wrap:wrap; gap:10px;
}

/* ---------- Default Astra page/post rendering ----------
   Only pages WITHOUT one of our /templates/page-*.php templates fall back
   to Astra's own page.php (its #primary/.entry-content markup) — e.g. the
   auto-generated Privacy Policy page, 404, search results. Astra's global
   "Container Layout" setting is "Normal Width Container", which (despite
   the name) maps to its edge-to-edge `ast-plain-container` class with no
   width limit. Rather than change that site-wide setting — which also
   governs blog/archive pages — constrain #primary itself to match the
   rest of the site's container width. */
#primary.content-area{
  max-width:840px; margin:0 auto; padding:64px 40px 96px;
}
#primary .entry-content{ font-family:var(--font-sans); font-size:16px; line-height:1.75; color:var(--ink-700); }

/* ---------- Section building blocks (used by page templates) ---------- */
.namo-section{ padding:88px 0; }
.namo-section.tight{ padding:64px 0; }
.namo-section.paper-50{ background:var(--paper-50); }
.namo-section.navy{ background:var(--navy-900); }
.namo-section.navy h2, .namo-section.navy .eyebrow{ color:#fff; }
.namo-section.navy p{ color:var(--navy-200); margin-bottom:0; }
.namo-cta-band{ background:linear-gradient(120deg,var(--navy-900),var(--navy-800)); padding:80px 0; text-align:center; }
.namo-cta-band h2{ color:#fff; }
.namo-cta-band p{ color:var(--navy-200); }

.namo-grid-3{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; }
.namo-grid-4{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:20px; }
.namo-grid-5{ display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:20px; }
.namo-split{ display:grid; grid-template-columns:1fr 1fr; gap:56px; align-items:center; }

.namo-card{ background:#fff; border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow-1); }
.namo-empty-stat{
  border:1.5px dashed var(--border); border-radius:16px; padding:28px 20px; text-align:center; background:var(--paper-50);
}
.namo-empty-stat svg{ margin:0 auto 12px; display:block; }
.namo-empty-stat .value{ font-family:var(--font-serif); font-weight:700; font-size:36px; color:var(--navy-800); }
.namo-empty-stat .label{ font-family:var(--font-sans); font-size:13px; color:var(--ink-700); }
.namo-empty-stat .muted{ color:var(--ink-400); }

.filter-pill{
  font-family:var(--font-sans); font-weight:600; font-size:13.5px; padding:9px 20px; border-radius:999px;
  border:1.5px solid var(--border); background:#fff; color:var(--ink-700); cursor:pointer;
}
.filter-pill.active{ background:var(--navy-800); border-color:var(--navy-800); color:#fff; }

label{ font-family:var(--font-sans); font-size:12.5px; font-weight:600; color:var(--navy-800); display:block; margin-bottom:7px; }
input[type=text], input[type=email], input[type=tel], select, textarea{
  width:100%; border:1.5px solid var(--border); border-radius:8px; padding:12px 14px;
  font-family:var(--font-sans); font-size:14.5px; color:var(--ink-900); background:#fff;
}
input:focus, select:focus, textarea:focus{
  outline:none; border-color:var(--navy-800); box-shadow:0 0 0 3px var(--navy-100);
}

/* ---------- Contact Form 7 — inherits the input/select/textarea styling
   above automatically (same tag/type selectors); this just covers CF7's
   own markup (field spacing via .namo-field, submit button, validation
   messages). .namo-field / .namo-field-grid / .namo-field-submit are our
   own wrapper classes used in the form templates, not CF7 defaults. ---------- */
.namo-cf7-wrap .namo-field{ margin:0 0 18px; }
.namo-cf7-wrap .namo-field-grid{ display:grid; grid-template-columns:1fr 1fr; gap:20px; margin:0 0 18px; }
.namo-cf7-wrap .namo-field-grid .namo-field{ margin:0; }
.namo-cf7-wrap .namo-field-submit{ margin:4px 0 0; }
.namo-cf7-wrap .wpcf7-form label{ width:100%; }
@media (max-width: 600px){
  .namo-cf7-wrap .namo-field-grid{ grid-template-columns:1fr; }
}
.namo-cf7-wrap input[type=submit]{
  display:inline-flex; align-items:center; gap:8px; background:var(--gold-500); color:#2A1D08;
  font-family:var(--font-sans); font-weight:600; font-size:14.5px; padding:14px 28px; border-radius:8px;
  border:none; cursor:pointer;
}
.namo-cf7-wrap input[type=submit]:hover{ background:var(--gold-700); color:#fff; }
.namo-cf7-wrap .wpcf7-not-valid-tip{ color:var(--error); font-size:12.5px; margin-top:4px; }
.namo-cf7-wrap .wpcf7-response-output{
  border-radius:8px; padding:12px 16px; font-family:var(--font-sans); font-size:13.5px; margin-top:16px;
}
.namo-cf7-wrap form.sent .wpcf7-response-output{ border-color:var(--green-500); color:var(--green-700); background:var(--green-100); }
.namo-cf7-wrap form.failed .wpcf7-response-output, .namo-cf7-wrap form.aborted .wpcf7-response-output{ border-color:var(--error); color:var(--error); background:#FBEAE7; }
.namo-cf7-wrap form.spam .wpcf7-response-output{ border-color:var(--error); color:var(--error); background:#FBEAE7; }

/* ---------- Step/timeline connector ----------
   Used by the About page's "Our Approach" steps and the Impact page's
   "Our Journey" milestones. Desktop: a horizontal line runs through the
   row, behind the circles. --step-line-offset must be set per row
   (inline) to each page's own circle radius, since it positions the line
   two different ways depending on breakpoint (see below).
   Below 900px — the same breakpoint the other grid-to-stack conversions
   in this file use — the row itself switches to a vertical timeline
   (stacked items, icon-left/text-right) instead of just wrapping into a
   multi-per-row grid, which reads better on narrow screens. The line
   pivots from horizontal (top offset) to vertical (left offset, same
   --step-line-offset value: it's "half the circle's size" either way,
   since the circle sits at the same top-left corner of its item in both
   layouts). `!important` is needed here because these properties are
   already set inline on the row/item elements for the desktop layout. */
.namo-step-row{ position:relative; }
.namo-step-row::before{
  content:''; position:absolute; top:var(--step-line-offset, 23px); left:6%; right:6%;
  height:2px; background:var(--border); z-index:0;
}
@media (max-width: 900px){
  .namo-step-row{
    flex-direction:column !important; align-items:stretch !important; gap:28px !important;
    max-width:480px; margin-left:auto !important; margin-right:auto !important;
  }
  .namo-step-row.is-journey{ max-width:200px; }
  .namo-step-row::before{
    top:0; bottom:0; left:var(--step-line-offset, 23px); right:auto; width:2px; height:auto;
  }
  .namo-step-item{
    flex-direction:row !important; align-items:flex-start !important; text-align:left !important;
    width:100% !important; flex:none !important; min-width:0 !important;
  }
  /* On About, the title and description are two separate elements next to
     the icon (not one grouped block) — without this they become two more
     side-by-side row items instead of a stacked text column, which is why
     titles/descriptions were colliding and drifting per row. */
  .namo-step-item .namo-step-text{ flex:1; min-width:0; }
  .namo-step-item p, .namo-step-item span{ max-width:none !important; }
}

/* ---------- Responsive ---------- */

/* Header/nav collapses to the mobile menu at a wider breakpoint than the
   rest of the page content: 7 nav items + both header CTAs + the logo
   genuinely need more room than a typical laptop screen gives a
   max-width:1160px container (that's a fixed shortfall, not something
   that only shows at "narrow" widths — squeezing gaps/font-size further
   would only postpone it a little). Rather than cram and let individual
   nav labels wrap mid-phrase, the mobile dropdown menu (already built)
   takes over earlier instead. */
@media (max-width: 1200px){
  .namo-header .inner{ padding:0 20px; height:88px; }
  .namo-logo img{ max-height:70px; }
  /* top uses --namo-header-h (set by main.js from the header's actual
     rendered position) instead of a hardcoded 88px, so the panel lines
     up correctly even when the WP admin bar pushes the header down. */
  .namo-nav{ display:none; position:fixed; top:var(--namo-header-h, 88px); left:0; right:0; bottom:0; background:#fff; flex-direction:column;
    padding:24px; overflow-y:auto; z-index:998; }
  .namo-nav.is-open{ display:flex; }
  .namo-nav ul{ flex-direction:column; gap:0; width:100%; }
  .namo-nav li{ border-bottom:1px solid var(--border); }
  .namo-nav a{ display:block; padding:16px 4px; font-size:16px; }
  .namo-header-actions .namo-volunteer-link{ display:none; }
  .namo-menu-toggle{ display:flex; }
  .namo-nav-mobile-actions{
    display:flex; flex-direction:row; flex-wrap:wrap; gap:12px; margin-top:24px; padding-top:20px;
    border-top:1px solid var(--border);
  }
  .namo-nav-mobile-actions a{ flex:1 1 auto; justify-content:center; text-align:center; }
  /* Hover doesn't work on touch, so the submenu becomes a tap-to-open/close
     accordion instead: collapsed by default, expanded via the .is-open
     class main.js toggles on the <li> when its .ast-menu-toggle button is
     tapped (a real separate button already in Astra's own menu markup —
     reused here rather than adding a new one — so tapping it toggles the
     submenu while tapping the label text still navigates normally). */
  .namo-nav .menu-item-has-children > a{ padding-right:44px; }
  .namo-nav .menu-item-has-children > a::after{ display:none; } /* replaced by the button's own chevron below */
  .namo-nav .ast-menu-toggle{
    display:flex; align-items:center; justify-content:center;
    position:absolute; top:2px; right:0; width:48px; height:48px;
    background:none; border:none; cursor:pointer; padding:0;
  }
  .namo-nav .ast-menu-toggle svg{ display:none; }
  .namo-nav .ast-menu-toggle::after{
    content:''; width:8px; height:8px; border-right:2px solid var(--navy-800); border-bottom:2px solid var(--navy-800);
    transform:rotate(45deg); transition:transform .2s ease;
  }
  .namo-nav li.is-open > .ast-menu-toggle::after{ transform:rotate(-135deg); margin-top:5px; }
  .namo-nav .sub-menu{
    display:none; position:static; box-shadow:none; border:none; border-radius:0;
    padding:0 0 0 18px; background:transparent;
  }
  .namo-nav li.is-open > .sub-menu{ display:block; }
  .namo-nav .sub-menu li{ border-bottom:none; }
  .namo-nav .sub-menu a{ padding:12px 4px; font-size:15px; color:var(--ink-700); }
}
/* Below ~480px the logo + "Support Our Mission" button + hamburger no
   longer all fit on one row — hide the persistent button here (it's
   still reachable inside the mobile dropdown via .namo-nav-mobile-actions
   above) so only the logo and hamburger remain in the fixed header bar. */
@media (max-width: 480px){
  .namo-header-actions .btn-primary{ display:none; }
}
@media (max-width: 900px){
  .namo-split{ grid-template-columns:1fr !important; }
  .namo-grid-3{ grid-template-columns:1fr !important; }
  .namo-grid-4{ grid-template-columns:repeat(2,1fr) !important; }
  .namo-grid-5{ grid-template-columns:repeat(2,1fr) !important; }
  .namo-footer-grid{ grid-template-columns:1fr 1fr !important; }
  h1{ font-size:32px !important; }
}
@media (max-width: 560px){
  .namo-footer-grid{ grid-template-columns:1fr !important; }
  .namo-grid-4{ grid-template-columns:1fr !important; }
  .namo-grid-5{ grid-template-columns:1fr !important; }
}
