:root {
  --bg: #f5f1e8;
  --bg-deep: #ecdfc3;
  --panel: #fffdf9;
  --panel-soft: #f0efe8;
  --text: #1d2a1f;
  --muted: #5d685f;
  --primary: #f2a65a;
  --primary-strong: #d97b2d;
  --secondary: #2d6a4f;
  --secondary-soft: #cfe4d8;
  --accent: #d95d39;
  --border: rgba(29, 42, 31, 0.1);
  --shadow: 0 22px 60px rgba(38, 58, 47, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, #fffaf3 100%);
  color: var(--text);
  line-height: 1.6;
}

:focus-visible {
  outline: 3px solid #0a5fcc;
  outline-offset: 3px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 100;
  background: #0a5fcc;
  color: #fff;
  padding: 0.8rem 1rem;
  border-radius: 8px;
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(245, 241, 232, 0.8);
  border-bottom: 1px solid var(--border);
}

section[id],
footer[id] {
  scroll-margin-top: 108px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-weight: 800;
}

.nav-links {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-links a {
  padding: 0.45rem 0;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--secondary);
}

.language-control {
  display: grid;
  gap: 3px;
  max-width: 190px;
  color: var(--text);
  font-size: 0.82rem;
}

.language-control label {
  font-weight: 700;
}

.language-control select {
  min-height: 40px;
  padding: 0.4rem 2rem 0.4rem 0.65rem;
  border: 1px solid rgba(45, 106, 79, 0.3);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.language-note,
.language-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.language-status {
  min-height: 1em;
}

.contact-box a {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  background: var(--secondary);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
  color: #fff;
  min-height: 44px;
}

.button:hover { transform: translateY(-1px); }
.button:disabled {
  cursor: wait;
  opacity: 0.75;
}
.button:focus-visible {
  box-shadow: 0 0 0 4px rgba(10, 95, 204, 0.18);
}

.button-small { padding: 0.75rem 1.1rem; font-size: 0.9rem; }
.button-secondary {
  background: rgba(45, 106, 79, 0.08);
  border: 1px solid rgba(45, 106, 79, 0.15);
  box-shadow: none;
  color: var(--text);
}

.hero {
  padding: 88px 0 64px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 18px;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

h1, h2, h3 {
  margin: 0 0 16px;
  line-height: 1.08;
  letter-spacing: -0.05em;
}

h1 {
  font-size: clamp(2.8rem, 5vw, 5rem);
  max-width: 620px;
}

h2 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.lead {
  max-width: 600px;
  color: var(--muted);
  font-size: 1.08rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 28px 0 34px;
}

.stats {
  list-style: none;
  display: flex;
  gap: 28px;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.stats li {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stats strong {
  font-size: 1.7rem;
  letter-spacing: -0.05em;
}

.stats span {
  color: var(--muted);
  font-size: 0.85rem;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.mockup-card {
  width: min(100%, 470px);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(255,255,255,0.7);
  box-shadow: var(--shadow);
}

.mockup-header {
  display: flex;
  gap: 8px;
  padding: 8px 10px 14px;
}

.mockup-header span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(29, 42, 31, 0.2);
}

.mockup-body {
  background: linear-gradient(180deg, #fffaf3, #f4efe4);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
}

.hero-panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
}

.hero-panel-top small {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}

.hero-panel-top strong {
  font-size: 1.9rem;
}

.chip {
  display: inline-block;
  background: var(--secondary-soft);
  color: var(--secondary);
  border-radius: 999px;
  padding: 0.42rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.program-list {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.program-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255,255,255,0.45);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
}

.program-row strong {
  color: var(--text);
}

.impact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-box {
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.metric-box small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-box b {
  font-size: 1.25rem;
}

.metric-box.accent {
  background: rgba(242, 166, 90, 0.12);
  border-color: rgba(217, 123, 45, 0.2);
}

.section {
  padding: 88px 0;
}

.muted { background: rgba(45, 106, 79, 0.03); }

.section-heading {
  max-width: 700px;
  margin-bottom: 38px;
}

.ask-section {
  background: #fffaf3;
}

.ask-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.ask-section .section-heading {
  max-width: 820px;
  margin-bottom: 0;
}

.ask-section .section-heading h2 {
  margin-bottom: 12px;
}

.ask-section .section-heading > p:last-child {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.study-resources {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.source-list {
  padding: 14px 16px;
  border-left: 4px solid var(--secondary);
  background: rgba(45, 106, 79, 0.06);
}

.coverage-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.coverage-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}

.source-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
}

.source-details summary,
.coverage-details summary {
  padding: 12px 14px;
  color: var(--secondary);
  font-weight: 700;
  cursor: pointer;
}

.source-details .source-list,
.coverage-details .coverage-note {
  margin: 0;
  padding: 0 14px 14px;
}

.source-details .source-list + .source-list,
.source-details .source-list + .coverage-note {
  padding-top: 8px;
}

.source-details .coverage-note {
  padding: 0 14px 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.upanishad-index {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.source-details summary:focus-visible,
.coverage-details summary:focus-visible {
  border-radius: 12px;
}

.upanishad-index summary {
  padding: 14px 16px;
  color: var(--secondary);
  font-weight: 700;
  cursor: pointer;
}

.upanishad-index summary:focus-visible {
  border-radius: 12px;
}

.index-note {
  margin: 0;
  padding: 0 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.upanishad-list {
  columns: 3;
  column-gap: 36px;
  padding: 8px 20px 18px 44px;
}

.upanishad-list li {
  break-inside: avoid;
  padding: 3px 0;
}

.chat-card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topic-picker {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  align-self: start;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 88% 88%, rgba(242, 166, 90, 0.1), transparent 48%),
    var(--panel);
  box-shadow: var(--shadow);
}

.topic-picker-content {
  position: relative;
  z-index: 1;
}

.topic-picker-content > p:not(.topic-status) {
  margin: 0 0 18px;
  color: var(--muted);
}

.topic-picker h3 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.topic-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.topic-option {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 136px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.topic-option:hover {
  transform: translateY(-2px);
  border-color: var(--secondary);
  background: #f5faf6;
}

.topic-option strong {
  color: var(--secondary);
}

.topic-option span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.topic-status {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.chat-guide-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.chat-guide-heading h3 {
  margin: 0 0 4px;
}

.chat-guide-heading span {
  color: var(--muted);
  font-size: 0.9rem;
}

.change-topic {
  min-height: 44px;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(45, 106, 79, 0.3);
  border-radius: 999px;
  background: #fff;
  color: var(--secondary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.change-topic:hover {
  background: var(--secondary-soft);
}

.chat-intro {
  margin: 0 0 16px;
  color: var(--muted);
}

.chat-messages {
  display: grid;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  margin-bottom: 20px;
}

.chat-message {
  max-width: 90%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-message p {
  margin: 0;
}

.chat-message p + p {
  margin-top: 0.8em;
}

.assistant-message {
  justify-self: start;
  background: #f0efe8;
}

.chat-processing {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.processing-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(45, 106, 79, 0.2);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: processing-spin 0.8s linear infinite;
}

@keyframes processing-spin {
  to { transform: rotate(360deg); }
}

.user-message {
  justify-self: end;
  background: var(--secondary);
  color: #fff;
}

.chat-citation {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin-top: 12px;
  padding: 6px 10px;
  border-left: 3px solid var(--secondary);
  border-radius: 0 8px 8px 0;
  background: rgba(45, 106, 79, 0.08);
  color: var(--secondary);
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.chat-follow-up {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--secondary);
  font-weight: 600;
}

.chat-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.prompt-chip {
  min-height: 44px;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(45, 106, 79, 0.3);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.prompt-chip:hover {
  background: var(--secondary-soft);
}

.chat-form {
  display: grid;
  gap: 10px;
}

.chat-form label {
  font-weight: 700;
}

.chat-form textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid #68736a;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.virtual-keyboard {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
}

.keyboard-heading,
.keyboard-group h5 {
  margin: 0;
  letter-spacing: 0;
}

.keyboard-heading {
  font-size: 1rem;
}

.keyboard-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.keyboard-groups {
  display: grid;
  gap: 12px;
}

.keyboard-group {
  display: grid;
  gap: 7px;
}

.keyboard-group h5 {
  color: var(--muted);
  font-size: 0.85rem;
}

.keyboard-keys,
.keyboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyboard-key {
  min-width: 44px;
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(45, 106, 79, 0.28);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
}

.keyboard-key:hover {
  background: var(--secondary-soft);
}

.keyboard-key:disabled {
  cursor: wait;
  opacity: 0.65;
}

.keyboard-space {
  flex: 1 1 180px;
}

.keyboard-backspace {
  min-width: 88px;
  font-size: 1.3rem;
}

.chat-help,
.chat-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.chat-submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.card-grid,
.story-grid {
  display: grid;
  gap: 24px;
}

.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.info-card,
.story-card {
  padding: 28px 24px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.65);
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(242, 166, 90, 0.12);
  color: var(--accent);
  font-size: 1.3rem;
  margin-bottom: 18px;
}

.info-card p,
.story-card p,
.site-footer p,
.impact-copy p {
  color: var(--muted);
}

.impact-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 24px;
  align-items: center;
}

.impact-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.metric-card {
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 18px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric-card strong {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  margin-bottom: 8px;
}

.metric-card span { color: var(--muted); }

.story-grid {
  grid-template-columns: 1.4fr 1fr 1fr;
}

.story-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(135deg, rgba(45,106,79,0.08), rgba(242,166,90,0.08));
}

.story-card.feature {
  min-height: 280px;
}

.story-card.small {
  background: linear-gradient(135deg, rgba(45,106,79,0.12), rgba(255,255,255,0.7));
}

.story-card.small.alt {
  background: linear-gradient(135deg, rgba(217,93,57,0.12), rgba(255,255,255,0.75));
}

.story-tag {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--secondary);
  font-weight: 700;
}

.cta-section {
  padding-top: 24px;
}

.cta-box {
  background: linear-gradient(135deg, rgba(45,106,79,0.12), rgba(242,166,90,0.12));
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 30px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.35);
}

.footer-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 30px;
}

.contact-box {
  padding: 24px 28px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.5);
}

.footer-bottom {
  padding: 20px 0 30px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

@media (max-width: 820px) {
  .hero-grid,
  .ask-layout,
  .three-up,
  .impact-layout,
  .story-grid,
  .impact-metrics,
  .footer-grid,
  .cta-box {
    grid-template-columns: 1fr;
    display: grid;
  }

  .nav {
    flex-wrap: wrap;
    gap: 18px;
  }

  .nav-links {
    order: 3;
    flex: 0 0 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 16px;
    font-size: 0.9rem;
  }

  .nav-links a {
    padding: 0.55rem 0;
  }

  .language-control {
    order: 2;
    max-width: 220px;
  }

  .topic-options {
    grid-template-columns: 1fr;
  }

  .topic-picker {
    padding: 24px;
  }

  .topic-option {
    min-height: 96px;
    padding: 18px;
  }

  .hero { padding-top: 56px; }
  .site-footer { text-align: center; }
  .contact-box { text-align: left; }
  .upanishad-list { columns: 2; }
}

@media (max-width: 480px) {
  .upanishad-list { columns: 1; }
  .topic-picker { padding: 20px; }
}

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

  @media (forced-colors: active) {
    .button,
    .topic-option,
    .keyboard-key {
      border: 1px solid ButtonText;
    }

    :focus-visible {
      outline: 2px solid Highlight;
    }
  }
}
