/* Design direction: "Midnight navy & matte gold" (dark, default) and "Pure white & matte gold" (light).
   Flat surfaces, no gradients/glow, no liturgical colour indicators; green is reserved for verification text. */
/* Bundled fonts (SIL Open Font License, see fonts/OFL-*.txt): Latin subset, variable weight. ~130 KB in all,
   precached by the service worker and served cache-first, so they cost nothing after the first visit. */
@font-face { font-family: "Noto Serif App"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../fonts/noto-serif-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Noto Serif App"; font-style: italic; font-weight: 100 900; font-display: swap; src: url(../fonts/noto-serif-latin-wght-italic.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter App"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../fonts/inter-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
/* Georgia (the font used before Noto Serif): the device's own Georgia where installed (Windows, Mac, iPhone); elsewhere
   (Android) Gelasio, an open font drawn to the same metrics. Chosen in Settings → Reading font. */
@font-face { font-family: "Georgia App"; font-style: normal; font-weight: 100 500; font-display: swap; src: local("Georgia"), url(../fonts/gelasio-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Georgia App"; font-style: normal; font-weight: 600 900; font-display: swap; src: local("Georgia Bold"), local("Georgia-Bold"), url(../fonts/gelasio-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Georgia App"; font-style: italic; font-weight: 100 500; font-display: swap; src: local("Georgia Italic"), local("Georgia-Italic"), url(../fonts/gelasio-latin-wght-italic.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Georgia App"; font-style: italic; font-weight: 600 900; font-display: swap; src: local("Georgia Bold Italic"), local("Georgia-BoldItalic"), url(../fonts/gelasio-latin-wght-italic.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  /* Dark (default) */
  --bg: #0A1624;          /* midnight navy: app background */
  --card: #13213B;        /* slate navy: cards & navigation */
  --card-2: #1B2B49;      /* raised: selected segment, inputs */
  --line: #24365A;        /* dividers & outlines */
  --text: #F7F9FC;        /* soft white: reading & primary text */
  --muted: #A7B1C0;       /* blue grey: secondary text */
  --accent: #CEAA5E;      /* matte gold: current hour fill */
  --accent-ink: #0A1624;  /* text on the gold fill */
  --gold: #CEAA5E;        /* gold text, icons & focus */
  --title: #CEAA5E;       /* app & page titles */
  --rubric: #E88978;      /* rubric coral */
  --ok: #72B18C;          /* muted green: verification text only */
  --warn: #CEAA5E;        /* "provisional" / "not fully checked" */
  --prayed: #E0574A;      /* red: an Hour prayed today */
  --serif: "Noto Serif App", "Noto Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter App", Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --fs: 21px; --radius: 12px;
  color-scheme: dark;
}
:root[data-font="georgia"] { --serif: "Georgia App", Georgia, "Times New Roman", serif; }
:root[data-theme="light"] {
  --bg: #FFFFFF;          /* pure white */
  --card: #F2F2F2;        /* neutral grey: prayer cards & panels */
  --card-2: #FFFFFF;
  --line: #D7D7D7;        /* neutral border */
  --text: #0A1624;        /* midnight navy: titles & reading text */
  --muted: #555555;       /* neutral charcoal */
  --accent: #CEAA5E;      /* matte gold */
  --accent-ink: #0A1624;
  --gold: #795700;        /* dark gold: accent text, icons, focus */
  --title: #0A1624;
  --rubric: #A63D32;      /* liturgical red */
  --ok: #28653F;          /* verification green */
  --warn: #795700;
  --prayed: #B3261E;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--serif); }
body { min-height: 100dvh; padding-bottom: calc(24px + env(safe-area-inset-bottom)); -webkit-text-size-adjust: 100%; }
#app { max-width: 720px; margin: 0 auto; padding: 0 16px; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Header */
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 0 14px; }
.brand img { width: 52px; height: 52px; border-radius: 12px; }
.brand > div { flex: 1; }
.brand h1 { margin: 0; font-size: 24px; line-height: 1.1; color: var(--title); font-weight: 700; }
.brand p { margin: 4px 0 0; font-style: italic; color: var(--muted); font-size: 14px; }

/* Day card: the arrows sit beside the date and title only (never over the choice below) */
.day { position: relative; background: var(--card); border-radius: var(--radius); padding: 10px 10px 14px; text-align: center; overflow: hidden; }
.day-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 4px; }
.day .date { color: var(--gold); font-size: 14px; }
.day h2 { margin: 4px 0 4px; font-size: 20px; font-weight: 500; line-height: 1.25; }
.day .rank { color: var(--muted); font-size: 14px; }
.dot { display: none; } /* no liturgical colour indicators */
.day .extra { margin-top: 8px; font-size: 14px; color: var(--muted); line-height: 1.4; padding: 0 8px; }
.day .extra .flag { color: var(--warn); }
.day .nav { background: none; border: 0; color: var(--gold); font-size: 30px; width: 44px; height: 48px; cursor: pointer; line-height: 1; padding: 0; }
.day .pick { background: none; border: 0; cursor: pointer; padding: 4px 0; color: inherit; min-width: 0; }
.today-link { display: block; margin: 8px auto 0; background: none; border: 1px solid var(--line); border-radius: 99px; padding: 4px 14px; color: var(--muted); font: 500 12px var(--sans); cursor: pointer; }
input.hidden-date { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }

/* Menu: the button at the top right of every page, and its panel */
.menu-btn { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 10px; color: var(--gold); cursor: pointer; }
.menu-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.menu { position: fixed; z-index: 20; top: calc(64px + env(safe-area-inset-top)); right: max(16px, calc((100vw - 720px) / 2 + 16px)); min-width: 200px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 8px 24px rgb(0 0 0 / .25); }
.menu[hidden] { display: none; }
.menu a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 10px; text-decoration: none; color: var(--text); font: 500 15px var(--sans); }
.menu a[aria-current] { background: var(--card-2); color: var(--gold); }
.menu svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--gold); }
.page-head { display: flex; align-items: center; gap: 12px; margin: 10px 0 0; }
.page-head .page-title { margin: 8px 0; }

/* Now card */
.now { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 84px; margin: 12px 0 0; padding: 12px 16px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.now small { display: block; font: 600 11px var(--sans); letter-spacing: 2px; }
.now strong { display: block; font-size: 24px; line-height: 1.15; font-weight: 700; margin: 2px 0; }
.now em { font-size: 14px; }
.now .go { font-size: 26px; flex: none; line-height: 1; }

/* Hours grid */
.label { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 8px; color: var(--muted); font: 500 11px var(--sans); letter-spacing: 2px; text-transform: uppercase; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hour { position: relative; display: block; text-decoration: none; background: var(--card); border-radius: var(--radius); padding: 8px 10px; min-height: 62px; border: 1px solid transparent; }
.hour.wide { grid-column: 1 / -1; min-height: 54px; display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: center; }
.hour.wide b, .hour.wide span { grid-column: 1; }
.hour.wide i { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
.hour.current { border-color: var(--accent); }
/* An Hour prayed (read to the end) on this device: red border. */
.hour.prayed { border-color: var(--prayed); box-shadow: inset 0 0 0 1px var(--prayed); }
.now.prayed { box-shadow: inset 0 0 0 3px var(--prayed); }
.hour b { display: block; font-size: 17px; font-weight: 500; line-height: 1.2; }
.hour span { display: block; color: var(--muted); font-size: 14px; line-height: 1.3; }
.hour i { display: block; margin-top: 3px; font: 500 11px var(--sans); font-style: normal; }
.badge-ok { color: var(--ok); } .badge-prov { color: var(--warn); } .badge-none { color: var(--muted); }
.hour.disabled { opacity: .5; }

/* Generic cards / settings */
.page-title { color: var(--title); font-size: 24px; margin: 18px 0 10px; font-weight: 700; }
.panel { background: var(--card); border-radius: var(--radius); padding: 2px 0; margin: 8px 0 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; min-height: 54px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .t { font-size: 17px; } .row .d { color: var(--muted); font-size: 14px; margin-top: 2px; line-height: 1.4; }
.sample { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; font-size: var(--fs); line-height: 1.5; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch:checked { background: var(--accent); } .switch:checked::after { left: 23px; }
select { font: 500 14px var(--sans); background: var(--card-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 40px; }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 10px 18px; min-height: 44px; font: 600 14px var(--sans); cursor: pointer; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
.note { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Office reader */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; min-height: 56px; background: var(--bg); border-bottom: 1px solid var(--line); margin: 0 -16px; padding: 6px 16px; }
.topbar .back { color: var(--gold); font-size: 17px; text-decoration: none; padding: 10px 0; white-space: nowrap; }
.topbar .menu-btn { margin-left: 0; }
.topbar h1 { flex: 1; margin: 0; font-size: 24px; color: var(--title); font-weight: 500; line-height: 1.2; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 10px; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; color: var(--gold); flex: none; }
.office-head { text-align: center; margin: 20px 0 4px; font-size: 20px; font-weight: 500; line-height: 1.3; }
.office-head .psalter { color: var(--muted); font-size: 14px; font-weight: 400; margin-top: 4px; }
.status { margin: 12px 0; padding: 10px 12px; border-radius: 10px; font: 400 13px/1.5 var(--sans); color: var(--muted); background: var(--card); border: 0; }
.status b { color: var(--text); font-weight: 600; }
.status.ok, .status.prov { border: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; font: 500 13px var(--sans); background: var(--card); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.office { font-size: var(--fs); line-height: 1.5; padding-bottom: 40px; }
.office h3 { color: var(--rubric); font-size: 1.05em; font-weight: 600; margin: 1.3em 0 .4em; }
.office .title { text-align: center; color: var(--muted); font-size: .85em; letter-spacing: 1px; margin: 0; }
.office p { margin: .15em 0; }
.office .rubric { color: var(--rubric); font-style: italic; font-size: .8em; margin: .7em 0 .3em; }
.office .credit { color: var(--muted); font-size: .75em; font-style: italic; margin-top: .4em; }
.office .ps-title { color: var(--rubric); text-align: right; margin-top: 1.1em; }
.office .ps-sub { color: var(--rubric); text-align: right; font-style: italic; font-size: .9em; }
.office .epigraph { color: var(--muted); font-style: italic; font-size: .85em; text-align: right; margin-bottom: .6em; }
.office .ant { font-style: italic; margin: .6em 0; }
.office .ant .lbl, .office .vr { color: var(--rubric); font-style: normal; font-weight: 600; margin-right: .3em; }
.office .psalm-prayer { margin: .7em 0; font-size: .95em; }
.office .psalm-prayer::before { content: "Psalm-prayer (optional) · "; color: var(--rubric); font-style: italic; font-size: .8em; }
.office .derived { }  /* (text inserted from elsewhere in the source: no mark; its provenance is in the tooltip) */
.office .corr { text-decoration: underline dotted color-mix(in srgb, var(--gold) 70%, transparent); text-underline-offset: 3px; cursor: help; }
.office .refrain { font-style: italic; }
/* Layout as printed (V6 line styles): a verse group or paragraph begins (gb), an indented half-verse (ind). */
.office p.verse.gb { margin-top: .65em; }
.office p.verse.ind { padding-left: 1.4em; }
.office p.para { margin: 0 0 .55em; }
.office p.para.ind { text-indent: 1.2em; margin-top: -.3em; }
.office .note { text-align: center; font-size: .85em; }
.office .stanza-gap { height: .6em; }
.office .speaking { background: color-mix(in srgb, var(--accent) 25%, transparent); border-radius: 6px; }
/* The texts are for praying in the app: not selectable (no copying from the reader). */
.office { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* End of an Hour: back to the day, and the next Hour. */
.end-nav { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 0 auto 32px; }
.end-nav .btn { display: inline-flex; align-items: center; text-decoration: none; }
.hide-derived-marks .derived { border-left: 0; padding-left: 0; }

/* Audio bar */
.player { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 9; display: flex; justify-content: center; pointer-events: none; }
.player > div { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 6px 10px 6px 6px; max-width: calc(100% - 32px); }
.player button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 18px; cursor: pointer; }
.player button.sm { width: 40px; height: 40px; background: transparent; color: var(--text); }
.player .meta { font: 500 12px var(--sans); color: var(--muted); max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Calendar month */
.month { background: var(--card); border-radius: var(--radius); padding: 10px; }
.month header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 17px; }
.month header b { font-weight: 500; }
.month header button { background: none; border: 0; color: var(--gold); font-size: 26px; width: 48px; height: 48px; cursor: pointer; }
.month .wd, .month .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.month .wd { color: var(--muted); font: 500 11px var(--sans); margin-bottom: 4px; }
.month .days a { text-decoration: none; border-radius: 8px; min-height: 40px; font-size: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.month .days a b { font-weight: 400; }
.month .days a.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.month .days a.tod { background: var(--card-2); }
.month .days a.sol b { color: var(--gold); font-weight: 600; }
@media (max-width: 380px) { .hour b { font-size: 16px; } }

/* Choice between the weekday and an optional memorial / commemoration (native picker, as in Liturgia Horarum+) */
.celebrate { display: block; margin: 12px 4px 0; text-align: left; }
.celebrate.evening { margin-top: 10px; }
.celebrate span { display: block; font: 500 11px var(--sans); letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); text-align: center; margin-bottom: 6px; }
.celebrate select { width: 100%; appearance: none; -webkit-appearance: none; font: 400 16px var(--serif); color: var(--text); background: var(--card-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23CEAA5E' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; border: 1px solid var(--accent); border-radius: 10px; padding: 10px 38px 10px 12px; min-height: 48px; cursor: pointer; }

/* Hymn given as a list of options; alternative forms (after "Or:") shown but not recited */
.office .choice { margin: 2px 0 2px 14px; font-style: italic; color: var(--muted); }
.office .choice::before { content: "♪ "; color: var(--gold); font-style: normal; }
.office .alt { color: var(--muted); }
.office .alt-group { margin: 6px 0 12px; border: 1px dashed var(--line); border-radius: 10px; padding: 4px 12px; color: var(--muted); }
.office .alt-group > summary { cursor: pointer; color: var(--rubric); font-style: italic; font-size: .92em; padding: 6px 0; }
.office .alt-group .alt-note { color: var(--muted); font-style: normal; font-size: .85em; }
.office .alt-group[open] { padding-bottom: 10px; }

/* Verification note at the top of an Hour: one small line (details in its tooltip). */
.check { margin: 4px 0 2px; font: 500 12px var(--sans); color: var(--muted); text-align: center; }
.check.ok { color: var(--ok); }
.check.prov { color: var(--warn); }

/* Option switch: "Hymn 1 | Hymn 2" beside the hymn heading; "Psalm 95 | 100 | 67 | 24" in the Invitatory. */
.office .hymn-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.office .hymn-head h3 { margin-right: auto; }
.office .opt-switch { display: inline-flex; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; margin: .6em 0 .2em; }
.office .hymn-head .opt-switch { margin: 0; }
.office .opt-switch button { appearance: none; border: 1px solid transparent; background: transparent; color: var(--muted); font: 400 14px var(--serif); padding: 6px 12px; min-height: 36px; border-radius: 8px; cursor: pointer; }
.office .opt-switch button[aria-selected="true"] { background: var(--card-2); color: var(--text); }
:root[data-theme="light"] .office .opt-switch button[aria-selected="true"] { color: var(--gold); border-color: var(--line); }

/* "Aperi, Domine": folded prayer at the top of the Invitatory (tap the title to open). */
.office .aperi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin: 16px 0 8px; }
.office .aperi summary { list-style: none; cursor: pointer; padding: 10px 14px; min-height: 44px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.office .aperi summary::-webkit-details-marker { display: none; }
.office .aperi summary::before { content: "›"; color: var(--gold); font-size: 1.2em; transition: transform .2s; }
.office .aperi[open] summary::before { transform: rotate(90deg); }
.office .aperi summary span { color: var(--gold); font-style: italic; }
.office .aperi summary small { color: var(--muted); font: 400 13px var(--sans); }
.office .aperi p { margin: 0; padding: 0 14px 12px; }
/* Night Prayer: the examination of conscience, a heading that opens to the penitential act. */
.office .aperi.exam { background: none; border: 0; border-radius: 0; margin: 1.3em 0 .4em; }
.office .aperi.exam summary { padding: 0; min-height: 44px; }
.office .aperi.exam summary::before { color: var(--rubric); }
.office .aperi.exam summary span { color: var(--rubric); font-style: normal; font-weight: 600; font-size: 1.05em; }
.office .aperi.exam p { padding: 0 0 .55em; }
/* When to make the sign of the cross (shown only; never read by the audio). */
.office .rubric.cross { font-size: .85em; margin-bottom: 2px; }
