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

:root {
  --bg:      #F5F0E8;
  --surface: #FAF7F2;
  --text:    #1A1209;
  --rubric:  #8B1A1A;
  --gold:    #C9A84C;
  --muted:   #6B6358;
  --border:  #DDD5C4;
  --panel-w: 70vw;
}

html, body {
  height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
}

/* ── THREE-VIEW ARCHITECTURE ───────────────────────────────────────────────── */

.view {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  will-change: transform, opacity;
}

/* view-main: default visible */
.view-main {
  transform: translateY(0); opacity: 1;
  transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .28s ease;
  z-index: 1;
}
.view-main.hidden {
  transform: translateY(20px); opacity: 0; pointer-events: none;
}

/* view-search: hidden below, rises in */
.view-search {
  transform: translateY(32px); opacity: 0; pointer-events: none;
  transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .28s ease;
  z-index: 2;
  background: var(--bg);
}
.view-search.visible {
  transform: translateY(0); opacity: 1; pointer-events: auto;
}

/* view-cal: hidden below, rises in */
.view-cal {
  transform: translateY(32px); opacity: 0; pointer-events: none;
  transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .28s ease;
  z-index: 2;
  background: var(--bg);
}
.view-cal.visible {
  transform: translateY(0); opacity: 1; pointer-events: auto;
}

/* ── SHARED HEADER STYLE ───────────────────────────────────────────────────── */

header,
.search-hdr,
.cal-hdr {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 32px;
  flex-shrink: 0;
}

.header-cross { color: var(--rubric); font-size: 18px; }
.header-title { font-family: 'Cinzel', serif; font-size: 13px; letter-spacing: .14em; }
.header-about {
  margin-left: auto;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .1em;
  color: var(--muted); text-decoration: none;
}
.header-about:hover { color: var(--rubric); }

/* ── LAYOUT ── */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── CENTER COLUMN ── */
.center {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

/* Sticky sub-bar */
.center-bar {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: 44px;
  padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  z-index: 50;
}

.week-label {
  font-family: 'Cinzel', serif;
  font-size: 10px; letter-spacing: .18em; color: var(--muted);
}

.bar-btns { display: flex; align-items: center; gap: 8px; }

/* Sub-bar buttons */
.bar-btn {
  display: flex; align-items: center; gap: 7px;
  background: none; border: 1px solid var(--border);
  padding: 5px 11px; cursor: pointer;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .1em;
  color: var(--muted);
  transition: border-color .15s, color .15s;
}
.bar-btn:hover, .bar-btn.active { border-color: var(--rubric); color: var(--rubric); }

/* ── SERVICE LIST ── */
.service-list-body { padding: 28px 32px 60px; }
.date-block { margin-bottom: 32px; }

.date-heading {
  display: flex; align-items: baseline;
  gap: 10px; flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gold);
  margin-bottom: 10px;
}
.dow   { font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: .12em; color: var(--rubric); }
.date-d { font-family: 'Cinzel', serif; font-size: 12px; letter-spacing: .08em; color: var(--text); }
.feast  { font-family: 'EB Garamond', serif; font-size: 15px; font-style: italic; color: var(--muted); }
.layout:has(.panel.open) .feast { display: none; }

.svc-rows { display: flex; flex-direction: column; }

.svc-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  background: none; border: none; border-left: 2px solid transparent;
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .12s, background .12s;
}
.svc-row:hover  { border-left-color: var(--gold);   background: rgba(201,168,76,.07); }
.svc-row.active { border-left-color: var(--rubric); background: rgba(139,26,26,.06); }
.svc-row .name  { font-family: 'EB Garamond', serif; font-size: 16px; color: var(--text); }
.svc-row .arrow {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .1em;
  color: var(--rubric); opacity: 0; transition: opacity .12s;
}
.svc-row:hover .arrow, .svc-row.active .arrow { opacity: 1; }
.svc-row.dimmed { opacity: .35; cursor: default; pointer-events: none; }
.svc-row .soon  { font-family: 'Cinzel', serif; font-size: 8px; letter-spacing: .1em; color: var(--muted); }

/* "Priest unavailable?" hint under the Liturgy row, linking to Typika variants. */
.svc-alt {
  display: block; width: 100%; text-align: left;
  background: none; border: none; border-left: 2px solid transparent;
  padding: 2px 12px 8px 26px;
  font-family: 'EB Garamond', serif; font-size: 12px; font-style: italic;
  color: var(--muted); cursor: pointer;
}
.svc-alt .alt-link {
  color: var(--rubric); border-bottom: 1px dotted var(--rubric); font-style: normal;
}
.svc-alt .alt-sep { margin: 0 6px; opacity: .5; }
.svc-alt:hover .alt-link { border-bottom-style: solid; }

/* ── RIGHT PANEL ── */
.panel {
  width: 0; flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
  transition: width .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.panel.open { width: var(--panel-w); }

.panel-inner {
  width: var(--panel-w);
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}

.panel-head {
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-top-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.btn-close {
  background: none; border: none; cursor: pointer;
  font-size: 17px; color: var(--muted); padding: 0 4px;
  font-family: 'EB Garamond', serif;
  transition: color .12s;
}
.btn-close:hover { color: var(--rubric); }
.btn-print {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .12em;
  background: none; border: 1.5px solid var(--rubric);
  color: var(--rubric); padding: 5px 14px; cursor: pointer;
  transition: background .12s, color .12s;
}
.btn-print:hover { background: var(--rubric); color: var(--surface); }
.btn-print-icon { display: none; }

/* ── VIEW: PRINT ───────────────────────────────────────────────────────────── */

.view-print {
  transform: translateY(32px); opacity: 0; pointer-events: none;
  transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .28s ease;
  z-index: 2;
  background: var(--bg);
}
.view-print.visible {
  transform: translateY(0); opacity: 1; pointer-events: auto;
}

.print-hdr {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 32px;
  flex-shrink: 0;
}

.print-back {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .12em;
  color: var(--muted); padding: 4px 0;
  transition: color .15s;
}
.print-back:hover { color: var(--rubric); }

.print-view-body {
  flex: 1; overflow-y: auto;
  display: flex; justify-content: center;
  padding: 48px 32px 60px;
}

.print-view-inner {
  width: 100%; max-width: 520px;
}

.pd-title {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .22em;
  color: var(--rubric); margin-bottom: 28px;
  text-transform: uppercase;
}
.pd-options { display: flex; gap: 14px; }
.pd-option {
  flex: 1; padding: 22px 18px; border: 1.5px solid var(--border);
  cursor: pointer; background: none; text-align: left;
  transition: border-color .12s, background .12s;
}
.pd-option:hover { border-color: var(--gold); background: rgba(201,168,76,.06); }
.pd-option-name {
  font-family: 'Cinzel', serif; font-size: 8px; letter-spacing: .16em;
  color: var(--rubric); display: block; margin-bottom: 8px;
  text-transform: uppercase;
}
.pd-option-desc {
  font-family: 'EB Garamond', serif; font-size: 15px; font-style: italic;
  color: var(--muted); line-height: 1.5;
}

.panel-svc {
  font-family: 'Cinzel', serif; font-size: 14px; letter-spacing: .1em; color: var(--rubric);
  margin-bottom: 2px;
}
.panel-date-str {
  font-family: 'EB Garamond', serif; font-size: 14px; font-style: italic; color: var(--muted);
}
/* Single-line metadata row: SERVICE TEXT: <overlay> • TYPE: <variant>. */
.panel-meta-row {
  margin-top: 6px;
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .14em;
  color: var(--muted);
  text-transform: uppercase;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
}
.panel-meta-row[hidden] { display: none; }
.panel-meta-row .pmr-label { color: var(--muted); margin-right: 6px; }
.panel-meta-row .pmr-name  { color: var(--rubric); font-style: normal; }
.panel-meta-row .pmr-sep   { color: var(--muted); opacity: .6; }
.panel-meta-row .pmr-sep[hidden],
.panel-meta-row .pmr-overlay[hidden],
.panel-meta-row .pmr-type[hidden] { display: none; }
.panel-meta-row .pmr-type,
.panel-meta-row .pmr-overlay {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; letter-spacing: inherit; color: inherit;
  text-transform: inherit;
  border-bottom: 1px dotted var(--muted);
  transition: color .12s, border-bottom-color .12s;
}
.panel-meta-row .pmr-type:hover,
.panel-meta-row .pmr-overlay:hover { color: var(--rubric); border-bottom-color: var(--rubric); }
.panel-meta-row .pmr-type:hover .pmr-name,
.panel-meta-row .pmr-overlay:hover .pmr-name { color: var(--rubric); }

/* Stacked option list — used by the Liturgy variant picker, where 4 options
   want to stack vertically instead of the print picker's 2-up row. */
.pd-options-stack { flex-direction: column; gap: 12px; }

/* "More options in Settings →" link inside the Service Text quick picker. */
.st-more-link {
  display: block; margin-top: 18px;
  background: none; border: none; padding: 6px 0; cursor: pointer;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.st-more-link:hover { color: var(--rubric); }
/* Panel detail toggle */
.panel-detail-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 10px 0 12px;
  cursor: pointer; background: none; border: none;
  width: 100%; text-align: left;
  border-top: 1px solid var(--border);
}
.panel-detail-toggle:hover .pdt-label { color: var(--text); }
.pdt-label {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .16em;
  color: var(--muted); flex: 1;
  transition: color .15s;
}
.pdt-icon {
  width: 16px; height: 16px;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color .15s;
}
.panel-detail-toggle:hover .pdt-icon { border-color: var(--rubric); }
.pdt-icon svg { color: var(--muted); transition: color .15s; }
.panel-detail-toggle:hover .pdt-icon svg { color: var(--rubric); }
.panel-detail-toggle.open .pdt-icon { border-color: var(--rubric); }
.panel-detail-toggle.open .pdt-icon svg { color: var(--rubric); }
.panel-detail-toggle.open .pdt-label { color: var(--rubric); }
.panel-detail-toggle .pdt-minus { display: none; }
.panel-detail-toggle .pdt-plus  { display: block; }
.panel-detail-toggle.open .pdt-minus { display: block; }
.panel-detail-toggle.open .pdt-plus  { display: none; }

/* Phone-only pieces of the head (short title, tap-line label, chevron,
   drawer rows). Desktop keeps the full title, the meta row and the +/− icon;
   the ≤640px block swaps these in. */
.panel-svc-short, .pdt-label-m, .pdt-chev, .pd-rows, .pd-comms-head { display: none; }

/* Collapsible detail body */
.panel-detail-body {
  overflow: hidden; max-height: 0; opacity: 0;
  transition: max-height .28s cubic-bezier(.4,0,.2,1), opacity .22s ease;
}
.panel-detail-body.open { max-height: 480px; opacity: 1; }
.panel-detail-body-inner { padding: 0 0 14px; }

/* Saints list */
.p-saints { margin-bottom: 12px; }
.p-saint {
  font-family: 'EB Garamond', serif; font-size: 15px; color: var(--text);
  padding: 3px 0; line-height: 1.4;
}
.p-saint.major { font-weight: 500; }

/* Pronoun row (radio inputs) */
.pronoun-row {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Cinzel', serif; font-size: 8.5px; letter-spacing: .1em;
  color: var(--muted);
}
.pronoun-row label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.pronoun-row input { accent-color: var(--rubric); }

/* Source labels on section headings — shown only in dev mode */
.src-tag {
  display: none;
  font-family: 'Cinzel', serif; font-size: 7.5px; letter-spacing: .08em;
  color: var(--muted); opacity: .7;
  text-transform: uppercase; margin-left: 8px; font-weight: 400;
}
body.dev-mode .src-tag { display: inline; }
@media print { .src-tag { display: none !important; } }

.panel-scroll { display: contents; }
.panel-body { flex: 1; overflow-y: auto; padding: 24px 22px 48px; }

.panel-loading {
  font-family: 'EB Garamond', serif;
  font-size: 15px; color: var(--muted);
  text-align: center; padding-top: 40px;
}

/* ── SERVICE TEXT ── */
.svc-sec { margin-bottom: 28px; }
.svc-head {
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .18em;
  text-align: center; color: var(--text); margin-bottom: 12px;
}
.svc-rule { height: 1px; background: var(--gold); margin: 20px 0; }
.rubric {
  font-family: 'EB Garamond', serif; font-size: 14px; font-style: italic;
  color: var(--rubric); margin-bottom: 8px; line-height: 1.6;
}
.instruction {
  font-family: 'EB Garamond', serif; font-size: 14px; font-style: italic;
  color: var(--muted); margin-bottom: 8px; line-height: 1.6;
}
.service-title {
  font-family: 'EB Garamond', serif; font-size: 22px; font-variant: small-caps;
  letter-spacing: 0.08em; text-align: center; color: var(--text);
  margin: 40px 0 20px; padding: 16px 0;
  border-top: 2px solid var(--accent); border-bottom: 1px solid var(--accent);
}
.prayer {
  font-family: 'EB Garamond', serif; font-size: 16px; line-height: 1.88;
  color: var(--text); margin-bottom: 14px;
}
.stich-label {
  font-family: 'EB Garamond', serif; font-size: 13px; font-style: italic;
  color: var(--muted); margin-bottom: 6px;
}
.verse {
  font-family: 'EB Garamond', serif; font-size: 14px; font-style: italic;
  color: var(--muted); margin-bottom: 10px; line-height: 1.6;
}
.prayer.compact {
  font-size: 14px; font-style: italic; color: var(--muted); line-height: 1.6;
}
/* A step smaller than `.compact`, for a long text read privately while
   something else is happening — the silent pre-Communion prayer. It should
   read as fine print beside what is being sung, not dominate the page. */
.prayer.fine {
  font-size: 12px; font-style: italic; color: var(--muted); line-height: 1.65;
}
/* A short, invariant acclamation inside a litany — "Lord, have mercy.",
   "Grant this, O Lord.", "Amen." A reader does not need these at body size;
   they are a cue that the petition has ended, and at body size they are 31%
   of the blocks in a Great Vespers. Set apart from `.compact`, which is for
   LONG text that is spoken to you (readings, psalmody, litany petitions). */
.prayer.cue {
  font-size: 13px; font-style: italic; color: var(--muted);
  line-height: 1.5; margin-bottom: 6px;
}
.spk {
  display: block;
  font-family: 'EB Garamond', serif; font-size: 13px; font-weight: 600;
  font-style: normal; color: var(--rubric);
}

/* ── VIEW: SEARCH ──────────────────────────────────────────────────────────── */

.search-back,
.cal-back {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .12em;
  color: var(--muted); padding: 4px 0;
  transition: color .15s;
}
.search-back:hover,
.cal-back:hover { color: var(--rubric); }

/* Scrollable body */
.search-content {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}

/* Search input wrapper */
.search-input-wrap {
  padding: 32px 32px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  opacity: 0; transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease;
}
.search-input-wrap.in { opacity: 1; transform: translateY(0); }

.search-input-row {
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 6px;
  transition: border-color .2s;
}
.search-input-row:focus-within { border-bottom-color: var(--rubric); }
.search-input-row svg { color: var(--muted); flex-shrink: 0; }

#search-input {
  flex: 1;
  background: none; border: none; outline: none;
  font-family: 'EB Garamond', serif; font-size: 22px;
  color: var(--text);
}
#search-input::placeholder { color: var(--muted); font-style: italic; }

.search-clear {
  background: none; border: none; cursor: pointer;
  font-family: 'EB Garamond', serif; font-size: 18px;
  color: var(--muted); padding: 0 2px; line-height: 1;
  opacity: 0; pointer-events: none;
  transition: opacity .15s, color .15s;
}
.search-clear.visible { opacity: 1; pointer-events: auto; }
.search-clear:hover { color: var(--rubric); }

/* Hint tags */
.search-hint-area {
  padding: 28px 32px 0;
  max-width: 640px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .3s ease .08s, transform .3s ease .08s;
}
.search-hint-area.in { opacity: 1; transform: translateY(0); }

.hint-label {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .2em;
  color: var(--muted); margin-bottom: 16px;
}
.hint-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.hint-tag {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .1em;
  background: none; border: 1px solid var(--border);
  color: var(--muted); padding: 6px 14px; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.hint-tag:hover { border-color: var(--rubric); color: var(--rubric); background: rgba(139,26,26,.04); }

/* Spinner */
.search-spinner-wrap {
  display: none;
  justify-content: center;
  padding: 64px 0;
}
.search-spinner-wrap.active { display: flex; }
.search-spinner {
  width: 24px; height: 24px;
  border: 1.5px solid var(--border);
  border-top-color: var(--rubric);
  border-radius: 50%;
  animation: spin 1.1s cubic-bezier(.5,.1,.5,.9) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.search-results-area { display: none; flex-direction: column; }
.search-results-area.in { display: flex; }

.results-eyebrow {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .2em;
  color: var(--muted);
  padding: 20px 32px 10px;
  border-bottom: 1px solid var(--border);
}

.result-row {
  display: flex; align-items: baseline; gap: 24px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-right: none; border-top: none;
  background: none; width: 100%; text-align: left;
  cursor: pointer;
  opacity: 0; transform: translateY(10px);
  transition: opacity .28s ease, transform .28s ease, background .12s, border-left-color .15s;
}
.result-row:last-child { border-bottom: none; }
.result-row.in  { opacity: 1; transform: translateY(0); }
.result-row:hover { background: rgba(139,26,26,.04); border-left-color: var(--gold); }
.result-row.unavailable { opacity: .38; pointer-events: none; }

.result-date {
  font-family: 'EB Garamond', serif; font-size: 14px; font-style: italic;
  color: var(--muted); min-width: 150px; flex-shrink: 0;
}
.result-name { font-family: 'EB Garamond', serif; font-size: 18px; color: var(--text); flex: 1; line-height: 1.4; }
.result-name em { color: var(--rubric); font-style: normal; }
.result-desc {
  display: block; font-size: 14px; font-style: italic; color: var(--muted);
  line-height: 1.35; margin-top: 2px;
}
.result-tag {
  font-family: 'Cinzel', serif; font-size: 8px; letter-spacing: .1em;
  color: var(--rubric); flex-shrink: 0;
}
.result-row.unavailable .result-tag { color: var(--muted); }

.results-empty {
  padding: 56px 32px;
  font-family: 'EB Garamond', serif; font-size: 18px; font-style: italic;
  color: var(--muted);
}

/* Mobile close button (search) */
.search-close-bottom { display: none; }

/* ── VIEW: CALENDAR ────────────────────────────────────────────────────────── */

.cal-view-body {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}

/* Week strip */
.cal-week-wrap {
  padding: 28px 32px 24px;
  flex-shrink: 0;
  opacity: 0; transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease;
  border-bottom: 1px solid var(--border);
}
.cal-week-wrap.in { opacity: 1; transform: translateY(0); }

.cal-week-label {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .18em;
  color: var(--muted); margin-bottom: 14px;
}

.cal-week-nav {
  display: flex; align-items: center; gap: 12px;
}

.cal-arrow {
  background: none; border: 1px solid var(--border);
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted);
  transition: border-color .15s, color .15s;
}
.cal-arrow:hover   { border-color: var(--rubric); color: var(--rubric); }
.cal-arrow:disabled { opacity: .3; pointer-events: none; }

.cal-week-strip {
  flex: 1; display: flex; gap: 6px; overflow: hidden;
  transition: opacity .18s ease, transform .18s ease;
}
.cal-week-strip.shifting { opacity: 0; transform: translateX(12px); }

.cal-week-day {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 10px 4px; gap: 4px;
  border: 1px solid var(--border);
  cursor: default; min-width: 0;
  transition: background .12s, border-color .12s;
}
.cwd-dow {
  font-family: 'Cinzel', serif; font-size: 8px; letter-spacing: .08em;
  color: var(--muted); line-height: 1;
}
.cwd-num {
  font-family: 'EB Garamond', serif; font-size: 18px;
  color: var(--muted); line-height: 1;
}
.cwd-month {
  font-family: 'Cinzel', serif; font-size: 7px; letter-spacing: .06em;
  color: var(--muted); line-height: 1;
}
.cwd-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: transparent; flex-shrink: 0;
}

.cal-week-day.has-svc { cursor: pointer; }
.cal-week-day.has-svc .cwd-num { color: var(--text); }
.cal-week-day.has-svc .cwd-dot { background: var(--rubric); }
.cal-week-day.has-svc:hover {
  background: rgba(139,26,26,.05); border-color: var(--gold);
}

.cal-week-day.today { border-color: var(--rubric); }
.cal-week-day.today .cwd-num { color: var(--rubric); font-weight: 600; }
.cal-week-day.today .cwd-dow { color: var(--rubric); }

/* Service strip */
.cal-saint-strip {
  padding: 20px 32px 0;
  flex-shrink: 0;
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease .1s, transform .25s ease .1s;
}
.cal-saint-strip.in { opacity: 1; transform: translateY(0); }

.css-eyebrow {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .18em;
  color: var(--muted); margin-bottom: 12px;
  border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.css-rows { display: flex; flex-direction: column; }
.css-row {
  display: flex; align-items: baseline; gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer; background: none;
  border-left: 3px solid transparent;
  border-right: none; border-top: none;
  width: 100%; text-align: left;
  transition: background .12s, border-left-color .15s;
}
.css-row:hover { background: rgba(139,26,26,.04); border-left-color: var(--gold); }
.css-row.unavail { opacity: .38; cursor: default; pointer-events: none; }
.css-date { font-family: 'EB Garamond', serif; font-size: 14px; font-style: italic; color: var(--muted); min-width: 80px; flex-shrink: 0; }
.css-name { font-family: 'EB Garamond', serif; font-size: 17px; color: var(--text); flex: 1; }
.css-tag  { font-family: 'Cinzel', serif; font-size: 8px; letter-spacing: .1em; color: var(--muted); flex-shrink: 0; }

/* Mobile close (calendar) */
.cal-close-bottom {
  display: none; justify-content: center;
  padding: 16px 0 36px; flex-shrink: 0;
}
.cal-close-bottom button {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--border);
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .14em;
  color: var(--muted); padding: 10px 28px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.cal-close-bottom button:hover { border-color: var(--rubric); color: var(--rubric); }

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */

/* Stacked date bar at narrower widths */
@media (max-width: 1090px) {
  .center-bar {
    padding: 10px 32px;
    height: auto;
    flex-wrap: wrap;
  }
  .week-label { width: 100%; margin-bottom: 8px; }
  .bar-btns { width: 100%; }
  .bar-btn { flex: 1; justify-content: center; }
}

/* Mobile: tighter spacing + scaled reading text.
   NOTE: a stray `}` used to sit above this block and the CSS parser swallowed
   the whole thing as a malformed rule — none of it ever applied on phones. */
@media (max-width: 767px) {
  header, .search-hdr, .cal-hdr { padding: 0 16px; }
  .header-title { font-size: 11px; letter-spacing: .1em; white-space: nowrap; }
  .header-about { font-size: 9px; }
  .header-settings { padding: 10px; margin-right: -10px; }
  .center-bar { padding: 10px 16px; }
  .bar-btn { min-height: 40px; }
  .service-list-body { padding: 20px 16px 80px; }
  .panel-head { padding: 12px 16px 0; }
  /* Print was `display: none` here, so phones had no way to print at all —
     not a degraded path, an absent one. It returns as a primary floating
     action in the thumb corner rather than a sticky bar, which would cost
     reading height; the floating ✕ stays alone at the top. */
  .btn-print {
    position: fixed; z-index: 20;
    right: 20px; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    width: 56px; height: 56px; padding: 0;
    border: none; border-radius: 50%;
    background: var(--rubric); color: var(--surface);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(26,18,9,.26), 0 1px 2px rgba(26,18,9,.18);
  }
  .btn-print:hover { background: var(--rubric); color: var(--surface); }
  .btn-print-label { display: none; }
  .btn-print-icon  { display: block; }
  /* The title must not run under the floating ✕. */
  .panel-svc, .panel-svc-short { padding-right: 56px; }
  .svc-row { padding: 11px 12px; }
  .svc-row .arrow { opacity: 1; }

  /* Scale up panel reading text for a phone held at arm's length in a dim
     nave (e-reader range). The desktop line-height (1.88) is tuned for 16px;
     at this size it reads as double-spaced, so the leading tightens too. */
  .prayer      { font-size: 22px; line-height: 1.55; }
  .prayer.compact { font-size: 18px; }
  .prayer.cue     { font-size: 17px; }
  .prayer.fine    { font-size: 17px; }
  .rubric      { font-size: 18px; }
  .instruction { font-size: 18px; }
  .verse       { font-size: 18px; }
  .stich-label { font-size: 17px; }
  .spk         { font-size: 16px; }
  .panel-comms { font-size: 18px; }
  .svc-head    { font-size: 12px; }
}

/* Mobile: all takeover views + panel at ≤640px */
@media (max-width: 640px) {
  /* Scroll containers own their overscroll so a rubber-band at the end of a
     list never drags the whole app; no grey tap flash on rows. */
  .center, .panel-body, .cal-view-body, .search-content, .settings-body {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  button, .svc-row, .css-row, .result-row { -webkit-tap-highlight-color: transparent; }

  /* Search */
  .search-hdr { display: none; }
  .search-content { display: flex; flex-direction: column; }
  .search-input-wrap { padding: 20px 20px 16px; }
  #search-input { font-size: 19px; }
  .search-hint-area { margin-top: auto; padding: 0 20px 32px; }
  .hint-tag { padding: 10px 16px; font-size: 10px; }
  .search-results-area { padding-bottom: 40px; }
  .results-eyebrow { padding: 16px 20px 10px; }
  .results-empty { padding: 40px 20px; }
  .search-spinner-wrap { padding: 80px 0; }
  .search-close-bottom {
    display: flex;
    justify-content: center;
    padding: 16px 0 36px;
    flex-shrink: 0;
  }
  .search-close-bottom button {
    display: flex; align-items: center; gap: 8px;
    background: none; border: 1px solid var(--border);
    font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .14em;
    color: var(--muted); padding: 12px 28px; cursor: pointer;
    transition: border-color .15s, color .15s;
  }
  .search-close-bottom button:hover { border-color: var(--rubric); color: var(--rubric); }

  /* Result rows: date-over-name instead of a fixed 150px date column that
     squeezed feast names into a 5-line ribbon. The row is the tap target, so
     the VIEW → tag is decoration and gets out of the way. */
  .result-row { flex-wrap: wrap; gap: 2px 12px; padding: 14px 20px; }
  .result-date { min-width: 0; width: 100%; font-size: 13px; }
  .result-name { flex: 1 1 auto; font-size: 18px; }
  .result-tag  { display: none; }
  .result-row.unavailable .result-tag { display: inline; width: 100%; margin-top: 4px; }

  /* Calendar */
  .cal-hdr { display: none; }
  /* The close bar lives inside the scrolling body; pin it to the bottom so
     a long week never hides the only way out. */
  .cal-close-bottom {
    display: flex; position: sticky; bottom: 0;
    background: var(--bg); padding: 12px 0 24px;
    border-top: 1px solid var(--border);
  }
  .cal-close-bottom button { padding: 12px 28px; background: var(--bg); }
  .cal-week-wrap { padding: 16px 12px 16px; }
  .cal-week-nav { gap: 6px; }
  .cal-arrow { width: 44px; height: 44px; }
  .cal-week-strip { gap: 3px; }
  .cwd-num { font-size: 16px; }
  .cwd-dow { font-size: 7px; }
  .cal-week-day { padding: 8px 2px; }
  .cal-saint-strip { padding: 16px 20px 0; }
  .css-row { flex-wrap: wrap; gap: 2px 12px; padding: 12px 0; }
  .css-date { min-width: 0; width: 100%; font-size: 13px; }
  .css-name { flex: 1 1 auto; font-size: 18px; }
  .css-tag  { display: none; }
  .css-row.unavail .css-tag { display: inline; width: 100%; margin-top: 2px; }
  .cal-view-body { justify-content: space-between; }

  /* Panel: full-screen slide-in from right */
  .panel {
    position: fixed;
    inset: 0;
    width: 100% !important;
    border-left: none;
    transform: translateX(100%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
    z-index: 100;
  }
  .panel.open { transform: translateX(0); }
  .panel-inner { width: 100%; }

  /* Nothing in the panel is pinned on a phone: the wrapper scrolls and the
     head (title, date, version, commemorations) flows away with the text.
     Only the close button floats, top-right, on a translucent disc so it
     stays legible over whatever line it lands on. */
  .panel-scroll { display: block; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .panel-body { flex: none; overflow: visible; padding: 20px 20px 72px; }
  .panel-head { padding: 14px 16px 0; }
  .panel-top-row { position: fixed; top: 6px; right: 6px; margin: 0; z-index: 10; }
  .btn-close {
    width: 44px; height: 44px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--text);
    background: rgba(250,247,242,.88); border-radius: 50%;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    box-shadow: 0 0 0 1px var(--border);
  }
  /* Progressive disclosure: three rows — short title, date, one tap line
     ("Settings • N Commemorations") — and everything else in the drawer. */
  .panel-svc { display: none; }
  .panel-svc-short { display: block; font-size: 13px; padding-right: 48px; line-height: 1.5; }
  .panel-date-str { font-size: 14px; line-height: 1.4; padding-right: 48px; }
  .panel-meta-row { display: none; }

  .panel-detail-toggle {
    margin-top: 4px; min-height: 44px; padding: 6px 0;
    border-top: none; gap: 10px;
  }
  .pdt-label, .pdt-icon { display: none; }
  .pdt-label-m {
    display: block; flex: 1;
    font-family: 'EB Garamond', serif; font-size: 15px; font-style: italic;
    line-height: 1.4; color: #5A5247;
  }
  .pdt-chev { display: block; flex-shrink: 0; color: var(--muted); transition: transform .2s ease, color .15s; }
  .panel-detail-toggle.open .pdt-chev { transform: rotate(180deg); color: var(--rubric); }
  .panel-detail-toggle.open .pdt-label-m { color: var(--rubric); }

  .panel-detail-body.open { max-height: 1600px; }
  .panel-detail-body-inner { border-top: 1px solid var(--border); padding: 6px 0 12px; }

  .pd-rows { display: flex; flex-direction: column; }
  .pd-row {
    display: flex; align-items: center; gap: 12px; min-height: 44px;
    background: none; border: none; padding: 0; width: 100%; text-align: left;
    border-bottom: 1px solid #EEE8DB; cursor: default; color: var(--text);
  }
  .pd-row[hidden] { display: none; }
  button.pd-row { cursor: pointer; }
  .pd-rows .pd-row:last-child { border-bottom: none; }
  .pd-key {
    width: 96px; flex-shrink: 0;
    font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .14em; color: var(--muted);
  }
  .pd-val { flex: 1; font-family: 'EB Garamond', serif; font-size: 15px; line-height: 1.3; color: var(--text); }
  .pd-go { flex-shrink: 0; color: var(--muted); }
  .pd-comms-head { display: block; margin-top: 10px; padding: 6px 0; letter-spacing: .16em; }
  .pd-comms-head[hidden] { display: none; }
  .p-saints { margin-bottom: 4px; }
}

/* ── PRINT STYLES ──────────────────────────────────────────────────────────── */
.print-header { display: none; }

/* ── HEADER SETTINGS BUTTON ────────────────────────────────────────────────── */

.header-settings {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px;
  display: flex; align-items: center;
  transition: color .15s;
}
.header-settings:hover { color: var(--rubric); }

/* ── VIEW: SETTINGS ───────────────────────────────────────────────────────── */

.view-settings {
  transform: translateY(32px); opacity: 0; pointer-events: none;
  transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .28s ease;
  z-index: 2;
  background: var(--bg);
}
.view-settings.visible {
  transform: translateY(0); opacity: 1; pointer-events: auto;
}

.settings-hdr {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 32px;
  flex-shrink: 0;
}

.settings-back {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .12em;
  color: var(--muted); padding: 4px 0;
  transition: color .15s;
}
.settings-back:hover { color: var(--rubric); }

.settings-body {
  flex: 1; overflow-y: auto;
  display: flex; justify-content: center;
  padding: 48px 32px 60px;
}

.settings-inner {
  width: 100%; max-width: 420px;
}

.settings-title {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .22em;
  color: var(--rubric); margin-bottom: 36px;
  text-transform: uppercase;
}

.settings-group {
  margin-bottom: 32px;
}

.settings-label {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .16em;
  color: var(--muted); margin-bottom: 8px;
  text-transform: uppercase;
}

.settings-desc {
  font-family: 'EB Garamond', serif; font-size: 15px; font-style: italic;
  color: var(--muted); line-height: 1.5;
  margin-bottom: 14px;
}

.settings-done {
  display: block; margin-top: 36px;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .14em;
  color: var(--surface); background: var(--rubric);
  border: 1.5px solid var(--rubric);
  padding: 11px 36px; cursor: pointer;
  transition: background .12s, color .12s;
}
.settings-done:hover { background: transparent; color: var(--rubric); }

.settings-segmented {
  display: inline-flex; border: 1.5px solid var(--border);
}

.seg-btn {
  background: none; border: none; cursor: pointer;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .1em;
  color: var(--muted); padding: 10px 24px;
  transition: background .12s, color .12s;
}
.seg-btn:not(:last-child) { border-right: 1.5px solid var(--border); }
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--rubric); color: var(--surface);
}

/* ── Settings: disabled group ─────────────────────────────────────────────── */
.settings-group.disabled {
  opacity: .35; pointer-events: none;
}
.settings-group.disabled .settings-desc::after {
  content: ' (available in Laity mode only)';
  font-style: normal; color: var(--muted);
}

/* ── Settings: translation picker (jurisdiction pills + version select) ───── */
.settings-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px;
}
.seg-btn-pill {
  background: none; border: 1.5px solid var(--border); cursor: pointer;
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .12em;
  color: var(--muted); padding: 7px 14px;
  text-transform: uppercase;
  transition: background .12s, color .12s, border-color .12s;
}
.seg-btn-pill:hover { color: var(--text); border-color: var(--muted); }
.seg-btn-pill.active {
  background: var(--rubric); color: var(--surface); border-color: var(--rubric);
}
.settings-select {
  display: block; width: 100%; max-width: 480px;
  font-family: 'EB Garamond', serif; font-size: 15px;
  color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border);
  padding: 9px 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
.settings-select:focus { outline: none; border-color: var(--rubric); }
.settings-input {
  display: block; width: 100%; max-width: 480px; box-sizing: border-box;
  font-family: 'EB Garamond', serif; font-size: 17px;
  color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border);
  padding: 9px 12px;
}
.settings-input:focus { outline: none; border-color: var(--rubric); }
.view-panikhida .settings-group { margin-bottom: 26px; }
.view-panikhida .settings-group.disabled { opacity: .35; pointer-events: none; }
.view-panikhida .settings-group.disabled .settings-desc::after { content: none; }
.settings-meta {
  margin-top: 10px;
  font-family: 'EB Garamond', serif; font-size: 13.5px; font-style: italic;
  color: var(--muted); line-height: 1.5;
  min-height: 1.4em;
}
.settings-meta .chain {
  font-style: normal; font-size: 11px; letter-spacing: .04em;
  color: var(--muted); margin-top: 4px;
  font-family: 'Cinzel', serif;
}

/* ── EDUCATION MODULE ────────────────────────────────────────────────────── */
.edu-module {
  margin: 0 0 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--rubric);
  background: color-mix(in srgb, var(--surface) 96%, var(--rubric));
  padding: 20px 24px 18px;
}
.edu-module-title {
  font-family: 'Cinzel', serif;
  font-size: 14px; letter-spacing: .04em;
  color: var(--rubric); margin-bottom: 2px;
}
.edu-module-subtitle {
  font-family: 'EB Garamond', serif;
  font-size: 14px; font-style: italic;
  color: var(--muted); margin-bottom: 14px;
}
.edu-module-body p {
  font-family: 'EB Garamond', serif;
  font-size: 16px; line-height: 1.6;
  color: var(--text); margin: 0 0 10px;
}
.edu-module-body p:last-child { margin-bottom: 0; }

/* timeline */
.edu-timeline {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.edu-timeline-label {
  font-family: 'Cinzel', serif;
  font-size: 9px; letter-spacing: .14em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 10px;
}
.edu-tl-item {
  display: flex; gap: 12px;
  font-family: 'EB Garamond', serif;
  font-size: 14px; line-height: 1.5;
  color: var(--text); margin-bottom: 8px;
}
.edu-tl-item:last-child { margin-bottom: 0; }
.edu-tl-date {
  flex-shrink: 0; width: 90px;
  font-weight: 600; color: var(--rubric);
  text-align: right;
}
.edu-tl-detail { flex: 1; }

/* scripture refs */
.edu-scripture {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.edu-scripture-label {
  font-family: 'Cinzel', serif;
  font-size: 9px; letter-spacing: .14em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 8px;
}
.edu-ref {
  font-family: 'EB Garamond', serif;
  font-size: 14px; line-height: 1.5;
  color: var(--text); margin-bottom: 4px;
}
.edu-ref-verse {
  font-weight: 600; color: var(--rubric);
  margin-right: 6px;
}


/* ── CHOIR MODE ───────────────────────────────────────────────────────────── */

.choir-toggles {
  display: none;
  padding: 10px 0 2px;
  flex-wrap: wrap; gap: 6px;
}
body.mode-choir .choir-toggles { display: flex; }

.choir-chip {
  font-family: 'Cinzel', serif; font-size: 8px; letter-spacing: .1em;
  color: var(--muted); padding: 5px 12px;
  border: 1px solid var(--border); background: none;
  cursor: pointer; transition: all .12s;
  text-transform: uppercase;
}
.choir-chip:hover { border-color: var(--gold); }
.choir-chip.active {
  background: var(--rubric); color: var(--surface);
  border-color: var(--rubric);
}

/* Tone badge for choir mode */
.tone-badge {
  display: inline-block;
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .08em;
  color: var(--rubric); border: 1px solid var(--rubric);
  padding: 1px 7px; margin-right: 6px;
  vertical-align: middle;
}

/* Source tag for choir mode */
.choir-source {
  font-family: 'Cinzel', serif; font-size: 8px; letter-spacing: .06em;
  color: var(--muted); font-style: italic;
  margin-left: 8px;
}

/* Choir mode: compact litany indicator */
.choir-litany {
  font-family: 'EB Garamond', serif; font-size: 14px;
  color: var(--muted); font-style: italic;
  padding: 4px 0;
}

/* Choir mode: service divider */
.choir-svc-divider {
  font-family: 'Cinzel', serif; font-size: 18px; letter-spacing: .12em;
  color: var(--rubric); text-align: center;
  padding: 28px 0 12px;
  border-bottom: 2px solid var(--gold);
  margin-bottom: 8px;
  text-transform: uppercase;
}

@media print {
  @page { size: letter; margin: 1in; }
  /* The app shell is `html, body { height: 100%; overflow: hidden }` so the
     three views can scroll independently. Left in place while printing, the
     output is CLIPPED TO ONE VIEWPORT-HEIGHT PAGE — WebKit does this strictly,
     which is how a 31-sheet booklet printed from an iPhone came out as a
     single empty page; Chromium tolerated it, so neither page.pdf() nor the
     e2e suite caught it. The old rules reset `body`'s overflow but neither
     element's height, and `html` not at all. Found 2026-10-11 on staging. */
  html, body { height: auto !important; overflow: visible !important; }
  /* The panel's own scroll chain clips print the same way. `.panel-scroll` is
     the PHONE scroll container (display:contents on desktop), which is why
     Standard print worked at a desk and produced one clipped page on a phone
     — for the whole time the print button was hidden there, so nobody could
     find it. Measured before this: #p-body 30681px of content inside a
     0-height .panel-scroll. Found 2026-10-11. */
  .layout, .panel-inner, .panel-scroll {
    height: auto !important; max-height: none !important; overflow: visible !important;
  }
  .view-search, .view-cal, .view-settings, header, .center-bar, .service-list-body, .panel-head { display: none !important; }
  .choir-toggles { display: none !important; }
  .tone-badge { border-color: #333; color: #333; }
  .choir-svc-divider { border-color: #8B1A1A; color: #8B1A1A; }
  .print-header { display: block; margin-bottom: 1.5em; }
  .print-header-svc { font-family: var(--font-sans, sans-serif); font-size: 10pt; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #8B1A1A; }
  .print-header-date { font-family: var(--font-sans, sans-serif); font-size: 9pt; color: #555; margin-top: 2px; }
  .view-main { position: static; }
  .layout { display: block; }
  /* On a phone the panel is `position: fixed` with a slide-in transform.
     Out of flow, WebKit prints it on the first page only and never paginates
     it — the same fault the booklet had — so the whole service came out as one
     clipped page. Both must be reset for print. */
  .panel {
    width: 100% !important; border: none; overflow: visible;
    position: static !important; transform: none !important;
  }
  .panel-inner { width: 100%; }
  .panel-body { overflow: visible; padding: 0; }
  body { background: white; font-size: 12pt; overflow: visible; }
  /* Widow/orphan protection: keep headings with their content */
  .svc-head { break-after: avoid; }
  /* Keep short content units together; allow long blocks (psalm, litany) to split */
  .prayer, .rubric, .instruction { break-inside: avoid; }
  .stich-label { break-after: avoid; }
  .svc-rule { background: none; border-top: 1px solid #8B1A1A; }
}

/* ── PARISH ADMIN FORM PATTERNS ──
   Used by /parish-admin/<slug>. Reuses the parchment-document tokens; adds
   three small primitives that other forms can adopt. */

.pa-field-label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 10px; letter-spacing: .14em; color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.pa-field-input,
.pa-field-textarea {
  width: 100%;
  font-family: 'EB Garamond', serif;
  font-size: 15px; line-height: 1.45; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.pa-field-textarea { resize: vertical; min-height: 64px; }
.pa-field-input:focus,
.pa-field-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,.18);
}
.pa-field-input:disabled {
  color: var(--muted); background: rgba(221,213,196,.25); cursor: not-allowed;
}
.pa-field-help {
  font-family: 'EB Garamond', serif;
  font-size: 12px; font-style: italic; color: var(--muted);
  margin-top: 6px;
}
.pa-field-error {
  font-family: 'EB Garamond', serif;
  font-size: 13px; color: var(--rubric);
  margin-top: 6px;
}
.pa-field-derived {
  font-family: 'EB Garamond', serif;
  font-size: 13px; font-style: italic; color: var(--muted);
  margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--gold);
}

/* Primary button — extends bar-btn pattern with filled rubric. */
.bar-btn--primary {
  background: var(--rubric); color: var(--surface);
  border-color: var(--rubric);
}
.bar-btn--primary:hover,
.bar-btn--primary:focus {
  background: #6b1414; color: var(--surface); border-color: #6b1414;
}
.bar-btn--primary:disabled { opacity: .5; cursor: not-allowed; }

/* Toggle (used for confessFirst). Native checkbox styled minimally. */
.pa-toggle {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  font-family: 'EB Garamond', serif; color: var(--text); cursor: pointer;
}
.pa-toggle input { margin-top: 4px; accent-color: var(--rubric); }
.pa-toggle .pa-toggle-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pa-toggle .pa-toggle-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.pa-toggle .pa-toggle-label { font-size: 15px; line-height: 1.35; }
.pa-toggle .pa-toggle-detail { font-size: 13px; color: var(--muted); font-style: italic; line-height: 1.45; }
.pa-toggle-default {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .14em;
  color: var(--muted); text-transform: uppercase;
  white-space: nowrap; flex-shrink: 0;
}

/* Tri-state rubric — a <select>, not a checkbox, because "unset" is a real
   third choice. Sits among .pa-toggle rows, so it borrows their rhythm. */
.pa-tristate { padding: 10px 0; font-family: 'EB Garamond', serif; color: var(--text); }
.pa-tristate .pa-toggle-head { margin-bottom: 6px; }
.pa-tristate .pa-field-input { margin-top: 2px; }
.pa-tristate .pa-toggle-detail { display: block; margin-top: 6px; }
/* The chosen option's own consequence, spelled out under the control. */
.pa-tristate .pa-tristate-effect {
  font-family: 'EB Garamond', serif;
  font-size: 13px; font-style: italic; color: var(--muted);
  margin-top: 8px; padding-left: 12px; border-left: 2px solid var(--gold);
}

/* Toast — bottom-right, gold left-border on success / rubric on error. */
.toast {
  position: fixed; right: 24px; bottom: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-left-width: 4px;
  padding: 12px 16px;
  font-family: 'EB Garamond', serif; font-size: 14px; color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  max-width: 360px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--success { border-left-color: var(--gold); }
.toast--error   { border-left-color: var(--rubric); color: var(--rubric); }
.toast a { color: inherit; text-decoration: underline; }

/* Parish admin: typeahead, selected box, multi-checkbox list. */
.pa-typeahead {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-top: none;
  max-height: 280px; overflow-y: auto;
  z-index: 50;
}
.pa-typeahead-row {
  padding: 8px 12px; cursor: pointer;
  font-family: 'EB Garamond', serif; font-size: 14px;
  display: flex; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.pa-typeahead-row:last-child { border-bottom: none; }
.pa-typeahead-row:hover, .pa-typeahead-row.is-active {
  background: rgba(201,168,76,.10); color: var(--text);
}
.pa-typeahead-row .pa-feast { color: var(--muted); font-style: italic; font-size: 12px; flex-shrink: 0; }
.pa-typeahead-empty {
  padding: 8px 12px;
  font-family: 'EB Garamond', serif; font-size: 13px; font-style: italic;
  color: var(--muted);
}

.pa-selected-box {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--gold);
  font-family: 'EB Garamond', serif; font-size: 15px;
}
.pa-selected-box .pa-feast { color: var(--muted); font-style: italic; font-size: 13px; }
.pa-selected-box .pa-link-btn { margin-left: auto; }
.pa-link-btn {
  background: none; border: none; padding: 0;
  font-family: 'Cinzel', serif; font-size: 10px; letter-spacing: .12em;
  color: var(--muted); cursor: pointer; text-transform: uppercase;
}
.pa-link-btn:hover { color: var(--rubric); }

.pa-checkboxes { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 6px; }
.pa-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'EB Garamond', serif; font-size: 14px; color: var(--text); cursor: pointer;
}
.pa-check input { accent-color: var(--rubric); }


/* ── BOOKLET ───────────────────────────────────────────────────────────────
   Saddle-stitch booklet printing, rendered in THIS document (it used to run in
   a popup, which phones block). Driven by public/scripts/booklet.js.

   Everything below is scoped to #bk-root on purpose: the booklet restyles
   .svc-head, .rubric, .svc-rule and `*` for print, and unscoped those rules
   would repaint the live service panel the moment this file loaded.

   #bk-root is parked off-screen rather than hidden, because pagination
   measures real rendered heights inside it. display:none would zero them. */

/* Parked with a zero-height clip rather than position:fixed/absolute.
   WebKit prints a fixed-position element on the FIRST PAGE ONLY and does not
   paginate it — parked at left:-10000px that is exactly one empty page, which
   is what an iPhone produced for a 31-sheet booklet. Out of flow is the
   problem; a zero-height clipping box keeps the subtree in normal flow (so it
   paginates) while taking no space and showing nothing, and children still
   have real measurable geometry. */
#bk-root { position: relative; height: 0; overflow: hidden; }

#bk-root *, #bk-root *::before, #bk-root *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Measure container (off-screen, matches page content width + font) ── */
#bk-measure { display: none; position: absolute; top: -9999px; left: 0; width: 4.5in;
  font-family: 'EB Garamond', Georgia, serif; font-size: 15pt; line-height: 1.75;
  height: auto; overflow: visible; padding: 0; }

/* ── Booklet spreads (one per print page = landscape letter sheet) ── */
#bk-sheets { visibility: hidden; }

#bk-root .bk-spread {
  width: 11in; height: 8.5in;
  display: flex;
  break-after: page;
}
#bk-root .bk-spread:last-child { break-after: auto; }
#bk-root .bk-spread.rotated {
  transform: rotate(180deg);
  transform-origin: center center;
}

#bk-root .bk-half {
  width: 5.5in; height: 8.5in;
  padding: 0.45in 0.5in;
  overflow: hidden; position: relative;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 15pt; line-height: 1.75; color: var(--text);
  flex-shrink: 0;
}

/* ── Hide dev-mode elements ── */
#bk-root .src-tag, #bk-root .tone-badge, #bk-root .choir-source { display: none !important; }
#bk-root $ {activeEducation !== 'on' ? '.edu-module { display: none !important; }' : ''}

/* ── Booklet title ── */
#bk-root .bk-title {
  font-family: 'Cinzel', serif; font-size: 12pt; letter-spacing: .2em;
  text-align: center; color: var(--text); text-transform: uppercase;
  margin-bottom: 4px; padding-top: 0.15in;
}
#bk-root .bk-subtitle {
  font-family: 'EB Garamond', Georgia, serif; font-size: 9pt;
  text-align: center; color: var(--muted);
  margin-bottom: 20px;
}

/* ── Service content ── */
/* A heading belongs to what FOLLOWS it, so the space above must beat the
   space below or the eye cannot tell which section it introduces. This had
   `margin-top: 4px; margin-bottom: 10px` — and because the preceding
   paragraph's 8px bottom margin collapses against that 4px, the real gap was
   8px above against 10px below: the heading sat marginally closer to the
   section it had just ENDED. The static renderer always had this right
   (`.section-head { margin: 18px 0 8px }`); the live booklet did not.

   NOT scoped with `:first-child` to drop the top margin at the head of a
   page, however obviously that reads. `paginate()` measures each item alone
   in a probe div, where every heading IS a first child — the probe would
   measure 0 top margin while the page renders 22px, under-measuring every
   heading and overflowing the page. Measurement and render have to see the
   same box. A page that opens on a heading simply carries the margin. */
#bk-root .svc-head {
  font-family: 'Cinzel', serif; font-size: 10pt; letter-spacing: .18em;
  text-align: center; color: var(--text); margin-top: 22px; margin-bottom: 6px;
  break-after: avoid;
}
/* The renderer emits a .svc-rule between sections and the app panel draws it
   as a gold line. In the booklet it is redundant — the centered small-caps
   heading already marks the section — and it is not free: 80 rules at 13px
   cost ~1040px, about a page and a half of a booklet. Hidden rather than
   removed from the renderer, which the panel still uses. */
#bk-root .svc-rule { display: none; }
#bk-root .rubric {
  font-family: 'EB Garamond', Georgia, serif; font-size: 13pt;
  font-style: italic; color: var(--rubric);
  margin-bottom: 5px; line-height: 1.5;
  break-inside: avoid;
}
#bk-root .instruction {
  font-family: 'EB Garamond', Georgia, serif; font-size: 13pt;
  font-style: italic; color: var(--muted);
  margin-bottom: 4px; line-height: 1.5;
}
#bk-root .prayer {
  font-family: 'EB Garamond', Georgia, serif; font-size: 15pt;
  line-height: 1.75; color: var(--text); margin-bottom: 8px;
  break-inside: avoid;
}
/* The id raises specificity above `.prayer.compact` and `.prayer.fine`, so
   the booklet needs its OWN step for each or the density tier is inert here.
   `.fine` had one; `.compact` did not, and the result was that every block
   tagged `compact` — the whole anaphora, both readings — printed at full body
   size in italic: the half-applied style was worse than no style at all.
   Found 2026-10-31 by probing computed styles in the rendered booklet.

   Unlike the panel, the booklet's `.compact` is ROMAN, not italic. In the
   panel it marks a short reading; here it carries multi-page runs (psalmody,
   litany petitions), and a page of italic is harder to read in a dim nave
   than the size step alone. The size step is doing the hierarchy work. */
/* 11.5pt against the 15pt body, not 12.5. Measured 2026-10-31 across the
   whole ladder (12.5 / 12 / 11.5 / 11 / 10.5 / 10): 12 buys nothing, 11.5 is
   where Great Vespers crosses 28 pages into 7 sheets, and 11 and 10.5 buy
   nothing further. The next real stop is 10pt, which takes the Liturgy from
   14 sheets to 13 — rejected for now: 10pt EB Garamond is two thirds of the
   body size, and this is read standing, in a nave, in low light. */
#bk-root .prayer.compact {
  font-size: 11.5pt; font-style: normal; line-height: 1.5; margin-bottom: 6px;
}
#bk-root .prayer.cue {
  font-size: 10.5pt; font-style: italic; color: var(--muted);
  line-height: 1.3; margin-bottom: 3px;
}
/* Kept strictly below `cue` so the ladder reads in one direction: the smaller
   the type, the less the pew is expected to do with it. */
#bk-root .prayer.fine {
  font-size: 10pt; font-style: italic; color: var(--muted); line-height: 1.5;
}
#bk-root .stich-label {
  font-family: 'EB Garamond', Georgia, serif; font-size: 13pt;
  font-style: italic; color: var(--muted); margin-bottom: 4px;
  break-after: avoid;
}
#bk-root .verse {
  font-family: 'EB Garamond', Georgia, serif; font-size: 13pt;
  font-style: italic; color: var(--muted); margin-bottom: 6px; line-height: 1.5;
}
#bk-root .spk { display: inline; font-weight: 600; font-style: normal; color: var(--rubric); }
/* Print cues (features/beatitudes-print-cues.md): a Reader's troparion
   printed as one indented line under the verse it follows. The verses
   themselves print as `.prayer.sung`, which takes the body size above —
   no separate size rule, so no new tier to keep in step across surfaces. */
#bk-root .print-cue { padding-left: 1.4em; margin-bottom: 7px; }
.print-cue { padding-left: 1.4em; }

/* ── Education modules (booklet) ── */
#bk-root .edu-module {
  margin: 8px 0; padding: 12px 14px 10px;
  border: 0.5pt solid var(--gold); border-left: 2pt solid var(--rubric);
  background: #faf8f4;
}
#bk-root .edu-module-title {
  font-family: 'Cinzel', serif; font-size: 9pt; letter-spacing: .06em;
  color: var(--rubric); margin-bottom: 1px;
}
#bk-root .edu-module-subtitle {
  font-family: 'EB Garamond', Georgia, serif; font-size: 10pt;
  font-style: italic; color: var(--muted); margin-bottom: 8px;
}
#bk-root .edu-module-body p {
  font-family: 'EB Garamond', Georgia, serif; font-size: 11pt;
  line-height: 1.5; color: var(--text); margin: 0 0 6px;
}
#bk-root .edu-module-body p:last-child { margin-bottom: 0; }
#bk-root .edu-timeline {
  margin-top: 8px; padding-top: 8px;
  border-top: 0.5pt solid var(--gold);
}
#bk-root .edu-timeline-label, #bk-root .edu-scripture-label {
  font-family: 'Cinzel', serif; font-size: 7pt; letter-spacing: .12em;
  color: var(--muted); text-transform: uppercase; margin-bottom: 5px;
}
#bk-root .edu-tl-item {
  display: flex; gap: 8px;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 10pt; line-height: 1.4;
  color: var(--text); margin-bottom: 4px;
}
#bk-root .edu-tl-item:last-child { margin-bottom: 0; }
#bk-root .edu-tl-date { flex-shrink: 0; width: 70px; font-weight: 600; color: var(--rubric); text-align: right; }
#bk-root .edu-tl-detail { flex: 1; }
#bk-root .edu-scripture { margin-top: 8px; padding-top: 6px; border-top: 0.5pt solid var(--gold); }
#bk-root .edu-ref {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 10pt; line-height: 1.4; color: var(--text); margin-bottom: 2px;
}
#bk-root .edu-ref-verse { font-weight: 600; color: var(--rubric); margin-right: 4px; }

/* ── Test page ── */
#bk-root .test-page {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif; font-size: 48pt; color: var(--muted);
  border: 2px dashed #ccc;
}
#bk-root .test-page span { display: block; }


@media print {
  /* Standard print and booklet print are mutually exclusive outputs. */
  body:not(.bk-printing) #bk-root { display: none !important; }

  /* The printing state is also forced inline from JS (booklet.js) — these
     rules are the belt, that is the braces. Relying on a media query to
     un-hide the only thing being printed is a single point of failure, and
     the failure mode is a blank page with nothing to debug. */
  body.bk-printing #bk-root  { height: auto; overflow: visible; }
  body.bk-printing #bk-sheets { visibility: visible; }
  body.bk-printing #bk-measure { display: none !important; }
  body.bk-printing .view,
  body.bk-printing header,
  body.bk-printing .center-bar,
  body.bk-printing .print-header { display: none !important; }
  body.bk-printing { background: #fff; }
}
