@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600&family=Inter:wght@300;400;500&display=swap');

/* ═══════════════════════════════════════════════════════
   BHAGAVAD GITA MASTERY — Design System v2 (Dark)
   ═══════════════════════════════════════════════════════ */

:root {
  /* Backgrounds */
  --bg:          #090704;
  --surface:     #110D07;
  --surface-2:   #1A1508;
  --surface-3:   #241D0B;

  /* Gold accent */
  --gold:        #D4A520;
  --gold-light:  #E8C048;
  --gold-dark:   #A07A10;
  --gold-glow:   rgba(212,165,32,0.10);
  --gold-border: rgba(212,165,32,0.14);
  --gold-hover:  rgba(212,165,32,0.40);

  /* Legacy aliases — keeps inline styles in secondary pages working */
  --primary:       var(--gold);
  --primary-light: var(--gold-light);
  --primary-dark:  var(--gold-dark);
  --accent:        var(--gold);
  --accent-light:  var(--gold-light);
  --bg-card:       var(--surface);
  --bg-dark:       var(--surface-2);
  --border:        var(--gold-border);
  --border-light:  var(--gold-border);

  /* Text */
  --text:        #EDE4CC;
  --text-muted:  rgba(237,228,204,0.55);
  --text-dim:    rgba(237,228,204,0.42); /* raised from 0.28 → passes WCAG AA */
  --text-light:  rgba(237,228,204,0.38);

  /* Kanda colours — vibrant on dark */
  --karma:       #E07840;
  --karma-bg:    rgba(224,120,64,0.07);
  --bhakti:      #A878D8;
  --bhakti-bg:   rgba(168,120,216,0.07);
  --jnana:       #5AA0D8;
  --jnana-bg:    rgba(90,160,216,0.07);

  /* Verse tiers */
  --tier-s:      #D4A520;
  --tier-a:      #5AA0D8;
  --tier-b:      #58B870;
  --tier-c:      #555;

  /* Sizing */
  --nav-height:  64px;
  --max-width:   1200px;
  --radius:      8px;
  --radius-lg:   14px;
  --radius-xl:   22px;

  /* Shadows */
  --shadow:      0 2px 16px rgba(0,0,0,0.5);
  --shadow-md:   0 8px 40px rgba(0,0,0,0.65);
  --shadow-gold: 0 0 0 1px var(--gold-border), 0 8px 32px rgba(212,165,32,0.07);

  --transition:  0.18s ease;
}

/* ─── Reset ─────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography ─────────────────────────────────────────── */

h1, h2, h3, h4, .cinzel {
  font-family: 'Cinzel', 'Palatino Linotype', Georgia, serif;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ─── Navigation ─────────────────────────────────────────── */

/* Skip to content — visually hidden until focused */
.skip-link {
  position: absolute;
  top: -9999px;
  left: 16px;
  z-index: 9999;
  background: var(--gold);
  color: #090704;
  padding: 8px 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

nav {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-height);
  background: rgba(9,7,4,0.88);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-bottom: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  padding: 0 clamp(16px,4vw,48px);
}

/* nav-inner — flex row inside sticky nav */
.nav-inner {
  display: flex;
  align-items: center;
  width: 100%;
}

/* nav-logo — used on all secondary pages (alias of nav-brand) */
.nav-brand,
.nav-logo {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--gold-light);
  text-decoration: none;
  flex-shrink: 0;
  margin-right: auto;
  transition: color var(--transition);
}
.nav-brand:hover,
.nav-logo:hover { color: white; }
.nav-brand span,
.nav-logo span {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Hamburger — CSS only, no JS */
.menu-check { display: none; }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius);
  transition: background var(--transition);
  margin-left: 8px;
}
.hamburger:hover { background: rgba(255,255,255,0.06); }
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.18s ease;
}
.menu-check:checked ~ .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-check:checked ~ .hamburger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.menu-check:checked ~ .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.nav-links a {
  display: block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  padding: 7px 14px;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.nav-links a:hover    { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-links a.active   { color: var(--gold-light); background: var(--gold-glow); }

/* Compact nav at medium viewports */
@media (min-width: 1101px) and (max-width: 1280px) {
  .nav-links a { padding: 6px 9px; font-size: 0.78rem; }
}

/* Hamburger breakpoint — 14 items need 1100px+ */
@media (max-width: 1100px) {
  .hamburger { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: rgba(9,7,4,0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--gold-border);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 20px;
    gap: 2px;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
  }
  .nav-links a { padding: 11px 14px; font-size: 0.9rem; }
  .menu-check:checked ~ .nav-links { display: flex; }
  /* When nav-inner is flex, sibling selector needs adjustment */
  .nav-inner .menu-check:checked ~ .nav-links { display: flex; }
}

/* ─── Page Header ────────────────────────────────────────── */

.page-header {
  background: linear-gradient(160deg, var(--surface-2) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--gold-border);
  padding: clamp(44px,8vw,76px) clamp(16px,4vw,48px) clamp(32px,6vw,56px);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(212,165,32,0.06) 0%, transparent 65%);
  pointer-events: none;
}
.page-header .eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.page-header h1 {
  font-size: clamp(1.8rem,4.5vw,2.9rem);
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.18;
}
.page-header .subtitle {
  font-size: clamp(0.88rem,2vw,1.05rem);
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ─── Main Layout ────────────────────────────────────────── */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(36px,6vw,64px) clamp(16px,4vw,32px);
}

/* .container — used on all generated section pages */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: clamp(16px,4vw,32px);
  padding-right: clamp(16px,4vw,32px);
  box-sizing: border-box;
}

/* ─── Page Title & Subtitle (generated pages) ─────────────── */

.page-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(1.7rem,4vw,2.6rem);
  color: var(--text);
  line-height: 1.2;
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
}

.hero-sub,
.page-subtitle {
  color: var(--text-muted);
  font-size: clamp(0.9rem,2vw,1.05rem);
  line-height: 1.75;
  max-width: 640px;
}

/* ─── Footer Classes (generated pages) ───────────────────── */

.footer,
footer.footer {
  background: var(--surface);
  border-top: 1px solid var(--gold-border);
  padding: 32px clamp(16px,4vw,48px);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 80px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-logo {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--gold-light);
  font-size: 1rem;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

/* ─── Accessibility — Focus Styles ───────────────────────── */

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ─── Reduced Motion ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Breadcrumb ─────────────────────────────────────────── */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-bottom: 36px;
  flex-wrap: wrap;
}
.breadcrumb a  { color: var(--gold); text-decoration: none; transition: color var(--transition); }
.breadcrumb a:hover { color: var(--gold-light); }
.breadcrumb .sep { color: var(--text-dim); }

/* ─── Grids ──────────────────────────────────────────────── */

.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2,1fr); }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 600px) {
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
}

/* ─── Cards ──────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.card:hover {
  border-color: var(--gold-hover);
  box-shadow: var(--shadow-gold);
  transform: translateY(-2px);
}
.card a { text-decoration: none; color: inherit; display: block; }

.card-number {
  font-family: 'Inter', sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.card-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}
.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.55;
}
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ─── Badges ─────────────────────────────────────────────── */

.badge {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  border: 1px solid;
  white-space: nowrap;
}
.badge-karma  { background: var(--karma-bg);  color: var(--karma);  border-color: rgba(224,120,64,0.3); }
.badge-bhakti { background: var(--bhakti-bg); color: var(--bhakti); border-color: rgba(168,120,216,0.3); }
.badge-jnana  { background: var(--jnana-bg);  color: var(--jnana);  border-color: rgba(90,160,216,0.3); }
.badge-s { background: rgba(212,165,32,0.09); color: var(--gold-light); border-color: rgba(212,165,32,0.3); }
.badge-a { background: rgba(90,160,216,0.09); color: var(--jnana);      border-color: rgba(90,160,216,0.3); }
.badge-b { background: rgba(88,184,112,0.09); color: #58B870;           border-color: rgba(88,184,112,0.3); }

/* ─── Chapter Cards ──────────────────────────────────────── */

.chapter-card { position: relative; cursor: pointer; }
.chapter-card .kanda-bar {
  height: 2px;
  margin: -22px -22px 18px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.chapter-card.karma  .kanda-bar { background: linear-gradient(90deg, var(--karma), transparent 80%); }
.chapter-card.bhakti .kanda-bar { background: linear-gradient(90deg, var(--bhakti), transparent 80%); }
.chapter-card.jnana  .kanda-bar { background: linear-gradient(90deg, var(--jnana), transparent 80%); }

.difficulty-bar {
  height: 3px;
  background: var(--surface-3);
  border-radius: 3px;
  margin-top: 12px;
  overflow: hidden;
}
.difficulty-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 3px;
}

/* ─── Section Headers ────────────────────────────────────── */

.section-header { margin-bottom: 28px; }
.section-header h2 {
  font-size: clamp(1.2rem,3vw,1.55rem);
  color: var(--text);
  margin-bottom: 5px;
}
.section-header p { color: var(--text-muted); font-size: 0.87rem; }

.kanda-header {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  margin-top: 40px;
  border: 1px solid;
}
.kanda-header h3 { font-weight: 400; font-size: 1rem; margin-bottom: 2px; }
.kanda-header p  { font-size: 0.77rem; opacity: 0.75; }
.kanda-karma  { background: var(--karma-bg);  color: var(--karma);  border-color: rgba(224,120,64,0.2); }
.kanda-bhakti { background: var(--bhakti-bg); color: var(--bhakti); border-color: rgba(168,120,216,0.2); }
.kanda-jnana  { background: var(--jnana-bg);  color: var(--jnana);  border-color: rgba(90,160,216,0.2); }

/* ─── Stats Row ──────────────────────────────────────────── */

.stats-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 48px; }
.stat-box {
  flex: 1;
  min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
}
.stat-box .number {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.9rem;
  color: var(--gold-light);
  line-height: 1;
  margin-bottom: 5px;
}
.stat-box .label {
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── Concept Cards ──────────────────────────────────────── */

.concept-card {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--gold-border);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: border-color var(--transition), transform var(--transition);
}
.concept-card:hover { border-color: var(--gold-hover); transform: translateX(2px); }
.concept-card .concept-name    { font-size: 0.95rem; color: var(--text); margin-bottom: 2px; }
.concept-card .concept-sanskrit{ font-size: 0.8rem; color: var(--text-muted); font-style: italic; margin-bottom: 8px; }
.concept-card .concept-def     { font-size: 0.8rem; color: var(--text-muted); line-height: 1.55; }

/* ─── Level Rows ─────────────────────────────────────────── */

.level-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--gold-border);
}
.level-id {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--gold-border);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.76rem;
  flex-shrink: 0;
}
.level-info { flex: 1; }
.level-name { font-size: 0.9rem; color: var(--text); }
.level-time { font-size: 0.76rem; color: var(--text-dim); }

/* ─── Path Cards ─────────────────────────────────────────── */

.path-card {
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.path-card:hover {
  border-color: var(--gold-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
}
.path-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent 70%);
}
.path-id {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.path-name { font-family: 'Cinzel', Georgia, serif; font-size: 1.05rem; color: var(--text); margin-bottom: 4px; }
.path-time { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 16px; }

/* ─── Verse Quote ────────────────────────────────────────── */

.verse-quote {
  background: var(--surface-2);
  border: 1px solid var(--gold-border);
  border-left: 3px solid var(--gold);
  padding: 28px 36px;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  margin: 40px 0;
  position: relative;
}
.verse-quote .verse-text {
  font-size: clamp(1rem,2.2vw,1.15rem);
  line-height: 1.85;
  color: var(--text);
  margin-bottom: 14px;
  font-style: italic;
  position: relative;
}
.verse-quote .verse-ref {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ─── Tables ─────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--gold-border);
}
th {
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--gold-border);
}
td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(212,165,32,0.05);
  color: var(--text-muted);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); color: var(--text); }

/* ─── Footer ─────────────────────────────────────────────── */

footer {
  background: var(--surface);
  border-top: 1px solid var(--gold-border);
  color: var(--text-dim);
  padding: 32px clamp(16px,4vw,48px);
  text-align: center;
  font-size: 0.78rem;
  margin-top: 80px;
}
footer a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
footer a:hover { color: var(--gold-light); }

/* ─── Chapter Nav ────────────────────────────────────────── */

.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  border-top: 1px solid var(--gold-border);
  margin-top: 48px;
  gap: 16px;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  background: var(--surface);
  transition: all var(--transition);
}
.nav-btn:hover { background: var(--surface-2); border-color: var(--gold-hover); color: var(--text); }
.nav-btn.disabled { opacity: 0.2; pointer-events: none; }

/* ─── Divider ─────────────────────────────────────────────── */

hr.divider { border: none; border-top: 1px solid var(--gold-border); margin: 48px 0; }

/* ─── Utility ─────────────────────────────────────────────── */

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--gold); }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 24px; }
.mt-lg { margin-top: 48px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 24px; }
.mb-lg { margin-bottom: 48px; }

.tag {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--gold-border);
  margin: 2px;
}

/* ─── Button base (generated pages) ─────────────────────── */

.btn-primary {
  background: var(--gold);
  color: #090704;
  padding: 10px 24px;
  border-radius: var(--radius);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  display: inline-block;
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--gold-light); transform: translateY(-1px); }

.btn-outline {
  border: 1px solid rgba(212,165,32,0.35);
  color: var(--text-muted);
  padding: 10px 24px;
  border-radius: var(--radius);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  display: inline-block;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); }

/* ─── Responsive images & tables ─────────────────────────── */

img { max-width: 100%; height: auto; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─── Sanskrit text sizing ───────────────────────────────── */

[lang="sa"], .devanagari { font-size: 1.05em; line-height: 1.8; }
