/* Karwar Atlas. Colours come from the town: the Arabian Sea, kokum and sol kadi,
   the mango-yellow sunset over Devbagh, laterite of the forts, mangrove green.
   Light is the default because most readers are outdoors on a phone. */
:root {
  --page: #F4F9F8;      /* sea foam */
  --surface: #FFFFFF;
  --ink: #10282C;       /* deep water */
  --ink-2: #355055;
  --muted: #5F7779;
  --ring: rgba(16, 40, 44, 0.12);
  --grid: rgba(16, 40, 44, 0.08);
  --axis: rgba(16, 40, 44, 0.35);
  --sea: #17707A;        /* Kali estuary water */
  --sea-soft: #D7ECEE;
  --kokum: #A3214F;      /* kokum and sol kadi */
  --kokum-deep: #5E1F3D; /* dried kokum rind */
  --kokum-soft: #F8E0E7;
  --sun: #F2902E;        /* sunset over Tagore Beach */
  --sun-soft: #FDE8D2;
  --laterite: #A3472A;   /* laterite of the headlands */
  --laterite-soft: #F6E1D7;
  --leaf: #2F7A4B;
  --leaf-soft: #DCEFE2;
  --kaavi: var(--kokum);      /* chart kit name for the warm series */
  --wash-sea: rgba(10, 110, 124, 0.08);
  --mid: #E4EEED;
  --head: "Baloo 2", "Baloo Tamma 2", system-ui, sans-serif;
  --sans: "Noto Sans", "Noto Sans Kannada", "Noto Sans Devanagari", system-ui, sans-serif;
  --measure: 40rem;
  color-scheme: light;
}
:root[lang="kn"] { --head: "Baloo Tamma 2", "Baloo 2", system-ui, sans-serif; --sans: "Noto Sans Kannada", "Noto Sans", system-ui, sans-serif; }
:root[lang="mr"], :root[lang="kok"] { --sans: "Noto Sans Devanagari", "Noto Sans", system-ui, sans-serif; }
:root[data-theme="dark"] {
  --page: #0B1C20; --surface: #12292E; --ink: #EAF4F3; --ink-2: #C3D6D6; --muted: #93AAAB;
  --ring: rgba(234, 244, 243, 0.14); --grid: rgba(234, 244, 243, 0.08); --axis: rgba(234, 244, 243, 0.35);
  --sea: #4CC0CC; --sea-soft: #123C43; --kokum: #EE6C95; --kokum-soft: #3E1A28; --sun: #F7C14E; --sun-soft: #3A3115;
  --laterite: #E58A63; --laterite-soft: #3B2219; --leaf: #6CC18C; --leaf-soft: #17352A;
  --wash-sea: rgba(76, 192, 204, 0.1); --mid: #1B3A40;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
html.big { font-size: 118%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--sans); font-size: 1.06rem; line-height: 1.6; }
img { max-width: 100%; display: block; }
a { color: var(--sea); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; margin: 0; font-weight: 800; letter-spacing: -0.01em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 0.75rem; z-index: 50; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.bar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem clamp(0.75rem, 4vw, 2rem); background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--ring);
}
.brand { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: auto; color: var(--sea); text-decoration: none; font-family: "Baloo 2", system-ui, sans-serif; font-weight: 800; font-size: 1.35rem; }
.pill {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; padding: 0.35rem 0.95rem;
  border-radius: 999px; border: 1.5px solid var(--ring); background: var(--surface); cursor: pointer; font-size: 0.95rem; font-weight: 600; white-space: nowrap; min-width: 0;
}
.pill[aria-expanded="true"] { border-color: var(--sea); color: var(--sea); }
#chapbtn .here { color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
#chapbtn .here:empty { display: none; }
.panel {
  position: absolute; top: calc(100% + 6px); z-index: 45; background: var(--surface); border-radius: 18px;
  box-shadow: 0 0 0 1px var(--ring), 0 18px 40px rgba(6, 30, 34, 0.22); max-height: min(78vh, 42rem); overflow-y: auto; padding: 0.5rem;
}
.panel[hidden] { display: none !important; }
#chapmenu { right: clamp(0.75rem, 4vw, 2rem); width: min(25rem, calc(100vw - 1.5rem)); }
#optmenu { right: clamp(0.75rem, 4vw, 2rem); width: min(19rem, calc(100vw - 1.5rem)); display: flex; flex-direction: column; gap: 0.45rem; padding: 0.9rem; }
.whole { margin: 0.4rem 0.6rem 0.6rem; font-size: 0.9rem; color: var(--ink-2); line-height: 1.45; }
#chaplist { list-style: none; margin: 0; padding: 0; }
#chaplist a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 48px; padding: 0.45rem 0.75rem; border-radius: 12px; color: var(--ink); text-decoration: none; }
#chaplist a:hover { background: var(--page); }
#chaplist a[aria-current] { background: var(--sea); color: #fff; }
#chaplist .name { display: inline-flex; align-items: center; gap: 0.6rem; }
#chaplist .name .ic { width: 20px; height: 20px; color: var(--sea); }
#chaplist a[aria-current] .ic, #chaplist a[aria-current] .mins { color: inherit; }
#chaplist a.done .mins::before { content: "✓ "; color: var(--leaf); font-weight: 700; }
#chaplist a[aria-current].done .mins::before { color: inherit; }
.mins { color: var(--muted); font-size: 0.85em; white-space: nowrap; }
#optmenu label { font-size: 0.85rem; color: var(--ink-2); }
#optmenu select { font: inherit; color: var(--ink); background: var(--page); border: 1.5px solid var(--ring); border-radius: 12px; padding: 0.5rem; min-height: 46px; margin-bottom: 0.3rem; }
.opt { display: flex; align-items: center; gap: 0.7rem; min-height: 50px; padding: 0.5rem 0.8rem; text-align: left; border-radius: 12px; border: 1.5px solid var(--ring); background: var(--page); cursor: pointer; }
.opt .ic { color: var(--sea); }
.opt[aria-pressed="true"] { border-color: var(--sea); background: var(--sea-soft); }
#textsize[aria-pressed="true"] .ic { transform: scale(1.25); }

/* ---------- hero ---------- */
.hero { position: relative; color: #fff; background: #0A4F59; overflow: hidden; }
.hero-photo { position: absolute; inset: 0; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 30, 36, 0.25) 0%, rgba(4, 30, 36, 0.55) 55%, rgba(4, 30, 36, 0.85) 100%); }
.hero-credit { position: absolute; right: 0.6rem; bottom: 3.6rem; z-index: 2; font-size: 0.68rem; color: rgba(255, 255, 255, 0.75); max-width: 60%; text-align: right; }
.hero-in { position: relative; z-index: 2; max-width: 68rem; margin: 0 auto; padding: clamp(3.5rem, 12vh, 7rem) clamp(1rem, 5vw, 2.5rem) 5.5rem; }
.hero h1 { font-size: clamp(2.6rem, 9vw, 5.2rem); max-width: 13ch; color: #fff; text-wrap: balance; }
.hero .lede { font-size: clamp(1.08rem, 2.6vw, 1.3rem); max-width: 36rem; margin: 1rem 0 1.6rem; color: rgba(255, 255, 255, 0.92); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-bottom: 1.4rem; }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 52px; padding: 0.6rem 1.35rem; border-radius: 999px; font-weight: 700; font-size: 1.05rem; text-decoration: none; cursor: pointer; border: 0; }
.btn-main { background: var(--sun); color: #2A1D00; }
.btn-ghost { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.6); }
.langpick { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; font-size: 0.92rem; color: rgba(255, 255, 255, 0.85); }
.langbtn { min-height: 44px; padding: 0.3rem 0.95rem; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, 0.55); background: transparent; color: #fff; cursor: pointer; font-size: 1rem; }
.langbtn[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: #fff; font-weight: 700; }
.resume { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 50px; margin-bottom: 1.4rem; padding: 0.55rem 1.1rem; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 600; text-decoration: none; }
.resume .ic { color: var(--kokum); }
.resume[hidden] { display: none; }
/* The one moving thing on the page: a slow wave along the bottom of the photo. */
.wave { position: absolute; left: 0; bottom: -1px; width: 200%; height: 54px; z-index: 3; fill: var(--page); animation: drift 14s linear infinite; }
@keyframes drift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .wave { animation: none; } * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- short version and tiles ---------- */
.quickwrap { max-width: 68rem; margin: 0 auto; padding: 1.5rem clamp(1rem, 5vw, 2.5rem) 2rem; }
.quickwrap > h2 { font-size: clamp(1.8rem, 5vw, 2.4rem); color: var(--kokum-deep); }
:root[data-theme="dark"] .quickwrap > h2 { color: var(--kokum); }
.sublead { color: var(--ink-2); margin: 0.2rem 0 1rem; }
.quick { list-style: none; counter-reset: q; padding: 0; margin: 0 0 2.5rem; display: grid; gap: 0.7rem; max-width: 46rem; }
.quick li { counter-increment: q; position: relative; background: var(--surface); border-radius: 18px; box-shadow: 0 0 0 1px var(--ring); padding: 0.85rem 1rem 0.85rem 3.6rem; }
.quick li::before { content: counter(q); position: absolute; left: 0.9rem; top: 0.8rem; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--sun); color: #2A1D00; font-family: "Baloo 2", sans-serif; font-weight: 800; }
.quick a { color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.quick a:hover { color: var(--sea); }
.tiles-h { font-size: clamp(1.6rem, 4.5vw, 2.1rem); margin-bottom: 0.9rem; }
.tiles { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.7rem; }
.tile a { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 0.6rem; min-height: 8.5rem; padding: 0.95rem; border-radius: 20px; text-decoration: none; color: var(--ink); background: var(--soft); box-shadow: inset 0 0 0 1px var(--ring); }
.tile a:hover { box-shadow: inset 0 0 0 2px var(--tone); }
.tile-ic { width: 34px; height: 34px; color: var(--tone); }
.tile-t { font-family: var(--head); font-weight: 700; font-size: 1.12rem; line-height: 1.2; }
.tile-m { font-size: 0.8rem; color: var(--ink-2); }
.tile-done { position: absolute; top: 0.7rem; right: 0.8rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--leaf); color: #fff; font-size: 0.85rem; font-weight: 700; }

/* Tones: each chapter wears one of the town's colours */
.tone-sea { --tone: var(--sea); --soft: var(--sea-soft); }
.tone-kokum { --tone: var(--kokum); --soft: var(--kokum-soft); }
.tone-sun { --tone: #A35A0C; --soft: var(--sun-soft); }
:root[data-theme="dark"] .tone-sun { --tone: var(--sun); }
.tone-laterite { --tone: var(--laterite); --soft: var(--laterite-soft); }
.tone-leaf { --tone: var(--leaf); --soft: var(--leaf-soft); }
.tone-ink { --tone: var(--ink-2); --soft: var(--mid); }

/* ---------- chapters ---------- */
#chapters .loading { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.chapter { max-width: 68rem; margin: 0 auto; padding: 3rem clamp(1rem, 5vw, 2.5rem); border-top: 1px solid var(--ring); }
.chap-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1.1rem; }
.chap-ic { flex: none; width: 3.2rem; height: 3.2rem; border-radius: 16px; display: grid; place-items: center; background: var(--soft); color: var(--tone); }
.chap-ic .ic { width: 28px; height: 28px; }
.chapter h2 { font-size: clamp(1.9rem, 6vw, 2.8rem); }
.lead { font-size: clamp(1.18rem, 3vw, 1.35rem); max-width: var(--measure); margin: 0 0 0.9rem; font-weight: 600; }
.chapter > p, .more-body > p { max-width: var(--measure); }
ul.pts { list-style: none; padding: 0; margin: 0 0 1.1rem; max-width: var(--measure); }
ul.pts li { position: relative; padding-left: 1.2rem; margin: 0 0 0.45rem; }
ul.pts li::before { content: ""; position: absolute; left: 0.1rem; top: 0.68em; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--tone, var(--sea)); }

/* Story cards: postcards with their own share row */
.items { list-style: none; padding: 0; margin: 1.4rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.item { background: var(--surface); border-radius: 22px; box-shadow: 0 0 0 1px var(--ring), 0 6px 18px rgba(6, 30, 34, 0.06); overflow: hidden; display: flex; flex-direction: column; scroll-margin-top: 80px; }
.item.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px var(--sun); } 100% { box-shadow: 0 0 0 1px var(--ring); } }
.item-img { position: relative; aspect-ratio: 3 / 2; background: var(--mid); }
.item-img img { width: 100%; height: 100%; object-fit: cover; }
.chip { position: absolute; left: 0.8rem; bottom: 0.8rem; padding: 0.15rem 0.7rem; border-radius: 999px; background: var(--sun); color: #2A1D00; font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 1rem; }
.chip-flat { position: static; align-self: flex-start; margin: 1rem 1.1rem 0; }
.item-body { padding: 0.9rem 1.1rem 1rem; display: flex; flex-direction: column; flex: 1; }
.item h3 { font-size: 1.32rem; margin: 0.1rem 0 0.6rem; }
.item ul.pts { font-size: 1rem; margin-bottom: 0.7rem; }
.item ul.pts li { margin-bottom: 0.35rem; line-height: 1.5; }
.item-text { font-size: 1rem; }
.item-meta { font-size: 0.8rem; color: var(--muted); margin: auto 0 0.3rem; }
.item-meta a { color: var(--muted); }
.conf { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--page); color: var(--ink-2); margin-right: 0.25rem; }
.conf-tradition { background: var(--sun-soft); }
.item-credit { font-size: 0.7rem; color: var(--muted); margin: 0 0 0.4rem; }

.sharerow { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; padding-top: 0.7rem; border-top: 1px dashed var(--ring); }
.sh { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 40px; padding: 0.25rem 0.75rem; border-radius: 999px; border: 1.5px solid var(--ring); background: transparent; color: var(--ink-2); font-size: 0.85rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.sh .ic { width: 18px; height: 18px; }
.sh:hover { border-color: var(--sea); color: var(--sea); }
.sh-main { background: var(--kokum); border-color: var(--kokum); color: #fff; }
.sh-main:hover { color: #fff; filter: brightness(1.08); }
.sharerow-chapter { border-top: 0; margin: 1rem 0 0; }

details.more { margin: 1.4rem 0 0; }
details.more > summary { display: inline-flex; align-items: center; min-height: 50px; padding: 0.5rem 1.15rem; border-radius: 999px; background: var(--soft, var(--sea-soft)); color: var(--ink); font-weight: 700; cursor: pointer; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; margin-right: 0.55rem; font-size: 1.2rem; color: var(--tone, var(--sea)); }
details.more[open] > summary::before { content: "−"; }
.more-body { padding-top: 0.6rem; }
.srclist { font-size: 0.85rem; color: var(--ink-2); padding-left: 1.2rem; max-width: 46rem; }
.srclist li { margin-bottom: 0.3rem; }
.src { font-size: 0.82rem; color: var(--muted); max-width: var(--measure); }
.note { font-size: 0.88rem; color: var(--ink-2); background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-radius: 14px; padding: 0.75rem 0.95rem; max-width: var(--measure); }
.more-body > h3, .chapter > h3 { font-size: 1.35rem; margin: 1.6rem 0 0.6rem; }

.facts { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.2rem 0 1.4rem; padding: 0; list-style: none; }
.facts li { background: var(--soft, var(--sea-soft)); border-radius: 18px; padding: 0.8rem 1rem; font-size: 0.86rem; color: var(--ink-2); flex: 1 1 9rem; max-width: 16rem; }
.facts strong { display: block; font-family: "Baloo 2", sans-serif; font-size: 2rem; font-weight: 800; color: var(--tone, var(--ink)); line-height: 1.1; }

/* Charts (shared kit) */
.fig { background: var(--surface); border-radius: 18px; 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.98rem; font-weight: 600; margin: 0 0 0.15rem; }
.fig .sub { 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-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: 3px; border-radius: 2px; }
.legend i.box { width: 10px; height: 10px; border-radius: 2px; }
.axis text, .lbl { font-family: var(--sans); font-size: 13px; 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: 10px; padding: 0.45rem 0.6rem; 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: 3px; border-radius: 2px; flex: none; }
.tip .row b { font-weight: 600; }
.tip .row span { color: var(--ink-2); }
.tip[hidden] { display: none; }
details.table { 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; }

/* Timeline */
.cjump { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 1.2rem; }
.cj { min-height: 40px; display: inline-flex; align-items: center; padding: 0.2rem 0.85rem; border-radius: 999px; background: var(--sun-soft); color: var(--ink); text-decoration: none; font-weight: 700; font-family: "Baloo 2", sans-serif; }
ol.tl { list-style: none; padding: 0 0 0 1rem; margin: 0; max-width: 46rem; border-left: 3px solid var(--sun-soft); }
ol.tl li { position: relative; padding: 0.45rem 0 0.45rem 1rem; display: grid; grid-template-columns: 5.2rem 1fr; gap: 0.6rem; align-items: start; scroll-margin-top: 90px; }
ol.tl li::before { content: ""; position: absolute; left: -1.55rem; top: 0.95rem; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px var(--page); }
.tl-y { font-family: "Baloo 2", sans-serif; font-weight: 800; color: var(--tone); font-size: 1.1rem; line-height: 1.5; }
.tl-t { display: inline-flex; gap: 0.5rem; align-items: flex-start; color: var(--ink); text-decoration: none; min-height: 32px; }
.tl-t .ic { width: 18px; height: 18px; margin-top: 0.2rem; color: var(--tone); }
.tl-t:hover span { text-decoration: underline; }

/* For media */
.cite { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.cite code { background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-radius: 12px; padding: 0.55rem 0.8rem; font-size: 0.92rem; }
.cardstrip { display: flex; gap: 0.7rem; overflow-x: auto; padding: 0.3rem 0 0.8rem; scroll-snap-type: x mandatory; }
.cardstrip a { flex: none; width: 9.5rem; scroll-snap-align: start; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px var(--ring); }

/* End of each section: where to go next */
.chapend { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: space-between; align-items: center; margin-top: 2.2rem; }
.chapend a { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 54px; padding: 0.6rem 1.2rem; border-radius: 999px; text-decoration: none; font-weight: 700; }
.chapend .next { background: var(--sea); color: #fff; margin-left: auto; }
.chapend .next .mins { color: inherit; opacity: 0.8; font-weight: 400; }
.chapend .prev { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ring); }
html:not(.focus) .chapend .prev { display: none; }

/* Focus mode: one section at a time (the start counts as one with its short version) */
html.focus main > section:not(.on):not(.quickwrap), html.focus #chapters > section:not(.on) { display: none; }
html.focus:not(:has(#start.on)) .quickwrap { display: none; }
/* Easier-to-read letters */
html.easy body, html.easy h1, html.easy h2, html.easy h3, html.easy .tile-t { font-family: "Atkinson Hyperlegible", var(--sans); }

.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--page); padding: 0.6rem 1.1rem; border-radius: 999px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast[hidden] { display: none; }

footer.end { max-width: 68rem; margin: 0 auto; padding: 2.5rem clamp(1rem, 5vw, 2.5rem) 4rem; border-top: 1px solid var(--ring); font-size: 0.9rem; color: var(--ink-2); }
footer.end p { max-width: 44rem; }

@media (max-width: 560px) {
  .brand span { display: none; }
  .bar { gap: 0.4rem; }
  .pill { padding: 0.3rem 0.8rem; font-size: 0.92rem; }
  #chapbtn .here { display: none; }
  .chapend a { width: 100%; justify-content: space-between; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .hero-credit { bottom: 3.2rem; }
}

/* From the iconography research: greeting, train progress, net loader, casuarina dividers */
.hello { margin: 0 0 0.3rem; font-family: "Baloo 2", sans-serif; font-weight: 700; font-size: 1.25rem; color: var(--sun); }
.bar { position: sticky; }
.progress { position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; pointer-events: none; }
.progress .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--sun); border-radius: 0 2px 2px 0; }
.progress .train { position: absolute; left: 0; top: -10px; width: 22px; height: 22px; color: var(--sea); background: var(--page); border-radius: 6px; padding: 2px; }
#chapters .loading { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.net-ic { width: 44px; height: 44px; color: var(--sea); animation: haul 1.6s ease-in-out infinite; }
@keyframes haul { 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .net-ic { animation: none; } }
.chapter { border-top: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='18' viewBox='0 0 120 18' fill='none' stroke='%2317707A' stroke-opacity='.35' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M0 17h120M14 17V3M14 6l-4 4M14 6l4 4M14 10l-5 4M14 10l5 4M64 17V5M64 8l-3 3M64 8l3 3M64 12l-4 3M64 12l4 3M98 17V1M98 4l-4 4M98 4l4 4M98 9l-5 4M98 9l5 4'/%3E%3C/svg%3E"); background-repeat: repeat-x; background-position: top center; background-size: 120px 18px; padding-top: 3.6rem; }
blockquote.quote { margin: 0.2rem 0 0.8rem; padding: 0.7rem 0.9rem; border-radius: 14px; background: var(--soft, var(--sea-soft)); font-family: var(--head); font-weight: 500; font-size: 1.08rem; line-height: 1.4; }
blockquote.quote p { margin: 0 0 0.3rem; }
blockquote.quote p::before { content: "C"; } blockquote.quote p::after { content: "D"; }
blockquote.quote cite { display: block; font-family: var(--sans); font-style: normal; font-size: 0.75rem; color: var(--ink-2); }
:root[data-theme="dark"] #chaplist a[aria-current], :root[data-theme="dark"] .chapend .next, :root[data-theme="dark"] .sh-main { color: #0B1C20; }
:root[data-theme="dark"] .sh-main:hover { color: #0B1C20; }
