/* =========================================================
   Dr. Bhimnath Jha — site styles
   Theme: deep maroon ground, white type, restrained gold
   accents drawn from Mithila painting.
   ========================================================= */

:root {
  --bg:        #3e070d;   /* deep maroon */
  --bg-deep:   #2c0408;   /* alternate sections */
  --bg-deeper: #1f0306;   /* footer */
  --bg-raise:  #540c14;   /* cards */
  --bg-raise-2:#65111a;

  --ink:       #ffffff;
  --ink-soft:  rgba(255,255,255,.82);
  --muted:     rgba(255,255,255,.60);
  --line:      rgba(255,255,255,.16);
  --line-strong: rgba(255,255,255,.28);

  --gold:      #d9a84e;
  --gold-soft: #ecc98a;
  --gold-deep: #b9862c;

  --serif: "EB Garamond", "Noto Serif Devanagari", Georgia, "Times New Roman", serif;
  --deva:  "Noto Serif Devanagari", "EB Garamond", serif;
  --tirh:  "Noto Sans Tirhuta", "Noto Serif Devanagari", serif;

  --wrap: 1140px;
  --narrow: 780px;
  --radius: 6px;
  --shadow: 0 24px 48px -24px rgba(0,0,0,.55);

  /* Kachni-style border band: sawtooth between double rules */
  --band: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='14'%3E%3Cpath d='M0 .75h24M0 13.25h24' stroke='%23d9a84e' stroke-width='1.2'/%3E%3Cpath d='M0 11.5L6 3l6 8.5z' fill='%23d9a84e'/%3E%3Cpath d='M12 11.5L18 3l6 8.5' fill='none' stroke='%23ffffff' stroke-opacity='.7' stroke-width='1'/%3E%3Ccircle cx='18' cy='8.6' r='1.2' fill='%23ffffff'/%3E%3C/svg%3E");

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 92px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 85% -10%, rgba(178,24,36,.38), transparent 62%),
    radial-gradient(900px 700px at -10% 40%, rgba(120,10,22,.45), transparent 62%),
    radial-gradient(800px 500px at 50% 110%, rgba(217,168,78,.06), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--gold); color: var(--bg-deeper); }

/* ---------- language toggle ---------- */
html[data-lang="en"]  [data-l="mai"],
html[data-lang="mai"] [data-l="en"] { display: none !important; }

:lang(mai) { font-family: var(--deva); }
p:lang(mai), :lang(mai) p { line-height: 1.9; }
html[data-lang="mai"] body { font-size: 1.0625rem; }

.tirh { font-family: var(--tirh); font-weight: 400; letter-spacing: .02em; }

/* ---------- basics ---------- */
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold-soft); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color .15s; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
cite { font-style: italic; }
cite:lang(mai), :lang(mai) cite { font-style: normal; }
h1, h2, h3, h4 { font-weight: 500; line-height: 1.2; margin: 0; color: var(--ink); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
.narrow { max-width: var(--narrow); }
.center { text-align: center; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--bg-deeper); padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; }

.band { height: 14px; background: var(--band) repeat-x center / 24px 14px; opacity: .9; }

/* Placeholders the family still needs to fill in */
.todo {
  color: var(--gold-soft);
  font-style: italic;
  background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(217,168,78,.10) 6px 12px);
  border-bottom: 1px dashed var(--gold);
  padding: 0 .2em;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(31,3,6,.88);
  backdrop-filter: saturate(1.3) blur(10px);
  -webkit-backdrop-filter: saturate(1.3) blur(10px);
  transition: box-shadow .2s;
}
.site-header.scrolled { box-shadow: 0 8px 24px -12px rgba(0,0,0,.6); }
.header-row { display: flex; align-items: center; gap: 24px; min-height: 70px; }

.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); line-height: 1.15; margin-right: auto; }
.brand:hover { color: var(--ink); }
.brand-tirh { color: var(--gold); font-size: .95rem; }
.brand-name { font-size: 1.2rem; font-weight: 500; letter-spacing: .01em; }

.site-nav { display: flex; gap: 2px; flex-wrap: wrap; order: 2; }
.site-nav a {
  position: relative; color: var(--ink-soft); text-decoration: none;
  padding: 8px 11px; font-size: 1rem;
}
.site-nav a::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 3px; height: 1px;
  background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform .25s;
}
.site-nav a:hover, .site-nav a.active { color: var(--ink); }
.site-nav a:hover::after, .site-nav a.active::after { transform: scaleX(1); }

.header-tools { display: flex; align-items: center; gap: 12px; order: 3; }

/* language switch: segmented control, selected language in gold */
.lang-switch {
  display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 3px;
  border: 1px solid var(--line-strong); border-radius: 999px;
}
.lang-switch button {
  display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 13px;
  font: inherit; font-size: .9rem; line-height: 1; letter-spacing: .01em;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[data-set-lang="en"] { font-family: var(--serif); }   /* keep the Latin face in Maithili mode too */
.lang-switch button[lang="mai"] { font-family: var(--deva); font-size: .86rem; letter-spacing: 0; padding-top: 5px; }  /* Devanagari sits high: nudge down */
.lang-switch button[aria-pressed="true"] { background: var(--gold); color: var(--bg-deeper); font-weight: 600; }

/* the one call to action in the top bar */
.hdr-books {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 18px 0 15px;
  border-radius: 999px; background: var(--gold); color: var(--bg-deeper);
  font-size: .95rem; font-weight: 600; line-height: 1; letter-spacing: .01em; text-decoration: none; white-space: nowrap;
  transition: background .15s, box-shadow .15s;
}
.hdr-books:hover, .hdr-books:focus-visible { background: var(--gold-soft); color: var(--bg-deeper); }
.hdr-books [lang="mai"] { font-family: var(--deva); letter-spacing: 0; padding-top: 4px; }
.hdr-books[aria-current="page"] { box-shadow: 0 0 0 2px var(--bg-deeper), 0 0 0 3px var(--gold); }
.hdr-books-ico { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

.menu-btn { display: none; }
@media (min-width: 961px) {
  /* thin rule between the page links and the controls */
  .header-tools::before { content: ""; width: 1px; height: 24px; background: var(--line-strong); margin-right: 4px; }
}
@media (min-width: 961px) and (max-width: 1120px) {
  .header-row { gap: 16px; }
  .site-nav a { padding: 8px 8px; }
  .site-nav a::after { left: 8px; right: 8px; }
}
@media (min-width: 961px) and (max-width: 1010px) {
  .site-nav a { padding: 8px 6px; }
  .site-nav a::after { left: 6px; right: 6px; }
}

@media (max-width: 960px) {
  .header-row { flex-wrap: wrap; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 0; border-radius: 999px;
    background: transparent; cursor: pointer; transition: background .15s;
  }
  .menu-btn:hover, .menu-btn[aria-expanded="true"] { background: rgba(255,255,255,.08); }
  .brand { min-height: 70px; justify-content: center; }   /* keeps the top row still when the menu opens below it */
  .bars, .bars::before, .bars::after { display: block; width: 20px; height: 2px; background: var(--ink); position: relative; transition: transform .2s, background .2s; }
  .bars::before, .bars::after { content: ""; position: absolute; left: 0; }
  .bars::before { top: -6px; } .bars::after { top: 6px; }
  .menu-btn[aria-expanded="true"] .bars { background: transparent; }
  .menu-btn[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] .bars::after  { transform: translateY(-6px) rotate(-45deg); }
  .js .site-nav { display: none; }
  .site-nav { order: 4; width: 100%; flex-direction: column; padding: 4px 0 14px; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 4px; border-top: 1px solid var(--line); }
  .site-nav a::after { display: none; }
}

/* ---------- hero ---------- */
.hero { padding: 84px 0 96px; position: relative; overflow: hidden; }
.hero::after {               /* faint large Tirhuta watermark */
  content: "𑒦𑒲"; font-family: var(--tirh);
  position: absolute; right: -2%; bottom: -18%; font-size: min(42vw, 520px); line-height: 1;
  color: rgba(255,255,255,.035); pointer-events: none; z-index: 0;
}
.hero-grid { display: grid; grid-template-columns: 1.3fr .9fr; gap: 64px; align-items: center; position: relative; z-index: 1; }

.hero-tirh { color: var(--gold); font-size: clamp(1.9rem, 4vw, 2.8rem); margin: 0 0 8px; line-height: 1.3; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.5rem); letter-spacing: -.012em; font-weight: 500; }
.hero h1 [lang="mai"] { font-weight: 600; letter-spacing: 0; }
.hero-alt { margin: 8px 0 0; color: var(--ink-soft); font-size: 1.3rem; }
.roles {
  margin: 22px 0 0; color: var(--gold); text-transform: uppercase;
  letter-spacing: .22em; font-size: .82rem; font-weight: 600;
  display: flex; align-items: center; gap: 14px;
}
.roles::before { content: ""; width: 36px; height: 1px; background: var(--gold); }
.roles [lang="mai"] { text-transform: none; letter-spacing: .04em; font-size: 1rem; }
.lede { font-size: 1.32rem; margin: 22px 0 0; max-width: 33em; color: var(--ink-soft); }
html[data-lang="mai"] .lede { font-size: 1.15rem; }
.lede cite { color: var(--ink); }

.facts {
  display: grid; grid-template-columns: repeat(3, auto); gap: 12px 36px;
  margin: 32px 0 0; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  justify-content: start;
}
.facts dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.facts dt [lang="mai"] { text-transform: none; letter-spacing: 0; font-size: .9rem; }
.facts dd { margin: 3px 0 0; font-size: 1.05rem; }

.cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 32px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 1rem; font-weight: 500;
  padding: 12px 22px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); color: var(--ink); background: transparent;
  transition: background .18s, color .18s, border-color .18s, transform .18s;
}
.btn:hover { border-color: var(--ink); color: var(--ink); background: rgba(255,255,255,.06); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--bg-deeper); }
.btn-primary:hover { background: var(--gold-soft); border-color: var(--gold-soft); color: var(--bg-deeper); transform: translateY(-1px); }
.btn.is-disabled { cursor: default; }
.btn.todo { color: var(--bg-deeper); border-bottom-style: solid; }

/* Arched portrait frame */
.portrait { margin: 0; justify-self: center; width: 100%; max-width: 390px; }
.portrait-frame {
  position: relative; aspect-ratio: 4 / 5;
  border-radius: 999px 999px 8px 8px / 46% 46% 8px 8px;
  padding: 12px; background: linear-gradient(160deg, var(--gold-soft), var(--gold-deep));
  box-shadow: var(--shadow);
}
.portrait-frame::before {
  content: ""; position: absolute; inset: 6px;
  border-radius: inherit; border: 1px solid rgba(31,3,6,.55); pointer-events: none;
}
.portrait-frame > img,
.portrait-placeholder {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
  border-radius: 999px 999px 4px 4px / 44% 44% 4px 4px;
}
.portrait-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: radial-gradient(circle at 50% 36%, rgba(217,168,78,.22), transparent 58%), var(--bg-deep);
  color: var(--gold);
}
.portrait-placeholder .tirh { font-size: 6.5rem; line-height: 1; }
.portrait-placeholder small { color: var(--muted); font-size: .95rem; font-style: italic; }

@media (max-width: 880px) {
  .hero { padding: 40px 0 56px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .portrait { order: -1; max-width: 270px; }
  .facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 440px) {
  .wrap { padding: 0 16px; }
  .facts { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.4rem; }
}

/* ---------- sections ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-deep); }
.section-alt::before, .section-alt::after {
  content: ""; display: block; height: 14px; background: var(--band) repeat-x center / 24px 14px; opacity: .55;
}
.section-alt::before { margin: -96px 0 82px; }
.section-alt::after  { margin: 82px 0 -96px; }

.section-head { text-align: center; margin-bottom: 48px; }
.kicker { color: var(--gold); font-size: 1.15rem; margin: 0 0 6px; }
.section-head h2 { font-size: clamp(2rem, 3.8vw, 2.8rem); }
.divider { display: block; width: 64px; height: 36px; margin: 16px auto 0; color: var(--ink); }

.prose p { margin: 0 0 1.15em; color: var(--ink-soft); }
.prose cite, .prose em { color: var(--ink); }
.prose .drop { color: var(--ink); }
.prose .drop::first-letter {
  float: left; font-size: 3.6em; line-height: .88; padding: .06em .12em 0 0; color: var(--gold); font-weight: 500;
}
.prose:lang(mai) .drop::first-letter { float: none; font-size: inherit; padding: 0; color: inherit; }

.verse {
  margin: 52px 0 0; padding: 34px 36px; text-align: center;
  background: var(--bg-raise); border-radius: var(--radius); position: relative;
}
.verse::before, .verse::after {
  content: ""; position: absolute; left: 18px; right: 18px; height: 14px;
  background: var(--band) repeat-x center / 24px 14px;
}
.verse::before { top: -7px; } .verse::after { bottom: -7px; }
.verse p { font-size: 1.4rem; margin: 0; }
.verse footer { margin-top: 12px; color: var(--muted); font-size: .95rem; }

.note { color: var(--ink-soft); margin-top: 40px; font-size: 1.05rem; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 100px; top: 8px; bottom: 8px; width: 1px;
  background: linear-gradient(var(--gold), rgba(217,168,78,.15));
}
.timeline li { display: grid; grid-template-columns: 82px 1fr; gap: 0 46px; padding: 12px 0 20px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: 94px; top: 19px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--bg-deep); border: 2px solid var(--gold);
}
.timeline li.highlight::before { background: var(--gold); box-shadow: 0 0 0 5px rgba(217,168,78,.18); }
.timeline .year { text-align: right; font-weight: 600; color: var(--gold); font-size: 1.15rem; padding-top: 2px; }
.timeline p { margin: 0; color: var(--ink-soft); }
.timeline li.highlight p { color: var(--ink); font-weight: 500; }

@media (max-width: 580px) {
  .timeline::before { left: 6px; }
  .timeline li { grid-template-columns: 1fr; padding-left: 34px; }
  .timeline li::before { left: 0; }
  .timeline .year { text-align: left; }
}

/* ---------- works ---------- */
.group-title {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .2em; color: var(--gold);
  margin: 56px 0 18px; display: flex; align-items: center; gap: 16px; font-weight: 600;
}
.group-title:first-of-type { margin-top: 0; }
.group-title [lang="mai"] { text-transform: none; letter-spacing: .02em; font-size: 1.05rem; font-weight: 500; }
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.books { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.book {
  background: var(--bg-raise); border-radius: var(--radius);
  padding: 26px 24px 22px; display: flex; flex-direction: column;
  border: 1px solid transparent; position: relative;
  transition: transform .2s, border-color .2s, background .2s;
}
.book::before {
  content: ""; position: absolute; left: 24px; top: 0; width: 34px; height: 3px; background: var(--gold);
}
.book:hover { transform: translateY(-3px); border-color: var(--line-strong); background: var(--bg-raise-2); }
.book h4 { font-family: var(--deva); font-size: 1.5rem; font-weight: 600; }
.book .translit { margin: 2px 0 0; font-style: italic; color: var(--muted); }
.book .desc { margin: 14px 0 0; font-size: 1rem; color: var(--ink-soft); }
.book .meta { margin: auto 0 0; padding-top: 14px; font-size: .9rem; color: var(--muted); }
.book .desc + .meta { margin-top: 10px; }
.book .link { margin: 14px 0 0; font-size: .95rem; }
.book-award { background: linear-gradient(170deg, rgba(217,168,78,.20), transparent 55%), var(--bg-raise); border-color: rgba(217,168,78,.35); }
.badge {
  align-self: flex-start; margin: 0 0 12px; font-size: .74rem; letter-spacing: .06em;
  background: var(--gold); color: var(--bg-deeper); padding: 3px 11px; border-radius: 999px; font-weight: 600;
}

/* ---------- stats band ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 64px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stats > div { padding: 26px 16px; text-align: center; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats dt { font-size: clamp(2.2rem, 4vw, 3rem); color: var(--gold); line-height: 1; font-weight: 500; font-variant-numeric: lining-nums; }
.stats dd { margin: 10px 0 0; color: var(--ink-soft); font-size: .98rem; }
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------- bibliography ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 30px; }
.filters button {
  font: inherit; font-size: .95rem; cursor: pointer;
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 16px;
  transition: background .15s, color .15s, border-color .15s;
}
.filters button small { font-size: .78rem; color: var(--muted); margin-left: 4px; font-variant-numeric: lining-nums; }
.filters button:hover { color: var(--ink); border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--bg-deeper); }
.filters button[aria-pressed="true"] small { color: var(--bg-deep); }

.biblio { columns: 2; column-gap: 26px; }
.bib-group {
  background: var(--bg-raise); border-radius: var(--radius); padding: 26px 28px 18px;
  border-top: 3px solid var(--gold); break-inside: avoid; margin: 0 0 26px; display: block;
}
.bib-group[hidden] { display: none; }
.biblio.single { columns: 1; }
.biblio.single .bib { columns: 2; column-gap: 40px; }
.bib-group h4 { font-size: 1.3rem; margin-bottom: 10px; }
.bib-group h4 [lang="mai"] { font-size: 1.15rem; }
.bib { list-style: none; margin: 0; padding: 0; }
.bib li {
  display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: baseline;
  padding: 11px 0; border-top: 1px solid var(--line); break-inside: avoid;
}
.bib li:first-child { border-top: 0; }
.bib .by { color: var(--gold); font-weight: 600; font-size: .98rem; font-variant-numeric: lining-nums tabular-nums; }
.bib .bt { display: block; font-family: var(--deva); font-size: 1.12rem; color: var(--ink); line-height: 1.5; }
.bib .tr { display: block; font-style: italic; color: var(--muted); font-size: .95rem; line-height: 1.4; }
.bib .bn { display: block; color: var(--ink-soft); font-size: .9rem; margin-top: 2px; line-height: 1.45; }
.bib li.star .bt::after { content: " ★"; color: var(--gold); font-size: .85em; }
.source-note { margin: 26px 0 0; color: var(--muted); font-size: .92rem; font-style: italic; text-align: center; }
.source-note [lang="mai"] { font-style: normal; }
@media (max-width: 860px) {
  .biblio { columns: 1; }
  .biblio.single .bib { columns: 1; }
  .bib-group { padding: 22px 18px 14px; }
}

/* ---------- honours ---------- */
.honours-layout { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: start; }
.honours-layout .group-title { margin-top: 0; }
.honours { list-style: none; margin: 0; padding: 0; }
.honours li { display: grid; grid-template-columns: 74px 1fr; gap: 22px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.honours li:last-child { border-bottom: 0; }
.h-year { font-size: 1.3rem; color: var(--gold); font-weight: 600; text-align: right; line-height: 1.3; font-variant-numeric: lining-nums; }
.honours h4 { font-size: 1.3rem; }
.honours p { margin: 4px 0 0; color: var(--ink-soft); font-size: 1.02rem; }
.honour-main h4 { font-size: 1.6rem; }
.honour-main .h-year { font-size: 1.9rem; line-height: 1.1; }

.service { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.service li { background: var(--bg-raise); border-radius: var(--radius); padding: 18px 22px; border-left: 3px solid var(--gold); }
.s-when { display: block; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); font-weight: 600; font-variant-numeric: lining-nums; }
.s-when [lang="mai"] { text-transform: none; letter-spacing: 0; font-size: .95rem; }
.service h4 { font-size: 1.2rem; margin-top: 4px; }
.service p { margin: 4px 0 0; color: var(--ink-soft); font-size: 1rem; }

.tribute { margin: 72px auto 0; max-width: 820px; text-align: center; }
.tribute blockquote { margin: 0; position: relative; padding-top: 34px; }
.tribute blockquote::before {
  content: "“"; position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  font-size: 5rem; line-height: 1; color: var(--gold); opacity: .8;
}
.tribute blockquote p { margin: 0; font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.45; color: var(--ink); font-style: italic; }
.tribute .tribute-orig { font-family: var(--deva); font-style: normal; font-size: 1.12rem; color: var(--ink-soft); margin-top: 14px; }
html[data-lang="mai"] .tribute .tribute-orig { font-size: clamp(1.25rem, 2.4vw, 1.6rem); color: var(--ink); margin-top: 0; }
.tribute figcaption { margin-top: 18px; color: var(--muted); font-size: .95rem; }
.tribute figcaption::before { content: "— "; }

@media (max-width: 900px) { .honours-layout { grid-template-columns: 1fr; gap: 40px; } }
@media (max-width: 480px) {
  .honours li { grid-template-columns: 1fr; gap: 4px; }
  .h-year { text-align: left; }
}

/* ---------- letters ---------- */
.section-intro { max-width: 640px; margin: 22px auto 0; color: var(--ink-soft); }
.letters-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.letter {
  background: var(--bg-raise); border-radius: var(--radius);
  padding: 40px 40px 32px; position: relative; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.letter::before {
  content: ""; position: absolute; inset: 10px; border: 1px solid rgba(217,168,78,.35); border-radius: 3px; pointer-events: none;
}
.letter-year { margin: 0; text-align: center; color: var(--gold); font-size: .85rem; letter-spacing: .2em; font-weight: 600; }
.letter-title { font-family: var(--deva); font-size: 1.45rem; text-align: center; color: var(--ink); margin: 6px 0 18px; line-height: 1.4; }
.letter .prose p { margin-bottom: .6em; }
.letter-meta { margin: auto 0 0; padding-top: 14px; text-align: center; color: var(--muted); font-size: .92rem; font-style: italic; }
.letter-meta [lang="mai"] { font-style: normal; }
@media (max-width: 760px) { .letters-grid { grid-template-columns: 1fr; } }
@media (max-width: 580px) { .letter { padding: 32px 24px 26px; } }

/* ---------- gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 820px) { .gallery { grid-template-columns: repeat(2, 1fr); gap: 14px; } }
.gallery figure { margin: 0; }
.gallery img, .ph-img { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; border-radius: var(--radius); }
.gallery img { box-shadow: var(--shadow); }
.ph-img { display: flex; align-items: center; justify-content: center; background: var(--bg-raise); border: 1px dashed var(--line-strong); }
.ph-img svg { width: 64px; height: 36px; color: var(--ink); opacity: .45; }
.gallery figcaption { font-size: .95rem; color: var(--ink-soft); margin-top: 10px; text-align: center; }

/* ---------- videos ---------- */
.v-group { font-size: 1.5rem; text-align: center; margin: 0 0 22px; }
.v-group ~ .v-group { margin-top: 64px; }
.v-group-note { text-align: center; color: var(--ink-soft); margin: -12px auto 26px; max-width: 640px; }
.videos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 22px; }
@media (max-width: 820px) { .videos { grid-template-columns: repeat(2, 1fr); gap: 22px 14px; } }
@media (max-width: 520px) { .videos { grid-template-columns: 1fr; } }
.v-item { margin: 0; }
.v-play, .v-item iframe {
  display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0;
  border-radius: var(--radius); box-shadow: var(--shadow); background: #000; overflow: hidden;
}
.v-play { position: relative; cursor: pointer; }
.v-play img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease, opacity .3s; opacity: .88; }
.v-play:hover img, .v-play:focus-visible img { transform: scale(1.04); opacity: 1; }
.v-play:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.v-icon {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border-radius: 50%; background: rgba(31,3,6,.78); border: 2px solid var(--gold);
  transition: background .2s, transform .2s;
}
.v-icon::after {
  content: ""; position: absolute; left: 25px; top: 19px;
  border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent var(--gold);
}
.v-play:hover .v-icon { background: var(--gold); transform: scale(1.06); }
.v-play:hover .v-icon::after { border-left-color: var(--bg-deeper); }
.v-item figcaption { font-size: .95rem; color: var(--ink-soft); margin-top: 10px; text-align: center; line-height: 1.45; }
.v-item figcaption cite { color: var(--ink); }

/* ---------- links ---------- */
.links { list-style: none; margin: 0; padding: 0; }
.links li { padding: 18px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.links li:last-child { border-bottom: 0; }
.links a, .link-label { font-size: 1.22rem; font-weight: 500; }
.links a { color: var(--ink); text-decoration: none; }
.links a:hover { color: var(--gold-soft); }
.links li > span:last-child { color: var(--muted); font-size: 1rem; }

/* ---------- footer ---------- */
.site-footer { background: var(--bg-deeper); color: var(--ink-soft); }
.site-footer .band { opacity: .6; }
.footer-inner { text-align: center; padding: 48px 24px 56px; }
.site-footer .divider { margin-top: 0; }
.footer-tirh { color: var(--gold); font-size: 1.7rem; margin: 12px 0 8px; }
.site-footer p { margin: 4px 0; }
.site-footer .small { font-size: .88rem; color: var(--muted); }

/* ---------- back to top ---------- */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold); color: var(--bg-deeper); text-decoration: none; font-size: 1.2rem;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { color: var(--bg-deeper); background: var(--gold-soft); }

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .book, .btn, .to-top { transition: none; }
}

/* ---------- print ---------- */
@media print {
  :root { --ink: #000; --ink-soft: #222; --muted: #555; --gold: #7a2533; }
  .site-header, .cta, .lang-switch, .gallery, #contact, .to-top, .band, .hero::after { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .section, .section-alt { padding: 24px 0; background: #fff; }
  .section-alt::before, .section-alt::after { display: none; }
  .book, .letter, .verse { background: #fff; border: 1px solid #ccc; box-shadow: none; }
  .js .reveal { opacity: 1; transform: none; }
}

/* =========================================================
   Additions: verse, quotes, scholars, gallery, lightbox
   ========================================================= */

/* his own verse in the About section */
.verse .verse-text { font-family: var(--deva); font-size: clamp(1.25rem, 2.2vw, 1.5rem); line-height: 1.9; font-style: normal; color: var(--ink); }
.verse .verse-tr { margin-top: 16px; font-size: 1.08rem; font-style: italic; color: var(--ink-soft); line-height: 1.7; }

/* tributes */
#tributes .tribute { margin-top: 0; }
.tribute blockquote p[lang="hi"] { font-family: var(--deva); font-style: normal; }
.quotes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; margin-top: 64px; }
.quote { margin: 0; background: var(--bg-raise); border-radius: var(--radius); padding: 28px 30px 24px; position: relative; display: flex; flex-direction: column; }
.quote::before { content: "“"; position: absolute; top: 6px; left: 18px; font-size: 3.4rem; line-height: 1; color: var(--gold); opacity: .55; }
.quote blockquote { margin: 0; padding-top: 18px; flex: 1; }
.quote blockquote p { margin: 0; font-size: 1.12rem; line-height: 1.65; color: var(--ink); font-style: italic; }
.quote blockquote p:lang(mai), .quote blockquote p:lang(hi) { font-family: var(--deva); font-style: normal; font-size: 1.05rem; }
.quote .q-orig { margin-top: 12px !important; color: var(--ink-soft) !important; font-size: .98rem !important; }
html[data-lang="mai"] .quote .q-orig { margin-top: 0 !important; color: var(--ink) !important; font-size: 1.05rem !important; }
.quote .q-verse { line-height: 1.95 !important; }
.quote .q-gloss { margin-top: 12px !important; font-size: .98rem !important; color: var(--ink-soft) !important; }
.quote figcaption { margin-top: 16px; color: var(--gold); font-size: .92rem; }
.quote figcaption::before { content: "— "; }
.quote-verse { grid-column: 1 / -1; text-align: center; }
.quote-verse::before { left: 50%; transform: translateX(-50%); }
@media (max-width: 760px) { .quotes { grid-template-columns: 1fr; } .quote-verse { text-align: left; } .quote-verse::before { left: 18px; transform: none; } }

/* doctoral scholars list */
.scholars { margin-top: 10px; }
.scholars summary { cursor: pointer; color: var(--gold-soft); font-size: .95rem; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.scholars summary::-webkit-details-marker { display: none; }
.scholars summary::after { content: "▾"; font-size: .8em; transition: transform .2s; }
.scholars[open] summary::after { transform: rotate(180deg); }
.scholars ol { margin: 10px 0 0; padding-left: 1.4em; columns: 2; column-gap: 24px; font-size: .95rem; color: var(--ink-soft); }
.scholars li { break-inside: avoid; padding: 2px 0; }
.scholars li span { color: var(--muted); font-size: .85em; margin-left: 4px; font-variant-numeric: lining-nums; }
.scholars-note { margin: 8px 0 0 !important; font-size: .82rem !important; color: var(--muted) !important; font-style: italic; }
@media (max-width: 480px) { .scholars ol { columns: 1; } }

/* gallery */
.gfilters { justify-content: center; }
.g-item { margin: 0; }
.g-item[hidden] { display: none; }
.g-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); position: relative; }
.g-open img { aspect-ratio: 4 / 3; width: 100%; height: auto; object-fit: cover; border-radius: 0; box-shadow: none; transition: transform .4s ease, filter .3s; }
.g-item.tall .g-open img { object-position: 50% 22%; }
.g-open:hover img, .g-open:focus-visible img { transform: scale(1.04); filter: brightness(1.06); }
.g-open::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(217,168,78,.0); border-radius: var(--radius); transition: border-color .2s; pointer-events: none; }
.g-open:hover::after { border-color: rgba(217,168,78,.6); }
.gallery figcaption { font-size: .92rem; line-height: 1.45; padding: 0 6px; }

/* lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; color: var(--ink); }
.lightbox::backdrop { background: rgba(20,2,4,.92); }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox figure { margin: 0; max-width: min(92vw, 1200px); text-align: center; }
.lightbox img { max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: 4px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.8); }
.lightbox figcaption { margin-top: 14px; color: var(--ink-soft); font-size: 1rem; }
.lb-close, .lb-prev, .lb-next {
  position: fixed; border: 0; cursor: pointer; color: var(--ink); background: rgba(255,255,255,.08);
  width: 48px; height: 48px; border-radius: 50%; font-size: 1.8rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: var(--gold); color: var(--bg-deeper); }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) { .lb-prev, .lb-next { top: auto; bottom: 18px; transform: none; } }
@media print { .lightbox, .gfilters { display: none !important; } }
.quotes .quote:first-child { grid-column: 1 / -1; }
.g-item.tall .g-open img { object-position: 50% 8%; }

/* contact card */
.contact-intro { color: var(--ink-soft); max-width: 560px; margin: 0 auto; }
.contact-card {
  margin: 30px auto 0; max-width: 560px; padding: 30px 28px 32px;
  background: var(--bg-raise); border-radius: var(--radius); border-top: 3px solid var(--gold); box-shadow: var(--shadow);
}
.contact-name { margin: 0; font-size: 1.5rem; color: var(--ink); }
.contact-role { margin: 2px 0 0; color: var(--gold); font-size: .95rem; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }
.contact-actions .btn { font-variant-numeric: lining-nums; }
@media (max-width: 480px) { .contact-actions .btn { width: 100%; justify-content: center; } }
.contact-address { font-style: normal; margin: 18px auto 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-soft); line-height: 1.6; }
.ca-label { display: block; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.ca-label [lang="mai"] { text-transform: none; letter-spacing: 0; font-size: .9rem; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; max-width: 900px; margin: 30px auto 0; align-items: stretch; }
.contact-grid .contact-card { margin: 0; max-width: none; display: flex; flex-direction: column; }
.contact-grid .contact-actions { margin-top: auto; padding-top: 22px; }
.contact-grid .contact-address { border-top: 0; padding-top: 0; margin-top: 14px; }
@media (max-width: 760px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } .contact-card { overflow-wrap: anywhere; } }

/* =========================================================
   Bookshop (books.html), policy pages, reader (read.html)
   ========================================================= */
.btn-sm { padding: 8px 15px; font-size: .92rem; }
button.btn { font-family: inherit; line-height: inherit; cursor: pointer; }

/* page heading used by the shop and policy pages */
.shop-hero, .page-hero { text-align: center; padding: 80px 0 24px; }
.shop-hero h1, .page-hero h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); }
.shop-lede { max-width: 680px; margin: 22px auto 0; color: var(--ink-soft); font-size: 1.15rem; }
.shop-points { list-style: none; padding: 0; margin: 30px 0 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 28px; color: var(--ink); font-size: 1rem; }
.shop-points li { display: inline-flex; align-items: center; gap: 9px; }
.shop-points svg { width: 22px; height: 22px; color: var(--gold); flex: none; }
.shop-section { padding-top: 48px; }
.shelf-filters { justify-content: center; margin-bottom: 36px; }

/* shelf: horizontal cards, cover on the left */
.shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (max-width: 900px) { .shelf { grid-template-columns: 1fr; } }
.sb {
  display: grid; grid-template-columns: 132px 1fr; gap: 22px; align-items: start;
  background: var(--bg-raise); border-radius: var(--radius); padding: 22px; border: 1px solid transparent;
  transition: border-color .2s, transform .2s;
}
.sb:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.sb[hidden] { display: none; }
.sb-body { display: flex; flex-direction: column; min-height: 100%; }
.sb-body .badge { margin-bottom: 8px; }
.sb h3 { font-family: var(--deva); font-size: 1.45rem; font-weight: 600; line-height: 1.3; }
.sb .translit { margin: 0; font-style: italic; color: var(--muted); font-size: 1rem; }
.sb-meta { margin: 6px 0 0; color: var(--gold-soft); font-size: .85rem; letter-spacing: .04em; }
.sb-desc { margin: 10px 0 0; color: var(--ink-soft); font-size: .98rem; line-height: 1.55; }
.sb-buy { margin-top: auto; padding-top: 16px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 14px; }
.price { margin: 0; font-size: 1.45rem; color: var(--ink); font-weight: 500; font-variant-numeric: lining-nums; line-height: 1.1; }
.price small { display: block; font-size: .74rem; color: var(--muted); letter-spacing: .04em; margin-top: 3px; font-weight: 400; }
.sb-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.soon { font-size: .82rem; color: var(--gold-soft); border: 1px dashed rgba(217,168,78,.55); padding: 6px 12px; border-radius: 999px; }
@media (max-width: 480px) {
  .sb { grid-template-columns: 96px 1fr; gap: 16px; padding: 16px; }
  .sb h3 { font-size: 1.25rem; }
}

/* drawn book covers (used until real cover images are added) */
.cover { position: relative; aspect-ratio: 2 / 3; border-radius: 3px 6px 6px 3px; overflow: hidden; box-shadow: 0 14px 28px -12px rgba(0,0,0,.7), 0 2px 4px rgba(0,0,0,.35); container-type: inline-size; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-drawn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 18% 12% 12%; color: var(--gold-soft);
}
.cover-drawn::before { /* gold frame */
  content: ""; position: absolute; inset: 7%; border: 1px solid rgba(236,201,138,.55); border-radius: 2px; pointer-events: none;
}
.cover-drawn::after { /* spine */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7%;
  background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(255,255,255,.08) 70%, rgba(0,0,0,.2));
}
.tone-1 { background: radial-gradient(120% 80% at 70% 10%, #8c1a28, #3e070d 70%); }
.tone-2 { background: radial-gradient(120% 80% at 70% 10%, #6e1a48, #26061a 70%); }
.tone-3 { background: radial-gradient(120% 80% at 70% 10%, #7d4716, #2b1405 70%); }
.tone-4 { background: radial-gradient(120% 80% at 70% 10%, #1c5a52, #071f1c 70%); }
.cv-top { position: absolute; left: 7%; right: 7%; top: 11%; height: 8cqw; background: var(--band) repeat-x center / auto 100%; opacity: .7; }
.cv-title { position: relative; font-family: var(--deva); font-weight: 600; font-size: 16.5cqw; line-height: 1.3; color: #fff; text-wrap: balance; }
.cv-lotus { position: relative; width: 26cqw; height: 15cqw; margin-top: 8cqw; color: var(--gold-soft); }
.cv-author { position: absolute; left: 0; right: 0; bottom: 13%; font-family: var(--deva); font-size: 8.5cqw; color: var(--gold-soft); letter-spacing: .02em; }
.cover-sm { width: 110px; }

/* how it works */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; counter-reset: none; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }
.steps li { background: var(--bg-raise); border-radius: var(--radius); padding: 26px 26px 22px; }
.step-n { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; align-items: center; justify-content: center; border: 1px solid var(--gold); color: var(--gold); font-weight: 600; margin-bottom: 12px; font-variant-numeric: lining-nums; }
.steps h3 { font-size: 1.3rem; }
.steps p { margin: 8px 0 0; color: var(--ink-soft); font-size: 1rem; }
.shop-help { max-width: 720px; margin-left: auto; margin-right: auto; }

/* footer links (all pages) */
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; margin: 18px 0 6px; font-size: .95rem; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--gold-soft); text-decoration: underline; }

/* policy pages */
.policy { padding: 16px 0 96px; }
.policy .updated { text-align: center; color: var(--muted); font-size: .95rem; margin: 10px 0 0; }
.policy-body { background: var(--bg-raise); border-radius: var(--radius); padding: 44px 48px; margin-top: 36px; }
@media (max-width: 640px) { .policy-body { padding: 28px 22px; } }
.policy-body h2 { font-size: 1.45rem; margin: 34px 0 10px; color: var(--gold-soft); }
.policy-body h2:first-child { margin-top: 0; }
.policy-body p, .policy-body li { color: var(--ink-soft); font-size: 1.05rem; }
.policy-body p { margin: 0 0 1em; }
.policy-body ul { margin: 0 0 1em; padding-left: 1.3em; }
.policy-body li { margin-bottom: .4em; }
.policy-body strong { color: var(--ink); font-weight: 500; }
.policy-note { text-align: center; color: var(--gold-soft); margin: 18px auto 0; max-width: 640px; }
.contact-list { list-style: none; padding: 0 !important; }
.contact-list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.contact-list li:last-child { border-bottom: 0; }
.contact-list .k { color: var(--muted); font-size: .95rem; }
@media (max-width: 520px) { .contact-list li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- reader ---------- */
.reader-page { background: #170205; background-image: none; }
.rd-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: 60px;
  display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: rgba(31,3,6,.96); border-bottom: 1px solid rgba(217,168,78,.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.rd-back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); text-decoration: none; font-size: .98rem; padding: 6px 8px; border-radius: var(--radius); flex: none; }
.rd-back:hover { color: var(--ink); background: rgba(255,255,255,.06); }
.rd-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
#rd-t { font-family: var(--deva); font-size: 1.15rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-tag { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; background: rgba(217,168,78,.18); color: var(--gold-soft); padding: 3px 9px; border-radius: 999px; flex: none; }
.rd-tag [lang="mai"] { text-transform: none; letter-spacing: 0; }
.rd-tools { display: flex; align-items: center; gap: 10px; flex: none; }
.rd-group { display: flex; align-items: center; gap: 2px; background: rgba(255,255,255,.05); border-radius: var(--radius); padding: 2px; }
.rd-btn, .rd-zval {
  font: inherit; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer;
  height: 36px; min-width: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px;
}
.rd-btn:hover, .rd-zval:hover { background: rgba(255,255,255,.1); color: var(--ink); }
.rd-zval { font-size: .85rem; min-width: 52px; font-variant-numeric: tabular-nums lining-nums; }
.rd-page { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; padding: 0 4px; font-variant-numeric: tabular-nums lining-nums; }
.rd-page input { width: 3.2em; text-align: center; font: inherit; color: var(--ink); background: rgba(0,0,0,.3); border: 1px solid var(--line-strong); border-radius: 4px; padding: 4px 2px; }
.rd-pages { padding: 78px 12px 40px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; overflow-x: auto; min-height: 100vh; }
.rd-sheet { margin: 0 auto; }   /* auto margins centre a page, yet let a zoomed-in page scroll all the way to its left edge */
.rd-sheet {
  flex: none; background: #f4f0e8; box-shadow: 0 10px 30px -8px rgba(0,0,0,.7); position: relative;
  background-image: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  background-size: 300% 100%; animation: rd-shimmer 1.6s linear infinite;
}
.rd-sheet.is-ready { animation: none; background: #fff; }
.rd-sheet canvas { display: block; }
@keyframes rd-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.rd-status { position: fixed; inset: 60px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--ink-soft); text-align: center; padding: 24px; }
.rd-status[hidden] { display: none; }
.rd-status.is-error p { max-width: 420px; margin: 0; }
.rd-spin { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(217,168,78,.25); border-top-color: var(--gold); animation: rd-spin 0.9s linear infinite; }
@keyframes rd-spin { to { transform: rotate(360deg); } }
.rd-end { display: flex; gap: 28px; align-items: center; max-width: 640px; margin: 8px auto 64px; padding: 28px 30px; background: var(--bg-raise); border-radius: var(--radius); border: 1px solid rgba(217,168,78,.35); }
.rd-end[hidden] { display: none; }
.rd-end-k { margin: 0; color: var(--gold); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; }
.rd-end-k [lang="mai"] { text-transform: none; letter-spacing: 0; font-size: .95rem; }
.rd-end h2 { font-family: var(--deva); font-size: 1.8rem; margin: 4px 0 6px; }
.rd-end-p { margin: 0 0 16px; color: var(--ink-soft); font-size: 1rem; }
@media (max-width: 760px) {
  .rd-bar { gap: 8px; padding: 0 8px; }
  .rd-label, .rd-full { display: none !important; }
  .rd-tag { display: none; }
  .rd-tools { gap: 6px; }
  .rd-tools .btn-sm { padding: 7px 11px; font-size: .85rem; }
  .rd-pages { padding: 72px 6px 32px; gap: 10px; }
  .rd-end { flex-direction: column; text-align: center; margin: 8px 12px 48px; }
}
@media print { .reader-page { display: none; } }

/* bookshop banner in the Works section */
.shop-callout {
  display: flex; align-items: center; justify-content: space-between; gap: 18px 32px; flex-wrap: wrap;
  margin: 48px 0 8px; padding: 28px 32px; border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(217,168,78,.18), transparent 60%), var(--bg-raise);
  border: 1px solid rgba(217,168,78,.4);
}
.shop-callout > div { flex: 1 1 380px; }
.shop-callout-k { margin: 0; color: var(--gold); font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; }
.shop-callout-k [lang="mai"] { text-transform: none; letter-spacing: .02em; font-size: 1rem; }
.shop-callout h3 { font-size: 1.6rem; margin: 4px 0 6px; }
.shop-callout p:last-child { margin: 0; color: var(--ink-soft); font-size: 1.02rem; }

/* ---------- checkout ---------- */
.test-banner { max-width: 760px; margin: -12px auto 30px; text-align: center; font-size: .95rem; color: var(--bg-deeper); background: var(--gold-soft); border-radius: var(--radius); padding: 10px 16px; }
.test-banner strong { font-weight: 600; }
.pay-dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: min(440px, calc(100vw - 32px)); }
.pay-dialog::backdrop { background: rgba(10,0,2,.72); backdrop-filter: blur(3px); }
.pay-box { background: var(--bg-raise); border: 1px solid rgba(217,168,78,.4); border-radius: 10px; padding: 30px 30px 24px; text-align: center; box-shadow: var(--shadow); }
.pay-box p { margin: 0 0 10px; color: var(--ink-soft); font-size: 1.02rem; }
.pay-box h2 { font-family: var(--deva); font-size: 1.7rem; margin: 2px 0 12px; }
.pay-box .rd-spin { margin: 6px auto 16px; display: block; }
.pay-k { color: var(--gold) !important; font-size: .85rem !important; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.pay-k [lang="mai"] { text-transform: none; letter-spacing: 0; font-size: 1rem; }
.is-error .pay-k { color: #f0a0a0 !important; }
.pay-tick { width: 52px; height: 52px; margin: 0 auto 12px !important; border-radius: 50%; background: var(--gold); color: var(--bg-deeper) !important; font-size: 1.6rem !important; line-height: 52px; font-weight: 600; }
.pay-small { font-size: .9rem !important; color: var(--muted) !important; }
.pay-small code { color: var(--ink); font-size: .85rem; }
.pay-test { font-size: .88rem !important; background: rgba(217,168,78,.12); border-radius: var(--radius); padding: 8px 12px; color: var(--gold-soft) !important; }
.pay-actions { margin: 16px 0 0 !important; }

/* ---------- My books ---------- */
.badge-owned { background: rgba(217,168,78,.18); color: var(--gold-soft); }
.sb.is-owned { border-color: rgba(217,168,78,.35); }
.lib-who { text-align: center; color: var(--ink-soft); margin: 0 0 30px; }
.lib-who strong { color: var(--ink); font-weight: 500; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--gold-soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish:hover { color: var(--ink); }
.lib-intro { text-align: center; color: var(--ink-soft); font-size: 1.12rem; margin: 0 auto 30px; max-width: 620px; }
.lib-forms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; max-width: 900px; margin: 0 auto; align-items: start; }
.lib-forms:has(#lib-link-card[hidden]) { grid-template-columns: 1fr; max-width: 460px; }
.lib-forms:has(#lib-link-card[hidden]) #lib-link { display: none; }
@media (max-width: 760px) { .lib-forms { grid-template-columns: 1fr; } }
.lib-card { background: var(--bg-raise); border-radius: var(--radius); padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.lib-card > div { display: flex; flex-direction: column; gap: 14px; }
.lib-card h2 { font-size: 1.35rem; }
.lib-hint { margin: 0; color: var(--ink-soft); font-size: .98rem; }
.lib-hint code { color: var(--gold-soft); }
.lib-card label { display: flex; flex-direction: column; gap: 6px; font-size: .92rem; color: var(--muted); }
.lib-card input {
  font: inherit; font-size: 1.05rem; color: var(--ink); background: rgba(0,0,0,.28);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 10px 12px;
}
.lib-card input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.lib-card .btn { align-self: flex-start; }
.lib-card .btn:disabled { opacity: .6; cursor: wait; }
.lib-msg { margin: 0; font-size: .95rem; padding: 10px 12px; border-radius: var(--radius); }
.lib-msg.is-ok { background: rgba(217,168,78,.14); color: var(--gold-soft); }
.lib-msg.is-bad { background: rgba(240,120,120,.12); color: #f3b3b3; }
#lib-loading .rd-spin { display: inline-block; }
.pay-go { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 16px 0 14px !important; }
.pay-small a { color: var(--gold-soft); }

/* ---------- checkout: email step ---------- */
.pay-price { font-size: 1.4rem !important; color: var(--ink) !important; font-variant-numeric: lining-nums; }
.pay-form { text-align: left; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.pay-form label { font-size: .92rem; color: var(--muted); }
.pay-form input {
  font: inherit; font-size: 1.05rem; color: var(--ink); background: rgba(0,0,0,.28);
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 10px 12px; width: 100%;
}
.pay-form input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.pay-form .pay-small { margin: 2px 0 0 !important; }
.pay-err { color: #f3b3b3 !important; font-size: .92rem !important; margin: 0 !important; }
.pay-form .pay-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0 0 !important; }

/* ---------- Google sign-in ---------- */
.g-btn { display: flex; justify-content: center; align-items: center; min-height: 44px; margin: 14px 0 6px; }
.lib-google { max-width: 460px; margin: 0 auto 26px; text-align: center; align-items: center; }
.lib-google .g-btn { margin-top: 4px; }
.lib-other { max-width: 900px; margin: 0 auto; }
.lib-other > summary { cursor: pointer; text-align: center; color: var(--gold-soft); margin: 0 0 22px; list-style: none; font-size: .98rem; }
.lib-other > summary::-webkit-details-marker { display: none; }
.lib-other > summary::after { content: " ▾"; }
.lib-other[open] > summary::after { content: " ▴"; }
.lib-other > summary:hover { color: var(--ink); }

/* Google's button is a light-themed iframe; matching its colour scheme keeps its background transparent on our dark page */
.g-btn, .g-btn iframe { color-scheme: light; }

/* =========================================================
   Gallery and videos, tuned for phones (Nov 2026)
   ========================================================= */
.g-item.g-more { display: none; }                       /* photos beyond "Show more" */
.g-more-wrap { text-align: center; margin: 30px 0 0; }

.lightbox, .vbox { height: 100vh; height: 100dvh; max-height: 100dvh; }
.lb-count { position: fixed; top: 30px; left: 24px; margin: 0; color: var(--ink-soft); font-size: .95rem; letter-spacing: .04em; font-variant-numeric: tabular-nums lining-nums; }

/* video length on the thumbnail */
.v-dur {
  position: absolute; right: 8px; bottom: 8px; padding: 4px 7px; border-radius: 4px;
  background: rgba(10,0,2,.82); color: #fff; font-size: .78rem; line-height: 1;
  font-family: var(--serif); font-variant-numeric: tabular-nums lining-nums; letter-spacing: .02em;
}

/* the video player dialog */
.vbox { border: 0; padding: 0; margin: 0; width: 100vw; max-width: 100vw; background: transparent; color: var(--ink); }
.vbox::backdrop { background: rgba(20,2,4,.94); }
.vbox[open] { display: flex; align-items: center; justify-content: center; }
.vb-inner { width: min(94vw, 1100px, calc((100vh - 170px) * 16 / 9)); }
.vb-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; box-shadow: 0 30px 60px -20px rgba(0,0,0,.8); }
.vb-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vb-cap { margin: 14px 6px 0; text-align: center; color: var(--ink-soft); font-size: 1rem; line-height: 1.5; }
.vb-cap cite { color: var(--ink); }

.v-swipe { display: none; }

@media (max-width: 640px) {
  /* filters: one row you can swipe sideways, instead of three wrapped rows */
  .gfilters {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
    margin: 0 -28px 22px; padding: 2px 28px 8px; scroll-padding: 0 28px; -webkit-overflow-scrolling: touch;
  }
  .gfilters::-webkit-scrollbar { display: none; }
  .gfilters button { flex: none; white-space: nowrap; }

  /* tighter grid; captions trimmed to two lines (the full caption shows when the photo is opened) */
  .gallery { gap: 18px 10px; }
  .gallery figcaption {
    font-size: .84rem; line-height: 1.4; margin-top: 7px; padding: 0 2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }

  /* enlarged photo: room for the caption and the arrows */
  .lightbox figure { max-width: 100vw; padding: 0 8px; }
  .lightbox img { max-height: 66vh; max-height: 66dvh; }
  .lightbox figcaption { font-size: .95rem; line-height: 1.5; padding: 0 10px; max-height: 17vh; overflow-y: auto; }
  .lb-count { top: 32px; left: 18px; }

  /* videos: each group becomes a row you swipe sideways, with the next video peeking in */
  .videos {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 -28px; padding: 0 28px 6px; scroll-padding: 0 28px; -webkit-overflow-scrolling: touch;
  }
  .videos::-webkit-scrollbar { display: none; }
  .v-item { flex: 0 0 82%; scroll-snap-align: start; }
  .v-item figcaption { font-size: .9rem; }
  .v-swipe { display: block; text-align: center; color: var(--muted); font-size: .86rem; margin: -12px 0 14px; }
  .v-group ~ .v-group { margin-top: 44px; }
  .vb-inner { width: 100vw; }
  .vb-frame { border-radius: 0; }
}
@media (max-width: 440px) {                             /* the page gutter is 16px here */
  .gfilters { margin: 0 -16px 22px; padding: 2px 16px 8px; scroll-padding: 0 16px; }
  .videos { margin: 0 -16px; padding: 0 16px 6px; scroll-padding: 0 16px; }
}
.lb-count { background: rgba(255,255,255,.08); padding: 7px 13px; border-radius: 999px; top: 24px; }
@media (max-width: 640px) { .lb-count { top: 24px; } }

/* =========================================================
   Phone pass across the site (Nov 2026): spacing, tap targets,
   bibliography that folds, compact "coming soon", reader bottom bar
   ========================================================= */
.bib-count { display: none; }
.rd-pager { display: flex; align-items: center; gap: 10px; }

/* bookshop: books not on sale yet, as a compact list */
.soon-head { margin: 56px 0 18px; }
.soon-head .group-title { margin: 0 0 6px; }
.soon-note { margin: 0; color: var(--muted); font-size: .95rem; }
.soon-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .soon-list { grid-template-columns: repeat(2, 1fr); } }
.soon-item { display: grid; grid-template-columns: 46px 1fr; gap: 14px; align-items: center; background: var(--bg-raise); border-radius: var(--radius); padding: 10px 14px 10px 10px; }
.soon-item[hidden] { display: none; }
.cover-xs { width: 46px; box-shadow: 0 6px 12px -6px rgba(0,0,0,.7); }
.cover-xs .cv-author, .cover-xs .cv-top { display: none; }
.soon-t { margin: 0; font-family: var(--deva); font-size: 1.08rem; color: var(--ink); line-height: 1.35; }
.soon-m { margin: 2px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.35; }

@media (max-width: 640px) {
  /* a little less empty space between sections */
  .section { padding: 64px 0; }
  .section-alt::before { margin: -64px 0 50px; }
  .section-alt::after  { margin: 50px 0 -64px; }
  .section-head { margin-bottom: 34px; }

  /* every filter row (bibliography, gallery, bookshop) is one row you swipe sideways */
  .filters {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
    margin-left: -28px; margin-right: -28px; padding: 2px 28px 8px; scroll-padding: 0 28px; -webkit-overflow-scrolling: touch;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; white-space: nowrap; min-height: 40px; }

  /* bigger tap targets */
  .footer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 12px 0 4px; }
  .footer-links a { padding: 11px 4px; }
  .scholars summary, .lib-other > summary { padding: 10px 4px; }
  .btn-sm { padding: 11px 16px; }
  .to-top { width: 40px; height: 40px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }

  /* bibliography: each group folds up; tap its heading (it shows how many titles it holds) */
  .bib-group { padding: 12px 16px; }
  .bib-group.foldable h4 { display: flex; align-items: center; gap: 10px; min-height: 42px; margin: 0; cursor: pointer; }
  .bib-group.foldable .bib-count { display: inline-block; margin-left: auto; color: var(--muted); font-size: .82rem; font-weight: 400; }
  .bib-group.foldable h4::after { content: "▾"; color: var(--gold-soft); font-size: .8em; transition: transform .2s; }
  .bib-group.foldable.open h4::after { transform: rotate(180deg); }
  .bib-group.foldable.open h4 { margin-bottom: 8px; }
  .bib-group.foldable:not(.open) .bib { display: none; }

  /* bookshop: a shorter header, so the first books are on the first screen */
  .shop-hero, .page-hero { padding: 36px 0 6px; }
  .shop-lede { font-size: 1.02rem; margin-top: 14px; }
  .shop-points { gap: 6px 16px; margin-top: 16px; font-size: .92rem; }
  .shop-section { padding-top: 26px; }
  .shelf-filters { margin-bottom: 20px; }
  .soon-head { margin-top: 44px; }
  .soon-list { grid-template-columns: 1fr; gap: 10px; }

  /* reader: page controls and zoom in a bar at the bottom, the title gets the top bar */
  .rd-pager {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; justify-content: space-between;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(31,3,6,.96); border-top: 1px solid rgba(217,168,78,.35);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  }
  .rd-pager .rd-btn, .rd-pager .rd-zval { height: 44px; min-width: 44px; }
  .rd-page input { height: 40px; width: 3.4em; font-size: 16px; }     /* 16px stops iPhones zooming in when the box is tapped */
  .rd-back { min-height: 44px; min-width: 44px; justify-content: center; }
  .rd-tools .btn-sm { min-height: 40px; }
  .rd-pages { padding-bottom: 96px; }
  .rd-end { margin-bottom: 110px; }
  #rd-t { font-size: 1.05rem; }
}
@media (max-width: 440px) {                             /* the page gutter is 16px here */
  .filters { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; scroll-padding: 0 16px; }
}
.tl-more-wrap { display: none; text-align: center; margin: 22px 0 0; }
@media (max-width: 640px) {
  .timeline:not(.expanded) li.tl-more { display: none; }
  .timeline:not(.expanded) + .tl-more-wrap { display: block; }
}
@media (max-width: 760px) {
  /* a blurred backdrop makes the top bar the frame for its "fixed" children, which pulled the
     bottom bar up into it: no blur on phones, a slightly more solid bar instead */
  .rd-bar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(31,3,6,.99); }
}

/* ---------- top bar on phones: [name] ........ [English|मैथिली] [≡] [Books] ---------- */
@media (max-width: 640px) {
  .header-row { column-gap: 10px; }
  .header-tools { gap: 6px; }
  .lang-switch { height: 42px; padding: 2px; }
  .lang-switch button { height: 36px; padding: 0 10px; }
  .menu-btn { width: 42px; height: 42px; }
  .hdr-books { height: 42px; padding: 0 15px; }
  .hdr-books-ico { display: none; }
  .brand-name { font-size: 1.05rem; }
}
@media (max-width: 400px) {
  .header-row { column-gap: 6px; }
  .lang-switch button { padding: 0 8px; font-size: .84rem; }
  .lang-switch button[lang="mai"] { font-size: .8rem; }
  .hdr-books { padding: 0 13px; }
  .brand-name { font-size: .97rem; }
  .brand-tirh { font-size: .88rem; }
}
@media (max-width: 370px) {
  .header-row { column-gap: 4px; }
  .header-tools { gap: 3px; }
  .menu-btn { width: 40px; }
  .lang-switch button { padding: 0 6px; }
  .hdr-books { padding: 0 12px; }
  .brand-name { font-size: .88rem; }
  .brand-tirh { font-size: .8rem; }
}
@media (max-width: 330px) {
  .lang-switch button, .lang-switch button[lang="mai"] { padding: 0 4px; font-size: .76rem; }
  .hdr-books { padding: 0 10px; font-size: .88rem; }
  .brand-name { font-size: .8rem; }
  .brand-tirh { font-size: .74rem; }
}

/* footer link to the same page in the other language (/ ↔ /mai) */
.footer-lang { margin: 4px 0 0; }
.footer-lang a { color: var(--gold-soft); text-underline-offset: 3px; }
.footer-lang a[lang="mai"] { font-family: var(--deva); }

/* ---------- UX pass, 9 Nov 2026 ---------- */
/* footer copyright */
.footer-copy { margin: 14px 0 0; color: var(--muted); font-size: .88rem; }

/* homepage: books on sale link to the bookshop */
.bib .bib-shop { display: inline-block; margin-top: 6px; color: var(--gold); font-size: .9rem; text-decoration: none;
  border-bottom: 1px solid rgba(217,168,78,.45); padding: 2px 0; line-height: 1.4; }
.bib .bib-shop:hover, .bib .bib-shop:focus-visible { color: var(--gold-soft); border-bottom-color: currentColor; }
.book .book-shop a { color: var(--gold); }

/* honours: on wide screens the short awards column stays in view beside the longer service list */
@media (min-width: 901px) { .honours-layout > :first-child { position: sticky; top: 110px; } }

/* hero roles on phones: tighter spacing so "teacher" doesn't sit alone on a second line */
@media (max-width: 640px) {
  .roles { letter-spacing: .12em; font-size: .78rem; gap: 10px; }
  .roles::before { width: 24px; }
}

/* shop cards: the PDF details under the price were too small to read comfortably */
.price small { font-size: .82rem; letter-spacing: .02em; }

/* shop: a book opened from a link (books.html#book-<id>) is briefly highlighted */
@keyframes bnj-linked { 0%, 35% { box-shadow: 0 0 0 2px var(--gold), 0 0 0 8px rgba(217,168,78,.18); } 100% { box-shadow: 0 0 0 0 transparent; } }
.sb.is-linked, .soon-item.is-linked { animation: bnj-linked 2.4s ease-out 1; }
@media (prefers-reduced-motion: reduce) { .sb.is-linked, .soon-item.is-linked { animation: none; box-shadow: 0 0 0 2px var(--gold); } }

/* shop: on phones the coming-soon list starts with six books */
.soon-more { margin: 14px 0 0; text-align: center; }
.soon-more[hidden] { display: none; }
@media (min-width: 641px) { .soon-more { display: none; } }
@media (max-width: 640px) { .soon-list:not(.expanded) .soon-extra { display: none; } }

/* reader: when no book can be shown, hide the page/zoom controls and offer the ways forward */
.rd-failed .rd-pager, .rd-failed .rd-full { display: none !important; }
.rd-acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* phones/tablets: Books pill in the middle, menu icon at the far right, its bars lined up with the page edge */
@media (max-width: 960px) { .menu-btn { margin-right: -9px; } }

/* contact buttons: email address and phone numbers are Latin text, so they keep the Latin font (the wider Devanagari font made the email wrap mid-word in Maithili) */
.contact-actions .btn[href^="mailto:"], .contact-actions .btn[href^="tel:"] { font-family: var(--serif); }
@media (max-width: 359px) { .contact-actions .btn { font-size: .88rem; padding-left: 12px; padding-right: 12px; gap: 8px; } }

/* ---------- book pages (book/<id>.html, built by tools/build-books.py) ---------- */
.bk-crumbs { padding-top: 26px; font-size: .92rem; color: var(--muted); }
.bk-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 0; }
.bk-crumbs li + li::before { content: "›"; margin: 0 9px; color: var(--gold); }
.bk-crumbs a { color: var(--ink-soft); text-decoration: none; }
.bk-crumbs a:hover, .bk-crumbs a:focus-visible { color: var(--gold-soft); text-decoration: underline; }
.bk-crumbs [aria-current] { color: var(--ink); }

.bk-hero { padding: 24px 0 56px; }
.bk-hero-grid { display: grid; grid-template-columns: 290px 1fr; gap: 56px; align-items: start; }
.bk-cover .cover { width: 100%; max-width: 290px; }
.bk-badge { display: inline-block; margin: 0 0 12px; }
.bk-kind { margin: 0 0 8px; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; font-size: .82rem; font-weight: 600; }
.bk-kind [lang="mai"] { text-transform: none; letter-spacing: .04em; font-size: 1rem; }
.bk-head h1 { font-family: var(--deva); font-size: clamp(2.1rem, 4.6vw, 3.2rem); line-height: 1.2; font-weight: 600; margin: 0; }
.bk-head h1[lang="en"] { font-family: var(--serif); font-weight: 500; line-height: 1.1; }
.bk-translit { margin: 6px 0 0; font-style: italic; color: var(--muted); font-size: 1.25rem; }
.bk-by { margin: 10px 0 0; color: var(--ink-soft); }
.bk-lead { margin: 20px 0 0; font-size: 1.2rem; line-height: 1.6; color: var(--ink-soft); max-width: 36em; }
html[data-lang="mai"] .bk-lead { font-size: 1.1rem; }
.bk-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; margin-top: 26px; }
.bk-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.bk-owned .bk-buy .price { display: none; }
.bk-points { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); font-size: .92rem; }
.bk-points li::before { content: "✓"; color: var(--gold); margin-right: 8px; }
.bk-sharerow { margin: 12px 0 0; }
.bk-share { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; color: var(--gold-soft); font-size: .95rem; text-decoration: none; }
.bk-share:hover, .bk-share:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

.bk-sec { padding: 64px 0; }
.bk-sec.section-alt::before { margin: -64px 0 50px; }
.bk-sec.section-alt::after { margin: 50px 0 -64px; }
.bk-h2 { position: relative; margin: 0 0 22px; padding-bottom: 12px; font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 500; }
.bk-h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 2px; background: var(--gold); }
.center .bk-h2::after { left: 50%; transform: translateX(-50%); }
.bk-h2-more { margin-top: 52px; }
.bk-note { margin: 0 0 16px; color: var(--ink-soft); }
.bk-small { margin-top: 24px; font-size: .92rem; color: var(--muted); }
.bk-sec .prose a, .bk-note a, .bk-author a, .bk-verse a, .bk-facts a { color: var(--gold-soft); text-underline-offset: 3px; }
.bk-author { margin: 0; color: var(--ink-soft); }

.bk-toc-h { margin: 28px 0 10px; font-size: 1rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.bk-toc-h [lang="mai"] { text-transform: none; letter-spacing: .02em; font-size: 1.1rem; }
.bk-toc { margin: 0; padding: 0 0 0 2.3em; }
ul.bk-toc { list-style: none; padding-left: 0; }
.bk-toc li { padding: 5px 0; line-height: 1.5; color: var(--ink); break-inside: avoid; }
.bk-toc:lang(mai) li { font-family: var(--deva); font-size: 1.06rem; }
.bk-toc li::marker { color: var(--gold); font-size: .85em; }
.bk-cols { columns: 2; column-gap: 44px; }
.bk-inline { margin: 0; color: var(--ink); line-height: 1.9; font-size: 1.04rem; }
.bk-inline:lang(mai) { font-family: var(--deva); }
.bk-toc-more { display: none; }

.bk-verse { margin: 40px 0 0; }
.bk-verse + .bk-verse { margin-top: 48px; }
.bk-prose { text-align: left; }
.bk-prose .verse-text { font-size: clamp(1.12rem, 2vw, 1.28rem); line-height: 1.9; }
.bk-en .verse-text { font-family: var(--serif); font-size: clamp(1.15rem, 2.1vw, 1.35rem); line-height: 1.7; }
.bk-verse .verse-text + .verse-text { margin-top: 1.1em; }
.bk-verse .bk-extra { margin-top: 18px; text-align: left; }
.bk-verse .verse-tr a { color: var(--gold-soft); }

.bk-facts { margin: 0; }
.bk-facts > div { display: grid; grid-template-columns: 10em 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.bk-facts > div:last-child { border-bottom: 0; }
.bk-facts dt { color: var(--muted); }
.bk-facts dd { margin: 0; color: var(--ink); }

.bk-cta { padding: 76px 0; }
.bk-cta .bk-actions { justify-content: center; margin-top: 24px; }

.bk-more { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 26px 20px; }
.bk-more a { display: flex; flex-direction: column; gap: 9px; color: inherit; text-decoration: none; }
.bk-more-t { font-family: var(--deva); font-size: 1.05rem; line-height: 1.35; color: var(--ink); }
.bk-more-t[lang="en"] { font-family: var(--serif); }
.bk-more-m { color: var(--muted); font-size: .88rem; line-height: 1.4; }
.bk-more-m b { color: var(--gold-soft); font-weight: 500; }
.bk-more a:hover .bk-more-t, .bk-more a:focus-visible .bk-more-t { color: var(--gold-soft); text-decoration: underline; text-underline-offset: 3px; }
.bk-all { margin: 32px 0 0; }

/* shop cards link to the book page */
.sb h3 a { color: inherit; text-decoration: none; }
.sb h3 a:hover, .sb h3 a:focus-visible { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.sb-cover { display: block; }
.sb-more { margin: 8px 0 0; font-size: .92rem; }
.sb-more a { color: var(--gold-soft); text-underline-offset: 3px; }

@media (max-width: 760px) {
  .bk-crumbs { padding-top: 18px; }
  .bk-hero { padding: 18px 0 36px; }
  .bk-hero-grid { grid-template-columns: 1fr; gap: 26px; }
  .bk-cover { display: flex; justify-content: center; }
  .bk-cover .cover { width: 190px; }
  .bk-head { text-align: center; }
  .bk-lead { margin-left: auto; margin-right: auto; font-size: 1.12rem; }
  .bk-buy, .bk-points { justify-content: center; }
  .bk-actions .btn { flex: 1 1 100%; justify-content: center; }
  .bk-sec { padding: 48px 0; }
  .bk-sec.section-alt::before { margin: -48px 0 36px; }
  .bk-sec.section-alt::after { margin: 36px 0 -48px; }
  .bk-cta { padding: 56px 0; }
  .bk-cols { columns: 1; }
  .bk-facts > div { grid-template-columns: 1fr; gap: 2px; }
  .bk-collapse:not(.expanded) li:nth-child(n+13) { display: none; }
  .bk-toc-more { display: block; margin: 14px 0 0; text-align: center; }
  .bk-toc-more[hidden] { display: none; }
  .bk-more { grid-template-columns: repeat(2, 1fr); }
  .bk-verse { padding: 28px 16px; }
  .bk-verse .verse-text { font-size: 1.08rem; line-height: 1.85; text-wrap: balance; }
  .bk-prose .verse-text { text-wrap: pretty; }
}

/* awards: the Sahitya Akademi's logo beside the 1992 award (their own header artwork, shown unaltered apart from its background wave) */
.award-logo { display: inline-block; margin-top: 14px; border-radius: 4px; overflow: hidden; line-height: 0; box-shadow: 0 6px 14px -8px rgba(0,0,0,.7); transition: transform .15s, box-shadow .15s; }
.award-logo img { display: block; width: 200px; height: auto; }
.award-logo:hover, .award-logo:focus-visible { transform: translateY(-1px); box-shadow: 0 10px 18px -8px rgba(0,0,0,.8); }
@media (max-width: 640px) { .award-logo img { width: 176px; } }

/* phones/tablets: the name area gives way, so the buttons never wrap to a second row (they did for a moment while the
   web fonts were still loading, because the fallback fonts are wider; the whole page then jumped up 66 px) */
@media (max-width: 960px) {
  .brand { flex: 1 1 0; min-width: 0; }
  .header-tools { flex-shrink: 0; }
}

/* ---------- Miscellanea: विविध रचनाएँ (miscellanea.html, miscellanea/<id>.html; built by tools/build-writings.py) ---------- */
.wk-h1 { font-family: var(--deva); font-size: clamp(2.7rem, 6.4vw, 4.2rem); font-weight: 600; line-height: 1.2; margin: 0; }
.wk-h1-en { margin: 8px 0 0; font-size: 1.25rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.wk-top .divider { margin-top: 18px; }

.wk-list { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.wk-card { display: flex; flex-direction: column; padding: 24px 26px 20px; background: var(--bg-raise); border-radius: var(--radius); border-top: 3px solid var(--gold); transition: transform .2s, box-shadow .2s; }
.wk-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.wk-card[hidden] { display: none; }
.wk-card.is-linked { animation: bnj-linked 2.4s ease-out 1; }
.wk-meta { margin: 0 0 8px; color: var(--gold); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.wk-meta [lang="mai"] { text-transform: none; letter-spacing: .03em; font-size: .98rem; }
.wk-card h3 { margin: 0; font-family: var(--deva); font-size: 1.4rem; font-weight: 600; line-height: 1.4; }
.wk-card h3 a { color: inherit; text-decoration: none; }
.wk-card h3 a:hover, .wk-card h3 a:focus-visible { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.wk-sub { margin: 2px 0 0; font-family: var(--deva); font-size: 1.02rem; color: var(--ink-soft); }
.wk-tr { margin: 6px 0 0; font-style: italic; color: var(--muted); }
.wk-lead { margin: 12px 0 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.wk-foot { margin-top: auto; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 14px; }
.wk-len { color: var(--muted); font-size: .88rem; }
.wk-btns { display: flex; gap: 8px; }
.wk-more-note { margin: 34px 0 0; text-align: center; }
.misc-callout { margin-top: 22px; }

.wk-hero { padding-bottom: 36px; }
.wk-hero .bk-head h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); }
.wk-hero .wk-sub { margin-top: 6px; font-size: 1.35rem; color: var(--gold-soft); }
.wk-hero .bk-translit { margin-top: 8px; }
.wk-actions { margin-top: 26px; }
.wk-poem-title { margin: 0 0 12px; font-family: var(--deva); font-size: 1.18rem; font-weight: 600; color: var(--gold); text-align: center; }
.wk-full .verse-text { font-size: clamp(1.2rem, 2.4vw, 1.42rem); line-height: 1.75; }
.wk-readfull { margin: 26px 0 0; }
.wk-more { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wk-more a { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px 18px; background: var(--bg-raise); border-radius: var(--radius); border-top: 2px solid var(--gold); color: inherit; text-decoration: none; transition: transform .2s; }
.wk-more a:hover, .wk-more a:focus-visible { transform: translateY(-2px); }
.wk-more-m { color: var(--gold); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.wk-more-m [lang="mai"] { text-transform: none; letter-spacing: .02em; font-size: .92rem; }
.wk-more-t { font-family: var(--deva); font-size: 1.12rem; line-height: 1.4; color: var(--ink); }
.wk-more a:hover .wk-more-t { color: var(--gold-soft); }
.wk-more-e { font-style: italic; font-size: .92rem; color: var(--muted); line-height: 1.4; }

@media (max-width: 860px) { .wk-list { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
@media (max-width: 640px) {
  .wk-card { padding: 20px 18px 16px; }
  .wk-more { grid-template-columns: minmax(0, 1fr); }
  .wk-hero .wk-sub { font-size: 1.2rem; }
  .wk-top { padding-bottom: 6px; }
}

/* narrow desktop windows (961-1056 px): nine menu items need a little less padding to stay on one line */
@media (min-width: 961px) and (max-width: 1056px) {
  .header-row { gap: 12px; }
  .site-nav a { padding: 8px 4px; font-size: .94rem; }
  .site-nav a::after { left: 4px; right: 4px; }
}
