/*
 * Публичная страница.
 *
 * Тёплая бумага, золото, глубокий зелёный: цвета взяты у самого предмета —
 * охра штукатурки, медь купола, зелень двора. Ни одного внешнего шрифта:
 * политика содержимого запрещает чужие источники, а системная гарнитура
 * грузится мгновенно на любом телефоне.
 */

:root {
  --bg: #f6f3ec;
  --paper: #fffdf8;
  --ink: #23201b;
  --mute: #6f675c;
  --dim: #8d857a;
  --line: #e6dfd2;
  --line-soft: #efe9dd;

  --gold: #c1902c;
  --gold-deep: #9a6f14;
  --gold-soft: #f4e6c4;
  --green: #2f5d62;
  --green-soft: #dfe9e6;
  --brick: #b4694a;

  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(35, 32, 27, .06), 0 8px 24px rgba(35, 32, 27, .06);

  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 24px; margin: 0 0 10px; }

a { color: var(--green); text-decoration-color: color-mix(in srgb, var(--green) 35%, transparent); }
a:hover { text-decoration-color: currentColor; }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ── Шапка ─────────────────────────────────────────────────────────────── */

.top {
  background: linear-gradient(180deg, var(--paper), color-mix(in srgb, var(--paper) 70%, var(--bg)));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(140%) blur(6px);
}

.top-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 68px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; color: inherit; }
.brand-mark {
  display: grid; place-items: center;
  width: 42px; height: 42px; flex: none;
  color: var(--gold-deep);
  background: var(--gold-soft);
  border-radius: 12px;
}
.brand b { display: block; font-family: var(--serif); font-size: 17px; line-height: 1.25; }
.brand i { display: block; font-style: normal; font-size: 13px; color: var(--mute); }

.top-sum { text-align: right; flex: none; }
.top-sum b {
  display: block; font-family: var(--serif); font-size: 22px;
  font-variant-numeric: tabular-nums; color: var(--gold-deep);
}
.top-sum i { font-style: normal; font-size: 13px; color: var(--mute); }

/* ── Пометка демонстрации ──────────────────────────────────────────────── */

.demo-note {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px dashed var(--gold);
  background: color-mix(in srgb, var(--gold-soft) 60%, var(--paper));
  border-radius: var(--radius-s);
  font-size: 14px;
  color: var(--gold-deep);
}

/* ── Сцена ─────────────────────────────────────────────────────────────── */

.hero { padding: 26px 0 10px; }

.lead {
  font-family: var(--serif);
  font-size: clamp(19px, 2.4vw, 26px);
  line-height: 1.35;
  margin: 0 0 18px;
  max-width: 34em;
}

.scene {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#church { display: block; width: 100%; height: auto; touch-action: manipulation; }

.scene-hint {
  position: absolute; left: 16px; bottom: 14px;
  font-size: 13px; color: var(--mute);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  pointer-events: none;
  animation: fade-in .4s ease both;
}

.noscript-note { padding: 18px; color: var(--mute); }

/* Подсказка о части храма */
.tip {
  position: absolute;
  z-index: 5;
  min-width: 230px; max-width: 290px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  pointer-events: none;
  transform: translate(-50%, -100%);
  animation: fade-in .12s ease both;
}
.tip b { font-family: var(--serif); font-size: 16px; display: block; }
.tip .tip-material { font-size: 13px; color: var(--mute); margin-bottom: 8px; }
.tip .tip-sum { font-size: 14px; font-variant-numeric: tabular-nums; }
.tip .tip-units { font-size: 13px; color: var(--mute); margin-top: 4px; }
.tip .tip-hint { color: var(--gold-deep); }
.tip-dots { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0 2px; }
.tip-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: color-mix(in srgb, var(--line) 80%, var(--paper));
  border: 1px solid var(--line);
}
.tip-dots i.is-on { background: var(--gold); border-color: var(--gold-deep); }
.tip .part-bar { margin: 8px 0 6px; }
.tip.is-clickable { pointer-events: auto; }

@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }

/* ── Переключатель времени суток ───────────────────────────────────────── */

.mood-toggle {
  position: absolute; top: 12px; right: 12px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  border-radius: 999px;
  cursor: pointer;
  font-size: 17px; line-height: 1;
  color: var(--gold-deep);
  transition: transform .15s ease, background .2s ease;
}
.mood-toggle:hover { transform: scale(1.06); background: var(--paper); }
.mood-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Ночью страница тоже слегка приглушается — иначе светлая вёрстка вокруг
   тёмного рисунка режет глаз. */
body.is-night { --bg: #efeae1; }
body.is-night .scene { border-color: #d8cfc0; }

/* ── Летопись ──────────────────────────────────────────────────────────── */

.chronicle { padding: 10px 0 20px; }
.chronicle-list { list-style: none; margin: 0; padding: 0; }
.chronicle-list li {
  display: flex; align-items: baseline; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.chronicle-date {
  font-variant-numeric: tabular-nums; color: var(--mute); font-size: 14px;
  min-width: 92px;
}
.chronicle-name { font-family: var(--serif); font-size: 17px; flex: 1; }
.chronicle-sum { color: var(--gold-deep); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ── Итоги под рисунком ────────────────────────────────────────────────── */

.totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 18px 0 6px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.total {
  background: var(--paper);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.total b {
  font-family: var(--serif);
  font-size: clamp(20px, 2.6vw, 28px);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}
.total:first-child b { color: var(--gold-deep); }
.total span { font-size: 13px; color: var(--mute); }

/* ── Прогресс ──────────────────────────────────────────────────────────── */

.progress-row { margin: 18px 0 8px; }

.bar {
  height: 12px;
  background: color-mix(in srgb, var(--line) 70%, var(--paper));
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--gold), #e0b34f 60%, var(--gold));
  border-radius: inherit;
  transition: width .8s cubic-bezier(.22, .8, .25, 1);
}

.progress-meta {
  margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 14px; color: var(--mute);
}
.progress-meta .dot { color: var(--line); }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0 8px; }

/* ── Кнопки ────────────────────────────────────────────────────────────── */

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border-radius: 12px; border: 1px solid transparent;
  font: 600 16px/1 var(--sans); color: var(--ink);
  background: var(--paper); cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.btn-gold {
  background: linear-gradient(180deg, #d8a63c, var(--gold));
  color: #2a1f06;
  box-shadow: 0 2px 0 var(--gold-deep), 0 10px 20px rgba(154, 111, 20, .22);
}
.btn-gold:hover { background: linear-gradient(180deg, #e0b04a, #c99a2e); }

.btn-plain { border-color: var(--line); color: var(--ink); }
.btn-plain:hover { background: var(--paper); border-color: var(--gold); }

.btn-small { min-height: 38px; padding: 0 14px; font-size: 14px; border: 1px solid var(--line); }
.btn-wide { width: 100%; }

/* ── Части храма ───────────────────────────────────────────────────────── */

.parts { padding: 34px 0 10px; }
.section-note { color: var(--mute); max-width: 60ch; margin: 0 0 18px; }

.part-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.part {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

/* Портрет части: маленький, в углу, не спорит с текстом. */
.part-thumb {
  position: absolute; top: 12px; right: 12px;
  width: 58px; height: 58px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  opacity: .95;
}
.part-head { padding-right: 66px; }
.part:hover { border-color: var(--gold); box-shadow: var(--shadow); }
.part.is-highlight { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.part.is-done { background: linear-gradient(180deg, var(--paper), color-mix(in srgb, var(--gold-soft) 45%, var(--paper))); }

.part-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.part-head b { font-family: var(--serif); font-size: 17px; }
.part-percent { font-variant-numeric: tabular-nums; color: var(--gold-deep); font-weight: 600; }
.part-flag {
  font-size: 12px; color: var(--green);
  background: var(--green-soft); border-radius: 999px; padding: 3px 10px;
  white-space: nowrap;
}

.part-bar {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--line) 75%, var(--paper));
}
.part-bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: width .8s cubic-bezier(.22, .8, .25, 1);
}

.part-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-variant-numeric: tabular-nums; }
.part-sub { font-size: 13px; color: var(--mute); }
.part-built {
  font-size: 12px; color: var(--green);
  background: var(--green-soft); border-radius: 999px; padding: 2px 8px;
}
.part .btn { align-self: flex-start; margin-top: 4px; }

/* ── Лента и стена ─────────────────────────────────────────────────────── */

.two-cols {
  display: grid; gap: 28px; padding: 34px 0;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.feed, .wall { list-style: none; margin: 0; padding: 0; }

.feed li {
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
}
.feed li::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); flex: none;
  align-self: center;
}
.feed li:first-child { animation: slide-in .5s ease both; }
.feed b { font-weight: 600; }
.feed .feed-sum { color: var(--gold-deep); font-variant-numeric: tabular-nums; font-weight: 600; }
.feed i { font-style: normal; color: var(--mute); font-size: 14px; }
.feed q { flex: 1 0 100%; color: var(--mute); font-size: 14px; }
.feed-empty { color: var(--mute); }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.wall {
  display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.wall li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--paper); font-size: 14px;
}
.wall span { color: var(--mute); font-variant-numeric: tabular-nums; }

/* ── Вопросы ───────────────────────────────────────────────────────────── */

.faq { padding: 10px 0 40px; }
.faq details {
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 0;
}
.faq summary { cursor: pointer; font-weight: 600; font-family: var(--serif); font-size: 17px; }
.faq p { color: var(--mute); margin: 8px 0 0; max-width: 70ch; }

/* ── Подвал ────────────────────────────────────────────────────────────── */

.foot { border-top: 1px solid var(--line); background: var(--paper); margin-top: 20px; }
.foot-in {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 0; font-size: 14px; color: var(--mute);
}
.foot-links { display: flex; gap: 16px; }

/* ── Окно пожертвования ────────────────────────────────────────────────── */

.modal {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  width: min(460px, calc(100vw - 24px));
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 60px rgba(35, 32, 27, .28);
}
.modal::backdrop { background: rgba(35, 32, 27, .45); backdrop-filter: blur(2px); }

.donate-form { padding: 18px; display: flex; flex-direction: column; gap: 12px; }

.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head b { font-family: var(--serif); font-size: 20px; }
.modal-close {
  appearance: none; border: 0; background: transparent;
  font-size: 26px; line-height: 1; color: var(--mute); cursor: pointer;
  width: 40px; height: 40px; border-radius: 10px;
}
.modal-close:hover { background: var(--bg); color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--mute); }
.field input, .field select, .field textarea {
  font: 400 16px/1.4 var(--sans);
  color: var(--ink);
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: 500 14px/1 var(--sans);
}
.chips button:hover, .chips button.is-active {
  border-color: var(--gold); background: var(--gold-soft);
}

.units-hint { margin: 0; font-size: 14px; color: var(--gold-deep); min-height: 20px; }

.check { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--mute); }
.check input { width: 18px; height: 18px; accent-color: var(--gold-deep); }

.modal-note { margin: 0; font-size: 13px; color: var(--mute); }

/* ── Всплывающие сообщения ─────────────────────────────────────────────── */

.toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #f6f1e6;
  border-radius: 12px; padding: 10px 14px;
  font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: toast-in .35s cubic-bezier(.2, .9, .3, 1) both;
  max-width: 320px;
}
.toast b { color: #f0cf7a; }
.toast.is-out { animation: toast-out .3s ease forwards; }

@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96) } to { opacity: 1; transform: none } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) } }

/* ── Страницы благодарности, оплаты, реквизитов, ошибок ────────────────── */

.plain-page { padding: 40px 0 60px; }
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
  max-width: 640px;
}
.card h1 { font-size: 28px; margin: 0 0 8px; }
.card p { color: var(--mute); }
.card .big {
  font-family: var(--serif); font-size: 34px; color: var(--gold-deep);
  font-variant-numeric: tabular-nums; margin: 10px 0;
}
.card ul { padding-left: 18px; color: var(--mute); }
.req-list { list-style: none; padding: 0; }
.req-list li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); display: flex; gap: 12px; justify-content: space-between; }
.req-list b { font-variant-numeric: tabular-nums; }

.pay-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.pay-card { width: min(420px, 100%); text-align: center; }
.pay-demo {
  border: 1px dashed var(--gold); background: var(--gold-soft);
  color: var(--gold-deep); border-radius: var(--radius-s);
  padding: 10px 14px; font-size: 14px; margin-bottom: 16px;
}
.pay-actions { display: flex; gap: 10px; margin-top: 18px; }
.pay-actions .btn { flex: 1; }

/* ── Страница благодарности ────────────────────────────────────────────── */

.thanks-page { padding-top: 28px; }

.thanks-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(280px, 420px) 1fr;
  align-items: start;
}

.thanks-scene {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.thanks-scene canvas { display: block; width: 100%; height: auto; }
.thanks-caption {
  margin: 0; padding: 10px 14px;
  font-size: 14px; color: var(--mute);
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 860px) {
  .thanks-grid { grid-template-columns: 1fr; }
}

.units-badge {
  margin: 14px 0 0;
  padding: 11px 14px;
  background: color-mix(in srgb, var(--gold-soft) 55%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  border-radius: 12px;
  font-size: 15px; color: var(--ink);
}
.units-badge b { font-variant-numeric: tabular-nums; color: var(--gold-deep); }
.units-badge span { color: var(--mute); }

/* ── Липкая кнопка на телефоне ─────────────────────────────────────────── */

.sticky-cta {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 30;
  display: none;
  box-shadow: 0 8px 28px rgba(35, 32, 27, .25);
}

@media (max-width: 680px) {
  /* Кнопка появляется, когда рисунок ушёл вверх: до этого она не нужна —
     своя кнопка стоит прямо под храмом. */
  body.is-scrolled .sticky-cta { display: flex; }
  .foot { padding-bottom: 72px; }
}

/* ── Мелочи ────────────────────────────────────────────────────────────── */

@media (max-width: 680px) {
  /*
   * На телефоне шапка складывается в две строки: название храма длинное,
   * и в одну строку с суммой оно ломалось на четыре, съедая пол-экрана.
   */
  .top-in { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 0; }
  .brand b { font-size: 15px; line-height: 1.2; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .top-sum { text-align: left; display: flex; align-items: baseline; gap: 8px; }
  .top-sum b { font-size: 19px; }

  .demo-note { font-size: 13px; padding: 9px 12px; }
  .lead { font-size: 18px; margin-bottom: 14px; }

  /* Подсказка уезжает под рисунок: поверх храма она закрывала то, ради
     чего человек сюда и смотрит. */
  .scene { overflow: visible; }
  .scene-hint {
    position: static;
    display: block;
    margin: 10px 2px 0;
    text-align: center;
    font-size: 12.5px;
    border-radius: 12px;
    background: transparent;
    border: 0;
    color: var(--dim);
  }
  .lead { font-size: 19px; }
  .cta-row .btn { flex: 1; }
  .totals { grid-template-columns: 1fr 1fr; }
  .mood-toggle { top: 8px; right: 8px; width: 36px; height: 36px; }
  .chronicle-list li { flex-wrap: wrap; gap: 6px 12px; }
  .chronicle-name { flex: 1 0 60%; }
  .totals .total:last-child { grid-column: 1 / -1; }
  .total { padding: 11px 13px; }
  .tip { position: fixed; left: 50% !important; bottom: 12px; top: auto !important; transform: translateX(-50%); width: calc(100vw - 24px); max-width: none; }
}

/* Человек попросил систему не двигаться — выключаем всё лишнее. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
