/* eShabda Library — shared styles. Colours follow the eShabda logo: ink black and the gold "e". */
:root {
  --paper: #ffffff;
  --ink: #23201c;
  --muted: #6a645b;
  --gold: #d6a21e;
  --gold-ink: #8a6406;      /* gold dark enough for text on white */
  --rule: #e6e2d9;
  --shelf: #f2f0eb;         /* backdrop behind covers */
  --focus: #1d5fbf;
  --serif: "Noto Serif Gujarati", "Shruti", Georgia, serif;
  --sans: "Hind Vadodara", "Noto Sans Gujarati", "Shruti", system-ui, sans-serif;
  --measure: 46rem;
  --page: 78rem;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.75 var(--sans);   /* Gujarati needs generous leading for matras */
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: .5rem 1rem; z-index: 10; }
[hidden] { display: none !important; }

/* ---------- masthead ---------- */
.masthead, main, .colophon { max-width: var(--page); margin: 0 auto; padding-left: clamp(1rem, 4vw, 2.5rem); padding-right: clamp(1rem, 4vw, 2.5rem); }
.masthead { display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap; padding-top: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.wordmark { font: 600 1.5rem/1 var(--sans); text-decoration: none; letter-spacing: .01em; }
.wm-e { color: var(--gold); font-weight: 600; }
.crumbs { font-size: .95rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .4rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--rule); }
.crumbs [aria-current] { color: var(--ink); }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.35; margin: 0; }

/* ---------- library home ---------- */
.lede { max-width: var(--measure); padding: clamp(2rem, 6vw, 4rem) 0 2rem; }
.lede h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.lede p { font-size: 1.2rem; margin: .75rem 0 0; }
.lede .lede-en { font-size: 1rem; color: var(--muted); margin-top: .25rem; }

.authors { list-style: none; margin: 0; padding: 0 0 4rem; display: grid; gap: clamp(1rem, 3vw, 2rem);
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); }
.author-card { display: block; text-decoration: none; }
.author-card img { width: 100%; aspect-ratio: 3 / 5; object-fit: cover; border-radius: 4px; border: 1px solid var(--rule); }
.author-card:hover img { border-color: var(--gold); }
.poster-fallback { display: grid; place-items: center; aspect-ratio: 3/5; background: var(--shelf); font: 700 1.6rem var(--serif); border-radius: 4px; }
.author-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-top: .6rem; }
.author-name { font: 600 1.15rem var(--serif); }
.author-count { color: var(--muted); font-size: .95rem; white-space: nowrap; }

/* ---------- author page ---------- */
.author-head { display: grid; grid-template-columns: auto 1fr; gap: clamp(1rem, 4vw, 2.5rem); align-items: end; padding: clamp(1.5rem, 5vw, 3rem) 0 2rem; }
.author-poster { width: clamp(6.5rem, 18vw, 10rem); aspect-ratio: 3/5; object-fit: cover; border-radius: 4px; border: 1px solid var(--rule); }
.author-text h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
.author-en { margin: .1rem 0 0; color: var(--muted); }
.author-en .dates { margin-left: 1rem; }
.bio { max-width: var(--measure); margin: .75rem 0 0; }
.stats { margin: .5rem 0 0; color: var(--muted); }
.feature-link { display: inline-block; margin-top: .9rem; padding: .45rem 1rem; border: 1.5px solid var(--gold); border-radius: 999px; text-decoration: none; font-weight: 600; }
.feature-link:hover { background: var(--gold); color: var(--ink); }

.toolbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; justify-content: space-between; padding: .5rem 0; }
.tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: thin; }
.tabs button { font: 500 1rem var(--sans); color: var(--muted); background: none; border: 0; border-bottom: 3px solid transparent; padding: .5rem .75rem; cursor: pointer; white-space: nowrap; }
.tabs button span { font-size: .8rem; margin-left: .2rem; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.search { font: 400 1rem var(--sans); padding: .55rem .9rem; border: 1px solid var(--rule); border-radius: 6px; min-width: min(20rem, 100%); background: var(--paper); color: var(--ink); }
.search:focus { border-color: var(--gold-ink); }

/* The shelf: covers stand on a thin ledge, like books facing out in a shop window. */
.shelf { padding: 2.25rem 0 .5rem; }
.shelf h2 { font-size: 1.5rem; margin-bottom: 1.25rem; }
.books { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem clamp(1rem, 2.5vw, 1.75rem);
  grid-template-columns: repeat(auto-fill, minmax(min(9.5rem, 42%), 1fr)); }
.book .cover { display: flex; align-items: flex-end; justify-content: center; aspect-ratio: 2 / 3; padding: .75rem .75rem 0; background: var(--shelf); border-bottom: 3px solid #d9d4c8; }
.book .cover img { max-height: 100%; width: auto; max-width: 100%; object-fit: contain; box-shadow: 2px 0 0 rgba(0,0,0,.08), 6px 4px 14px rgba(40,30,10,.18); transform-origin: bottom center; transition: transform .2s ease; }
.book a.cover:hover img { transform: translateY(-4px); }
.book.unavailable .cover img { filter: grayscale(.6); opacity: .75; }
.book h3 { font-size: 1.05rem; font-weight: 600; margin-top: .6rem; }
.book h3 a { text-decoration: none; }
.book h3 a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.book .meta { margin: .15rem 0 0; color: var(--muted); font-size: .9rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.tag { font-size: .8rem; padding: 0 .5rem; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold-ink); }
.tag.soon { border-color: var(--rule); color: var(--muted); }
.synopsis { font-size: .9rem; color: var(--muted); margin: .3rem 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.empty { padding: 2rem 0; color: var(--muted); }

/* ---------- Rangbhoomi index ---------- */
.index-head { max-width: var(--measure); padding: clamp(1.5rem, 5vw, 3rem) 0 1.5rem; }
.index-head h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
.index-head p { margin: .6rem 0 0; }
.filters { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--rule); }
.filters label { display: flex; align-items: center; gap: .4rem; color: var(--muted); }
.filters select { font: 400 1rem var(--sans); padding: .45rem .5rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); }
.filters .count { margin: 0 0 0 auto; color: var(--muted); }
.table-wrap { overflow-x: auto; padding-bottom: 4rem; }
.entries { width: 100%; border-collapse: collapse; font-size: .97rem; }
.entries th { text-align: left; font-weight: 600; color: var(--muted); padding: .75rem .75rem .5rem 0; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.entries td { padding: .7rem .75rem .7rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.lead { min-width: 14rem; }
.lead > a { font: 600 1.05rem var(--serif); text-decoration: none; }
.lead > a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
.sub { display: block; color: var(--muted); font-size: .88rem; }
.entries details { font-size: .88rem; color: var(--muted); }
.entries summary { cursor: pointer; color: var(--gold-ink); width: max-content; }
.entries details p { margin: .2rem 0; }
.d-crew { font-style: italic; }
.entries td:last-child { white-space: nowrap; color: var(--muted); }

@media (max-width: 720px) {
  .author-head { align-items: start; }
  .toolbar .search, .filters .search { width: 100%; }
  .filters .count { margin-left: 0; }
  .entries thead { display: none; }
  .entries tr { display: block; padding: .8rem 0; border-bottom: 1px solid var(--rule); }
  .entries td { display: block; border: 0; padding: .1rem 0; }
  .entries td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .entries td:last-child { white-space: normal; }
}

.colophon { display: flex; gap: 1.5rem; padding-top: 1.5rem; padding-bottom: 2.5rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .95rem; }

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

/* ---------- additions for the JSON-driven version ---------- */
.img-fallback { display: flex; align-items: center; justify-content: center; text-align: center; width: 100%; height: 100%; min-height: 8rem; padding: 1rem; background: #fff; border: 1px solid var(--rule); font: 600 1rem/1.5 var(--serif); color: var(--muted); }
.author-card .img-fallback { aspect-ratio: 3 / 5; font-size: 1.5rem; border-radius: 4px; }
.author-head .img-fallback { width: clamp(6.5rem, 18vw, 10rem); aspect-ratio: 3 / 5; min-height: 0; border-radius: 4px; }
.formats { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0 0; font-size: .85rem; }
.formats a { text-decoration: none; padding: 0 .55rem; border: 1px solid var(--rule); border-radius: 4px; }
.formats a:hover { border-color: var(--gold); }
.loading { padding: 4rem 0; color: var(--muted); }
