/* ============================================
   MUKUNDRAJ FOUNDATION — DESIGN SYSTEM
   ============================================ */

:root {
  /* Brand */
  --saffron: #B45309;
  --saffron-deep: #7C2D12;
  --saffron-soft: #DC8B3F;
  --gold: #FBBF24;
  --gold-soft: #FDE68A;
  --ivory: #FEF9EE;
  --ivory-deep: #F5EBD3;
  --ink: #1C1917;
  --ink-soft: #44403C;
  --ink-mute: #78716C;
  --line: #E7DDC4;
  --paper: #FFFDF7;

  /* Type */
  --display: 'Mukta', system-ui, sans-serif;
  --body: 'Hind', system-ui, sans-serif;
  --serif: 'Tiro Devanagari Hindi', 'Mukta', serif;

  /* Spacing rhythm */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section: clamp(4rem, 9vw, 8rem);

  --radius: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }

/* ----- Typography ----- */
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: clamp(2.5rem, 6vw, 4.75rem); font-weight: 800; }
h2 { font-size: clamp(2rem, 4vw, 3.25rem); }
h3 { font-size: clamp(1.35rem, 2vw, 1.75rem); }
h4 { font-size: 1.15rem; }

.eyebrow {
  font-family: var(--body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--saffron);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.eyebrow::before {
  content: '';
  width: 24px; height: 1px;
  background: currentColor;
}

.devanagari {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.lead { font-size: 1.2rem; line-height: 1.55; color: var(--ink-soft); max-width: 60ch; }

/* ----- Layout ----- */
.wrap {
  width: min(1240px, 100% - 2*var(--gutter));
  margin-inline: auto;
}
.wrap-narrow { width: min(820px, 100% - 2*var(--gutter)); margin-inline: auto; }

section { padding-block: var(--section); }

/* ----- Header ----- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(254, 249, 238, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem;
  padding-block: 1.1rem;
  width: min(1240px, 100% - 2*var(--gutter));
  margin-inline: auto;
}
.brand { display: flex; align-items: center; gap: 0.85rem; flex-shrink: 0; }
.brand-mark { width: 46px; height: 46px; flex-shrink: 0; }
.brand-name {
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: 0.005em; line-height: 1.15;
}
.brand-name small {
  display: block; font-weight: 400; font-size: 0.72rem;
  color: var(--ink-mute); letter-spacing: 0.18em; text-transform: uppercase;
  margin-top: 2px;
}

.nav { display: flex; align-items: center; gap: 1.75rem; }
.nav a {
  font-size: 0.95rem; font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  padding-block: 0.25rem;
}
.nav a:hover { color: var(--saffron); }
.nav a.active { color: var(--saffron); }
.nav a.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--gold);
}

.header-right { display: flex; align-items: center; gap: 1rem; }

.lang-toggle {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--ivory-deep);
  border-radius: 999px;
  font-family: var(--body);
}
.lang-toggle button {
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--ink-soft);
  transition: background 0.2s, color 0.2s;
}
.lang-toggle button.active { background: var(--saffron); color: var(--paper); }

.btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.85rem 1.4rem; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem;
  background: var(--saffron); color: var(--paper);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:hover { background: var(--saffron-deep); transform: translateY(-1px); box-shadow: 0 8px 22px -10px rgba(180,83,9,0.6); }
.btn-ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--ivory); }
.btn-gold { background: var(--ink); color: var(--gold); }
.btn-gold:hover { background: var(--saffron-deep); color: var(--gold); }
.btn-sm { padding: 0.55rem 1rem; font-size: 0.85rem; }

/* ----- Ornament dividers ----- */
.ornament {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; margin: 0 auto;
  color: var(--saffron);
  opacity: 0.7;
}
.ornament::before, .ornament::after {
  content: ''; flex: 1; max-width: 100px;
  height: 1px; background: linear-gradient(90deg, transparent, var(--saffron), transparent);
}

/* ----- Cards ----- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px -24px rgba(28,25,23,0.25); border-color: var(--gold); }

/* ----- Imagery placeholders ----- */
.placeholder {
  position: relative;
  background:
    repeating-linear-gradient(135deg,
      var(--ivory-deep) 0 8px,
      var(--ivory) 8px 16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-mute);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  overflow: hidden;
  aspect-ratio: 4/3;
}
.placeholder.portrait { aspect-ratio: 3/4; }
.placeholder.wide { aspect-ratio: 16/9; }
.placeholder.square { aspect-ratio: 1/1; }

/* ----- Footer ----- */
.site-footer {
  background: var(--ink);
  color: var(--ivory-deep);
  padding-block: 4.5rem 2rem;
  margin-top: var(--section);
}
.site-footer h4 {
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 1.25rem;
}
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-grid p, .footer-grid a {
  color: rgba(254,249,238,0.7);
  font-size: 0.95rem;
  line-height: 1.8;
}
.footer-grid a:hover { color: var(--gold); }
.footer-grid ul { list-style: none; }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 2rem;
  font-size: 0.85rem;
  color: rgba(254,249,238,0.45);
  flex-wrap: wrap; gap: 1rem;
}

/* ----- Utility ----- */
.mute { color: var(--ink-mute); }
.center { text-align: center; }
.divider { height: 1px; background: var(--line); margin-block: 3rem; }

/* Responsive */
@media (max-width: 1024px) {
  .nav { display: none; }
}
@media (max-width: 880px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .header-right .lang-toggle { display: inline-flex; }
}
@media (max-width: 540px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .brand-name small { display: none; }
}

/* ============================================
   HAMBURGER + MOBILE MENU (always defined)
   ============================================ */
.nav-toggle {
  display: none;
  width: 48px; height: 48px;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--ivory);
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 5rem 1rem 2rem;
  text-align: center;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ink);
  padding: 0.85rem 1.5rem;
  min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
}
.mobile-menu a.active { color: var(--saffron); }
.mobile-menu a.btn {
  margin-top: 1rem;
  font-size: 1.05rem;
  color: var(--paper);
  width: min(280px, 100%);
}
.mobile-menu-close {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 48px; height: 48px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* ============================================
   MOBILE OPTIMIZATIONS — 320px to 768px
   ============================================ */
@media (max-width: 768px) {
  /* Avoid horizontal scroll, ever */
  html, body { overflow-x: hidden; max-width: 100%; }

  /* 16px minimum body, 18px+ Devanagari */
  body { font-size: 16px; line-height: 1.6; }
  .devanagari { font-size: 18px; }
  p.devanagari, .lead.devanagari, blockquote.devanagari { font-size: 1.15rem; }

  /* Tighter, consistent gutters */
  :root { --gutter: 16px; --section: 3rem; }
  .wrap, .wrap-narrow {
    width: 100%;
    padding-inline: 16px;
    margin-inline: 0;
  }
  section { padding-block: 3rem; }

  /* Sticky header stays sticky on mobile (already sticky by default) */
  .site-header { position: sticky; top: 0; }
  .header-inner {
    width: 100%;
    padding-inline: 16px;
    padding-block: 0.65rem;
    gap: 0.75rem;
  }
  .brand-mark { width: 36px; height: 36px; }
  .brand-name { font-size: 0.95rem; }
  .brand-name small { display: none; }
  .header-right .btn { display: none; } /* "Offer Seva" lives in mobile menu instead */
  .nav { display: none; }
  .nav-toggle { display: flex; margin-left: auto; }

  /* Buttons: 48px hit targets */
  .btn {
    min-height: 48px;
    padding: 0.85rem 1.4rem;
    font-size: 1rem;
  }
  .btn-sm { min-height: 44px; padding: 0.55rem 1rem; }

  /* Headings scale down */
  h1 { font-size: clamp(2rem, 8vw, 2.6rem); line-height: 1.15; }
  h2 { font-size: clamp(1.6rem, 6vw, 2.1rem); }
  h3 { font-size: 1.25rem; }

  /* Images full width */
  img { width: 100%; height: auto; }

  /* Footer stacked + centered */
  .site-footer { padding-block: 3rem 1.5rem; }
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    text-align: center;
    padding-bottom: 2rem;
  }
  .footer-grid > div > div[style*="display:flex"],
  .footer-grid > div > div[style*="display: flex"] {
    justify-content: center;
  }
  .footer-grid p, .footer-grid ul, .footer-grid address {
    margin-inline: auto;
    max-width: 30ch !important;
  }
  .footer-grid ul { list-style: none; padding: 0; }
  .footer-grid h4 { letter-spacing: 0.16em; }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.85rem;
  }

  /* Eyebrow wraps cleanly */
  .eyebrow { font-size: 11px; }
}

@media (max-width: 540px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.7rem; }
}
