/* ════════════════════════════════════════════════════
   MAIN.CSS — Layout, Sidebar, Topbar, Mobile
   ════════════════════════════════════════════════════ */

:root {
  --saffron:       #D4500A;   /* primary accent */
  --saffron-light: #F4874B;   /* hover, active states */
  --saffron-pale:  #FEF3C7;   /* pale amber highlight */
  --gold:          #B8860B;   /* section badges, term accent */
  --gold-light:    #E8C84A;   /* text on dark bands */
  --ivory:         #FAF7F3;   /* warm cream page background */
  --ivory-dark:    #F3F0EC;   /* sidebar, section band bg */
  --brown:         #2D3E52;   /* dark band — steel blue-slate */
  --brown-deep:    #1E2D3E;   /* footer band — deep slate */
  --brown-pale:    #D4B896;   /* champagne gold — headings on dark bg */
  --text-primary:  #1C2535;   /* dark navy charcoal */
  --text-secondary:#3D4F63;   /* medium slate */
  --text-muted:    #6B7A8D;   /* muted blue-grey */
  --border:        #E2E6EC;   /* cool-neutral border */
  --border-light:  #EDF0F4;
  --sidebar-w:     285px;
  --topbar-h:      56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ivory:         #141820;
    --ivory-dark:    #1A2030;
    --brown:         #2D3E52;
    --brown-deep:    #1E2D3E;
    --text-primary:  #E8EDF4;
    --text-secondary:#A8B4C4;
    --text-muted:    #6B7A8D;
    --border:        #2A3444;
    --border-light:  #222E3E;
    --saffron-pale:  #2A1A0A;
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Crimson Pro', Georgia, serif;
  background: var(--ivory);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

/* ── TOPBAR ─────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--topbar-h);
  background: var(--ivory);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 2px solid var(--saffron);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  gap: 12px;
}

.topbar-left {
  display: flex; align-items: center; gap: 12px;
  flex: 1; min-width: 0; overflow: hidden;
}

.hamburger {
  display: flex;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: transparent; border: none;
  cursor: pointer; padding: 6px;
  border-radius: 6px;
  transition: background 0.2s;
}
.hamburger:hover { background: rgba(0,0,0,0.06); }
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.25s;
  transform-origin: center;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.topbar-title {
  display: flex; flex-direction: column; gap: 1px;
  cursor: pointer; text-decoration: none;
  min-width: 0;
}
.topbar-title .mr {
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 16px; color: var(--text-primary);
  font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.topbar-title .en {
  font-family: 'Crimson Pro', serif;
  font-size: 15px; color: var(--text-muted);
  font-style: italic; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.topbar-right {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}

/* Language Toggle */
.lang-toggle {
  display: flex; gap: 3px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
}
.lang-btn {
  padding: 3px 12px;
  border: none; border-radius: 16px;
  font-family: 'Crimson Pro', serif;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  background: transparent;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.lang-btn.active {
  background: var(--saffron);
  color: white;
}

/* ── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--topbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--ivory-dark);
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 60px;
  z-index: 100;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  box-shadow: 4px 0 20px rgba(28,42,62,0.18);
}
.sidebar.open { transform: translateX(0); }
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Sidebar section */
.sb-section { border-bottom: 1px solid var(--border); }

.sb-section-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 9px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.sb-section-hdr:hover { background: rgba(0,0,0,0.04); }

/* Open section — colored left accent per section */
.sb-section.c0.open .sb-section-hdr { border-left: 3px solid #7B68CC; background: rgba(123,104,204,0.06); }
.sb-section.c1.open .sb-section-hdr { border-left: 3px solid #2A9D6B; background: rgba(42,157,107,0.06); }
.sb-section.c2.open .sb-section-hdr { border-left: 3px solid #D4500A; background: rgba(212,80,10,0.06); }
.sb-section.c3.open .sb-section-hdr { border-left: 3px solid #B8860B; background: rgba(184,134,11,0.06); }

.sb-badge {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  font-family: 'Crimson Pro', serif;
}
.c0 .sb-badge { background: #7B68CC; color: white; }
.c1 .sb-badge { background: #2A9D6B; color: white; }
.c2 .sb-badge { background: #D4500A; color: white; }
.c3 .sb-badge { background: #B8860B; color: white; }

.sb-section-label { flex: 1; min-width: 0; }
.sb-section-label .mr {
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 13px; color: var(--text-primary);
  font-weight: 500; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-section-label .en {
  font-size: 14px; color: var(--text-secondary);
  font-style: italic; margin-top: 1px;
}

.sb-arrow {
  color: var(--text-muted);
  font-size: 9px;
  transition: transform 0.22s;
  flex-shrink: 0;
}
.sb-section.open .sb-arrow { transform: rotate(90deg); }

/* Article list */
.sb-art-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.sb-section.open .sb-art-list { max-height: 2000px; }

.sb-art-link {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 16px 6px 22px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s;
  border-left: 2px solid transparent;
}
.sb-art-link:hover { background: rgba(0,0,0,0.05); }
.sb-art-link.coming-soon { opacity: 0.42; cursor: default; pointer-events: none; }
.sb-art-link.coming-soon .sb-art-num { color: var(--text-muted); }
.sb-art-link.active {
  background: var(--saffron-pale);
  border-left-color: var(--saffron);
  border-left-width: 3px;
}
.sb-art-num {
  font-size: 10px; color: var(--text-muted);
  min-width: 18px; padding-top: 1px;
  font-family: monospace; flex-shrink: 0;
}
.sb-art-titles { min-width: 0; }
.sb-art-titles .mr-t {
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 13px; color: var(--text-secondary);
  display: block; line-height: 1.4;
}
.sb-art-titles .en-t {
  font-size: 14px; color: var(--text-secondary);
  font-style: italic; display: block;
}
.sb-art-link.active .sb-art-titles .mr-t,
.sb-art-link.active .sb-art-titles .en-t { color: var(--saffron); }

/* Status dot */
.sb-art-link.done::after {
  content: '✓';
  font-size: 9px;
  color: var(--saffron);
  margin-left: auto;
  flex-shrink: 0;
  padding-top: 2px;
}

/* ── MAIN CONTENT ─────────────────────────────────── */
.main {
  margin-left: 0;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

/* Sidebar overlay */
.sidebar-overlay {
  display: block;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

/* ── HOME PAGE ─────────────────────────────────────── */

/* Band 1 — Hero */
.home-hero {
  background: var(--brown);
  padding: 60px 56px 52px;
}
.home-hero h1 {
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 32px; font-weight: 600;
  color: #FFFFFF; line-height: 1.3;
}
.home-hero h1[data-lang="en"] {
  font-family: 'Crimson Pro', serif;
  font-size: 28px; font-weight: 300; font-style: italic;
  color: rgba(255,255,255,0.7);
}
.hero-divider {
  width: 40px; height: 2px;
  background: var(--gold-light);
  margin: 20px 0;
}
.home-hero .hero-desc {
  font-size: 16px; color: rgba(255,255,255,0.62);
  max-width: 520px; line-height: 1.85;
}
.authors {
  display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap;
}
.author-tag {
  font-size: 11px; color: rgba(255,255,255,0.38);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 3px 10px; border-radius: 20px; font-style: italic;
}
.hero-links {
  margin-top: 28px;
}
.hero-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  padding: 7px 18px; border-radius: 20px;
  text-decoration: none; font-size: 13px;
  transition: background 0.18s, color 0.18s;
}
.hero-link-btn:hover {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.95);
}

/* Band 2 — Knowledge Cycles */
.home-sections-band {
  background: var(--ivory);
  padding: 36px 32px 44px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.home-band-hdr {
  margin-bottom: 24px;
}
.home-band-hdr .band-title {
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.home-band-hdr .band-title[data-lang="en"] {
  font-family: 'Crimson Pro', serif;
  font-style: normal; font-weight: 600;
}
.home-band-hdr .band-sub {
  font-size: 12px; color: var(--text-muted);
  margin-top: 3px;
}

/* Home section grid */
.home-grid {
  display: grid; grid-template-columns: repeat(2,1fr);
  gap: 16px;
  background: transparent;
}
.sec-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 30px;
  cursor: pointer;
  transition: box-shadow 0.18s, transform 0.18s;
}
.sec-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.c0.sec-card { border-top: 3px solid #7B68CC; }
.c1.sec-card { border-top: 3px solid #2A9D6B; }
.c2.sec-card { border-top: 3px solid #D4500A; }
.c3.sec-card { border-top: 3px solid #B8860B; }
.sec-card-badge {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; margin-bottom: 14px;
  font-family: 'Crimson Pro', serif;
}
.c0 .sec-card-badge { background: #EEEDFF; color: #534AB7; }
.c1 .sec-card-badge { background: #E1F5EE; color: #0F6E56; }
.c2 .sec-card-badge { background: #FAECE7; color: #D4500A; }
.c3 .sec-card-badge { background: #FFF3DC; color: #B8860B; }
.c4.sec-card { border-top: 3px solid #6B7A8D; }
.c4 .sec-card-badge { background: #EEF0F4; color: #4A5568; }
.sec-card h3 {
  font-family: 'Noto Sans Devanagari', sans-serif;
  font-size: 15px; font-weight: 600;
  color: var(--text-primary); line-height: 1.4; margin-bottom: 3px;
}
.sec-card .sc-sub { font-style: italic; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.sec-card .sc-count { font-size: 12px; color: var(--text-muted); }

/* Band 3 — Footer */
.home-footer-band {
  background: var(--brown-deep);
  padding: 28px 56px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  border-top: 2px solid var(--saffron);
}
.home-footer-band .footer-note {
  font-size: 12px; color: rgba(255,255,255,0.35);
  font-style: italic;
}
.home-footer-band .footer-link {
  font-size: 12px; color: rgba(255,255,255,0.4);
  text-decoration: none;
  transition: color 0.18s;
}
.home-footer-band .footer-link:hover { color: var(--saffron-light); }

/* ── LANGUAGE VISIBILITY ────────────────────────────── */
html[lang="mr"] .topbar-title .en,
html[lang="mr"] .sb-section-label .en,
html[lang="mr"] .sb-art-titles .en-t,
html[lang="mr"] .sb-art-num .en-t,
html[lang="mr"] .sb-badge .en-t { display: none; }

html[lang="en"] .topbar-title .mr,
html[lang="en"] .sb-section-label .mr,
html[lang="en"] .sb-art-titles .mr-t,
html[lang="en"] .sb-art-num .mr-t,
html[lang="en"] .sb-badge .mr-t { display: none; }

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 860px) {
  .home-hero { padding: 40px 24px 44px; }
  .home-hero h1 { font-size: 26px; }
  .home-hero h1[data-lang="en"] { font-size: 22px; }
  .home-sections-band { padding: 24px 20px 32px; }
  .home-grid { grid-template-columns: 1fr; gap: 12px; }
  .home-footer-band { padding: 20px 24px; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 14px; }
  .topbar-title .mr { font-size: 14px; }
}
