/* ===========================================================================
   Torah Texts search — styles

   BIDI DISCIPLINE (this is still the important part, and it is inherited on purpose):

   The corpus is two-thirds Hebrew and the interface mirrors between LTR and RTL, so
   every directional rule uses CSS LOGICAL properties — margin-inline-start,
   padding-inline, inset-inline-start, border-inline-start, text-align: start — and
   never left/right. One `margin-left` here silently breaks the Hebrew layout.

   Per-result direction is independent of the chrome: a Hebrew result inside an English
   interface sets dir="rtl" on itself only.

   DESIGN NOTES for this revision:

   - One column. The former three-panel sidebar is gone; filters are chips in the search
     field and the rest lives in a drawer that is closed by default. On a search page the
     results are the content, and everything permanently occupying a third of the width
     was competing with them.
   - Type carries the hierarchy, not boxes. Results are separated by space and a hairline
     rule rather than by cards, because twenty cards read as twenty equal objects when
     what matters is their order.
   - One accent, used only for interactive things and the matched-word highlight.
   =========================================================================== */

:root {
  /*
     WHITE AND PURPLE. One scheme, pinned.

     `color-scheme: light` is deliberate rather than an oversight. The page previously
     followed prefers-color-scheme, so a viewer whose machine was in dark mode got a dark
     violet palette — which is not what "white and purple" means, and is a bad surprise when
     the page is being shown to someone. The dark palette is removed rather than left
     half-maintained; the variables below are the only source of colour, so reintroducing it
     later means one media query, not a rewrite.

     Purple values are still the ones sampled from the Torah Texts library pages.
  */
  color-scheme: light;

  --purple: #4a2a90;          /* the brand colour: header bar, buttons, active states */
  --purple-deep: #2e1758;     /* headings */
  --purple-mid: #4a2a90;      /* subheadings, section labels */
  --purple-soft: #6b5a90;     /* icons and quieter interactive text */

  /* white page, with purple only where it does work */
  --bg: #ffffff;
  --bg-raised: #ffffff;
  --bg-sunken: #f7f4fc;
  --bg-hover: #f2ecfb;
  --border: #e9e2f6;
  --border-strong: #d3c8ec;

  --text: #2e1758;
  --text-soft: #5d5178;
  --text-faint: #766a8a;

  --accent: #4a2a90;
  --accent-hover: #381f70;
  --accent-soft: #efe9fb;
  --accent-text: #4a2a90;

  /* the match highlight stays warm: it has to separate from a page that is otherwise white
     and purple, and a purple-on-purple highlight is invisible */
  --mark-bg: #ffe9a8;
  --mark-text: #4a3405;

  /* tier accents, all within the purple family so they read as one system */
  --tier-1: #4a2a90;
  --tier-2: #6b4aa8;
  --tier-3: #3d6b8f;
  --tier-4: #7a4a8f;
  --tier-5: #8f4a7a;
  --tier-6: #6b5a90;

  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgb(46 23 88 / 6%);
  --shadow-md: 0 4px 14px rgb(46 23 88 / 10%), 0 1px 3px rgb(46 23 88 / 6%);
  --shadow-lg: 0 14px 40px rgb(46 23 88 / 18%), 0 2px 8px rgb(46 23 88 / 10%);

  /*
     ALL SANS, as the Torah Texts pages are. --serif is aliased to the same stack so the rules
     referring to it need not all change, and a future display face has one place to land.
  */
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Nunito Sans",
          Poppins, Roboto, "Helvetica Neue", sans-serif;
  --serif: var(--sans);
  /* Hebrew scripture keeps a Hebrew serif: long passages meant to be read. Chrome uses sans. */
  --hebrew: "Frank Ruhl Libre", "Narkisim", "Times New Roman", David, serif;
  --hebrew-ui: "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --measure: 74ch;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/**
 * THE hidden ATTRIBUTE MUST WIN. Non-negotiable, and this rule is load-bearing.
 *
 * The browser hides `[hidden]` via `display: none` in its own default stylesheet, which any
 * author rule outranks. So `.reader { display: flex }` silently defeated `<aside hidden>` and
 * the reader panel rendered on every page load, covering half the screen with no way to close
 * it — it had never been opened, so nothing was listening for a close. Five more elements had
 * the same defect: the tabs bar, the result-count line, the pager, and two buttons all showed
 * before there was anything to show.
 *
 * `!important` is correct here rather than lazy: an element carrying `hidden` is being asserted
 * absent by the markup, and no layout rule should be able to contradict that. Toggling the
 * attribute in JS is how the whole page manages state, so every `display` added below is a
 * potential repeat of this bug without it.
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  /* the page itself must never scroll sideways, whatever a result contains */
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  inset-inline-start: -9999px;
}
.skip:focus {
  inset-inline-start: 8px;
  inset-block-start: 8px;
  z-index: 60;
  background: var(--bg-raised);
  padding: 8px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* ---------------------------------------------------------------- header */
/*
   A SOLID PURPLE BAR, as on the Torah Texts library pages: white brand and navigation, and a
   translucent search field sitting inside the bar rather than floating on the page. The bar is
   opaque rather than a blurred translucent white, because the brand colour is the identity and
   fading it out is what made the previous header look like a generic search page.
*/
header {
  position: sticky;
  inset-block-start: 0;
  z-index: 30;
  background: var(--purple);
  border-block-end: 1px solid color-mix(in srgb, #000 12%, var(--purple));
}

/*
   FULL-BLEED, like the reference: brand hard against the leading edge, search and controls
   against the trailing one. The bar is chrome that spans the window; only the content column
   below it is measured. Boxing the bar to 820px left it looking like a widget on the page
   rather than the site's own navigation.
*/
.head-inner {
  max-width: 1440px;
  margin-inline: auto;
  padding: 11px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}
/* with the field gone, the controls sit against the trailing edge */
.head-actions { margin-inline-start: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  inline-size: 27px;
  block-size: 27px;
  border-radius: 7px;
  background: rgb(255 255 255 / 18%);
  color: #fff;
  font-family: var(--hebrew-ui);
  font-size: 17px;
  line-height: 1;
  padding-block-end: 1px;
}
.brand-text {
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -.005em;
}
/* the second word is lighter, matching "Torah Texts" where only the first word is emphatic */
.brand-text em { font-style: normal; font-weight: 400; opacity: .82; }

/* ---------------------------------------------------------------- search box */
/*
   ON THE PAGE, NOT IN THE BAR.

   Every colour here comes from the scheme. The previous version lived inside the purple
   header, so the field was white-on-purple translucent and turned hard-coded `#fff` on
   focus — while `--text` in dark mode is near-white. The result was white text on a white
   field: you could not see what you were typing. Nothing hard-codes a colour now, so light
   and dark both follow from the same variables.
*/
.searchwrap {
  position: relative;
  margin-block-end: 28px;
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding-inline: 14px 5px;
  padding-block: 5px;
  box-shadow: var(--shadow-sm);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.searchbox:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 18%, transparent);
}
.s-icon { inline-size: 18px; block-size: 18px; color: var(--text-faint); flex: none; }
.searchbox:focus-within .s-icon { color: var(--purple); }

.searchbox input {
  flex: 1;
  min-width: 6ch;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding-block: 8px;
  outline: none;
}
.searchbox input::placeholder { color: var(--text-faint); }
.searchbox input::-webkit-search-cancel-button { display: none; }

/* filter chips shown INSIDE the field, so the query and its scope read as one thing */
.infield-chips { display: flex; gap: 5px; flex: none; max-inline-size: 46%; overflow: hidden; }
.infield-chips:empty { display: none; }
.ichip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 0;
  border-radius: var(--radius-pill);
  padding-inline: 10px 5px;
  padding-block: 3px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  max-inline-size: 22ch;
}
.ichip span { overflow: hidden; text-overflow: ellipsis; }
.ichip button {
  border: 0; background: none; color: inherit; cursor: pointer; padding: 0;
  display: grid; place-items: center; inline-size: 15px; block-size: 15px;
  border-radius: 50%; opacity: .7;
}
.ichip button:hover { opacity: 1; background: color-mix(in srgb, var(--purple) 18%, transparent); }
.ichip svg { inline-size: 9px; block-size: 9px; }

.clear {
  border: 0; background: none; cursor: pointer; color: var(--text-faint);
  display: grid; place-items: center; inline-size: 26px; block-size: 26px;
  border-radius: 50%; flex: none;
}
.clear:hover { background: var(--bg-hover); color: var(--text); }
.clear svg { inline-size: 13px; block-size: 13px; }

.btn {
  border: 0;
  background: var(--purple);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 6px;
  cursor: pointer;
  flex: none;
  transition: background .14s var(--ease);
}
.btn:hover { background: var(--accent-hover); }


.head-actions { display: flex; align-items: center; gap: 4px; flex: none; }

/* header buttons are white-on-purple; the drawer's own chips use the page palette */
.iconbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid rgb(255 255 255 / 26%);
  color: rgb(255 255 255 / 92%);
  font: inherit;
  font-size: 13px;
  padding: 6px 11px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .14s var(--ease), border-color .14s var(--ease);
}
.iconbtn:hover { background: rgb(255 255 255 / 16%); color: #fff; border-color: rgb(255 255 255 / 40%); }
.iconbtn svg { inline-size: 15px; block-size: 15px; }
.iconbtn.ghost { border-color: transparent; }
.iconbtn.ghost:hover { background: rgb(255 255 255 / 16%); }
.iconbtn[aria-expanded="true"] { background: #fff; color: var(--purple); border-color: #fff; }

/* inside the reader panel the buttons sit on the page, not on the bar */
.reader-actions .iconbtn {
  color: var(--text-soft);
  border-color: var(--border);
}
.reader-actions .iconbtn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

@media (max-width: 720px) {
  #advtoggle span { display: none; }
  .brand-text { display: none; }
}

/* ---------------------------------------------------------------- suggest */
.suggest {
  position: absolute;
  inset-inline: 0;
  inset-block-start: calc(100% + 5px);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 40;
  display: none;
}
.suggest.open { display: block; }
.suggest button {
  display: flex;
  inline-size: 100%;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: start;
  padding: 9px 14px;
  cursor: pointer;
}
.suggest button:hover, .suggest button[aria-selected="true"] { background: var(--bg-hover); }
.suggest .kind {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  flex: none;
  min-inline-size: 7ch;
}
.suggest .val { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .n { color: var(--text-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- advanced drawer */
.advanced {
  background: var(--bg-sunken);
  border-block-end: 1px solid var(--border);
}
.adv-inner {
  max-width: 1440px;
  margin-inline: auto;
  padding: 18px 20px 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 22px 28px;
}
.adv-col h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--purple-mid);
}
.adv-col h3:not(:first-child) { margin-block-start: 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}


.facetlist { display: flex; flex-direction: column; gap: 1px; }
.facetlist button {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: none;
  border: 0;
  color: var(--text-soft);
  font: inherit;
  font-size: 13.5px;
  text-align: start;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.facetlist button:hover { background: var(--bg-hover); color: var(--text); }
.facetlist button[aria-pressed="true"] { color: var(--accent-text); font-weight: 600; }
.facetlist .fv { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facetlist .fn { color: var(--text-faint); font-size: 12px; font-variant-numeric: tabular-nums; }

.linkish {
  background: none; border: 0; color: var(--accent-text);
  font: inherit; font-size: 13px; cursor: pointer; padding: 4px 6px;
  text-align: start; border-radius: 6px;
}
.linkish:hover { background: var(--bg-hover); }

.hist { display: flex; flex-direction: column; gap: 1px; }
.hist button {
  background: none; border: 0; color: var(--text-soft); font: inherit; font-size: 13.5px;
  text-align: start; padding: 4px 6px; border-radius: 6px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hist button:hover { background: var(--bg-hover); color: var(--text); }

.syn { margin: 0; font-size: 13px; }
.syn div { display: flex; gap: 10px; padding-block: 3px; align-items: baseline; }
.syn dt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
  flex: none;
}
.syn dd { margin: 0; color: var(--text-soft); }

/* ---------------------------------------------------------------- layout */
/*
   ONE COLUMN, ONE WIDTH. The answer card and the results share it.

   The card was constrained by `.wrap` at 1120px while each result carried its own 74ch cap, so
   a full-width card sat above a column of half-width results and the page read as unfinished.
   The measure now lives here, once, and everything below inherits it.
*/
.wrap {
  max-width: 820px;
  margin-inline: auto;
  padding: 26px 20px 80px;
}

/* ---------------------------------------------------------------- direct answer */
/*
   The resolved reference. Deliberately the most prominent thing on the page when it
   exists: if someone typed a citation or quoted a verse, the text they asked for should
   be readable without a click.
*/
.direct {
  border-block-end: 1px solid var(--border);
  padding-block-end: 22px;
  margin-block-end: 26px;
}
.direct-kicker {
  font-size: 12px;
  color: var(--text-faint);
  margin-block-end: 5px;
}
.direct-kicker .why { opacity: .7; }
.direct-kicker .why::before { content: '·'; margin-inline: 4px; opacity: .5; }
.direct h2 {
  margin: 0 0 14px;
  font-size: 25px;
  font-weight: 700;
  color: var(--purple-deep);
  letter-spacing: -.02em;
}
.direct h2 small {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-faint);
  margin-block-start: 4px;
}

/* the verse itself: the largest text on the page, because it is the answer */
.vpair { display: grid; gap: 14px; margin-block-end: 16px; }
@media (min-width: 700px) { .vpair.two { grid-template-columns: 1fr 1fr; gap: 30px; } }
.vtext {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.75;
  margin: 0;
}
.vtext[dir="rtl"] { font-family: var(--hebrew); font-size: 20.5px; line-height: 1.95; }
.vtext .vnum {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 650;
  color: var(--text-faint);
  vertical-align: .4em;
  margin-inline-end: 6px;
}

.direct-links { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; }
.direct-more {
  margin-block-start: 16px;
  font-size: 13px;
  color: var(--text-faint);
}
.direct-more > summary { cursor: pointer; list-style: none; width: fit-content; }
.direct-more > summary::-webkit-details-marker { display: none; }
.direct-more > summary:hover { color: var(--accent-text); }
.direct-more ul { margin: 10px 0 0; padding-inline-start: 0; list-style: none; }
.direct-more li { margin-block: 6px; line-height: 1.6; }
.direct-more li i { font-style: normal; color: var(--text-soft); }

/* chapter / section links inside an answer */
.reflist { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; }
.reflist a {
  color: var(--text-soft);
  text-decoration: none;
  border-block-end: 1px solid var(--border);
}
.reflist a:hover { color: var(--accent-text); border-block-end-color: currentColor; }
.reflist a .lg { font-size: 10px; color: var(--text-faint); margin-inline-start: 4px; }

/* ---------------------------------------------------------------- meta + tabs */
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  color: var(--text-soft);
  font-size: 13.5px;
  margin-block-end: 14px;
}
.meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.meta .warn { color: #a4562a; }

.meta .dropped {
  font-size: 12.5px;
  color: var(--text-faint);
}
.meta .dropped code {
  font-family: inherit;
  font-style: italic;
}

.tabs {
  display: flex;
  gap: 2px;
  border-block-end: 1px solid var(--border);
  margin-block-end: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none;
  border: 0;
  border-block-end: 2px solid transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 14px;
  padding: 8px 13px;
  cursor: pointer;
  white-space: nowrap;
  margin-block-end: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] {
  color: var(--purple);
  border-block-end-color: var(--purple);
  font-weight: 650;
}
.tabs .cnt { color: var(--text-faint); font-size: 12px; margin-inline-start: 5px; font-variant-numeric: tabular-nums; }
.tabhint {
  margin: 0 0 18px;
  color: var(--text-soft);
  font-size: 13.5px;
  max-inline-size: var(--measure);
}

/* ---------------------------------------------------------------- results */
/*
   RESTRAINT IS THE POINT HERE.

   An earlier revision gave every row a coloured tier bar, a monospace reference badge, a
   book name, a breadcrumb tail and a row of four footer links — three lines of chrome around
   three lines of content, in five type sizes and six accent colours. It read as decoration
   competing with the text.

   Now: one muted metadata line, the title, the passage, and only the actions that apply.
   Colour appears in exactly two places on a result — a link on hover, and the match
   highlight. Everything else is set in greys and separated by space.
*/
.results { display: flex; flex-direction: column; }

.grouphead {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block: 30px 6px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--purple-mid);
}
.grouphead:first-child { margin-block-start: 0; }
.grouphead hr { flex: 1; border: 0; border-block-start: 1px solid var(--border); }

.res {
  padding-block: 20px;
  border-block-end: 1px solid var(--border);
  scroll-margin-block-start: 90px;
}
.res:last-child { border-block-end: 0; }

/* keyboard cursor and pinned reference: a single hairline on the leading edge */
.res.cursor, .res.pinned {
  box-shadow: inset 2px 0 0 var(--accent);
  margin-inline-start: -16px;
  padding-inline-start: 14px;
}
.res.pinned { box-shadow: inset 2px 0 0 var(--border-strong); }
.res.cursor { box-shadow: inset 2px 0 0 var(--accent); }

/* one line, plain text, dot-separated */
.res-meta {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-block-end: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.res-meta .ref { color: var(--text-soft); font-weight: 500; }
.res-meta .sep { opacity: .45; margin-inline: 6px; }

.res-title {
  margin: 0 0 6px;
  font-size: 17.5px;
  font-weight: 650;
  color: var(--purple-deep);
  line-height: 1.4;
  letter-spacing: -.01em;
}
.res-title button {
  background: none; border: 0; padding: 0; font: inherit; color: inherit;
  text-align: start; cursor: pointer;
}
.res-title button:hover { color: var(--purple); text-decoration: underline; text-underline-offset: 3px; }
.res-title[dir="rtl"] { font-family: var(--hebrew-ui); font-size: 19px; }

.res-snip {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.72;
}
.res-snip[dir="rtl"] { font-family: var(--hebrew); font-size: 17px; line-height: 1.9; }
.res-snip mark {
  background: var(--mark-bg);
  color: var(--mark-text);
  border-radius: 2px;
  padding: 0 1px;
}

.res-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-block-start: 10px;
  font-size: 12.5px;
  color: var(--text-faint);
}
.res-foot a, .res-foot button {
  color: var(--text-faint);
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.res-foot a:hover, .res-foot button:hover { color: var(--accent-text); }
/* the match reason is shown only when it is not the obvious one; plain, not a pill */
.res-foot .why { font-style: italic; opacity: .85; }

/* extra passages from the same article, collapsed by default */
.more-p { margin-block-start: 10px; }
.more-p > summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-faint);
  list-style: none;
  width: fit-content;
}
.more-p > summary:hover { color: var(--accent-text); }
.more-p > summary::-webkit-details-marker { display: none; }
.more-p ol { margin: 10px 0 0; padding-inline-start: 0; list-style: none; }
.more-p li {
  border-inline-start: 1px solid var(--border);
  padding-inline-start: 14px;
  margin-block: 10px;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.65;
}
.more-p li[dir="rtl"] { font-family: var(--hebrew); font-size: 16px; }

/* ------- clickable scripture citation inside a passage, and its popover ------- */
.vref {
  color: inherit;
  text-decoration: none;
  border-block-end: 1px dotted var(--border-strong);
  cursor: pointer;
}
.vref:hover { color: var(--accent-text); border-block-end-color: currentColor; }

.vpop {
  position: absolute;
  z-index: 45;
  inline-size: min(440px, calc(100vw - 32px));
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
}
.vpop h4 {
  margin: 0 0 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--purple-deep);
}
.vpop .vp {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  margin-block: 6px;
}
.vpop .vp[dir="rtl"] { font-family: var(--hebrew); font-size: 18px; line-height: 1.85; }
.vpop .vp.ctx { color: var(--text-faint); font-size: 14px; }
.vpop .vp.ctx[dir="rtl"] { font-size: 15.5px; }
.vpop .vp b { font-weight: 600; font-size: 10.5px; color: var(--text-faint);
  font-family: var(--sans); vertical-align: .35em; margin-inline-end: 5px; }
.vpop footer { margin-block-start: 10px; display: flex; gap: 12px; font-size: 12.5px; }
.vpop footer button, .vpop footer a {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--accent-text); cursor: pointer; text-decoration: none;
}
.vpop footer button:hover, .vpop footer a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- states */
.empty, .welcome {
  padding-block: 48px 20px;
  max-inline-size: 56ch;
}
.empty h2, .welcome h2 {
  margin: 0 0 10px;
  font-size: 27px;
  font-weight: 700;
  color: var(--purple-deep);
  letter-spacing: -.02em;
}
.empty p, .welcome p { margin: 0 0 16px; color: var(--text-soft); }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.examples-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-faint);
  margin-block-end: 10px;
}
.examples button {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-soft);
  font: inherit;
  font-size: 13.5px;
  padding: 6px 13px;
  cursor: pointer;
}
.examples button:hover { border-color: var(--accent); color: var(--accent-text); }

.skel { padding-block: 16px; border-block-end: 1px solid var(--border); }
.skel i {
  display: block;
  block-size: 11px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--bg-sunken), var(--bg-hover), var(--bg-sunken));
  background-size: 220% 100%;
  animation: sweep 1.15s linear infinite;
  margin-block-end: 8px;
}
.skel i:nth-child(1) { inline-size: 24%; block-size: 9px; }
.skel i:nth-child(2) { inline-size: 62%; block-size: 15px; }
.skel i:nth-child(3) { inline-size: 96%; }
.skel i:nth-child(4) { inline-size: 78%; }
@keyframes sweep { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .skel i { animation: none; } html { scroll-behavior: auto; } }

/* ---------------------------------------------------------------- pager */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-block-start: 32px;
  color: var(--text-soft);
  font-size: 13.5px;
}
.pager button[disabled] { opacity: .4; cursor: default; }

/* ---------------------------------------------------------------- reader */
.reader-scrim {
  position: fixed;
  inset: 0;
  background: rgb(20 19 15 / 45%);
  backdrop-filter: blur(2px);
  z-index: 50;
}
.reader {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  inline-size: min(760px, 100%);
  background: var(--bg);
  border-inline-start: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  z-index: 51;
  display: flex;
  flex-direction: column;
}
.reader-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-block-end: 1px solid var(--border);
  background: var(--bg-raised);
}
.reader-titles { flex: 1; min-width: 0; }
.reader-head h2 {
  margin: 0;
  font-size: 18.5px;
  font-weight: 650;
  color: var(--purple-deep);
  line-height: 1.35;
}
.reader-head h2[dir="rtl"] { font-family: var(--hebrew-ui); font-size: 20px; }
.reader-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-faint); }
.reader-actions { display: flex; align-items: center; gap: 4px; flex: none; }

.reader-body { flex: 1; overflow-y: auto; padding: 22px 24px 60px; }

/* parallel columns: translation beside source, aligned per unit */
.rpair {
  display: grid;
  gap: 6px 26px;
  padding-block: 12px;
  border-block-end: 1px solid var(--border);
}
@media (min-width: 620px) { .rpair.two { grid-template-columns: 1fr 1fr; } }
.rpair .u {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--text);
}
.rpair .u[dir="rtl"] { font-family: var(--hebrew); font-size: 18.5px; line-height: 1.95; }
.rpair .vn {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 650;
  color: var(--text-faint);
  vertical-align: .4em;
  margin-inline-end: 6px;
}
.rpair.hit { background: color-mix(in srgb, var(--mark-bg) 26%, transparent); border-radius: 6px; }

.rsec {
  margin-block: 24px 10px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--purple-mid);
}
.rcomm {
  font-size: 14.5px;
  color: var(--text-soft);
  padding-block: 9px;
  border-block-end: 1px solid var(--border);
}
.rcomm[dir="rtl"] { font-family: var(--hebrew); font-size: 16px; }
.rcomm b { color: var(--text); font-weight: 600; }

.rtopics { display: flex; flex-wrap: wrap; gap: 5px; margin-block-start: 14px; }
.rtopics button {
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-pill);
  color: var(--text-soft); font: inherit; font-size: 12.5px; padding: 3px 10px; cursor: pointer;
}
.rtopics button:hover { color: var(--accent-text); border-color: var(--border-strong); }

@media (max-width: 620px) {
  .head-inner { flex-wrap: wrap; }
  .searchwrap { order: 3; flex-basis: 100%; }
  .wrap { padding-inline: 16px; }
  .direct { padding: 15px 16px; border-radius: var(--radius); }
}
