/* Library v2 — core design system. Tokens, themes (Paper / Sepia / Night / Auto), typography, the header (nx-),
   shared components (ui-), shared annotation classes (hl-*, ul*, mk). Module CSS uses its own prefix. See ARCHITECTURE.md. */
@font-face { font-family: "EB Garamond"; src: url(fonts/EBGaramond.woff) format("woff"); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url(fonts/EBGaramond-Italic.woff) format("woff"); font-weight: 400 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/Cormorant.woff) format("woff"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/Cormorant-Italic.woff) format("woff"); font-weight: 300 700; font-style: italic; font-display: swap; }

/* ------------------------------------------------------------------ tokens: Paper (light) */
:root {
  color-scheme: light;
  --paper: #f6f1e6; --surface: #fcf9f2; --surface-2: #f0e9da; --surface-3: #e6dcc8;
  --ink: #1e1913; --ink-2: #4a4035; --muted: #8b7e6b; --faint: #b9ad97;
  --border: rgba(74, 56, 30, .15); --border-2: rgba(74, 56, 30, .28);
  --rubric: #9b2a1f; --gold: #9c7427; --gold-2: #c9a55a; --link: #6b4a1a; --gilt: #a67c2e; --on-rubric: #fff;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 8px 28px rgba(60, 40, 10, .09);
  --shadow-lg: 0 18px 60px rgba(40, 25, 5, .22);
  --scrim: rgba(15, 10, 3, .38);
  --hl-yellow: rgba(242, 201, 76, .42); --hl-green: rgba(126, 184, 106, .34); --hl-blue: rgba(110, 160, 220, .30);
  --hl-rose: rgba(226, 124, 140, .30); --hl-violet: rgba(160, 128, 210, .30);
  --ul-red: #b0362a; --ul-gold: #b88a2e; --ul-blue: #3f6fb5;
  --sw-yellow: #f2c94c; --sw-green: #86bf6f; --sw-blue: #79a8e0; --sw-rose: #e58a9a; --sw-violet: #a98ad9;
  /* corpus colours (Study bars, tree, badges) */
  --c-fa: #9b2a1f; --c-st: #3f6fb5; --c-cat: #b8892e; --c-cm: #4f8a4a; --c-ca: #7b5aa6;
  --tree-0: #dccba0; --tree-1: #c9a55a; --tree-2: #b9772f; --tree-3: #9b2a1f; --tree-4: #5e150d;
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --display: "Cormorant Garamond", "EB Garamond", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs: 20px; --lh: 1.62; --measure: 36rem;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --r-1: 8px; --r-2: 12px; --r-3: 16px; --r-pill: 999px;
  --w-text: 46rem; --w-narrow: 36rem; --w-wide: 64rem; --w-full: 84rem;
  --nxh: 100px;
  --z-head: 40; --z-sel: 55; --z-layer: 60; --z-toast: 90;
  --bar-bg: color-mix(in srgb, var(--paper) 88%, transparent);
}
/* the reading column (Bible, catechisms, Fathers) grows with the window on laptops and desktops, up to a comfortable line length */
@media (min-width: 900px) { :root { --measure: clamp(36rem, 58vw, 54rem); } }
:root[data-theme="sepia"] {
  --paper: #eadcbf; --surface: #f3e7cc; --surface-2: #e4d3b1; --surface-3: #d8c49d;
  --ink: #2b2014; --ink-2: #54432d; --muted: #86704f; --faint: #b19b78; --border: rgba(80, 55, 20, .18); --border-2: rgba(80, 55, 20, .32);
  --gilt: #946a1f; --tree-0: #d2bb8a;
}
/* Night: explicit, or Auto when the device is dark */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #13110e; --surface: #1b1814; --surface-2: #25211b; --surface-3: #312b22;
  --ink: #ece3d2; --ink-2: #cbbda6; --muted: #978a74; --faint: #6c6252; --border: rgba(236, 222, 196, .11); --border-2: rgba(236, 222, 196, .22);
  --rubric: #e27e6c; --gold: #d4ab5e; --gold-2: #b68d45; --link: #e3c38a; --gilt: #c9a257; --on-rubric: #1b1814;
  --shadow: none; --shadow-lg: 0 18px 60px rgba(0, 0, 0, .6); --scrim: rgba(0, 0, 0, .55);
  --hl-yellow: rgba(230, 190, 70, .30); --hl-green: rgba(110, 175, 95, .30); --hl-blue: rgba(95, 145, 215, .32);
  --hl-rose: rgba(225, 110, 130, .30); --hl-violet: rgba(150, 120, 215, .34);
  --ul-red: #ec8a78; --ul-gold: #deb35f; --ul-blue: #7fa6e6;
  --c-fa: #e27e6c; --c-st: #7fa6e6; --c-cat: #deb35f; --c-cm: #86bf6f; --c-ca: #b59ae0;
  --tree-0: #5d5445; --tree-1: #8f7440; --tree-2: #c9a257; --tree-3: #e27e6c; --tree-4: #ffc2b0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #13110e; --surface: #1b1814; --surface-2: #25211b; --surface-3: #312b22;
    --ink: #ece3d2; --ink-2: #cbbda6; --muted: #978a74; --faint: #6c6252; --border: rgba(236, 222, 196, .11); --border-2: rgba(236, 222, 196, .22);
    --rubric: #e27e6c; --gold: #d4ab5e; --gold-2: #b68d45; --link: #e3c38a; --gilt: #c9a257; --on-rubric: #1b1814;
    --shadow: none; --shadow-lg: 0 18px 60px rgba(0, 0, 0, .6); --scrim: rgba(0, 0, 0, .55);
    --hl-yellow: rgba(230, 190, 70, .30); --hl-green: rgba(110, 175, 95, .30); --hl-blue: rgba(95, 145, 215, .32);
    --hl-rose: rgba(225, 110, 130, .30); --hl-violet: rgba(150, 120, 215, .34);
    --ul-red: #ec8a78; --ul-gold: #deb35f; --ul-blue: #7fa6e6;
    --c-fa: #e27e6c; --c-st: #7fa6e6; --c-cat: #deb35f; --c-cm: #86bf6f; --c-ca: #b59ae0;
    --tree-0: #5d5445; --tree-1: #8f7440; --tree-2: #c9a257; --tree-3: #e27e6c; --tree-4: #ffc2b0;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 17px; line-height: 1.5; overflow-x: hidden;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
a { color: var(--link); }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.is-hidden, [hidden] { display: none !important; }
.ui-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ui-muted { color: var(--muted); }
.ui-sans { font-family: var(--sans); }
.ui-sc { font-variant: small-caps; letter-spacing: .04em; }
.ui-sp { flex: 1; }
.ui-ico { display: inline-flex; line-height: 0; }
body.nx-modal { overflow: hidden; }
main#main { min-height: calc(100vh - var(--nxh)); outline: none; }

/* ------------------------------------------------------------------ header (nx-) */
.nx-head { position: sticky; top: 0; z-index: var(--z-head); background: var(--bar-bg); backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--border); font-family: var(--sans); transition: transform .22s ease; padding-top: env(safe-area-inset-top); }
.nx-head.is-away { transform: translateY(-100%); }
.nx-row1 { display: flex; align-items: center; gap: 4px; padding: 8px 10px 2px; min-width: 0; }
.nx-backslot { flex: none; display: flex; }
.nx-ib { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; text-decoration: none; position: relative; padding: 0; }
.nx-ib:hover { background: var(--surface-2); color: var(--ink); }
.nx-ib.is-on, .nx-ib[aria-pressed="true"] { color: var(--rubric); background: var(--surface-2); }
.nx-mark { color: var(--rubric); font-size: 22px; }
.nx-where { flex: 1; min-width: 0; display: flex; justify-content: center; }
.nx-title { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; border: 0; background: transparent; padding: 6px 12px; border-radius: 10px;
  font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.nx-title.is-btn { cursor: pointer; }
.nx-title.is-btn:hover { background: var(--surface-2); }
.nx-tt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nx-chev { font-size: 12px; color: var(--muted); flex: none; }
.nx-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.nx-tools.is-empty { display: none; }
.nx-find { display: inline-flex; align-items: center; gap: 8px; height: 38px; border: 1px solid var(--border-2); background: var(--surface); color: var(--muted); border-radius: 11px;
  padding: 0 10px; cursor: pointer; font: 500 14px var(--sans); flex: none; width: clamp(190px, 24vw, 300px); }
.nx-find:hover { border-color: var(--gold-2); color: var(--ink-2); }
.nx-fi { line-height: 0; }
.nx-ft { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-find kbd { font: 600 11px var(--sans); border: 1px solid var(--border-2); border-radius: 5px; padding: 1px 6px; color: var(--muted); }
@media (max-width: 899px) {
  .nx-find { width: 40px; height: 40px; padding: 0; justify-content: center; border: 0; background: transparent; color: var(--ink-2); border-radius: 10px; }
  .nx-find:hover { background: var(--surface-2); } .nx-ft, .nx-find kbd { display: none; }
}
.nx-row2 { display: flex; align-items: center; gap: 8px; padding: 0 10px 6px; min-width: 0; }
.nx-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nx-tabs::-webkit-scrollbar { display: none; }
.nx-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.nx-tab:hover { background: var(--surface-2); color: var(--ink); }
.nx-tab.is-on { background: var(--ink); color: var(--paper); }
.nx-ti { color: var(--rubric); font-size: 15px; line-height: 0; }
.nx-tab.is-on .nx-ti { color: inherit; }
.nx-sm { display: none; }
.nx-t-home .nx-lg { display: none; }
@media (max-width: 760px) {
  .nx-lg { display: none; } .nx-sm { display: inline; }
  .nx-tab { padding: 6px 9px; font-size: 13px; gap: 0; }
  .nx-row1 { padding: 6px 6px 2px; gap: 2px; } .nx-row2 { padding: 0 8px 6px; gap: 6px; }
  .nx-tabs { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent); }
  .nx-title { padding: 6px 6px; font-size: 18px; }
}
@media (max-width: 400px) { .nx-ib { width: 36px; } }
.nx-collect { flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 40%; min-width: 0; border: 1px dashed var(--border-2); background: transparent; color: var(--ink-2);
  border-radius: var(--r-pill); padding: 5px 11px; font: 600 12.5px var(--sans); cursor: pointer; }
.nx-collect:hover { border-color: var(--gold-2); }
.nx-collect.is-on { border-style: solid; border-color: color-mix(in srgb, var(--nb) 55%, var(--border-2)); background: color-mix(in srgb, var(--nb) 11%, var(--surface)); color: var(--ink); }
.nx-collect b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 650; }
.nx-collect .nx-cl { color: var(--muted); font-weight: 500; white-space: nowrap; }
.nx-collect .nx-ct { font-variant-numeric: tabular-nums; color: var(--muted); }
.nx-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--nb, var(--gold)); flex: none; display: inline-block; }
.nx-collect:not(.is-on) .nx-dot { background: transparent; border: 1.5px solid var(--muted); }
@media (max-width: 760px) { .nx-collect .nx-cl { display: none; } .nx-collect { max-width: 34%; padding: 5px 9px; } }
.nx-modes { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; flex: none; font-family: var(--sans); }
.nx-modes a { padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.nx-modes a.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
@media (max-width: 430px) { .nx-modes a { padding: 5px 6px; font-size: 12.5px; } }
.nx-view { min-height: 40vh; }
.nx-view > .ui-loading:not(:only-child) { display: none; }

/* ------------------------------------------------------------------ pages & typography */
.ui-page { margin: 0 auto; padding: 20px 16px 120px; max-width: var(--w-wide); min-width: 0; }
.ui-page.is-narrow { max-width: var(--w-narrow); } .ui-page.is-text { max-width: var(--w-text); } .ui-page.is-full { max-width: var(--w-full); }
.ui-hero { text-align: center; padding: 28px 8px 10px; }
.ui-hero-cross { color: var(--rubric); font-size: 36px; line-height: 1; }
.ui-hero-title { font-family: var(--display); font-weight: 600; font-size: 44px; letter-spacing: .01em; margin: 6px 0 0; line-height: 1.05; }
.ui-hero-sub { font-variant: small-caps; letter-spacing: .12em; color: var(--muted); font-size: 16px; margin-top: 8px; }
.ui-orn { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--gold); margin: 16px auto; max-width: 18rem; }
.ui-orn::before, .ui-orn::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); }
.ui-eyebrow { font-family: var(--sans); font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.ui-ptitle { font-family: var(--display); font-weight: 600; font-size: 38px; margin: 6px 0 2px; line-height: 1.1; overflow-wrap: anywhere; }
.ui-psub { color: var(--muted); margin: 0 0 16px; }
@media (max-width: 520px) { .ui-ptitle { font-size: 32px; } .ui-hero-title { font-size: 38px; } }
.ui-prose { font-size: 17px; line-height: 1.55; }
.ui-prose p { margin: 0 0 .7em; }
.ui-prose.is-clamp { max-height: 15em; overflow: hidden; position: relative; }
.ui-prose.is-clamp::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4em; background: linear-gradient(transparent, var(--surface)); }
/* reading text: modules put Scripture / catechism / Fathers text in .ui-text (size and spacing follow the settings) */
.ui-text { font-size: var(--fs); line-height: var(--lh); hyphens: auto; -webkit-hyphens: auto; text-align: left; font-variant-numeric: oldstyle-nums; overflow-wrap: break-word; }
html[data-s-justify="on"] .ui-text { text-align: justify; text-justify: inter-word; }
.ui-quote { font-style: italic; color: var(--ink-2); border-left: 2px solid var(--gold-2); padding-left: 10px; margin: 0; }
.ui-end { text-align: center; color: var(--gold); margin: 30px 0 0; font-size: 18px; }
.ui-hint { font-family: var(--sans); font-size: 12.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.45; }
.ui-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* ------------------------------------------------------------------ controls */
.ui-btn { font-family: var(--sans); font-size: 14px; font-weight: 650; border-radius: 11px; border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); padding: 9px 14px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 1.2; }
.ui-btn:hover { background: var(--surface-2); }
.ui-btn:disabled { opacity: .5; cursor: default; }
.ui-btn.is-primary { background: var(--rubric); border-color: var(--rubric); color: var(--on-rubric); }
.ui-btn.is-danger { color: var(--rubric); }
.ui-btn.is-small { font-size: 13px; padding: 6px 10px; border-radius: 9px; }
.ui-btn.is-ghost { border-color: transparent; background: transparent; }
.ui-btn.is-ghost:hover { background: var(--surface-2); }
.ui-btn[aria-pressed="true"] { background: var(--surface-3); border-color: var(--gold-2); }
.ui-field { flex: 1; min-width: 0; width: 100%; font: inherit; font-size: 18px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); }
.ui-goto { display: flex; gap: 8px; margin-top: 10px; }
.ui-goto .ui-field { width: auto; }
.ui-ta { width: 100%; min-height: 150px; font: inherit; font-size: 18px; line-height: 1.5; padding: 12px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); resize: vertical; }
.ui-label { display: block; font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.ui-form > :first-child { margin-top: 0; }
.ui-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ui-chip { font-family: var(--sans); font-size: 13px; font-weight: 600; border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); border-radius: var(--r-pill); padding: 4px 11px; cursor: pointer; text-decoration: none; }
.ui-chip:hover { border-color: var(--gold-2); }
.ui-chip.is-on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.ui-tagpick { margin-top: 8px; }
.ui-seg { display: inline-flex; background: var(--surface-2); border-radius: 11px; padding: 3px; flex-wrap: wrap; max-width: 100%; }
.ui-seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; cursor: pointer; font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.ui-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.ui-tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 17px; cursor: pointer; }
.ui-tog:first-of-type { border-top: 0; }
.ui-tog small { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); }
.ui-switch { position: relative; width: 46px; height: 28px; flex: none; }
.ui-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.ui-switch span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--surface-3); transition: background .15s; pointer-events: none; }
.ui-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.ui-switch input:checked + span { background: var(--rubric); }
.ui-switch input:checked + span::after { transform: translateX(18px); }
.ui-switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.ui-sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-2); cursor: pointer; padding: 0; }
.ui-sw.is-yellow { background: var(--sw-yellow); } .ui-sw.is-green { background: var(--sw-green); } .ui-sw.is-blue { background: var(--sw-blue); } .ui-sw.is-rose { background: var(--sw-rose); } .ui-sw.is-violet { background: var(--sw-violet); }
.ui-sw.is-clear { background: var(--surface); position: relative; } .ui-sw.is-clear::after { content: ""; position: absolute; left: 4px; right: 4px; top: 13px; height: 2px; background: var(--rubric); transform: rotate(-45deg); }

/* ------------------------------------------------------------------ cards, lists, sections */
.ui-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-3); box-shadow: var(--shadow); padding: 18px; min-width: 0; color: inherit; text-decoration: none; }
a.ui-card:hover { border-color: var(--gold-2); }
.ui-card-h { font-family: var(--display); font-weight: 600; font-size: 25px; margin: 0 0 4px; line-height: 1.15; }
.ui-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.ui-sec { margin-top: 22px; }
.ui-sec-h { font-family: var(--sans); font-size: 11.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--gold); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.ui-ct { color: var(--muted); font-weight: 600; letter-spacing: 0; }
.ui-list { list-style: none; margin: 0; padding: 0; }
.ui-list li { border-top: 1px solid var(--border); }
.ui-list li:first-child { border-top: 0; }
.ui-list-a { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; padding: 9px 2px; text-decoration: none; color: var(--ink); min-width: 0; }
a.ui-list-a:hover .ui-list-t { color: var(--rubric); }
.ui-list-t { font-size: 17px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.ui-list-r { margin-left: auto; font: 600 12.5px var(--sans); color: var(--muted); }
.ui-list-s { flex-basis: 100%; color: var(--ink-2); font-size: 15px; }
.ui-tag { display: inline-block; font-family: var(--sans); font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--ink-2); text-decoration: none; }
.ui-kind { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.ui-refchip { display: inline-block; font-variant: small-caps; letter-spacing: .04em; font-weight: 600; color: var(--rubric); text-decoration: none; border: 1px solid var(--border-2); border-radius: var(--r-pill); padding: 0 9px; font-size: 15.5px; line-height: 1.6; background: var(--surface); }
.ui-refchip:hover { border-color: var(--rubric); }
.ui-crux { color: var(--rubric); line-height: 0; }
.ui-skel { display: grid; gap: 12px; padding: 8px 0; }
.ui-skel i { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: ui-shimmer 1.3s linear infinite; }
@keyframes ui-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.ui-loading { max-width: var(--w-text); margin: 0 auto; padding: 40px 16px; }
.ui-empty { text-align: center; padding: 28px 12px; color: var(--ink-2); }
.ui-empty .ui-crux { font-size: 30px; }
.ui-empty-t { font-family: var(--display); font-size: 26px; font-weight: 600; color: var(--ink); margin: 6px 0 4px; }
.ui-empty .ui-row { justify-content: center; }
.ui-error-d { text-align: left; margin: 14px auto 0; max-width: 34rem; font-family: var(--sans); font-size: 12px; color: var(--muted); }
.ui-error-d code { display: block; white-space: pre-wrap; word-break: break-word; margin-top: 6px; }
.ui-sync { font-family: var(--sans); font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.ui-sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.ui-sync.is-local i { background: #3e9b52; }
.ui-more { margin-top: 4px; }

/* ornate initial */
.oi { position: relative; display: inline-block; width: var(--oi, 3em); height: var(--oi, 3em); vertical-align: top; color: var(--gilt); text-indent: 0; font-style: normal; flex: none; }
.oi .oi-f { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.oi .oi-l { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; font-style: normal;
  color: var(--rubric); font-size: calc(var(--oi, 3em) * .66); line-height: 1; padding-top: .07em; letter-spacing: 0; }
.ui-oi-wrap { display: inline-block; line-height: 0; --oi: 48px; }
.ui-oi-wrap .oi { --oi: inherit; width: var(--oi); height: var(--oi); }
.ui-text .oi { float: left; --oi: calc((var(--lh) * 3 - .5) * 1em); margin: .3em .45em 0 0; }

/* ------------------------------------------------------------------ shared annotation classes (reader, catechism, Fathers, notebooks) */
mark { color: inherit; background: transparent; border-radius: 2px; padding: .02em 0; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hl-yellow { background: var(--hl-yellow); } .hl-green { background: var(--hl-green); } .hl-blue { background: var(--hl-blue); } .hl-rose { background: var(--hl-rose); } .hl-violet { background: var(--hl-violet); }
.ul { text-decoration-line: underline; text-decoration-thickness: .09em; text-underline-offset: .18em; text-decoration-skip-ink: auto; }
.ul-red { text-decoration-color: var(--ul-red); } .ul-gold { text-decoration-color: var(--ul-gold); } .ul-blue { text-decoration-color: var(--ul-blue); }
.ul-double { text-decoration-style: double; } .ul-wavy { text-decoration-style: wavy; text-decoration-thickness: .06em; } .ul-dotted { text-decoration-style: dotted; }
.mk { font-family: var(--sans); font-size: .56em; vertical-align: .6em; line-height: 0; cursor: pointer; user-select: none; -webkit-user-select: none; margin: 0 .1em; padding: 0 .25em; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); font-weight: 700; white-space: nowrap; }
.mk.x { color: var(--gold); }
.cfn { color: var(--rubric); font-size: .6em; vertical-align: .62em; line-height: 0; cursor: pointer; padding: 0 .1em; font-family: var(--sans); font-weight: 700; user-select: none; -webkit-user-select: none; }
@keyframes ui-flash { 0%, 40% { background: color-mix(in srgb, var(--gold-2) 38%, transparent); } 100% { background: transparent; } }
.ui-flash { animation: ui-flash 2.4s ease-out; border-radius: 3px; }

/* selection toolbar */
.nx-seltool { position: fixed; z-index: var(--z-sel); display: none; gap: 4px; align-items: center; padding: 6px; background: var(--ink); color: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  font-family: var(--sans); transform: translate(-50%, -100%); max-width: calc(100vw - 16px); width: max-content; flex-wrap: wrap; justify-content: center; }
.nx-seltool .ui-sw { width: 26px; height: 26px; border-color: var(--ink); }
.nx-st-b { border: 0; background: transparent; color: var(--surface); font-size: 13px; font-weight: 650; padding: 6px 8px; border-radius: 9px; cursor: pointer; }
.nx-st-b:hover { background: rgba(255, 255, 255, .12); }
.nx-st-div { width: 1px; height: 22px; background: rgba(255, 255, 255, .2); margin: 0 2px; }
.nx-selrow { flex-basis: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; border-top: 1px solid rgba(255, 255, 255, .18); padding-top: 4px; margin-top: 2px; }

/* ------------------------------------------------------------------ layers: sheets, dialogs, palette, toast */
.ui-layer { position: fixed; inset: 0; z-index: var(--z-layer); pointer-events: none; }
.ui-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .2s; pointer-events: auto; }
.ui-layer.on .ui-scrim { opacity: 1; }
.ui-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh; background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg);
  transform: translateY(102%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); pointer-events: auto; outline: none; min-width: 0; }
.ui-layer.on .ui-sheet { transform: none; }
.ui-grab { width: 42px; height: 5px; border-radius: 3px; background: var(--border-2); margin: 9px auto 2px; flex: none; }
.ui-shead { display: flex; align-items: center; gap: 8px; padding: 6px 16px 10px; border-bottom: 1px solid var(--border); flex: none; }
.ui-stitle { flex: 1; margin: 0; font-family: var(--display); font-size: 25px; font-weight: 600; line-height: 1.15; min-width: 0; overflow-wrap: anywhere; }
.ui-x { border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; flex: none; color: var(--ink-2); display: grid; place-items: center; padding: 0; }
.ui-sbody { overflow-y: auto; padding: 14px 16px 22px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; min-height: 0; flex: 1; }
.ui-sfoot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 10px 16px 14px; border-top: 1px solid var(--border); flex: none; }
.ui-sfoot .ui-left { margin-right: auto; }
@media (min-width: 700px) {
  .ui-sheet.is-center { left: 50%; right: auto; bottom: auto; top: 50%; width: min(720px, 92vw); max-height: 82vh; border-radius: 18px; transform: translate(-50%, -46%); opacity: 0; transition: transform .2s, opacity .2s; }
  .ui-layer.on .ui-sheet.is-center { transform: translate(-50%, -50%); opacity: 1; }
  .ui-sheet.is-center .ui-grab { display: none; }
  .ui-confirm.is-center { width: min(440px, 92vw); }
}
@media (min-width: 1000px) {
  .ui-sheet-layer.is-side .ui-scrim { display: none; }
  /* the side panel sits under the header, so the header's search, Aa and tabs stay usable while it is open */
  .ui-sheet.is-side { left: auto; top: var(--nxh, 0px); width: 420px; max-height: none; border-radius: 0; transform: translateX(102%); border-left: 1px solid var(--border); border-top: 1px solid var(--border); }
  .ui-layer.on .ui-sheet.is-side { transform: none; }
  .ui-sheet.is-side .ui-grab { display: none; }
}
.ui-confirm-msg { margin: 0; font-size: 17px; }
.ui-toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 12px;
  font-family: var(--sans); font-size: 14px; z-index: var(--z-toast); box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .2s; pointer-events: none; display: flex; gap: 12px; align-items: center; max-width: calc(100vw - 32px); }
.ui-toast.on { opacity: 1; pointer-events: auto; }
.ui-toast button { border: 0; background: none; color: var(--gold-2); font-weight: 700; cursor: pointer; }
.ui-sugg { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ui-sugg li > * { display: block; width: 100%; text-align: left; border: 0; background: var(--surface); padding: 9px 12px; font-size: 16.5px; border-top: 1px solid var(--border); }
.ui-sugg li:first-child > * { border-top: 0; }
.ui-sugg li button { cursor: pointer; }
.ui-sugg li button:hover, .ui-sugg li button.is-on { background: var(--surface-2); }
.ui-sugg b { color: var(--rubric); font-variant: small-caps; margin-right: 6px; }

/* settings */
.ui-set { display: grid; gap: 18px; }
.ui-setgrp h4 { margin: 0 0 8px; font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ui-sizes { display: flex; align-items: center; gap: 10px; }
.ui-sizes input { flex: 1; accent-color: var(--rubric); min-width: 0; }
.ui-sizes output { font: 12px var(--sans); min-width: 3.5em; text-align: right; }
.ui-set-sample { font-size: var(--fs); line-height: var(--lh); margin: 8px 0 0; }
.ui-set-sync { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-family: var(--sans); font-size: 13px; }

/* palette */
.nx-pbox { position: absolute; left: 50%; top: 9vh; transform: translateX(-50%); width: min(700px, calc(100vw - 32px)); max-height: 80vh; display: flex; flex-direction: column; pointer-events: auto;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
@media (max-width: 699px) { .nx-pbox { left: 0; top: 0; transform: none; width: 100%; max-height: none; height: 100%; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); } }
.nx-prow { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.nx-pico { line-height: 0; color: var(--muted); }
.nx-pinp { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 19px; color: var(--ink); padding: 6px 2px; outline: none; }
.nx-pinp::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.nx-pesc { border: 0; background: var(--surface-2); color: var(--ink-2); font: 600 12.5px var(--sans); border-radius: 8px; padding: 6px 10px; cursor: pointer; flex: none; }
.nx-pres { overflow-y: auto; padding: 4px 0 10px; overscroll-behavior: contain; flex: 1; min-height: 0; }
.nx-pres.is-hidden { display: none; }
.nx-phint { font: 11.5px var(--sans); color: var(--muted); padding: 8px 14px; border-top: 1px solid var(--border); }
@media (max-width: 699px) { .nx-phint { display: none; } }
.nx-rh { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 18px 3px; font: 700 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.nx-rh a { letter-spacing: 0; text-transform: none; font-weight: 600; font-size: 12.5px; color: var(--link); text-decoration: none; }
.nx-r { padding: 1px 8px; }
.nx-go { display: block; padding: 7px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.nx-go:hover, .nx-go.is-act { background: var(--surface-2); }
.nx-go.is-act { box-shadow: inset 3px 0 0 var(--rubric); }
.nx-rt { display: flex; align-items: center; gap: 8px; font-size: 17.5px; font-weight: 600; line-height: 1.25; min-width: 0; }
.nx-rtt { min-width: 0; overflow-wrap: anywhere; }
.nx-rt b { font-weight: 700; color: var(--rubric); }
.nx-rs { display: block; color: var(--ink-2); font-size: 15px; line-height: 1.35; margin-top: 1px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nx-rs em { font-style: normal; background: var(--hl-yellow); border-radius: 2px; }
.nx-tag { font: 600 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--border-2); border-radius: var(--r-pill); padding: 1px 7px; margin-left: auto; white-space: nowrap; }
.nx-si { line-height: 0; color: var(--muted); }
.nx-acts { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 10px 8px; }
.nx-act { font: 600 12.5px var(--sans); border: 1px solid var(--border-2); background: var(--surface); color: var(--ink); border-radius: var(--r-pill); padding: 4px 11px; cursor: pointer; text-decoration: none; line-height: 1.4; }
.nx-act:hover { border-color: var(--gold-2); background: var(--surface-2); }
.nx-rwords .nx-rt { font-weight: 500; }

/* passage picker */
.nx-picker .ui-sbody { padding-top: 10px; }
.nx-pick-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.nx-pick-top .ui-field { flex: 1 1 14rem; font-size: 16px; padding: 8px 12px; }
.nx-pick-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.nx-pick-mod { font-size: 15px; font-style: italic; }
.nx-pick-vt { font: 13px var(--sans); color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.nx-pick-vt input { accent-color: var(--rubric); }
.nx-testament { margin-top: 18px; }
.nx-testament:first-child { margin-top: 4px; }
.nx-testament-h { font-family: var(--display); font-weight: 600; font-size: 28px; margin: 0; text-align: center; }
.nx-sect { margin-top: 12px; }
.nx-sect-h { font-family: var(--sans); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 700; }
.nx-bookgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.nx-book { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 9px 12px; cursor: pointer; min-width: 0; }
.nx-book:hover { border-color: var(--gold-2); }
.nx-book b { display: block; font-size: 17.5px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.nx-book span { display: block; font-family: var(--sans); font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-book.is-cur { border-color: var(--rubric); box-shadow: inset 0 0 0 1px var(--rubric); }
.nx-book.is-dc b::after { content: " †"; color: var(--gold); font-size: .7em; vertical-align: .3em; }
@media (max-width: 520px) { .nx-bookgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; } .nx-book { padding: 8px 8px; } .nx-book b { font-size: 15.5px; } .nx-book span { font-size: 10.5px; } }
.nx-chgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 7px; margin-top: 12px; }
.nx-ch { display: grid; place-items: center; height: 46px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 18px; font-variant-numeric: oldstyle-nums; cursor: pointer; padding: 0; }
.nx-ch:hover { border-color: var(--gold-2); }
.nx-ch.is-cur { background: var(--rubric); color: var(--on-rubric); border-color: var(--rubric); }
@media print { .nx-head, .nx-seltool, .ui-layer, .ui-toast { display: none !important; } body { background: #fff; color: #000; } }
@media (min-width: 700px) {
  .ui-sheet.is-full { left: 50%; right: auto; top: 4vh; bottom: 4vh; width: min(1100px, 94vw); max-height: none; border-radius: 18px; transform: translate(-50%, 3%); opacity: 0; transition: transform .2s, opacity .2s; }
  .ui-layer.on .ui-sheet.is-full { transform: translate(-50%, 0); opacity: 1; }
  .ui-sheet.is-full .ui-grab { display: none; }
}
