/* ---------------------------------------------------------------------------
   English Bible App

   Built for comfortable reading first: white page, high contrast, large type,
   generous spacing, and controls big enough to hit without aiming. Every
   interactive target is at least 44x44px. No framework.
   --------------------------------------------------------------------------- */

:root {
  /* light: plain white page, near-black ink */
  --paper: #ffffff;
  --paper-2: #f6f7f8;
  --paper-3: #e9ebed;
  --ink: #121416;        /* 17.7:1 on white */
  --ink-2: #33383d;      /* 11.1:1 on white */
  --muted: #5a6168;      /*  6.4:1 on white */
  --rule: #c9ced3;
  --rule-strong: #9aa1a8;
  --accent: #9a2f1c;     /*  7.6:1 on white */
  --accent-soft: #b84a33;
  --gold: #7a5c12;       /*  6.3:1 on white */
  --focus: #0b5fa5;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, "Noto Serif", "Source Serif Pro", serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --measure: 36rem;
  --bar-h: 4.25rem;
  --tap: 2.75rem;                    /* 44px minimum target */
  --shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 10px 28px -14px rgba(0, 0, 0, .3);
}

/* dark: true dark, not washed grey, with contrast held above AA */
:root[data-theme="dark"] {
  --paper: #0f1113;
  --paper-2: #181b1e;
  --paper-3: #23272b;
  --ink: #f2f4f6;        /* 16.9:1 on --paper */
  --ink-2: #d2d7dc;      /* 12.1:1 */
  --muted: #a0a8b0;      /*  7.2:1 */
  --rule: #3a4046;
  --rule-strong: #5d666e;
  --accent: #ff9b7a;     /*  8.5:1 */
  --accent-soft: #ffb79d;
  --gold: #e0b964;       /* 10.7:1 */
  --focus: #7cc0ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .6), 0 12px 32px -16px rgba(0, 0, 0, .9);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1113;
    --paper-2: #181b1e;
    --paper-3: #23272b;
    --ink: #f2f4f6;
    --ink-2: #d2d7dc;
    --muted: #a0a8b0;
    --rule: #3a4046;
    --rule-strong: #5d666e;
    --accent: #ff9b7a;
    --accent-soft: #ffb79d;
    --gold: #e0b964;
    --focus: #7cc0ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .6), 0 12px 32px -16px rgba(0, 0, 0, .9);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

/* --scale is driven by the A- / A+ control and persisted per reader.
   Starting from 100% keeps the browser's own font-size setting intact. */
html {
  font-size: calc(100% * var(--scale, 1));
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.06rem + .4vw, 1.4rem);
  line-height: 1.78;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: .2em; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

h1, h2, h3 { font-weight: 600; line-height: 1.16; letter-spacing: -.01em; margin: 0; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: absolute; left: .5rem; top: -4rem; z-index: 100;
  background: var(--ink); color: var(--paper); font-family: var(--sans);
  padding: .8rem 1.1rem; border-radius: 4px; text-decoration: none;
  font-size: 1rem; font-weight: 600;
}
.skip:focus { top: .5rem; color: var(--paper); }

/* --- top bar ------------------------------------------------------------ */

.bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .5rem;
  min-height: var(--bar-h);
  padding: .4rem clamp(.6rem, 2vw, 1.5rem);
  background: var(--paper);
  border-bottom: 2px solid var(--rule);
}
.bar > * { min-width: 0; }

.wordmark {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 700;
  letter-spacing: -.01em; text-decoration: none; white-space: nowrap;
  display: flex; align-items: center; flex: 0 1 auto;
  overflow: hidden; text-overflow: ellipsis;
  min-height: var(--tap); padding: 0 .3rem;
}
.wordmark:hover { color: var(--accent); }

.bar-spacer { flex: 1; }

/* every control is a real target: 44px tall, readable label */
.btn {
  appearance: none; border: 2px solid var(--rule); background: var(--paper);
  color: var(--ink); font: inherit; font-size: .95rem; font-family: var(--sans);
  font-weight: 500;
  min-height: var(--tap); padding: .4rem .8rem; border-radius: 6px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; white-space: nowrap;
  transition: border-color .12s, background .12s, color .12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn[aria-pressed="true"], .btn.on {
  background: var(--ink); border-color: var(--ink); color: var(--paper);
}
.btn[aria-pressed="true"]:hover, .btn.on:hover {
  background: var(--accent); border-color: var(--accent); color: var(--paper);
}
.btn-quiet { border-color: transparent; }
.btn-quiet:hover { border-color: var(--rule); }

select.btn { padding-right: .6rem; }

.sizer { display: inline-flex; gap: 0; }
.sizer .btn {
  min-width: var(--tap); padding: .4rem .55rem;
  font-family: var(--serif); font-weight: 600;
}
.sizer .btn:first-child { border-radius: 6px 0 0 6px; border-right-width: 1px; }
.sizer .btn:last-child { border-radius: 0 6px 6px 0; border-left-width: 1px; }
.sizer .btn:nth-child(1) { font-size: .9rem; }
.sizer .btn:nth-child(2) { font-size: 1.2rem; }

.ref-picker {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 600;
  border: 2px solid var(--rule); background: var(--paper); color: var(--ink);
  cursor: pointer; padding: .4rem .8rem; border-radius: 6px;
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: var(--tap);
}
.ref-picker:hover { border-color: var(--accent); color: var(--accent); }
.ref-picker svg { opacity: .75; flex: none; }

/* --- page shell -------------------------------------------------------- */

.shell { display: flex; align-items: flex-start; }

main {
  flex: 1 1 auto; min-width: 0;
  padding: clamp(1.75rem, 4vw, 3.5rem) clamp(1.1rem, 4vw, 2.5rem) 7rem;
}
.col { max-width: var(--measure); margin: 0 auto; }
.col-wide { max-width: 64rem; margin: 0 auto; }

.eyebrow {
  font-family: var(--sans); font-size: .92rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 .7rem;
}

/* --- chapter ----------------------------------------------------------- */

.chapter-head { margin-bottom: 2.4rem; }
.chapter-head h1 {
  font-size: clamp(2.1rem, 1.6rem + 2.4vw, 3.2rem);
  margin: 0 0 .6rem;
}
.chapter-head .meta {
  font-family: var(--sans); font-size: .95rem; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; align-items: center;
  line-height: 1.5;
}

.chapter-head .src-note {
  font-family: var(--sans); font-size: .95rem; color: var(--muted);
  margin: .6rem 0 0; line-height: 1.5;
}

.verses { margin: 0; }

/* paragraph flow, like a printed Bible */
.verses.flow p { margin: 0 0 1.3em; }
.verses.flow .v { display: inline; }
.verses.flow .v + .v::before { content: " "; }

/* one verse per line, easiest to track with the eye */
.verses.lines .v {
  display: block; padding: .5rem 0 .5rem 3rem;
  text-indent: -3rem; margin-bottom: .2em;
  border-bottom: 1px solid transparent;
}
.verses.lines .v:hover { border-bottom-color: var(--rule); }

.v { scroll-margin-top: calc(var(--bar-h) + 2rem); }

/* verse numbers are buttons, so they get a real target and real contrast */
.vn {
  font-family: var(--sans); font-size: .72em; font-weight: 700;
  color: var(--accent); vertical-align: .34em;
  margin-right: .32em; cursor: pointer; letter-spacing: .01em;
  border: 0; background: none; padding: .35em .3em; border-radius: 4px;
  font-variant-numeric: tabular-nums; line-height: 1;
  position: relative;
}
.vn::before {                     /* invisible 44px hit area */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 2.75rem; height: 2.75rem; transform: translate(-50%, -50%);
}
.vn:hover { background: var(--paper-3); }
.verses.lines .vn { vertical-align: baseline; font-size: .8em; }

.v[data-xc]:not([data-xc="0"]) .vn::after {
  content: ""; display: inline-block;
  width: .32em; height: .32em; border-radius: 50%;
  background: var(--gold); margin-left: .22em; vertical-align: .28em;
}

.v.sel { background: color-mix(in srgb, var(--gold) 22%, transparent); border-radius: 4px; }
.v.sel .vn { background: var(--accent); color: var(--paper); }
.v.mark { background: color-mix(in srgb, var(--gold) 32%, transparent); border-radius: 4px; }

/* --- chapter nav: the big obvious buttons ------------------------------ */

.chapter-nav {
  /* minmax(0,...) so a long book name cannot blow the track past the container */
  display: grid; gap: .8rem; grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 3.5rem; padding-top: 2rem; border-top: 2px solid var(--rule);
}
.chapter-nav a, .chapter-nav span {
  display: flex; align-items: center; gap: .7rem; min-width: 0;
  min-height: 4.25rem; padding: .9rem 1.1rem;
  border: 2px solid var(--rule); border-radius: 8px;
  text-decoration: none; font-family: var(--sans);
  background: var(--paper);
}
.chapter-nav a:hover {
  border-color: var(--accent); background: var(--paper-2); color: var(--ink);
}
.chapter-nav span { border-style: dashed; opacity: .4; }
.chapter-nav .nx { flex-direction: row-reverse; text-align: right; }
.chapter-nav .arrow {
  font-size: 1.5rem; line-height: 1; color: var(--accent); flex: none;
  font-family: var(--sans); width: 1.2em; text-align: center;
}
.chapter-nav .dir {
  display: block; font-size: .85rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .15rem;
}
.chapter-nav .ref {
  font-size: 1.1rem; font-weight: 600; color: var(--ink);
  display: block; overflow-wrap: anywhere;
}

/* fixed bottom nav on phones, thumb-reachable */
.quicknav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: none; gap: .5rem; padding: .5rem .6rem calc(.5rem + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 2px solid var(--rule);
}
.quicknav a, .quicknav button {
  flex: 1; min-height: 3.25rem; border: 2px solid var(--rule); border-radius: 8px;
  background: var(--paper); color: var(--ink); font-family: var(--sans);
  font-size: 1rem; font-weight: 600; display: flex; align-items: center;
  justify-content: center; gap: .4rem; text-decoration: none; cursor: pointer;
}
.quicknav a:hover, .quicknav button:hover { border-color: var(--accent); color: var(--accent); }
.quicknav .off { opacity: .35; pointer-events: none; }

/* --- explore panel ----------------------------------------------------- */

.explore {
  flex: 0 0 25rem; width: 25rem;
  position: sticky; top: var(--bar-h);
  max-height: calc(100vh - var(--bar-h));
  overflow: hidden auto; overscroll-behavior: contain;
  border-left: 2px solid var(--rule);
  background: var(--paper-2);
  font-family: var(--sans); font-size: 1rem; line-height: 1.6;
}
.explore-inner { padding: 1.4rem 1.4rem 4rem; }

.tabs {
  display: flex; flex-wrap: wrap; gap: .3rem;
  border-bottom: 2px solid var(--rule); margin: 0 0 1.3rem;
}
.tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  font: inherit; font-family: var(--sans); font-size: .95rem; font-weight: 500;
  color: var(--ink-2); padding: .6rem .7rem; border-bottom: 3px solid transparent;
  margin-bottom: -2px; min-height: var(--tap);
}
.tab:hover { color: var(--accent); }
.tab[aria-selected="true"] {
  color: var(--accent); border-bottom-color: var(--accent); font-weight: 700;
}
.tab .n { font-variant-numeric: tabular-nums; opacity: .75; margin-left: .25em; }

.panel h3 {
  font-family: var(--sans); font-size: .88rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  margin: 1.8rem 0 .7rem;
}
.panel h3:first-child { margin-top: 0; }
.panel .empty { color: var(--muted); }

.scope {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; flex-wrap: wrap;
  margin-bottom: 1.1rem; padding-bottom: .8rem;
  border-bottom: 2px dashed var(--rule);
}
.scope strong { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; }
.scope .hint { color: var(--muted); font-size: .9rem; }

.rank-note { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.xgroup { margin-bottom: 1.5rem; }
.xgroup > .vlabel {
  font-weight: 700; font-size: .98rem; color: var(--accent);
  margin-bottom: .5rem; cursor: pointer; min-height: var(--tap);
  background: none; border: 0; padding: .3rem .1rem; font-family: var(--sans);
  display: flex; align-items: center; gap: .4rem;
}
.xgroup > .vlabel:hover { text-decoration: underline; }
.xrefs { display: flex; flex-wrap: wrap; gap: .45rem; }
.xref {
  font-size: .95rem; color: var(--ink); text-decoration: none;
  border: 2px solid var(--rule); border-radius: 6px;
  padding: .4rem .6rem; min-height: var(--tap);
  display: inline-flex; align-items: center; background: var(--paper);
}
.xref:hover { color: var(--accent); border-color: var(--accent); }

.preview {
  margin-top: .8rem; padding: .9rem 1rem;
  background: var(--paper); border: 2px solid var(--rule); border-radius: 6px;
  font-family: var(--serif); font-size: 1.05rem; line-height: 1.6;
}
.preview .cite {
  display: block; font-family: var(--sans); font-size: .85rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--accent);
  margin-bottom: .35rem;
}

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border-bottom: 1px solid var(--rule); padding-bottom: .4rem; }
.rows li:last-child { border-bottom: 0; }
.row {
  display: flex; align-items: baseline; gap: .7rem; width: 100%;
  padding: .7rem .2rem .4rem; background: none; border: 0; font: inherit;
  text-align: left; cursor: pointer; color: inherit; text-decoration: none;
  min-height: var(--tap);
}
.row:hover .nm { color: var(--accent); text-decoration: underline; }
.row .nm { font-family: var(--serif); font-size: 1.12rem; flex: 1 1 auto; }
.row .sub { color: var(--muted); font-size: .88rem; }
.row .ct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }

.vchips { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .5rem .2rem; }
.vchip {
  font-size: .9rem; color: var(--ink-2); text-decoration: none;
  font-variant-numeric: tabular-nums; padding: .3rem .45rem;
  border: 1px solid var(--rule); border-radius: 5px; min-height: 2rem;
  display: inline-flex; align-items: center;
}
.vchip:hover { color: var(--accent); border-color: var(--accent); }

/* --- map --------------------------------------------------------------- */

.map {
  width: 100%; display: block; background: var(--paper);
  border: 2px solid var(--rule); border-radius: 6px;
}
.map .land { fill: var(--paper-3); stroke: var(--rule-strong); stroke-width: .6; }
.map .water { fill: none; stroke: var(--focus); stroke-opacity: .5; stroke-width: .9; }
.map .pin { fill: var(--accent); stroke: var(--paper); stroke-width: 1.4; cursor: pointer; }
.map .pin:hover, .map .pin.on { fill: var(--gold); }
.map .plabel {
  font-family: var(--sans); font-size: 9px; font-weight: 600; fill: var(--ink);
  paint-order: stroke; stroke: var(--paper); stroke-width: 3px;
  pointer-events: none;
}

/* --- graph ------------------------------------------------------------- */

.graph { width: 100%; display: block; }
.graph .link { stroke: var(--rule-strong); stroke-width: 1.2; }
.graph .node { fill: var(--accent); cursor: pointer; }
.graph .node:hover { fill: var(--gold); }
.graph .nlabel {
  font-family: var(--sans); font-size: 10px; font-weight: 600; fill: var(--ink);
  paint-order: stroke; stroke: var(--paper-2); stroke-width: 3px;
  pointer-events: none;
}

/* --- timeline ---------------------------------------------------------- */

.tl { list-style: none; margin: 0; padding: 0 0 0 1.4rem; border-left: 3px solid var(--rule); }
.tl li { position: relative; padding: 0 0 1.5rem; }
.tl li::before {
  content: ""; position: absolute; left: -1.82rem; top: .5rem;
  width: .6rem; height: .6rem; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--paper);
}
.tl .yr {
  font-family: var(--sans); font-size: .88rem; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}
.tl .ti { font-family: var(--serif); font-size: 1.15rem; margin-bottom: .3rem; }

/* --- modal ------------------------------------------------------------- */

dialog.modal {
  border: 2px solid var(--rule-strong); border-radius: 8px; padding: 0;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
  width: min(50rem, calc(100vw - 1.5rem)); max-height: min(85vh, 50rem);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .55); }
.modal-head {
  display: flex; align-items: center; gap: .7rem;
  padding: .8rem 1rem; border-bottom: 2px solid var(--rule);
  position: sticky; top: 0; background: var(--paper); z-index: 2;
}
.modal-body { padding: 1.3rem 1rem 2rem; overflow: auto; }
.field {
  flex: 1; font: inherit; font-family: var(--sans); font-size: 1.1rem;
  border: 0; background: transparent; color: var(--ink); padding: .5rem .2rem;
  min-height: var(--tap);
}
.field::placeholder { color: var(--muted); }

.bookgrid {
  display: grid; gap: .4rem .8rem;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
}
.bookgrid a {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .6rem .7rem; border-radius: 6px; text-decoration: none;
  font-size: 1.08rem; min-height: var(--tap); border: 2px solid transparent;
}
.bookgrid a:hover { background: var(--paper-3); border-color: var(--accent); color: var(--accent); }
.bookgrid a .c { font-family: var(--sans); font-size: .85rem; color: var(--muted); }

.chapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr)); gap: .45rem; }
.chapgrid a {
  display: grid; place-items: center; min-height: 3.25rem;
  border: 2px solid var(--rule); border-radius: 6px; text-decoration: none;
  font-family: var(--sans); font-size: 1.05rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chapgrid a:hover { border-color: var(--accent); color: var(--accent); }
.chapgrid a[aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.hits { list-style: none; margin: 0; padding: 0; }
.hits li { padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.hits .cite {
  font-family: var(--sans); font-size: .95rem; font-weight: 700;
  letter-spacing: .04em; color: var(--accent); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 2.25rem;
}
.hits .cite:hover { text-decoration: underline; }
.hits p { margin: .2rem 0 0; font-size: 1.15rem; line-height: 1.65; }
.hits mark {
  background: color-mix(in srgb, var(--gold) 38%, transparent);
  color: var(--ink); padding: 0 .1em; border-radius: 2px;
}

/* --- home -------------------------------------------------------------- */

.hero { margin: 0 auto clamp(2.5rem, 6vw, 4rem); max-width: 46rem; }
.hero h1 {
  font-size: clamp(2.4rem, 1.7rem + 3.4vw, 4rem);
  letter-spacing: -.02em; margin: 0 0 1rem;
}
.hero p {
  font-size: clamp(1.2rem, 1.1rem + .5vw, 1.45rem); color: var(--ink-2);
  margin: 0 0 2rem; max-width: 34rem; line-height: 1.6;
}
.hero .cta { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.cta-main {
  font-family: var(--sans); font-size: 1.1rem; font-weight: 700;
  background: var(--ink); color: var(--paper); text-decoration: none;
  padding: .85rem 1.4rem; border-radius: 8px; border: 2px solid var(--ink);
  min-height: 3.25rem; display: inline-flex; align-items: center;
}
.cta-main:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }

.canon { display: grid; gap: clamp(2rem, 4vw, 3.5rem); grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.canon section h2 {
  font-size: 1rem; font-family: var(--sans); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding-bottom: .6rem; border-bottom: 2px solid var(--rule); margin-bottom: .8rem;
}
.canon ul { list-style: none; margin: 0 0 1.6rem; padding: 0; columns: 2; column-gap: 1.6rem; }
.canon li { break-inside: avoid; }
.canon a {
  display: flex; align-items: center; padding: .45rem .4rem;
  text-decoration: none; font-size: 1.08rem; min-height: var(--tap);
  border-radius: 5px;
}
.canon a:hover { color: var(--accent); background: var(--paper-2); }
.canon .div {
  font-family: var(--sans); font-size: .85rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin: 1.2rem 0 .3rem;
  column-span: all;
}

.cards { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin: 3rem 0; }
.card {
  display: block; text-decoration: none; padding: 1.3rem 1.4rem 1.5rem;
  border: 2px solid var(--rule); border-radius: 8px; background: var(--paper);
}
.card:hover { border-color: var(--accent); background: var(--paper-2); color: var(--ink); }
.card h3 { font-size: 1.3rem; margin-bottom: .4rem; }
.card p { margin: 0; font-size: 1rem; color: var(--ink-2); font-family: var(--sans); line-height: 1.55; }

/* --- index pages ------------------------------------------------------- */

.toolbar {
  display: flex; flex-wrap: wrap; gap: .7rem; align-items: center;
  margin: 0 0 1.6rem; padding-bottom: 1.1rem; border-bottom: 2px solid var(--rule);
}
.toolbar .field { border: 2px solid var(--rule); border-radius: 6px; padding: .5rem .7rem; }
.entity-list { list-style: none; margin: 0; padding: 0; columns: 3; column-gap: 2.2rem; }
.entity-list li { break-inside: avoid; }
.entity-list a {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .4rem;
  text-decoration: none; font-size: 1.08rem; min-height: var(--tap);
  border-radius: 5px;
}
.entity-list a:hover { color: var(--accent); background: var(--paper-2); }
.entity-list .ct { font-family: var(--sans); font-size: .85rem; color: var(--muted); }
@media (max-width: 56rem) { .entity-list { columns: 2; } }
@media (max-width: 36rem) { .entity-list { columns: 1; } }

.dict { font-size: 1.12rem; line-height: 1.75; color: var(--ink-2); }
.dict p { margin: 0 0 1.1em; }
.dict ul { padding-left: 1.3rem; }
.dict li { margin-bottom: .6em; }

.section-h {
  font-family: var(--sans); font-size: .95rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  margin: 2.6rem 0 .8rem;
}

.kin { display: flex; flex-wrap: wrap; gap: 2rem; margin: 1.8rem 0; font-family: var(--sans); }
.kin h3 {
  font-size: .88rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .4rem;
}
.kin ul { list-style: none; margin: 0; padding: 0; }
.kin a {
  text-decoration: none; font-family: var(--serif); font-size: 1.1rem;
  display: flex; align-items: center; min-height: 2.5rem;
}
.kin a:hover { color: var(--accent); text-decoration: underline; }

.reflist { display: flex; flex-wrap: wrap; gap: .5rem; font-family: var(--sans); }
.reflist a {
  text-decoration: none; color: var(--ink); font-size: .98rem;
  border: 2px solid var(--rule); border-radius: 6px; padding: .4rem .65rem;
  min-height: var(--tap); display: inline-flex; align-items: center;
  background: var(--paper);
}
.reflist a:hover { color: var(--accent); border-color: var(--accent); }

/* --- footer ------------------------------------------------------------ */

.foot {
  border-top: 2px solid var(--rule); margin-top: 5rem;
  padding: 2rem clamp(1.1rem, 4vw, 2.5rem) 4rem;
  font-family: var(--sans); font-size: 1rem; color: var(--ink-2);
}
.foot .col-wide { display: flex; flex-wrap: wrap; gap: .6rem 2rem; align-items: center; }
.foot a {
  color: var(--ink-2); min-height: var(--tap);
  display: inline-flex; align-items: center;
}
.foot a:hover { color: var(--accent); }

/* --- toast ------------------------------------------------------------- */

.toast {
  position: fixed; left: 50%; bottom: 1.6rem; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-family: var(--sans);
  font-size: 1rem; padding: .8rem 1.2rem; border-radius: 6px;
  box-shadow: var(--shadow); z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 2rem);
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(-.2rem); }

/* --- responsive -------------------------------------------------------- */

@media (max-width: 68rem) {
  .explore {
    position: fixed; inset: auto 0 0 0; width: 100%; flex: none;
    max-height: 72vh; border-left: 0; border-top: 2px solid var(--rule-strong);
    box-shadow: var(--shadow); z-index: 50;
    border-radius: 12px 12px 0 0;
  }
  .explore-inner { padding-top: .8rem; }
  .explore::before {
    content: ""; display: block; width: 3rem; height: .3rem;
    background: var(--rule-strong); border-radius: 3px; margin: .6rem auto .2rem;
  }
  .quicknav { display: flex; }
  main { padding-bottom: 6rem; }
  body { padding-bottom: 4.5rem; }
}

@media (max-width: 48rem) {
  .bar {
    flex-wrap: wrap; row-gap: .4rem; gap: .4rem;
    padding: .5rem .7rem; min-height: 0;
  }
  .bar-spacer { display: none; }
  .wordmark { flex: 1 0 auto; font-size: 1.1rem; }
  .ref-picker { font-size: 1rem; }
  #theme { margin-left: auto; }
  #layout { display: none; }
  .chapter-nav { grid-template-columns: minmax(0, 1fr); }
  .verses.lines .v { padding-left: 2.4rem; text-indent: -2.4rem; }
}

@media print {
  .bar, .explore, .chapter-nav, .quicknav, .foot, .toast, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; padding: 0; }
  main { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@media (prefers-contrast: more) {
  :root { --rule: var(--rule-strong); --muted: var(--ink-2); }
}
