/* ─── Mobile polish ───────────────────────────────────── */

@media (pointer: coarse) {
  .mystery-trigger,
  .nav-btn,
  .back-btn,
  .link-card,
  .mystery-begin,
  .completion-btn,
  .bead,
  .font-size-toggle,
  .font-panel-btn,
  .autoplay-toggle,
  .player-speed-btn { min-height: 44px; min-width: 44px; }
  .intention-remove { opacity: 0.4; }
}

@media (max-width: 480px) {
  .prayer-meditation,
  .prayer-text { line-height: 1.9; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Touch & scroll ──────────────────────────────────── */

#prayer-screen { overscroll-behavior-y: contain; }
#prayer-screen { -webkit-user-select: none; user-select: none; }
#prayer-screen .prayer-text,
#prayer-screen .prayer-meditation,
#prayer-screen .prayer-scripture {
  -webkit-user-select: text;
  user-select: text;
}

.nav-btn, .mystery-begin, .mystery-trigger, .back-btn {
  touch-action: manipulation;
}

/* ─── RTL Support (Arabic) ────────────────────────────── */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .site-header-inner { flex-direction: row-reverse; }
[dir="rtl"] .header-nav { flex-direction: row-reverse; }
[dir="rtl"] .site-header-right { flex-direction: row-reverse; }
[dir="rtl"] .featured-content { text-align: right; }
[dir="rtl"] .featured-footer { flex-direction: row-reverse; }
[dir="rtl"] .mystery-card { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .mystery-info { text-align: right; }
[dir="rtl"] .prayer-nav { flex-direction: row-reverse; }
[dir="rtl"] .prayer-section { text-align: right; }
[dir="rtl"] .section-header { flex-direction: row-reverse; }
[dir="rtl"] .bead-counter { direction: ltr; }
[dir="rtl"] .player-controls { flex-direction: row-reverse; }
[dir="rtl"] .back-btn svg { transform: scaleX(-1); }
[dir="rtl"] .featured-watermark { display: none; }

/* ─── Desktop: book-column reading layout ─────────────── */
/* The app is designed phone-first. On large screens, widen into a
   book-like column with scaled typography and a soft ambient glow,
   rather than leaving the phone column adrift on a black canvas. */
@media (min-width: 900px) {
  body {
  }
  #app,
  .site-header-inner {
    max-width: 700px;
  }
  .screen {
    padding: 0 2rem;
  }
  .hero h1 { font-size: 3rem; }
  .hero-subtitle { max-width: 30rem; }
  .prayer-body { font-size: 1.0625rem; }
  .prayer-body.font-size-0 { font-size: 1.0625rem; }
  .prayer-title { font-size: 2.25rem; }
}
@media (min-width: 1280px) {
  #app,
  .site-header-inner {
    max-width: 760px;
  }
}

/* ─── Prayer Options ──────────────────────────────────── */

.opt-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

.opt-group { margin-bottom: 1.25rem; }

.opt-heading {
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

/* min-height keeps every row a comfortable touch target (WCAG 2.2 SC 2.5.8). */
.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.375rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--foreground);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.opt-row:hover:not([disabled]) { border-color: var(--mary); }

/* A prayer with no text in this language: shown, explained, and not clickable,
   rather than hidden outright so the reader knows it exists. */
.opt-row-off { opacity: 0.55; cursor: default; }

.opt-text { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
.opt-name { font-size: 0.875rem; font-weight: 400; }
.opt-sub { font-size: 0.6875rem; color: var(--muted-foreground); }

.opt-switch {
  position: relative;
  flex-shrink: 0;
  width: 2.6rem;
  height: 1.5rem;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s ease;
}

.opt-switch.on { background: var(--accent-fill); }

.opt-knob {
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.opt-switch.on .opt-knob { transform: translateX(1.1rem); }
[dir="rtl"] .opt-switch.on .opt-knob { transform: translateX(-1.1rem); }

.lang2-row { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.lang2-chip {
  min-height: 36px;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--card);
  color: var(--foreground);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang2-chip:hover { border-color: var(--mary); }

.lang2-chip.on {
  border-color: var(--mary);
  background: color-mix(in oklch, var(--mary) 12%, transparent);
  color: var(--mary-ink);
  font-weight: 400;
}

/* ─── Decade context ──────────────────────────────────── */

/* Carries the mystery and its fruit through the Our Father, Glory Be and
   Fatima Prayer, which previously showed only "Decade 1". */
.decade-context {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  margin-bottom: 1.25rem;
  border-left: 2px solid var(--gold);
  background: color-mix(in oklch, var(--gold) 7%, transparent);
  border-radius: 2px;
}

[dir="rtl"] .decade-context {
  border-left: none;
  border-right: 2px solid var(--gold);
  border-radius: 2px;
}

/* Landscape, not square: a square crop of a diptych like the Annunciation
   lands squarely on the dark seam between the panels. The 35% vertical bias
   favours the upper half, where these paintings put their subject. */
.decade-context-art {
  width: 3.5rem;
  height: 2.75rem;
  object-fit: cover;
  object-position: center 35%;
  border-radius: 2px;
  flex-shrink: 0;
}

.decade-context-body { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }

.decade-context-name {
  font-family: 'Rosarivo', 'Rosarivo Fallback', Georgia, serif;
  font-size: 1rem;
  color: var(--parchment-ink);
  line-height: 1.25;
}

.decade-context-fruit {
  font-size: 0.6875rem;
  font-style: italic;
  color: var(--parchment-muted);
}

/* ─── Tap to translate ────────────────────────────────── */

.prayer-text-tappable { cursor: pointer; }

.translate-hint {
  display: block;
  white-space: normal;
  margin-top: 0.5rem;
  font-family: 'Rosarivo', 'Rosarivo Fallback', Georgia, serif;
  font-size: 0.625rem;
  color: var(--parchment-muted);
}

.prayer-text-tappable.revealed .translate-hint { display: none; }

/* Inherits white-space: pre-line from .prayer-text, which the line breaks need. */
.prayer-text-alt {
  display: none;
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid color-mix(in oklch, var(--parchment-muted) 30%, transparent);
  color: var(--parchment-muted);
}

.prayer-text-tappable.revealed .prayer-text-alt { display: block; }

/* ─── Sheen's meditations ────────────────────────────────
   Several paragraphs, and for the Assumption and Coronation, verse. */
.prayer-meditation-sheen p { margin: 0 0 1em; }
.prayer-meditation-sheen:has(> .meditation-verse:first-child)::first-letter { font-size: inherit; float: none; padding: 0; color: inherit; }
.meditation-verse { margin: 0.25em 0 1.25em; padding-inline-start: 0.75em; font-style: italic; }
.meditation-verse .meditation-stanza { margin: 0 0 1em; line-height: 1.7; }
/* One block per line with a hanging indent, so a line the phone wraps still reads as one line. */
.meditation-line { display: block; padding-inline-start: 1.5em; text-indent: -1.5em; }
.meditation-line.meditation-indent { padding-inline-start: 3em; }
.meditation-verse .meditation-verse-by { font-style: normal; font-size: 0.8125em; color: var(--parchment-muted); }
.prayer-meditation-sheen .meditation-source {
  margin: 1.25em 0 0;
  padding-top: 0.75em;
  border-top: 1px solid var(--parchment-rule);
  font-size: 0.8125rem;
  color: var(--parchment-muted);
}
/* Arabic letters join, so a drop cap tears the first word apart; Arabic and
   Chinese have no italic, so verse stays upright rather than a faked slant. */
html[lang="ar"] .prayer-meditation::first-letter { font-size: inherit; float: none; padding: 0; color: inherit; line-height: inherit; }
html[lang="ar"] .meditation-verse, html[lang="zh"] .meditation-verse { font-style: normal; }
