/* ==========================================================================
   Andhra Kraisthava Keerthanalu — UECF.NET web book
   Pure CSS3, mobile-first, no frameworks.
   Sections:
     1. Legacy Telugu web fonts
     2. Design tokens (light + dark)
     3. Base & accessibility
     4. Header / navigation / breadcrumb
     5. Landing page
     6. Contents & first-line index
     7. Song reading view
     8. Search overlay
     9. Footer & floating controls
    10. Hymnal home / All Songs
    11. Print
   ========================================================================== */

/* -------------------------------------------------------------------------
   1. Unicode Telugu fonts
   Lyrics are stored as genuine UTF-8 Telugu (U+0C00–U+0C7F). Prefer Noto
   (loaded from Google Fonts on book pages), then common system Telugu faces.
   ------------------------------------------------------------------------- */

/* -------------------------------------------------------------------------
   2. Design tokens
   ------------------------------------------------------------------------- */
:root {
  --navy:        #101B31;
  --navy-2:      #1b294a;
  --gold:        #c8952f;
  --gold-soft:   #e7c574;

  /* Warm off-white page canvas with white "card" panels floating on top --
     matches the look of UECF.NET's other web books (e.g. the 25th Silver
     Jubilee Souvenir), rather than the flat pure-white page used before. */
  --bg:          #f5f3ea;
  --bg-soft:     #eeebe0;
  --bg-card:     #ffffff;
  --ink:         #16202f;
  --ink-soft:    #4d5a6d;
  --ink-faint:   #7a869a;
  --rule:        #dfe3ea;
  --link:        #14407c;
  --link-hover:  #0b2c5a;
  --mark:        #ffe38a;
  --mark-wash:   rgba(255, 227, 138, .28);

  --header-h:    64px;
  --wrap:        1180px;
  --measure:     44rem;

  /* accent chips (hymn numbers, primary buttons) flip in dark */
  --accent-bg:   var(--navy);
  --accent-fg:   #ffffff;
  --accent-brd:  var(--navy);

  --reader-scale: 1;             /* driven by the A+ / A− controls */
  --radius:      10px;
  --shadow-sm:   0 1px 2px rgba(16, 27, 49, .08), 0 2px 8px rgba(16, 27, 49, .06);
  --shadow-md:   0 6px 24px rgba(16, 27, 49, .14);

  --te: "Noto Sans Telugu", "Noto Serif Telugu", "Gautami", "Vani",
        "Nirmala UI", "Telugu Sangam MN", "Pothana2000", "Lohit Telugu", sans-serif;
  --sans: "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, var(--te);
  --serif: "Noto Serif Telugu", Georgia, "Times New Roman", var(--te);
}

html[data-theme="dark"] {
  --bg:         #0b1220;
  --bg-soft:    #111b2e;
  --bg-card:    #131f36;
  --ink:        #e6ecf6;
  --ink-soft:   #b3c0d4;
  --ink-faint:  #8d9cb5;
  --rule:       #26344f;
  --link:       #8fc0ff;
  --link-hover: #b9d8ff;
  --mark:       #6b551a;
  --mark-wash:  rgba(107, 85, 26, .35);
  --navy:       #0b1220;
  --navy-2:     #16243f;
  --accent-bg:  #c8952f;
  --accent-fg:  #14203a;
  --accent-brd: #c8952f;
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md:  0 8px 28px rgba(0, 0, 0, .55);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg:         #0b1220;
    --bg-soft:    #111b2e;
    --bg-card:    #131f36;
    --ink:        #e6ecf6;
    --ink-soft:   #b3c0d4;
    --ink-faint:  #8d9cb5;
    --rule:       #26344f;
    --link:       #8fc0ff;
    --link-hover: #b9d8ff;
    --mark:       #6b551a;
    --mark-wash:  rgba(107, 85, 26, .35);
    --navy:       #0b1220;
    --navy-2:     #16243f;
    --accent-bg:  #c8952f;
    --accent-fg:  #14203a;
    --accent-brd: #c8952f;
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, .5);
    --shadow-md:  0 8px 28px rgba(0, 0, 0, .55);
  }
}

/* -------------------------------------------------------------------------
   3. Base & accessibility
   ------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}

img { max-width: 100%; height: auto; }

a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 18px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--gold); color: #17202f; padding: 10px 16px; font-weight: 700;
}
.skip-link:focus { left: 8px; top: 8px; }

/* Reading progress bar */
.progress {
  position: fixed; inset-block-start: 0; inset-inline: 0; height: 3px;
  background: transparent; z-index: 120; pointer-events: none;
}
.progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transition: width .12s linear;
}

/* Unicode Telugu body / titles */
.t, .tb, .te {
  font-family: var(--te);
  font-feature-settings: "kern" 1, "liga" 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.t, .te { font-weight: 400; }
.tb { font-weight: 700; }
.lat { font-family: var(--serif); font-weight: 400; font-style: normal; }
.lat.b { font-weight: 700; }
.lat.i { font-style: italic; }

/* -------------------------------------------------------------------------
   4. Header / navigation / breadcrumb
   ------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--navy);
  color: #f2f5fa;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .07), var(--shadow-sm);
}
.header-inner {
  display: flex; align-items: center; gap: 12px; min-height: var(--header-h);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark {
  font-weight: 800; letter-spacing: .06em; font-size: 15px;
  border: 2px solid var(--gold); color: var(--gold-soft);
  padding: 4px 7px; border-radius: 6px; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 13.5px; font-weight: 700; }
.brand-text small { font-size: 11px; color: #a9b7cd; }

.site-nav { display: none; margin-inline-start: auto; gap: 4px; }
.site-nav a {
  color: #dbe4f1; text-decoration: none; padding: 8px 11px; border-radius: 6px;
  font-size: 14px; white-space: nowrap;
}
.site-nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.site-nav a.current { background: rgba(200, 149, 47, .22); color: #fff; }

.header-tools { margin-inline-start: auto; display: flex; gap: 6px; }
.site-nav.open ~ .header-tools { margin-inline-start: 0; }

.icon-btn {
  background: rgba(255, 255, 255, .08); color: inherit;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px; padding: 7px 10px; cursor: pointer;
  font: inherit; font-size: 15px; line-height: 1;
}
.icon-btn:hover { background: rgba(255, 255, 255, .18); }
.menu-btn { display: inline-block; }

@media (min-width: 900px) {
  .menu-btn { display: none; }
  .site-nav { display: flex; }
  .header-tools { margin-inline-start: 8px; }
}
@media (max-width: 899px) {
  .site-nav {
    display: none; position: absolute; inset-inline: 0; top: var(--header-h);
    background: var(--navy-2); flex-direction: column; padding: 8px;
    box-shadow: var(--shadow-md);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; }
}

.breadcrumb { background: var(--bg-soft); border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 9px 0; }
.breadcrumb li + li::before { content: "›"; color: var(--ink-faint); margin-inline-end: 6px; }
.breadcrumb li[aria-current] { color: var(--ink-soft); }

/* -------------------------------------------------------------------------
   5. Landing page
   ------------------------------------------------------------------------- */
.hero { display: grid; gap: 26px; padding: 30px 0 10px; }
@media (min-width: 820px) { .hero { grid-template-columns: 300px 1fr; gap: 40px; align-items: start; } }

.hero-cover img {
  width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-md);
  border: 1px solid var(--rule); background: var(--bg-card);
}
.eyebrow {
  margin: 0 0 6px; text-transform: uppercase; letter-spacing: .1em;
  font-size: 11.5px; font-weight: 700; color: var(--gold);
}
.hero h1 { margin: 0 0 6px; line-height: 1.15; display: flex; flex-direction: column; gap: 4px; }
.hero-te { font-size: clamp(30px, 6vw, 46px); }
.hero-en { font-size: clamp(15px, 2.4vw, 19px); color: var(--ink-soft); font-weight: 600; font-family: var(--sans); }
.hero-sub { font-size: clamp(19px, 3vw, 26px); margin: 0 0 16px; color: var(--gold); }
.hero-desc { max-width: var(--measure); color: var(--ink-soft); }

.facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; padding: 0; }
.facts > div {
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 8px 14px; min-width: 116px;
}
.facts dt { font-size: 11.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: 2px 0 0; font-size: 21px; font-weight: 700; }

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.btn {
  display: inline-block; padding: 11px 18px; border-radius: 999px;
  border: 1.5px solid var(--rule); color: var(--ink); background: var(--bg-card);
  text-decoration: none; font-weight: 600; font-size: 15px;
}
.btn:hover { background: var(--bg-soft); color: var(--link-hover); }
.btn-primary {
  background: var(--accent-bg); color: var(--accent-fg); border-color: var(--accent-brd);
}
.btn-primary:hover { filter: brightness(1.12); color: var(--accent-fg); }
.btn-ghost { border-style: dashed; }

.resume-note {
  margin-top: 14px; padding: 10px 14px; border-inline-start: 4px solid var(--gold);
  background: var(--bg-soft); border-radius: 0 var(--radius) var(--radius) 0; font-size: 14.5px;
}

.section { padding: 34px 0; border-top: 1px solid var(--rule); }
.section h2 { font-size: clamp(19px, 3vw, 25px); margin: 0 0 18px; }

.toc-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .toc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .toc-grid { grid-template-columns: repeat(3, 1fr); } }
.toc-card a {
  display: flex; gap: 12px; align-items: center; height: 100%;
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 13px 15px; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm);
}
.toc-card a:hover { border-color: var(--gold); transform: translateY(-1px); }
.toc-n {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-fg); display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
}
.toc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.toc-head { font-size: 19px; line-height: 1.3; }
.toc-meta { font-size: 12.5px; color: var(--ink-faint); font-family: var(--sans); }

.feature-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature {
  background: var(--bg-soft); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 16px 18px;
}
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; font-size: 14.5px; color: var(--ink-soft); }

.updates, .related { margin: 0; padding-inline-start: 20px; color: var(--ink-soft); }
.updates li, .related li { margin-bottom: 8px; }
.updates time { font-weight: 700; color: var(--ink); }

/* -------------------------------------------------------------------------
   6. Contents & first-line index
   ------------------------------------------------------------------------- */
.reading {
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin: 20px 0 32px; padding: 20px 18px 40px;
}
@media (min-width: 640px) { .reading { padding: 30px 34px 48px; } }
.reading h1 { font-size: clamp(23px, 4vw, 32px); margin: 0 0 8px; }
.lede { color: var(--ink-soft); max-width: var(--measure); }

.toc-section { padding: 16px 0; border-top: 1px solid var(--rule); }
.toc-section h2 { font-size: 20px; margin: 0 0 4px; }
.toc-section h2 a { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.toc-section h2 a:hover .t { color: var(--link); }
.hymn-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.hymn-chips a {
  display: inline-block; min-width: 38px; text-align: center;
  padding: 4px 8px; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--bg-soft); text-decoration: none; font-size: 13.5px; color: var(--ink);
}
.hymn-chips a:hover { background: var(--gold); color: #17202f; border-color: var(--gold); }

.firstlines {
  columns: 1; column-gap: 34px;
  font-size: calc(17px * var(--reader-scale));
}
@media (min-width: 900px) { .firstlines { columns: 2; } }
.idx-entry { margin: 0 0 2px; line-height: 1.85; break-inside: avoid; }

/* -------------------------------------------------------------------------
   6b. Songs Index (modern bilingual searchable list)
   ------------------------------------------------------------------------- */
.songs-index-page .lede { max-width: 46rem; }
.songs-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 18px 0 10px; position: sticky; top: calc(var(--header-h) + 4px);
  z-index: 5; padding: 10px 0; background: var(--bg);
}
.songs-filter-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.songs-filter {
  flex: 1 1 220px; min-width: 0; font: inherit; font-size: 16px;
  padding: 11px 14px; border: 1px solid var(--rule); border-radius: 10px;
  background: var(--bg-card); color: var(--ink);
}
.songs-filter:focus {
  outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold);
}
.songs-sort { display: inline-flex; gap: 4px; }
.songs-sort-btn {
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: .04em;
  padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--bg-card); color: var(--ink-soft); cursor: pointer;
}
.songs-sort-btn.active,
.songs-sort-btn[aria-pressed="true"] {
  background: var(--accent-bg); color: var(--accent-fg); border-color: var(--accent-brd);
}
.songs-alpha {
  display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 12px;
}
.songs-alpha a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 6px; border-radius: 6px;
  text-decoration: none; font-size: 12.5px; font-weight: 700;
  color: var(--link); background: var(--bg-soft); border: 1px solid var(--rule);
}
.songs-alpha a:hover { background: var(--gold); color: #17202f; border-color: var(--gold); }
.songs-count { margin: 0 0 8px; color: var(--ink-soft); font-size: 14px; }
.songs-empty { color: var(--ink-soft); margin: 16px 0; }
.songs-index-list {
  list-style: none; margin: 0; padding: 0;
  border-top: 1px solid var(--rule);
}
.songs-letter {
  list-style: none; margin: 18px 0 6px; padding: 4px 2px;
  font-family: var(--sans); font-size: 13px; font-weight: 800;
  letter-spacing: .08em; color: var(--ink-faint); text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
}
.songs-row { list-style: none; margin: 0; }
.songs-row > a {
  display: flex; gap: 12px; align-items: baseline;
  padding: 10px 6px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--rule); min-height: 44px;
}
.songs-row > a:hover { background: var(--bg-soft); }
.songs-num {
  flex: none; min-width: 2.6em; text-align: right;
  font-family: var(--sans); font-weight: 800; font-size: 14px;
  color: var(--link);
}
.songs-titles {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1;
}
.songs-te {
  font-size: calc(17px * var(--reader-scale)); line-height: 1.45;
  overflow-wrap: anywhere;
}
.songs-te-missing { color: var(--ink-faint); }
.songs-en {
  font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  color: var(--ink-soft); line-height: 1.35; overflow-wrap: anywhere;
}
.printed-firstlines {
  margin: 36px 0 20px; padding: 14px 16px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--bg-card);
}
.printed-firstlines > summary {
  cursor: pointer; font-weight: 700; color: var(--ink);
  padding: 4px 0;
}
.printed-firstlines-lede { margin-top: 10px; }
@media (max-width: 640px) {
  .songs-toolbar { top: var(--header-h); }
  .songs-row > a { gap: 10px; padding: 11px 4px; }
  .songs-num { min-width: 2.2em; font-size: 13px; }
  .songs-en { font-size: 12.5px; }
}


/* -------------------------------------------------------------------------
   7. Song reading view
   ------------------------------------------------------------------------- */
.reader-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 0; margin-bottom: 8px; border-bottom: 1px solid var(--rule);
}
.reader-tools .icon-btn { background: var(--bg-soft); border-color: var(--rule); color: var(--ink); }
.rt-label { font-size: 12.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }

.book-text {
  font-size: calc(18px * var(--reader-scale));
  max-width: 46rem;
  text-align: left;
  font-family: var(--te);
  -webkit-user-select: text;
  user-select: text;
}
.book-text p { margin: 0 0 7px; line-height: 1.95; overflow-wrap: break-word; text-align: left; }
.book-text .te, .book-text .t, .book-text .tb { font-size: 1em; }
.verse { margin: 12px 0 16px; }
.verse-label {
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 6px;
}
.book-text .lg { font-size: 1.22em; }
.book-text .xl { font-size: 1.45em; }
.book-text .md { font-size: 1.08em; }
.book-text .sm { font-size: .82em; }
.book-text sup.sup { font-size: .58em; vertical-align: super; line-height: 0; color: var(--ink-soft); }

/* Invisible anchor marking where a printed page began in the source book --
   used only so "search by page number" can scroll to the right spot. The
   original book's printed page number is intentionally not shown here. */
.pagemark {
  display: block; height: 0; overflow: hidden;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.hymn {
  margin: 26px 0 30px; scroll-margin-top: calc(var(--header-h) + 20px);
  text-align: left;
}
.hymn-head {
  display: flex; align-items: flex-start; gap: 12px; margin: 0 0 8px;
  padding-bottom: 6px; border-bottom: 2px solid var(--rule);
  text-align: left;
}
.hymn-no {
  flex: none; font-family: var(--sans); font-weight: 800; font-size: 1.15em;
  background: var(--accent-bg); color: var(--accent-fg);
  border-radius: 8px; padding: 2px 10px; line-height: 1.4;
}
.hymn-title-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* The big title line. Hymnals are conventionally identified by their
   opening words, so wherever the book's own "Index of First Lines" gives
   us a real first line, THAT leads here -- not the printed heading (see
   .hymn-title-sub below), matching how the index itself identifies songs. */
.hymn-title { font-size: 1.16em; overflow-wrap: anywhere; }
/* Second line: the hymn's own printed heading (plus its Roman reading aid),
   demoted under the first-line title above. When no first line could be
   resolved, this block is skipped and the printed heading is promoted to
   .hymn-title instead -- see build_chapter() in build_site.py. */
.hymn-title-sub {
  display: flex; flex-direction: column; gap: 1px; margin-top: 1px;
}
.hymn-title-orig {
  font-size: .68em; font-weight: 400; color: var(--ink-soft);
  overflow-wrap: anywhere;
}
/* Best-effort Roman-script reading aid -- see the "English titles" note in
   the About section and README section 3b. */
.hymn-title-roman {
  font-family: var(--sans); font-style: normal; font-weight: 500;
  font-size: .72em; line-height: 1.35; color: var(--ink-soft);
  overflow-wrap: anywhere; letter-spacing: .01em;
}
.hymn-head .anchor {
  margin-inline-start: auto; text-decoration: none; color: var(--ink-faint);
  opacity: 0; font-size: .8em; font-family: var(--sans);
}
.hymn:hover .anchor, .anchor:focus { opacity: 1; }
/* Jumped-to hymn (via search, index, or a #h123 link): a soft wash across
   the whole card plus a highlighter-style stroke under just the title line
   -- scoped to .hymn-title alone (not the whole multi-line .hymn-head) so it
   stays a thin underline even now that the roman title and first-line
   subtitle make the header three lines tall. */
.hymn:target { background: var(--mark-wash); border-radius: var(--radius); }
.hymn:target .hymn-title { background: linear-gradient(transparent 60%, var(--mark) 60%); }

.ln.meta {
  color: var(--ink-soft); margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.ln.meta .meta-te { font-size: 0.95em; }
.ln.meta .meta-rt {
  font-family: var(--sans); font-style: italic; font-weight: 500;
  font-size: 0.82em; color: var(--ink-faint); line-height: 1.4;
}
.attrib { text-align: right; color: var(--ink-soft); margin: 4px 0 10px; }
.fn {
  font-size: .8em; color: var(--ink-soft); line-height: 1.7; margin: 0;
}
.hymn .fn:first-of-type { margin-top: 10px; padding-top: 8px; border-top: 1px dotted var(--rule); }

mark, .hl {
  background: var(--mark); color: inherit; padding: 0 1px; border-radius: 2px;
}

.pager {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--rule);
}

/* -------------------------------------------------------------------------
   8. Search overlay & Telugu keypad
   ------------------------------------------------------------------------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 150; background: rgba(9, 15, 28, .55);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px;
  backdrop-filter: blur(2px);
}
.search-overlay[hidden] { display: none; }
.search-box {
  width: min(720px, 100%); background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-md); overflow: hidden; border: 1px solid var(--rule);
  display: flex; flex-direction: column; max-height: 82vh;
}
.search-row { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--rule); }
#search-input {
  flex: 1; font: inherit; font-size: 17px; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: 8px;
  background: var(--bg); color: var(--ink);
}
.search-row .icon-btn { background: var(--bg-soft); border-color: var(--rule); color: var(--ink); }
.search-hint { padding: 8px 14px; font-size: 13px; color: var(--ink-faint); border-bottom: 1px solid var(--rule); }
.kb-toggle {
  margin-inline-start: 8px; font: inherit; font-size: 12.5px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--rule); color: var(--ink);
  border-radius: 999px; padding: 3px 10px;
}
.keypad {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 14px;
  border-bottom: 1px solid var(--rule); max-height: 30vh; overflow-y: auto;
}
.keypad[hidden] { display: none; }
.keypad button {
  font-family: var(--te); font-size: 20px; line-height: 1;
  min-width: 40px; padding: 6px 8px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--rule); color: var(--ink);
  border-radius: 6px;
}
.keypad button:hover { background: var(--gold); color: #17202f; }
.keypad button.util { font-family: var(--sans); font-size: 13px; }

.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-results li a {
  display: flex; gap: 10px; align-items: baseline; padding: 9px 11px;
  border-radius: 8px; text-decoration: none; color: inherit;
}
.search-results li a:hover, .search-results li a.sel { background: var(--bg-soft); }
.search-results .rn {
  flex: none; font-weight: 700; font-family: var(--sans); font-size: 13px;
  background: var(--accent-bg); color: var(--accent-fg); border-radius: 6px; padding: 1px 8px;
}
.search-results .rt { font-family: var(--te); font-size: 17px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.search-results .rr { font-family: var(--sans); font-style: italic; font-size: 12.5px; color: var(--ink-faint); }
.search-results .rp { margin-inline-start: auto; font-size: 12px; color: var(--ink-faint); flex: none; }
.search-empty { padding: 20px 14px; color: var(--ink-faint); font-size: 14.5px; }

/* -------------------------------------------------------------------------
   9. Footer & floating controls
   ------------------------------------------------------------------------- */
.site-footer {
  background: var(--navy); color: #cbd6e6; margin-top: 40px;
  padding: 26px 0; font-size: 14px;
}
.site-footer a { color: #dfe8f6; }
.foot-links { margin: 0 0 8px; }
.tagline { margin: 0 0 6px; color: #9db0cb; font-size: 13px; }
.copyright { margin: 0; color: #8fa3c0; font-size: 13px; }

.to-top {
  position: fixed; inset-inline-end: 16px; inset-block-end: 16px; z-index: 90;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  background: var(--accent-bg); color: var(--accent-fg);
  border: 1px solid rgba(255, 255, 255, .18);
  font-size: 19px; box-shadow: var(--shadow-md);
}
.to-top[hidden] { display: none; }

/* -------------------------------------------------------------------------
   10. Hymnal home, All Songs, song viewer
   ------------------------------------------------------------------------- */
.progress { display: none !important; }

.hymnal-home .hymnal-hero { margin-bottom: 8px; }
.hymnal-cards {
  display: grid; gap: 16px; padding: 8px 0 28px;
}
@media (min-width: 760px) {
  .hymnal-cards { grid-template-columns: 1fr 1fr; gap: 20px; }
}
.hymnal-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--rule);
  border-radius: calc(var(--radius) + 2px); padding: 22px 22px 20px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow-sm);
  min-height: 200px; transition: border-color .15s, transform .15s;
}
.hymnal-card:hover { border-color: var(--gold); transform: translateY(-2px); color: inherit; }
.hymnal-card-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold); font-family: var(--sans);
}
.hymnal-card h2 { margin: 0; font-size: clamp(22px, 3vw, 28px); }
.hymnal-card-stat {
  margin: 0; font-size: 18px; font-weight: 700; color: var(--ink);
}
.hymnal-card p { margin: 0; color: var(--ink-soft); font-size: 14.5px; flex: 1; }
.hymnal-card-cta {
  margin-top: 8px; font-weight: 700; color: var(--link); font-size: 14.5px;
}
.hymnal-tools-row { display: flex; flex-wrap: wrap; gap: 10px; }

.all-songs-toolbar { flex-wrap: wrap; }
.song-jump-wrap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-inline-start: auto;
}
.song-jump-wrap input[type="number"] {
  width: 5.5rem; padding: 8px 10px; border: 1px solid var(--rule);
  border-radius: 8px; background: var(--bg-card); color: var(--ink); font: inherit;
}
.all-songs-list {
  list-style: none; margin: 16px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 0;
}
.song-card { border-bottom: 1px solid var(--rule); }
.song-card > a {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 4px; text-decoration: none; color: inherit;
}
.song-card > a:hover { background: var(--bg-soft); }
.song-card-num {
  flex: none; min-width: 2.4em; font-weight: 800; font-family: var(--sans);
  font-size: 18px; color: var(--accent-bg);
}
html[data-theme="dark"] .song-card-num { color: var(--gold-soft); }
.song-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.song-card-te { font-size: 17.5px; font-weight: 700; line-height: 1.4; }
.song-card-rt {
  font-family: var(--sans); font-size: 14.5px; font-style: italic; font-weight: 500;
  color: var(--ink-soft); line-height: 1.35;
}
.song-card-en {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--ink-faint); line-height: 1.35; font-style: normal;
}
.song-card-meta {
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  line-height: 1.4; margin-top: 3px;
}
.song-card-meta-rt {
  font-family: var(--sans); font-size: 12.5px; font-style: italic; font-weight: 500;
  color: var(--ink-faint); line-height: 1.35;
}
.song-card-preview {
  font-size: 12.5px; color: var(--ink-faint); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 36rem;
}
.songs-sentinel { height: 1px; list-style: none; }

/* Printed-style Song Index */
.song-index-header { margin: 8px 0 4px; text-align: center; }
.song-index-header h1 {
  margin: 0 0 8px; font-size: clamp(26px, 4.5vw, 36px); font-weight: 800;
  letter-spacing: .01em;
}
.song-index-sub {
  margin: 0 auto 6px; max-width: 36rem; color: var(--ink-soft);
  font-size: 14.5px; line-height: 1.55;
}
.song-index-sub span[lang="en"] { color: var(--ink-faint); font-size: 13.5px; }
.telugu-alpha a {
  min-width: 2.4em; font-family: var(--te); font-size: 13px; font-weight: 700;
}
.alpha-index-list {
  list-style: none; margin: 0; padding: 0;
  border-top: none;
}
.sticky-letter, .alpha-letter {
  position: sticky; top: calc(var(--header-h) + 58px); z-index: 3;
  list-style: none; margin: 18px 0 4px; padding: 8px 4px 6px;
  background: var(--bg); border-bottom: 2px solid var(--gold);
  display: flex; align-items: baseline; gap: 10px;
}
.alpha-letter-te {
  font-family: var(--te); font-size: 28px; font-weight: 800; line-height: 1;
  color: var(--ink);
}
.alpha-letter-en {
  font-family: var(--sans); font-size: 13px; font-weight: 700;
  color: var(--ink-faint); letter-spacing: .04em;
}
.alpha-row { list-style: none; margin: 0; }
.alpha-row > a {
  display: flex; flex-direction: column; gap: 1px;
  padding: 9px 4px 10px; text-decoration: none; color: inherit;
  border-bottom: 1px dotted var(--rule); min-height: 44px;
}
.alpha-row > a:hover { background: var(--bg-soft); }
.alpha-main {
  display: flex; align-items: baseline; gap: 6px; width: 100%;
  min-width: 0;
}
.alpha-te {
  flex: 0 1 auto; font-size: 16.5px; font-weight: 600; line-height: 1.45;
  overflow-wrap: anywhere; max-width: calc(100% - 4.5rem);
}
.alpha-dots {
  flex: 1 1 auto; min-width: 1.5rem; height: 0; align-self: center;
  border-bottom: 1px dotted var(--ink-faint); opacity: .7; margin: 0 2px 4px;
}
.alpha-num {
  flex: none; font-family: var(--sans); font-weight: 800; font-size: 14.5px;
  color: var(--link); min-width: 2.6em; text-align: right;
}
.alpha-rt {
  font-family: var(--sans); font-size: 13.5px; font-style: italic;
  color: var(--ink-soft); padding-inline-start: 2px;
}
.alpha-en, .alpha-sub {
  font-family: var(--sans); font-size: 12.5px; color: var(--ink-faint);
  padding-inline-start: 2px;
}
.alpha-meta {
  font-size: 12.5px; font-weight: 500; color: var(--ink-soft);
  line-height: 1.4; padding-inline-start: 2px; margin-top: 2px;
}
.alpha-meta-rt {
  font-family: var(--sans); font-size: 12px; font-style: italic; font-weight: 500;
  color: var(--ink-faint); line-height: 1.35; padding-inline-start: 2px;
}
@media (max-width: 640px) {
  .sticky-letter, .alpha-letter { top: calc(var(--header-h) + 52px); }
  .alpha-te { font-size: 15.5px; }
  .alpha-letter-te { font-size: 24px; }
}

.hymn-page .hymn-head { margin-top: 8px; }
.hymn-page .hymn-head .hymn-title { font-size: clamp(22px, 4vw, 30px); font-weight: 700; }
.hymn-page .hymn-title-roman {
  font-style: italic; font-size: .78em; color: var(--ink-soft);
}
.hymn-page .hymn-title-en {
  font-family: var(--sans); font-size: .68em; font-weight: 500;
  color: var(--ink-faint); line-height: 1.35;
}
.hymn-status { color: var(--ink-faint); }
.song-pager {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  margin: 28px 0 8px; padding-top: 18px; border-top: 1px solid var(--rule);
}
.btn-disabled {
  opacity: .45; pointer-events: none; cursor: default;
}
#fav-btn[aria-pressed="true"] {
  background: var(--accent-bg); color: var(--accent-fg); border-color: var(--accent-bg);
}
.search-results .re {
  font-family: var(--sans); font-size: 12px; color: var(--ink-faint);
}

.sitemap-list {
  margin: 18px 0 28px; padding-left: 1.2em; max-width: 40rem;
  font-size: 16px; line-height: 1.75;
}
.sitemap-list li { margin: 0 0 8px; }
.sitemap-list a { font-weight: 700; }

/* -------------------------------------------------------------------------
   11. Print
   ------------------------------------------------------------------------- */
@media print {
  .site-header, .breadcrumb, .reader-tools, .song-pager, .pager,
  .to-top, .progress, .search-overlay, .site-footer .foot-links { display: none !important; }
  body { font-size: 12pt; }
  .book-text { max-width: none; }
  .hymn { break-inside: avoid-page; }
}
