/* ==========================================================================
   AartiBhajan.com — design system
   Palette from the puja thali: kumkum (red-ochre), haldi (gold), chandan cream.
   Structural line = the shirorekha: titles hang from a rule, as Devanagari does.
   Signature = the verse card with its marker chip and the dhruvapada treatment.
   ========================================================================== */

/* ---- fonts: one Devanagari face per language, so Marathi renders as Marathi,
       Hindi as Hindi, Sanskrit as Sanskrit. Latin subset (IAST-capable) included. */
/* Default reading face. Mukta (Ek Type, Mumbai) declares both Hindi and Marathi
   language systems, so `lang` still drives its letterforms — and its even stroke
   weight reads far calmer than a high-contrast serif, especially in dark mode
   where thin strokes bloom against the background. */
@font-face {
  font-family: 'Mukta';
  src: url('/assets/fonts/Mukta-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
/* Traditional face. Only referenced under html[data-type="trad"], so a browser
   never downloads it unless the reader actually asks for it. */
@font-face {
  font-family: 'Tiro Marathi';
  src: url('/assets/fonts/TiroDevanagariMarathi-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Tiro Hindi';
  src: url('/assets/fonts/TiroDevanagariHindi-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Tiro Sanskrit';
  src: url('/assets/fonts/TiroDevanagariSanskrit-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --bg: #FAF5EA;
  --surface: #FFFDF6;
  --surface-2: #F4ECDC;
  --ink: #33281C;
  --muted: #6F5F4B;
  --accent: #A93F2E;        /* kumkum */
  --accent-ink: #8C3222;
  --gold: #96700F;          /* haldi, darkened for contrast */
  --line: #E4D8C2;
  --focus: #1D4ED8;
  --serif-latn: 'Mukta', Georgia, serif;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --verse-size: 1.25rem;    /* 20px Devanagari base */
  --verse-leading: 2.0;
  --body-scale: 1;          /* size control scales list and body text too */
}
html[data-theme="dark"] {
  --bg: #1E1811;
  --surface: #292118;
  --surface-2: #322A1F;
  --ink: #EFE7D6;
  --muted: #BFAE93;
  --accent: #E5946B;
  --accent-ink: #EFA57E;
  --gold: #D3A945;
  --line: #3D3323;
  --focus: #93B4F5;
}
html[data-fontsize="1"] { --verse-size: 1.375rem; --body-scale: 1.06; }
html[data-fontsize="2"] { --verse-size: 1.55rem;  --body-scale: 1.13; }
html[data-fontsize="3"] { --verse-size: 1.75rem;  --body-scale: 1.2; }
html[data-fontsize="-1"] { --verse-size: 1.1rem;  --body-scale: .94; }

* { box-sizing: border-box; }
/* Safety net: an icon must never expand to fill its container, whatever else fails. */
svg { max-width: 1.5rem; max-height: 1.5rem; flex: none; }
.brand svg { max-width: 1.7rem; max-height: 1.7rem; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--ui); font-size: 1.0625rem; line-height: 1.6;
}
/* Reading faces. `lang` on the element drives the font's own locl substitutions. */
.deva, .verse-text, .prose-text { font-family: 'Mukta', system-ui, sans-serif; }
html[data-type="trad"] .deva:lang(mr), html[data-type="trad"] .verse-text:lang(mr),
html[data-type="trad"] .prose-text:lang(mr) { font-family: 'Tiro Marathi', serif; }
html[data-type="trad"] .deva:lang(hi), html[data-type="trad"] .verse-text:lang(hi),
html[data-type="trad"] .prose-text:lang(hi) { font-family: 'Tiro Hindi', serif; }
html[data-type="trad"] .deva:lang(sa), html[data-type="trad"] .verse-text:lang(sa),
html[data-type="trad"] .prose-text:lang(sa) { font-family: 'Tiro Sanskrit', serif; }
/* the two type buttons render themselves in the face they select */
#typeEasy { font-family: 'Mukta', sans-serif; }
#typeTrad { font-family: 'Tiro Marathi', serif; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--surface);
  padding: .75rem 1rem; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---- header ---- */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .bar {
  max-width: 46rem; margin: 0 auto; padding: .6rem 1rem;
  display: flex; align-items: center; gap: .75rem;
}
.brand {
  font-family: var(--serif-latn); font-size: 1.3rem; color: var(--ink);
  text-decoration: none; display: flex; align-items: center; gap: .5rem; flex: 1;
}
.brand svg { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.brand b { font-weight: 400; }
.icon-btn {
  min-width: 48px; min-height: 48px; display: inline-flex; align-items: center;
  justify-content: center; gap: .35rem; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); border-radius: 10px;
  cursor: pointer; font: inherit; padding: 0 .6rem;
}
.icon-btn svg { width: 1.25rem; height: 1.25rem; }
.icon-btn:hover { border-color: var(--accent); }
html[data-theme="light"] .ic-sun { display: none; }
html[data-theme="dark"] .ic-moon { display: none; }

.site-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav ul {
  display: flex; gap: .25rem; list-style: none; margin: 0 auto; padding: 0 .75rem;
  max-width: 46rem;
}
.site-nav a {
  display: block; padding: .7rem .8rem; text-decoration: none; color: var(--muted);
  white-space: nowrap; border-bottom: 3px solid transparent; font-size: 1rem;
}
.site-nav a[aria-current="page"], .site-nav a:hover {
  color: var(--ink); border-bottom-color: var(--accent);
}

main { max-width: 46rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* ---- shirorekha title: text hangs from the rule ---- */
.page-title {
  font-family: var(--serif-latn); font-weight: 400; line-height: 1.5;
  font-size: 1.9rem; margin: 1rem 0 .25rem;
  border-top: 3px solid var(--accent); padding-top: .6rem; display: inline-block;
}
.page-sub { color: var(--muted); margin: 0 0 .5rem; font-size: calc(1.05rem * var(--body-scale)); }
.byline { color: var(--muted); font-size: .95rem; margin: .25rem 0 1rem; }
.byline .sep { margin: 0 .4rem; color: var(--line); }

.breadcrumbs { font-size: .9rem; color: var(--muted); margin: .5rem 0 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: 0; margin: 0; }
.breadcrumbs li + li::before { content: "›"; margin: 0 .35rem; color: var(--line); }
.breadcrumbs a { color: var(--muted); }

.intro { font-size: calc(1.02rem * var(--body-scale)); color: var(--ink); }
.lede { border-left: 3px solid var(--gold); padding-left: .9rem; }

/* ---- reading toolbar (labelled, senior-friendly) ---- */
/* One compact control pane. Wraps to ~2 rows on a phone so the first verse is
   visible on the opening screen. Every control keeps a 44px tap target. */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: .3rem; margin: .9rem 0;
}
.toolbar .label { font-size: .8rem; color: var(--muted); }
.seg {
  display: inline-flex; flex: 0 0 auto; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 9px; overflow: hidden;
}
.seg button {
  height: 44px; border: 0; white-space: nowrap;
  background: var(--surface); color: var(--ink); font-family: inherit;
  font-size: .95rem; padding: 0 .7rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[disabled], .seg button[aria-disabled="true"] {
  opacity: .35; cursor: default; color: var(--muted);
}
/* brief nudge when a reader presses a control that has nothing left to give */
@keyframes ab-nudge { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-2px)} 75%{transform:translateX(2px)} }
.seg button.at-limit { animation: ab-nudge .22s ease-in-out 1; }
@media (prefers-reduced-motion: reduce) { .seg button.at-limit { animation: none; } }
.seg button[aria-pressed="true"] { background: var(--accent); color: #FFF9F2; }
html[data-theme="dark"] .seg button[aria-pressed="true"] { color: #201409; }
.switch {
  display: inline-flex; flex: 0 0 auto; align-items: center; height: 44px;
  white-space: nowrap; border: 1px solid var(--line); background: var(--surface);
  border-radius: 9px; padding: 0 .6rem; font-family: inherit; font-size: .95rem;
  color: var(--ink); cursor: pointer;
}
.switch .dot {
  display: inline-block; flex: none; width: 1.7rem; height: 1rem; margin-left: .35rem;
  border-radius: 1rem; background: var(--surface-2);
  border: 1px solid var(--line); position: relative; transition: background .15s;
}
.switch .dot::after {
  content: ""; position: absolute; top: 0; left: 1px; width: .85rem; height: .85rem;
  border-radius: 50%; background: var(--muted); transition: transform .15s;
}
.switch[aria-pressed="true"] .dot { background: var(--accent); }
.switch[aria-pressed="true"] .dot::after { transform: translateX(.72rem); background: #FFF9F2; }
/* reading-mode button sits in the same pane, same height as the segments */
.btn.compact {
  display: inline-flex; flex: 0 0 auto; height: 44px; min-height: 0;
  padding: 0 .7rem; font-size: .95rem; border-radius: 9px; gap: .3rem; white-space: nowrap;
}
.btn.compact svg { width: 1.05rem; height: 1.05rem; }

/* ---- verses: the signature ---- */
.verses { margin-top: .5rem; }
.verse-card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.1rem 1.2rem; margin: 0 0 1rem;
}
.verse-card .marker {
  position: absolute; top: -.7rem; right: 1rem; background: var(--bg);
  color: var(--gold); font-size: .85rem; padding: 0 .5rem; letter-spacing: .05em;
}
.verse-text {
  font-size: var(--verse-size); line-height: var(--verse-leading);
  margin: 0; white-space: normal;
}
.verse-text .ln { display: block; }
.verse-card.refrain {
  background: var(--surface-2); border-left: 4px solid var(--accent);
}
.verse-card.refrain::before {
  content: "ध्रुवपद"; display: block; font-size: .78rem; color: var(--accent-ink);
  letter-spacing: .08em; margin-bottom: .35rem; font-family: var(--ui);
}
.part-heading {
  font-family: var(--serif-latn); font-size: 1.35rem; margin: 2rem 0 1rem;
  padding-top: .5rem; border-top: 2px solid var(--gold); display: inline-block;
}
.invocation { text-align: center; color: var(--muted); font-size: 1.05rem; margin: 1rem 0; }
.meaning {
  border-top: 1px dashed var(--line); margin-top: .8rem; padding-top: .7rem;
  color: var(--muted); font-size: .98rem; line-height: 1.65;
}
.meaning b { color: var(--ink); font-weight: 600; }
html[data-meaning="off"] .meaning { display: none; }
html[data-script="latn"] .script-deva { display: none; }
html[data-script="deva"] .script-latn { display: none; }

.note-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: 14px; padding: 1rem 1.2rem; margin: 0 0 1rem;
}
.note-card h2 { font-size: 1.05rem; margin: 0 0 .4rem; }
.note-card p { margin: 0; color: var(--muted); }

/* ---- actions row (reading mode, pdf, print, share) ---- */
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.25rem 0; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 48px;
  padding: 0 1rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem;
  text-decoration: none; cursor: pointer;
}
.btn svg { width: 1.2rem; height: 1.2rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #FFF9F2; }
html[data-theme="dark"] .btn.primary { color: #201409; }
/* reading mode: distinct but clearly an unselected action, not an active state */
.btn.accent-outline { border: 1.5px solid var(--accent); color: var(--accent-ink); background: var(--surface); }
.btn.accent-outline:hover { background: var(--surface-2); }
.btn.wa { border-color: var(--line); }
.btn.wa svg { color: #25D366; }
.btn.ghost { border-style: dashed; color: var(--muted); white-space: normal; text-align: center; max-width: 100%; }
.actions-end { margin: 1.5rem 0 0; }
.btn:hover { border-color: var(--accent); }

/* ---- japa counter ---- */
.counter {
  display: flex; align-items: center; gap: 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1.1rem; margin: 1rem 0;
  flex-wrap: wrap;
}
.counter .count { font-size: 2rem; font-family: var(--serif-latn); min-width: 3.5rem; text-align: center; }
.counter .target { color: var(--muted); font-size: .9rem; }

/* ---- cards / lists ---- */
.card-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .75rem; }
.card-list a {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 1rem 1.1rem; text-decoration: none; color: var(--ink);
}
.card-list a:hover { border-color: var(--accent); }
.card-list .t { font-family: var(--serif-latn); font-size: calc(1.25rem * var(--body-scale)); display: block; }
.card-list .s { color: var(--muted); font-size: calc(.92rem * var(--body-scale)); display: block; margin-top: .2rem; }
.section-title {
  font-size: 1.15rem; margin: 2rem 0 .5rem; font-weight: 600;
  display: flex; align-items: baseline; gap: .6rem;
}
.section-title .more { font-size: .9rem; font-weight: 400; margin-left: auto; }

.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; padding: 0; list-style: none; }
.chip-row a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; color: var(--ink); font-size: .98rem;
}
.chip-row a:hover { border-color: var(--accent); }

/* ---- related / next in puja ---- */
.related { margin-top: 2.5rem; border-top: 2px solid var(--line); padding-top: .5rem; }

/* ---- search ---- */
.search-box { display: flex; gap: .5rem; margin: 1rem 0; }
.search-box input {
  flex: 1; min-height: 52px; font: inherit; font-size: 1.1rem; padding: 0 1rem;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--ink);
}
.search-box input:focus { border-color: var(--accent); outline: none; }
.search-hint { color: var(--muted); font-size: .92rem; }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--line); background: var(--surface);
  margin-top: 2rem; padding: 1.5rem 1rem 5rem; color: var(--muted); font-size: .95rem;
}
.site-footer .inner { max-width: 46rem; margin: 0 auto; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .75rem; }
.site-footer a { color: var(--muted); }

/* ---- reading mode ---- */
html.reading-mode .site-header, html.reading-mode .site-nav,
html.reading-mode .toolbar, html.reading-mode .actions,
html.reading-mode .related, html.reading-mode .site-footer,
html.reading-mode .breadcrumbs, html.reading-mode .intro,
html.reading-mode .counter, html.reading-mode .note-card { display: none; }
html.reading-mode body { background: var(--bg); }
html.reading-mode main { max-width: 40rem; padding-bottom: 7rem; }
html.reading-mode { --verse-size: 1.6rem; }
html.reading-mode[data-fontsize="1"] { --verse-size: 1.75rem; }
html.reading-mode[data-fontsize="2"] { --verse-size: 1.95rem; }
html.reading-mode[data-fontsize="3"] { --verse-size: 2.2rem; }
.rm-bar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom));
}
html.reading-mode .rm-bar { display: flex; gap: .5rem; justify-content: center; align-items: center; }
.rm-bar .btn { min-width: 52px; justify-content: center; }
.rm-bar .speed { color: var(--muted); font-size: .9rem; min-width: 3.2rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- print: the clean hard copy ---- */
@media print {
  .site-header, .site-nav, .toolbar, .actions, .related, .site-footer,
  .breadcrumbs, .rm-bar, .counter, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  main { max-width: 100%; padding: 0; }
  .verse-card { border: none; padding: .4cm 0; page-break-inside: avoid; margin: 0; }
  .verse-card.refrain { background: none; border-left: 2pt solid #999; padding-left: .4cm; }
  .meaning { color: #333; }
  .page-title { border-top-color: #000; }
  .print-footer { display: block !important; text-align: center; color: #666; font-size: 9pt; margin-top: 1cm; }
}
.print-footer { display: none; }

@media (min-width: 640px) {
  .page-title { font-size: 2.2rem; }
  .card-list.two-col { grid-template-columns: 1fr 1fr; }
}


/* ---- inline quick search in header ---- */
.quick-search { border-top: 1px solid var(--line); background: var(--surface); }
.quick-search .bar { display: flex; gap: .5rem; align-items: center; max-width: 46rem; margin: 0 auto; padding: .6rem 1rem; }
.quick-search input {
  flex: 1; min-height: 48px; font: inherit; font-size: 1.05rem; padding: 0 .9rem;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink);
}
.quick-search input:focus { border-color: var(--accent); outline: none; }
.quick-search .card-list { max-width: 46rem; margin: 0 auto; padding: 0 1rem 1rem; }
.quick-search .card-list:empty { padding: 0; }

/* ---- info toggle next to subtitle ---- */
.info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; margin-left: .35rem; vertical-align: -.55rem;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  color: var(--muted); cursor: pointer;
}
.info-btn svg { width: 1.1rem; height: 1.1rem; }
.info-btn:hover, .info-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-ink); }
.about-inline { border-left: 3px solid var(--gold); padding-left: .9rem; margin: .75rem 0 0; }
.about-inline .intro { margin-bottom: 0; }
.about-inline .byline { margin-top: 0; }

/* ---- bhavarth: per-verse progressive disclosure ---- */
.bhavarth { margin-top: .3rem; }
.bhavarth > summary {
  display: flex; align-items: center; justify-content: flex-end; gap: .2rem;
  cursor: pointer; list-style: none; -webkit-appearance: none;
  color: var(--muted); font-size: .8rem; font-family: var(--ui);
  min-height: 32px; padding: 0 .1rem; user-select: none;
}
.bhavarth > summary::-webkit-details-marker { display: none; }
.bhavarth > summary::marker { content: ""; font-size: 0; }
.bhavarth > summary svg {
  width: .9rem; height: .9rem; max-width: .9rem; max-height: .9rem;
  transition: transform .15s; flex: none;
}
.bhavarth[open] > summary svg { transform: rotate(180deg); }
.bhavarth[open] > summary { color: var(--accent-ink); }
.bh-label { font-weight: 500; }
.bh-body {
  font-size: calc(1.02rem * var(--body-scale));
  margin-top: .2rem; padding: .8rem 1rem; background: var(--bg); border-radius: 10px;
  border-left: 3px solid var(--gold); line-height: 1.85; color: var(--ink);
}
.bh-note { color: var(--muted); font-size: .93rem; border-left: 3px solid var(--line); padding-left: .8rem; }

/* ---- about block at page end ---- */
.about-block { margin-top: 2.5rem; border-top: 2px solid var(--line); padding-top: .25rem; }
.about-block .intro { color: var(--muted); }

/* ---- feedback ---- */
.feedback-block { margin-top: 2rem; text-align: center; }
dialog:not([open]) { display: none; }
.fb-dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; max-width: 34rem;
  width: calc(100% - 2rem); background: var(--surface); color: var(--ink);
}
.fb-dialog::backdrop { background: rgba(0,0,0,.45); }
.fb-dialog h2 { margin: 0 0 .3rem; font-family: var(--serif-latn); font-weight: 400; font-size: 1.4rem; }
.fb-hint { color: var(--muted); font-size: .95rem; margin: 0 0 .9rem; }
.fb-label { display: block; font-size: .9rem; color: var(--muted); margin: .5rem 0 .25rem; }
.fb-dialog textarea, .fb-dialog input[type="email"] {
  width: 100%; font: inherit; font-size: 1.05rem; padding: .6rem .75rem; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px;
}
.fb-dialog textarea:focus, .fb-dialog input:focus { border-color: var(--accent); outline: none; }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }
.fb-status { min-height: 1.3rem; margin: .6rem 0 0; font-size: .95rem; color: var(--accent-ink); }

@media print {
  .bhavarth > summary, .info-btn, .feedback-block, .fb-dialog, .quick-search, .about-inline { display: none !important; }
  .bhavarth { border-top: 1px solid #ccc; }
  .bh-body { display: block !important; background: none; border-left: 2pt solid #999; }
  .about-block { border-top: 1pt solid #000; }
}
html.reading-mode .bhavarth, html.reading-mode .about-block,
html.reading-mode .feedback-block, html.reading-mode .bh-note,
html.reading-mode .actions-end, html.reading-mode .about-inline { display: none; }

.source-note {
  font-size: .92rem; color: var(--muted); background: var(--surface-2);
  border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0;
  padding: .7rem .9rem; margin-top: .8rem;
}
@media print { .source-note { display: none; } }

/* moved out of inline style attributes so CSP can forbid inline styles */
.counter .inc { min-width: 96px; justify-content: center; }
.search-hint { padding: 1rem; }
.part-heading.day-heading { font-size: 1.6rem; }

/* heading above the text — states plainly what follows */
.verses-heading {
  font-family: var(--serif-latn); font-weight: 400; font-size: 1.15rem;
  color: var(--muted); margin: 1.2rem 0 .6rem; padding-bottom: .35rem;
  border-bottom: 1px solid var(--line);
}
.verses-heading .vh-en { font-size: .9rem; }
@media print { .verses-heading { border-bottom-color: #999; color: #333; } }
html.reading-mode .verses-heading { display: none; }

/* ---- prose blocks: kathas are narrative, so they flow rather than break by line ---- */
.prose-block { margin: 0 0 1.1rem; }
.prose-text {
  font-size: calc(var(--verse-size) * 0.82);
  line-height: 1.95; margin: 0 0 .9rem; text-align: left;
}
.prose-text:first-letter { }
@media print { .prose-text { font-size: 12pt; line-height: 1.7; } }

/* ---- standalone japa counter ---- */
.japa-big { margin: 1.5rem 0 2rem; text-align: center; }
.japa-tap {
  display: block; width: 100%; max-width: 22rem; margin: 0 auto;
  aspect-ratio: 1 / 1; border-radius: 50%; cursor: pointer;
  background: var(--surface); border: 3px solid var(--accent); color: var(--ink);
  font: inherit; -webkit-tap-highlight-color: transparent; user-select: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  transition: transform .08s ease, background .12s ease;
}
.japa-tap:active { transform: scale(.97); background: var(--surface-2); }
.japa-tap.pulse { background: var(--surface-2); }
.japa-count {
  font-family: var(--serif-latn); font-size: clamp(3.5rem, 22vw, 6rem);
  line-height: 1; color: var(--accent-ink); font-variant-numeric: tabular-nums;
}
.japa-hint { font-size: .95rem; color: var(--muted); }
.japa-meta { margin-top: 1.25rem; }
.japa-targets { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.japa-targets button {
  min-height: 44px; min-width: 60px; border: 0; background: var(--surface);
  color: var(--ink); font: inherit; font-size: 1rem; cursor: pointer;
}
.japa-targets button + button { border-left: 1px solid var(--line); }
.japa-targets button[aria-pressed="true"] { background: var(--accent); color: #FFF9F2; }
html[data-theme="dark"] .japa-targets button[aria-pressed="true"] { color: #201409; }
.japa-progress { color: var(--muted); min-height: 1.5rem; margin: .75rem 0 0; font-size: 1rem; }
.japa-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .9rem; }
.japa-actions .btn { font-size: .95rem; }
#japaWake[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); }
@media print { .japa-big { display: none; } }
.chip-row.static span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: .98rem;
}

/* ---- reading-type choice, moved out of the top control pane ---- */
.type-choice { margin: 1.5rem 0 .5rem; }
.type-choice .label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.type-choice .seg button { min-width: 92px; flex-direction: column; gap: 0; line-height: 1.15; padding: .3rem .8rem; height: auto; min-height: 48px; }
.type-choice .seg button small { font-size: .68rem; opacity: .75; font-family: var(--ui); }
.type-note { font-size: .82rem; color: var(--muted); margin: .4rem 0 0; }
@media print { .type-choice { display: none; } }
html.reading-mode .type-choice { display: none; }

/* ---- reading-mode speed menu ---- */
.speed-wrap { position: relative; }
button.speed {
  min-height: 44px; min-width: 3.6rem; padding: 0 .6rem; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font: inherit; font-size: .95rem; font-variant-numeric: tabular-nums;
}
button.speed:hover, button.speed[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-ink); }
.speed-menu {
  position: absolute; bottom: calc(100% + .4rem); right: 0; z-index: 60;
  list-style: none; margin: 0; padding: .3rem; min-width: 5.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
}
.speed-menu button {
  display: block; width: 100%; min-height: 42px; padding: 0 .8rem; cursor: pointer;
  background: none; border: 0; border-radius: 8px; color: var(--ink);
  font: inherit; font-size: 1rem; text-align: right; font-variant-numeric: tabular-nums;
}
.speed-menu button:hover { background: var(--surface-2); }
.speed-menu button[aria-checked="true"] { background: var(--accent); color: #FFF9F2; }
html[data-theme="dark"] .speed-menu button[aria-checked="true"] { color: #201409; }

/* ---- japa: locked state when the target is reached ---- */
.japa-tap.locked { border-color: var(--gold); background: var(--surface-2); }
.japa-tap.locked .japa-count { color: var(--gold); }
#japaSound[aria-pressed="true"], #japaWake[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-ink); }
#japaWake[aria-disabled="true"] { opacity: .5; }


/* ---- series: a long text published in parts (Sunderkand, Manache Shlok) ---- */
.series-nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem;
  margin: 1rem 0; padding: .7rem .9rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  font-size: calc(.95rem * var(--body-scale));
}
.series-nav a { color: var(--accent-ink); text-decoration: none; }
.series-nav a:hover { text-decoration: underline; }
.series-nav .sn-hub { font-family: var(--serif-latn); }
.series-nav .sn-pos { color: var(--muted); }
/* the links sit last and wrap as a unit, so a narrow phone never splits prev from next */
.series-nav .sn-links { margin-left: auto; display: flex; gap: .9rem; }
.series-nav .sn-links a { display: inline-flex; align-items: center; min-height: 44px; }

.series-progress { color: var(--muted); font-size: calc(.95rem * var(--body-scale)); margin: .4rem 0 1rem; }
.series-progress .sp-note { display: block; font-size: .9em; }

.part-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .6rem; counter-reset: part; }
.part-list a {
  display: grid; grid-template-columns: 2.4rem 1fr; align-items: baseline; column-gap: .8rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: .9rem 1.1rem; text-decoration: none; color: var(--ink); min-height: 44px;
}
.part-list a:hover { border-color: var(--accent); }
.part-list .pn { grid-row: span 2; color: var(--gold); font-variant-numeric: tabular-nums; }
.part-list .t { font-family: var(--serif-latn); font-size: calc(1.2rem * var(--body-scale)); }
.part-list .s { color: var(--muted); font-size: calc(.9rem * var(--body-scale)); grid-column: 2; }
.series-note { color: var(--muted); font-size: calc(.92rem * var(--body-scale)); margin: .5rem 0 .2rem; }
.series-note a { color: var(--accent-ink); }

/* ---- section jump: stepping through a long continuous page (pothi) ----
   Deliberately a 48px column and nothing wider. An earlier version put the current
   section's NAME in the bar; Devanagari titles vary hugely in width, so the control
   changed size as you scrolled and could run off a narrow screen. The name lives in
   the sheet (and in an off-screen label for screen readers) where it can be as long
   as it likes; the bar shows only the count. */
.sec-jump {
  position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40; display: flex; flex-direction: column; gap: 6px; width: 48px;
}
.sec-jump .sj-btn, .sec-jump .sj-pill {
  width: 48px; min-height: 48px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 14px; cursor: pointer; padding: 0;
  box-shadow: 0 2px 10px rgba(51, 40, 28, .12);
  display: flex; align-items: center; justify-content: center;
}
html[data-theme="dark"] .sec-jump .sj-btn,
html[data-theme="dark"] .sec-jump .sj-pill { box-shadow: 0 2px 10px rgba(0, 0, 0, .4); }
.sec-jump .sj-btn svg { width: 20px; height: 20px; }
/* one chevron glyph, rotated — prev points up, next points down */
.sec-jump #sjPrev svg { transform: rotate(180deg); }
.sec-jump .sj-btn[aria-disabled="true"] { opacity: .4; }
.sec-jump .sj-pill { font-size: .8rem; line-height: 1.15; }
.sec-jump .sj-count { color: var(--gold); font-variant-numeric: tabular-nums; }
/* off-screen but read aloud, so the control announces where you are */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.sec-sheet {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 41; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 6px 28px rgba(51, 40, 28, .22);
}
.sec-sheet .ss-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface); color: var(--muted);
  font-size: calc(.92rem * var(--body-scale));
}
.sec-sheet .ss-close { min-width: 44px; min-height: 44px; background: none; border: 0; color: var(--ink); cursor: pointer; font-size: 1.1rem; }
.sec-sheet .ss-list { list-style: none; margin: 0; padding: .4rem; }
.sec-sheet .ss-list button {
  display: block; width: 100%; text-align: start; min-height: 48px;
  padding: .6rem .8rem; background: none; border: 0; border-radius: 10px;
  color: var(--ink); font-size: calc(1.05rem * var(--body-scale)); cursor: pointer;
}
.sec-sheet .ss-list button:hover { background: var(--surface-2); }
.sec-sheet .ss-list button[aria-current="true"] { background: var(--surface-2); color: var(--accent-ink); }

/* reading mode has its own bottom bar — never stack the two */
html.reading-mode .sec-jump, html.reading-mode .sec-sheet { display: none; }
@media print { .sec-jump, .sec-sheet { display: none; } }

/* ---- image block: one image of the complete text, at the foot of the page ---- */
.img-block { margin: 2rem 0; }
.img-note { color: var(--muted); font-size: calc(.95rem * var(--body-scale)); margin: .2rem 0 1rem; }
.img-one { margin: 0; max-width: 420px; }
.img-one a { display: block; cursor: zoom-in; }
/* a tall text makes a tall image; the preview is cropped to a readable card and the
   viewer shows the whole thing */
.img-one img {
  width: 100%; height: auto; max-height: 520px; object-fit: cover; object-position: top;
  display: block; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.img-one a:hover img { border-color: var(--accent); }
.img-one figcaption { color: var(--muted); font-size: calc(.85rem * var(--body-scale)); margin-top: .35rem; }

.lightbox {
  position: fixed; inset: 0; z-index: 90; background: rgba(24, 18, 12, .93);
  overflow: auto; padding: 52px 12px 24px; text-align: center;
}
.lightbox img { max-width: 100%; height: auto; border-radius: 8px; }
.lb-close {
  position: fixed; top: 8px; right: 10px; z-index: 91;
  min-width: 44px; min-height: 44px; border-radius: 50%; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-size: 1.1rem;
}
html.lb-open { overflow: hidden; }
@media print { .img-block, .lightbox { display: none; } }

/* ---- संकल्प: mala vows that carry over between days ---- */
.sankalp { margin: 2rem 0; }
.vow-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .7rem; }
/* The card is a plain block with two stacked children, not a flex row containing a
   flex column. Nested flex cannot be verified here (WeasyPrint does not shrink-wrap
   flex containers — see tools/layout_test.py), and on a phone a row of controls under
   the progress bar is a shorter, easier target than a tall column beside it. */
.vow { display: block; }
/* flexbox, not grid: the layout test renders real CSS through WeasyPrint, whose grid
   support is partial, so a grid card cannot actually be verified before shipping. */
.vow-pick {
  width: 100%; text-align: start; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: .8rem 1rem; cursor: pointer; color: var(--ink);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; min-height: 44px;
}
.vow.on .vow-pick { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.vow-pick .vw-name { flex: 1 1 auto; font-size: calc(1.15rem * var(--body-scale)); }
.vow-pick .vw-count { flex: 0 0 auto; color: var(--accent-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vow-pick .vw-bar { flex: 0 0 100%; width: 100%; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.vow-pick .vw-bar i { display: block; height: 100%; background: var(--gold); }
.vow.complete .vw-bar i { background: var(--accent); }
.vow-pick .vw-sub { flex: 0 0 100%; width: 100%; color: var(--muted); font-size: calc(.85rem * var(--body-scale)); }
/* − and ✕ sit left, away from where the thumb naturally lands; the + that gets
   pressed every day sits right and is twice as wide. Mis-tapping "remove" on a
   21-mala vow is the one mistake this row has to make hard. */
.vow-ctl { display: flex; align-items: center; gap: .4rem; margin-top: .4rem; }
.vow-ctl button, .vow-del {
  min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 12px; cursor: pointer; font-size: 1.05rem;
}
.vow-ctl button:hover { border-color: var(--accent); }
.vow-del { font-size: .8rem; color: var(--muted); margin-inline-end: auto; }
.vow-del[data-confirm="1"] { color: var(--accent-ink); border-color: var(--accent); }
/* The + is pressed every day; − and ✕ almost never.
   NOTE THE SELECTOR. This was written twice as `.vow-plus` and had no effect either
   time, because `.vow-ctl button` above is specificity (0,1,1) and beats (0,1,0) — so
   min-width:44px and font-size:1.05rem kept winning and the button never changed size.
   `.vow-ctl .vow-plus` is (0,2,0) and actually applies. tools/css_test.js now asserts
   it, because "I set a bigger number" is not evidence that anything got bigger. */
.vow-ctl .vow-plus {
  min-width: 150px; min-height: 68px; font-size: 2.2rem; font-weight: 600; line-height: 1;
  color: var(--accent-ink); border-color: var(--accent); border-width: 2px;
  background: var(--surface-2);
}
.vow-ctl { align-items: center; }
.vow-about { margin-top: 1.2rem; }
.vow-empty { color: var(--muted); font-size: calc(.95rem * var(--body-scale)); }
/* Three fields need labels, not guesswork: name on its own row, then
   "how many malas × how many japs each" reading as one sentence. */
.vow-add { margin: 1rem 0 .3rem; }
.vow-add .va-row { margin: 0 0 .6rem; }
.vow-add .va-nums { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; }
.vow-add .va-f { margin: 0; }
.vow-add label {
  display: block; color: var(--muted); font-size: calc(.85rem * var(--body-scale)); margin-bottom: .25rem;
}
.vow-add .va-en { color: var(--muted); }
.vow-add input {
  width: 100%; min-height: 48px; padding: .6rem .9rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  font-family: inherit; font-size: calc(1rem * var(--body-scale));
}
.vow-add .va-f input { width: 6.5rem; }
.vow-add .va-x { color: var(--muted); padding-bottom: .8rem; }
.vow-add .btn { min-height: 48px; }
.vow-note { color: var(--accent-ink); font-size: calc(.92rem * var(--body-scale)); min-height: 1.2em; margin: .2rem 0 0; }
.japa-vow { color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.vow-backup { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.vow-backup summary { cursor: pointer; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
.vow-backup textarea {
  width: 100%; margin: .5rem 0; padding: .6rem .8rem; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface-2); color: var(--ink);
  font-family: ui-monospace, monospace; font-size: .8rem; resize: vertical;
}

/* an echoed ध्रुवपद is a reading aid, not new text — quieter than the stanza it follows */
.verse-card.echo { opacity: .82; border-style: dashed; }
/* the moment a mala completes — held for a beat so the full count is actually seen */
.japa-tap.done { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--accent); }

/* ---- deity hub: guidance, not just a list ---- */
.start-here {
  margin: 1.2rem 0; padding: .9rem 1.1rem; border-radius: 14px;
  background: var(--surface-2); border-inline-start: 4px solid var(--gold);
}
.start-here h2 { margin: 0 0 .3rem; font-size: calc(1rem * var(--body-scale)); color: var(--muted); font-weight: 600; }
.start-here p { margin: 0; }
.start-here a { color: var(--accent-ink); font-size: calc(1.1rem * var(--body-scale)); }
.when-read { color: var(--muted); font-size: calc(.95rem * var(--body-scale)); margin: .8rem 0 1.2rem; }
.when-read b { color: var(--ink); font-weight: 600; }

/* ---- /deity/ — choose by god ---- */
.deity-grid { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: .7rem; grid-template-columns: 1fr 1fr; }
.deity-grid a {
  display: block; padding: .9rem 1rem; min-height: 44px; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.deity-grid a:hover { border-color: var(--accent); }
.deity-grid .dg-deva { display: block; font-size: calc(1.25rem * var(--body-scale)); }
.deity-grid .dg-latn { display: block; font-family: var(--serif-latn); color: var(--accent-ink); font-size: calc(1rem * var(--body-scale)); }
.deity-grid .dg-count { display: block; color: var(--muted); font-size: calc(.82rem * var(--body-scale)); margin-top: .2rem; }
@media (min-width: 620px) { .deity-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---- curated shelves: /ashtak/, /puja/ ---- */
.list-group { margin: 1.6rem 0; }
.lg-note { color: var(--muted); font-size: calc(.95rem * var(--body-scale)); margin: .2rem 0 .8rem; }
