/* Layer 1 reader — theme tokens (Web Design spec). Only colors change between themes. */
:root {
  color-scheme: light;
  --bg: #F7F4EF;
  --text: #1C1917;
  --muted: #6B645F; /* 5.3:1 on --bg (AA for small text) */
  --border: #E7E5E4;
  --select: rgba(196, 164, 132, 0.22);
  --hl: rgba(244, 196, 48, 0.34);   /* personal highlight (amber) — warmer/yellower than --select */
  --hl-mark: #C8930F;
  --serif: "Trehand Greek", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
html.dark {
  color-scheme: dark;
  --bg: #141210;
  --text: #E7E5E4;
  --muted: #A8A29E;
  --border: #292524;
  --select: rgba(214, 168, 118, 0.30); /* warmer + slightly stronger so selection reads on charcoal */
  --hl: rgba(240, 176, 40, 0.26);
  --hl-mark: #E3B341;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--serif);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }

/* Thin chrome: same bg as the page */
.chrome {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
}
.chrome-inner {
  max-width: 42rem; margin: 0 auto; padding: 0.25rem 1.25rem;
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 1rem;
}
/* Primary label: book picker, top left. The book name is the visible face ("Genesis ▾"); a transparent
   native select sits on top (native list on phones, full keyboard support, one focus ring on the face). */
.book-pick { position: relative; flex: 0 0 auto; display: flex; margin-left: -0.35rem; border-radius: 8px; }
.book-face {
  position: relative; display: inline-flex; align-items: center; min-height: 44px;
  font: 600 1.05rem/1.2 var(--sans); color: var(--text); white-space: nowrap;
  padding: 0 1.4rem 0 0.35rem; border-radius: 8px;
}
.book-face .caret { right: 0.55rem; }
.bf-short { display: none; }
.book-pick:hover .book-face { background: var(--select); }
.book-pick:focus-within .book-face { outline: 2px solid var(--text); outline-offset: 0; }
/* Shared: transparent native select laid over a visible face (book in chrome, chapter number in title) */
.pick-select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 44px; margin: 0; padding: 0;
  opacity: 0; cursor: pointer; font: 16px var(--sans); border: 0; appearance: none; -webkit-appearance: none; }
.pick-select option, .pick-select optgroup { color: initial; }
.caret { position: absolute; top: 50%; width: 0.38rem; height: 0.38rem; margin-top: -0.3rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); pointer-events: none; }
/* Demoted product name */
.brand {
  font-size: 0.85rem; letter-spacing: 0.01em; text-decoration: none; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto;
}
.brand:hover { color: var(--text); }
/* 44x44 hit targets */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
  min-width: 44px; height: 44px; padding: 0 0.5rem; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
  font: 500 0.85rem var(--sans);
}
.icon-btn:hover, .icon-btn:focus-visible { color: var(--text); background: var(--select); }
.icon-btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; cursor: default; }
.icon-btn svg { width: 22px; height: 22px; flex: 0 0 auto; }
/* Before theme.js runs, show only the Auto icon */
#theme-toggle .ic-light, #theme-toggle .ic-dark { display: none; }
.theme-btn { border: 1px solid var(--border); padding: 0 0.7rem 0 0.55rem; min-width: 48px; height: 48px; color: var(--text); }

main { max-width: 42rem; margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }
/* Chapter picker: the large chapter number is the page title and the visible face of the chapter select. */
.chapter-pick { position: relative; width: max-content; max-width: 100%; margin: 0.4rem auto 2.25rem; border-radius: 10px; }
h1.chapter-title {
  position: relative; font-weight: 400; font-size: 3rem; line-height: 1; text-align: center;
  margin: 0; padding: 0.3rem 1.3rem; border-radius: 10px; font-variant-numeric: lining-nums;
}
h1.chapter-title .caret { right: 0.4rem; width: 0.42rem; height: 0.42rem; color: var(--muted); }
.chapter-pick:hover h1.chapter-title { background: var(--select); }
.chapter-pick:hover h1.chapter-title .caret { color: var(--text); }
.chapter-pick:focus-within h1.chapter-title { outline: 2px solid var(--text); outline-offset: 2px; }
.prose { max-width: 65ch; margin: 0 auto; font-size: 1.2rem; line-height: 1.75; hyphens: manual; }
.prose p { margin: 0 0 1.1em; }
/* BSB section headings: quiet editorial labels, not loud titles */
.prose h2.section {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
  margin: 2.2em 0 0.9em;
}
.prose h2.section:first-child { margin-top: 0; }
/* Poetry / OT quotations */
.prose p.q1, .prose p.q2 { margin: 0; padding-left: 1.5em; text-indent: -0.75em; }
.prose p.q2 { padding-left: 2.5em; }
.prose p.q1 + p:not(.q1):not(.q2), .prose p.q2 + p:not(.q1):not(.q2) { margin-top: 1.1em; }
.prose p.pc { text-align: center; }
.prose p.m { text-indent: 0; }
.stanza-break { height: 0.6em; }
/* Full-Bible block types (BSB USFM): sub-headings, Psalm book divisions, acrostic letters,
   superscriptions, genealogy lists, refrains. All quiet; same palette as the rest of the reader. */
.prose h3.section { font-family: var(--sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); margin: 1.6em 0 0.7em; }
.prose h2.section.major { text-align: center; letter-spacing: 0.16em; margin-bottom: 0.2em; }
.prose p.range { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); text-align: center; margin: 0 0 2em; }
.prose h3.section.acrostic { text-transform: none; letter-spacing: 0.06em; margin: 1.8em 0 0.2em; }
.prose h3.section.acrostic + h3.section.acrostic { margin-top: 0; }
/* Hebrew acrostic letter (Psalm 119 א above ALEPH): large serif in full ink so it pairs with the
   English name; stays left-aligned over it despite dir=rtl. */
.prose h3.section.acrostic.heb { font-family: "SBL Hebrew", "Noto Serif Hebrew", "Taamey Frank CLM", "Times New Roman", var(--serif);
  font-size: 1.75rem; font-weight: 400; line-height: 1.15; letter-spacing: 0; color: var(--text);
  text-align: left; margin-bottom: 0.1em; }
.prose h3.section.acrostic.heb + h3.section.acrostic { color: var(--text); opacity: 0.82; font-weight: 650; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p.d { font-style: italic; color: var(--muted); font-size: 0.95em; }
.prose p.li1, .prose p.li2 { margin: 0; padding-left: 1.5em; text-indent: -1.5em; }
.prose p.li2 { padding-left: 2.5em; text-indent: -1em; }
.prose p.li1 + p:not(.li1):not(.li2), .prose p.li2 + p:not(.li1):not(.li2) { margin-top: 1.1em; }
.prose p.qr { margin: 0; text-align: right; font-style: italic; }
.prose p.pmo { text-indent: 0; }

/* Verses: quiet until selected. data-ref is the hook for later study layers. */
.v {
  cursor: pointer;
  transition: background-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
/* Keep deep-linked verses clear of the sticky header (~53px) */
.v[id] { scroll-margin-top: 80px; scroll-margin-bottom: 24px; }
.v sup {
  font-family: var(--sans); font-size: 0.6em; color: var(--muted);
  margin-right: 0.2em; vertical-align: 0.55em; line-height: 0;
  user-select: none; font-variant-numeric: tabular-nums;
}
.v.selected { background: var(--select); }
.v.selected sup { color: var(--text); opacity: 1; }
.v:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 2px; }
/* Personal highlight (annotations.js). Distinct from selection; a selected highlighted verse keeps
   the amber and adds the selection tint plus a thin accent underline so selection stays visible. */
.v.hl { background: var(--hl); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.v.hl.selected { background: linear-gradient(var(--select), var(--select)), var(--hl); box-shadow: inset 0 -2px 0 var(--hl-mark); }

.pager {
  display: flex; justify-content: space-between; gap: 1rem;
  border-top: 1px solid var(--border); margin-top: 2.5rem; padding-top: 1.25rem;
  font-family: var(--sans); font-size: 0.95rem;
}
.pager a { text-decoration: none; color: var(--muted); }
.pager a:hover { color: var(--text); }
.pager .disabled { opacity: 0.55; color: var(--muted); }

footer {
  background: var(--bg); border-top: 1px solid var(--border);
  font-family: var(--sans); font-size: 0.8rem; color: var(--muted);
}
footer .inner { max-width: 42rem; margin: 0 auto; padding: 1.25rem; line-height: 1.6; }

@media (max-width: 480px) {
  .chrome-inner { gap: 0.15rem; padding: 0.2rem 0.6rem; }
  .brand { display: none; }
  .book-pick { margin-right: auto; }
  .bf-full { display: none; }
  .bf-short { display: inline; }
  .theme-btn { padding: 0 0.5rem 0 0.4rem; }
  .prose { font-size: 1.125rem; line-height: 1.7; }
  h1.chapter-title { font-size: 2.5rem; }
  main { padding-top: 1.75rem; }
}

/* ───────── Public site (landing, gate, sign-in) ───────── */
:root { --surface: #FFFDF9; --accent: #7A5532; --accent-text: #FFFDF9; --danger: #A12F22; --field-bg: #FFFFFF; --field-border: #CFC8C0; }
html.dark { --surface: #1C1917; --accent: #D6A876; --accent-text: #141210; --danger: #F2A08F; --field-bg: #24201D; --field-border: #57504A; }
/* Public site small text: stronger muted (light 6.4:1 on bg / 6.9:1 on surface; dark 8.8:1 / 8.3:1). */
.site { --muted: #5E5853; }
html.dark .site { --muted: #B8B1AB; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.site { font-family: var(--sans); }
.wide { max-width: 60rem; margin-left: auto; margin-right: auto; padding-left: 1.25rem; padding-right: 1.25rem; }
.chrome-inner.wide { max-width: 60rem; }
.site-brand { font-weight: 650; color: var(--text); text-decoration: none; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.site-brand-sub { font-weight: 400; color: var(--muted); }
/* Auth-dependent UI: signed-out shown until Clerk says otherwise */
.when-in { display: none !important; }
html[data-auth="in"] .when-in { display: inline-flex !important; }
html[data-auth="in"] .when-out { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 0 1rem; border-radius: 10px; font: 600 0.95rem var(--sans); text-decoration: none;
  cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--select); }
.btn-lg { min-height: 48px; padding: 0 1.3rem; font-size: 1rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 0.75rem; }

.site-main { max-width: none; padding: 0 0 3rem; }
.site-main.narrow { max-width: 40rem; margin: 0 auto; padding: 3rem 1.25rem; }
.eyebrow { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 0 0 0.75rem; }
.hero { padding-top: 4.5rem; padding-bottom: 3.5rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; align-items: center; }
.lede-2 { margin-top: 0.75rem; color: var(--muted); }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.1rem, 5.5vw, 3.4rem); line-height: 1.12; margin: 0 0 1.25rem; max-width: 20ch; }
.hero-sub { font-family: var(--serif); font-style: italic; font-size: 1.3rem; line-height: 1.4; color: var(--muted); margin: -0.5rem 0 1rem; }
.lede { font-family: var(--serif); font-size: 1.2rem; line-height: 1.65; max-width: 38rem; margin: 0; }
.trust { color: var(--muted); font-size: 1rem; margin: 0.75rem 0 0; }
.section-h { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; margin: 0 0 1.25rem; }
.how, .pilot, .support { padding-top: 2.5rem; padding-bottom: 2.5rem; border-top: 1px solid var(--border); }
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.25rem; }
.card h3 { font-family: var(--serif); font-weight: 500; font-size: 1.25rem; margin: 0.5rem 0 0.4rem; }
.card p { margin: 0; color: var(--muted); line-height: 1.55; }
.step { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 50%; background: var(--select); font-weight: 600; font-size: 0.85rem; }
.layers { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
.layers li { display: flex; gap: 1rem; align-items: baseline; padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.layers li:last-child { border-bottom: 0; }
.layers p { margin: 0.2rem 0 0; color: var(--muted); line-height: 1.5; }
.tag { flex: 0 0 auto; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.2rem 0.5rem; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); min-width: 3.4rem; text-align: center; }
.tag-live { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.join { padding-top: 3rem; padding-bottom: 3rem; border-top: 1px solid var(--border); scroll-margin-top: 64px; }
.join h2 { font-family: var(--serif); font-weight: 400; font-size: 2rem; margin: 0 0 0.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.join-form { max-width: 38rem; margin-top: 1.5rem; display: grid; gap: 1rem; }
.seg { border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 0.25rem 0.5rem; border-radius: 9px; font-size: 0.9rem; color: var(--muted); }
.seg input:checked + span { background: var(--select); color: var(--text); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: grid; gap: 0.35rem; font-size: 0.9rem; align-content: start; }
.field > label { font-weight: 500; }
.req { color: var(--danger); font-weight: 700; margin-left: 0.1em; }
.req-note { margin: 0; font-size: 0.85rem; color: var(--muted); }
.field-err { margin: 0; min-height: 0; font-size: 0.875rem; color: var(--danger); font-weight: 500; }
.field-err:empty { display: none; }
.field.invalid input { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.field.invalid input:focus { outline-color: var(--danger); }
.field em { color: var(--muted); font-style: normal; }
.field input, .field textarea {
  font: 1rem var(--sans); color: var(--text); background: var(--field-bg);
  border: 1px solid var(--field-border); border-radius: 10px; padding: 0.7rem 0.8rem; min-height: 44px; width: 100%;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
/* Honeypot: off-screen, zero-size, aria-hidden, untabbable; bots still fill it. */
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.form-status { margin: 0; min-height: 1.4em; color: var(--muted); }
.join-form .btn { justify-self: start; }
.join-done { max-width: 38rem; margin-top: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.25rem 1.5rem; }
.join-done h3 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; margin: 0 0 0.5rem; }
.support-row { display: flex; gap: 1.5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.support-row p { margin: 0; max-width: 34rem; color: var(--muted); line-height: 1.55; }
.support-links { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.soon { font-weight: 400; color: var(--muted); margin-left: 0.3em; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }
.site-footer .inner { padding-top: 1.5rem; padding-bottom: 2rem; line-height: 1.6; }
.site-footer p { margin: 0 0 0.4rem; }
.site-footer .fine { font-size: 0.85rem; }
.site-footer a, footer a { color: var(--muted); }
.site-footer a:hover, footer a:hover { color: var(--text); }

.prose-page h1, .gate h1, .auth-wrap h1 { font-family: var(--serif); font-weight: 400; font-size: 2.2rem; line-height: 1.15; margin: 0 0 1rem; }
.prose-page p, .gate p { font-family: var(--serif); font-size: 1.15rem; line-height: 1.65; }
.gate > div { display: none; }
.gate[data-state="refresh"] .gate-refresh, .gate[data-state="out"] .gate-out,
.gate[data-state="pending"] .gate-pending, .gate[data-state="error"] .gate-error { display: block; }
.site-main.narrow.centered { min-height: calc(100vh - 13rem); min-height: calc(100svh - 13rem); display: flex; flex-direction: column; justify-content: center; }
.site-main.narrow.centered > section { width: 100%; }
.auth-wrap { display: grid; justify-items: center; gap: 1rem; text-align: center; }
.clerk-mount { min-height: 300px; display: flex; justify-content: center; }

/* Decorative hero mock (aria-hidden): wide screens only. */
.hero-mock { display: none; margin: 0; }
@media (min-width: 1000px) {
  .hero.wide { max-width: 76rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .hero-mock { display: block; }
}
.mock-window { background: var(--bg); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(28,25,23,.05), 0 18px 40px -18px rgba(28,25,23,.25); user-select: none; pointer-events: none; }
html.dark .mock-window { box-shadow: 0 18px 40px -18px rgba(0,0,0,.7); }
.mock-bar { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); font: 600 0.85rem var(--sans); }
.mock-dots { display: flex; gap: 6px; } .mock-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.mock-body { display: grid; grid-template-columns: 1.35fr 1fr; min-height: 21rem; }
.mock-read { padding: 1.25rem 1.25rem 1rem 1.5rem; font-family: var(--serif); }
.mock-book { font: 0.62rem var(--sans); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); text-align: center; margin: 0; }
.mock-num { font-size: 2rem; text-align: center; margin: 0.1rem 0 0.75rem; line-height: 1; }
.mock-sec { font: 600 0.6rem var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 0.5rem; }
.mock-prose { font-size: 0.92rem; line-height: 1.7; margin: 0; }
.mock-v sup { font: 0.6em var(--sans); color: var(--muted); margin-right: 0.15em; }
.mock-sel { background: var(--select); box-shadow: 0 0 0 2px var(--select); border-radius: 2px; }
.mock-panel { background: var(--surface); border-left: 1px solid var(--border); padding: 1rem; font-family: var(--sans); }
.mock-ref { font: 400 1.05rem var(--serif); margin: 0 0 0.5rem; }
.mock-tabs { display: flex; gap: 0.6rem; font-size: 0.68rem; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 0.45rem; margin: 0 0 0.75rem; }
.mock-tabs .on { color: var(--text); font-weight: 600; box-shadow: 0 0.5rem 0 -0.35rem var(--accent); }
.mock-word { display: grid; gap: 0.1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); }
.mock-gk { font: 1.05rem var(--greek, var(--serif)); }
.mock-tr { font-size: 0.68rem; color: var(--muted); }
.mock-gl { font-size: 0.75rem; line-height: 1.4; }
.mock-line { height: 0.45rem; border-radius: 4px; background: var(--border); margin-top: 0.8rem; }
.mock-line.short { width: 60%; margin-top: 0.45rem; }
.mock-cap { font-size: 0.85rem; color: var(--text); text-align: center; margin-top: 0.75rem; }
.mock-cap strong { font-weight: 600; }
.mock-sample { display: inline-block; vertical-align: 0.2em; margin-left: 0.4rem; padding: 0.1rem 0.45rem; border: 1px dashed var(--accent); border-radius: 999px;
  font: 600 0.6rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }
.mock-note { font-size: 0.68rem; line-height: 1.35; color: var(--muted); font-style: italic; margin: -0.3rem 0 0.4rem; }
.mock-word { opacity: 0.85; }

@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .hero { padding-top: 2.5rem; }
}
@media (max-width: 480px) {
  .site-brand-sub { display: none; }
  .site-chrome .btn { padding: 0 0.7rem; font-size: 0.875rem; }
  .site-chrome .btn-ghost.when-out { display: none !important; } /* Sign in stays in hero */
  .site-chrome .btn-ghost.when-in { display: none !important; } /* Sign out stays in footer */
  .site-chrome .chrome-inner { gap: 0.4rem; padding: 0.25rem 0.75rem; }
  .site-chrome .theme-label { display: none; }
  .site-chrome .theme-btn { padding: 0; }
  .seg { grid-template-columns: 1fr; }
  .seg span { justify-content: flex-start; padding: 0.25rem 0.85rem; }
  .cta-row .btn-lg { flex: 1 1 auto; }
  .support-links .btn { flex: 1 1 auto; }
  .join-form .btn { justify-self: stretch; }
  .hero h1 br { display: none; }
}
.gate .eyebrow, .prose-page .eyebrow { font-family: var(--sans); font-size: 0.78rem; line-height: 1.4; }

/* ───────── Admin (/admin) ───────── */
.site-main.wide.admin-main { padding: 2.5rem 1.25rem 3.5rem; }
.admin h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.65rem, 5vw, 2.2rem); margin: 0; line-height: 1.15; }
.admin h2 { font-family: var(--serif); font-weight: 500; font-size: 1.25rem; margin: 0 0 0.65rem; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1rem; flex-wrap: wrap; }
.admin-status { min-height: 1.4em; margin: 0.85rem 0 1.25rem; color: var(--muted); }
.admin-status.ok { color: var(--text); }
.admin-status.err { color: var(--danger); font-weight: 500; }
.admin-missing, .admin-clerk { display: none; }
.admin[data-config="missing"] .admin-missing { display: block; }
.admin[data-config="ok"] .admin-clerk { display: block; }
.admin-missing p { line-height: 1.55; color: var(--muted); }
.admin-missing code { font-size: 0.9em; }
.admin-sec { margin: 2.25rem 0; }
.admin-sec > .muted.small { margin: 0 0 0.85rem; line-height: 1.5; }
.admin-sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem 1rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.admin-sec select { font: inherit; color: var(--text); background: var(--field-bg); border: 1px solid var(--field-border); border-radius: 8px; padding: 0.4rem 0.55rem; min-height: 40px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th { text-align: left; font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .em { overflow-wrap: anywhere; word-break: normal; }
.admin-table .note { color: var(--muted); max-width: 28rem; white-space: pre-wrap; }
.admin-table .acts { text-align: right; white-space: nowrap; }
.admin-table .acts .btn + .btn { margin-left: 0.4rem; }
.admin-table .meta { color: var(--muted); font-size: 0.88rem; }
.btn-sm { min-height: 36px; padding: 0 0.75rem; font-size: 0.85rem; border-radius: 8px; }
.pill { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.55rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.pill-pending { background: var(--select); color: var(--text); border-color: transparent; }
.pill-invited { color: var(--accent); border-color: var(--accent); }
.pill-joined, .pill-admin { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.pill-rejected { color: var(--danger); border-color: var(--danger); }
@media (max-width: 640px) {
  .site-main.wide.admin-main { padding: 1.75rem 1rem 3rem; }
  .admin-sec { margin: 1.75rem 0; }
  .admin-head { align-items: center; }
  .table-wrap { overflow: visible; border: 0; border-radius: 0; background: transparent; }
  .admin-table, .admin-table tbody { display: block; width: 100%; }
  .admin-table thead { display: none; }
  .admin-table tr {
    display: grid; gap: 0.45rem;
    padding: 1rem 1.05rem; margin: 0 0 0.75rem;
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  }
  .admin-table tr:last-child { margin-bottom: 0; }
  .admin-table tr:last-child td { border-bottom: 0; }
  .admin-table td {
    display: grid; grid-template-columns: minmax(5.5rem, 32%) 1fr;
    gap: 0.5rem 0.75rem; align-items: start;
    padding: 0; border: 0; font-size: 0.95rem; line-height: 1.4;
  }
  .admin-table td::before {
    content: attr(data-label);
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--muted); padding-top: 0.15rem;
  }
  .admin-table td.em {
    grid-template-columns: 1fr; font-weight: 500; overflow-wrap: anywhere;
  }
  .admin-table td.em::before { display: none; }
  .admin-table td.em .pill { margin-left: 0.35rem; vertical-align: 0.1em; }
  .admin-table td.acts {
    grid-template-columns: 1fr; text-align: left; white-space: normal;
    padding-top: 0.35rem; margin-top: 0.15rem; border-top: 1px solid var(--border);
  }
  .admin-table td.acts::before { display: none; }
  .admin-table td.acts .btn { margin: 0.25rem 0.45rem 0 0 !important; }
  .admin-table td[colspan] {
    display: block; color: var(--muted); text-align: center; padding: 0.35rem 0;
  }
  .admin-table td[colspan]::before { display: none; }
  .admin-table tr:has(td[colspan]) {
    padding: 1.1rem 1rem; text-align: center;
  }
}

/* ───────── Layer 2 · Study panel (Slice A shell) ───────── */
/* Self-hosted polytonic Greek (Noto Serif subset, SIL OFL 1.1, licence in font metadata).
   unicode-range: only Greek/diacritics use it; Latin keeps the book serif. CSP: font-src via default-src 'self'. */
@font-face {
  font-family: "Trehand Greek"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/noto-serif-greek.woff2?v=b4888d4326") format("woff2");
  unicode-range: U+0300-036F, U+0370-03FF, U+1F00-1FFF;
}
/* Self-hosted pointed Hebrew (Noto Serif Hebrew subset, SIL OFL 1.1, licence in font metadata) for OT
   study words. unicode-range keeps it to Hebrew code points. */
@font-face {
  font-family: "Trehand Hebrew"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/noto-serif-hebrew.woff2?v=b4888d4326") format("woff2");
  unicode-range: U+0590-05FF, U+FB1D-FB4F;
}
:root { --hebrew: "Trehand Hebrew", "SBL Hebrew", "Noto Serif Hebrew", "Taamey Frank CLM", "Times New Roman", var(--serif); }
:root { --greek: var(--serif); } /* --serif leads with "Trehand Greek" (Greek code points only) */
:root { --panel-w: clamp(22rem, 30vw, 28rem); --chrome-h: 53px; --sub: #57504B; /* ~7.5:1 on --surface */ }
html.dark { --sub: #BDB7B2; /* ~8.5:1 on dark --surface */ }
.study {
  position: fixed; z-index: 20; display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); font-family: var(--sans);
  border: 1px solid var(--border);
}
.study[hidden] { display: none; }
.study-head { flex: 0 0 auto; padding: 0.75rem 1.25rem 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.study-grab { display: none; }
.study-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.study-title { font: 400 1.6rem/1.2 var(--serif); margin: 0; }
.study-close { margin-right: -0.5rem; }
.study-verse {
  font: 1rem/1.55 var(--serif); color: var(--muted); margin: 0.35rem 0 0.75rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.study-tabs { display: flex; gap: 0.15rem; margin: 0 -0.35rem; overflow-x: auto; scrollbar-width: none; }
.study-tabs::-webkit-scrollbar { display: none; }
.study-tabs [role="tab"] {
  flex: 1 1 0; min-width: min-content; display: grid; justify-items: start; align-content: start; gap: 0.05rem; min-height: 48px;
  padding: 0.45rem 0.35rem 0.55rem; border: 0; border-radius: 8px 8px 0 0; background: transparent;
  color: var(--muted); font: inherit; text-align: left; cursor: pointer;
  box-shadow: inset 0 -2px 0 transparent;
}
.study-tabs [role="tab"]:hover { color: var(--text); background: var(--select); }
.study-tabs [role="tab"][aria-selected="true"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.study-tabs [role="tab"]:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
.st-label { font-weight: 600; font-size: 0.92rem; }
/* Subtitle wraps to two lines rather than clipping in narrow equal-width tabs (~1000px side panel). */
.st-sub { font-size: 0.75rem; line-height: 1.2; color: var(--sub); max-width: 100%; overflow-wrap: break-word; hyphens: auto; }
.study-tabs [role="tab"][aria-selected="true"] .st-sub, .study-tabs [role="tab"]:hover .st-sub { color: var(--text); }
/* Labels never wrap, so the content dot stays beside the label (not on its own line). */
.st-label { display: inline-flex; align-items: center; white-space: nowrap; }
.study-scroll { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 1.25rem 1.25rem 2rem; }
.sp-h { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 0.75rem; }
.sp-h span { font-weight: 400; text-transform: none; letter-spacing: 0; }
.sp-empty { font: 1.05rem/1.6 var(--serif); margin: 0 0 0.75rem; padding: 1rem 1.1rem; border: 1px dashed var(--field-border); border-radius: 12px; }
.sp-hint { font-size: 0.85rem; line-height: 1.5; color: var(--muted); margin: 0.25rem 0 0; }
.study-close:focus-visible { outline: 2px solid var(--text); outline-offset: 0; }
/* Layer 2 Slice B: study content (Words / Context / Quotes / Teachings). */
.study[data-state="loading"] .sp-empty { opacity: 0.55; }
.sp-empty[hidden] { display: none; }
.study-tabs [role="tab"].has-content .st-label::after { content: ""; flex: 0 0 auto; width: 6px; height: 6px; margin-left: 0.35em; border-radius: 50%; background: var(--accent); }
.sp-body { font-family: var(--sans); }
.sp-body a { color: inherit; text-underline-offset: 2px; }
.sp-body summary { cursor: pointer; border-radius: 6px; }
.sp-body summary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.sp-foot { font-size: 0.8rem; line-height: 1.5; color: var(--sub); margin: 1.25rem 0 0; }
.sp-foot a { color: var(--sub); }
/* Words */
.sp-words { list-style: none; margin: 0; padding: 0; }
.w { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.w:first-child { padding-top: 0; }
.w-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.w-gk { font: 1.3rem/1.3 var(--greek); }
.study [lang="grc"] { font-family: var(--greek); }
/* Hebrew (OT packs): pointed text needs a little more size and line-height so vowel points and
   dagesh stay legible; isolated RTL inside the LTR row. */
.study [lang="he"] { font-family: var(--hebrew); }
.w-gk.w-heb { font: 1.5rem/1.55 var(--hebrew); unicode-bidi: isolate; }
.w-heb-lemma { font-size: 1.12em; unicode-bidi: isolate; }
.w-gl { font-size: 0.95rem; text-align: right; }
.w-gl-none { color: var(--sub); font-style: italic; font-size: 0.82rem; }
.w-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-top: 0.1rem; }
.w-tr { font-size: 0.8rem; color: var(--sub); min-width: 0; }
.w-note { font: 0.98rem/1.55 var(--serif); margin: 0.45rem 0 0; padding: 0.5rem 0.7rem; background: var(--select); border-radius: 8px; }
/* Compact morphology toggle: sits at the end of the transliteration line; no row of its own while closed. */
.w-more-btn {
  flex: 0 0 auto; margin: -0.35rem -0.4rem -0.35rem 0; padding: 0.35rem 0.4rem; min-height: 28px;
  border: 0; border-radius: 6px; background: transparent; color: var(--sub);
  font: 500 0.75rem var(--sans); cursor: pointer; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px;
}
.w-more-btn:hover { color: var(--text); background: var(--select); text-decoration-color: currentColor; }
.w-more-btn:focus-visible { outline: 2px solid var(--text); outline-offset: 0; }
.w-more { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.75rem; margin: 0.35rem 0 0.1rem; font-size: 0.82rem; }
.w-more[hidden] { display: none; }
.w-more dt { color: var(--sub); }
.w-more dd { margin: 0; }
/* Attribution: one short credit line; licence detail behind a quiet disclosure. */
.sp-attr-short { margin: 0; }
.sp-attr-more { margin-top: 0.25rem; }
.sp-attr-more summary { display: inline-block; list-style: none; color: var(--sub); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; padding: 0.15rem 0; }
.sp-attr-more summary::-webkit-details-marker { display: none; }
.sp-attr-more summary:hover { color: var(--text); text-decoration-color: currentColor; }
.sp-attr-more ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.sp-attr-more li { margin: 0.15rem 0; }
.sp-attr-more p { margin: 0.35rem 0 0; }
/* Context */
.sp-summary { font: 1.05rem/1.65 var(--serif); margin: 0 0 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip summary { display: inline-flex; align-items: center; min-height: 36px; padding: 0.25rem 0.8rem; border: 1px solid var(--field-border); border-radius: 999px; font-size: 0.88rem; list-style: none; background: var(--surface); }
.chip summary::-webkit-details-marker { display: none; }
.chip summary:hover { background: var(--select); }
.chip[open] { flex: 1 1 100%; }
.chip[open] summary { background: var(--select); border-color: var(--accent); font-weight: 600; }
.chip p { font: 0.98rem/1.6 var(--serif); margin: 0.5rem 0 0.25rem; padding: 0 0.15rem; }
/* Quotes */
.q-group { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sub); margin: 1.25rem 0 0.4rem; }
.q-group:first-child { margin-top: 0; }
.q-list { list-style: none; margin: 0; padding: 0; }
.q { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.q-head { display: flex; align-items: baseline; gap: 0.5rem; }
.q-ref { font-weight: 600; font-size: 0.92rem; }
/* In-app quote refs (John 2:17 → /psalm/69#v9): warm accent + soft underline so they read as links
   without loud blue. Plain-text refs (span.q-ref) stay ink. Accent ≥4.5:1 on --surface both themes. */
.sp-body a.q-ref { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.sp-body a.q-ref:hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }
.sp-body a.q-ref:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.q-label { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sub); border: 1px solid var(--border); border-radius: 6px; padding: 0.05rem 0.4rem; }
.q-snip { font: 1rem/1.55 var(--serif); margin: 0.3rem 0 0; }
.q-note { font-size: 0.82rem; color: var(--sub); margin: 0.2rem 0 0; }
/* Teachings */
.tc { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 0.85rem 1rem; margin: 0 0 0.75rem; }
.tc-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.4rem; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sub); }
.tc-era { font-weight: 400; }
.tc-era::before { content: "· "; }
.tc-quote { margin: 0; }
.tc-quote p { font: 1.02rem/1.6 var(--serif); margin: 0; }
.tc-cite { font-size: 0.82rem; color: var(--sub); margin: 0.5rem 0 0; }
.tc-cite cite { font-style: italic; }

/* Desktop: side panel right of the chapter; chapter reflows into the remaining space. */
@media (min-width: 1000px) {
  .study {
    top: var(--chrome-h); right: 0; bottom: 0; width: var(--panel-w);
    border-width: 0 0 0 1px; box-shadow: -12px 0 32px -24px rgba(28,25,23,.35);
    animation: study-in-side 160ms ease-out;
  }
  html.dark .study { box-shadow: -12px 0 32px -20px rgba(0,0,0,.8); }
  body.study-open main, body.study-open footer .inner {
    margin-left: max(1.25rem, calc((100% - var(--panel-w) - 42rem) / 2));
    margin-right: calc(var(--panel-w) + max(0rem, (100% - var(--panel-w) - 42rem) / 2));
  }
  body.study-open footer .inner { padding-left: 1.25rem; padding-right: 1.25rem; }
}
/* Narrow / phone: bottom sheet over the chapter with sticky reference + close.
   Snap heights (peek / mid / full) live on :root so main's bottom padding tracks the sheet;
   study-panel.js sets --sheet-h to var(--sheet-<snap>) or to a px value while dragging. */
@media (max-width: 999px) {
  :root {
    --sheet-peek: max(152px, 32vh); --sheet-peek: max(152px, 32svh);
    --sheet-mid: 62vh; --sheet-mid: 62svh;
    --sheet-full: min(92vh, calc(100vh - var(--chrome-h) - 0.5rem));
    --sheet-full: min(92svh, calc(100svh - var(--chrome-h) - 0.5rem));
    --sheet-h: var(--sheet-mid);
  }
  .study {
    left: 0; right: 0; bottom: 0; height: var(--sheet-h); max-height: calc(var(--sheet-full) + 12px);
    border-width: 1px 0 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 32px -16px rgba(28,25,23,.35);
    padding-bottom: env(safe-area-inset-bottom);
    animation: study-in-up 180ms ease-out;
    transition: height 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .study[data-dragging="true"] { transition: none; touch-action: none; user-select: none; -webkit-user-select: none; }
  html.dark .study { box-shadow: 0 -12px 32px -12px rgba(0,0,0,.85); }
  .study-head { border-radius: 18px 18px 0 0; padding-top: 0; }
  /* Full-width >=44px drag strip with the 40x4 pill drawn by ::after. */
  .study-grab {
    display: block; width: auto; min-height: 22px; margin: 0 -1.25rem; padding: 10px 0 8px;
    background: transparent; border: 0; cursor: grab; touch-action: none;
  }
  .study-grab::after { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto; border-radius: 2px; background: var(--field-border); }
  .study-grab:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; border-radius: 18px 18px 0 0; }
  .study[data-dragging="true"] .study-grab { cursor: grabbing; }
  .study-title-row { touch-action: none; }
  /* The title row is the other drag surface; with the grab strip the hit area is ~44px+. */
  .study-title { font-size: 1.35rem; }
  .study-verse { -webkit-line-clamp: 2; font-size: 0.95rem; margin-bottom: 0.5rem; }
  body.study-open main { padding-bottom: calc(var(--sheet-h) + 2rem); transition: padding-bottom 200ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  body.study-dragging main { transition: none; }
}
@media (max-width: 480px) {
  .study-head { padding-left: 1rem; padding-right: 1rem; }
  .study-grab { margin: 0 -1rem; }
  .study-scroll { padding: 1rem 1rem 1.5rem; }
  .study-tabs { gap: 0; }
  .study-tabs [role="tab"] { padding: 0.4rem 0.35rem 0.5rem; }
  .st-label { font-size: 0.88rem; }
  .st-sub { font-size: 0.72rem; line-height: 1.2; }
}
@keyframes study-in-side { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes study-in-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .study { animation: none !important; transition: none !important; } body.study-open main { transition: none !important; } .v { transition: none; } }
[role="tabpanel"]:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; border-radius: 4px; }

/* My notes (annotations.js): private note + highlight toggle for the open verse. */
.study[data-tab="notes"] .sp-hint { display: none; }
.my-notes { display: grid; gap: 0.6rem; }
.mn-hl { justify-self: start; display: inline-flex; align-items: center; gap: 0.5rem; min-height: 40px; padding: 0.35rem 0.85rem 0.35rem 0.6rem;
  border: 1px solid var(--field-border); border-radius: 999px; background: var(--surface); color: var(--text); font: 500 0.9rem var(--sans); cursor: pointer; }
.mn-hl:hover { background: var(--select); }
.mn-hl:focus-visible, .mn-save:focus-visible, .mn-del:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.mn-hl[aria-pressed="true"] { border-color: var(--hl-mark); background: var(--hl); }
.mn-swatch { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--hl-mark); background: transparent; }
.mn-hl[aria-pressed="true"] .mn-swatch { background: var(--hl-mark); }
.mn-hl:disabled, .mn-save:disabled { opacity: 0.55; cursor: default; }
.mn-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sub); margin-top: 0.35rem; }
.mn-text { width: 100%; min-height: 8.5rem; resize: vertical; padding: 0.7rem 0.8rem; border: 1px solid var(--field-border); border-radius: 10px;
  background: var(--field-bg); color: var(--text); font: 1rem/1.55 var(--serif); }
.mn-text:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.mn-text:disabled { opacity: 0.6; }
.mn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.mn-save { min-height: 40px; padding: 0.4rem 1rem; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-text); font: 600 0.9rem var(--sans); cursor: pointer; }
.mn-del { min-height: 40px; padding: 0.4rem 0.25rem; border: 0; background: transparent; color: var(--sub); font: 500 0.85rem var(--sans); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.mn-del:hover { color: var(--danger); text-decoration-color: currentColor; }
.mn-del[hidden] { display: none; }
.mn-status { flex: 1 1 12rem; margin: 0; font-size: 0.82rem; color: var(--sub); min-height: 1.2em; }
.mn-status.mn-err { color: var(--danger); }
/* Tab strip overflow (5 tabs in a narrow panel): edge fade + chevron wherever more tabs sit off-screen. */
.study-tabs-wrap { position: relative; }
.study-tabs { --fade: 44px; }
.study-tabs.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--fade)), transparent); mask-image: linear-gradient(to right, #000 calc(100% - var(--fade)), transparent); }
.study-tabs.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - var(--fade)), transparent); mask-image: linear-gradient(to left, #000 calc(100% - var(--fade)), transparent); }
.study-tabs.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent); mask-image: linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent); }
.st-more {
  position: absolute; top: 0; bottom: 2px; z-index: 1; display: none; align-items: center; justify-content: center;
  width: 26px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.st-more svg { width: 18px; height: 18px; }
.st-more:hover { color: var(--text); }
.st-more-l { justify-content: flex-start; background: linear-gradient(to right, var(--surface) 55%, transparent); }
.st-more-r { justify-content: flex-end; background: linear-gradient(to left, var(--surface) 55%, transparent); }
.st-more-l { left: -0.45rem; }
.st-more-r { right: -0.45rem; }
.study-tabs-wrap.more-l .st-more-l, .study-tabs-wrap.more-r .st-more-r { display: flex; }
/* Compact tabs: sub-labels visually hidden (kept in each tab's accessible name). Applied in desktop side-panel
   mode (>=1000px, panel ~--panel-w wide) and by study-panel.js whenever the strip would overflow with sub-labels. */
@media (min-width: 501px) {
  .study-tabs.compact [role="tab"] { flex: 1 0 auto; min-height: 44px; align-content: center; padding: 0.55rem 0.45rem 0.6rem; }
  .study-tabs.compact [role="tab"] .st-sub {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
}
.study-tabs [role="tab"] { position: relative; }
@media (min-width: 1000px) {
  /* Side panel is ~22rem at 1000px: bleed the strip to the panel edges and tighten tabs so all five fit. */
  .study-tabs-wrap { margin: 0 -1.25rem; }
  .study-tabs { --fade: 40px; gap: 0; margin: 0; padding: 0 0.2rem; scroll-padding: 0 0.2rem; }
  .st-more-l { left: 0; }
  .st-more-r { right: 0; }
  .study-tabs [role="tab"] { flex: 1 0 auto; min-height: 44px; align-content: center; padding: 0.55rem 0.28rem 0.6rem; }
  .study-tabs [role="tab"] .st-label { font-size: 0.8rem; }
  .study-tabs [role="tab"].has-content .st-label::after { margin-left: 0.25em; }
  .study-tabs [role="tab"] .st-sub {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  /* If it still overflows (very narrow panel / large text), make the "more" cue stronger than the phone fade. */
  .st-more { color: var(--text); width: 30px; }
}
@media (max-width: 500px) {
  /* Phone: drop the visible sub-labels (still in each tab's accessible name) so all five tabs fit at ~375. */
  .study-tabs [role="tab"] { position: relative; flex: 0 0 auto; min-height: 44px; align-content: center; padding: 0.55rem 0.34rem 0.6rem; }
  .study-tabs [role="tab"] .st-sub {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .study-tabs [role="tab"] .st-label { font-size: 0.82rem; }
  .study-tabs [role="tab"].has-content .st-label::after { margin-left: 0.3em; }
  /* Let the strip bleed to the sheet edges (head has 1rem side padding here) so five labels fit at ~375. */
  .study-tabs-wrap { margin: 0 -1rem; }
  .study-tabs { --fade: 36px; margin: 0; padding: 0 0.3rem; scroll-padding: 0 0.3rem; }
  .st-more-l { left: 0; }
  .st-more-r { right: 0; }
}
