/* ============================================================
   SCRIPTURA — CSS Foundation
   Heritage design system tokens + reset + base typography
   ============================================================ */

/* Self-hosted variable fonts (latin subset) served through Propshaft — no
   external font CDN at runtime. Stack falls back to Georgia / system-ui. */
@font-face {
  font-family: 'EB Garamond';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/eb-garamond-1e782b72.woff2") format("woff2");
}

@font-face {
  font-family: 'EB Garamond';
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/eb-garamond-italic-c3864bf8.woff2") format("woff2");
}

@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/public-sans-217759bd.woff2") format("woff2");
}

/* --- Design Tokens (Light theme default) --- */
:root {
  /* Palette */
  --color-primary:     #1A1C1E;
  /* Shale: one step darker than the spec swatch so small label text clears
     4.5:1 AA on Limestone. */
  --color-secondary:   #5D6368;
  --color-tertiary:    #B8422E;
  --color-neutral:     #F7F5F2;
  --color-surface:     #FFFFFF;
  --color-on-tertiary: #FFFFFF;

  /* Personal highlight palette. These are annotation colors, not system
     accents; Vermilion remains reserved for the Reading Mark Rule. */
  --highlight-ember: #9A5145;
  --highlight-ochre: #8A6F35;
  --highlight-sage:  #5F765E;
  --highlight-slate: #5D7380;

  /* Rail — follows theme */
  --color-rail-bg:          #FFFFFF;
  --color-rail-icon:        #5D6368;
  --color-rail-icon-active: #1A1C1E;

  /* Typography */
  --font-display:  'EB Garamond', Georgia, serif;
  --font-body:     'EB Garamond', Georgia, serif;
  --font-label:    'Public Sans', system-ui, sans-serif;
  --font-mono:     ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Font sizes — 20px default per DESIGN.md (17/20/23 steps) */
  --scripture-font-size: 20px;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  32px;
  --space-xl:  64px;

  /* Radii */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;

  /* Shell dimensions */
  --rail-width:    48px;
  --drawer-width:  280px;
  --tab-bar-height: 48px;
  --context-bar-height: 44px;
  --right-panel-width: 320px;
  --reader-max-width: 70ch;
  --catalog-max-width: 64rem; /* scannable indices/catalogs; prose stays at --reader-max-width */

  /* Border — single standard used throughout */
  --border: 1px solid color-mix(in srgb, var(--color-secondary) 25%, transparent);
  --shadow-overlay: 0 -4px 24px rgba(0,0,0,0.12);

  /* Focus ring — keyboard users see Vermilion, mouse users see nothing */
  --focus-ring: 2px solid var(--color-tertiary);
  --focus-offset: 2px;
}

/* --- Dark Theme --- */
[data-theme="dark"] {
  --color-primary:          #F7F5F2;
  /* Lightened Shale: #6C7278 fails 4.5:1 on the dark surfaces. */
  --color-secondary:        #9AA0A6;
  --color-neutral:          #0F1011;
  --color-surface:          #1A1C1E;
  --color-rail-bg:          #0F1011;
  --color-rail-icon:        #9AA0A6;
  --color-rail-icon-active: #F7F5F2;
  --highlight-ember:        #C58B80;
  --highlight-ochre:        #C0A15C;
  --highlight-sage:         #8FA78B;
  --highlight-slate:        #8FA7B3;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Keep scroll momentum inside scrollable chrome from rubber-banding the page. */
.app-content,
.study-panel-body,
.bottom-sheet-body,
.drawer-body {
  overscroll-behavior: contain;
}

@media (max-width: 767px) {
  /* Clear the notch/status bar when installed as a standalone PWA. */
  .context-bar {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--context-bar-height) + env(safe-area-inset-top, 0px));
  }

  /* iOS zooms on focus for inputs < 16px; bump the reader chrome inputs. */
  .top-search-input,
  .context-bar-translation-select {
    font-size: 1rem;
  }
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-primary);
  background-color: var(--color-neutral);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

svg {
  display: block;
  flex-shrink: 0;
}

[hidden] {
  display: none !important;
}

/* --- Focus visible ---
   Keyboard-first product: every interactive surface gets a visible Vermilion
   ring when reached via keyboard. Mouse users never see it because :focus-visible
   only matches keyboard focus. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius-sm);
}

.top-search-input:focus-visible {
  outline-offset: -2px;
}

/* --- Reduced motion ---
   PRODUCT.md promises prefers-reduced-motion is respected. Strip every non-essential
   transition; keep color changes (functional, not motion) and instantaneous transforms. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Flashes stay inside the system: Surface on Limestone, label voice, and the
   single accent only for alerts. Weight carries the signal, not a new hue. */
.flash {
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-label);
  font-size: 0.75rem;
  background: var(--color-surface);
  border-bottom: var(--border);
  color: var(--color-secondary);
}
.flash-alert { color: var(--color-tertiary); font-weight: 600; }
.flash-notice { color: var(--color-primary); }

/* Skip link: hidden until keyboard focus, then a clear Surface card. */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  color: var(--color-primary);
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  border: var(--border);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  left: var(--space-sm);
  top: var(--space-sm);
}

/* ============================================================
   APP SHELL — Mobile (base, no media query)
   ============================================================ */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  position: relative;
}

/* Main area: context bar + content + right panel (stacked on mobile) */
.app-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  /* Reserve space for fixed tab bar at bottom */
  padding-bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
}

.app-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* --- Context Bar (sticky top on mobile) --- */
.context-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--context-bar-height);
  background: var(--color-surface);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  gap: var(--space-sm);
}

.context-bar-brand {
  flex: 1;
}

.context-bar-logo {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

/* Reader context bar layout */
.context-bar-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
}

.context-bar-location {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.context-bar-translation {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.context-bar-translation-switcher {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.context-bar-translation-select {
  height: 30px;
  min-width: 4.5rem;
  max-width: 7rem;
  padding: 0 var(--space-xs);
  background: color-mix(in srgb, var(--color-secondary) 10%, transparent);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-secondary);
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.context-bar-translation-select:hover {
  color: var(--color-primary);
}

.context-bar-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  border-radius: var(--radius-md);
  transition: background 0.1s;
}

.context-bar-nav-btn:hover {
  background: var(--color-neutral);
}

.context-bar-nav-btn--disabled {
  color: var(--color-secondary);
  pointer-events: none;
}

.top-search {
  position: relative;
  flex: 0 1 clamp(8rem, 34vw, 10.5rem);
  margin-left: auto;
  min-width: 0;
}

/* Quiet ⌘K affordance inside the search field; hides on focus and on mobile. */
.top-search-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-label);
  font-size: 0.625rem;
  color: var(--color-secondary);
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 0.05em 0.3em;
  pointer-events: none;
}

.top-search:focus-within .top-search-kbd {
  display: none;
}

@media (max-width: 767px) {
  .top-search-kbd {
    display: none; /* no hardware keyboard assumption on mobile */
  }
}

/* Empty-palette hint row: teaches the reference/prefix vocabulary. */
.search-hint {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  color: var(--color-secondary);
  padding: var(--space-sm) var(--space-md);
  margin: 0;
}

.top-search-input {
  width: 100%;
  height: 30px;
  background: color-mix(in srgb, var(--color-secondary) 10%, transparent);
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-primary);
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0 var(--space-sm);
}

.top-search-input::placeholder {
  color: var(--color-secondary);
}

.top-search-results {
  position: absolute;
  top: calc(100% + var(--space-xs));
  right: 0;
  z-index: 60;
  width: min(22rem, calc(100vw - (var(--space-md) * 2)));
  max-height: min(24rem, calc(100dvh - 72px));
  overflow-y: auto;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
}

/* --- App Content --- */
.app-content {
  flex: 1;
  background: var(--color-neutral);
}

/* --- Lane + Column primitives ---
   The lane is the desktop content host. It owns column count and dividers.
   At one column (today's V1 default) the lane is visually transparent: the
   inner page padding on .reader-page and .library-page carries the layout.
   Plan 0002 extends this to 2-4 columns. */
.app-lane {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100%;
}

.app-column {
  min-width: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  /* Vertical divider between columns when more than one is present.
     Single-column lanes show no divider because they have no sibling column. */
  .app-lane[data-lane-count-value="2"],
  .app-lane[data-lane-count-value="3"],
  .app-lane[data-lane-count-value="4"] {
    grid-template-columns: repeat(var(--lane-count, 2), minmax(320px, 1fr));
  }

  .app-lane[data-lane-count-value="2"] { --lane-count: 2; }
  .app-lane[data-lane-count-value="3"] { --lane-count: 3; }
  .app-lane[data-lane-count-value="4"] { --lane-count: 4; }

  .app-lane[data-lane-count-value]:not([data-lane-count-value="1"]) .app-column + .app-column {
    border-left: var(--border);
  }

  /* Multi-column lanes get independent scroll per column. */
  .app-lane[data-lane-count-value]:not([data-lane-count-value="1"]) .app-column {
    overflow-y: auto;
  }
}

/* --- Bottom Tab Bar (mobile only) --- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--color-surface);
  border-top: var(--border);
  display: flex;
  align-items: stretch;
}

.tab-bar-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--color-secondary);
  padding: var(--space-xs) 0;
  border-top: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
}

.tab-bar-btn.active,
.tab-bar-btn[aria-current] {
  color: var(--color-primary);
  border-top-color: var(--color-tertiary);
}

.tab-bar-icon {
  width: 22px;
  height: 22px;
}

.tab-bar-label {
  font-family: var(--font-label);
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* More overflow sheet: quiet destinations above the tab bar. Flat by default;
   the bottom sheet is the system's only shadowed element, so no shadow here. */
.tab-bar-more {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
  z-index: 31;
  background: var(--color-surface);
  border-top: var(--border);
  display: flex;
  flex-direction: column;
}

.tab-bar-more-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  font-family: var(--font-label);
  font-size: 0.875rem;
  color: var(--color-primary);
  text-decoration: none;
  border-bottom: var(--border);
}

.tab-bar-more-link:last-child {
  border-bottom: none;
}

/* Hide desktop-only elements on mobile */
.app-rail,
.study-panel {
  display: none;
}

/* Drawer on mobile: fixed overlay sliding in from the left. The tab bar's
   Bible and Settings buttons open it, so it must exist below 768px. */
.app-drawer {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(320px, 85vw);
  z-index: 60;
  background: var(--color-rail-bg);
  border-right: var(--border);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0.2s;
  overflow-y: auto;
}

.app-drawer.drawer--open {
  transform: none;
  visibility: visible;
}

/* Backdrop behind the mobile overlay drawer; tap to close. */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: color-mix(in srgb, var(--color-primary) 40%, transparent);
  border: none;
  padding: 0;
}

/* Hide bottom sheet by default */
.bottom-sheet {
  display: none;
}

/* ============================================================
   APP SHELL — Desktop (≥ 768px)
   ============================================================ */

@media (min-width: 768px) {

  /* Tab bar hidden on desktop */
  .tab-bar {
    display: none;
  }

  /* Bottom sheet hidden on desktop (study panel used instead) */
  .bottom-sheet {
    display: none !important;
  }

  /* App shell becomes a horizontal row */
  .app-shell {
    flex-direction: row;
    height: 100dvh;
    overflow: hidden;
  }

  /* Main area fills remaining width, becomes vertical column */
  .app-main {
    flex: 1;
    flex-direction: column;
    display: flex;
    overflow: hidden;
    padding-bottom: 0;
  }

  .app-workspace {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative; /* anchors the wide-width overlaying desk (see 1360px block) */
  }

  /* Rail always visible */
  .app-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: var(--rail-width);
    flex-shrink: 0;
    background: var(--color-rail-bg);
    border-right: var(--border);
    height: 100dvh;
    z-index: 40;
    position: relative;
  }

  /* Context bar becomes a top toolbar to the right of the rail */
  .context-bar {
    position: static;
    flex-shrink: 0;
  }

  .top-search {
    flex-basis: 16rem;
    max-width: 18rem;
  }

  /* Content area scrollable */
  .app-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
  }

  /* Right study panel: slide in from right.
     This panel is a column flexbox with overflow:hidden, so the flex sizing
     algorithm derives its used width from content and ignores the plain
     `width` property. min-width/max-width ARE honored in both flow (push) and
     out-of-flow (the wide-width overlay) modes, so the desk width is pinned by
     clamping min == max == --right-panel-width; width is kept as a fallback.
     All three track the token so the resize handle drives either mode. */
  .study-panel {
    display: flex;
    flex-direction: column;
    width: 0;
    min-width: 0;
    max-width: 0;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--color-surface);
    border-left: var(--border);
    transition: min-width 0.2s ease, max-width 0.2s ease, width 0.2s ease;
    position: relative; /* anchors the .study-panel-resizer handle */
  }

  .study-panel:not([hidden]) {
    width: var(--right-panel-width);
    min-width: var(--right-panel-width);
    max-width: var(--right-panel-width);
  }

  .study-panel[hidden] {
    display: none;
  }

  /* Drawer: positioned next to rail, pushes content */
  .app-drawer {
    position: static;
    transform: none;
    visibility: visible;
    display: flex;
    flex-direction: column;
    width: 0;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--color-rail-bg);
    border-right: none;
    transition: width 0.2s ease;
    height: 100dvh;
  }

  .app-drawer.drawer--open {
    width: var(--drawer-width);
    overflow-y: auto;
  }

  /* Push drawer needs no backdrop on desktop */
  .drawer-backdrop {
    display: none !important;
  }
}

/* Wide screens: the desk floats over the otherwise-empty right margin so the
   reading column never jumps when it opens or closes. Parallel/commentary
   pages keep the pushing behavior because their grids already use the full
   width — an overlay there would cover content, so :has() excludes them. The
   graceful fallback in a :has()-less browser is today's push behavior. */
@media (min-width: 1360px) {
  .app-workspace:not(:has(.reader-page--parallel)):not(:has(.reader-page--commentary)) > .study-panel:not([hidden]) {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto; /* size from width/right, not the static-position left edge */
    height: auto;
    width: var(--right-panel-width); /* min/max-width (on :not([hidden])) pin it */
  }
}

/* ============================================================
   LEFT RAIL + DRAWER
   ============================================================ */

/* Rail buttons */
.rail-top,
.rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
}

.rail-top { flex: 1; }

.rail-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-rail-icon);
  border-radius: var(--radius-md);
  position: relative;
  transition: color 0.15s;
  text-decoration: none;
}

.rail-btn:hover {
  color: var(--color-rail-icon-active);
}

.rail-btn.active,
.rail-btn[aria-expanded="true"],
.rail-btn[aria-current="page"] {
  color: var(--color-rail-icon-active);
}

/* Tertiary left border for active rail button */
.rail-btn.active::before,
.rail-btn[aria-expanded="true"]::before,
.rail-btn[aria-current="page"]::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--color-tertiary);
  border-radius: 1px;
}

/* Drawer */
.drawer-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: var(--border);
  flex-shrink: 0;
}

.drawer-title {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.drawer-close {
  color: var(--color-secondary);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.1s;
}

.drawer-close:hover {
  color: var(--color-rail-icon-active);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.drawer-footer {
  flex-shrink: 0;
  padding: var(--space-md);
  border-top: var(--border);
}

.drawer-auth-link {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  text-decoration: none;
}

.drawer-auth-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.drawer-empty {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-secondary);
  padding: var(--space-md);
  text-align: center;
}

/* Search results */
.search-group-heading {
  font-family: var(--font-label);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
  padding: var(--space-sm) var(--space-sm) var(--space-xs);
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.1s;
}

.search-result:hover {
  background: color-mix(in srgb, var(--color-secondary) 15%, transparent);
}

.search-result-ref {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-tertiary);
}

.search-result-text {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--color-secondary);
  line-height: 1.4;
}

.search-empty {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-secondary);
  padding: var(--space-md);
  text-align: center;
}

.search-highlight {
  background: none;
  color: var(--color-primary);
  font-weight: 500;
}

/* Settings within drawer */
.settings-group {
  padding: var(--space-md) var(--space-sm);
  border-bottom: var(--border);
}

.settings-label {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
  display: block;
  margin-bottom: var(--space-sm);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.settings-theme-btn {
  flex: 1;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-secondary);
  background: color-mix(in srgb, var(--color-secondary) 10%, transparent);
  transition: background 0.1s, color 0.1s;
}

/* Active theme reads as weight + tone, not accent — the rail stripe is the
   drawer's single Vermilion mark (One Bookmark Rule). */
.settings-theme-btn.active {
  background: color-mix(in srgb, var(--color-secondary) 22%, transparent);
  color: var(--color-rail-icon-active);
  font-weight: 600;
}

.settings-size-btn {
  width: 36px;
  height: 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-secondary);
  background: color-mix(in srgb, var(--color-secondary) 10%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-size-btn:hover {
  color: var(--color-rail-icon-active);
}

.settings-size-value {
  flex: 1;
  text-align: center;
  font-family: var(--font-label);
  font-size: 0.6875rem;
  color: var(--color-secondary);
}

/* ============================================================
   BOTTOM SHEET (mobile verse panel stub)
   ============================================================ */

@media (max-width: 767px) {
  .bottom-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--color-surface);
    border-top: var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-overlay);
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 40dvh;
  }

  .bottom-sheet--open {
    transform: translateY(0);
  }

  .bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background: color-mix(in srgb, var(--color-secondary) 40%, transparent);
    border-radius: 2px;
    margin: var(--space-sm) auto var(--space-xs);
    cursor: grab;
    flex-shrink: 0;
  }

  .bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-md) var(--space-sm);
    flex-shrink: 0;
  }

  .bottom-sheet-ref {
    font-family: var(--font-label);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-secondary);
  }

  .bottom-sheet-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-secondary);
  }

  .bottom-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm) var(--space-md) var(--space-md);
  }

  .sheet-panel-frame {
    display: block;
    margin-top: 0.5rem;
  }

}

/* ============================================================
   READER — Prose verse rendering
   ============================================================ */

.reader-page {
  min-height: 100%;
  padding: var(--space-lg) var(--space-md);
}

.reader-content {
  max-width: var(--reader-max-width);
  margin: 0 auto;
}

/* Swipe-paging feedback: a small slide + fade before the chapter changes.
   Reduced-motion users get an instant swap (the controller skips this). */
.reader-content--paging-left,
.reader-content--paging-right {
  transition: transform 0.15s ease, opacity 0.15s ease;
  opacity: 0.6;
}

.reader-content--paging-left {
  transform: translateX(-24px);
}

.reader-content--paging-right {
  transform: translateX(24px);
}

/* Catalog variant: scannable result/list surfaces (search, study marks,
   concordance) breathe wider than reading prose. */
.reader-content--catalog {
  max-width: var(--catalog-max-width);
}

/* Prose block: verses flow inline, not as block elements */
.prose-block {
  font-family: var(--font-body);
  font-size: var(--scripture-font-size);
  line-height: 1.8;
  color: var(--color-primary);
  word-spacing: 0.02em;
}

/* Chapter drop-cap: floated EB Garamond numeral */
.chapter-drop-cap {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 500;
  line-height: 0.85;
  float: left;
  margin-right: 0.1em;
  margin-top: 0.05em;
  color: var(--color-primary);
}

.para-break {
  height: 1em;
}

.verse-unit.para-start::before {
  content: '';
  display: inline-block;
  width: 1.5em;
}

/* Verse units are inline — prose flows naturally */
.verse-unit {
  display: inline;
  cursor: pointer;
}

.verse-unit + .verse-unit {
  margin-left: 0.15em;
}

/* Selected verse: left border accent + subtle tint */
.verse-unit.verse--selected {
  background: color-mix(in srgb, var(--color-tertiary) 7%, transparent);
  box-shadow: inset 2px 0 0 var(--color-tertiary);
  border-radius: 1px;
}

/* Multi-column lanes demote older selections to a quiet Shale mark so only
   one Vermilion bookmark exists across the lane (lane_controller). */
.verse-unit.verse--previously-selected {
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--color-secondary) 45%, transparent);
  border-radius: 1px;
}

/* Verse numbers: superscript, secondary color */
.verse-number {
  font-family: var(--font-label);
  font-size: 0.5625rem;
  font-weight: 600;
  color: var(--color-secondary);
  vertical-align: super;
  line-height: 0;
  margin-right: 0.1em;
}

.verse-note-marker {
  font-family: var(--font-label);
  font-size: 0.5625rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--color-secondary) 75%, transparent);
  vertical-align: super;
  line-height: 0;
  margin: 0 0.15em 0 0.05em;
}

.verse-text {
  display: inline;
}

.verse-unit:is(.verse--hl-ember, .verse--hl-ochre, .verse--hl-sage, .verse--hl-slate) .verse-text {
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  text-decoration-skip-ink: none;
}

.verse-unit.verse--hl-ember .verse-text {
  text-decoration-color: var(--highlight-ember);
}

.verse-unit.verse--hl-ochre .verse-text {
  text-decoration-color: var(--highlight-ochre);
}

.verse-unit.verse--hl-sage .verse-text {
  text-decoration-color: var(--highlight-sage);
}

.verse-unit.verse--hl-slate .verse-text {
  text-decoration-color: var(--highlight-slate);
}

.word-study-discovery {
  font-family: var(--font-label);
  font-size: 0.625rem;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--color-secondary);
}

.word-study-discovery {
  margin: 0 0 var(--space-md);
  text-align: right;
}

.word-study-discovery-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.word-study-discovery-link:hover {
  color: var(--color-primary);
}

/* Dismiss control for the one-time tagged-word gesture hint. Shale glyph,
   no border, no accent. */
.word-study-discovery-dismiss {
  margin-left: 0.4em;
  padding: 0 0.2em;
  border: none;
  background: none;
  color: var(--color-secondary);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.word-study-discovery-dismiss:hover {
  color: var(--color-primary);
}

.reader-word {
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color 0.1s, text-decoration-color 0.1s;
}

.reader-word:hover,
.reader-word[aria-current="true"] {
  color: var(--color-primary);
  text-decoration-color: color-mix(in srgb, var(--color-secondary) 70%, transparent);
}

/* Empty state */
.reader-empty {
  color: var(--color-secondary);
  font-family: var(--font-body);
  padding: var(--space-xl) 0;
  text-align: center;
}

.reader-empty-hint {
  font-family: var(--font-label);
  font-size: 0.75rem;
  margin-top: var(--space-sm);
}

.reader-empty code,
.library-empty code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: color-mix(in srgb, var(--color-secondary) 15%, transparent);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* Bottom chapter navigation */
.reader-chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: var(--border);
}

.reader-chapter-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: var(--border);
  transition: color 0.1s, border-color 0.1s;
}

.reader-chapter-link:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.reader-tab-surface {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.reader-tabs {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  border-bottom: var(--border);
}

.reader-tab {
  flex: 0 0 auto;
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: color 0.1s, border-color 0.1s;
}

.reader-tab:hover,
.reader-tab--active {
  color: var(--color-primary);
}

.reader-tab--active {
  border-bottom-color: var(--color-tertiary);
}

.chapter-heading {
  clear: both;
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: var(--space-lg) 0 var(--space-sm);
}

.chapter-heading:first-child {
  margin-top: 0;
}

.hebrew-subtitle {
  font-style: italic;
  color: var(--color-secondary);
  margin-bottom: var(--space-md);
}

.words-of-jesus {
  font-style: italic;
}

.inline-heading {
  font-variant: small-caps;
  letter-spacing: 0.04em;
}

.inline-line-break {
  display: block;
  content: "";
  margin-top: 0.35em;
}

.poetry {
  display: inline-block;
}

.poetry-1 { margin-left: 1.5em; }
.poetry-2 { margin-left: 3em; }
.poetry-3 { margin-left: 4.5em; }

/* Footnote callers are addresses, like verse numbers — Shale, not the accent
   (One Bookmark Rule: a footnoted chapter must not scatter Vermilion). */
.footnote-ref {
  font-family: var(--font-label);
  font-size: 0.5625rem;
  font-weight: 600;
  color: var(--color-secondary);
  margin: 0 0.08em;
}

.resource-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.resource-entry {
  padding-bottom: var(--space-lg);
  border-bottom: var(--border);
}

.resource-title {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.resource-meta {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.resource-copy,
.resource-empty {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-primary);
}

.resource-copy + .resource-copy {
  margin-top: var(--space-sm);
}

.resource-empty {
  color: var(--color-secondary);
  font-style: italic;
}

.cross-reference-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  border-top: var(--border);
}

.cross-reference-item {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr auto;
  gap: var(--space-md);
  align-items: baseline;
  padding: var(--space-sm) 0;
  border-bottom: var(--border);
}

.cross-reference-source,
.cross-reference-source-label,
.cross-reference-score {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.cross-reference-meta {
  display: inline-flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  align-items: baseline;
}

.cross-reference-target-link {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}

.cross-reference-source:hover,
.cross-reference-target-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Study panel sections (Passage Desk) */
.panel-desk-heading {
  font-family: var(--font-label);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: 0 0 0.5rem;
}

.panel-section {
  border-top: var(--border);
}

.panel-section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0;
  cursor: pointer;
  list-style: none;
}

.panel-section-summary::-webkit-details-marker { display: none; }

.panel-section-title {
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 600;
}

.panel-section-count {
  font-family: var(--font-label);
  font-size: 0.7rem;
  color: var(--color-secondary);
  font-variant-numeric: tabular-nums;
}

.panel-section-body { padding: 0 0 0.75rem; }

.panel-link { text-decoration: underline; }

.panel-person-list {
  list-style: none;
  padding: 0;
}

.panel-person-row {
  display: grid;
  grid-template-columns: minmax(7rem, 0.8fr) 1.2fr;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.panel-person-name {
  color: var(--color-primary);
  font-family: var(--font-body);
  font-weight: 600;
  text-decoration: none;
}

.panel-person-name:hover,
.panel-person-verse:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.panel-person-verses {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: baseline;
}

.panel-person-verse,
.panel-person-more {
  font-family: var(--font-label);
  font-size: 0.625rem;
  color: var(--color-secondary);
}

.panel-person-verse {
  text-decoration: none;
}

.panel-verse-heading {
  font-family: var(--font-label);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: 0 0 0.5rem;
}

.panel-word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.panel-word-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.3rem 0.5rem;
  border: var(--border);
  text-decoration: none;
}

.panel-word-chip-surface { font-size: 0.85rem; }

.panel-word-chip-gloss {
  font-family: var(--font-label);
  font-size: 0.65rem;
  color: var(--color-secondary);
}

.panel-back { margin-top: 0.75rem; }

.panel-word-kicker {
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: 0;
}

.panel-word-lemma { font-size: 1.4rem; margin: 0.15rem 0 0; }
.panel-word-translit { font-style: italic; color: var(--color-secondary); margin: 0; }
.panel-word-gloss { font-weight: 600; margin: 0.35rem 0 0; }
.panel-word-definition { font-size: 0.9rem; margin: 0.35rem 0 0.75rem; }

.panel-word-usage {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-secondary);
  margin: 0 0 0.75rem;
}

.panel-word-usage-label { font-weight: 600; }

.panel-word-dictionary {
  color: var(--color-secondary);
  margin: 0 0 1rem;
}

.panel-word-dictionary-kicker,
.panel-word-related-title {
  font-family: var(--font-label);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.2rem;
}

.panel-word-dictionary-title {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  margin: 0 0 0.35rem;
}

.panel-word-dictionary-body {
  font-size: 0.88rem;
  color: var(--color-primary);
}

.panel-word-dictionary-body p {
  margin: 0 0 0.5rem;
}

.panel-word-related {
  font-size: 0.8rem;
  margin: 0 0 1rem;
}

.panel-word-related ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.panel-word-related li + li {
  margin-top: 0.25rem;
}

.panel-word-hint {
  font-size: 0.85rem;
  margin: 0.75rem 0 0;
}

.panel-occurrence-list { list-style: none; margin: 0; padding: 0; }

.panel-word-occurrence {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}

.panel-occurrence-surface { color: var(--color-secondary); }
.panel-more { margin: 0.5rem 0 0; font-size: 0.85rem; }

.voice-panel {
  max-width: var(--reader-max-width);
}

.voice-author-group + .voice-author-group {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: var(--border);
}

.voice-author-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.voice-author-name,
.voice-author-era,
.voice-occurrence-author,
.voice-occurrence-range,
.voice-possible-divider {
  font-family: var(--font-label);
  font-weight: 600;
  color: var(--color-secondary);
}

.voice-author-name {
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.voice-author-era,
.voice-occurrence-author,
.voice-occurrence-range,
.voice-possible-divider {
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voice-occurrence-list {
  border-top: var(--border);
}

.voice-occurrence {
  border-bottom: var(--border);
}

.voice-occurrence-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  text-align: left;
  transition: background-color 0.1s, color 0.1s;
}

.voice-occurrence-row:hover {
  background: color-mix(in srgb, var(--color-secondary) 6%, transparent);
}

.voice-occurrence-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.voice-occurrence-title {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.3;
  color: var(--color-primary);
}

.voice-occurrence-state {
  flex: 0 0 auto;
  width: 1rem;
  text-align: center;
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-secondary);
}

.voice-occurrence--open .voice-occurrence-state {
  transform: rotate(45deg);
}

.voice-possible-divider {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  padding: var(--space-sm) 0 var(--space-xs);
}

.voice-possible-divider::before,
.voice-possible-divider::after {
  content: "";
  height: 0;
  border-top: var(--border);
}

.voice-possible-divider::before {
  width: var(--space-md);
}

.voice-possible-divider::after {
  flex: 1;
}

.voice-excerpt-frame {
  display: block;
  padding: 0 0 var(--space-sm);
}

.voice-excerpt {
  padding: 0 0 var(--space-sm);
}

.voice-excerpt-heading {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: var(--space-xs) 0;
}

.voice-excerpt-copy {
  max-width: var(--reader-max-width);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-primary);
}

.voice-excerpt-copy p + p {
  margin-top: var(--space-sm);
}

.panel-loading {
  font-family: var(--font-label);
  font-size: 0.8rem;
  color: var(--color-secondary);
  margin: 0;
}

.audio-player {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-xs) 0;
}

.audio-element {
  width: 100%;
}

.audio-link {
  display: block;
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  padding: var(--space-xs) 0;
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .reader-page {
    padding: var(--space-lg) var(--space-xl);
  }
}

@media (max-width: 520px) {
  .cross-reference-item {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }
}

/* ============================================================
   LIBRARY SCREENS (home, translation, book)
   ============================================================ */

.library-page {
  padding: var(--space-lg) var(--space-md);
  max-width: var(--reader-max-width);
  margin: 0 auto;
}

.library-page--canon,
.library-page--book {
  /* Canon list and the book chapter index breathe wider than reading prose
     on desktop because they are scannable indices, not reading prose. */
  max-width: var(--catalog-max-width);
}

/* The library hub spreads across the full sheet like the front page: the
   sidebar + wings grid uses the whole width, and the wider gutters and
   column rules match the home broadsheet. */
.library-page--hub {
  max-width: none;
}

@media (min-width: 768px) {
  .library-page--hub {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }
}

.library-header {
  margin-bottom: var(--space-lg);
}

.library-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-md);
}

.library-breadcrumb-link {
  color: var(--color-secondary);
  transition: color 0.1s;
}

.library-breadcrumb-link:hover {
  color: var(--color-primary);
}

.library-breadcrumb-sep {
  color: var(--color-secondary);
  opacity: 0.45;
}

.library-title {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4vw + 1rem, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--color-primary);
  line-height: 1.05;
}

.library-subtitle {
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: italic;
  color: var(--color-secondary);
  margin-top: var(--space-sm);
}

.library-subtitle-sep {
  display: inline-block;
  margin: 0 0.5em;
  opacity: 0.5;
}

.library-section {
  margin-top: var(--space-xl);
}

.library-section-title {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: var(--border);
}

.library-empty {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--color-secondary);
  padding: var(--space-md) 0;
}

.library-empty-hint {
  font-style: normal;
  font-family: var(--font-label);
  font-size: 0.75rem;
  margin-top: var(--space-xs);
}

/* ---- Continue Reading ------------------------------------------------
   The single Vermilion touch on a library page. Reads as a printed quote
   pulled from the book, not a card. No background; the typographic shape
   and the leading-arrow do the work. */
/* Home list rows (Recent, Your study, Reference): typographic, hairline
   separators — never metric tiles (PRODUCT.md anti-references). */
.home-row-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-top: var(--border);
  text-decoration: none;
  color: inherit;
  transition: color 0.1s;
}

.home-row-list li:last-child .home-row {
  border-bottom: var(--border);
}

.home-row:hover .home-row-title {
  color: var(--color-tertiary);
}

.home-row-title {
  font-family: var(--font-body);
  font-size: 1.0625rem;
}

.home-row-desc {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-secondary);
  text-align: right;
  flex: 0 1 auto;
}

.home-row-meta {
  font-family: var(--font-label);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  flex-shrink: 0;
}

/* ---- Home broadsheet -------------------------------------------------
   The front page is set like a newspaper front page: the day's content in
   a ruled grid. Every rule is the single --border token; cells are flat on
   the Limestone page (no cards). The page's one Vermilion touch at rest is
   the verse-of-the-day reference. Unlike other catalog surfaces, the front
   page spreads across the full sheet: no max-width cap, wider gutters. */
.library-page--home {
  max-width: none;
}

@media (min-width: 768px) {
  .library-page--home {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }
}

/* Welcome strip: greeting left, the single resume affordance right. The
   broadsheet's top rule closes the strip visually. */
.home-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
  padding-bottom: var(--space-lg);
}

.home-welcome-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-primary);
}

.home-welcome-lede {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--color-secondary);
  margin-top: var(--space-xs);
}

.home-pickup {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
  text-align: right;
  text-decoration: none;
}

.home-pickup-label {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.home-pickup-ref {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.home-pickup-book {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-primary);
  transition: color 0.1s;
}

.home-pickup-translation {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.home-pickup-arrow {
  color: var(--color-secondary);
  align-self: center;
  transition: transform 0.15s cubic-bezier(0.32, 0.72, 0, 1), color 0.1s;
}

.home-pickup:hover .home-pickup-book {
  color: var(--color-tertiary);
}

.home-pickup:hover .home-pickup-arrow {
  color: var(--color-primary);
  transform: translateX(3px);
}

@media (max-width: 767px) {
  .home-pickup {
    align-items: flex-start;
    text-align: left;
  }
}

.home-broadsheet {
  display: grid;
  grid-template-columns: 1fr;
}

/* Mobile stacking order: verse, word, book, person, library. */
.home-cell--verse { order: 1; }
.home-cell--word { order: 2; }
.home-cell--book { order: 3; }
.home-cell--person { order: 4; }
.home-cell--library { order: 5; }

.home-cell {
  border-top: var(--border);
  padding: var(--space-md) 0 var(--space-lg);
  min-width: 0;
}

@media (min-width: 768px) {
  .home-broadsheet {
    grid-template-columns: 1fr 1fr 1fr;
    /* Without a person cell (people dataset not imported), the featured
       book stretches across the vacated column instead of leaving a hole. */
    grid-template-areas:
      "verse verse word"
      "book  book  library";
  }

  .home-broadsheet:has(.home-cell--person) {
    grid-template-areas:
      "verse verse  word"
      "book  person library";
  }

  .home-cell--verse { grid-area: verse; }
  .home-cell--word { grid-area: word; }
  .home-cell--person { grid-area: person; }
  .home-cell--book { grid-area: book; }
  .home-cell--library { grid-area: library; }

  .home-cell {
    padding-right: var(--space-lg);
  }

  /* Vertical column rules, newspaper-style. The book leads its row, so the
     rules sit on the person and the two right-hand columns. */
  .home-cell--word,
  .home-cell--person,
  .home-cell--library {
    border-left: var(--border);
    padding-left: var(--space-lg);
    padding-right: 0;
  }

  .home-cell--person {
    padding-right: var(--space-lg);
  }
}

.home-cell-title {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-md);
}

.home-cell-link {
  display: inline-block;
  margin-top: var(--space-md);
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.1s;
}

.home-cell-link:hover {
  color: var(--color-primary);
}

/* Verse of the day — the lede. Scripture voice, reader-scale type. */
.votd-text {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.5vw + 0.75rem, 1.5rem);
  line-height: 1.7;
  color: var(--color-primary);
  max-width: 60ch;
}

.votd-ref {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  margin-top: var(--space-md);
  text-decoration: none;
}

/* The page's single Vermilion touch at rest (One Bookmark Rule). */
.votd-ref-label {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-tertiary);
}

.votd-ref-translation {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.votd-ref-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: auto;
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  transition: color 0.1s;
}

.votd-ref-cta svg {
  transition: transform 0.15s cubic-bezier(0.32, 0.72, 0, 1);
}

.votd-ref:hover .votd-ref-cta {
  color: var(--color-primary);
}

.votd-ref:hover .votd-ref-cta svg {
  transform: translateX(3px);
}

/* Greek word of the day — the language column. The lemma reads (EB
   Garamond); the apparatus labels (Public Sans). */
.wotd-lemma {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--color-primary);
  overflow-wrap: break-word;
}

.wotd-translit {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-secondary);
  margin-top: var(--space-xs);
}

.wotd-gloss {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--color-primary);
  margin-top: var(--space-md);
}

.wotd-usage {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--color-secondary);
  margin-top: var(--space-sm);
}

.wotd-meta {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--color-secondary);
  margin-top: var(--space-md);
}

/* Your desk — resume, recents, and study counts as quiet rows. */
.home-row-list--flush li:first-child .home-row {
  border-top: 0;
  padding-top: 0;
}

.home-row-list--flush li:last-child .home-row {
  border-bottom: 0;
}

/* Resource rows inside a narrow column: rail icon beside a stacked
   title-over-description text block. */
.home-row--stacked {
  justify-content: flex-start;
  align-items: flex-start;
  gap: var(--space-md);
}

.home-row-icon {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--color-secondary);
}

.home-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-row--stacked .home-row-desc {
  text-align: left;
}

/* Book of the week — the plate. An engraving when one exists under
   app/assets/images/engravings/, otherwise a typographic plate: the book's
   initial set like a specimen. Duotoned into the page in both themes. */
.botw-plate {
  border: var(--border);
  background: var(--color-surface);
  margin-bottom: var(--space-md);
  /* Stays book-plate-shaped even when the cell spans a vacated column. */
  max-width: 24rem;
}

.botw-plate--engraving {
  line-height: 0;
}

.botw-plate--engraving img {
  width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.02);
  mix-blend-mode: multiply;
}

[data-theme="dark"] .botw-plate--engraving img {
  filter: grayscale(1) invert(0.9) contrast(1.05);
  mix-blend-mode: screen;
}

.botw-plate--type {
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 3;
  font-family: var(--font-display);
  font-size: 4.5rem;
  font-weight: 500;
  color: var(--color-primary);
}

.botw-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.botw-name a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.1s;
}

.botw-name a:hover {
  color: var(--color-tertiary);
}

.botw-meta {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-top: var(--space-xs);
}

.botw-intro {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-secondary);
  margin-top: var(--space-sm);
}

/* From the library — the weekly document. */
.folw-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.folw-title a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.1s;
}

.folw-title a:hover {
  color: var(--color-tertiary);
}

.folw-meta {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-top: var(--space-xs);
}

/* Person of the week — the featured Bible character. */
.potw-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.potw-name a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.1s;
}

.potw-name a:hover {
  color: var(--color-tertiary);
}

.potw-attr {
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: italic;
  color: var(--color-secondary);
  margin-top: var(--space-xs);
}

.potw-meta {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-top: var(--space-sm);
}

/* Later entries in the library cell (featured commentary, resources),
   separated from the block above by breathing room and a hairline rule. */
.folw-sublabel {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: var(--border);
}

.folw-title--commentary {
  font-size: 1.25rem;
  margin-top: var(--space-xs);
}

@media (prefers-reduced-motion: reduce) {
  .votd-ref-cta svg {
    transition: none;
  }

  .votd-ref:hover .votd-ref-cta svg {
    transform: none;
  }
}

.continue-reading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-top: var(--border);
  border-bottom: var(--border);
  text-decoration: none;
  color: inherit;
  transition: color 0.1s;
  margin-top: var(--space-lg);
}

.continue-reading--inline {
  margin-top: var(--space-md);
  margin-bottom: var(--space-lg);
}

.continue-reading-label {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-secondary);
  align-self: center;
}

.continue-reading-ref {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  min-width: 0;
}

.continue-reading-book {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.continue-reading-translation {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.continue-reading-arrow {
  color: var(--color-tertiary);
  align-self: center;
  transition: transform 0.15s cubic-bezier(0.32, 0.72, 0, 1);
}

.continue-reading:hover .continue-reading-book {
  color: var(--color-tertiary);
}

.continue-reading:hover .continue-reading-arrow {
  transform: translateX(3px);
}

/* ---- Canon (book grid, translation screen) --------------------------
   Two-column typographic canon list, grouped by genre section. Replaces
   the old 66-pill card grid. The book name carries the weight; the
   chapter count is a tabular afterthought on the right. */
.canon {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl) var(--space-xl);
  margin-top: var(--space-md);
}

.canon-section {
  break-inside: avoid;
}

.canon-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-secondary);
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-sm);
  border-bottom: var(--border);
}

.canon-section-count {
  font-feature-settings: "tnum";
  opacity: 0.6;
}

.canon-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.canon-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.1s, color 0.1s;
}

.canon-row-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--color-primary);
  transition: color 0.1s;
}

.canon-row-count {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  font-feature-settings: "tnum";
}

.canon-row-count-unit {
  opacity: 0.7;
}

.canon-row:hover .canon-row-name {
  color: var(--color-tertiary);
}

/* Long-book signal: a thin underline appears on hover for 50+ chapter
   books, hinting the reader may want a chapter rather than the whole book. */
.canon-row--long:hover .canon-row-name {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--color-tertiary) 50%, transparent);
  text-underline-offset: 0.18em;
}

/* Type-to-jump dim. The canon shape is preserved (books aren't hidden),
   non-matching rows fade to make matches pop. */
.canon-row--dim {
  opacity: 0.18;
  pointer-events: none;
}

/* ---- Canon filter (type-to-jump) ------------------------------------ */
.canon-filter {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: var(--border);
  margin-bottom: var(--space-md);
}

.canon-filter-label {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.canon-filter-input {
  flex: 1;
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--color-primary);
  min-width: 0;
}

.canon-filter-input::placeholder {
  color: var(--color-secondary);
  font-style: italic;
}

.canon-filter-count {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  font-feature-settings: "tnum";
}

/* ---- Chapter list (book screen) -------------------------------------
   Replaces the old chapters-grid. Each chapter is a typographic cell, not
   a pill. Long books group into decades with a thin label. */
.chapter-section,
.chapter-decade {
  margin-top: var(--space-md);
}

.chapter-decade + .chapter-decade {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: var(--border);
}

.chapter-decade-label {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
  font-feature-settings: "tnum";
}

.chapter-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: var(--space-xs);
}

.chapter-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-secondary);
  text-decoration: none;
  font-feature-settings: "tnum";
  transition: color 0.1s, font-weight 0.1s;
}

.chapter-cell:hover {
  color: var(--color-primary);
  font-weight: 600;
}

@media (min-width: 768px) {
  .library-page {
    padding: var(--space-xl) var(--space-xl);
  }

  .canon {
    grid-template-columns: 1fr 1fr;
    column-gap: var(--space-xl);
    row-gap: var(--space-xl);
  }

  .chapter-list {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: var(--space-sm);
  }

  .chapter-cell {
    height: 64px;
    font-size: 1.5rem;
  }
}

/* ---- Document library ------------------------------------------------
   Westminster and future local texts use the same reading-room language:
   typographic lists for navigation, plain prose for content, no card stacks. */
.document-list {
  list-style: none;
  border-top: var(--border);
}

.document-list li {
  border-bottom: var(--border);
}

.document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title meta"
    "description meta"
    "facts meta";
  gap: var(--space-xs) var(--space-md);
  padding: var(--space-md) var(--space-xs);
  color: inherit;
  text-decoration: none;
}

.document-row-title {
  grid-area: title;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--color-primary);
  transition: color 0.1s;
}

.document-row-description {
  grid-area: description;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--color-secondary);
}

.document-row-meta {
  grid-area: meta;
  align-self: center;
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  white-space: nowrap;
}

.document-row-facts {
  grid-area: facts;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: 2px;
}

.document-row:hover .document-row-title {
  color: var(--color-tertiary);
}

.library-work-content {
  max-width: var(--reader-max-width);
}

/* ---- Library hub shell ----------------------------------------------
   The card catalog (search + facets) docks left on desktop and collapses
   into a disclosure on mobile; the main column carries the quote lede and
   the three wings, or search results when filters are active. */
.library-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .library-shell {
    grid-template-columns: 16rem minmax(0, 1fr);
    /* No gap: the seam between catalog and main is a ruled column divider,
       matching the home broadsheet, not empty space. */
    gap: 0;
  }

  .library-sidebar {
    position: sticky;
    top: var(--space-md);
    align-self: start;
    border-right: var(--border);
    padding-right: var(--space-xl);
  }

  .library-main {
    padding-left: var(--space-xl);
  }
}

.library-filters-summary {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  cursor: pointer;
  padding: var(--space-sm) 0;
  border-top: var(--border);
  border-bottom: var(--border);
}

.library-filters[open] .library-filters-summary {
  border-bottom: 0;
}

.library-filters-more {
  margin-top: var(--space-md);
}

.library-filters-more-summary {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  cursor: pointer;
  padding: var(--space-xs) 0;
}

.library-filters-more[open] .library-filters-more-summary {
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
}

/* Featured quote — the hub's lede and its single Vermilion touch. Ruled
   top like the home broadsheet's first cell, so the quote and the wings
   below it read as one continuous set of horizontal seams. */
.library-quote {
  border-top: var(--border);
  padding: var(--space-lg) 0;
}

.library-quote-text {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.2vw + 0.9rem, 1.5rem);
  line-height: 1.6;
  color: var(--color-primary);
  max-width: 46ch;
  text-wrap: pretty;
}

.library-quote-caption {
  margin-top: var(--space-md);
}

.library-quote-link {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-sm);
  text-decoration: none;
}

.library-quote-author {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-tertiary);
}

.library-quote-source {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  transition: color 0.1s;
}

.library-quote-link:hover .library-quote-source {
  color: var(--color-primary);
}

/* The three wings: commentaries, collections, authors. Ruled like the home
   broadsheet; one column on mobile, three on wide desktop. */
.library-wings {
  display: grid;
  grid-template-columns: 1fr;
}

.library-wing {
  border-top: var(--border);
  padding: var(--space-md) 0 var(--space-lg);
  min-width: 0;
}

@media (min-width: 1024px) {
  .library-wings {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .library-wing {
    padding-right: var(--space-lg);
  }

  .library-wing + .library-wing {
    border-left: var(--border);
    padding-left: var(--space-lg);
    padding-right: 0;
  }
}

.library-wing-title {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-md);
}

.library-wing-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.library-wing-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-xs) 0 var(--space-sm);
  text-decoration: none;
  color: inherit;
}

.library-wing-row-title {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  color: var(--color-primary);
  transition: color 0.1s;
}

.library-wing-row:hover .library-wing-row-title {
  color: var(--color-tertiary);
}

.library-wing-row-meta {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  flex-shrink: 0;
}

.library-wing-more {
  display: inline-block;
  margin-top: var(--space-md);
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.1s;
}

.library-wing-more:hover {
  color: var(--color-primary);
}

.library-section-title-link {
  color: inherit;
  text-decoration: none;
}

.library-section-title-link:hover {
  color: var(--color-primary);
}

.library-filter-form {
  padding: var(--space-md) 0;
}

.library-empty-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Search-hit highlight in library-index excerpts — matches the subtle
   search-result mark (weight, not a Vermilion or yellow background). */
.document-row-description mark {
  background: none;
  color: var(--color-primary);
  font-weight: 500;
}

.library-featured-filters {
  margin-bottom: var(--space-md);
}

.library-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--space-sm);
}

/* Inside the sidebar the fields always stack. */
.library-sidebar .library-filter-grid {
  grid-template-columns: 1fr;
}

.library-sidebar .library-filter-field--wide {
  grid-column: auto;
}

.library-filter-field {
  min-width: 0;
}

.library-filter-field--wide {
  grid-column: span 2;
}

.library-filter-label {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.library-filter-input,
.library-filter-select {
  width: 100%;
  min-height: 38px;
  border: var(--border);
  border-radius: 0;
  background: var(--color-surface);
  color: var(--color-primary);
  font: inherit;
  font-size: 0.9375rem;
}

.library-filter-input {
  padding: 0 var(--space-sm);
}

.library-filter-select {
  padding: 0 var(--space-md) 0 var(--space-sm);
}

.library-filter-input::placeholder {
  /* Lighter than body gray so the hint recedes; --color-muted was never
     defined and fell back to near-black --color-primary. */
  color: color-mix(in srgb, var(--color-secondary) 70%, transparent);
}

.library-filter-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.library-filter-button,
.library-filter-reset {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.library-filter-button {
  border: var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-secondary);
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s;
}

.library-filter-button:hover,
.library-filter-button:focus-visible {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.library-filter-reset {
  color: var(--color-secondary);
  text-decoration: none;
}

.library-filter-reset:hover {
  color: var(--color-primary);
}

.library-chip-list,
.library-chip {
  display: inline-flex;
  align-items: center;
}

.library-chip-list {
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.library-chip {
  min-height: 1.35rem;
  border: var(--border);
  padding: 0 0.45rem;
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.library-chip--filter {
  color: var(--color-primary);
  text-decoration: none;
}

.library-chip--filter:hover,
.library-chip--active {
  border-color: var(--color-primary);
}

.library-chip--warning {
  background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
  border-color: color-mix(in srgb, var(--color-secondary) 35%, transparent);
  color: var(--color-secondary);
}

.library-work-provenance,
.library-notice {
  margin-bottom: var(--space-xl);
  padding: var(--space-md) 0;
  border-top: var(--border);
  border-bottom: var(--border);
}

.library-work-provenance .library-section-title {
  margin-bottom: var(--space-sm);
}

.library-metadata-list {
  display: grid;
  gap: var(--space-xs);
}

.library-metadata-row {
  display: grid;
  grid-template-columns: minmax(7rem, 0.35fr) minmax(0, 1fr);
  gap: var(--space-md);
  align-items: baseline;
}

.library-metadata-row dt {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.library-metadata-row dd,
.library-provenance-note,
.library-notice p {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-primary);
}

.library-metadata-row code {
  font-size: 0.75rem;
  word-break: break-all;
}

.library-metadata-subtitle {
  margin: var(--space-md) 0 var(--space-xs);
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.library-metadata-sublist,
.library-related-edition-list {
  list-style: none;
}

.library-metadata-sublist li + li,
.library-related-edition-list li + li {
  margin-top: var(--space-xs);
}

.library-related-edition-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  color: inherit;
  text-decoration: none;
}

.library-related-edition-link:hover span:first-child {
  color: var(--color-tertiary);
}

.library-metadata-link {
  color: var(--color-primary);
}

.library-metadata-link:hover {
  color: var(--color-tertiary);
}

.library-metadata-muted {
  color: var(--color-secondary);
}

.library-work-provenance .library-chip-list,
.library-provenance-note {
  margin-top: var(--space-md);
}

.library-notice {
  border-color: color-mix(in srgb, var(--color-tertiary) 35%, var(--color-border));
}

.library-notice p + p {
  margin-top: var(--space-xs);
}

.commentary-reader {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.commentary-note {
  scroll-margin-top: calc(var(--context-bar-height) + var(--space-md));
}

.commentary-note-reference,
.commentary-heading {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.commentary-note-copy {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--color-primary);
}

.commentary-note-copy p + p {
  margin-top: var(--space-md);
}

.commentary-note-meta {
  margin-bottom: var(--space-md);
  font-family: var(--font-label);
  color: var(--color-secondary);
}

.commentary-note-meta-author {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
}

.commentary-note-meta-category,
.commentary-note-meta-source {
  margin-top: 2px;
  font-size: 0.6875rem;
  line-height: 1.45;
}

.commentary-note-source-link {
  color: inherit;
  text-underline-offset: 2px;
}

.commentary-note-source-link:hover {
  color: var(--color-primary);
}

.commentary-filter-form--compact {
  margin-bottom: var(--space-lg);
  padding-top: 0;
  border-top: 0;
}

.commentary-filter-form--compact .library-filter-grid {
  grid-template-columns: 1fr;
}

.commentary-excerpts-callout {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: var(--border);
  font-family: var(--font-body);
  color: var(--color-secondary);
}

.commentary-excerpts-callout-link {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  text-underline-offset: 3px;
}

.commentary-excerpts-callout-link:hover {
  color: var(--color-tertiary);
}

.commentary-excerpt-list {
  display: grid;
  gap: var(--space-xl);
}

.commentary-excerpt {
  padding-bottom: var(--space-xl);
  border-bottom: var(--border);
}

.commentary-excerpt-header {
  margin-bottom: var(--space-md);
  font-family: var(--font-label);
}

.commentary-excerpt-author {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-primary);
}

.commentary-excerpt-author span,
.commentary-excerpt-category,
.commentary-excerpt-source {
  color: var(--color-secondary);
}

.commentary-excerpt-author span {
  font-size: 1rem;
  white-space: nowrap;
}

.commentary-excerpt-category,
.commentary-excerpt-source {
  margin-top: 3px;
  font-size: 0.6875rem;
  line-height: 1.45;
}

.commentary-excerpt-copy {
  max-width: var(--reader-max-width);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--color-primary);
}

.commentary-excerpt-copy p + p {
  margin-top: var(--space-md);
}

.commentary-excerpt-anchors {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  margin-top: var(--space-md);
}

.commentary-excerpt-anchor {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-secondary);
  text-underline-offset: 3px;
}

.commentary-excerpt-anchor:hover {
  color: var(--color-primary);
}

.library-work-toc {
  margin-bottom: var(--space-xl);
}

.library-work-toc-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs) var(--space-lg);
}

.library-work-toc-link {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  padding: 2px 0;
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  text-decoration: none;
}

.library-work-toc-link:hover {
  color: var(--color-primary);
}

.library-work-toc-label {
  font-feature-settings: "tnum";
  color: var(--color-primary);
}

.library-work-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.library-document-section {
  scroll-margin-top: calc(var(--context-bar-height) + var(--space-md));
}

.library-document-section + .library-document-section {
  padding-top: var(--space-lg);
  border-top: var(--border);
}

.library-document-children {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.library-document-heading {
  margin-bottom: var(--space-sm);
}

.library-document-heading-link {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-sm);
  text-decoration: none;
}

.library-document-label {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  font-feature-settings: "tnum";
}

.library-document-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.2;
  color: var(--color-primary);
}

.library-document-heading-link:hover .library-document-title {
  color: var(--color-tertiary);
}

.library-document-copy {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-primary);
}

.library-document-copy + .library-document-copy {
  margin-top: var(--space-sm);
}

.library-proof-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-sm);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: var(--border);
}

.library-proof-list--detected {
  margin-top: var(--space-xs);
  padding-top: 0;
  border-top: 0;
}

.library-proof-item {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
}

.library-proof-item--detected {
  font-weight: 500;
}

.library-proof-marker {
  color: var(--color-primary);
  font-feature-settings: "tnum";
}

.library-proof-link,
.library-proof-reference {
  color: var(--color-secondary);
}

.library-proof-link:hover {
  color: var(--color-primary);
}

.library-detected-references {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: var(--border);
}

.library-detected-title,
.library-detected-note {
  margin: 0;
  font-family: var(--font-label);
  color: var(--color-secondary);
}

.library-detected-title {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.library-detected-note {
  margin-top: var(--space-xs);
  font-size: 0.625rem;
  letter-spacing: 0.02em;
}

@media (min-width: 768px) {
  .library-work-toc-list {
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  }
}

@media (max-width: 520px) {
  .document-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "description"
      "facts"
      "meta";
  }

  .document-row-meta {
    align-self: start;
  }

  .library-filter-field--wide {
    grid-column: auto;
  }

  .library-metadata-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .library-document-heading-link {
    flex-direction: column;
    gap: 0;
  }
}

/* ============================================================
   STUDY PANEL (desktop right slot)
   ============================================================ */

@media (min-width: 768px) {
  /* Drag handle straddling the desk's left border. Transparent hit area — no
     second border style (One Border Rule), no shadow (Flat-By-Default). */
  .study-panel-resizer {
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 5;
  }

  .study-panel-resizer:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
  }

  /* Live drag: suppress the width transition so the desk tracks the pointer,
     and stop text selection while dragging. */
  .desk-resizing .study-panel {
    transition: none;
  }

  .desk-resizing {
    user-select: none;
    cursor: col-resize;
  }

  .study-panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    border-bottom: var(--border);
    flex-shrink: 0;
  }

  .study-panel-ref {
    flex: 1;
    font-family: var(--font-label);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--color-secondary);
  }

  .study-panel-lock {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-secondary);
    border-radius: var(--radius-sm);
    transition: color 0.1s, background-color 0.1s, box-shadow 0.1s;
    cursor: pointer;
  }

  .study-panel-lock:hover {
    color: var(--color-primary);
  }

  .study-panel-lock--active {
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-secondary) 14%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-secondary) 50%, transparent);
  }

  .study-panel-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-secondary);
    border-radius: var(--radius-sm);
    transition: color 0.1s;
  }

  .study-panel-close:hover {
    color: var(--color-primary);
  }

  .study-panel-actions {
    padding: var(--space-md);
    border-bottom: var(--border);
  }

  .study-panel-actions:empty {
    display: none;
    border-bottom: none;
  }

  .study-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
  }

}

/* ============================================================
   BOOK PICKER (inside drawer + mobile sheets)
   ============================================================ */

.book-picker {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.picker-select-wrap {
  position: relative;
}

.picker-select {
  width: 100%;
  padding: var(--space-xs) calc(var(--space-md) + var(--space-sm)) var(--space-xs) var(--space-sm);
  background: color-mix(in srgb, var(--color-secondary) 15%, transparent);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-rail-icon-active);
  cursor: pointer;
  appearance: none;
}

.picker-select-arrow {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-secondary);
  pointer-events: none;
}

.picker-select:hover + .picker-select-arrow,
.picker-select:focus-visible + .picker-select-arrow {
  color: var(--color-rail-icon-active);
}

.picker-section {
  margin-bottom: var(--space-sm);
}

.picker-heading {
  font-family: var(--font-label);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
  padding: var(--space-xs) 0;
  margin-bottom: var(--space-xs);
  border-bottom: var(--border);
}

.picker-books {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.picker-book-btn {
  padding: var(--space-xs) var(--space-xs);
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--color-secondary);
  border-radius: var(--radius-sm);
  text-align: center;
  transition: background 0.1s, color 0.1s;
  cursor: pointer;
}

.picker-book-btn:hover {
  background: color-mix(in srgb, var(--color-secondary) 20%, transparent);
  color: var(--color-rail-icon-active);
}

/* Chapter grid within picker */
.picker-chapters-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.picker-back-btn {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.1s;
  cursor: pointer;
}

.picker-back-btn:hover {
  color: var(--color-rail-icon-active);
}

.picker-chapters-title {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-rail-icon-active);
}

.picker-chapters-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}

.picker-chapter-link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-secondary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.picker-chapter-link:hover {
  background: var(--color-tertiary);
  color: var(--color-on-tertiary);
}

/* ============================================================
   VERSE ACTIONS (study panel + bottom sheet shared content)
   ============================================================ */

.verse-actions-ref {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.verse-actions-text {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}

.verse-actions-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.verse-highlight-palette {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.verse-highlight-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--color-secondary) 35%, transparent);
  flex: 0 0 auto;
  transition: border-color 0.1s, outline-color 0.1s;
}

.verse-highlight-swatch:hover {
  border-color: var(--color-primary);
}

.verse-highlight-swatch[aria-pressed="true"] {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.verse-highlight-swatch--ember,
.study-highlight-swatch--ember {
  background: var(--highlight-ember);
}

.verse-highlight-swatch--ochre,
.study-highlight-swatch--ochre {
  background: var(--highlight-ochre);
}

.verse-highlight-swatch--sage,
.study-highlight-swatch--sage {
  background: var(--highlight-sage);
}

.verse-highlight-swatch--slate,
.study-highlight-swatch--slate {
  background: var(--highlight-slate);
}

.verse-highlight-clear {
  padding-inline: var(--space-sm);
}

.verse-actions-error {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--color-tertiary);
  background: color-mix(in srgb, var(--color-tertiary) 8%, transparent);
  border: var(--border);
  border-color: color-mix(in srgb, var(--color-tertiary) 38%, transparent);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-md);
}

.verse-actions-btn {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  padding: var(--space-xs) var(--space-md);
  border: var(--border);
  border-radius: var(--radius-md);
  transition: color 0.1s, border-color 0.1s;
}

.verse-actions-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.verse-actions-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.verse-actions-save-link {
  align-self: center;
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.verse-actions-save-link:hover {
  color: var(--color-primary);
}

.verse-actions-subtitle {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: var(--space-md) 0 var(--space-sm);
}

.verse-actions-crossrefs {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.verse-actions-crossrefs li {
  border-bottom: var(--border);
}

.verse-actions-crossref-link {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--color-primary);
  padding: var(--space-xs) 0;
}

.verse-actions-crossref-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.verse-note-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.verse-note-textarea {
  width: 100%;
  min-height: 10rem;
  resize: vertical;
  background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
  color: var(--color-primary);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
}

.verse-note-textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--color-secondary) 45%, transparent);
  outline-offset: 2px;
}

.verse-note-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ============================================================
   READER ATTRIBUTION (chapter footer)
   ============================================================ */

.reader-attribution {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  font-family: var(--font-label);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  color: var(--color-secondary);
}

.reader-attribution-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.reader-attribution-link:hover {
  color: var(--color-primary);
}

.reader-empty-link {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================
   DICTIONARY PAGES
   ============================================================ */

.dictionary-index-page {
  padding-bottom: var(--space-xl);
}

.dictionary-hub-header {
  border-top: var(--border);
  padding-top: var(--space-lg);
}

.dictionary-hub-heading {
  display: grid;
  gap: var(--space-lg);
}

.dictionary-word-card {
  display: grid;
  gap: var(--space-xs);
  color: inherit;
  text-decoration: none;
  padding: var(--space-md) 0;
  border-top: var(--border);
  border-bottom: var(--border);
}

.dictionary-word-card-label,
.dictionary-results-label,
.dictionary-pane-title,
.dictionary-terms-count,
.dictionary-source-chip,
.dictionary-term-meta,
.dictionary-direct-link,
.dictionary-source-title {
  font-family: var(--font-label);
}

.dictionary-word-card-label,
.dictionary-results-label,
.dictionary-pane-title,
.dictionary-source-title {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.dictionary-source-sense {
  color: var(--color-primary);
}

.dictionary-word-card-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.1;
}

.dictionary-word-card-gloss {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--color-secondary);
}

.dictionary-search-band {
  border-top: var(--border);
  border-bottom: var(--border);
  padding: var(--space-md) 0;
  margin-bottom: var(--space-lg);
}

/* Desktop: search sits left, the source chips flow right on the same row.
   The chips row loses its own top rule here since the band already frames it. */
@media (min-width: 768px) {
  .dictionary-search-band {
    display: grid;
    grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
    align-items: center;
    gap: var(--space-lg);
  }

  .dictionary-search-band .dictionary-source-chips {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    justify-content: flex-end;
  }
}

.dictionary-search-form {
  display: grid;
  gap: var(--space-md);
}

.dictionary-search-actions {
  margin-top: 0;
}

.dictionary-source-chips {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-top: var(--space-md);
  margin-top: var(--space-md);
  border-top: var(--border);
}

.dictionary-source-chip {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-xs);
  flex: 0 0 auto;
  color: var(--color-secondary);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  /* Transparent border at rest so the active pill's border doesn't nudge
     neighbours; only the fill + border color change on selection. */
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: color 0.1s, background-color 0.1s, border-color 0.1s;
}

.dictionary-source-chip:hover {
  color: var(--color-primary);
}

.dictionary-source-chip--active {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
  /* Same hairline as the --border token, applied as a color so it rides the
     transparent rest-state border without a layout shift. */
  border-color: color-mix(in srgb, var(--color-secondary) 25%, transparent);
}

.dictionary-source-chip-count {
  font-weight: 500;
  color: var(--color-secondary);
}

.dictionary-shell {
  display: grid;
  gap: var(--space-lg);
}

.dictionary-index-pane,
.dictionary-terms-pane,
.dictionary-definition-pane {
  min-width: 0;
}

.dictionary-az {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-sm) 0;
  border-top: var(--border);
  border-bottom: var(--border);
}

.dictionary-az--receded {
  opacity: 0.65;
}

.dictionary-az-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  font-family: var(--font-label);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.dictionary-az-link:hover {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
}

.dictionary-az-link--active {
  color: var(--color-primary);
  font-weight: 700;
}

.dictionary-az-link--disabled {
  opacity: 0.28;
}

.dictionary-terms-pane {
  border-top: var(--border);
}

.dictionary-terms-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: var(--border);
}

.dictionary-terms-count {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-secondary);
}

.dictionary-term-list {
  list-style: none;
}

.dictionary-term-list li {
  border-bottom: var(--border);
}

.dictionary-term-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-sm) 0 var(--space-sm) var(--space-sm);
  color: inherit;
  text-decoration: none;
  box-shadow: inset 0 0 0 transparent;
}

.dictionary-term-link:hover .dictionary-term-headword {
  color: var(--color-primary);
}

.dictionary-term-link--active {
  box-shadow: inset 2px 0 0 var(--color-tertiary);
  background: color-mix(in srgb, var(--color-secondary) 7%, transparent);
}

.dictionary-term-headword {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.25;
  color: var(--color-primary);
  overflow-wrap: anywhere;
}

.dictionary-term-meta {
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  white-space: nowrap;
}

.dictionary-results-label {
  margin-bottom: var(--space-sm);
}

.dictionary-pagination {
  margin-top: var(--space-md);
}

.dictionary-definition-frame {
  display: block;
  min-width: 0;
  position: relative;
}

.dictionary-content {
  font-family: var(--font-body);
}

.dictionary-header {
  padding-bottom: var(--space-lg);
  border-bottom: var(--border);
}

.dictionary-definition-header {
  position: relative;
}

.dictionary-kicker {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.dictionary-kicker span {
  margin-left: var(--space-sm);
}

.dictionary-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 500;
  line-height: 1;
  overflow-wrap: anywhere;
}

.dictionary-direct-link {
  display: inline-flex;
  margin-top: var(--space-sm);
  color: var(--color-secondary);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dictionary-direct-link:hover {
  color: var(--color-primary);
}

.dictionary-definition-sources {
  display: grid;
  gap: var(--space-xl);
}

.dictionary-definition-source {
  padding-top: var(--space-lg);
  border-top: var(--border);
}

.dictionary-definition-source:first-child {
  border-top: 0;
}

.dictionary-definition-source-header {
  margin-bottom: var(--space-md);
}

.dictionary-body {
  margin-top: var(--space-md);
}

.dictionary-body p {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-primary);
}

.dictionary-body p + p {
  margin-top: var(--space-md);
}

.dictionary-reference-section {
  margin-top: var(--space-lg);
}

.dictionary-reference-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  padding: var(--space-md) 0;
  border-top: var(--border);
  border-bottom: var(--border);
}

.dictionary-reference-list li {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--color-secondary);
}

.dictionary-reference-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dictionary-reference-link:hover {
  color: var(--color-primary);
}

.dictionary-empty {
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-style: italic;
  color: var(--color-secondary);
  padding: var(--space-lg) 0;
}

.dictionary-attribution code {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  overflow-wrap: anywhere;
}

.dictionary-attribution-source {
  display: block;
  margin-top: var(--space-xs);
}

.dictionary-definition-loading {
  display: none;
  padding: var(--space-md) 0;
}

.dictionary-definition-loading span {
  display: block;
  height: 0.75rem;
  max-width: 100%;
  margin-bottom: var(--space-sm);
  background: color-mix(in srgb, var(--color-secondary) 16%, transparent);
}

.dictionary-definition-loading span:nth-child(1) {
  width: 42%;
}

.dictionary-definition-loading span:nth-child(2) {
  width: 88%;
}

.dictionary-definition-loading span:nth-child(3) {
  width: 64%;
}

.dictionary-definition-frame[busy] .dictionary-definition-loading {
  display: block;
}

.dictionary-definition-frame[busy] .dictionary-definition-shell {
  opacity: 0.35;
}

.dictionary-definition-shell {
  transition: opacity 0.15s linear;
}

@media (min-width: 768px) {
  .dictionary-hub-heading {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
    align-items: end;
  }

  .dictionary-word-card {
    border-bottom: 0;
  }

  .dictionary-search-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .dictionary-shell {
    grid-template-columns: minmax(5rem, 6rem) minmax(16rem, 0.9fr) minmax(0, 1.4fr);
    gap: 0;
    align-items: start;
  }

  .dictionary-index-pane,
  .dictionary-terms-pane,
  .dictionary-definition-pane {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
  }

  .dictionary-index-pane {
    padding-left: 0;
  }

  .dictionary-terms-pane,
  .dictionary-definition-pane {
    border-left: var(--border);
  }

  .dictionary-index-pane,
  .dictionary-terms-pane {
    position: sticky;
    top: var(--space-md);
    max-height: calc(100dvh - (var(--space-md) * 2));
    overflow: auto;
  }

  .dictionary-az {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    overflow: visible;
    border-bottom: 0;
  }

  .dictionary-az-link {
    justify-content: flex-start;
  }

  .dictionary-title {
    font-size: 4.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dictionary-definition-shell {
    transition: none;
  }
}

/* ============================================================
   PEOPLE PAGES
   ============================================================ */

.person-content {
  font-family: var(--font-body);
}

.person-identity,
.person-notes,
.person-section-intro {
  color: var(--color-secondary);
  margin-top: var(--space-sm);
}

.person-notes {
  color: var(--color-primary);
  line-height: 1.65;
}

.person-section {
  margin-top: var(--space-xl);
}

.person-name-list,
.person-relationship-group ul,
.person-reference-list {
  list-style: none;
  padding: 0;
}

.person-name-entry {
  padding: var(--space-md) 0;
  border-top: var(--border);
}

.person-name-entry:last-child {
  border-bottom: var(--border);
}

.person-name-heading {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.person-name-heading h3,
.person-relationship-group h3 {
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 600;
}

.person-name-note,
.person-language-label,
.person-mention-book summary span:last-child {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.person-language-line,
.person-strongs-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-sm);
  margin-top: var(--space-xs);
  line-height: 1.55;
}

.person-language-line > span + span::before {
  content: "·";
  margin-right: var(--space-sm);
  color: var(--color-secondary);
}

.person-strongs-links .dictionary-reference-link + .dictionary-reference-link {
  margin-left: var(--space-xs);
}

.person-relationship-groups {
  border-top: var(--border);
}

.person-relationship-group {
  display: grid;
  grid-template-columns: minmax(8rem, 0.35fr) 1fr;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: var(--border);
}

.person-relationship-group li + li {
  margin-top: var(--space-xs);
}

.person-mention-books {
  margin-top: var(--space-md);
  border-bottom: var(--border);
}

.person-mention-book {
  border-top: var(--border);
}

.person-mention-book summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-body);
  font-weight: 600;
}

.person-mention-book summary::-webkit-details-marker {
  display: none;
}

.person-reference-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  padding: var(--space-sm) 0 var(--space-md);
  font-family: var(--font-label);
  font-size: 0.6875rem;
}

.person-mention-counts {
  margin-top: var(--space-md);
}

.person-mention-count-row {
  grid-template-columns: 1fr auto;
}

.person-attribution {
  margin-top: var(--space-xl);
}

@media (max-width: 520px) {
  .person-relationship-group {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }
}

/* ============================================================
   LEXICON PAGE
   ============================================================ */

.lexicon-content {
  font-family: var(--font-body);
}

.lexicon-panel-frame {
  display: block;
}

.lexicon-content--frame {
  font-size: 0.9375rem;
}

.lexicon-header {
  padding-bottom: var(--space-lg);
  border-bottom: var(--border);
}

.lexicon-kicker {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.lexicon-kicker span {
  margin-left: var(--space-sm);
}

.lexicon-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 500;
  line-height: 1;
  overflow-wrap: anywhere;
}

.lexicon-content--frame .lexicon-title {
  font-size: 2rem;
  line-height: 1.05;
}

.lexicon-gloss {
  margin-top: var(--space-md);
  font-size: 1.25rem;
  line-height: 1.45;
  color: var(--color-secondary);
}

.lexicon-content--frame .lexicon-gloss {
  font-size: 1rem;
}

.lexicon-details {
  margin-top: var(--space-lg);
}

.lexicon-detail-row {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  border-bottom: var(--border);
}

.lexicon-detail-row dt {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.lexicon-detail-row dd {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--color-primary);
}

.lexicon-detail-row--prose dd {
  font-size: 1.0625rem;
}

.lexicon-dictionary-link {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.lexicon-dictionary-source {
  display: block;
  margin-top: 2px;
  color: var(--color-secondary);
}

.lexicon-content--frame .lexicon-detail-row {
  padding: var(--space-sm) 0;
}

.lexicon-content--frame .lexicon-detail-row dd,
.lexicon-content--frame .lexicon-detail-row--prose dd {
  font-size: 0.9375rem;
  line-height: 1.55;
}

.lexicon-attribution code {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  overflow-wrap: anywhere;
}

.lexicon-frame-loading {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

/* ============================================================
   CONCORDANCE PAGE
   ============================================================ */

.concordance-content {
  font-family: var(--font-body);
}

.concordance-header {
  padding-bottom: var(--space-lg);
  border-bottom: var(--border);
}

.concordance-title {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 500;
  line-height: 1.05;
}

.concordance-summary {
  margin-top: var(--space-md);
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--color-secondary);
}

.concordance-lexicon-link {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.concordance-groups {
  margin-top: var(--space-lg);
}

.concordance-book-group + .concordance-book-group {
  margin-top: var(--space-lg);
}

.concordance-book-title {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--color-secondary);
  padding-bottom: var(--space-xs);
  border-bottom: var(--border);
}

.concordance-list {
  list-style: none;
}

.concordance-occurrence {
  border-bottom: var(--border);
}

.concordance-occurrence-link {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
}

.concordance-occurrence-link:hover .concordance-reference {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.concordance-reference {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--color-secondary);
  font-feature-settings: "tnum";
}

.concordance-surface {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--color-primary);
}

@media (min-width: 768px) {
  .lexicon-title {
    font-size: 4.5rem;
  }

  .concordance-title {
    font-size: 3.75rem;
  }

  .concordance-occurrence-link {
    grid-template-columns: 8rem 1fr;
    gap: var(--space-lg);
  }

  .lexicon-detail-row {
    grid-template-columns: 10rem 1fr;
    gap: var(--space-lg);
  }

  .lexicon-detail-row dt {
    padding-top: 0.35rem;
  }
}

/* ============================================================
   STUDY PAGE (/study)
   ============================================================ */

.study-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.study-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.study-favorite-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.study-group-title {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.study-note-list,
.study-highlight-list,
.study-favorite-list {
  list-style: none;
  border-top: var(--border);
}

.study-note-item,
.study-highlight-item,
.study-favorite-item {
  border-bottom: var(--border);
}

.study-note-link,
.study-highlight-link,
.study-favorite-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.study-note-link {
  flex-direction: column;
  align-items: flex-start;
}

.study-highlight-link {
  align-items: center;
  justify-content: flex-start;
}

.study-note-link:hover .study-note-ref,
.study-highlight-link:hover .study-highlight-ref,
.study-favorite-link:hover .study-favorite-ref {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.study-note-ref,
.study-highlight-ref,
.study-favorite-ref {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-primary);
}

.study-highlight-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--color-secondary) 30%, transparent);
}

.study-note-excerpt {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-secondary);
}

.study-note-excerpt span {
  margin: 0;
}

.study-empty {
  padding: var(--space-xl) 0;
  color: var(--color-secondary);
  font-family: var(--font-body);
  font-size: 1.125rem;
}

.study-empty-compact {
  padding: var(--space-sm) 0 0;
  font-size: 1rem;
}

/* ============================================================
   SHORTCUTS DIALOG ("?" sheet) + shared shortcut list
   ============================================================ */

.shortcuts-dialog {
  margin: auto;
  max-width: 24rem;
  width: calc(100vw - 2 * var(--space-lg));
  background: var(--color-surface);
  color: var(--color-primary);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.shortcuts-dialog::backdrop {
  background: rgba(15, 16, 17, 0.4);
}

.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.shortcuts-title {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.shortcuts-close {
  color: var(--color-secondary);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shortcuts-close:hover {
  color: var(--color-primary);
}

.shortcuts-list {
  display: flex;
  flex-direction: column;
}

.shortcuts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: var(--border);
}

.shortcuts-row:last-child {
  border-bottom: none;
}

.shortcuts-row dt {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-primary);
}

.shortcuts-row dd {
  display: flex;
  gap: 4px;
  align-items: center;
  font-family: var(--font-label);
  font-size: 0.6875rem;
  color: var(--color-secondary);
}

.shortcuts-row kbd {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
}

/* ============================================================
   SEARCH RESULTS PAGE (/search)
   ============================================================ */

.search-page-header {
  margin-bottom: var(--space-lg);
}

.search-page-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.search-page-form {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.search-page-input {
  flex: 1;
  min-width: 12rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-primary);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
}

.search-page-translation {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-primary);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-sm);
}

.search-page-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  width: 100%;
}

.search-page-order {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
}

.search-page-order-option {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.search-page-order-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.search-page-order-option span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-sm);
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  cursor: pointer;
}

.search-page-order-option input:checked + span {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-secondary) 12%, transparent);
}

.search-page-order-option input:focus-visible + span {
  outline: 2px solid var(--color-tertiary);
  outline-offset: 2px;
}

.search-page-filter {
  min-height: 2.375rem;
  font-family: var(--font-label);
  font-size: 0.6875rem;
  color: var(--color-primary);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 0 var(--space-sm);
}

.search-page-submit {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-on-tertiary);
  background: var(--color-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
}

.search-page-reference {
  display: block;
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--color-primary);
  padding: var(--space-sm) 0;
  border-bottom: var(--border);
  margin-bottom: var(--space-sm);
}

.search-page-reference:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.search-page-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin: var(--space-sm) 0;
}

.search-page-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 1.75rem;
  padding: 0 var(--space-sm);
  border: var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--color-secondary);
  text-transform: uppercase;
}

.search-page-filter-chip:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.search-page-count {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: var(--space-md) 0;
}

.search-page-section + .search-page-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: var(--border);
}

.search-page-section-title {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.search-page-results {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.search-page-result {
  border-bottom: var(--border);
}

.search-page-result-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm) 0;
}

.search-page-result-link:hover .search-result-ref {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.search-page-result-text {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-primary);
}

.search-page-result-meta {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.search-page-result-text mark {
  background: none;
  color: var(--color-primary);
  font-weight: 500;
}

.search-page-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: var(--border);
}

.search-page-page-label {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  color: var(--color-secondary);
  font-feature-settings: "tnum";
}

.search-page-empty {
  font-family: var(--font-body);
  color: var(--color-secondary);
  padding: var(--space-lg) 0;
}

/* Combobox affordances in the top-search dropdown */
.search-result--active {
  background: color-mix(in srgb, var(--color-secondary) 15%, transparent);
}

.search-result--reference .search-result-ref,
.search-result--all .search-result-ref {
  color: var(--color-primary);
}

/* ============================================================
   ABOUT PAGE
   ============================================================ */

.about-title,
.page-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
}

.about-subtitle,
.section-title {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: var(--space-lg) 0 var(--space-sm);
}

.about-copy p {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-primary);
}

.about-copy p + p {
  margin-top: var(--space-md);
}

.about-link {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-shortcuts {
  max-width: 28rem;
}

.about-facts {
  margin: var(--space-lg) 0;
  display: flex;
  flex-direction: column;
}

.about-fact {
  display: grid;
  grid-template-columns: minmax(8rem, auto) 1fr;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: var(--border);
}

.about-fact dt {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  padding-top: 3px;
}

.about-fact dd {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-primary);
  overflow-wrap: anywhere;
}

.about-mirror-note {
  margin-top: var(--space-lg);
  color: var(--color-secondary);
  font-size: 0.9375rem;
}

/* ============================================================
   AUTH SCREENS
   ============================================================ */

.auth-page {
  display: flex;
  align-items: flex-start;
}

.auth-card {
  width: 100%;
  max-width: var(--reader-max-width);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.auth-kicker {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.1;
  margin-bottom: var(--space-md);
}

.auth-copy {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-secondary);
  margin-bottom: var(--space-md);
  max-width: 34rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.auth-label {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.auth-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-primary);
  background: var(--color-neutral);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
}

.auth-submit {
  align-self: flex-start;
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-on-tertiary);
  background: var(--color-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  transition: opacity 0.1s;
}

.auth-submit:hover {
  opacity: 0.85;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.auth-link {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link:hover {
  color: var(--color-primary);
}

@media (max-width: 520px) {
  .auth-card {
    padding: var(--space-md);
  }
}

/* ============================================================
   SETTINGS — translation selection
   ============================================================ */

.settings-hint {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.settings-translations {
  display: flex;
  flex-direction: column;
}

.settings-translation-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  border-bottom: var(--border);
  cursor: pointer;
}

.settings-translation-row:last-child {
  border-bottom: none;
}

.settings-translation-check {
  accent-color: var(--color-rail-icon-active);
  align-self: center;
  flex-shrink: 0;
}

.settings-translation-abbr {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-rail-icon-active);
  min-width: 3.25rem;
}

.settings-translation-name {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  color: var(--color-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   SETTINGS PAGE (/settings)
   ============================================================ */

.settings-page-note {
  font-family: var(--font-label);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--color-secondary);
  margin-bottom: var(--space-lg);
  max-width: 34rem;
}

.settings-section {
  margin-bottom: var(--space-lg);
}

.settings-account {
  max-width: 34rem;
}

.settings-account-email {
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
  overflow-wrap: anywhere;
  margin-bottom: var(--space-sm);
}

.settings-account-plan {
  display: inline-flex;
  width: fit-content;
  align-items: baseline;
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-secondary);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
  margin-bottom: var(--space-sm);
}

.settings-account-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.settings-account-link {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.settings-account-link:hover {
  color: var(--color-primary);
}

.settings-inline-link {
  color: var(--color-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.settings-inline-link:hover {
  color: var(--color-primary);
}

.settings-account-submit {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
}

.settings-account-submit:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.settings-page-row {
  max-width: 20rem;
}

.settings-page-translations {
  max-width: 34rem;
}

.settings-page-translations .settings-translation-row {
  padding: var(--space-sm) 0;
}

.settings-page-translations .settings-translation-abbr,
.settings-page-translations .settings-translation-name {
  font-size: 0.75rem;
}

.settings-translation-meta {
  margin-left: auto;
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  flex-shrink: 0;
}

/* ============================================================
   STUDY DESK (Plan 0005) — modes, instant details, parallel, interlinear
   ============================================================ */

.reader-page {
  position: relative;
}

.reader-page--parallel {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

@media (min-width: 900px) {
  .reader-page--parallel {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    max-width: none;
  }

  .reader-page--parallel .reader-content {
    max-width: none;
  }
}

.parallel-column-label {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-sm);
}

.reader-text-surface {
  position: relative;
}

.context-bar-tool-btn {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.context-bar-tool-btn:hover,
.context-bar-tool-btn--active {
  color: var(--color-primary);
}

.context-bar-tool-btn--active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-secondary) 40%, transparent);
}

/* Secondary reading tools: inline on desktop, a Tools dropdown on mobile.
   The context-tools controller forces the <details> open on desktop; here the
   body lays the tools in an inline flex row and the summary is hidden. Real
   layout boxes (not display:contents) keep the controls visible to a11y/tests. */
@media (min-width: 768px) {
  .context-bar-tools-menu {
    display: flex;
    align-items: center;
  }

  .context-bar-tools-body {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
  }

  .context-bar-tools-menu > summary {
    display: none;
  }
}

@media (max-width: 767px) {
  .context-bar-tools-menu {
    position: relative;
  }

  .context-bar-tools-trigger {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
  }

  .context-bar-tools-body {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    background: var(--color-surface);
    border: var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    min-width: 14rem;
  }

  .context-bar-tools-body .context-bar-tool-btn {
    min-height: 44px;
  }
}

.context-bar-audio {
  position: relative;
}

.context-bar-audio summary {
  list-style: none;
}

.context-bar-audio summary::-webkit-details-marker {
  display: none;
}

.context-bar-audio-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 16rem;
  padding: var(--space-sm);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
}

.context-bar-audio-reader {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-xs);
}

.context-bar-parallel-select {
  max-width: 7.5rem;
}

.study-desk-modes {
  display: flex;
  gap: 0;
  border-bottom: var(--border);
  flex-shrink: 0;
}

.study-desk-mode {
  flex: 1;
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-secondary);
  padding: var(--space-sm) var(--space-xs);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: transparent;
}

.study-desk-mode:hover {
  color: var(--color-primary);
}

.study-desk-mode--active,
.study-desk-mode[aria-selected="true"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-tertiary);
}

.panel-desk-sub {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: calc(var(--space-xs) * -1) 0 var(--space-md);
}

/* Quiet group headers (Study / Media / Yours) in the passage guide. */
.panel-desk-group-label {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: var(--space-md) 0 var(--space-xs);
}

/* Verse detail layers above the passage guide; a single divider separates it. */
.study-panel-verse-frame:not(:empty) {
  display: block;
  border-bottom: var(--border);
  margin-bottom: var(--space-sm);
}

.instant-details {
  z-index: 25;
  max-width: min(22rem, 90vw);
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-label);
  font-size: 0.6875rem;
  line-height: 1.35;
  color: var(--color-primary);
  box-shadow: var(--shadow-overlay);
  pointer-events: none;
}

.reader-word--tagged {
  border-bottom: 1px dotted color-mix(in srgb, var(--color-secondary) 55%, transparent);
  cursor: help;
}

.reader-word--interlinear {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: top;
  margin: 0 0.15em 0.35em;
  line-height: 1.15;
}

.ws-interlinear {
  display: block;
  font-family: var(--font-label);
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-secondary);
  max-width: 5.5rem;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
}

.prose-block--interlinear .verse-text {
  line-height: 2.1;
}

.ref-popover {
  position: absolute;
  z-index: 80;
  max-width: min(22rem, 90vw);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  pointer-events: none;
}

.ref-popover-ref {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-xs);
}

.ref-popover-text {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--color-primary);
}

.search-result--command .search-result-ref {
  color: var(--color-primary);
}

.panel-desk kbd {
  font-family: var(--font-label);
  font-size: 0.625rem;
  padding: 0.1em 0.35em;
  border: var(--border);
  border-radius: var(--radius-sm);
}

@media (min-width: 768px) {
  .study-panel-body {
    padding: var(--space-sm) var(--space-md);
  }

  .panel-section-summary {
    padding: var(--space-xs) 0;
  }
}

/* ============================================================
   COMMENTARY FOLLOW COLUMN (?commentary=:id)
   Text | Commentary grow with content — one page scroll, no nested box.
   ============================================================ */

.reader-page--commentary {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  align-items: stretch;
  max-width: none;
  width: 100%;
}

@media (min-width: 900px) {
  .reader-page--commentary {
    grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 1fr);
    gap: var(--space-xl);
  }

  .reader-page--commentary.reader-page--parallel {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.9fr) minmax(0, 1fr);
  }

  /* Match Scripture column height so the pair reads as one surface */
  .reader-page--commentary > .reader-content,
  .reader-page--commentary > .commentary-column {
    min-height: 100%;
  }
}

.commentary-column {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: auto;
  max-height: none;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  overflow: visible;
}

.commentary-column-header {
  flex-shrink: 0;
  /* Stick within .app-content scroll, not a nested box */
  position: sticky;
  top: 0;
  z-index: 2;
  padding: var(--space-sm) var(--space-md);
  border-bottom: var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  background: var(--color-surface);
}

.commentary-column-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.commentary-column-kicker {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: 0;
}

.commentary-column-close {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
}

.commentary-column-close:hover {
  color: var(--color-primary);
}

/* Searchable commentary source picker (column header) */
.commentary-picker {
  position: relative;
}

.commentary-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  font-family: var(--font-label);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-primary);
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  text-align: left;
}

.commentary-picker-trigger:hover,
.commentary-picker-trigger[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-secondary));
}

.commentary-picker-trigger-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commentary-picker-chevron {
  flex-shrink: 0;
  color: var(--color-secondary);
}

.commentary-picker-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  padding: var(--space-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-height: min(20rem, 50vh);
}

.commentary-picker-search {
  width: 100%;
  font-family: var(--font-label);
  font-size: 0.8125rem;
  color: var(--color-primary);
  background: var(--color-neutral);
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
}

.commentary-picker-search:focus {
  outline: 2px solid color-mix(in srgb, var(--color-tertiary) 55%, transparent);
  outline-offset: 1px;
}

.commentary-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  max-height: 14rem;
}

.commentary-picker-option {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-primary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.commentary-picker-option:hover,
.commentary-picker-option--active {
  background: color-mix(in srgb, var(--color-secondary) 12%, transparent);
}

.commentary-picker-option--current {
  font-weight: 600;
}

.commentary-picker-empty {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--color-secondary);
  padding: var(--space-xs) var(--space-sm);
  margin: 0;
}

/* Full note list — page scrolls; no inner scrollbar */
.commentary-column-body {
  flex: 1 1 auto;
  overflow: visible;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.commentary-note {
  padding-bottom: var(--space-md);
  border-bottom: var(--border);
  scroll-margin-top: 4.5rem;
}

.commentary-note:last-of-type {
  border-bottom: none;
}

.commentary-note--active {
  background: color-mix(in srgb, var(--color-secondary) 8%, transparent);
  margin: 0 calc(var(--space-md) * -1);
  padding: var(--space-sm) var(--space-md) var(--space-md);
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--color-secondary) 45%, transparent);
}

.commentary-note-label {
  margin: 0 0 var(--space-xs);
}

.commentary-note-verse-btn {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
}

.commentary-note-verse-btn:hover {
  color: var(--color-primary);
}

.commentary-note-copy {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-primary);
}

.commentary-note-copy p {
  margin: 0 0 var(--space-sm);
}

.commentary-note-copy p:last-child {
  margin-bottom: 0;
}

.commentary-column-footer {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
}



@media (min-width: 900px) {
  .reader-page--commentary .reader-content {
    max-width: none;
  }
}

@media (max-width: 899px) {
  .commentary-column {
    order: 2;
    max-height: none;
  }
}
