/*
 * Časoslov — the stylesheet of the hour fragment other sites embed (API v1; docs/api.md).
 *
 * Everything is scoped under .casoslov, the fragment's root: nothing here reaches the rest of the host page. The rules
 * are the app's own (app/globals.css, the print's typography measured on Časoslov 2026), with the host's resets
 * neutralised inside the fragment. Set any of these on .casoslov (or an ancestor) to fit the site:
 *
 *   --cs-papir        background             (default: transparent — the page's own)
 *   --cs-tinta        text                   #231f20
 *   --cs-crvena       rubrics, labels        #d2232a
 *   --cs-sivo         quiet text             #5d5751
 *   --cs-crta         rules, borders         #e7dfd2
 *   --cs-plavo        the app's own words    #1f4f86
 *   --cs-isticanje    the chosen segment     #fbf1dc
 *   --cs-font-tekst   body face              "Minion Pro", then close open faces
 *   --cs-font-naslov  titles and labels      "Optima nova LT Pro", then close faces
 *   --cs-velicina     body size              1.1rem
 *   --cs-sirina       the column             34em
 *
 * Dark: <article class="casoslov" data-tema="tamno"> (the host decides the scheme, not the device), or set the colours.
 * No fonts are loaded from here.
 */

/* The root: .office is the app's name for the same article (kept for parity with the app's markup). */
.casoslov,
.casoslov.office {
  --ink: var(--cs-tinta, #231f20);
  --rubric: var(--cs-crvena, #d2232a);
  --muted: var(--cs-sivo, #5d5751);
  --rule: var(--cs-crta, #e7dfd2);
  --app: var(--cs-plavo, #1f4f86);
  --highlight: var(--cs-isticanje, #fbf1dc);

  --font-body: var(--cs-font-tekst, "Minion Pro", "Crimson Pro", "Iowan Old Style", "Palatino Linotype", Georgia, serif);
  --font-head: var(--cs-font-naslov, "Optima nova LT Pro", Optima, Candara, "Segoe UI", system-ui, sans-serif);
  --font-sign: "Times New Roman", Times, "Liberation Serif", "Nimbus Roman", serif;

  --body: var(--cs-velicina, 1.1rem);
  --leading: 1.4;
  --measure: var(--cs-sirina, 34em);
  --caps-tracking: 0.02em;

  --pt: calc(var(--body) / 11);
  --size-label: calc(8 * var(--pt));
  --size-rubric: calc(10 * var(--pt));
  --size-rank: calc(9 * var(--pt));
  --size-saint: calc(9.5 * var(--pt));
  --size-bio: calc(9 * var(--pt));
  --gap-para: calc(2 * var(--pt));
  --gap-strophe: calc(4 * var(--pt));
  --gap-label: calc(5 * var(--pt));
  --gap-psalm: calc(12 * var(--pt));
  --indent-verse: calc(12 * var(--pt));
  --indent-ant: calc(24 * var(--pt));
  --indent-ant-n: calc(34 * var(--pt));
  --indent-role: calc(15 * var(--pt));
  --indent-petition: calc(10 * var(--pt));

  display: block;
  box-sizing: border-box;
  background: var(--cs-papir, transparent);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--body);
  font-kerning: normal;
  line-height: var(--leading);
  max-width: var(--measure);
  margin-inline: auto;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}

.casoslov[data-tema="tamno"] {
  --ink: var(--cs-tinta, #e9e4dc);
  --rubric: var(--cs-crvena, #f0595f);
  --muted: var(--cs-sivo, #b3aca3);
  --rule: var(--cs-crta, #3a3531);
  --app: var(--cs-plavo, #a9c8f0);
  --highlight: var(--cs-isticanje, #262119);
}

/* ——— the host's resets and styles, neutralised inside the fragment ——— */

.casoslov *,
.casoslov *::before,
.casoslov *::after {
  box-sizing: border-box;
}

.casoslov h1,
.casoslov h2,
.casoslov h3 {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  margin: 0;
  color: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.casoslov ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.casoslov li {
  margin: 0;
  padding: 0;
}

.casoslov li::before,
.casoslov li::marker {
  content: none;
}

.casoslov a {
  color: inherit;
  text-decoration: none;
  background: none;
  border: 0;
}

.casoslov section,
.casoslov nav,
.casoslov footer {
  display: block;
  margin: 0;
  padding: 0;
}

.casoslov p {
  margin: 0 0 var(--gap-para);
  padding: 0;
}

/* The host's type on bare elements (p { line-height: 1.8 }, a { color }) gives way to the fragment's own. */
.casoslov p,
.casoslov li,
.casoslov a,
.casoslov summary,
.casoslov span,
.casoslov i {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: inherit;
}

.casoslov p,
.casoslov li,
.casoslov summary {
  color: inherit;
}

/* Common class names a host may style too: the fragment's own are plain text. */
.casoslov .label,
.casoslov .line,
.casoslov .lines,
.casoslov .caps,
.casoslov .red,
.casoslov .sign,
.casoslov .role,
.casoslov .preview,
.casoslov .aside,
.casoslov .dash {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
}

.casoslov :focus-visible {
  outline: 2px solid var(--app);
  outline-offset: 2px;
}

.casoslov .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.casoslov .not-italic {
  font-style: normal;
}

/* ——— the title block ——— */

.casoslov .date-line {
  font-family: var(--font-head);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  hyphens: manual;
  margin-bottom: 0.4em !important;
}

.casoslov .celebration-title {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: var(--caps-tracking);
  text-align: center;
  line-height: 1.25;
  margin: 0.6em 0 0.35em;
  text-wrap: balance;
  hyphens: manual;
}

.casoslov .celebration-title.saint {
  font-size: var(--size-saint);
  font-weight: 400;
  text-transform: none;
}

.casoslov .celebration-title .caps {
  text-transform: uppercase;
}

.casoslov .celebration-title.saint.blagdan {
  font-weight: 600;
}

.casoslov .celebration-title.saint.svetkovina {
  font-weight: 700;
}

.casoslov .rank {
  font-family: var(--font-head);
  font-size: var(--size-rank);
  color: var(--rubric);
  text-align: center !important;
  hyphens: manual;
}

.casoslov .subtitle {
  color: var(--rubric);
  font-style: italic;
  text-align: center !important;
  hyphens: manual;
}

.casoslov .bio {
  font-size: var(--size-bio);
}

.casoslov .rank + .bio,
.casoslov .subtitle + .bio {
  margin-top: 0.6em;
}

/* ——— the hour ——— */

.casoslov .hour-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1em;
  text-align: center;
  margin: 1.3em 0 0.5em;
}

.casoslov .office-hour {
  scroll-margin-top: 3.5rem;
}

.casoslov .section-title {
  font-family: var(--font-head);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--caps-tracking);
  text-align: center !important;
  line-height: 1.25;
  text-wrap: balance;
  hyphens: manual;
  margin: 0 0 0.5em !important;
}

.casoslov .slot-label {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  align-items: baseline;
  font-family: var(--font-head);
  font-size: var(--size-label);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: var(--caps-tracking);
  text-transform: uppercase;
  color: var(--rubric);
  margin: calc(var(--gap-label) + var(--gap-para) + 0.4em) 0 0.3em;
  text-align: left;
  hyphens: manual;
}

.casoslov .slot-label .label {
  flex: 1 1 auto;
}

.casoslov .slot-label > .slot-heading {
  flex: 1 1 auto;
  display: flex;
  justify-content: space-between;
  gap: 1em;
  align-items: baseline;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.casoslov .slot-label .aside {
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.casoslov .part {
  margin: 0;
}

.casoslov .rubric {
  color: var(--rubric);
  font-style: italic;
  font-size: var(--size-rubric);
  line-height: calc(var(--leading) * 1.02);
}

.casoslov .red {
  color: var(--rubric);
}

.casoslov .sign {
  font-family: var(--font-sign);
}

.casoslov .app-note {
  font-family: var(--font-head);
  font-size: 0.8em;
  font-style: normal;
  line-height: 1.45;
  color: var(--app);
  margin: 0.6em 0 !important;
  text-align: left;
  hyphens: manual;
}

.casoslov .app-note a {
  font-weight: 600;
}

.casoslov .app-note a:hover {
  color: var(--ink);
}

/* ——— antiphons, dialogues ——— */

.casoslov .antiphon,
.casoslov .role-line {
  display: grid;
  grid-template-columns: minmax(var(--indent-ant), max-content) 1fr;
  column-gap: 0.3em;
}

.casoslov .antiphon.numbered {
  grid-template-columns: minmax(var(--indent-ant-n), max-content) 1fr;
}

.casoslov .role-line {
  grid-template-columns: minmax(var(--indent-role), max-content) 1fr;
}

.casoslov .antiphon .label,
.casoslov .role-line .role {
  color: var(--rubric);
}

.casoslov .lines > .line {
  display: block;
  text-align: left;
  padding-left: var(--indent-verse);
  text-indent: calc(-1 * var(--indent-verse));
}

/* ——— psalms ——— */

.casoslov .psalm-title {
  color: var(--rubric);
  text-align: left;
  hyphens: manual;
}

.casoslov .psalm-group + .psalm-group .psalm:first-child .psalm-title,
.casoslov .psalm + .psalm .psalm-title {
  margin-top: var(--gap-psalm) !important;
}

.casoslov .canticle-title {
  color: var(--rubric);
  font-style: italic;
  text-align: left;
  hyphens: manual;
}

.casoslov .psalm-section {
  color: var(--rubric);
  text-align: center !important;
}

.casoslov .psalm-sentence {
  text-align: left;
  hyphens: manual;
}

.casoslov .psalm-sentence i {
  font-style: italic;
}

.casoslov .strophe {
  margin: 0 0 var(--gap-strophe);
}

.casoslov .verse {
  margin: 0 !important;
  text-align: left;
  hyphens: manual;
  padding-left: var(--indent-verse);
  text-indent: calc(-1 * var(--indent-verse));
}

.casoslov .verse.cont {
  padding-left: calc(2 * var(--indent-verse));
}

.casoslov .mediant {
  white-space: nowrap;
}

.casoslov .inline-rubric {
  margin: 0.2em 0 var(--gap-strophe) !important;
}

/* ——— hymns ——— */

.casoslov .hymn {
  display: flex;
  justify-content: center;
  text-align: left;
  hyphens: manual;
}

.casoslov .hymn-body {
  display: inline-block;
  max-width: 100%;
}

.casoslov .stanza {
  margin: 0 0 var(--gap-strophe) !important;
}

.casoslov .stanza .line {
  display: block;
  padding-left: 1em;
  text-indent: -1em;
}

.casoslov .hymn-attribution {
  font-size: 0.85em;
  text-align: right !important;
}

/* ——— the reading, the responsory, the intercessions, the prayer ——— */

.casoslov .reading,
.casoslov .prayer {
  margin: 0 0 var(--gap-para);
}

.casoslov .responsory {
  margin: 0 0 var(--gap-para);
  text-align: left;
}

.casoslov .responsory .role-line {
  margin: 0 0 var(--gap-para);
}

.casoslov .intercessions {
  margin: 0;
}

.casoslov .int-response {
  font-style: italic;
}

.casoslov .petition {
  margin: 0 0 var(--gap-para);
}

.casoslov .petition > p {
  margin: 0 !important;
}

.casoslov .petition-a {
  padding-left: var(--indent-petition);
  text-indent: calc(-1 * var(--indent-petition));
}

.casoslov .petition-b {
  display: grid;
  grid-template-columns: var(--indent-petition) 1fr;
}

.casoslov .petition-b .dash {
  color: var(--rubric);
  font-weight: 700;
}

/* ——— alternatives and pickers: the app's controls around the book's texts ——— */

.casoslov .alternatives {
  margin: 0.4em 0 0.8em;
}

.casoslov .alternative {
  display: block;
  border-top: 1px solid var(--rule);
  padding: 0.25em 0;
}

.casoslov .alternative > summary {
  display: list-item;
  cursor: pointer;
  text-align: left;
  list-style-position: outside;
  margin-left: 1em;
  hyphens: manual;
}

.casoslov .alternative > summary .rubric {
  font-size: var(--size-rubric);
}

.casoslov .alternative > summary .preview {
  color: var(--muted);
  font-size: 0.85em;
}

.casoslov .choose {
  font-family: var(--font-head);
  font-size: 0.8em;
  font-weight: 600;
  color: var(--app);
}

.casoslov .choose:hover {
  color: var(--ink);
}

.casoslov .picker {
  font-family: var(--font-head);
  font-size: 0.85rem;
  line-height: 1.35;
  margin: 0.4rem 0 0.8rem;
  text-align: left;
  hyphens: manual;
}

.casoslov .picker-title {
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.casoslov .picker ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.casoslov .picker a {
  display: inline-block;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  min-height: 2rem;
}

.casoslov .picker a[aria-current="true"] {
  border-color: var(--rubric);
  color: var(--rubric);
  font-weight: 600;
}

/* ——— switches: the hours of the day, Redovni / Svečanost, the Common, the Compline ——— */

.casoslov .switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.6rem;
  margin: 0.75rem 0 1rem;
  font-family: var(--font-head);
  font-size: 0.85rem;
  line-height: 1.2;
  text-align: center;
  hyphens: manual;
}

.casoslov .switch-lead {
  color: var(--muted);
}

.casoslov .switch ul {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--rule);
  border-radius: 1.5rem;
}

.casoslov .switch a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  border-radius: 1.25rem;
  color: var(--ink);
}

.casoslov .switch a:hover {
  background: color-mix(in srgb, var(--rule) 70%, transparent);
}

.casoslov .switch a[aria-current="true"],
.casoslov .switch a[aria-current="page"] {
  color: var(--rubric);
  font-weight: 600;
  background: var(--highlight);
}

.casoslov .casovi {
  margin-top: 1rem;
}

@media (min-width: 64rem) {
  .casoslov .switch a {
    min-height: 2.25rem;
  }
}

/* ——— the hours before and after, the days before and after, the © lines ——— */

.casoslov .dalje,
.casoslov .dani {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 2rem;
  font-family: var(--font-head);
  font-size: 0.875rem;
  text-align: left;
  hyphens: manual;
}

.casoslov .dani {
  margin-top: 0.75rem;
}

.casoslov .dalje a,
.casoslov .dani a {
  color: var(--app);
}

.casoslov .dalje a[rel="next"] {
  font-weight: 600;
}

.casoslov .dalje a:hover,
.casoslov .dani a:hover {
  color: var(--ink);
}

.casoslov .prava {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-head);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
  hyphens: manual;
}

.casoslov .prava p {
  margin: 0;
}

.casoslov .prava a {
  color: var(--app);
}

@media print {
  .casoslov .no-print {
    display: none !important;
  }
}
