/* ==========================================================================
   Dharamveer Sewa Foundation — base styles
   1. Design tokens  2. Reset  3. Typography  4. Layout  5. Utilities
   ========================================================================== */

/* Metric-matched fallbacks: text occupies the same space before and after the
   web fonts swap in, so the page doesn't jump (CLS). */
@font-face {
  font-family: "Poppins Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Roboto");
  ascent-override: 92.33%;
  descent-override: 30.78%;
  line-gap-override: 8.79%;
  size-adjust: 113.73%;
}
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Roboto");
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
  size-adjust: 107.12%;
}

/* 1. Design tokens ------------------------------------------------------- */
:root {
  /* Brand — saffron (action), sacred green (trust), gold (logo), cream (warmth) */
  --saffron-50: #fff4e8;
  --saffron-100: #ffe6cc;
  --saffron-300: #fbb46a;
  --saffron-400: #f7962f;
  --saffron-500: #ee7a12;
  --saffron-600: #c2410c;   /* buttons: white text 5.2:1 */
  --saffron-700: #a3360a;
  --saffron-800: #7c2a08;

  --green-50: #edf6ef;
  --green-100: #d5eadb;
  --green-500: #2f8a57;
  --green-600: #1f7a4a;
  --green-700: #1b5e3a;
  --green-800: #134630;
  --green-900: #0e2f22;
  --green-950: #0a231a;

  --gold-50: #fbf4e2;
  --gold-200: #efd9a0;
  --gold-300: #e8c872;
  --gold-500: #c9962c;
  --gold-700: #8a6a1f;

  --cream-50: #fffbf5;
  --cream-100: #fff6ea;
  --cream-200: #fbeedb;

  --ink-900: #1f1b16;
  --ink-800: #2e2923;
  --ink-700: #463f37;
  --ink-600: #5e574e;
  --ink-400: #9b9287;
  --line: #ece2d3;
  --line-strong: #dccdb6;
  --white: #ffffff;

  --whatsapp: #1fa855;

  /* Semantic */
  --color-bg: var(--white);
  --color-bg-alt: var(--cream-100);
  --color-text: var(--ink-700);
  --color-heading: var(--ink-900);
  --color-muted: var(--ink-600);
  --color-primary: var(--saffron-600);
  --color-primary-hover: var(--saffron-700);
  --color-accent: var(--saffron-500);
  --color-secondary: var(--green-700);

  /* Typography */
  --font-heading: "Poppins", "Poppins Fallback", "Mukta", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", "Inter Fallback", "Mukta", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-hindi: "Mukta", "Poppins", system-ui, sans-serif;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --fs-h4: 1.125rem;
  --fs-h3: clamp(1.2rem, 1.1rem + 0.45vw, 1.4rem);
  --fs-h2: clamp(1.75rem, 1.3rem + 1.9vw, 2.75rem);
  --fs-h1: clamp(2.1rem, 1.45rem + 2.9vw, 3.75rem);
  --fs-display: clamp(2.4rem, 1.6rem + 3.6vw, 4.5rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --section-y: clamp(3.5rem, 2.4rem + 4.5vw, 6.5rem);
  --gutter: clamp(1rem, 0.6rem + 2vw, 2rem);
  --container: 1200px;

  /* Shape & depth */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(60, 38, 10, 0.06), 0 2px 8px -2px rgba(60, 38, 10, 0.08);
  --shadow: 0 2px 4px rgba(60, 38, 10, 0.04), 0 12px 32px -12px rgba(60, 38, 10, 0.18);
  --shadow-lg: 0 4px 10px rgba(60, 38, 10, 0.05), 0 28px 60px -20px rgba(60, 38, 10, 0.28);
  --shadow-primary: 0 10px 24px -10px rgba(194, 65, 12, 0.6);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 76px;
}

/* 2. Reset --------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, picture, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
p, h1, h2, h3, h4, h5, h6, figure, blockquote, dl, dd { margin: 0; }
:where(ul[class], ol[class]) { list-style: none; margin: 0; padding: 0; }
table { border-collapse: collapse; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--saffron-400);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: var(--saffron-100); color: var(--ink-900); }

@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;
  }
}

/* 3. Typography ---------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
p { text-wrap: pretty; }
strong, b { font-weight: 600; color: var(--ink-800); }

[lang="hi"] { font-family: var(--font-hindi); letter-spacing: 0; }

.lead { font-size: var(--fs-lg); line-height: 1.7; color: var(--ink-600); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-muted { color: var(--color-muted); }
.text-center { text-align: center; }
.text-highlight { color: var(--saffron-600); }
.text-green { color: var(--green-700); }

.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.8rem); margin-top: 2.2em; }
.prose h3 { font-size: 1.2rem; margin-top: 1.8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--saffron-500); }
.prose a { color: var(--saffron-600); font-weight: 500; }

/* 4. Layout -------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: calc(860px + var(--gutter) * 2); }
.container--wide { max-width: calc(1320px + var(--gutter) * 2); }

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(2.5rem, 2rem + 2.5vw, 4rem); }
.section--flush-top { padding-top: 0; }
.section--cream { background: var(--cream-100); }
.section--soft {
  background:
    radial-gradient(60rem 30rem at 100% 0%, rgba(238, 122, 18, 0.07), transparent 60%),
    radial-gradient(50rem 30rem at 0% 100%, rgba(31, 122, 74, 0.06), transparent 60%),
    var(--cream-50);
}
.section--dark {
  background:
    radial-gradient(50rem 30rem at 0% 0%, rgba(232, 200, 114, 0.12), transparent 60%),
    radial-gradient(40rem 30rem at 100% 100%, rgba(238, 122, 18, 0.1), transparent 60%),
    var(--green-900);
  color: #d8e3dc;
}
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--white); }
.section--dark .text-muted, .section--dark .lead { color: #b9c9bf; }

.section-head { max-width: 760px; margin-bottom: clamp(2rem, 1.5rem + 2vw, 3.25rem); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head h2 + p { margin-top: var(--space-4); }
.section-head .eyebrow + h2 { margin-top: var(--space-4); }
.section-head--split {
  max-width: none;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-5);
}
.section-head--split > div { max-width: 640px; }

.grid { display: grid; gap: var(--grid-gap, clamp(1rem, 0.7rem + 1.2vw, 1.75rem)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 260px)), 1fr)); }

@media (min-width: 1024px) {
  .grid-3.grid--fixed { grid-template-columns: repeat(3, 1fr); }
  .grid-4.grid--fixed { grid-template-columns: repeat(4, 1fr); }
}

.split {
  display: grid;
  gap: clamp(2rem, 1rem + 4vw, 5rem);
  align-items: center;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split--wide-left { grid-template-columns: 1.15fr 0.85fr; }
  .split--wide-right { grid-template-columns: 0.85fr 1.15fr; }
  .split--reverse > :first-child { order: 2; }
}

.stack > * + * { margin-top: var(--stack, var(--space-4)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster, var(--space-3)); }
@media (max-width: 479px) {
  /* Paired call-to-action buttons share the row evenly on phones */
  .cluster > .btn--lg { flex: 1 1 auto; padding-inline: 1.1rem; min-height: 52px; font-size: 1rem; }
}

/* 5. Utilities ------------------------------------------------------------ */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.mt-0 { margin-top: 0 !important; }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-7 { margin-top: var(--space-7); }
.mx-auto { margin-inline: auto; }
.w-full { width: 100%; }

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 1000;
  background: var(--ink-900); color: var(--white);
  padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* Scroll reveal (only when JS is running) */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--delay, 0s);
}
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
}
