/* ==========================================================================
   LITURGIA DIURNA - styles
   A traditional, "missal / breviary" look: parchment tones, blackletter
   display headings, Roman-capital labels, and a serif body.

   Fonts are loaded from Google Fonts. To run fully offline, download the three
   families and replace the @import below with local @font-face rules.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=UnifrakturMaguntia&family=Cinzel:wght@400;500;600;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

:root {
  --font-black: 'UnifrakturMaguntia', 'Blackletter', 'Old English Text MT', serif;
  --font-display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --font-body: 'EB Garamond', Georgia, 'Times New Roman', serif;

  /* parchment (light) */
  --bg: #eee4c8;
  --bg-1: #efe6cd;
  --bg-2: #e4d6ad;
  --surface: #fbf4e3;
  --surface-2: #f1e6cc;
  --text: #2a2117;
  --muted: #6f5c3e;
  --line: #d8c79e;
  --line-strong: #b39a63;
  --accent: #7d1f2c;          /* deep crimson */
  --accent-soft: #efdcc9;
  --gold: #a9761f;
  --good: #38613a;
  --warn: #96571a;
  --badge-bg: #eadfc4;
  /* source bubble colours (light) - one per place in the books */
  --src-proper: #8a5a00;
  --src-common: #5a2a8a;
  --src-psalter: #1a5a8a;
  --src-season: #1a6a3a;
  --src-office: #0a6a6a;
  --shadow: 0 1px 3px rgba(64, 42, 10, 0.18);
  --radius: 4px;
}

[data-theme="dark"] {
  --bg: #171209;
  --bg-1: #161209;
  --bg-2: #20180e;
  --surface: #221b10;
  --surface-2: #2b2213;
  --text: #eee1c4;
  --muted: #a7936f;
  --line: #443821;
  --line-strong: #6b5527;
  --accent: #c86a76;
  --accent-soft: #3a2228;
  --gold: #d3a559;
  --good: #6f9c6f;
  --warn: #d29a4c;
  --badge-bg: #2c2414;
  /* source bubble colours (dark) - one per place in the books */
  --src-proper: #d9b25a;
  --src-common: #b88ad9;
  --src-psalter: #7aa8d9;
  --src-season: #7ac98a;
  --src-office: #5ab8b8;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

[hidden] { display: none !important; }

body {
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  font-size: 17px;
  transition: background 0.25s ease, color 0.25s ease;
}

/* The page background is a fixed radial gradient. background-attachment: fixed
   is not honoured on iOS Safari and makes scrolling janky there - and the fixed
   "Top" button layered over it made that worse. A fixed pseudo-element paints the
   same gradient, stays put while the page scrolls, and avoids the bug. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% -20%, var(--bg-1), var(--bg-2));
}

/* ---- top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.topbar-inner { padding: 14px 18px 2px; text-align: center; }
.app-title {
  margin: 0;
  font-family: var(--font-black);
  font-weight: normal;
  font-size: 2rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  line-height: 1.1;
}
.app-subtitle {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  align-items: center;
  padding: 12px 18px 14px;
}

/* ---- section navigation ----
   A chip per section, in the sticky bar. The bar's own height is written to
   --topbar-h by trackTopbarHeight(), and every card clears that much when it is
   scrolled to, so a section's heading never lands under the bar. */
.section-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 0 18px 10px;
  border-top: 1px solid var(--line);
  margin-top: 2px;
  padding-top: 8px;
}
.section-chip {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.section-chip:hover { color: var(--accent); border-color: var(--line-strong); }
.section-chip.is-current {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.section-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card { scroll-margin-top: calc(var(--topbar-h, 8rem) + 10px); }
/* Headings are anchor targets too: the explorer scrolls to the heading of whichever
   view it is showing, and any engine-level scroll to a heading should clear the bar
   as well. scroll-margin-top does that wherever scrollIntoView is the mechanism, and
   is the belt to scrollJustBelowBar()'s braces (which measures and clamps). */
.card h2,
.card h3,
.bible-count { scroll-margin-top: calc(var(--topbar-h, 8rem) + 10px); }
.btn {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.top-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.date-input {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

/* ---- layout ---- */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 5px var(--line), var(--shadow);
  border-radius: var(--radius);
  padding: 24px 26px;
}


/* ---- ornaments & headings ---- */
.ornament {
  text-align: center;
  color: var(--accent);
  font-size: 1.15rem;
  line-height: 1;
  margin: 10px 0 14px;
}
.ornament::before, .ornament::after {
  content: "";
  display: inline-block;
  width: 72px;
  height: 1px;
  background: var(--line-strong);
  vertical-align: middle;
  margin: 0 14px;
}
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  color: var(--accent);
  margin: 0 0 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-strong);
}
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 18px 0 8px;
}
.small { color: var(--muted); font-size: 0.82rem; }

/* ---- header card ---- */
.header-card .feast-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.28;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin: 0 0 4px;
  text-align: center;
}
.header-card .feast-date {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin: 0;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}
.badge {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--line-strong);
}
.badge.rank { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.color-dot {
  display: inline-block;
  width: 0.8em; height: 0.8em;
  border-radius: 50%;
  vertical-align: baseline;
  margin-right: 5px;
  border: 1px solid rgba(0, 0, 0, 0.3);
}
.theme-text { color: var(--muted); font-style: italic; margin: 6px 0 0; text-align: center; }
.theme-text::before {
  content: "Theme of the day: ";
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent);
}

/* ---- glance grid (definition list) ---- */
.glance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
}
.glance-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 13px;
  margin: 0;
}
.glance-item dt {
  font-family: var(--font-display);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.glance-item dd {
  margin: 6px 0 0;
  font-size: 1.05rem;
  font-weight: 500;
}
.colour-value { display: inline-flex; align-items: center; gap: 8px; }
.colour-value .color-dot { margin-right: 0; vertical-align: middle; width: 0.85em; height: 0.85em; }

/* ---- mass ---- */
.reading-list { list-style: none; padding: 0; margin: 8px 0; }
.reading-list li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.reading-list li:last-child { border-bottom: 0; }
.reading-list .rl-label { font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; }
.reading-preview { margin: 4px 0 2px 4px; padding: 2px 0 2px 10px; border-left: 2px solid var(--line); }
.reading-preview-verse { margin: 0; font-size: 0.95rem; }
.reading-more { background: none; border: 0; padding: 0; margin-top: 4px; color: var(--accent); cursor: pointer; font: inherit; font-size: 0.85rem; text-decoration: underline dotted; text-underline-offset: 2px; }

/* The weekday readings offered alongside a memorial's, where the Church allows
   either (General Introduction to the Lectionary n. 83). */
.mass-alt {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.mass-alt-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  margin: 0 0 3px;
}
.mass-alt .reading-list { margin: 4px 0 0; }
.mass-alt .reading-list li { padding: 5px 0; }
.mass-alt .small { margin: 6px 0 0; }

/* a one-line note above the readings saying whose they are (proper vs ferial) */
.mass-source { color: var(--muted); font-style: italic; margin: 8px 0 2px; }

/* the collapsible Order of Mass */
.mass-order { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.mass-order summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; color: var(--text); }
.mass-order summary:hover { color: var(--accent); }
.mass-order-body { margin-top: 8px; }
.mass-order-part { font-family: var(--font-display); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 4px; }
.mass-order-list { list-style: none; padding: 0; margin: 0 0 4px; }
.mass-order-list li { padding: 5px 0; border-bottom: 1px dotted var(--line); font-size: 0.95rem; }
.mass-order-list li:last-child { border-bottom: 0; }
.mo-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mo-tag { color: var(--muted); font-size: 0.82rem; font-style: italic; white-space: nowrap; }
.mo-right { display: flex; align-items: baseline; gap: 8px; }
.mo-posture { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.mo-cite { margin: 2px 0 2px 14px; font-size: 0.95rem; }
.mo-details { margin: 0; }
.mo-summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.mo-summary::-webkit-details-marker { display: none; }
.mo-summary .mo-item { color: var(--accent); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.mo-latin { margin: 5px 0 2px; font-style: italic; color: var(--muted); font-size: 0.9rem; }
.mo-english { margin: 0 0 3px; }


/* ---- hours ---- */
.hour-list { list-style: none; margin: 0; padding: 0; }
.hour-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 10px 0;
  padding: 13px 15px;
  background: var(--surface);
}
.hour-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.hour-title { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; letter-spacing: 0.04em; }
.hour-meta { color: var(--muted); font-size: 0.8rem; }
.override-tag {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.override-psalter { background: var(--good); color: #fff; }
.override-proper { background: var(--warn); color: #fff; }
.override-sunday1 { background: var(--gold); color: #fff; }
.override-fixed { background: var(--accent); color: #fff; }
.cites { margin: 9px 0 0; font-size: 0.94rem; }
.cites .cite-label { font-family: var(--font-display); font-weight: 600; font-size: 0.86rem; }
.notes { color: var(--muted); font-size: 0.82rem; margin: 6px 0 0; padding-left: 18px; }
.notes li { margin: 3px 0; }

/* Where an Hour's antiphons are to be found - a pointer to the book, never the
   antiphon text itself. */
.antiphons { margin-top: 4px; }
.antiphons .cite-label { color: var(--muted); }
.source-line { font-size: 0.78rem; color: var(--muted); margin-top: 7px; }
.source-line .k { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.04em; color: var(--text); }

/* ---- sacred art ---- */
.sacred-art { margin: 0; text-align: center; }
.sacred-art img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 440px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sacred-art figcaption {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 9px;
  line-height: 1.4;
}
.sacred-art figcaption a { color: var(--accent); text-decoration: none; }
.sacred-art figcaption a:hover { text-decoration: underline; }
/* Where more than one picture is held for the day, the reader picks. Kept as a
   wrapped row of small chips under the caption, so it never scrolls sideways. */
.art-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}
.art-options-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.art-option {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.art-option:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.art-option.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.art-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- tappable scripture citations ---- */
.cite-btn {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px dotted var(--line-strong);
  border-radius: 2px;
  -webkit-tap-highlight-color: transparent;
}
.cite-btn:hover { color: var(--accent); border-bottom-color: var(--accent); }
.cite-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- passage light box (tap a citation to read it) ---- */
body.passage-open { overflow: hidden; }
.passage {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.passage-backdrop { position: absolute; inset: 0; background: rgba(20, 12, 4, 0.62); }
.passage-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 660px;
  max-height: 88vh;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.passage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.passage-title { font-family: var(--font-display); font-size: 1rem; margin: 0; letter-spacing: 0.04em; }
.passage-close {
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius);
}
.passage-close:hover { color: var(--text); }
.passage-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
  font-size: 1.02rem;
  line-height: 1.62;
}
.passage-chapter {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 6px;
}
.passage-verse { margin: 0 0 8px; }
.passage-num {
  font-family: var(--font-display);
  font-size: 0.68rem;
  vertical-align: super;
  color: var(--accent);
  margin-right: 5px;
  font-weight: 600;
}
.passage-foot { border-top: 1px solid var(--line); padding: 9px 16px 14px; }
.passage-foot .small { margin: 4px 0 0; }
.passage-credit a { color: var(--accent); }
.passage-loading { font-style: italic; }

@media (min-width: 641px) {
  .passage { align-items: center; }
  .passage-panel { border-radius: 10px; max-height: 84vh; }
}

/* ---- psalter: cards and label/value rows, so nothing scrolls sideways ---- */
.psalter-days {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  margin: 10px 0 18px;
}
.psalter-day {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
}
.psalter-day.today { border-color: var(--accent); background: var(--accent-soft); }
.psalter-day-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  margin: 0 0 6px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.psalter-today {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 2px 7px;
}
.psalter-rows { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; align-items: baseline; }
.psalter-rows dt {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.psalter-rows dd { margin: 0; font-size: 0.9rem; }
.psalter-sub {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  margin: 18px 0 4px;
}

/* On a phone each label sits above its references instead of squeezing them. */
@media (max-width: 560px) {
  .psalter-rows { grid-template-columns: 1fr; gap: 1px; }
  .psalter-rows dt { margin-top: 7px; }
  .psalter-rows dd { margin-bottom: 2px; }
}

/* ---- sources ---- */
.sources-list { font-size: 0.86rem; }
.sources-list li { margin: 6px 0; }
code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
}

.foot {
  color: var(--muted);
  font-style: italic;
  font-size: 0.82rem;
  text-align: center;
  padding: 4px 6px 24px;
}

@media (max-width: 520px) {
  .controls { gap: 6px; }
  .btn { padding: 7px 9px; }
  .card { padding: 18px 16px; }
  .feast-name { font-size: 1.25rem; }
  /* The bar is sticky, so on a phone it has to stay small: a shorter title, no
     subtitle, and the chips on one scrollable line rather than four wrapped ones.
     Without this the sticky part alone would take a quarter of the screen. */
  .topbar-inner { padding: 9px 12px 0; }
  .app-title { font-size: 1.4rem; }
  .app-subtitle { display: none; }
  .controls { padding: 8px 12px 9px; }
  .section-nav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 7px 12px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .section-nav::-webkit-scrollbar { display: none; }
  .section-chip { padding: 5px 8px; }
}

/* ---- the prayed mark on the day's Hours ---- */
.pray-tally { margin: 6px 0 10px; }
.hour-prayed {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--good);
}
.hour-card.is-prayed { border-left: 3px solid var(--good); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hour-mark.on { color: var(--good); border-color: var(--good); }

/* ==========================================================================
   THE PRAY VIEW - one Hour, read straight through
   A full page, not a modal: the browser's own scroll, the back gesture and
   printing all behave. Everything here is typography for praying rather than
   for browsing: the reader's eye should never have to hunt for what is next.
   ========================================================================== */
body.pray-open { overflow: hidden; }
.pray {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.pray-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
}
.pray-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.pray-rail {
  overflow-x: auto;
  padding: 7px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.pray-nav { display: inline-flex; gap: 6px; }
.pray-chip {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  white-space: nowrap;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
}
.pray-chip:hover { background: var(--accent-soft); }
.pray-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  overflow-anchor: none;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 22px 20px 70px;
  font-size: 1.05rem;
  line-height: 1.62;
}
.pray-body.pray-lg { font-size: 1.18rem; }
.pray-body.pray-xl { font-size: 1.34rem; line-height: 1.7; }
.pray-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--line-strong);
}
.part { margin: 0 0 26px; }
.part-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.part-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}
.part-cite { font-size: 0.84rem; color: var(--muted); }
.tier-badge {
  margin-left: auto;
  padding: 1px 8px;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--badge-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.tier-traditional, .tier-from-psalm { color: var(--warn); border-color: var(--warn); }
.tier-local { color: var(--accent); border-color: var(--accent); }
.part-source {
  margin-left: 4px;
  padding: 1px 8px;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--badge-bg);
  border: 1px solid var(--accent);
  border-radius: 999px;
}
/* One colour per place in the books, so a glance tells where each part comes from. */
.part-source.source-proper { color: var(--src-proper); border-color: var(--src-proper); }
.part-source.source-common { color: var(--src-common); border-color: var(--src-common); }
.part-source.source-psalter { color: var(--src-psalter); border-color: var(--src-psalter); }
.part-source.source-season { color: var(--src-season); border-color: var(--src-season); }
.part-source.source-office { color: var(--src-office); border-color: var(--src-office); }
.part-source.source-pointer { color: var(--muted); border-color: var(--line-strong); }
.part-source.source-local { color: var(--accent); border-color: var(--accent); }
.hour-source-list { margin: 8px 0 0; }
.hour-source-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.hour-source-row .part-source { margin-left: 0; }
.hour-source-label { font-size: 0.82rem; color: var(--text); }
.part-tier-note { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }
.rubric { color: var(--accent); font-style: italic; }
.antiphon { font-style: italic; margin: 0 0 10px; }
.antiphon-block { margin: 4px 0 12px; padding: 6px 10px; border-left: 2px solid var(--line); }
.antiphon-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ant-label {
  font-family: var(--font-display);
  font-style: normal;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.antiphon-repeat { color: var(--muted); }
.ant-src {
  margin-left: 6px;
  font-family: var(--font-display);
  font-style: normal;
  font-size: 0.64rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.verse { margin: 0 0 6px; }
.verse-num { margin-right: 0.35em; font-size: 0.68rem; color: var(--muted); vertical-align: 0.28em; }
.doxology { font-style: italic; margin: 10px 0 10px; }
.versicle { margin: 0 0 3px; }
.response { margin: 0 0 8px; font-weight: 600; }
.hymn-title { margin: 0 0 4px; font-size: 0.84rem; color: var(--muted); }
.hymn-first { margin: 0 0 8px; font-family: var(--font-display); font-size: 0.95rem; }
.marian-title { margin: 0 0 8px; font-family: var(--font-display); }
.marian-antiphon { margin: 0 0 12px; font-style: italic; }
.part-note { margin: 10px 0 0; font-size: 0.8rem; font-style: italic; color: var(--muted); }
.pray-open-btn { margin-top: 10px; }
@media print {
  .pray-head, .pray-rail, .pray-foot { display: none; }
  .pray { position: static; }
  .pray-body { overflow: visible; max-width: none; padding: 0; }
  .section-nav, .controls { display: none; }
  .topbar { position: static; }
}

/* ---- the Bible explorer ----
   A book list, a chapter grid, a chapter, and a search over the whole canon. The
   text is the World English Bible (Catholic); the look is the page's own. */
.bible-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 6px; }
.bible-query {
  flex: 1 1 15rem;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.bible-scope {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 8px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.bible-crumbs { margin: 3px 0 12px; }
.bible-crumb-link {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px dotted var(--line-strong);
}
.bible-crumb-link:hover { border-bottom-color: var(--accent); }
.bible-testament {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 18px 0 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.bible-group {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 6px;
}
.bible-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.bible-book {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-width: 9rem;
}
.bible-book:hover { border-color: var(--accent); background: var(--accent-soft); }
.bible-book-name { font-family: var(--font-display); font-size: 0.82rem; letter-spacing: 0.03em; }
.bible-book-meta { font-size: 0.7rem; color: var(--muted); }
.bible-book-title { margin: 14px 0 2px; }
.bible-chapter-grid { max-width: 100%; }
.bible-chapter {
  min-width: 2.4rem;
  padding: 6px 4px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.bible-chapter:hover { border-color: var(--accent); background: var(--accent-soft); }
.bible-chapter-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
}
.bible-chapter-title { margin: 0; }
.bible-step { white-space: nowrap; }
.bible-verses { margin: 0 0 10px; }
.bible-verse { margin: 0 0 8px; }
.bible-verse.is-target {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 4px 6px;
  margin-left: -9px;
}
.bible-verse-num {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  vertical-align: super;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0 5px 0 0;
  cursor: pointer;
}
.bible-verse-num:hover { text-decoration: underline; }
.bible-liturgy { margin: 10px 0 0; }
.bible-count { margin: 10px 0; }
.bible-results { display: flex; flex-direction: column; gap: 4px; }
.bible-hit-item { border-bottom: 1px solid var(--line); }
.bible-hit-item:last-child { border-bottom: 0; }
.bible-hit-item .bible-hit { border-bottom-color: transparent; }
.bible-hit {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  cursor: pointer;
}
.bible-hit:hover { border-color: var(--accent); background: var(--accent-soft); }
.bible-hit-ref {
  display: block;
  font-family: var(--font-display);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 2px;
}
.bible-hit-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.92rem;
}
.bible-hit mark { background: var(--gold); color: #fff; padding: 0 1px; }
/* the search results keep the site's serif, like everything else */
.bible-hit { font: inherit; }
/* the verses read today, tinted and marked by where they are read */
.bible-verse.is-mass { background: rgba(201, 162, 39, 0.10); border-left: 2px solid #c9a227; padding: 2px 6px; margin-left: -8px; }
.bible-verse.is-office { background: rgba(90, 184, 184, 0.10); border-left: 2px solid #5ab8b8; padding: 2px 6px; margin-left: -8px; }
/* the per-verse copy button */
.bible-copy { background: none; border: 0; padding: 0 6px 0 0; color: var(--muted); cursor: pointer; font: inherit; font-size: 0.8rem; }
.bible-copy:hover { color: var(--accent); }
.bible-copy.is-copied { color: var(--good); }
/* bottom chapter navigation */
.bible-chapter-foot { margin-top: 14px; }
/* the clear-search and resume buttons */
.bible-clear { font-size: 0.8rem; }
.bible-resume { margin: 0 0 12px; }
/* cross-references: the toggle and the per-verse list it reveals */
.bible-xref-toggle { font-size: 0.72rem; margin: 10px 0 2px; }
.bible-xref-toggle.is-on { border-color: var(--accent); background: var(--accent-soft); }
.bible-xrefs { margin: 0 0 8px 1.4rem; }
.bible-xref-label { color: var(--muted); padding-right: 4px; }
.bible-xref { font-size: 0.86rem; }
.bible-xrefs-loading { margin: 8px 0; }
.bible-credit { margin: 14px 0 0; }
.bible-loading, .bible-error { margin: 12px 0; }
.bible-error { color: var(--bad); }
.passage-explorer { margin-top: 10px; }


/* ---- Hours housekeeping (moved below the hour list) and the collapsible Sources ---- */
.hours-foot {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.sources-details > summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.3;
  margin-bottom: 12px;
}
.sources-details > summary:hover { color: var(--accent); }

/* ---- the month calendar ---- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-label { flex: 1; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.cal-nav { padding: 2px 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-weekday {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); text-align: center;
}
.cal-cell {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 6px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); text-align: left; font: inherit; cursor: pointer;
  color: var(--text);
  min-height: 58px;
  min-width: 0;
  position: relative;
}
.cal-cell:hover { border-color: var(--line-strong); }
.cal-cell .color-dot { width: 0.6em; height: 0.6em; }
.cal-num { font-weight: 600; font-size: 0.9rem; }
.cal-name {
  font-size: 0.72rem; line-height: 1.2; color: var(--muted);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  max-width: 100%; overflow-wrap: anywhere;
}
.cal-cell.is-today { border-color: var(--accent); }
.cal-cell.is-now .cal-num { color: var(--accent); }
.cal-cell.is-holyday { border-color: var(--accent); }
.cal-hdo {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--accent);
}
.cal-blank { border: none; background: none; cursor: default; }

/* season edge: a 3px left border in the season's own colour, plus a faint wash,
   so the month shows the shape of Advent/Lent/Christmas/Easter/Ordinary Time.  */
.cal-cell { border-left-width: 3px; }
.cal-cell.season-advent    { border-left-color: #6b4a8b; background-image: linear-gradient(rgba(107,74,139,0.10), rgba(107,74,139,0.10)); }
.cal-cell.season-lent      { border-left-color: #6b4a8b; background-image: linear-gradient(rgba(107,74,139,0.10), rgba(107,74,139,0.10)); }
.cal-cell.season-triduum   { border-left-color: #b02418; background-image: linear-gradient(rgba(176,36,24,0.10), rgba(176,36,24,0.10)); }
.cal-cell.season-christmas { border-left-color: #c9a227; background-image: linear-gradient(rgba(201,162,39,0.10), rgba(201,162,39,0.10)); }
.cal-cell.season-easter    { border-left-color: #c9a227; background-image: linear-gradient(rgba(201,162,39,0.10), rgba(201,162,39,0.10)); }
.cal-cell.season-ordinary  { border-left-color: #2f7d4f; background-image: linear-gradient(rgba(47,125,79,0.10), rgba(47,125,79,0.10)); }

/* rank emphasis: a solemnity (and a Sunday, which ranks as one) carries a gold
   ring and a firmer name; a feast firms the name; a ferial day stays quiet.    */
.cal-cell.rank-solemnity { box-shadow: 0 0 0 1.5px #c9a227; }
.cal-cell.rank-solemnity .cal-name,
.cal-cell.is-sunday .cal-name { color: var(--text); font-weight: 600; }
.cal-cell.rank-feast .cal-name { color: var(--text); font-weight: 500; }
.cal-cell.rank-ferial .cal-num { color: var(--muted); }

/* today's cell: a strong outline so the present day is unmistakable in the grid. */
.cal-cell.is-now { box-shadow: 0 0 0 2px var(--accent); }

/* Sunday: the Lord's Day gets a gold-ringed number so it stands out in the grid. */
.cal-cell.is-sunday .cal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55em;
  height: 1.55em;
  border: 1.5px solid #c9a227;
  border-radius: 50%;
  color: var(--gold);
  font-weight: 700;
  line-height: 1;
}

/* the key under the calendar */
.cal-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.cal-legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 0.8rem; color: var(--muted); }
.cal-legend-key { font-weight: 600; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend .color-dot { width: 0.75em; height: 0.75em; margin-right: 0; }
.legend-ring { display: inline-block; width: 0.85em; height: 0.85em; border-radius: 50%; border: 1.5px solid #c9a227; }
.cal-legend .small { margin: 0; }

/* ---- the Rosary ---- */
.rosary-set { font-family: var(--font-display); font-size: 1.05rem; margin: 4px 0 0; }
.rosary-viewer {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}
.rosary-step-title { margin: 0 0 6px; font-size: 1.15rem; }
.rosary-mystery-name { margin: 0 0 2px; font-weight: 600; }
.rosary-fruit { margin: 0 0 12px; color: var(--muted); font-style: italic; }
.rosary-art { margin: 0 0 12px; }
.rosary-art img { width: 100%; max-width: 480px; height: auto; border-radius: var(--radius); display: block; }
.rosary-art figcaption { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.rosary-scripture-ref { margin: 0 0 4px; font-family: var(--font-display); font-weight: 600; }
.rosary-verses { margin-bottom: 4px; }
.rosary-verse { margin: 0 0 8px; }
.rosary-prayer { margin: 0 0 10px; font-size: 1.02rem; line-height: 1.5; }
.rosary-beads { display: inline-flex; gap: 4px; margin: 2px 0 8px; }
.rosary-bead { color: var(--gold); font-size: 0.7rem; }
.rosary-note { margin: 0; color: var(--muted); font-size: 0.85rem; }
.rosary-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.rosary-counter { color: var(--muted); font-size: 0.85rem; }
.rosary-progress { margin-top: 10px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.rosary-progress-fill { height: 100%; background: var(--accent); }


