/* Спільна молитва — стилі. Кольори задані токенами: темна «свічкова» тема за замовчуванням,
   світла «пергаментна» — якщо так налаштовано в системі. */

:root {
  --bg: #0e0a08;
  --bg-glow: rgba(214, 150, 70, 0.16);
  --surface: #17110e;
  --surface-2: #1f1813;
  --line: rgba(222, 186, 120, 0.16);
  --line-strong: rgba(222, 186, 120, 0.34);
  --text: #eee4d3;
  --text-soft: #cdbfa9;
  --muted: #9c8c76;
  --gold: #dcb46a;
  --gold-strong: #f1d69c;
  --ember: #e0893a;
  --hl: rgba(220, 180, 106, 0.16);
  --hl-line: rgba(241, 214, 156, 0.55);
  --all: #e8c98a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --serif-display: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6efe2;
    --bg-glow: rgba(226, 170, 90, 0.22);
    --surface: #fffaf1;
    --surface-2: #f3e9d8;
    --line: rgba(120, 84, 30, 0.16);
    --line-strong: rgba(120, 84, 30, 0.32);
    --text: #2a1f16;
    --text-soft: #4a3a2b;
    --muted: #7c6a55;
    --gold: #9a6a1c;
    --gold-strong: #7a4f0e;
    --ember: #c4661d;
    --hl: rgba(214, 160, 70, 0.2);
    --hl-line: rgba(154, 106, 28, 0.55);
    --all: #8a5a14;
    --shadow: 0 14px 40px rgba(90, 60, 20, 0.14);
    color-scheme: light;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 50% -140px, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--serif);
  line-height: 1.6;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }

.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* ─────────── шапка ─────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: var(--serif-display); font-weight: 600; font-size: 22px; letter-spacing: .01em;
  color: var(--gold-strong);
}
.brand svg { width: 18px; height: 22px; flex: none; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  text-decoration: none; font-family: var(--sans); font-size: 13px; font-weight: 500;
  letter-spacing: .02em; color: var(--text-soft);
  padding: 7px 12px; border-radius: 999px; border: 1px solid transparent;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); border-color: var(--line); }
.nav a[aria-current="page"] { color: var(--bg); background: var(--gold); }
@media (max-width: 620px) {
  .top .wrap { padding-top: 8px; padding-bottom: 8px; }
  .nav { width: 100%; margin-left: 0; justify-content: space-between; }
  .nav a { padding: 7px 10px; }
}

.live {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.live i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ember);
  box-shadow: 0 0 0 0 rgba(224, 137, 58, .6); animation: pulse 2.4s infinite;
}
.live b { font-weight: 600; color: var(--text-soft); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(224,137,58,.55); } 70% { box-shadow: 0 0 0 9px rgba(224,137,58,0); } 100% { box-shadow: 0 0 0 0 rgba(224,137,58,0); } }

/* ─────────── свічка ─────────── */
.candle { position: relative; width: 34px; height: 92px; flex: none; }
.candle .wax {
  position: absolute; bottom: 0; left: 7px; width: 20px; height: 58px; border-radius: 4px 4px 3px 3px;
  background: linear-gradient(90deg, #d9c9a8, #f6ecd6 45%, #cdbb97);
}
.candle .wick { position: absolute; bottom: 57px; left: 16px; width: 2px; height: 7px; background: #3a2a1a; border-radius: 1px; }
.candle .flame {
  position: absolute; bottom: 62px; left: 9px; width: 16px; height: 28px;
  border-radius: 50% 50% 45% 45% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 78%, #fffbe8 0 18%, #ffd27a 36%, #f08a2c 68%, rgba(240,138,44,0) 72%);
  transform-origin: 50% 90%;
  animation: flicker 3.2s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(255, 180, 80, .55));
  opacity: .82;
}
.candle .halo {
  position: absolute; bottom: 38px; left: -26px; width: 86px; height: 86px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,190,100,.22), rgba(255,190,100,0) 68%);
  opacity: .5; transition: opacity 1.2s;
}
.praying .candle .flame { opacity: 1; }
.praying .candle .halo { opacity: 1; }
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(-1deg); }
  25% { transform: scale(1.04, .97) rotate(1.5deg); }
  50% { transform: scale(.97, 1.04) rotate(-1.5deg); }
  75% { transform: scale(1.02, .99) rotate(1deg); }
}
.candle.sm { width: 18px; height: 44px; }
.candle.sm .wax { left: 4px; width: 10px; height: 26px; }
.candle.sm .wick { bottom: 25px; left: 8px; height: 5px; }
.candle.sm .flame { bottom: 29px; left: 3px; width: 12px; height: 17px; opacity: .35; animation-duration: 2.6s; }
.candle.sm .halo { display: none; }
.reader.on .candle.sm .flame { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .candle .flame, .live i { animation: none; }
}

/* ─────────── вступ сторінки ─────────── */
.hero { display: flex; gap: 20px; align-items: flex-end; padding: 34px 0 18px; }
.hero h1 {
  margin: 0; font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(34px, 7vw, 52px); line-height: 1.05; color: var(--gold-strong); letter-spacing: .005em;
}
.hero p { margin: 8px 0 0; color: var(--text-soft); font-size: 16px; max-width: 34em; }

.join {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  padding: 16px 18px; margin: 6px 0 22px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 15px; letter-spacing: .02em;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  transition: transform .15s ease, background .2s, border-color .2s;
}
.btn:hover { border-color: var(--gold); }
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-strong), var(--gold));
  color: #22160a; border-color: transparent; box-shadow: 0 6px 24px rgba(220, 180, 106, .25);
}
.join .hint { color: var(--muted); font-size: 14px; flex: 1 1 260px; }
.join .vol { display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: 13px; color: var(--muted); }
.join input[type="range"] { accent-color: var(--gold); width: 130px; }

.seg-switch { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.seg-switch button {
  border: 0; background: none; cursor: pointer; padding: 8px 14px; border-radius: 999px;
  font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--text-soft);
}
.seg-switch button[aria-pressed="true"] { background: var(--gold); color: #22160a; }

/* ─────────── читці на спільній сторінці ─────────── */
.readers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 22px; }
.reader {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  font-family: var(--sans); font-size: 14px; color: var(--muted);
  transition: border-color .3s, color .3s, background .3s;
}
.reader.on { color: var(--text); border-color: var(--hl-line); background: var(--surface-2); }
.reader.lead { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 22px rgba(220, 180, 106, .18); }
.reader.lead span { font-weight: 600; color: var(--gold-strong); }
@media (max-width: 520px) {
  .readers { grid-template-columns: repeat(2, 1fr); }
}

/* ─────────── поточна молитва ─────────── */
.now {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); overflow: hidden;
}
.now-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.eyebrow {
  font-family: var(--sans); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold); display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.badge {
  font-family: var(--sans); font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--gold-strong);
}
.now h2 {
  margin: 8px 0 0; font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(26px, 5vw, 36px); line-height: 1.15; color: var(--text);
}
.progress { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.bar { flex: 1; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-strong)); transition: width .5s linear; }
.left { font-family: var(--sans); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.text { padding: 18px 24px 30px; font-size: clamp(18px, 2.4vw, 21px); line-height: 1.8; }
.text p { margin: 0 0 .85em; color: var(--text-soft); }
.text h4 {
  margin: 1.2em 0 .5em; font-family: var(--serif-display); font-size: 1.2em; font-weight: 600; color: var(--gold-strong);
}
.text .s { border-radius: 6px; padding: 1px 2px; margin: 0 -2px; transition: background .4s, color .4s; }
.text .s.done { color: var(--muted); }
.text .s.cur { background: var(--hl); color: var(--text); box-shadow: inset 0 -2px 0 var(--hl-line); }
.text .s.all { color: var(--all); font-style: italic; }
.text .s.all.cur { color: var(--gold-strong); }
.text .rep {
  display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px;
  font-family: var(--sans); font-size: 12px; font-style: normal; vertical-align: 2px;
  color: var(--gold-strong); border: 1px solid var(--line-strong); font-variant-numeric: tabular-nums;
}
.text .empty { color: var(--muted); font-style: italic; }

.follow {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30;
  display: none;
}
.follow.show { display: inline-flex; }

/* ─────────── далі ─────────── */
.next { margin: 28px 0 10px; }
.next h3, .section-h {
  font-family: var(--sans); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 0 0 10px;
}
.next ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.next li {
  display: grid; grid-template-columns: 58px 1fr auto; gap: 12px; align-items: baseline;
  padding: 12px 2px; border-bottom: 1px solid var(--line);
}
.next time { font-family: var(--sans); font-size: 14px; color: var(--gold); font-variant-numeric: tabular-nums; }
.next .t { color: var(--text-soft); font-size: 17px; line-height: 1.35; }
.next .s2 { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ─────────── головна ─────────── */
.home-hero { text-align: center; padding: 48px 0 10px; }
.home-hero .candle { margin: 0 auto 10px; }
.home-hero h1 {
  margin: 0; font-family: var(--serif-display); font-weight: 600;
  font-size: clamp(42px, 9vw, 70px); line-height: 1; color: var(--gold-strong);
}
.home-hero p { margin: 14px auto 0; max-width: 32em; color: var(--text-soft); font-size: 17px; }
.home-now { margin: 30px 0 26px; }
.home-now .now-head { border-bottom: 0; }
.rooms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.room {
  display: flex; align-items: center; gap: 16px; padding: 18px 18px; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  transition: border-color .2s, transform .2s;
}
.room:hover { border-color: var(--gold); transform: translateY(-1px); }
.room .candle { transform: scale(.72); transform-origin: left bottom; margin: -18px -8px 0 0; }
.room b { display: block; font-family: var(--serif-display); font-size: 26px; font-weight: 600; color: var(--text); line-height: 1.1; }
.room span { display: block; font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 3px; }
.room.wide { grid-column: 1 / -1; border-color: var(--line-strong); }
.room.wide b { color: var(--gold-strong); }
@media (max-width: 520px) { .rooms { grid-template-columns: 1fr; } }

.note { color: var(--muted); font-size: 14px; margin: 26px 0 0; }
footer { margin: 40px 0 30px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; font-family: var(--sans); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Браузер не дав увімкнути звук сам — прохання торкнутися сторінки */
.wake {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  padding: 14px 22px; border-radius: 999px; max-width: calc(100% - 32px); text-align: center;
  background: var(--gold); color: var(--bg); font-weight: 600; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: wake-pulse 2s ease-in-out infinite;
}
@keyframes wake-pulse { 50% { transform: translateX(-50%) scale(1.04); } }
@media (prefers-reduced-motion: reduce) { .wake { animation: none; } }
