/* ============================================================
   Ramcharitmanas Reader — styles (rev 2, per Amit's feedback)
   - Verse text centered (Amit)
   - Mool in traditional saffron-red  --mool  (Amit: match site)
   - New marigold background kept (Amit: "new background is great")
   - Global menu (all Kaands + Aarti/Bhajan) + floating Doha nav
   Set the exact site colours in the :root variables below.
   ============================================================ */

@font-face {
  font-family: 'khula'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('./fonts/khula.ttf') format('truetype');
}
@font-face {
  font-family: 'khula-sb'; font-weight: 600; font-style: normal; font-display: swap;
  src: url('./fonts/khula-sb.ttf') format('truetype');
}

:root {
  /* --- surfaces --- */
  --paper:     #FBF7EF;
  --paper-2:   #F4ECDB;
  --card:      #FFFDF8;
  --line:      #EADFC9;
  --line-2:    #E0D2B6;

  /* --- text colours (ADJUST TO MATCH SITE EXACTLY) --- */
  --mool:      #ca2325;   /* verse / mool — EXACT site red                 */
  --arth:      #414141;   /* meaning (Hindi) — exact site grey             */
  --english:   #5f6368;   /* english translation — site secondary grey    */
  --ink:       #241C15;
  --ink-soft:  #6E5D48;
  --ink-faint: #A2917A;

  /* --- accents --- */
  --saffron:   #ca2325;
  --saffron-d: #a81d1f;
  --tilak:     #ca2325;

  --wrap: 720px;
  --r: 14px;
  --verse-scale: 1;

  /* Devanagari serif for scripture; swap here to match the site font */
  --serif: 'khula', 'Khula', 'Noto Sans Devanagari', sans-serif;   /* verses + headings */
  --ui: 'khula-sb', 'Khula', system-ui, sans-serif;                /* UI */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  line-height: 1.5;
  background-image: radial-gradient(120% 60% at 50% -8%, rgba(228,136,27,.10), transparent 60%);
  background-attachment: fixed;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px clamp(12px, 4vw, 24px);
  background: rgba(251,247,239,.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand {
  font-family: var(--serif); font-size: 1.08rem; font-weight: 600;
  color: var(--tilak); text-decoration: none; white-space: nowrap;
}
.topbar .spacer { flex: 1; }
.iconbtn {
  appearance: none; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink-soft);
  width: 40px; height: 40px; border-radius: 11px;
  font-size: 1.15rem; cursor: pointer; display: grid; place-items: center;
  transition: border-color .15s, color .15s;
}
.iconbtn:hover { border-color: var(--saffron); color: var(--tilak); }
.iconbtn:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }

/* ---------- layout ---------- */
main { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(12px, 4vw, 24px) 120px; }
.view { animation: fade .28s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

/* ---------- HOME ---------- */
.hero { text-align: center; padding: clamp(28px,7vw,56px) 0 clamp(16px,4vw,28px); }
.hero .om { font-family: var(--serif); color: var(--saffron); font-size: 2.4rem; line-height: 1; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem,6vw,2.7rem); color: var(--tilak); margin: .3em 0 .15em; }
.hero p { color: var(--ink-soft); margin: 0; font-size: .98rem; }

.group-label {
  text-align: center; font-family: var(--ui); font-size: .74rem; font-weight: 600;
  letter-spacing: 2.5px; text-transform: uppercase; color: var(--saffron-d);
  margin: 30px 0 12px; position: relative;
}
.group-label::before, .group-label::after {
  content: ""; position: absolute; top: 50%; width: 26%; height: 1px; background: var(--line-2);
}
.group-label::before { left: 4%; } .group-label::after { right: 4%; }

.kand-list { list-style: none; margin: 0; padding: 0; }
.kand-card {
  display: flex; align-items: center; gap: 15px; width: 100%;
  text-align: left; text-decoration: none; background: var(--card); color: inherit;
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 17px; margin: 9px 0; cursor: pointer;
  transition: transform .14s, border-color .14s, box-shadow .14s;
}
.kand-card:hover { transform: translateY(-2px); border-color: var(--saffron); box-shadow: 0 8px 22px -14px rgba(154,42,16,.5); }
.kand-card:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
.kand-num {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--serif); font-size: 1.2rem; color: var(--tilak);
  background: radial-gradient(circle at 50% 35%, #FCEBCB, #F3D79B); border: 1px solid #E9C687;
}
.kand-card.text .kand-num { border-radius: 12px; background: radial-gradient(circle at 50% 35%, #FBE0DA, #EFC0B3); }
.kand-card .body { flex: 1; min-width: 0; }
.kand-card .hi { font-family: var(--serif); font-size: 1.24rem; color: var(--ink); display: block; }
.kand-card .meta { font-size: .8rem; color: var(--ink-soft); margin-top: 1px; }
.kand-card .chev { color: var(--saffron); font-size: 1.2rem; flex: none; }

/* ---------- KAND HEADER ---------- */
.kand-head { text-align: center; padding: clamp(20px,5vw,38px) 0 6px; }
.kand-head .eyebrow { color: var(--saffron-d); font-size: .78rem; letter-spacing: 2px; text-transform: uppercase; }
.kand-head h2 { font-family: var(--serif); color: var(--tilak); font-size: clamp(1.6rem,5vw,2.2rem); margin: .2em 0 .1em; }
.kand-head .sub { color: var(--ink-faint); font-size: .9rem; }

/* ---------- SECTION ---------- */
.section { margin-top: 26px; scroll-margin-top: 66px; }
.section-title {
  font-family: var(--serif); text-align: center; font-size: 1.18rem; color: var(--tilak);
  padding-bottom: 10px; margin: 0 auto 14px; max-width: 92%;
  border-bottom: 1px solid var(--line-2);
}
.section-title .sn {
  font-family: var(--ui); font-size: .68rem; font-weight: 600; color: #fff;
  background: var(--saffron); border-radius: 6px; padding: 2px 7px; margin-right: 8px; vertical-align: middle;
}
.section-title .en { display: block; font-family: var(--ui); font-size: .72rem; font-weight: 500; letter-spacing: .4px; color: var(--ink-faint); text-transform: uppercase; margin-top: 3px; }

/* ---------- VERSE CARD (centered, signature) ---------- */
.verse {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  margin: 14px 0; overflow: hidden; transition: border-color .16s, box-shadow .16s;
}
.verse:hover { border-color: var(--line-2); }
.verse.open { border-color: var(--saffron); box-shadow: 0 6px 22px -14px rgba(202,35,37,.45); }

.verse-head {
  display: block; width: 100%; text-align: center; cursor: pointer;
  background: none; border: 0; color: inherit; padding: 16px 18px 14px; font-family: var(--serif);
}
.verse-head:focus-visible { outline: 2px solid var(--saffron); outline-offset: -3px; }

.stanza-label {
  font-family: var(--ui); font-size: .8rem; font-weight: 600; color: var(--saffron-d);
  margin-bottom: 10px; letter-spacing: .4px;
  display: inline-block; padding: 2px 12px; border-radius: 999px;
  background: #FBEBD3;
}
.mool {
  font-family: var(--serif); color: var(--mool);
  font-size: calc(1.2rem * var(--verse-scale)); line-height: 1.95;
  letter-spacing: .2px; white-space: pre-line;   /* keep verse line breaks */
}
.verse-head .caret { display: block; color: var(--saffron); font-size: .66rem; margin-top: 10px; transition: transform .22s; opacity: .55; }
.verse.open .verse-head .caret { transform: rotate(180deg); }

.meaning { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .26s ease; }
.verse.open .meaning { grid-template-rows: 1fr; }
.meaning-inner { overflow: hidden; }
.meaning-pad { padding: 0 18px 18px; text-align: center; }
.arth, .english { white-space: pre-line; }
.arth {
  font-family: var(--serif); color: var(--arth); line-height: 1.85;
  font-size: calc(1.04rem * var(--verse-scale));
  padding-top: 14px; border-top: 1px dashed var(--line-2); margin: 0 6px;
}
.english {
  font-family: var(--ui); color: var(--english); line-height: 1.6;
  font-size: calc(.94rem * var(--verse-scale)); margin: 12px 6px 0; padding-top: 12px; border-top: 1px solid var(--line);
}
main[data-script="hi"] .english { display: none; }
main[data-script="en"] .arth    { display: none; }
main[data-script="en"] .english { border-top: 0; padding-top: 4px; margin-top: 0; }
.english:empty { display: none; }

/* ---------- reading controls dock ---------- */
.dock {
  position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); bottom: 16px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,253,248,.94); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 8px;
  box-shadow: 0 10px 30px -16px rgba(36,28,21,.5);
}
.dock .seg { display: flex; background: var(--paper-2); border-radius: 999px; padding: 3px; }
.dock .seg button { border: 0; background: none; cursor: pointer; font-family: var(--ui); font-size: .8rem; font-weight: 600; color: var(--ink-soft); padding: 5px 11px; border-radius: 999px; transition: background .15s, color .15s; }
.dock .seg button.on { background: var(--saffron); color: #fff; }
.dock .div { width: 1px; height: 22px; background: var(--line-2); }
.dock .fs { display: flex; align-items: center; gap: 6px; padding: 0 4px; color: var(--ink-soft); font-family: var(--serif); }
.dock input[type=range] { width: 78px; accent-color: var(--saffron); }
@media (max-width: 430px) { .dock .fs { display: none; } }

/* ---------- floating Doha navigator ---------- */
.doha-fab {
  position: fixed; z-index: 26; right: 16px; bottom: 74px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--saffron); color: #fff; border: 0; cursor: pointer;
  box-shadow: 0 8px 22px -8px rgba(202,35,37,.6); font-family: var(--ui); border: 2px solid #fff;
  transition: transform .14s;
}
.doha-fab:hover { transform: scale(1.06); }
.doha-fab:focus-visible { outline: 3px solid var(--tilak); outline-offset: 2px; }
.doha-fab .d1 { font-size: .95rem; line-height: 1; }
.doha-fab .d2 { font-size: .66rem; font-weight: 600; letter-spacing: .3px; }

/* ---------- drawers (left menu + right jump) ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(36,28,21,.42); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; z-index: 41; top: 0; height: 100%; width: min(340px, 86vw);
  background: var(--paper); display: flex; flex-direction: column;
  transition: transform .26s ease;
}
.drawer.left  { left: 0;  border-right: 1px solid var(--line-2); transform: translateX(-100%); box-shadow: 16px 0 40px -20px rgba(0,0,0,.4); }
.drawer.right { right: 0; border-left: 1px solid var(--line-2);  transform: translateX(100%);  box-shadow: -16px 0 40px -20px rgba(0,0,0,.4); }
.drawer.show { transform: none; }
.drawer h3 { font-family: var(--serif); color: var(--tilak); margin: 0; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }

/* global menu */
.menu-nav { overflow-y: auto; padding: 6px 0 24px; }
.menu-nav a, .menu-nav .glabel {
  display: flex; gap: 12px; align-items: center; text-decoration: none;
  padding: 11px 20px; color: var(--ink); font-family: var(--serif); font-size: 1.06rem;
}
.menu-nav a { border-bottom: 1px solid var(--line); cursor: pointer; }
.menu-nav a:hover { background: var(--paper-2); color: var(--tilak); }
.menu-nav a.on { background: #FBEBD3; color: var(--tilak); }
.menu-nav a .n { font-family: var(--ui); font-size: .72rem; font-weight: 600; color: var(--saffron-d); min-width: 20px; }
.menu-nav a .en { display: block; font-family: var(--ui); font-size: .7rem; color: var(--ink-faint); }
.menu-nav .glabel { font-family: var(--ui); font-size: .7rem; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-faint); padding-top: 18px; padding-bottom: 6px; }
.menu-nav a .soon { margin-left: auto; font-family: var(--ui); font-size: .62rem; color: var(--ink-faint); border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 7px; }

/* doha / section jump list */
.jump-nav { overflow-y: auto; padding: 8px 14px 24px; }
.jump-sec { font-family: var(--serif); color: var(--tilak); font-size: .82rem; padding: 14px 6px 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.jump-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px,1fr)); gap: 7px; margin-bottom: 8px; }
.jump-grid a {
  text-decoration: none; text-align: center; font-family: var(--serif);
  font-size: .92rem; color: var(--mool); background: var(--card);
  border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 4px; cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
}
.jump-grid a:hover { background: var(--saffron); color: #fff; border-color: var(--saffron); }

/* ---------- misc ---------- */
.loading { text-align: center; padding: 60px 0; color: var(--ink-faint); font-family: var(--serif); font-size: 1.1rem; }
.note { text-align: center; color: var(--ink-soft); background: var(--paper-2); border: 1px dashed var(--line-2); border-radius: var(--r); padding: 22px; margin: 20px 0; font-size: .95rem; line-height: 1.6; }
footer { text-align: center; color: var(--ink-faint); font-size: .82rem; padding: 20px 0 6px; }
footer a { color: var(--saffron-d); }

/* ---------- plain verse (aarti / bhajan with no meaning) ---------- */
.verse-plain {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  margin: 10px 0; padding: 14px 18px; text-align: center;
}
.verse-plain .mool { color: var(--mool); font-family: var(--serif);
  font-size: calc(1.16rem * var(--verse-scale)); line-height: 1.85; white-space: pre-line; }
.verse-plain .stanza-label { color: var(--saffron-d); font-size: .9rem; margin-bottom: 6px; }
