@font-face {
  font-family: "IM FELL English";
  src: url("./fonts/im_fell_english.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IM FELL English";
  src: url("./fonts/im_fell_english_italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: Fraunces;
  src: url("./fonts/fraunces.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f8f5ed;
  --ink: #28251f;
  --muted: #746e61;
  --accent-light: #81652f;
  --accent-dark: #cab37b;
  --accent: var(--accent-light);
  --rubric: var(--accent);
  --surface: color-mix(in srgb, var(--accent) 6%, var(--paper));
  --surface-hi: color-mix(in srgb, var(--accent) 3%, var(--paper));
  --rule: color-mix(in srgb, var(--accent) 24%, var(--paper));
  --shadow: #26221d18;
  --font-body: "IM FELL English", Georgia, "Times New Roman", serif;
  --font-display: Fraunces, "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: var(--font-body);
  --font-scale: 1;
  --page-gap: 48px;
}
[data-liturgical-colour="white"] { --accent-light: #81652f; --accent-dark: #cab37b; }
[data-liturgical-colour="green"] { --accent-light: #4f6845; --accent-dark: #a2b491; }
[data-liturgical-colour="red"] { --accent-light: #8c443b; --accent-dark: #d0a097; }
[data-liturgical-colour="violet"] { --accent-light: #745874; --accent-dark: #bda5c2; }
[data-liturgical-colour="black"] { --accent-light: #59564f; --accent-dark: #b5b1a6; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #000000;
  --ink: #e5e0d6;
  --muted: #b0a896;
  --accent: var(--accent-dark);
  --shadow: #00000040;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #000000;
    --ink: #e5e0d6;
    --muted: #b0a896;
    --accent: var(--accent-dark);
    --shadow: #00000040;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 24px; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); padding-top: env(safe-area-inset-top); }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { background: none; border: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .32; }
button:not(:disabled):hover { color: var(--accent); }
a { color: var(--accent); text-underline-offset: 3px; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { color: var(--paper); background: var(--accent); }
svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.masthead { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: min(1140px, calc(100% - 64px)); margin: 22px auto 0; padding: 15px 0 0; border-bottom: 3px double var(--rule); }
.masthead::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent); opacity: .3; }
.masthead-edition { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.45; font-variant: small-caps; letter-spacing: .08em; }
.masthead-edition span { display: block; font-size: .62rem; letter-spacing: .14em; margin-top: 7px; }
.wordmark { text-decoration: none; color: var(--ink); font-family: var(--font-display); font-size: 4.4rem; font-weight: 720; font-variation-settings: "SOFT" 55, "WONK" 1; letter-spacing: -.075em; line-height: 1.05; padding: 0 10px 5px 0; }
.date-button { grid-column: 1 / -1; justify-self: center; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 5px 16px 9px; font-size: .88rem; font-style: italic; color: var(--muted); }
.date-button > span:last-child { font-style: normal; font-size: .8em; }
.header-actions { display: flex; align-items: center; justify-self: end; gap: 5px; }
.icon-button, .type-button { position: relative; display: grid; place-items: center; width: 44px; height: 44px; color: var(--muted); }
.type-button { font-family: var(--font-display); font-weight: 550; font-size: 1.15rem; letter-spacing: -.06em; }
.saved-indicator { position: absolute; background: var(--accent); border: 2px solid var(--paper); width: 8px; height: 8px; border-radius: 50%; right: 8px; top: 7px; }
.workspace { width: min(1140px, 100%); margin: 0 auto; display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; min-height: 0; }
.desktop-index { position: sticky; top: 24px; display: flex; flex-direction: column; min-height: 0; height: calc(100dvh - 102px); padding: 34px 24px 24px 8px; }
.index-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-family: var(--font-display); font-weight: 550; font-size: 1rem; margin-bottom: 20px; color: var(--accent); }
.edition, .eyebrow { font-size: .69rem; letter-spacing: .13em; font-weight: 400; }
.edition { color: var(--muted); }
#desktop-toc { overflow: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; padding: 0 6px 10px 0; }
.toc-entry { display: grid; grid-template-columns: 22px minmax(0, 1fr); width: 100%; text-align: left; gap: 6px; padding: 9px 7px; font-size: .85rem; line-height: 1.4; color: var(--muted); border-left: 2px solid transparent; }
.toc-entry span:first-child { font-size: .63rem; padding-top: 3px; opacity: .8; font-variant-numeric: tabular-nums; }
.toc-entry[aria-current="true"] { color: var(--ink); background: var(--surface); border-left-color: var(--accent); }
.toc-entry:hover { background: var(--surface-hi); }
.sidebar-foot { display: grid; gap: 8px; padding-top: 20px; font-size: .62rem; letter-spacing: .12em; color: var(--muted); }
.text-button { text-align: left; padding: 7px 0; font-size: .83rem; letter-spacing: 0; color: var(--muted); }
.reader-shell { min-width: 0; min-height: 0; padding: 20px clamp(28px, 5vw, 76px) 80px; border-left: 1px solid var(--rule); }
.office-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 26px; font-size: .86rem; }
.segmented { display: inline-flex; align-items: center; gap: 17px; }
.segmented button { position: relative; padding: 10px 0; min-height: 44px; color: var(--muted); font-family: var(--font-display); font-size: .98rem; font-weight: 500; }
.segmented button[aria-pressed="true"] { color: var(--ink); }
.segmented button[aria-pressed="true"]::after { content: ""; position: absolute; bottom: 3px; left: 0; right: 0; height: 2px; background: var(--accent); opacity: .65; }
select { background: var(--paper); border: 1px solid var(--rule); border-radius: 0; padding: 8px 24px 8px 10px; min-height: 44px; max-width: 100%; }
/* Fraunces (ascent 15, descent 4 at 15.2px) and italic IM FELL (12/5 at
   13.12px) do not share vertical metrics, so centring both in equal 44px boxes
   leaves the select text 2px above the segmented buttons' baseline. Shift the
   text down by that measured difference rather than aligning the boxes again. */
.office-bar select { background: transparent; border-color: transparent; color: var(--muted); font-style: italic; padding-left: 5px; padding-top: 10px; padding-bottom: 6px; }
#hour-select { color: var(--accent); }
#votive-select { margin-left: auto; max-width: 230px; text-overflow: ellipsis; }
.day-heading { padding-bottom: 28px; margin-bottom: 30px; border-bottom: 1px solid var(--rule); }
.eyebrow { color: var(--accent); margin: 0 0 11px; line-height: 1.5; }
h1 { font-family: var(--font-display); font-variation-settings: "SOFT" 35, "WONK" 1; color: var(--ink); font-weight: 580; line-height: 1.17; letter-spacing: -.025em; font-size: clamp(1.65rem, 2.8vw, 2.4rem); margin: 0; text-wrap: balance; }
.reading { position: relative; min-height: 260px; outline-offset: 6px; touch-action: pan-y pinch-zoom; }
.flow { width: 100%; font-size: calc(1.3rem * var(--font-scale)); line-height: 1.65; overflow-wrap: break-word; }
.flow:empty { display: none; }
.flow section { margin: 0; padding: 0; }
.section-title { color: var(--ink); font-family: var(--font-display); font-variation-settings: "SOFT" 35, "WONK" 1; font-weight: 560; font-size: 1.5em; line-height: 1.2; letter-spacing: -.022em; margin: 1.8em 0 .75em; break-after: avoid; }
.flow section:first-child .section-title { margin-top: .1em; }
.section-number { display: flex; align-items: center; gap: 10px; color: var(--accent); font: .67rem/1.5 var(--font-body); letter-spacing: .13em; margin-bottom: .7rem; }
.section-number::after { content: ""; width: 27px; height: 1px; background: var(--accent); opacity: .45; }
.flow p { margin: 0 0 .6em; orphans: 2; widows: 2; }
.flow p.verse { margin-bottom: .32em; }
.flow p.rubric { font-size: .84em; line-height: 1.6; margin: .65em 0; }
.rubric { color: var(--rubric); font-style: italic; }
span.rubric { font-size: .85em; }
.rubric .rubric { font-size: inherit; }
.versicle { color: var(--rubric); font-style: normal; white-space: nowrap; margin-right: .12em; }
.cross { color: var(--rubric); }
.initial { color: var(--rubric); font-weight: bold; }
.verse-number { font-size: .59em; color: var(--muted); vertical-align: .1em; margin-right: .32em; }
[data-rubrics="false"] .flow .rubric { display: none; }
/* {ex Proprio de Tempore} and its kin say which book the text came from. They
   are the source apparatus, not part of the office, and never spoken. */
.flow p.source { display: none; }
/* On a vigil the Gloria is a lone rubric reading "omit."; with rubrics hidden
   its heading would stand over nothing, reading as a failure rather than a
   deliberate silence. Drop any section left with nothing to say. */
[data-rubrics="false"] .flow section:not(:has(p:not(.rubric):not(.source))) { display: none; }
.flow section:not(:has(p:not(.source))) { display: none; }
.flow b, .flow strong { font-weight: bold; }
.page-bar { position: fixed; z-index: 5; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 2px max(24px, calc((100vw - 660px) / 2)) calc(2px + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); background: var(--paper); }
.running-title { display: flex; align-items: center; gap: 12px; min-height: 44px; min-width: 0; padding: 0; color: var(--muted); font-size: .79rem; font-style: italic; text-align: left; }
.running-title span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 65vw; }
.running-title span:last-child { color: var(--accent); font-style: normal; }
.page-arrow { display: none; height: 44px; font-size: 1.4rem; }
.page-position { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 0; color: var(--ink); font-size: .83rem; font-variant-numeric: tabular-nums; }
.index-mark { color: var(--accent); font-size: 1.1rem; }
.progress-track { position: absolute; height: 1px; top: -1px; left: 0; right: 0; }
#progress-fill { background: var(--accent); height: 100%; width: 0; opacity: .7; }
.reading-message { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 250px; padding-bottom: 40px; font-size: 1.15rem; line-height: 1.6; }
.reading-message p { max-width: 32rem; }
.reading-message button { margin: 6px 0; }
body[data-layout="pages"] { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; overflow: hidden; }
body[data-layout="pages"] .masthead { margin-top: 8px; padding-top: 8px; }
body[data-layout="pages"] .wordmark { font-size: 2.7rem; }
body[data-layout="pages"] .masthead-edition { font-size: .65rem; }
body[data-layout="pages"] .masthead-edition span { display: none; }
body[data-layout="pages"] .date-button { min-height: 34px; padding-bottom: 6px; }
body[data-layout="pages"] .workspace { align-items: stretch; }
body[data-layout="pages"] .desktop-index { position: static; height: auto; }
body[data-layout="pages"] .reader-shell { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; padding-top: 8px; padding-bottom: 0; }
body[data-layout="pages"] .office-bar { margin-bottom: 12px; }
body[data-layout="pages"] .day-heading { padding-bottom: 14px; margin-bottom: 16px; }
body[data-layout="pages"] .day-heading h1 { font-size: 1.55rem; }
body[data-layout="pages"] .reading { min-height: 0; overflow: hidden; }
body[data-layout="pages"] .flow { height: 100%; column-width: var(--page-width, 580px); column-gap: var(--page-gap); column-fill: auto; line-height: 1.6; }
body[data-layout="pages"] .page-bar { position: relative; display: grid; grid-template-columns: 44px 1fr 44px; padding: 4px 0 calc(4px + env(safe-area-inset-bottom)); margin-top: 12px; }
body[data-layout="pages"] .page-arrow { display: block; }
body[data-layout="pages"] .running-title { display: none; }
dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-top: 3px solid var(--accent); border-radius: 2px; padding: 0; width: min(480px, calc(100% - 24px)); max-height: min(85dvh, 820px); box-shadow: 0 20px 90px var(--shadow); }
dialog::backdrop { background: #17120d65; backdrop-filter: blur(3px); }
.dialog-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.dialog-header h2 { font-family: var(--font-display); font-weight: 550; font-size: 1.5rem; letter-spacing: -.025em; margin: 0; }
.close-button { font: 1.6rem var(--font-body); width: 44px; height: 44px; color: var(--muted); }
.dialog-body { padding: 8px 24px 26px; font-size: 1rem; line-height: 1.6; }
.dialog-body > p { margin: 16px 0; }
#mobile-toc { padding: 12px 16px 24px; }
#mobile-toc .toc-entry { min-height: 44px; font-size: 1.05rem; padding: 11px 12px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.setting-row > select { font-size: .9rem; }
input[type="checkbox"] { width: 21px; height: 21px; accent-color: var(--accent); flex-shrink: 0; }
.small-note { font-size: .82rem; color: var(--muted); line-height: 1.65; }
.about { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: .9rem; color: var(--muted); }
.about h3 { font: 550 1.15rem var(--font-display); color: var(--accent); margin: 0; }
.about p { margin: 14px 0; }
.calendar-controls { display: flex; gap: 7px; align-items: center; padding-top: 16px; }
input[type="date"] { min-width: 0; flex: 1; width: 150px; background: var(--paper); border: 1px solid var(--rule); border-radius: 0; min-height: 44px; padding: 6px; font-size: .94rem; }
.solid-button, .outline-button { border-radius: 2px; border: 1px solid var(--rule); padding: 10px 14px; min-height: 44px; font-size: .9rem; }
.solid-button { border-color: var(--accent); background: var(--accent); color: var(--paper); }
.solid-button:not(:disabled):hover { color: var(--paper); filter: brightness(1.12); }
.calendar-month { flex: 1; text-align: center; margin: 0; font-family: var(--font-display); font-size: 1.04rem; font-weight: 550; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.calendar-weekdays { margin-top: 4px; font: .62rem/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: center; }
.calendar-grid { margin: 7px 0 4px; }
.month-controls { padding-top: 6px; }
#month-panel { border-top: 1px solid var(--rule); margin-top: 12px; }
/* The nearby-days list: the reading order most of the time. */
.calendar-days { display: grid; gap: 4px; margin: 16px 0; }
.calendar-day { display: grid; grid-template-columns: 43px 1fr; width: 100%; text-align: left; gap: 14px; align-items: center; padding: 13px 9px; border-top: 1px solid var(--rule); }
.calendar-day[aria-current="date"] { background: var(--surface); color: var(--ink); }
.calendar-day time { font-family: var(--font-display); font-size: 1.5rem; text-align: center; color: light-dark(var(--accent-light), var(--accent-dark)); }
.calendar-day time small { display: block; font: .63rem var(--font-body); text-transform: uppercase; letter-spacing: .08em; color: inherit; margin-top: 2px; }
.calendar-day > span { font-size: .97rem; line-height: 1.4; }
.calendar-day.is-major > span { font-weight: 650; }
.calendar-day.is-major time { font-weight: 700; }
.calendar-day .small-note { display: block; font-size: .74rem; margin-top: 3px; font-weight: 400; }
/* The numeral carries the day's colour; weight carries its rank. Nothing else
   in the cell competes, so a month reads as a season at a glance. */
.calendar-cell { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; min-height: 38px; font-family: var(--font-display); font-size: 1.02rem; border: 1px solid transparent; border-radius: 2px; color: light-dark(var(--accent-light), var(--accent-dark)); }
.calendar-cell.is-major { font-weight: 700; }
.calendar-cell.is-absent { color: var(--rule); }
.calendar-cell[aria-current="date"] { background: var(--surface); border-color: light-dark(var(--accent-light), var(--accent-dark)); }
.calendar-cell:not(:disabled):hover { background: var(--surface-hi); }
.calendar-chosen { min-height: 2.6em; margin: 10px 0 2px; font-size: .93rem; line-height: 1.45; }
.calendar-chosen b { font-weight: 550; }
.calendar-chosen span { display: block; font-size: .76rem; color: var(--muted); margin-top: 2px; }
/* Typed dates commit on Enter or the button, never on a partial value. */
.date-entry { display: flex; gap: 7px; align-items: center; margin: 4px 0 6px; }
.date-entry input { flex: 1; min-width: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: 0; padding: 9px 10px; min-height: 44px; font-family: var(--font-body); letter-spacing: .04em; }
.date-entry input[aria-invalid="true"] { border-color: light-dark(#8c443b, #d0a097); }
#date-error { color: light-dark(#8c443b, #d0a097); margin-top: 0; }
.download-actions { display: flex; flex-wrap: wrap; gap: 10px; }
progress { width: 100%; accent-color: var(--accent); }
.saved-days { max-height: 180px; overflow: auto; }
.saved-day { width: 100%; text-align: left; padding: 9px 0; font-size: .9rem; border-bottom: 1px solid var(--rule); }
.toast { position: fixed; bottom: calc(75px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 12px 20px; border: 1px solid var(--rule); border-radius: 2px; color: var(--ink); background: var(--surface); box-shadow: 0 3px 20px var(--shadow); font-size: .9rem; z-index: 10; }
.skip-link { position: fixed; top: -100px; z-index: 20; background: var(--paper); padding: 15px; }
.skip-link:focus { top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.noscript { position: fixed; inset: 160px 20px 20px; padding: 30px; background: var(--paper); }
@media (max-width: 850px) {
  .workspace { display: block; min-height: 0; }
  .desktop-index { display: none; }
  .reader-shell { width: min(740px, 100%); margin: 0 auto; padding: 18px 32px 80px; border-left: 0; }
  body[data-layout="pages"] .reader-shell { height: 100%; }
}
@media (max-width: 520px) {
  .masthead { width: calc(100% - 48px); margin-top: 17px; padding-top: 14px; }
  .wordmark { font-size: clamp(2.3rem, 12.3vw, 3.2rem); font-weight: 730; }
  .masthead-edition { font-size: .63rem; letter-spacing: .04em; }
  .masthead-edition span { font-size: .53rem; letter-spacing: .1em; margin-top: 6px; }
  .date-button { font-size: .82rem; padding-top: 9px; }
  .header-actions { gap: 0; }
  .icon-button, .type-button { width: 36px; }
  .reader-shell { padding: 12px max(24px, env(safe-area-inset-right)) 80px max(24px, env(safe-area-inset-left)); }
  .office-bar { gap: 6px; margin-bottom: 18px; font-size: .82rem; }
  .segmented { gap: 15px; margin-right: 7px; }
  .segmented button { font-size: .95rem; }
  .office-bar select { padding-right: 18px; max-width: 155px; }
  #votive-select { flex-basis: 100%; max-width: 100%; margin-left: 0; padding: 8px 18px 4px 0; }
  #office-type { max-width: 95px; }
  .day-heading { padding-bottom: 24px; margin-bottom: 25px; }
  .eyebrow { font-size: .61rem; letter-spacing: .09em; margin-bottom: 10px; }
  h1 { font-size: 1.86rem; line-height: 1.17; }
  .flow { font-size: calc(1.25rem * var(--font-scale)); line-height: 1.65; }
  .section-title { font-size: 1.46em; }
  .page-bar { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
  .running-title { font-size: .73rem; }
  .page-position { font-size: .79rem; }
  dialog { max-height: 88dvh; }
  body[data-layout="pages"] .day-heading h1 { font-size: 1.26rem; }
  body[data-layout="pages"] .office-bar { gap: 2px; margin-bottom: 7px; }
  body[data-layout="pages"] #votive-select { min-height: 34px; padding-top: 2px; padding-bottom: 2px; }
}
@media (max-height: 550px) {
  body[data-layout="pages"] .masthead { margin-top: 0; padding-top: 0; grid-template-columns: 1fr auto 1fr; }
  body[data-layout="pages"] .masthead-edition { display: none; }
  body[data-layout="pages"] .wordmark { font-size: 2rem; grid-column: 1; }
  body[data-layout="pages"] .date-button { grid-row: 1; grid-column: 2; }
  body[data-layout="pages"] .header-actions { grid-row: 1; grid-column: 3; }
  body[data-layout="pages"] .office-bar { margin-bottom: 3px; }
  body[data-layout="pages"] .day-heading { padding-bottom: 8px; margin-bottom: 10px; }
  body[data-layout="pages"] .day-heading h1 { font-size: 1rem; }
  body[data-layout="pages"] .eyebrow { display: none; }
}
@media (max-width: 360px) {
  .masthead-edition { font-size: .53rem; }
  .wordmark { font-size: 2.25rem; }
}
@media (prefers-reduced-motion: no-preference) { button, a { transition: color .12s, background .12s; } }
@media print {
  :root { --paper: white; --ink: black; }
  body, body[data-layout="pages"] { display: block; height: auto; overflow: visible; }
  .masthead, .desktop-index, .office-bar, .page-bar, dialog, .toast { display: none; }
  .workspace, .reader-shell, body[data-layout="pages"] .reader-shell { display: block; padding: 0; border: 0; }
  .reading, body[data-layout="pages"] .reading { overflow: visible; }
  .flow, body[data-layout="pages"] .flow { height: auto; columns: auto; transform: none !important; font-size: 11pt; }
}
