/*
Theme Name: Vimarsh
Theme URI: https://www.vimarsh.org.in
Author: Vimarsh
Author URI: https://www.vimarsh.org.in
Description: Custom theme for Vimarsh — a community-based NGO working with women, adolescents and children in Nainital district, Uttarakhand. Editorial, warm, accessible. Colours and fonts are theme-level tokens (see top of this file) — swap them for Vimarsh's real brand once available; nothing else in the theme hard-codes a colour.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: vimarsh
*/

/* ============================================================================
   VIMARSH DESIGN SYSTEM
   Temporary visual identity — isolated in this file (tokens at the top) so it
   can be swapped for Vimarsh's real brand colours/fonts/logo without touching
   any component markup. See README.md "Rebranding" section.
   ============================================================================ */

:root {
  /* ---- Brand tokens (TEMPORARY — replace when Vimarsh brand guide arrives) ---- */
  --color-primary: #c1502e;       /* terracotta */
  --color-primary-dark: #9c3e22;
  --color-secondary: #1f4b3f;     /* deep forest */
  --color-secondary-light: #2c6754;
  --color-bg: #fbf6ee;            /* warm cream */
  --color-bg-alt: #f4ecdd;
  --color-sand: #ede1ce;
  --color-clay: #e3c9b4;
  --color-border: #ddd2bf;
  --color-text: #241f1a;
  --color-text-muted: #5c5346;
  --color-white: #ffffff;
  --color-focus: #1f4b3f;
  --color-info-bg: #fdf1e4;
  --color-info-border: #d98a3d;

  /* ---- Type ---- */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* ---- Scale ---- */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.95rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.5rem, 1.3rem + 0.8vw, 1.9rem);
  --step-3: clamp(1.9rem, 1.6rem + 1.4vw, 2.6rem);
  --step-4: clamp(2.4rem, 1.9rem + 2.2vw, 3.6rem);
  --step-5: clamp(2.9rem, 2.1rem + 3.6vw, 4.8rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;
  --space-7: 9rem;

  --max-width: 76rem;
  --radius: 4px;
  --transition: 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 var(--space-2); color: var(--color-text); }
h1 { font-size: var(--step-5); font-weight: 500; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p { margin: 0 0 var(--space-2); }
a { color: inherit; text-decoration-color: var(--color-primary); }
ul, ol { padding-left: 1.2em; }
main { display: block; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-secondary);
  color: var(--color-white);
  padding: 0.75em 1.25em;
  z-index: 200;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ---- Layout helpers ---- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-3); }
.section { padding: var(--space-6) 0; }
.section--tight { padding: var(--space-5) 0; }
.section--alt { background: var(--color-bg-alt); }
.section--dark { background: var(--color-secondary); color: var(--color-white); }
.section--dark h2, .section--dark h3 { color: var(--color-white); }
.eyebrow {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary-dark); /* darker than brand primary — #c1502e alone fails WCAG AA at this text size */
  font-weight: 600;
  margin-bottom: var(--space-2);
  display: inline-block;
}
.section--dark .eyebrow { color: var(--color-clay); }
.lede { font-size: var(--step-1); color: var(--color-text-muted); max-width: 46rem; }
.section--dark .lede { color: #d9ded9; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--step--1);
  letter-spacing: 0.01em;
  padding: 0.9em 1.6em;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--color-primary); color: var(--color-white); }
.btn--primary:hover { background: var(--color-primary-dark); }
.btn--secondary { background: transparent; color: var(--color-secondary); border-color: var(--color-secondary); }
.btn--secondary:hover { background: var(--color-secondary); color: var(--color-white); }
.section--dark .btn--secondary { color: var(--color-white); border-color: rgba(255,255,255,0.6); }
.section--dark .btn--secondary:hover { background: var(--color-white); color: var(--color-secondary); }
.btn--ghost { background: transparent; color: var(--color-primary); padding-left: 0; padding-right: 0; }
.btn--ghost:hover { text-decoration: underline; }
.btn--block { width: 100%; justify-content: center; }

/* ---- Header / Nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 246, 238, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  text-decoration: none;
  color: var(--color-text);
}
.brand__mark {
  width: 2.2em; height: 2.2em;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-white);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.55em;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.primary-nav { display: none; }
.primary-nav__list { list-style: none; display: flex; gap: var(--space-4); margin: 0; padding: 0; }
.primary-nav__list a {
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--color-text);
  padding: 0.4em 0;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition), color var(--transition);
}
.primary-nav__list a:hover,
.primary-nav__list a[aria-current="page"],
.primary-nav__list .current-menu-item > a,
.primary-nav__list .current_page_item > a { border-color: var(--color-primary); color: var(--color-primary-dark); }
.header-actions { display: flex; align-items: center; gap: var(--space-2); }
.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5em 0.8em;
  font-size: var(--step--1);
  cursor: pointer;
}
.nav-toggle__icon { width: 1.1em; height: 0.85em; position: relative; display: inline-block; }
.nav-toggle__icon span, .nav-toggle__icon::before, .nav-toggle__icon::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: currentColor;
}
.nav-toggle__icon::before { top: 0; }
.nav-toggle__icon span { top: 50%; transform: translateY(-50%); }
.nav-toggle__icon::after { bottom: 0; }

.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 150;
  padding: var(--space-3);
  overflow-y: auto;
}
.mobile-nav[data-open="true"] { display: block; }
.mobile-nav__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.mobile-nav__close { background: none; border: none; font-size: 1.6rem; cursor: pointer; line-height: 1; padding: 0.2em; }
.mobile-nav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.mobile-nav__list a { text-decoration: none; font-family: var(--font-display); font-size: var(--step-2); color: var(--color-text); }
.mobile-nav__cta { margin-top: var(--space-4); }

@media (min-width: 60em) {
  .primary-nav { display: block; }
  .nav-toggle { display: none; }
}

/* ---- Hero ---- */
.hero {
  padding: var(--space-5) 0 var(--space-6);
}
.hero__grid {
  display: grid;
  gap: var(--space-4);
  align-items: center;
}
.hero__headline { margin-bottom: var(--space-2); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.hero__media { order: -1; }

@media (min-width: 60em) {
  .hero__grid { grid-template-columns: 1.1fr 0.9fr; }
  .hero__media { order: 0; }
}

/* ---- Placeholder image block ---- */
.placeholder-image {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, var(--color-sand), var(--color-sand) 10px, var(--color-clay) 10px, var(--color-clay) 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px dashed var(--color-primary);
}
.placeholder-image--wide { aspect-ratio: 16 / 9; }
.placeholder-image--square { aspect-ratio: 1 / 1; }
.placeholder-image--tall { aspect-ratio: 3 / 4; }

/* ---- Real uploaded photo (WordPress Featured Image / Customizer image
   controls) — same shape/crop treatment as the placeholder it replaces, so
   nothing shifts or looks inconsistent once real photography is added.
   The --wide/--standard/--square/--tall modifiers are chosen per-image from
   wp-admin (Programme/Story "Photo display size" field, or the Customizer
   photo-size dropdowns) — a curated, layout-safe set of display sizes
   rather than free-form pixel dimensions, which would risk stretching
   photos or breaking the grid they sit in. ---- */
.vimarsh-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  object-fit: cover;
}
.vimarsh-photo.placeholder-image--wide { aspect-ratio: 16 / 9; }
.vimarsh-photo.placeholder-image--square { aspect-ratio: 1 / 1; }
.vimarsh-photo.placeholder-image--tall { aspect-ratio: 3 / 4; }
.placeholder-image__label {
  background: rgba(36, 31, 26, 0.85);
  color: var(--color-white);
  font-size: var(--step--1);
  font-weight: 600;
  padding: 0.6em 1em;
  border-radius: var(--radius);
  margin: var(--space-2);
  max-width: 90%;
}

/* ---- Info required badge ---- */
.info-required {
  display: block;
  background: var(--color-info-bg);
  border: 1.5px dashed var(--color-info-border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  font-size: var(--step--1);
  color: #6b4420;
  margin: var(--space-2) 0;
}
.info-required strong { display: inline-block; margin-right: 0.4em; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.85em; }

/* ---- Section heading ---- */
.section-heading { max-width: 42rem; margin-bottom: var(--space-4); }

/* ---- Cards / grid ---- */
.grid { display: grid; gap: var(--space-3); }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
@media (min-width: 48em) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.programme-card {
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.programme-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px -18px rgba(36,31,26,0.4); }
.programme-card__body { padding: var(--space-3); display: flex; flex-direction: column; flex: 1; }
.programme-card__tag {
  font-size: var(--step--1); font-weight: 600; color: var(--color-secondary);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4em;
}
.programme-card__tag--unverified { color: #6b4420; } /* darker than --color-info-border — that shade fails WCAG AA as text */
.programme-card__body p { color: var(--color-text-muted); flex: 1; }

/* ---- Stat strip ---- */
.stat-strip { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 42em) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60em) { .stat-strip { grid-template-columns: repeat(3, 1fr); } }
.stat {
  border-top: 3px solid var(--color-primary);
  padding-top: var(--space-2);
}
.stat__value {
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 600;
  color: var(--color-secondary);
  line-height: 1;
  display: block;
}
.stat__label { font-weight: 600; margin-top: 0.3em; }
.stat__sub { color: var(--color-text-muted); font-size: var(--step--1); }

/* ---- Process steps ---- */
.steps { display: grid; gap: var(--space-3); counter-reset: step; }
@media (min-width: 48em) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { position: relative; padding-top: var(--space-3); }
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: var(--step-2);
  color: var(--color-primary);
  display: block;
  margin-bottom: 0.3em;
}

/* ---- Quote / story ---- */
.quote {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.4;
  border-left: 3px solid var(--color-primary);
  padding-left: var(--space-3);
  margin: 0;
}
.quote__attribution { display: block; margin-top: var(--space-2); font-family: var(--font-body); font-size: var(--step--1); font-weight: 600; color: var(--color-text-muted); }

.story-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.story-card__body { padding: var(--space-3); }
.story-card__meta { font-size: var(--step--1); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.empty-state {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-3);
  text-align: center;
  max-width: 42rem;
  margin: 0 auto;
}

/* ---- CTA section ---- */
.cta-section { text-align: center; }
.cta-section .btn { margin: var(--space-1); }

/* ---- Table ---- */
table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
th, td { text-align: left; padding: 0.7em 1em; border-bottom: 1px solid var(--color-border); }
th { font-family: var(--font-display); font-weight: 600; }

/* ---- Breadcrumb ---- */
.breadcrumb { font-size: var(--step--1); color: var(--color-text-muted); margin-bottom: var(--space-3); }
.breadcrumb a { color: var(--color-text-muted); text-decoration: underline; }

/* ---- Forms ---- */
.form-field { margin-bottom: var(--space-2); display: flex; flex-direction: column; gap: 0.4em; }
.form-field label { font-weight: 600; font-size: var(--step--1); }
.form-field input, .form-field textarea, .form-field select {
  font: inherit;
  padding: 0.7em 0.9em;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-white);
}

/* ---- Footer ---- */
.site-footer { background: var(--color-secondary); color: var(--color-white); padding: var(--space-6) 0 var(--space-3); }
.site-footer a { color: var(--color-white); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; margin-bottom: var(--space-5); }
@media (min-width: 48em) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.footer-grid h4 { color: var(--color-white); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-body); font-weight: 700; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6em; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.2);
  padding-top: var(--space-3);
  display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: space-between; align-items: center;
  font-size: var(--step--1);
  color: rgba(255,255,255,0.75);
}
.social-links { display: flex; gap: var(--space-2); list-style: none; padding: 0; margin: 0; }

/* ---- Scroll reveal ----
   Progressive enhancement: content is fully visible by default (no-JS, JS-
   failed, or JS-still-loading users always see everything). Only once the
   early head script confirms JS is running (html.js) do .reveal elements
   start hidden, ready to be animated in on scroll by main.js. */
.reveal { opacity: 1; transform: none; }
html.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms ease, transform 700ms ease;
}
html.js .reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---- Utility ---- */
.mt-0 { margin-top: 0; }
.text-center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: var(--space-2); }
.tag-list { list-style: none; padding: 0; margin: var(--space-2) 0; display: flex; flex-wrap: wrap; gap: 0.5em; }
.tag-list li { background: var(--color-sand); border-radius: 999px; padding: 0.35em 0.9em; font-size: var(--step--1); }

/* ---- WordPress-specific additions ---- */
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Keep the sticky header below the WP admin toolbar for logged-in editors */
.admin-bar .site-header { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar .site-header { top: 46px; }
}

/* Native WP gallery/caption/alignment classes used if editors add them inside page content */
.alignwide { max-width: 90rem; }
.alignfull { max-width: none; width: 100%; }
.wp-caption-text { font-size: var(--step--1); color: var(--color-text-muted); }
img.aligncenter { margin-left: auto; margin-right: auto; }
