:root {
  --bg: #f5efe0;
  --ink: #2b2419;
  --ink-soft: #6b5d49;
  --accent: #5a3a1f;
  --gold: #b0893c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background-color: var(--bg);
  color: var(--ink);
  font-family: 'EB Garamond', 'Crimson Text', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  font-size: 22px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 8vw 12vh;
  text-align: center;
}

.page {
  max-width: 38em;
  width: 100%;
}

.prayer-title {
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.85em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 2em;
}

.prayer {
  font-size: 1.1em;
  line-height: 1.7;
  margin: 0;
}

.sign-page .prayer {
  font-size: 1.2em;
  line-height: 1.9;
}

.virtue {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 2em;
  font-size: 1em;
}

.scripture {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 2.8em;
  font-size: 1em;
  line-height: 1.7;
}

.scripture .ref {
  display: block;
  margin-top: 0.4em;
  font-style: normal;
  font-size: 0.85em;
  letter-spacing: 0.04em;
}

.decade-page {
  max-width: 40em;
}

/* When a decade carries its image, anchor it at the top and let the text flow beneath it */
#app.has-decade-image {
  justify-content: flex-start;
}

.decade-plate {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 3.5vh 0 3vh;
  z-index: 1;
  pointer-events: none;
  /* cream backing that fades to nothing, so rising past-text passes under it and dissolves */
  background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) 76%, rgba(245, 239, 224, 0) 100%);
}

.decade-image {
  max-height: 21vh;
  max-width: 64vw;
  object-fit: contain;
  /* soft fade into the cream along the lower edge, so it sits rather than frames */
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 80%, transparent 100%);
}

.decade-page.has-image {
  padding-top: 27vh;
}

/* Wide screens: split the decade — painting holds the left half, scripture the right */
@media (min-width: 760px) {
  .decade-plate {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 50vw;
    padding: 4vh 2.5vw;
    align-items: center;
    background: none;
  }
  .decade-image {
    max-height: 82vh;
    max-width: 42vw;
    /* whole painting, no edge fade — there is a central gutter between it and the text */
    -webkit-mask-image: none;
    mask-image: none;
  }
  .decade-page.has-image {
    padding-top: 0;
    align-self: flex-end;
    width: 38vw;
    max-width: 30em;
  }
  #app.has-decade-image .progress {
    left: 50vw;
    right: 0;
  }
}

.decade-line {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.95em;
  line-height: 1.55;
  margin: 0 0 0.7em;
  opacity: 0.35;
  transition: opacity 0.4s ease, color 0.4s ease;
}

.decade-line.past {
  opacity: 0.55;
}

.decade-line.current {
  opacity: 1;
  color: var(--ink);
  font-weight: 500;
}

.decade-line .ref {
  display: inline;
  margin-left: 0.4em;
  font-style: normal;
  font-size: 0.78em;
  opacity: 0.75;
  letter-spacing: 0.04em;
}

.placeholder {
  opacity: 0.5;
}

.mystery-image {
  display: block;
  margin: 0 auto 2em;
  max-width: 100%;
  max-height: 42vh;
  object-fit: contain;
  /* presented like a framed painting — a slim mat, a hairline edge, a soft shadow */
  padding: 7px;
  background: #fbf7ec;
  border: 1px solid rgba(90, 58, 31, 0.22);
  box-shadow: 0 6px 22px rgba(43, 36, 25, 0.16);
}

.announcement .mystery-ordinal {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 0.6em;
  font-size: 0.95em;
}

.announcement .mystery-title {
  font-size: 1.7em;
  font-weight: 400;
  margin: 0.3em 0 0.6em;
  letter-spacing: 0.01em;
}

.fruit {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.9em;
  margin: 0 0 2.5em;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.exposition {
  max-width: 30em;
  margin: 0 auto;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.75;
  font-size: 1em;
}

.exposition .ref {
  display: block;
  margin-top: 1.4em;
  font-style: normal;
  font-size: 0.78em;
  letter-spacing: 0.06em;
  opacity: 0.9;
}

.meditation-title {
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.78em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0 0 2.2em;
  opacity: 0.7;
}

.welcome h1 {
  font-weight: 400;
  font-size: 2.4em;
  margin: 0 0 0.3em;
  letter-spacing: 0.02em;
}

.welcome .today {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 3em;
}

.mystery-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  max-width: 22em;
}

.mystery-list li {
  cursor: pointer;
  font-size: 1.2em;
  padding: 0.5em 1em;
  transition: color 0.2s ease;
  display: flex;
  align-items: baseline;
  gap: 0.8em;
}

.mystery-list li:hover {
  color: var(--accent);
}

.mystery-list li.recommended {
  color: var(--accent);
}

.mystery-list .num {
  display: inline-block;
  width: 1.2em;
  color: var(--ink-soft);
  font-style: italic;
  text-align: right;
}

.welcome .hint {
  margin: 3.5em 0 0;
  font-size: 0.8em;
  color: var(--ink-soft);
  font-style: italic;
  letter-spacing: 0.02em;
}

.welcome .setting {
  margin: 1.4em 0 0;
  font-size: 0.78em;
}

.welcome .toggle {
  cursor: pointer;
  font-style: italic;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  opacity: 0.7;
  border-bottom: 1px dotted transparent;
  transition: color 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.welcome .toggle.on {
  color: var(--accent);
  opacity: 1;
}

.welcome .toggle:hover {
  color: var(--accent);
  opacity: 1;
  border-bottom-color: rgba(90, 58, 31, 0.4);
}

.closing .prayer {
  font-size: 1.15em;
}

.progress {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1em;
  padding: 7vh 0 3.5vh;
  /* cream backing so the scrolling scripture dissolves above the dots rather than colliding with them */
  background: linear-gradient(to top, var(--bg) 55%, rgba(245, 239, 224, 0));
  pointer-events: none;
  z-index: 2;
}

.beads {
  display: flex;
  gap: 0.8em;
  align-items: center;
}

.b-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-soft);
  opacity: 0.25;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

.b-dot.done {
  opacity: 0.5;
}

.b-dot.active {
  opacity: 1;
  transform: scale(1.7);
  background: var(--accent);
}

.mysteries {
  display: flex;
  gap: 1.6em;
}

.m-marker {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-soft);
  opacity: 0.22;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.m-marker.done {
  opacity: 0.45;
}

.m-marker.active {
  opacity: 0.95;
  background: var(--accent);
}

/* Welcome → colophon link, fainter still than the setting toggle */
.welcome .colophon-link {
  margin: 2em 0 0;
  font-size: 0.74em;
}

.welcome .colophon-link .link {
  cursor: pointer;
  font-style: italic;
  color: var(--ink-soft);
  opacity: 0.55;
  letter-spacing: 0.04em;
  border-bottom: 1px dotted transparent;
  transition: color 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.welcome .colophon-link .link:hover {
  color: var(--accent);
  opacity: 1;
  border-bottom-color: rgba(90, 58, 31, 0.4);
}

/* The colophon reads top-down rather than centred, so a long page scrolls naturally */
#app.is-colophon {
  justify-content: flex-start;
  padding-top: 9vh;
  padding-bottom: 9vh;
}

.colophon {
  max-width: 34em;
  text-align: left;
}

.colophon h3,
.colophon p,
.colophon .sources,
.colophon .sources li {
  text-align: left;
}

.colophon .prayer-title {
  text-align: center;
  margin-bottom: 2.4em;
}

.colophon h3 {
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.72em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 2.4em 0 0.8em;
  opacity: 0.75;
}

.colophon p {
  color: var(--ink-soft);
  font-size: 0.92em;
  line-height: 1.7;
  margin: 0 0 1em;
}

.colophon .sources {
  list-style: none;
  padding: 0;
  margin: 0 0 1.2em;
}

.colophon .sources li {
  font-size: 0.92em;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 0.45em;
}

.colophon .fine {
  font-size: 0.82em;
  opacity: 0.85;
}

.colophon strong {
  font-weight: 600;
  color: var(--ink);
}

.colophon a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted rgba(90, 58, 31, 0.45);
  transition: border-color 0.2s ease;
}

.colophon a:hover {
  border-bottom-color: var(--accent);
}

.colophon .return {
  text-align: center;
  margin-top: 2.8em;
}

.colophon .return .link {
  cursor: pointer;
  font-style: italic;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  border-bottom: 1px dotted transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.colophon .return .link:hover {
  color: var(--accent);
  border-bottom-color: rgba(90, 58, 31, 0.4);
}

/* Small seasonal note under the day line — quiet, appears only in a resonant season */
.welcome .season {
  margin: -2.2em 0 2.8em;
  font-style: italic;
  color: var(--accent);
  font-size: 0.82em;
  letter-spacing: 0.03em;
  opacity: 0.82;
}

/* The Scripture setting: a plain label while only one translation exists */
.welcome .toggle.static {
  cursor: default;
  opacity: 0.6;
  border-bottom: none;
}
.welcome .toggle.static:hover {
  color: var(--ink-soft);
  opacity: 0.6;
  border-bottom-color: transparent;
}

/* Provenance of the Fatima prayer — the one devotional text not from Scripture or council */
.prayer-origin {
  margin: 2.6em 0 0;
  font-size: 0.72em;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  opacity: 0.6;
}

/* The "show another painting" control — small, light, in a FIXED corner so it
   holds still no matter how the painting beneath it changes shape */
.img-cycle {
  position: fixed;
  left: 20px;
  bottom: 18px;
  z-index: 3;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(245, 239, 224, 0.6);
  color: var(--accent);
  cursor: pointer;
  opacity: 0.4;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.img-cycle:hover { opacity: 1; background: rgba(245, 239, 224, 0.96); }
.img-cycle:active { transform: scale(0.9); }
.img-cycle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; opacity: 1; }
.img-cycle svg { display: block; }

/* The bead row is the one part of the inert footer that takes taps */
.beads {
  pointer-events: auto;
  gap: 0.25em;
}
.b-hit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.b-hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-radius: 50%;
}
/* a soft ring around the bead you're on — findable at a glance when praying by hand */
.b-hit:has(.b-dot.active)::after {
  content: "";
  position: absolute;
  width: 19px;
  height: 19px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0.4;
  pointer-events: none;
}
/* the small link of chain leading to the onward bead */
.b-sep {
  width: 14px;
  height: 1px;
  background: var(--ink-soft);
  opacity: 0.3;
  align-self: center;
}
/* the onward bead: hollow until the decade is done, then it fills and invites the tap */
.b-onward {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-soft);
  background: transparent;
  opacity: 0.4;
  transition: opacity 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}
.b-hit.onward.ready .b-onward {
  opacity: 0.95;
  background: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 600px) {
  html, body { font-size: 18px; }
  #app { padding: 5vh 6vw 14vh; }
  .decade-image { max-height: 17vh; max-width: 82vw; }
  .decade-page.has-image { padding-top: 23vh; }
  .beads { gap: 0.1em; }
  .b-hit { width: 21px; height: 21px; }
}

/* ─── Paper grain: a whisper of tooth on the cream, so the calm reads as
       crafted rather than flat. Pure inline-SVG noise, no external file. ─── */
body {
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='160'%20height='160'%3E%3Cfilter%20id='p'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.8'%20numOctaves='2'%20stitchTiles='stitch'/%3E%3CfeColorMatrix%20type='saturate'%20values='0'/%3E%3C/filter%3E%3Crect%20width='100%25'%20height='100%25'%20filter='url(%23p)'%20opacity='0.04'/%3E%3C/svg%3E");
}

/* ─── An illuminated initial to open the credits ─── */
.colophon .lead::first-letter {
  font-size: 3.1em;
  line-height: 0.82;
  float: left;
  margin: 0.02em 0.12em 0 0;
  color: var(--accent);
  font-weight: 600;
}

/* ─── A gold hairline beneath each mystery's name ─── */
.announcement .mystery-title::after {
  content: "";
  display: block;
  width: 2.6em;
  height: 1px;
  margin: 0.7em auto 0.1em;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  opacity: 0.85;
}

/* ─── Welcome: settings grouped, then a small always-visible info box ─── */
.welcome-settings { margin-top: 2.8em; }
.welcome-settings .setting { margin: 0.55em 0 0; }

.welcome-info {
  max-width: 25em;
  margin: 2.8em auto 0;
  padding: 1.15em 1.5em 1.25em;
  border: 1px solid rgba(90, 58, 31, 0.18);
  border-radius: 3px;
  background: rgba(255, 253, 247, 0.45);
}
.welcome-info .hint {
  margin: 0 0 0.7em;
  font-size: 0.8em;
  color: var(--ink-soft);
  font-style: italic;
  letter-spacing: 0.02em;
}
.welcome-info .info-credit {
  margin: 0 0 0.7em;
  font-size: 0.76em;
  color: var(--ink-soft);
  line-height: 1.6;
  opacity: 0.92;
}
.welcome-info .info-credit a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted rgba(90, 58, 31, 0.4);
}
.welcome-info .info-links { margin: 0; font-size: 0.76em; }
.welcome-info .info-links .link {
  cursor: pointer;
  font-style: italic;
  color: var(--ink-soft);
  opacity: 0.78;
  border-bottom: 1px dotted transparent;
  transition: color 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}
.welcome-info .info-links .link:hover {
  color: var(--accent);
  opacity: 1;
  border-bottom-color: rgba(90, 58, 31, 0.4);
}
.welcome-info .dot-sep { opacity: 0.4; margin: 0 0.55em; }

/* ─── The improvement form — the colophon's quiet reading layout ─── */
#app.is-feedback {
  justify-content: flex-start;
  padding-top: 9vh;
  padding-bottom: 9vh;
}
.feedback { max-width: 30em; text-align: left; }
.feedback .prayer-title { text-align: center; margin-bottom: 2em; }
.feedback .feedback-intro {
  color: var(--ink-soft);
  font-size: 0.95em;
  line-height: 1.7;
  font-style: italic;
  margin: 0 0 2em;
}
.feedback form { display: flex; flex-direction: column; }
.feedback .feedback-label {
  font-size: 0.72em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.8;
  margin: 0 0 0.55em;
}
.feedback .feedback-label .optional {
  text-transform: none;
  letter-spacing: 0.02em;
  font-style: italic;
  opacity: 0.85;
}
.feedback textarea,
.feedback input[type=email] {
  font-family: inherit;
  font-size: 0.95em;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.6);
  border: 1px solid rgba(90, 58, 31, 0.25);
  border-radius: 3px;
  padding: 0.7em 0.8em;
  margin: 0 0 1.6em;
  width: 100%;
}
.feedback textarea { resize: vertical; line-height: 1.6; }
.feedback textarea:focus,
.feedback input[type=email]:focus {
  outline: none;
  border-color: var(--accent);
}
.feedback button[type=submit] {
  align-self: flex-start;
  font-family: inherit;
  font-size: 0.9em;
  font-style: italic;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 3px;
  padding: 0.6em 1.7em;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: opacity 0.2s ease;
}
.feedback button[type=submit]:hover { opacity: 0.88; }
.feedback button[type=submit]:disabled { opacity: 0.5; cursor: default; }
.feedback .feedback-status {
  margin: 1.4em 0 0;
  color: var(--accent);
  font-style: italic;
  font-size: 0.95em;
  min-height: 1.2em;
}
.feedback .return { text-align: center; margin-top: 2.6em; }
.feedback .return .link {
  cursor: pointer;
  font-style: italic;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  border-bottom: 1px dotted transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.feedback .return .link:hover {
  color: var(--accent);
  border-bottom-color: rgba(90, 58, 31, 0.4);
}

/* colophon → feedback invitation */
.colophon .colophon-feedback { text-align: center; margin-top: 2.2em; }
.colophon .colophon-feedback .link {
  cursor: pointer;
  font-style: italic;
  color: var(--accent);
  opacity: 0.9;
  border-bottom: 1px dotted rgba(90, 58, 31, 0.45);
}
