/* ───────────────────────── Reading environments ─────────────────────────
   A third appearance axis beside Dark/Light and the accent. :root carries
   data-env="digital | modern-edition | …" (core.js → applyTheme). "digital" has NO
   rules here — it is the original look, byte-for-byte unchanged. Every other environment:
     1. re-tones the surface variables (--bg/--ink/--chrome/--card/--rule/…) for both Dark
        and Light, still mixing a little --accent in, so all five accents work;
     2. swaps the READING typefaces by overriding --serif/--hebrew/--display *inside
        .reader-page only* (the app chrome keeps its own faces: --ui-* below);
     3. restyles verse numbers, headings and ornaments on the reading surface.
   Default reading-text sizes/leading per environment live in core.js (ENV_TEXT) and sit
   under the user's saved slider values. */

/* ── Fonts (all OFL; offline, cached by the service worker). Latin and polytonic Greek
   are separate unicode-range faces, so a script's file is only fetched when it is on
   screen. Source Serif 4 has no Greek Extended, so Latin is its own range and ALL Greek
   goes to Gentium Plus — one Greek face, never a mixed word. ── */
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("fonts/sourceserif4-latin-opsz-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("fonts/sourceserif4-latin-opsz-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Latin Extended: the transliteration letters (ḥ ṯ ḇ ṣ ṭ ś …) used in word study / interlinear. */
@font-face {
  font-family: "Source Serif 4"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("fonts/sourceserif4-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("fonts/sourceserif4-latin-ext-wght-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Gentium Plus"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/gentiumplus-greek-400-normal.woff2") format("woff2"); unicode-range: U+0370-03FF;
}
@font-face {
  font-family: "Gentium Plus"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/gentiumplus-greek-400-italic.woff2") format("woff2"); unicode-range: U+0370-03FF;
}
@font-face {
  font-family: "Gentium Plus"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/gentiumplus-greek-700-normal.woff2") format("woff2"); unicode-range: U+0370-03FF;
}
/* Greek Extended = polytonic breathings, accents, iota subscript (the LXX and NT use them throughout). */
@font-face {
  font-family: "Gentium Plus"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/gentiumplus-greek-ext-400-normal.woff2") format("woff2"); unicode-range: U+1F00-1FFF;
}
@font-face {
  font-family: "Gentium Plus"; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fonts/gentiumplus-greek-ext-400-italic.woff2") format("woff2"); unicode-range: U+1F00-1FFF;
}
@font-face {
  font-family: "Gentium Plus"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/gentiumplus-greek-ext-700-normal.woff2") format("woff2"); unicode-range: U+1F00-1FFF;
}
@font-face {
  font-family: "Noto Serif Hebrew"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/notoserifhebrew-hebrew-wght-normal.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}

/* ── Parchment fonts: Cardo (English + polytonic Greek) and David Libre (Hebrew); OFL. ── */
@font-face { font-family: "Cardo"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/cardo-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cardo"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/cardo-latin-400-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cardo"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/cardo-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cardo"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/cardo-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cardo"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/cardo-latin-ext-400-italic.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cardo"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/cardo-greek-400-normal.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "Cardo"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/cardo-greek-400-italic.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "Cardo"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/cardo-greek-700-normal.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "Cardo"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/cardo-greek-ext-400-normal.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "Cardo"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/cardo-greek-ext-400-italic.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "Cardo"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/cardo-greek-ext-700-normal.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "David Libre"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/davidlibre-hebrew-400-normal.woff2") format("woff2"); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "David Libre"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/davidlibre-hebrew-700-normal.woff2") format("woff2"); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }

/* ── Early Print fonts: EB Garamond (English + polytonic Greek) and Frank Ruhl Libre (Hebrew); OFL. ── */
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/ebgaramond-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/ebgaramond-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/ebgaramond-greek-wght-normal.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/ebgaramond-greek-ext-wght-normal.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400 800; font-display: swap; src: url("fonts/ebgaramond-latin-wght-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400 800; font-display: swap; src: url("fonts/ebgaramond-latin-ext-wght-italic.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400 800; font-display: swap; src: url("fonts/ebgaramond-greek-wght-italic.woff2") format("woff2"); unicode-range: U+0370-03FF; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400 800; font-display: swap; src: url("fonts/ebgaramond-greek-ext-wght-italic.woff2") format("woff2"); unicode-range: U+1F00-1FFF; }
@font-face { font-family: "Frank Ruhl Libre"; font-style: normal; font-weight: 300 900; font-display: swap; src: url("fonts/frankruhllibre-hebrew-wght-normal.woff2") format("woff2"); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }

:root {
  /* The application chrome keeps these in every environment (see .reader-controls below). */
  --ui-serif: "Alegreya", "Palatino Linotype", Palatino, "Times New Roman", Georgia, serif;
  --ui-hebrew: "Shofar", "Frank Ruehl CLM", "David Libre", "Times New Roman", serif;
  --ui-display: "Cormorant", "Cormorant Garamond", "Palatino Linotype", var(--ui-serif);
  --ui-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}

/* ───────────────────────── environment preview cards (Settings) ─────────────────────────
   Each card paints itself from its own data-env-preview, because the :root-scoped rules
   below only restyle the real reading surface. */
.env-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); grid-auto-rows: 1fr; gap: 0.75rem; margin: 0.6rem 0 0.9rem; }
.env-card {
  display: flex; flex-direction: column; gap: 0.35rem; text-align: start; padding: 0.7rem 0.8rem 0.8rem;
  border: 1px solid var(--rule); border-radius: 0.7rem; background: var(--card); color: var(--ink);
}
.env-card[aria-checked="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
.env-card:hover { border-color: var(--accent); }
.env-sample {
  display: flex; flex-direction: column; gap: 0.15rem; padding: 0.55rem 0.65rem; border-radius: 0.4rem;
  border: 1px solid transparent; min-height: 5.2rem; justify-content: center; flex: none;
}
.env-he { font-size: 1.25rem; line-height: 1.4; direction: rtl; text-align: right; }
.env-en { font-size: 0.95rem; line-height: 1.3; }
.env-blurb { flex: 1; }
.env-name { font-weight: 700; font-size: 0.98rem; }
.env-blurb { font-size: 0.78rem; opacity: 0.75; line-height: 1.3; }
.env-card[data-env-preview="digital"] .env-sample {
  background: linear-gradient(165deg, #22397e, #0c1838); color: #f1ead6; border-color: rgba(231, 198, 107, 0.45);
  font-family: var(--ui-serif);
}
.env-card[data-env-preview="digital"] .env-he { font-family: var(--ui-hebrew); color: #e7c66b; }
.env-card[data-env-preview="modern-edition"] .env-sample {
  background: #fbfaf7; color: #1d1c1a; border-color: #e3e0d8; font-family: "Source Serif 4", Georgia, serif;
}
.env-card[data-env-preview="modern-edition"] .env-he { font-family: "Noto Serif Hebrew", var(--ui-hebrew); }

/* ═════════════════════════ Modern Edition ═════════════════════════
   A contemporary scholarly book: soft neutral page, near-black ink, Source Serif 4 for
   English, Gentium Plus for Greek (full polytonic), Noto Serif Hebrew; light grey
   superscript verse numbers; a plain sans heading; hairline rules instead of filigree. */
[data-env="modern-edition"][data-theme="light"] {
  --base: #f3f1ec;
  --bg: color-mix(in srgb, var(--accent) 2%, #fbfaf7);
  --ink: color-mix(in srgb, var(--accent) 5%, #1b1a18);
  --chrome: color-mix(in srgb, var(--accent) 4%, #ffffff);
  --card: color-mix(in srgb, var(--accent) 2%, #ffffff);
  --hover: color-mix(in srgb, var(--accent) 8%, #efece5);
  --rule: color-mix(in srgb, var(--accent) 12%, #dedad0);
  --accent-ink: color-mix(in srgb, var(--accent), black 30%);
  --foil-ink: #6f5a22;
}
[data-env="modern-edition"][data-theme="light"][data-accent="gold"] { --accent-ink: color-mix(in srgb, var(--accent), black 56%); }
[data-env="modern-edition"][data-theme="dark"] {
  --base: #0f1013;
  --bg: color-mix(in srgb, var(--accent) 3%, #15161a);
  --ink: color-mix(in srgb, var(--accent) 4%, #e8e6e1);
  --chrome: color-mix(in srgb, var(--accent) 7%, #101114);
  --card: color-mix(in srgb, var(--accent) 5%, #1b1c21);
  --hover: color-mix(in srgb, var(--accent) 14%, #1b1c21);
  --rule: color-mix(in srgb, var(--accent) 16%, #2a2b31);
  --accent-ink: color-mix(in srgb, var(--accent), white 46%);
}
/* Plain page: no radial glow, no parchment fibres. */
[data-env="modern-edition"] body { background-image: none; background-color: var(--bg); }
[data-env="modern-edition"][data-theme="dark"] body .t.he,
[data-env="modern-edition"][data-theme="dark"] body .t.en,
[data-env="modern-edition"][data-theme="dark"] body .t.grc { text-shadow: none; }

/* Typefaces — the reading surface only. The reader bar and the sidebar keep the app's faces. */
[data-env="modern-edition"] .reader-page,
[data-env="modern-edition"] .font-preview {
  --serif: "Source Serif 4", "Gentium Plus", Charter, "Iowan Old Style", Georgia, serif;
  --hebrew: "Noto Serif Hebrew", "Shofar", "Frank Ruehl CLM", "Times New Roman", serif;
  --display: var(--ui-sans);
  --read-size: 1.2rem;
  font-family: var(--serif);   /* body's computed font-family is inherited, not re-resolved — set it here */
}
[data-env="modern-edition"] .reader-page .reader-controls,
[data-env="modern-edition"] .reader-page .side-nav {
  --serif: var(--ui-serif); --hebrew: var(--ui-hebrew); --display: var(--ui-display);
  font-family: var(--ui-serif);
}
/* English reading text: a little optical care. Greek and Hebrew take their own faces via the vars. */
[data-env="modern-edition"] .reader-page .t.en,
[data-env="modern-edition"] .font-preview .t.en,
[data-env="modern-edition"] .reader-page .reader-para {
  font-optical-sizing: auto; hyphens: auto; -webkit-hyphens: auto;
}
/* Measure: a comfortable book column (≈ 62–66 characters). */
[data-env="modern-edition"] .reader.single { max-width: calc(38rem * var(--measure, 1)); }
[data-env="modern-edition"] .reader-page .verses.linear { max-width: calc(40rem * var(--measure, 1)); }
[data-env="modern-edition"] .reader-para { text-align: left; margin-bottom: 1em; }

/* Verse numbers: small, quiet, lining. */
[data-env="modern-edition"] .reader-page .vn,
[data-env="modern-edition"] .reader-page .vnum-inline {
  font-family: var(--ui-sans); font-weight: 500; font-size: 0.82em;
  color: color-mix(in srgb, var(--ink) 50%, transparent);
  font-variant-numeric: lining-nums tabular-nums; letter-spacing: 0.02em;
}
[data-env="modern-edition"] .reader-page .vnum-inline:hover { color: var(--accent-ink); }

/* Headings: a light, large display-cut title (Source Serif's optical-size axis gives the large
   sizes their fine, high-contrast form), a tracked accent caption beneath, and a short accent
   rule instead of filigree. Real air between the bar and the title. */
[data-env="modern-edition"] .reader-page .chapter-title { color: var(--ink); font-family: var(--serif); font-optical-sizing: auto; font-weight: 300; font-size: 2.7rem; line-height: 1.08; letter-spacing: -0.012em; margin-top: 3.4rem; }
[data-env="modern-edition"] .reader-page .chapter-title .he { font-family: var(--hebrew); font-weight: 400; letter-spacing: 0; }
[data-env="modern-edition"] .reader-page .chapter-title .bne {
  font-family: var(--ui-sans); font-weight: 600; font-size: 0.7rem; letter-spacing: 0.22em; opacity: 1; color: var(--accent-ink); margin-top: 0.7rem;
}
[data-env="modern-edition"] .reader-page .headpiece,
[data-env="modern-edition"] .reader-page .tailpiece { display: none; }
[data-env="modern-edition"] .reader-page .divider {
  height: 0; width: 2.2rem; margin: 1.5rem auto 2rem; border-top: 2px solid color-mix(in srgb, var(--accent-ink) 60%, transparent); border-radius: 2px; color: transparent;
}
[data-env="modern-edition"] .reader-page .divider use { display: none; }
/* Reading text: softened ink, a touch more size and leading, balanced wrapping, hanging quotes. */
[data-env="modern-edition"] .reader-page .t.en,
[data-env="modern-edition"] .reader-page .reader-para { color: color-mix(in srgb, var(--ink) 94%, var(--bg)); text-wrap: pretty; hanging-punctuation: first; }
[data-env="modern-edition"] .reader-page { --read-size: 1.24rem; }
[data-env="modern-edition"] .reader-page .parashah-mark { border-block-color: color-mix(in srgb, var(--rule) 55%, transparent); }
[data-env="modern-edition"] .reader-page .parashah-mark .pm-he { color: var(--ink); }
[data-env="modern-edition"] .reader-page .parashah-mark .pm-name { font-family: var(--ui-sans); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; }
/* Verse numbers keep their quiet weight but take the accent so they are easy to find. */
[data-env="modern-edition"] .reader-page .vn,
[data-env="modern-edition"] .reader-page .vnum-inline { color: color-mix(in srgb, var(--accent-ink) 78%, var(--bg)); font-weight: 600; }
/* Illumination → plain: the chapter's first word/initial is set like the rest. */
[data-env="modern-edition"] .reader-page .reader .illuminated {
  color: inherit; text-shadow: none; float: none; font: inherit; font-size: inherit; padding: 0; line-height: inherit;
}
/* Remaining gold furniture goes ink-quiet: portion marks, colophon, song heads, acrostic letters. */
[data-env="modern-edition"] .reader-page { --foil-ink: color-mix(in srgb, var(--ink) 58%, transparent); }
[data-env="modern-edition"] .reader-page .parallel .pv { border-bottom-style: solid; border-bottom-color: color-mix(in srgb, var(--rule) 70%, transparent); }

/* ═════════════════════════ Parchment ═════════════════════════
   Warm manuscript paper, dark brown ink, Cardo (a scholars' old-style face covering Latin,
   polytonic Greek) with David Libre for Hebrew. The reading column is a bounded PAGE on a
   darker desk, with a faint tiled paper grain (textures/paper.jpg, multiplied so it only ever
   darkens a hair and never touches contrast or selection). Ornaments keep their place but
   go ink-brown; verse numbers are italic old-style figures. */
[data-env="parchment"][data-theme="light"] {
  --base: #d9ccb2;                      /* the desk behind the page */
  --bg: color-mix(in srgb, var(--accent) 3%, #f3e8cf);
  --ink: color-mix(in srgb, var(--accent) 4%, #2b2015);
  --chrome: color-mix(in srgb, var(--accent) 4%, #ebdfc2);
  --card: color-mix(in srgb, var(--accent) 3%, #f8efd9);
  --hover: color-mix(in srgb, var(--accent) 10%, #e6d8b6);
  --rule: color-mix(in srgb, var(--accent) 10%, #c9b690);
  --accent-ink: color-mix(in srgb, var(--accent) 46%, #4a2e12);
  --foil-ink: #6b4a22;
}
[data-env="parchment"][data-theme="light"][data-accent="gold"] { --accent-ink: color-mix(in srgb, var(--accent) 30%, #4a2e12); }
[data-env="parchment"][data-theme="dark"] {
  --base: #120e09;
  --bg: color-mix(in srgb, var(--accent) 4%, #1d160e);
  --ink: color-mix(in srgb, var(--accent) 4%, #e9dcc0);
  --chrome: color-mix(in srgb, var(--accent) 6%, #16110b);
  --card: color-mix(in srgb, var(--accent) 5%, #251c12);
  --hover: color-mix(in srgb, var(--accent) 14%, #251c12);
  --rule: color-mix(in srgb, var(--accent) 14%, #3a2d1d);
  --accent-ink: color-mix(in srgb, var(--accent) 36%, #e8cc92);
  --foil-ink: #cfae6a;
}
/* The desk: a flat tone with a soft vignette — the page itself carries the paper. */
[data-env="parchment"] body {
  background-image: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--base) 82%, #fff), var(--base));
  background-color: var(--base);
  background-repeat: no-repeat; background-attachment: fixed; background-size: 100% 100%;
}
[data-env="parchment"][data-theme="dark"] body { background-image: radial-gradient(120% 90% at 50% 0%, #1a130c, var(--base)); }
[data-env="parchment"][data-theme="dark"] body .t.he,
[data-env="parchment"][data-theme="dark"] body .t.en,
[data-env="parchment"][data-theme="dark"] body .t.grc { text-shadow: none; }

/* The page. A pseudo-element paints the paper so it can stop short of the fixed sidebar's gutter
   (--gutter), which stays part of .reader-page's padding exactly as in Digital. */
[data-env="parchment"] #app:has(> .reader-page) { padding-top: var(--topbar-h); }
[data-env="parchment"] .reader-page {
  --serif: "Cardo", "Gentium Plus", "Palatino Linotype", Palatino, Georgia, serif;
  --hebrew: "David Libre", "Noto Serif Hebrew", "Shofar", "Frank Ruehl CLM", "Times New Roman", serif;
  --display: var(--serif);
  --read-size: 1.22rem;
  --pg: clamp(1.6rem, 6vw, 4.5rem);     /* the page's own side margin */
  --gutter: 0rem;                        /* the sidebar's strip, when it is showing */
  font-family: var(--serif);
  position: relative; isolation: isolate;
  max-width: calc(62rem * var(--measure, 1) + var(--gutter)); margin-inline: auto;
  padding: 0 calc(var(--pg) + var(--gutter)) 2.5rem var(--pg);
}
@media (min-width: 70rem) {
  [data-env="parchment"]:not([data-side-hidden]) .reader-page:has(> .side-nav) { --gutter: 15.75rem; }
}
[data-env="parchment"] .reader-page::before {
  content: ""; position: absolute; z-index: -1; inset: 0 var(--gutter) 0 0; pointer-events: none;
  background-color: var(--bg); background-image: url("textures/paper.jpg"); background-blend-mode: multiply;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rule) 45%, transparent), 0 10px 32px rgba(40, 24, 8, 0.12);
}
[data-env="parchment"][data-theme="dark"] .reader-page::before { box-shadow: 0 0 0 1px color-mix(in srgb, var(--rule) 45%, transparent), 0 10px 32px rgba(0, 0, 0, 0.28); }
[data-env="parchment"] .font-preview { --serif: "Cardo", "Gentium Plus", Georgia, serif; --hebrew: "David Libre", "Shofar", serif; font-family: var(--serif); }
/* The bar is the page's header: it bleeds to the page's edges, not the window's. */
[data-env="parchment"] .reader-page .reader-controls {
  --serif: var(--ui-serif); --hebrew: var(--ui-hebrew); --display: var(--ui-display); font-family: var(--ui-serif);
  margin-inline: calc(-1 * var(--pg)); padding-inline: var(--pg); margin-top: 0;
  background: var(--chrome);   /* opaque: the bar is sticky over scrolling text */
  border-bottom-color: color-mix(in srgb, var(--rule) 50%, transparent);
}
[data-env="parchment"] .reader-page .side-nav { --serif: var(--ui-serif); --hebrew: var(--ui-hebrew); --display: var(--ui-display); font-family: var(--ui-serif); }
[data-env="parchment"]:not([data-side-hidden]) .reader-page:has(> .side-nav) .reader-controls { margin-right: calc(-1 * var(--pg)); padding-right: var(--pg); border-radius: 0; }
@media (max-width: 48rem) {
  [data-env="parchment"] #app:has(> .reader-page) { padding-inline: 0; }
  [data-env="parchment"] .reader-page { max-width: none; --pg: 2.1rem; }
  [data-env="parchment"] .reader-page::before { box-shadow: none; }
}

/* Typography. */
[data-env="parchment"] .reader-page .t.en,
[data-env="parchment"] .font-preview .t.en,
[data-env="parchment"] .reader-page .reader-para { hyphens: auto; -webkit-hyphens: auto; font-feature-settings: "kern" 1, "liga" 1, "clig" 1, "calt" 1, "onum" 1; }
[data-env="parchment"] .reader.single { max-width: calc(36rem * var(--measure, 1)); }
[data-env="parchment"] .reader-page .verses.linear { max-width: calc(38rem * var(--measure, 1)); }
[data-env="parchment"] .reader-para { text-align: justify; }
[data-env="parchment"] .reader-page .vn,
[data-env="parchment"] .reader-page .vnum-inline {
  font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 0.95em;
  color: color-mix(in srgb, var(--ink) 62%, #8a5a2a);
  font-variant-numeric: oldstyle-nums proportional-nums; font-feature-settings: "onum" 1;
}
[data-env="parchment"] .reader-page .vnum-inline:hover { color: var(--accent-ink); }
[data-env="parchment"] .reader-page .chapter-title { color: var(--ink); font-family: var(--serif); font-weight: 400; font-size: 2rem; letter-spacing: 0.02em; }
[data-env="parchment"] .reader-page .chapter-title .he { font-family: var(--hebrew); font-weight: 400; }
[data-env="parchment"] .reader-page .chapter-title .bne { font-family: var(--serif); font-style: italic; font-size: 0.95rem; letter-spacing: 0.06em; text-transform: none; opacity: 0.75; }
/* Ornaments: same positions, drawn in ink instead of foil. */
[data-env="parchment"] .reader-page .headpiece,
[data-env="parchment"] .reader-page .tailpiece,
[data-env="parchment"] .reader-page .divider { filter: sepia(1) saturate(0.55) brightness(0.52); opacity: 0.8; }
[data-env="parchment"][data-theme="dark"] .reader-page .headpiece,
[data-env="parchment"][data-theme="dark"] .reader-page .tailpiece,
[data-env="parchment"][data-theme="dark"] .reader-page .divider { filter: sepia(0.9) saturate(0.7) brightness(0.95); opacity: 0.85; }
[data-env="parchment"] .reader-page .parallel .pv { border-bottom-style: solid; border-bottom-color: color-mix(in srgb, var(--rule) 38%, transparent); }
[data-env="parchment"] .reader-page .par-head { border-bottom-color: color-mix(in srgb, var(--rule) 55%, transparent); }
[data-env="parchment"] .reader-page .reader .illuminated { color: var(--accent-ink); text-shadow: none; }

/* Settings preview card */
.env-card[data-env-preview="parchment"] .env-sample {
  background: #f3e8cf url("textures/paper.jpg"); background-blend-mode: multiply; color: #2b2015; border-color: #c9b690; font-family: "Cardo", Georgia, serif;
}
.env-card[data-env-preview="parchment"] .env-he { font-family: "David Libre", var(--ui-hebrew); }

/* ═════════════════════════ Early Print ═════════════════════════
   A homage to sixteenth-century printed Bibles, made comfortable: cooler cream paper, black
   "iron-gall" ink, EB Garamond (a Renaissance old-style; also carries polytonic Greek) with
   Frank Ruhl Libre for Hebrew. A bounded page like Parchment, but more compact, framed by a
   fine rule; small-caps titles; RED rubric verse numbers and chapter marks (--rubric). Hebrew and
   Greek keep their own typographic conventions — only the English follows the Latin tradition. */
[data-env="early-print"][data-theme="light"] {
  --base: #cfc8b8;                      /* the desk */
  --bg: color-mix(in srgb, var(--accent) 1.5%, #fcfaf4);
  --ink: color-mix(in srgb, var(--accent) 1.5%, #15130f);
  --chrome: color-mix(in srgb, var(--accent) 3%, #f4efe3);
  --card: color-mix(in srgb, var(--accent) 2%, #fbf8f0);
  --hover: color-mix(in srgb, var(--accent) 9%, #e2d8bd);
  --rule: color-mix(in srgb, var(--accent) 8%, #b8a987);
  --accent-ink: color-mix(in srgb, var(--accent), black 34%);
  --rubric: var(--accent-ink);            /* the printer's second colour IS the accent ink */
  --foil-ink: var(--accent-ink);
}
[data-env="early-print"][data-theme="light"][data-accent="gold"] { --accent-ink: color-mix(in srgb, var(--accent), black 55%); }
[data-env="early-print"][data-theme="dark"] {
  --base: #0f0d0a;
  --bg: color-mix(in srgb, var(--accent) 3%, #1f1b15);
  --ink: color-mix(in srgb, var(--accent) 3%, #e7dec9);
  --chrome: color-mix(in srgb, var(--accent) 5%, #15120e);
  --card: color-mix(in srgb, var(--accent) 4%, #26211a);
  --hover: color-mix(in srgb, var(--accent) 13%, #26211a);
  --rule: color-mix(in srgb, var(--accent) 12%, #3a3328);
  --accent-ink: color-mix(in srgb, var(--accent), white 42%);
  --rubric: var(--accent-ink);
  --foil-ink: var(--accent-ink);
}
[data-env="early-print"] body {
  background-image: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--base) 84%, #fff), var(--base));
  background-color: var(--base);
  background-repeat: no-repeat; background-attachment: fixed; background-size: 100% 100%;
}
[data-env="early-print"][data-theme="dark"] body { background-image: radial-gradient(120% 90% at 50% 0%, #17130e, var(--base)); }
[data-env="early-print"][data-theme="dark"] body .t.he,
[data-env="early-print"][data-theme="dark"] body .t.en,
[data-env="early-print"][data-theme="dark"] body .t.grc { text-shadow: none; }

[data-env="early-print"] #app:has(> .reader-page) { padding-top: var(--topbar-h); }
[data-env="early-print"] .reader-page {
  --serif: "EB Garamond", "Cardo", "Palatino Linotype", Palatino, Georgia, serif;
  --hebrew: "Frank Ruhl Libre", "David Libre", "Noto Serif Hebrew", "Shofar", "Times New Roman", serif;
  --display: var(--serif);
  --read-size: 1.2rem;
  --pg: clamp(1.6rem, 6vw, 4rem);
  --gutter: 0rem;
  font-family: var(--serif);
  position: relative; isolation: isolate;
  max-width: calc(56rem * var(--measure, 1) + var(--gutter)); margin-inline: auto;
  padding: 0 calc(var(--pg) + var(--gutter)) 2rem var(--pg);
}
@media (min-width: 70rem) {
  [data-env="early-print"]:not([data-side-hidden]) .reader-page:has(> .side-nav) { --gutter: 15.75rem; }
}
[data-env="early-print"] .reader-page::before {
  content: ""; position: absolute; z-index: -2; inset: 0 var(--gutter) 0 0; pointer-events: none;
  background-color: var(--bg); background-image: url("textures/paper.jpg"); background-blend-mode: multiply;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--rule) 55%, transparent), 0 8px 26px rgba(30, 22, 10, 0.12);
}
[data-env="early-print"][data-theme="dark"] .reader-page::before { box-shadow: 0 0 0 1px color-mix(in srgb, var(--rule) 55%, transparent), 0 8px 26px rgba(0, 0, 0, 0.3); }
/* The printed frame: a single fine rule inset from the page edge. */
[data-env="early-print"] .reader-page::after {
  content: ""; position: absolute; z-index: -1; inset: 0.55rem calc(var(--gutter) + 0.55rem) 0.55rem 0.55rem; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
}
[data-env="early-print"] .font-preview { --serif: "EB Garamond", "Cardo", Georgia, serif; --hebrew: "Frank Ruhl Libre", "Shofar", serif; font-family: var(--serif); }
[data-env="early-print"] .reader-page .reader-controls {
  --serif: var(--ui-serif); --hebrew: var(--ui-hebrew); --display: var(--ui-display); font-family: var(--ui-serif);
  margin-inline: calc(-1 * var(--pg)); padding-inline: var(--pg); margin-top: 0;
  background: var(--chrome);   /* opaque: the bar is sticky over scrolling text */
  border-bottom-color: color-mix(in srgb, var(--rule) 50%, transparent);
}
[data-env="early-print"]:not([data-side-hidden]) .reader-page:has(> .side-nav) .reader-controls { margin-right: calc(-1 * var(--pg)); padding-right: var(--pg); border-radius: 0; }
[data-env="early-print"] .reader-page .side-nav { --serif: var(--ui-serif); --hebrew: var(--ui-hebrew); --display: var(--ui-display); font-family: var(--ui-serif); }
@media (max-width: 48rem) {
  [data-env="early-print"] #app:has(> .reader-page) { padding-inline: 0; }
  [data-env="early-print"] .reader-page { max-width: none; --pg: 2.1rem; }
  [data-env="early-print"] .reader-page::before { box-shadow: none; }
  [data-env="early-print"] .reader-page::after { display: none; }
}

/* Typography: compact, traditional. */
[data-env="early-print"] .reader-page .t.en,
[data-env="early-print"] .font-preview .t.en,
[data-env="early-print"] .reader-page .reader-para { hyphens: auto; -webkit-hyphens: auto; font-feature-settings: "kern" 1, "liga" 1, "clig" 1, "calt" 1, "onum" 1; }
[data-env="early-print"] .reader.single { max-width: calc(34rem * var(--measure, 1)); }
[data-env="early-print"] .reader-page .verses.linear { max-width: calc(36rem * var(--measure, 1)); }
[data-env="early-print"] .reader-para { text-align: justify; margin-bottom: 0.7em; }
/* Verse numbers: rubric red. In the parallel/linear gutter they sit as quiet red figures; in
   running prose they stay inline (the prose is one flowing text node — no gutter to hang in). */
[data-env="early-print"] .reader-page .vn,
[data-env="early-print"] .reader-page .vnum-inline {
  font-family: var(--serif); font-style: normal; font-weight: 500; font-size: 0.92em;
  color: var(--rubric); font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1; letter-spacing: 0.03em;
}
[data-env="early-print"] .reader-page .vnum-inline:hover { color: var(--accent-ink); }
/* Titles in small capitals; the chapter mark is a rubric. */
[data-env="early-print"] .reader-page .chapter-title { color: var(--ink); font-family: var(--serif); font-weight: 500; font-size: 1.85rem; letter-spacing: 0.05em; font-variant-caps: small-caps; }
[data-env="early-print"] .reader-page .chapter-title .he { font-family: var(--hebrew); font-weight: 500; font-variant-caps: normal; letter-spacing: 0; }
[data-env="early-print"] .reader-page .chapter-title .bne { color: var(--rubric); font-family: var(--serif); font-size: 0.92rem; letter-spacing: 0.14em; text-transform: none; font-variant-caps: all-small-caps; opacity: 1; }
/* Ornaments redrawn as accent-ink flourishes (the shared divider shape as a mask), no foil. */
[data-env="early-print"] .reader-page .headpiece,
[data-env="early-print"] .reader-page .tailpiece { display: none; }
[data-env="early-print"] .reader-page .divider {
  display: block; height: 1.15rem; width: 8.5rem; margin: 0.9rem auto 1.3rem; color: transparent;
  background-color: var(--accent-ink); opacity: 0.85;
  -webkit-mask: var(--ornament) center / contain no-repeat; mask: var(--ornament) center / contain no-repeat;
}
[data-env="early-print"] .reader-page .divider use { display: none; }
[data-env="early-print"] .reader-page .chapter-title { margin-top: 1.6rem; }
[data-env="early-print"] .reader-page .par-head { color: var(--accent-ink); font-variant-caps: all-small-caps; letter-spacing: 0.12em; text-transform: none; border-bottom-color: color-mix(in srgb, var(--rule) 30%, transparent); }
[data-env="early-print"] .reader-page .parallel .pv,
[data-env="early-print"] .reader-page .parallel .pv-gutter { border-bottom: 1px solid color-mix(in srgb, var(--rule) 22%, transparent); padding-block: 0.15rem; }
/* the portion (parashah) headings: drop the heavy top/bottom rules, let small caps carry them */
[data-env="early-print"] .reader-page .parashah-mark { border-top: 0; border-bottom: 0; }
[data-env="early-print"] .reader-page .parashah-mark .pm-he { color: var(--ink); }
[data-env="early-print"] .reader-page .parashah-mark .pm-name { color: var(--accent-ink); font-variant-caps: all-small-caps; letter-spacing: 0.12em; }
/* the little verse icons (bookmark, link, cross-refs): clearly visible ink, not faded accent */
[data-env="early-print"] .reader-page .star,
[data-env="early-print"] .reader-page .linkcopy,
[data-env="early-print"] .reader-page .xref-btn { color: color-mix(in srgb, var(--ink) 74%, var(--bg)); opacity: 0.9; }
[data-env="early-print"] .reader-page .star.on { color: var(--accent-ink); opacity: 1; }
[data-env="early-print"] .reader-page .star:hover,
[data-env="early-print"] .reader-page .linkcopy:hover,
[data-env="early-print"] .reader-page .xref-btn:hover { color: var(--accent-ink); opacity: 1; background: var(--hover); }
[data-env="early-print"] .reader-page .reader .illuminated { color: var(--rubric); text-shadow: none; }

/* Settings preview card */
.env-card[data-env-preview="early-print"] .env-sample {
  background: #fcfaf4 url("textures/paper.jpg"); background-blend-mode: multiply; color: #15130f; border-color: #cfc8b8; font-family: "EB Garamond", Georgia, serif;
}
.env-card[data-env-preview="early-print"] .env-en::first-letter { color: var(--accent-ink); }
.env-card[data-env-preview="early-print"] .env-he { font-family: "Frank Ruhl Libre", var(--ui-hebrew); }

/* the floating preview's halo should match the page it floats over (Parchment/Early Print sit on the desk) */
[data-env="parchment"] .font-preview, [data-env="early-print"] .font-preview { box-shadow: 0 0 0 0.5rem var(--base); }

/* Desk around the page: real breathing room between the window edge and the page (wide enough
   screens only — on phones the page runs edge to edge and its own --pg margin does the work). */
@media (min-width: 48.01rem) {
  [data-env="parchment"] #app:has(> .reader-page),
  [data-env="early-print"] #app:has(> .reader-page) {
    padding-inline: max(clamp(1.25rem, 5.5vw, 4.5rem), env(safe-area-inset-left), env(safe-area-inset-right));
  }
}

/* Justified prose needs a measure of ~30+ characters or it opens rivers of space: on phones set it ragged-right. */
@media (max-width: 48rem) {
  [data-env="parchment"] .reader-para, [data-env="early-print"] .reader-para { text-align: left; }
}


/* ───────── Modern Edition: reading finesse ─────────
   A publisher's chapter opening: a large, light, accent-tinted numeral over the native title;
   book-quality paragraph rhythm; tracked sans column heads; quieter interlinear. */
[data-env="modern-edition"] .reader-page .chapter-title { margin-top: 2.6rem; }
[data-env="modern-edition"] .reader-page .chapter-title::before {
  content: attr(data-ch); display: block;
  font-family: var(--serif); font-optical-sizing: auto; font-weight: 200; font-size: 6rem; line-height: 0.9;
  letter-spacing: -0.04em; font-variant-numeric: lining-nums;
  color: color-mix(in srgb, var(--accent-ink) 34%, transparent); margin-bottom: 1.1rem;
}
/* the numeral now carries the chapter number, so the caption is just the book */
[data-env="modern-edition"] .reader-page .chapter-title .bne { margin-top: 0.8rem; }
/* paragraph rhythm: a little more leading and a full line between paragraphs */
[data-env="modern-edition"] .reader-page .reader-para { margin-bottom: 1.15em; text-rendering: optimizeLegibility; font-kerning: normal; hyphenate-limit-chars: 6 3 3; }
[data-env="modern-edition"] .reader-page .reader.single.en .reader-para,
[data-env="modern-edition"] .reader-page .t.en { line-height: var(--en-leading, 1.82); }
/* column heads in parallel: tracked sans small caps in accent ink, hairline rule */
[data-env="modern-edition"] .reader-page .par-head {
  font-family: var(--ui-sans); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.2em; color: var(--accent-ink);
  border-bottom-color: color-mix(in srgb, var(--rule) 60%, transparent); padding-bottom: 0.5rem;
}
/* the verse gutter: roomier, icons only on intent */
[data-env="modern-edition"] .reader-page .pv-gutter .star,
[data-env="modern-edition"] .reader-page .pv-gutter .linkcopy,
[data-env="modern-edition"] .reader-page .pv-gutter .xref-btn { opacity: 0.7; }
[data-env="modern-edition"] .reader-page .parallel .pv:hover ~ .pv-gutter .star,
[data-env="modern-edition"] .reader-page .pv-gutter:hover .star,
[data-env="modern-edition"] .reader-page .pv-gutter:hover .linkcopy,
[data-env="modern-edition"] .reader-page .pv-gutter:hover .xref-btn { opacity: 1; }
[data-env="modern-edition"] .reader-page .parallel .pv { padding-block: 0.55rem; }
/* interlinear: ink for the original and gloss, accent only on the transliteration */
[data-env="modern-edition"] .reader-page .il-tr { font-style: italic; color: var(--accent-ink); opacity: 0.9; }
[data-env="modern-edition"] .reader-page .il-en { color: color-mix(in srgb, var(--ink) 80%, var(--bg)); }
[data-env="modern-edition"] .reader-page .il-word:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); }
/* selection */
[data-env="modern-edition"] ::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
/* narrow screens: a smaller numeral */
@media (max-width: 48rem) {
  [data-env="modern-edition"] .reader-page .chapter-title::before { font-size: 4.2rem; }
  [data-env="modern-edition"] .reader-page .chapter-title { font-size: 2.2rem; margin-top: 1.8rem; }
}

/* ───────────── ornaments on the other pages follow the environment too ─────────────
   The reader redraws its headpiece / divider per environment; the same rule applies to the quieter marks used
   on every other page: the diamond + fading rule that opens a section on Home, the short rule under page and
   list headings, the rule under a plan band's name, and the flourish above the week's portion. */
[data-env="parchment"] { --orn: color-mix(in srgb, #7a4e22 78%, var(--ink)); }
[data-env="early-print"] { --orn: var(--accent-ink); }
[data-env="modern-edition"] { --orn: color-mix(in srgb, var(--accent-ink) 62%, transparent); }

/* Parchment & Early Print: ink-coloured (no gold foil), hairline rules */
:is([data-env="parchment"], [data-env="early-print"]) .section-head::before { background: var(--orn); opacity: 0.8; }
:is([data-env="parchment"], [data-env="early-print"]) .section-head::after { background: linear-gradient(90deg, color-mix(in srgb, var(--orn) 70%, transparent), transparent); height: 1px; }
:is([data-env="parchment"], [data-env="early-print"]) :is(.results-head, .data-page h2, .slider-group h3)::after { background: linear-gradient(90deg, var(--orn), transparent); height: 1px; width: 7rem; }
:is([data-env="parchment"], [data-env="early-print"]) .pb-head::after { background: var(--orn); height: 1px; }
:is([data-env="parchment"], [data-env="early-print"]) .home-parashah::before { background-color: var(--orn); }

/* Modern Edition: no flourishes — a diamond-free heading and one short, quiet rule */
[data-env="modern-edition"] .section-head::before { display: none; }
[data-env="modern-edition"] .section-head::after { background: var(--orn); height: 1px; opacity: 0.5; }
[data-env="modern-edition"] :is(.results-head, .data-page h2, .slider-group h3)::after { background: var(--orn); width: 5rem; height: 2px; }
[data-env="modern-edition"] .pb-head::after { background: var(--orn); }
[data-env="modern-edition"] .home-parashah::before { display: none; }

/* The tooled cards on Home (today's readings, plan bands) are coloured leather, so their gold stays legible; what changes is the
   tooling: Parchment keeps the double frame, Early Print a single printed rule, Modern Edition none. */
[data-env="modern-edition"] .home > :not(.bookcase) .cover-frame { display: none; }
[data-env="early-print"] .home > :not(.bookcase) .cover-frame::after { display: none; }
[data-env="early-print"] .home > :not(.bookcase) .cover-frame { border-width: 1px; opacity: 0.6; }

/* the top bar follows the desk padding Parchment and Early Print keep around the page (wide screens) */
@media (min-width: 48.01rem) {
  :is([data-env="parchment"], [data-env="early-print"]):has(#app > .reader-page) { --page-pad: max(clamp(1.25rem, 5.5vw, 4.5rem), env(safe-area-inset-left), env(safe-area-inset-right)); }
}

/* With the sidebar hidden, styles.css zeroes the reader's side padding (it was the sidebar's strip). In these two
   environments the page has real margins inside its painted edge/frame: keep them, so verse numbers, icons and
   the ends of lines (interlinear especially) never run under the page's border or the printed frame. */
:root[data-env="parchment"][data-side-hidden] .reader-page:has(> .side-nav),
:root[data-env="early-print"][data-side-hidden] .reader-page:has(> .side-nav) { padding-inline: var(--pg); }
:is([data-env="parchment"], [data-env="early-print"]) .reader-page .il-verse { padding-inline: 0.5rem; }

/* Parchment & Early Print: the page is a bounded sheet, but the reader bar (a second header under the top bar) runs the
   full width of the window like Digital and Modern. Its own box still follows the page's text column; a pseudo
   paints the bar out to the window's edges — both edges with the sidebar away, the left edge only beside it. */
:is([data-env="parchment"], [data-env="early-print"]) .reader-page .reader-controls {
  background: transparent; border-bottom: 0; isolation: isolate;
}
:is([data-env="parchment"], [data-env="early-print"]) .reader-page .reader-controls::before {
  content: ""; position: absolute; z-index: -1; top: 0; bottom: 0;
  left: calc(50% - 50vw + var(--gutter, 0rem) / 2); right: calc(50% - 50vw + var(--gutter, 0rem) / 2);
  background: var(--chrome); border-bottom: 1px solid color-mix(in srgb, var(--rule) 50%, transparent);
}
@media (min-width: 70rem) {
  :root:not([data-side-hidden]):is([data-env="parchment"], [data-env="early-print"]) .reader-page:has(> .side-nav) .reader-controls::before { right: 0; }
}
:is([data-env="parchment"], [data-env="early-print"]) body { overflow-x: clip; }

/* Hebrew (and Aramaic) prose is always right-aligned, whatever the environment or screen sets for Latin/Greek text. */
[data-env] .reader.single.he .reader-para { text-align: right; direction: rtl; }
