/* Layout: a reading room. One narrow column of prose, wide catalog drawers of index cards,
   kantha running-stitch rules between sections. */
:root {
  --paper: #f2f3ee;      /* cool ledger paper */
  --card: #fbfbf7;       /* index card stock */
  --ink: #1d2540;        /* nil (indigo) ink */
  --ink-soft: #4a5170;
  --rule: #c9ccd6;
  --jute: #9a6a12;       /* stamp / accent */
  --open: #2f6b4f;       /* access: open */
  --request: #8a5a00;    /* access: by request */
  --closed: #8b2f3a;     /* access: closed */
  --chip: #e4e6ee;
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --body: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --bangla: "Noto Serif Bengali", "Kohinoor Bangla", "Vrinda", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12162a; --card: #1a1f36; --ink: #e6e7ef; --ink-soft: #a9adc4; --rule: #343a57;
    --jute: #d9a548; --open: #7cc5a0; --request: #e2b45c; --closed: #e58b95; --chip: #262c48;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12162a; --card: #1a1f36; --ink: #e6e7ef; --ink-soft: #a9adc4; --rule: #343a57;
  --jute: #d9a548; --open: #7cc5a0; --request: #e2b45c; --closed: #e58b95; --chip: #262c48;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.6;
  margin: 0;
}
.wrap {
  max-width: 72rem; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.prose { max-width: 40rem; }
a { color: var(--ink); text-decoration-color: var(--jute); text-underline-offset: 3px; }
a:hover { color: var(--jute); }
:focus-visible { outline: 2px solid var(--jute); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; text-wrap: balance; line-height: 1.15; margin: 0; }
h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h3 { font-size: 1.25rem; }
p { margin: 0; }
.stack { display: grid; gap: 1rem; }
.label {
  font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
}
.placeholder { background: var(--chip); padding: 0 .3em; border-radius: 3px; font-family: var(--mono); font-size: .85em; }

/* Kantha running stitch */
.stitch { border: 0; height: 2px; margin: 0;
  background-image: linear-gradient(to right, var(--jute) 0 10px, transparent 10px 18px);
  background-size: 18px 2px; opacity: .7; }

/* Masthead */
.top { border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding-block: .9rem; }
.brand { font-family: var(--display); font-size: 1.1rem; font-weight: 700; text-decoration: none; }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; }
nav a { font-family: var(--mono); font-size: .8rem; text-decoration: none; color: var(--ink-soft); }
nav a:hover { color: var(--jute); }

.hero .wrap { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(2rem, 5vw, 3.5rem); display: grid; gap: 1.5rem; }
.hero h1 { font-size: clamp(2.6rem, 8vw, 5.4rem); font-weight: 500; letter-spacing: -.01em; }
.hero h1 em { font-style: italic; color: var(--jute); }
.bn { font-family: var(--bangla); font-size: clamp(1.1rem, 2.5vw, 1.4rem); color: var(--ink-soft); }
.lede { font-size: clamp(1.15rem, 2.2vw, 1.35rem); max-width: 38rem; }
.facts { display: flex; flex-wrap: wrap; gap: .5rem 2rem; font-family: var(--mono); font-size: .8rem; color: var(--ink-soft); }
.facts b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

section > .wrap { padding-block: clamp(2.5rem, 6vw, 4rem); display: grid; gap: 1.75rem; }

/* Access legend */
.access { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.access > div { border-top: 3px solid var(--c); padding-top: .75rem; display: grid; gap: .4rem; min-width: 0; }
.access .open { --c: var(--open); } .access .request { --c: var(--request); } .access .closed { --c: var(--closed); }
.stamp {
  display: inline-block; font-family: var(--mono); font-size: .7rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  border: 1.5px solid currentColor; padding: .05rem .4rem; border-radius: 2px; transform: rotate(-2deg); white-space: nowrap;
}
.stamp.open { color: var(--open); } .stamp.request { color: var(--request); } .stamp.closed { color: var(--closed); }

/* Catalog */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.filters button {
  font: 500 .8rem var(--mono); color: var(--ink); background: transparent; border: 1px solid var(--rule);
  padding: .35rem .75rem; border-radius: 999px; cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.drawer { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 1rem; }
.card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 3px; padding: 1rem 1.1rem 1.1rem;
  display: grid; gap: .55rem; align-content: start; min-width: 0;
}
.card .head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; border-bottom: 1px solid var(--closed); padding-bottom: .45rem; }
.card .call { font-family: var(--mono); font-size: .75rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.card h3 { font-size: 1.15rem; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card .by { font-size: .95rem; color: var(--ink-soft); }
.card .why { font-size: .95rem; }
.card .note { font-size: .85rem; font-style: italic; color: var(--ink-soft); }
.card .foot { font-family: var(--mono); font-size: .72rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.count { font-family: var(--mono); font-size: .8rem; color: var(--ink-soft); }

/* Guide */
.guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 1.5rem; }
.guide article { display: grid; gap: .6rem; align-content: start; min-width: 0; }
.guide ol, .guide ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.guide .src { font-family: var(--mono); font-size: .75rem; color: var(--ink-soft); }
.callout { border-left: 3px solid var(--jute); padding: .25rem 0 .25rem 1rem; max-width: 44rem; }

/* FAQ */
details { border-top: 1px solid var(--rule); padding-block: .85rem; max-width: 44rem; }
details:last-of-type { border-bottom: 1px solid var(--rule); }
summary { cursor: pointer; font-weight: 600; }
details p { margin-top: .5rem; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 44rem; border-left: 2px solid var(--rule); }
.timeline li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: .6rem 0 .6rem 1rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 1.05rem; width: 10px; height: 10px; border-radius: 50%; background: var(--jute); }
.timeline .yr { font-family: var(--mono); font-size: .9rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.timeline .ev { min-width: 0; }
.timeline .ev small { display: block; font-size: .85rem; color: var(--ink-soft); }
.cite { border-left: 3px solid var(--rule); padding-left: 1rem; font-size: .95rem; }
.btns { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; }
.btn { font: 500 .8rem var(--mono); text-decoration: none; border: 1px solid var(--ink); padding: .4rem .8rem; border-radius: 3px; color: var(--ink); }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn:hover { border-color: var(--jute); color: var(--jute); }
.btn.solid:hover { background: var(--jute); color: var(--paper); }
.contact { display: grid; gap: .75rem; }
.email { font-family: var(--mono); font-size: 1rem; user-select: all; }
.copy { font: 500 .8rem var(--mono); background: var(--ink); color: var(--paper); border: 0; padding: .4rem .8rem; border-radius: 3px; cursor: pointer; justify-self: start; }

footer { border-top: 1px solid var(--rule); }
footer .wrap { padding-block: 2rem; display: grid; gap: .5rem; font-size: .9rem; color: var(--ink-soft); }

/* Language and theme controls. The Google Translate banner and tooltip are hidden. */
.tools { display: flex; align-items: center; gap: .5rem; }
.tools select, .tools button {
  font: inherit; font-size: .85rem; color: var(--ink); background: var(--card);
  border: 1px solid var(--rule); border-radius: 4px; padding: .25rem .5rem; min-height: 2rem; cursor: pointer;
}
.tools select { max-width: 11rem; }
#gt-host { position: absolute; left: -9999px; top: 0; height: 0; overflow: hidden; }
body { top: 0 !important; position: static !important; }
.skiptranslate iframe, iframe.skiptranslate, .goog-te-banner-frame, .VIpgJd-ZVi9od-ORHb-OEVmcd, .VIpgJd-ZVi9od-aZ2wEe-wOHMyf, #goog-gt-tt, .goog-tooltip, .goog-tooltip:hover { display: none !important; visibility: hidden !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }

/* Visual polish: sticky header, delta line art in the hero, theme-colored card spines, phone layout. */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); }
.hero { position: relative; overflow: hidden; }
.hero .wrap { position: relative; z-index: 1; }
.facts span { border: 1px solid var(--rule); background: var(--card); border-radius: 4px; padding: .3rem .6rem; }
.card { border-top: 4px solid var(--spine, var(--rule)); }
.card.t-GAZ { --spine: var(--open); } .card.t-HIS { --spine: var(--jute); } .card.t-MAP { --spine: var(--ink-soft); }
.card.t-SOC { --spine: var(--closed); } .card.t-LIT { --spine: var(--request); }
.legend-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .4rem; background: var(--spine); }
.filters button[data-t] { display: inline-flex; align-items: center; }
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .top { position: static; }
  .top .wrap { gap: .5rem; padding-block: .6rem; }
  .brand { font-size: 1rem; }
  nav { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  nav ul { flex-wrap: nowrap; white-space: nowrap; padding-bottom: .25rem; }
  .tools { width: 100%; }
  .tools select { flex: 1; max-width: none; }
  .facts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
    .btns .btn { flex: 1 1 100%; text-align: center; min-height: 2.75rem; }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: .25rem; }
  .filters button { white-space: nowrap; }
}

/* Explore, search, covers, start-here, scrolling timeline */
[hidden] { display: none !important; }
.sr { position: absolute; left: -9999px; }
.search input { width: 100%; max-width: 28rem; font: inherit; font-size: 1rem; color: var(--ink); background: var(--card); border: 1px solid var(--rule); border-radius: 4px; padding: .55rem .75rem; }
.search input:focus-visible { outline: 2px solid var(--jute); }
.card.flash { animation: flash 1.8s ease-out 1; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px var(--jute); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .card.flash { animation: none; outline: 3px solid var(--jute); } }
.cardrow { display: flex; gap: .85rem; align-items: flex-start; min-width: 0; }
.cardrow .txt { display: grid; gap: .5rem; min-width: 0; flex: 1; }
.cover { width: 76px; flex: none; border: 1px solid var(--rule); background: #fff; border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .45rem; background: var(--spine); }
.dot-GAZ { --spine: var(--open); } .dot-HIS { --spine: var(--jute); } .dot-MAP { --spine: var(--ink-soft); } .dot-SOC { --spine: var(--closed); } .dot-LIT { --spine: var(--request); }
.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; }
.path { background: var(--card); border: 1px solid var(--rule); border-top: 4px solid var(--jute); border-radius: 3px; padding: 1rem 1.1rem; display: grid; gap: .5rem; align-content: start; }
.path h3 { font-size: 1.1rem; }
.path ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; font-size: .95rem; }
.explore { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 820px) { .explore { grid-template-columns: 1fr; } }
.mapbox { background: var(--card); border: 1px solid var(--rule); border-radius: 3px; padding: .5rem; }
.mapbox svg { width: 100%; height: auto; display: block; }
.map-sea { fill: color-mix(in srgb, var(--ink) 8%, var(--card)); }
.map-land { fill: color-mix(in srgb, var(--ink-soft) 14%, var(--card)); stroke: var(--rule); stroke-width: 1; }
.map-bd { fill: color-mix(in srgb, var(--jute) 20%, var(--card)); stroke: var(--ink-soft); stroke-width: 1.2; }
.map-lbl { font: 500 11px var(--mono); fill: var(--ink-soft); letter-spacing: .12em; }
.pin { cursor: pointer; }
.pin circle { fill: var(--closed); stroke: var(--card); stroke-width: 2; }
.pin text { font: 500 13px var(--body); fill: var(--ink); paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
.pin:hover circle, .pin:focus circle { fill: var(--jute); }
.pin:focus { outline: none; } .pin:focus-visible circle { stroke: var(--ink); stroke-width: 3; }
.dlist { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.dlist button { font: 500 .78rem var(--mono); color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: .3rem .65rem; min-height: 2.25rem; cursor: pointer; }
.dlist button:hover { border-color: var(--jute); }
@media (max-width: 640px) { .pin text { display: none; } }
.mapnote { font-size: .8rem; color: var(--ink-soft); margin-top: .5rem; }
.quiz { background: var(--card); border: 1px solid var(--rule); border-radius: 3px; padding: 1.1rem 1.2rem; display: grid; gap: .8rem; }
.quiz h3 { font-size: 1.15rem; }
.quiz .opts { display: grid; gap: .5rem; }
.quiz .opts button { text-align: left; font: inherit; color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 4px; padding: .6rem .8rem; cursor: pointer; min-height: 2.75rem; }
.quiz .opts button:hover { border-color: var(--jute); }
.quiz .step { font: 500 .75rem var(--mono); color: var(--ink-soft); }
.quiz .link { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--jute); cursor: pointer; justify-self: start; }
.result { display: grid; gap: .6rem; }
.result ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.tl-ctl { display: flex; gap: .5rem; align-items: center; font: 500 .8rem var(--mono); color: var(--ink-soft); }
.tl-ctl button { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--rule); border-radius: 4px; min-width: 2.5rem; min-height: 2.5rem; cursor: pointer; }
.tl-track { list-style: none; margin: .75rem 0 0; padding: .25rem 0 1rem; display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; max-width: none; }
.tl-track:focus-visible { outline: 2px solid var(--jute); outline-offset: 4px; }
.tl-card { flex: 0 0 min(78vw, 17rem); scroll-snap-align: start; border-top: 3px solid var(--jute); padding-top: .9rem; position: relative; display: grid; gap: .35rem; align-content: start; }
.tl-card::before { content: ""; position: absolute; top: -8px; left: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--jute); }
.tl-card .yr { font-family: var(--display); font-size: 2.2rem; line-height: 1; }
.tl-card h3 { font-size: 1.05rem; }
.tl-card p { font-size: .92rem; color: var(--ink-soft); margin: 0; }
.tl-card a { font: 500 .78rem var(--mono); }

/* Multi-page site */
a.path { text-decoration: none; color: inherit; }
a.path:hover { border-top-color: var(--ink); }
a.path p { margin: 0; font-size: .95rem; color: var(--ink-soft); }
nav a[aria-current="page"] { color: var(--ink); border-bottom: 2px solid var(--jute); padding-bottom: 2px; }
main > section:first-child > .wrap { padding-top: clamp(2rem, 5vw, 3rem); }
.program { font-family: var(--mono); font-size: .95rem; color: var(--ink-soft); }
.program b { color: var(--ink); font-weight: 500; }
.program span { font-family: var(--bangla); }

/* Hero river map */
.hero-art { margin: 1.5rem 0 0; max-width: 24rem; }
.hero-art figcaption { font-size: .75rem; color: var(--ink-soft); margin-top: .4rem; }
.rivers-map { width: 100%; height: auto; display: block; --rv: #2f6f9f; --rvl: #1b4f78; --land: #e9e0cb; --edge: #8a7f66; }
:root[data-theme="dark"] .rivers-map { --rv: #7db4e0; --rvl: #a9d0f0; --land: #232a45; --edge: #5b6489; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rivers-map { --rv: #7db4e0; --rvl: #a9d0f0; --land: #232a45; --edge: #5b6489; } }
.rv-land { fill: var(--land); stroke: var(--edge); stroke-width: 1; }
.rv-nbr { fill: none; stroke: var(--edge); stroke-width: .8; stroke-dasharray: 3 3; opacity: .6; }
.rv-reg { font: 500 13px var(--mono); letter-spacing: .15em; fill: var(--edge); }
.rv-minor, .rv-mid, .rv-main { fill: none; stroke: var(--rv); stroke-linecap: round; stroke-linejoin: round; }
.rv-minor { stroke-width: 1.4; opacity: .7; } .rv-mid { stroke-width: 2.1; } .rv-main { stroke-width: 3; }
.rv-city { fill: var(--closed); stroke: var(--card); stroke-width: 1.5; }
.rv-ct { font: 500 16px var(--body); fill: var(--ink); }
.rv-lbl { font: italic 600 20px var(--body); fill: var(--rvl); paint-order: stroke; stroke: var(--land); stroke-width: 4px; }
@media (min-width: 1100px) { .hero-art { position: absolute; right: 16px; top: 2.5rem; width: 27rem; max-width: none; margin: 0; } .hero .lede { max-width: 36rem; } .hero h1 { font-size: clamp(2.6rem, 5.6vw, 4.6rem); } .hero .wrap { min-height: 41rem; align-content: start; } .hero .facts { margin-top: 3.4rem; } }

/* Book overview page */
.bookpage { max-width: 46rem; margin-inline: auto; display: grid; gap: 1.6rem; }
.crumbs { font-size: .85rem; color: var(--ink-soft); margin: 0; }
.crumbs a { color: var(--ink-soft); }
.bp-head { display: flex; gap: 1.4rem; align-items: flex-start; }
.bp-cover { flex: none; border: 1px solid var(--rule); background: #fff; border-radius: 2px; box-shadow: 0 2px 6px rgba(0,0,0,.25); height: auto; }
.bp-title { display: grid; gap: .6rem; min-width: 0; }
.bp-title h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.15; margin: 0; }
.bp-title .by { margin: 0; color: var(--ink-soft); }
.bp-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.bp-tags span { font-family: var(--mono); font-size: .72rem; border: 1px solid var(--rule); background: var(--card); border-radius: 4px; padding: .2rem .5rem; color: var(--ink-soft); }
.bp-sec { display: grid; gap: .5rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.bp-sec h2 { font-size: 1.15rem; margin: 0; }
.bp-sec p, .bp-sec ul { margin: 0; }
.bp-sec ul { padding-left: 1.2rem; display: grid; gap: .4rem; }
.bp-more { list-style: none; padding-left: 0 !important; }
.bp-foot { font-size: .85rem; font-style: italic; color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 1rem; margin: 0; }
@media (max-width: 560px) {
  .bp-head { flex-direction: column; }
  .bp-cover { width: 120px; }
}

.docs { display: grid; max-width: 56rem; border: 1px solid var(--rule); border-radius: 3px; }
.docs .row { display: grid; grid-template-columns: minmax(10rem, 1fr) 2fr; gap: 1rem; padding: .65rem .9rem; border-top: 1px solid var(--rule); min-width: 0; }
.docs .row:first-child { border-top: 0; }
.docs .row > span { min-width: 0; overflow-wrap: anywhere; }
.docs .head { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); background: var(--chip); }
@media (max-width: 36rem) { .docs .row { grid-template-columns: 1fr; gap: .15rem; } }
