/* Ambejug Atlas. Kaavi red-oxide on limewash, with sea ink. */
:root {
  color-scheme: light;
  --page: #eef0ed;
  --surface: #fbfbf9;
  --ink: #14252c;
  --ink-2: #47555a;
  --muted: #6f7b7b;
  --grid: #dde1dd;
  --axis: #b9c1bd;
  --ring: rgba(20, 37, 44, 0.12);
  --sea: #1a6fa8;
  --kaavi: #b4462a;
  --wash-sea: rgba(26, 111, 168, 0.10);
  --mid: #e4e6e2;
  --serif: "Tiro Kannada", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 38rem;
  --rail: 7.5rem;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0c1417;
    --surface: #142024;
    --ink: #e7ecea;
    --ink-2: #b3bfbd;
    --muted: #8a9693;
    --grid: #22323a;
    --axis: #3a4c52;
    --ring: rgba(255, 255, 255, 0.10);
    --sea: #3b8fcc;
    --kaavi: #d0623f;
    --wash-sea: rgba(59, 143, 204, 0.14);
    --mid: #2a3a40;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0c1417;
  --surface: #142024;
  --ink: #e7ecea;
  --ink-2: #b3bfbd;
  --muted: #8a9693;
  --grid: #22323a;
  --axis: #3a4c52;
  --ring: rgba(255, 255, 255, 0.10);
  --sea: #3b8fcc;
  --kaavi: #d0623f;
  --wash-sea: rgba(59, 143, 204, 0.14);
  --mid: #2a3a40;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
}
a { color: var(--sea); text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 2px solid var(--kaavi);
  outline-offset: 3px;
}
img { max-width: 100%; display: block; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 0.75rem; z-index: 10; }

/* Top bar */
.bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  font-family: var(--sans); font-size: 0.875rem; color: var(--ink-2);
}
.bar button {
  font: inherit; color: inherit; background: none; border: 1px solid var(--ring);
  border-radius: 999px; padding: 0.3rem 0.8rem; cursor: pointer;
}

/* Opening */
.opening { padding: 0 clamp(1rem, 4vw, 2.5rem) 3rem; max-width: 74rem; margin: 0 auto; }
.opening h1 {
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 5.2rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 1.5rem 0 0.75rem;
  max-width: 16ch;
}
.opening .lede { max-width: var(--measure); color: var(--ink-2); font-size: 1.2rem; margin: 0 0 2rem; }

/* Swipe compare */
.compare {
  position: relative; overflow: hidden; border-radius: 6px;
  background: var(--surface); box-shadow: 0 0 0 1px var(--ring);
  touch-action: pan-y; user-select: none;
}
.compare img { width: 100%; height: auto; }
.compare .after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--split, 50%)); }
.compare .handle {
  position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); pointer-events: none;
}
.compare input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0;
}
.compare .tag {
  position: absolute; top: 0.6rem; font-family: var(--sans); font-size: 0.8rem;
  background: rgba(12, 20, 23, 0.72); color: #fff; padding: 0.2rem 0.55rem; border-radius: 3px;
}
.compare .tag.l { left: 0.6rem; } .compare .tag.r { right: 0.6rem; }
.pin {
  position: absolute; transform: translate(-50%, -50%); pointer-events: none;
  font-family: var(--sans); font-size: 0.78rem; color: #fff; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.9);
}
.pin::before {
  content: ""; display: block; width: 10px; height: 10px; margin: 0 auto 2px;
  border-radius: 50%; background: var(--kaavi); box-shadow: 0 0 0 2px #fff;
}
.pin.minor::before { width: 7px; height: 7px; background: #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.6); }
.caption { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); margin: 0.6rem 0 0; max-width: 60rem; }

/* Index of records */
.index { max-width: 74rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem) 2rem; }
.index ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; font-family: var(--sans); font-size: 0.92rem; }
.index a { color: var(--ink-2); text-decoration: none; }
.index a:hover { color: var(--ink); text-decoration: underline; }
.index b { color: var(--kaavi); font-weight: 600; margin-right: 0.35rem; }

/* Record sections: the start year sits in the rail */
.record {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0 2rem; max-width: 74rem; margin: 0 auto;
  padding: 3.5rem clamp(1rem, 4vw, 2.5rem);
  border-top: 1px solid var(--grid);
}
.record .year {
  font-size: clamp(2.2rem, 4vw, 3.2rem); line-height: 1; color: var(--kaavi);
  position: sticky; top: 1.5rem; align-self: start; margin: 0.2rem 0 0;
}
.record .body { min-width: 0; }
.record h2 { font-weight: 400; font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.2; margin: 0 0 0.75rem; }
.record p { max-width: var(--measure); margin: 0 0 1rem; }
.record .src { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); max-width: var(--measure); }
.record .src a { color: var(--muted); }

@media (max-width: 720px) {
  .record { grid-template-columns: 1fr; padding-top: 2.5rem; padding-bottom: 2.5rem; }
  .record .year { position: static; margin-bottom: 0.5rem; }
}

/* Facts row */
.facts { display: flex; flex-wrap: wrap; gap: 1.25rem 2.5rem; margin: 1.25rem 0 1.5rem; padding: 0; list-style: none; }
.facts li { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-2); max-width: 15rem; }
.facts strong { display: block; font-size: 1.6rem; font-weight: 600; color: var(--ink); line-height: 1.2; }

/* Figures */
.fig {
  background: var(--surface); border-radius: 6px; box-shadow: 0 0 0 1px var(--ring);
  padding: 1rem 1rem 0.75rem; margin: 1.25rem 0; position: relative;
}
.fig h3 { font-family: var(--sans); font-size: 0.95rem; font-weight: 600; margin: 0 0 0.15rem; }
.fig .sub { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); margin: 0 0 0.5rem; }
.fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; gap: 1.1rem; flex-wrap: wrap; font-family: var(--sans); font-size: 0.8rem; color: var(--ink-2); margin: 0 0 0.4rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend i { display: inline-block; width: 16px; height: 2px; border-radius: 1px; }
.legend i.box { width: 10px; height: 10px; border-radius: 2px; }

.axis text, .lbl { font-family: var(--sans); font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.lbl.ink { fill: var(--ink-2); }
.grid line { stroke: var(--grid); stroke-width: 1; }
.base { stroke: var(--axis); stroke-width: 1; }
.cross { stroke: var(--ink-2); stroke-width: 1; }

.tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 8rem;
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--ring), 0 6px 18px rgba(0,0,0,.12);
  border-radius: 5px; padding: 0.45rem 0.6rem; font-family: var(--sans); font-size: 0.8rem; line-height: 1.35;
}
.tip .t { color: var(--muted); margin-bottom: 0.2rem; }
.tip .row { display: flex; align-items: center; gap: 0.45rem; }
.tip .row i { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tip .row b { font-weight: 600; }
.tip .row span { color: var(--ink-2); }
.tip[hidden] { display: none; }

details.table { font-family: var(--sans); font-size: 0.82rem; margin-top: 0.4rem; }
details.table summary { cursor: pointer; color: var(--ink-2); }
details.table .wrap { max-height: 18rem; overflow: auto; margin-top: 0.4rem; }
details.table table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
details.table th, details.table td { text-align: right; padding: 0.2rem 0.6rem; border-bottom: 1px solid var(--grid); }
details.table th:first-child, details.table td:first-child { text-align: left; }

/* Gallery of satellite frames and maps */
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.frames figure { margin: 0; }
.frames .imgwrap { position: relative; border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px var(--ring); background: var(--surface); }
.frames figcaption { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-2); margin-top: 0.35rem; }
.frames figcaption small { display: block; color: var(--muted); }

blockquote.gz {
  margin: 1.25rem 0; padding: 0.2rem 0 0.2rem 1.1rem; border-left: 3px solid var(--kaavi);
  max-width: var(--measure); font-size: 1.05rem;
}
blockquote.gz p { margin: 0 0 0.4rem; }
blockquote.gz cite { font-family: var(--sans); font-style: normal; font-size: 0.8rem; color: var(--muted); }

ol.timeline { list-style: none; padding: 0; margin: 1rem 0; max-width: var(--measure); }
ol.timeline li { display: grid; grid-template-columns: 4.2rem 1fr; gap: 0.8rem; padding: 0.5rem 0; border-bottom: 1px solid var(--grid); }
ol.timeline .y { color: var(--kaavi); font-variant-numeric: tabular-nums; }
ol.timeline a { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); }

.note { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-2); background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-radius: 5px; padding: 0.7rem 0.9rem; max-width: var(--measure); }

footer.end {
  max-width: 74rem; margin: 0 auto; padding: 3rem clamp(1rem, 4vw, 2.5rem) 4rem;
  border-top: 1px solid var(--grid); font-family: var(--sans); font-size: 0.85rem; color: var(--muted);
}
footer.end p { max-width: 44rem; }

.prose { max-width: 46rem; margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 2.5rem) 4rem; }
.prose h1 { font-weight: 400; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; }
.prose h2 { font-weight: 400; font-size: 1.5rem; margin-top: 2.2rem; }
.prose code { font-size: 0.85em; background: var(--surface); padding: 0.05rem 0.3rem; border-radius: 3px; box-shadow: 0 0 0 1px var(--ring); }
.prose pre { background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-radius: 5px; padding: 0.8rem; overflow-x: auto; font-size: 0.82rem; }
.prose li { margin-bottom: 0.3rem; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print { .bar button, details.table summary { display: none; } .record { break-inside: avoid; } }

/* Narrow screens: secondary pins keep their dot, lose their label, so names never collide. */
@media (max-width: 600px) {
  .pin.minor { font-size: 0; }
  .facts { gap: 1rem 1.75rem; }
}

/* ---------- v2: navigation, explorer, chapters ---------- */
:root { --c-name: #8a6a33; --c-river: var(--sea); --c-rain: #2f7f74; --c-sea: var(--sea); --c-storms: var(--kaavi); --c-air: var(--kaavi); --c-people: #6a5a8c; }
html[lang="mr"] body, html[lang="kok"] body { font-family: "Tiro Devanagari Marathi", var(--serif); line-height: 1.8; }
html[lang="kn"] body { line-height: 1.8; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.bar {
  position: sticky; top: 0; z-index: 20; gap: 1rem;
  background: color-mix(in srgb, var(--page) 90%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--grid); padding-top: 0.6rem; padding-bottom: 0.6rem;
}
.bar .region { white-space: nowrap; }
.chapters { display: flex; gap: 0.2rem; overflow-x: auto; scrollbar-width: none; flex: 1; justify-content: center; }
.chapters::-webkit-scrollbar { display: none; }
.chapters a { white-space: nowrap; color: var(--ink-2); text-decoration: none; padding: 0.3rem 0.65rem; border-radius: 999px; }
.chapters a:hover { color: var(--ink); background: var(--surface); }
.chapters a[aria-current] { color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--ring); }
.tools { display: flex; gap: 0.5rem; align-items: center; }
.tools select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--ring); border-radius: 999px; padding: 0.3rem 0.6rem; }
@media (max-width: 960px) {
  .bar { flex-wrap: wrap; }
  .bar .region { display: none; }
  .tools { margin-left: auto; }
  .chapters { order: 3; flex-basis: 100%; justify-content: flex-start; }
}
.machine { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-2); background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-radius: 5px; padding: 0.5rem 0.75rem; max-width: var(--measure); }
.caption b { font-weight: 600; color: var(--ink-2); }
section[id] { scroll-margin-top: 5rem; }

/* Year explorer */
.explorer { max-width: 74rem; margin: 0 auto; padding: 3rem clamp(1rem, 4vw, 2.5rem); border-top: 1px solid var(--grid); }
.explorer h2, .chapter h2 { font-weight: 400; font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.15; margin: 0 0 0.6rem; }
.explorer .intro { max-width: var(--measure); color: var(--ink-2); margin: 0 0 1.25rem; }
.ribbon svg { width: 100%; height: auto; display: block; }
.rb-lab { font-family: var(--sans); font-size: 10.5px; fill: var(--ink-2); }
.rb-axis { font-family: var(--sans); font-size: 10px; fill: var(--muted); }
.rb-track { stroke: var(--grid); stroke-width: 1; }
.rb-span { stroke-width: 5; stroke-linecap: round; opacity: 0.85; fill: none; }
.rb-dot { stroke: var(--page); stroke-width: 1; }
.rb-span.c-name { stroke: var(--c-name); } .rb-dot.c-name { fill: var(--c-name); }
.rb-span.c-river { stroke: var(--c-river); } .rb-dot.c-river { fill: var(--c-river); }
.rb-span.c-rain { stroke: var(--c-rain); } .rb-dot.c-rain { fill: var(--c-rain); }
.rb-span.c-sea { stroke: var(--c-sea); } .rb-dot.c-sea { fill: var(--c-sea); }
.rb-span.c-storms { stroke: var(--c-storms); } .rb-dot.c-storms { fill: var(--c-storms); }
.rb-span.c-air { stroke: var(--c-air); } .rb-dot.c-air { fill: var(--c-air); }
.rb-span.c-people { stroke: var(--c-people); } .rb-dot.c-people { fill: var(--c-people); }
.ribbon .now { stroke: var(--ink); stroke-width: 1.5; }
.yearbar { display: flex; gap: 0.6rem; align-items: center; margin: 0.8rem 0 0.6rem; font-family: var(--sans); }
.yearbar input[type="range"] { flex: 1; accent-color: var(--kaavi); min-width: 0; }
.yearbar button, .picks button, .tabs button, .flipbar button {
  font: inherit; font-family: var(--sans); font-size: 0.85rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--ring); border-radius: 999px; padding: 0.35rem 0.8rem; cursor: pointer; white-space: nowrap;
}
.yearbar button.ghost { background: none; }
.yearbar button:hover, .picks button:hover, .tabs button:hover, .flipbar button:hover { border-color: var(--ink-2); }
.picks { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 1.25rem; font-family: var(--sans); }
.picks-lab { font-size: 0.82rem; color: var(--muted); margin-right: 0.3rem; }
.picks b { color: var(--kaavi); font-weight: 600; }
.picks button[aria-pressed="true"], .tabs button[aria-selected="true"], .flipbar button[aria-pressed="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }
.picks button[aria-pressed="true"] b { color: inherit; }
.yearcard { background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-radius: 8px; padding: 1.25rem 1.4rem; }
.yc-year { font-size: clamp(3rem, 8vw, 4.6rem); line-height: 1; color: var(--kaavi); margin: 0 0 0.75rem; }
.yc-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 17rem); gap: 1.5rem; align-items: start; }
.yc-body:not(:has(.yc-img)) { grid-template-columns: 1fr; }
.yc-list { list-style: none; margin: 0; padding: 0; }
.yc-list li { display: grid; grid-template-columns: 7rem 1fr; gap: 0.8rem; padding: 0.45rem 0; border-bottom: 1px solid var(--grid); }
.yc-list li:last-child { border-bottom: 0; }
.yc-chap { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-2); text-decoration: none; padding: 0.25rem 0 0 0.5rem; border-left: 3px solid var(--grid); }
.yc-list li[data-chap="name"] .yc-chap { border-color: var(--c-name); }
.yc-list li[data-chap="river"] .yc-chap { border-color: var(--c-river); }
.yc-list li[data-chap="rain"] .yc-chap { border-color: var(--c-rain); }
.yc-list li[data-chap="sea"] .yc-chap { border-color: var(--c-sea); }
.yc-list li[data-chap="storms"] .yc-chap { border-color: var(--c-storms); }
.yc-list li[data-chap="air"] .yc-chap { border-color: var(--c-air); }
.yc-list li[data-chap="people"] .yc-chap { border-color: var(--c-people); }
.yc-img img { border-radius: 4px; box-shadow: 0 0 0 1px var(--ring); }
.yc-empty { color: var(--ink-2); margin: 0; }
@media (max-width: 720px) {
  .yc-body { grid-template-columns: 1fr; }
  .yc-list li { grid-template-columns: 1fr; gap: 0.15rem; }
  .yearbar { flex-wrap: wrap; }
  .yearbar input[type="range"] { flex-basis: 100%; order: -1; }
}

/* Chapters */
.chapter { max-width: 74rem; margin: 0 auto; padding: 3.5rem clamp(1rem, 4vw, 2.5rem); border-top: 1px solid var(--grid); }
.chapter > p, .more-body > p { max-width: var(--measure); }
.chapter .lead { font-size: 1.25rem; line-height: 1.6; }
.chapter h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; margin: 2rem 0 0.5rem; }
.tabs { display: flex; gap: 0.4rem; margin: 1.25rem 0 0.6rem; }
.zoom, .flip { margin: 0 0 1rem; }
.zoom .imgwrap, .flip .imgwrap { position: relative; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--ring); }
.zoom figcaption, .flip figcaption { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-2); margin-top: 0.5rem; max-width: 52rem; }
.ring { position: absolute; width: 24%; aspect-ratio: 2.8; transform: translate(-50%, -50%); border: 3px solid var(--kaavi); border-radius: 50%; pointer-events: none; }
.flip { outline-offset: 4px; }
.flipbar { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 1rem 0 0.6rem; }
.clues { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.8rem; }
.clues li { background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-radius: 6px; padding: 0.9rem 1rem; }
.chapter .clues h3 { margin: 0 0 0.35rem; }
.clues p { margin: 0; font-size: 1rem; }
.verdict { border-left: 3px solid var(--kaavi); padding-left: 1rem; font-size: 1.15rem; }
details.more { margin-top: 1.75rem; }
details.more > summary {
  cursor: pointer; font-family: var(--sans); font-size: 0.95rem; color: var(--ink); padding: 0.6rem 0.9rem;
  background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-radius: 999px; display: inline-block; list-style: none;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+ "; color: var(--kaavi); }
details.more[open] > summary::before { content: "\2212  "; }
.more-body { padding-top: 0.5rem; }
.frames figure .imgwrap { position: relative; }
