/* Modelled on Breviarium Gregorianum (breviariumgregorianum.com): EB Garamond, a warm
   white page, red rubrics, a slim bar with hour, date and settings, centred headings,
   red psalm titles, numbered verses. */
@font-face { font-family: "EB Garamond"; src: url(fonts/ebgaramond-latin-ext.woff2) format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; src: url(fonts/ebgaramond-italic-latin-ext.woff2) format("woff2"); font-weight: 400 800; font-style: italic; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; src: url(fonts/ebgaramond-latin.woff2) format("woff2"); font-weight: 400 800; font-style: normal; font-display: swap; 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: "EB Garamond"; src: url(fonts/ebgaramond-italic-latin.woff2) format("woff2"); font-weight: 400 800; font-style: italic; font-display: swap; 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 {
  --bg: #faf7f5;
  --bg-raised: #f0ebe7;
  --fg: #111;
  --fg-soft: #5d5650;
  --rubric: #e22613;
  --rule: #ddd5cf;
  --exsurge-negative-fill: var(--bg);
  --size: 100;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1b1a17;
  --bg-raised: #2a2824;
  --fg: #ece6da;
  --fg-soft: #a69d8f;
  --rubric: #f0705f;
  --rule: #3a362f;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1a17;
    --bg-raised: #2a2824;
    --fg: #ece6da;
    --fg-soft: #a69d8f;
    --rubric: #f0705f;
    --rule: #3a362f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "EB Garamond", "Crimson Text", Garamond, Georgia, serif;
  /* EB Garamond's Latin forms write u as v (LAVDES): the ecclesiastical spelling keeps u */
  font-feature-settings: "locl" 0;
  font-size: calc(18.67px * var(--size) / 100);
  line-height: 1.35;
  padding-bottom: env(safe-area-inset-bottom);
}
button, select, input { font-feature-settings: "locl" 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.r, .rubric { color: var(--rubric); }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
}
.bar { display: flex; align-items: center; gap: 8px; max-width: 44rem; margin: 0 auto; padding: 8px 12px; }
.logo { flex: 0 0 auto; display: block; width: 40px; height: 40px; }
.logo svg { width: 100%; height: 100%; display: block; }
.logo .bg { fill: #a8261b; }
.logo .staff { fill: #f8f0e1; fill-opacity: .36; }
.logo .notes { fill: #f8f0e1; }
.bar select, .bar input[type=date] {
  font: inherit; font-size: 17px; color: var(--fg); background: var(--bg-raised);
  border: 0; border-radius: 6px; padding: 7px 10px; min-width: 0; height: 40px;
}
.bar select { flex: 0 1 auto; max-width: 11em; }
.bar input[type=date] { flex: 1 1 auto; }
.gear { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px; background: var(--bg-raised); }
.gear svg { width: 22px; height: 22px; fill: var(--fg); }
.gear[aria-expanded="true"] { outline: 2px solid var(--rubric); }

/* ---------- settings ---------- */
.settings {
  max-width: 44rem; margin: 0 auto 8px; padding: 10px 16px 6px;
  background: var(--bg-raised); border-radius: 10px; font-size: 17px;
  max-height: calc(100vh - 80px); overflow: auto;
}
@media (max-width: 46rem) { .settings { margin: 0 12px 8px; } }
.settings[hidden] { display: none; }
.settings-title { text-align: center; margin: 2px 0 8px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.mode { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mode .preview { width: 100%; background: var(--bg); border-radius: 10px; padding: 6px; border: 3px solid transparent; display: block; }
.mode[aria-checked="true"] .preview { border-color: var(--rubric); }
.mode[aria-checked="true"] .mode-name { color: var(--rubric); }
/* the miniature scores of the two modes: real scores, laid out wide and shrunk (app.js) */
.mini { height: 210px; overflow: hidden; pointer-events: none; text-align: left; }
.mini .score { margin: 0; }
.mini .score svg { display: block; }
.mini ol { margin: 4px 0 0; padding: 0 0 0 19px; font-size: 14px; line-height: 1.3; }
.mini ol b { font-weight: 700; }
.mini ol .star, .mini ol .flex { color: var(--rubric); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); }
.row select { font: inherit; color: inherit; background: transparent; border: 0; text-align: right; max-width: 55%; }
.row input[type=range] { flex: 0 1 50%; }
.row select:disabled { opacity: 0.55; }
.name { color: var(--rubric); }
/* where a section's pieces come from: small, under its heading, on the right */
.src-label { display: block; text-align: right; margin-top: 0.1em; font-size: 0.62rem; font-weight: 400; font-style: italic; letter-spacing: 0.02em; text-transform: none; color: var(--rubric); opacity: 0.8; }
.wip { margin-left: 0.4em; font-size: 0.78em; font-style: italic; color: var(--rubric); }

/* ---------- the office ---------- */
.office { max-width: 44rem; margin: 0 auto; padding: 0 16px 4rem; }
.loading, .empty { color: var(--fg-soft); font-style: italic; text-align: center; margin: 3rem 0; }
.borrowed { color: var(--fg-soft); font-style: italic; font-size: .9em; text-align: center; margin: .2rem auto 1rem; max-width: 30em; }
.title-block { text-align: center; margin: 48px 0 8px; }
.title-block .rank { color: var(--rubric); margin: 0 0 -4px; }
.title-block h1 { font-size: 2em; line-height: 1.1; font-weight: 700; margin: 0; padding: 0 12px; }
.title-block .tempora { margin: 4px 0 0; }
h2.hour { text-align: center; font-size: 17px; font-weight: 700; text-transform: uppercase; letter-spacing: 3px; margin: 56px 0 0; }
h2.section { text-align: center; font-size: 18px; font-weight: 700; margin: 40px 0 18px; }
.rubric { font-style: italic; font-size: .92em; margin: .9em 0 .3em; }
.block { margin: .6em 0; }
h3.sub { font-weight: 700; font-size: 1em; margin: 1.2em 0 .2em; }
.chant { margin: .6em 0 .4em; overflow: hidden; }
.chant svg { display: block; max-width: 100%; height: auto; }
/* Exsurge leaves the notes to the SVG's default black: follow the text colour (night) */
.score svg { fill: currentColor; font-feature-settings: "locl" 0; }
.score svg .rubric, .score svg .annotation { fill: var(--rubric); }
.score-tools { display: flex; justify-content: flex-end; margin: 0 0 -6px; position: relative; z-index: 1; }
.score-tools .play { width: 36px; height: 26px; border-radius: 6px; background: var(--bg-raised); color: var(--fg); font-size: 12px; line-height: 26px; }
.score-tools .play.playing { color: var(--rubric); }
.chant .missing { color: var(--fg-soft); font-style: italic; }
.ant-text { margin: .1em 0 .4em; }
.ant-text .r { font-weight: 600; font-style: normal; }

/* psalms */
.psalm { margin-top: 24px; }
.psalm-head { margin: 0 0 4px; display: flex; flex-wrap: wrap; gap: 0 .6em; align-items: baseline; }
.psalm-head .ref { color: var(--rubric); }
.psalm-head .title { font-style: italic; color: var(--fg-soft); font-size: .9em; }
.psalm-head .tone { margin-left: auto; color: var(--rubric); font-size: .85em; font-style: italic; }
.sentence { font-style: italic; color: var(--fg-soft); font-size: .88em; margin: 0 0 .5em; }
.psalm-score, .verse-score { margin: .2em 0 .5em; }
ol.verses { margin: 18px 0; padding: 0 0 0 32px; font-size: 20px; }
ol.verses li { margin: 3px 0; padding-left: 2px; }
ol.verses li.strophe-start { margin-top: 12px; }
ol.verses li::marker { font-variant-numeric: lining-nums; }
ol.verses b { font-weight: 700; }
ol.verses .star, ol.verses .flex { color: var(--rubric); }

/* versicles, texts, intercessions */
.versicle { margin: .3em 0; padding-left: 1.6em; text-indent: -1.6em; }
.versicle .r { font-weight: 600; }
.text p { margin: .25em 0; }
.hymn p { margin: 0 0 .7em; }
.hymn-rest .strophe { break-inside: avoid; }
@media (min-width: 640px) { .hymn-rest { column-count: 2; column-gap: 2em; } }
.preces .intro { margin: .3em 0 .6em; }
.preces .intention { margin: .45em 0; padding-left: 1.2em; text-indent: -1.2em; }
.preces .intention .r { padding: 0 .2em; }

/* the foot of the page: private use, and whom to write to */
.colophon { max-width: 40rem; margin: 0 auto; padding: 1.25rem 16px calc(2rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); text-align: center; font-size: 0.85em; color: var(--fg-soft); }
.colophon p { margin: 0.2em 0; }
.colophon a { color: inherit; }

/* translations under the Latin (site/translate.js): smaller, set off by a rule; long pieces fold */
.tr { font-size: 0.93em; font-style: italic; line-height: 1.35; margin: 2px 0 10px; }
.tr p { margin: 0 0 0.45em; }
.tr b { font-weight: 700; }
.tr .r { color: var(--rubric); font-style: normal; }
.tr summary { color: var(--rubric); cursor: pointer; }
.tr .tr-head { font-style: italic; }
/* Chinese is not set in italics; a serif CJK face beside EB Garamond */
.tr:lang(zh) { font-style: normal; font-family: "EB Garamond", "Noto Serif TC", "Songti TC", "PMingLiU", serif; font-size: 0.92em; line-height: 1.7; letter-spacing: 0.02em; }
ol.verses li .tr { margin: 1px 0 6px; font-size: 0.88em; }
:lang(zh) { font-family: "EB Garamond", "Noto Serif TC", "Songti TC", "PMingLiU", serif; }

/* PDF (site/pdf.js): a control in the settings; the pages laid out off screen while it is made */
.pdf { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pdf select { font: inherit; color: inherit; background: transparent; border: 0; text-align: right; }
.pdf button, .pdf a { font: inherit; color: var(--rubric); background: var(--bg-raised); border-radius: 6px; padding: 2px 12px; text-decoration: none; }
.pdf button:disabled { opacity: .5; }
.pdf [hidden] { display: none; }
/* the hour laid out for print (PDF, page count) keeps the light theme whatever the page's, so
   the page itself never changes theme while it is measured */
#print-root {
  position: absolute; left: -100000px; top: 0; background: #fff; color: #111;
  --bg: #faf7f5; --bg-raised: #f0ebe7; --fg: #111; --fg-soft: #5d5650; --rubric: #e22613; --rule: #ddd5cf;
  --exsurge-negative-fill: var(--bg); color-scheme: light;
}
.print-flow { max-width: none; margin: 0; padding: 0; }
.print-flow .score-tools { display: none; }
.print-flow h2.section { margin: 22px 0 10px; }
.print-flow .title-block { margin-top: 0; }

/* the source of each score, beside its ▶ (site/sources.js) */
.score-tools { align-items: center; gap: 8px; }
.score-src { font-size: 11px; letter-spacing: .02em; color: var(--fg-soft); text-decoration: none; opacity: .8; white-space: nowrap; }
a.score-src:hover { text-decoration: underline; }

/* help and sources */
.link { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.help { max-width: min(40rem, calc(100vw - 32px)); max-height: 85vh; overflow: auto; padding: 18px 20px 22px; border: 1px solid var(--rule); border-radius: 10px; background: var(--bg); color: var(--fg); font-size: 0.9em; line-height: 1.4; }
.help::backdrop { background: rgb(0 0 0 / .35); }
.help h2 { font-size: 1.3em; margin: 0 2em 0.4em 0; }
.help h3 { font-size: 1em; margin: 1.2em 0 0.3em; }
.help ul { padding-left: 1.2em; margin: 0.3em 0; }
.help li { margin: 0.25em 0; }
.help a { color: inherit; }
.help .close { position: sticky; top: 0; float: right; width: 32px; height: 32px; border-radius: 6px; background: var(--bg-raised); color: var(--fg); font-size: 20px; line-height: 32px; }
.help-books { display: grid; grid-template-columns: minmax(3.2em, max-content) 1fr; gap: 6px 12px; margin: 0.4em 0; }
.help-books dt { font-weight: 600; max-width: 5.2em; }
.help-books dd { margin: 0; }

/* the version, small at the foot (stamped by scripts/build.mjs) */
.colophon .version { margin-top: 0.8em; font-size: 0.8em; opacity: .6; letter-spacing: .02em; font-variant-numeric: lining-nums; }

/* "beta", as Breviarium Gregorianum marks its translations */
.beta { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px; background: var(--rubric); color: var(--bg); font-size: 0.65em; letter-spacing: .04em; text-transform: uppercase; vertical-align: 0.15em; line-height: 1.5; }
/* mutual enrichment: the window of options and the note in the office */
.bonus-intro { margin: 0 0 0.8em; }
.bonus-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--rule); cursor: pointer; }
.bonus-row input { margin-top: 0.25em; accent-color: var(--rubric); }
.bonus-note { font-size: 0.85em; font-style: italic; text-align: center; margin: 1.2em 0 0.2em; opacity: 0.85; }
/* the pixel spark beside "Mutual enrichment", and the burst when an option is ticked */
.pixel-spark { display: inline-block; width: 15px; height: 15px; vertical-align: -1px; margin-left: 2px; image-rendering: pixelated;
  background:
    linear-gradient(#e8b923, #e8b923) 6px 0 / 3px 15px no-repeat,
    linear-gradient(#e8b923, #e8b923) 0 6px / 15px 3px no-repeat,
    linear-gradient(var(--rubric), var(--rubric)) 3px 3px / 3px 3px no-repeat,
    linear-gradient(var(--rubric), var(--rubric)) 9px 9px / 3px 3px no-repeat,
    linear-gradient(#fff6c8, #fff6c8) 6px 6px / 3px 3px no-repeat;
  animation: spark-twinkle 1.6s steps(1) infinite; }
@keyframes spark-twinkle { 0%, 60% { opacity: 1; transform: scale(1); } 70% { opacity: .55; transform: scale(.8); } 85% { opacity: 1; transform: scale(1.15); } }
.pixel-burst { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 10; }
body > .pixel-burst { position: fixed; }
.pixel-burst i { position: absolute; left: 0; top: 0; image-rendering: pixelated; animation: pixel-fly 700ms steps(7) forwards; }
@keyframes pixel-fly { 0% { transform: translate(0, 0); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.bonus { overflow: visible; }
@media (prefers-reduced-motion: reduce) { .pixel-spark { animation: none; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* the Chinese interface: Hong Kong's name of the celebration, the Latin under it */
h1:lang(zh) { font-family: "EB Garamond", "Noto Serif TC", serif; font-weight: 400; font-size: 1.75em; letter-spacing: 0.06em; line-height: 1.35; text-wrap: balance; }
.latin-name { font-style: italic; margin-top: -0.2em; }
html:lang(zh) .settings, html:lang(zh) .help, html:lang(zh) h2.section, html:lang(zh) h2.hour, html:lang(zh) .rank, html:lang(zh) .tone, html:lang(zh) .colophon { font-family: "EB Garamond", "Noto Serif TC", serif; }
/* Noto Serif TC is served in its regular weight only: no synthesized bold */
html:lang(zh) h2.section, html:lang(zh) h2.hour, html:lang(zh) .help h2, html:lang(zh) .help h3 { font-weight: 400; letter-spacing: 0.12em; }
.pdf-pages { color: var(--rubric); font-variant-numeric: oldstyle-nums; white-space: nowrap; }
/* the hour before and the hour after, at the foot of the hour */
.hours-nav { max-width: 40rem; margin: 1.5rem auto 0; padding: 0 16px 1.25rem; display: flex; justify-content: space-between; gap: 12px; }
.hours-nav:empty { display: none; }
.hours-nav a { color: var(--rubric); text-decoration: none; padding: 0.55em 0.9em; border-radius: 8px; background: var(--bg-raised); font-size: 0.95em; }
.hours-nav a.next { margin-left: auto; text-align: right; }
html:lang(zh) .hours-nav { font-family: "EB Garamond", "Noto Serif TC", serif; }
@media print { .hours-nav { display: none; } }
/* the settings in groups */
.settings-group { margin: 1.1em 0 0.1em; font-size: 0.78em; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rubric); }
.settings-group + .row { border-top: 0; }
.pdf { gap: 8px; flex-wrap: wrap; }
.pdf button, .pdf a, .pdf select { white-space: nowrap; flex: none; }
.pdf-pages { font-size: 0.9em; }
html:lang(zh) .settings-group { letter-spacing: 0.3em; }
