:root {
  --background: 40 33% 97%;
  --foreground: 25 20% 16%;
  --card: 40 30% 95%;
  --gold: 36 60% 48%;
  --gold-light: 38 50% 70%;
  --gold-dark: 34 65% 35%;
  --ivory: 40 33% 97%;
  --muted: 35 20% 92%;
  --muted-foreground: 25 10% 46%;
  --border: 35 20% 87%;
  --radius: 0.75rem;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

/* ===== Dark Mode ===== */
/* dark-init применяется до загрузки CSS для предотвращения "flash of light" */
html.dark-init body { background: hsl(25 15% 10%); }

body.dark {
  --background: 25 15% 10%;
  --foreground: 38 22% 85%;
  --card: 25 14% 14%;
  --gold: 36 55% 52%;
  --gold-light: 38 45% 62%;
  --gold-dark: 34 58% 42%;
  --ivory: 25 14% 12%;
  --muted: 25 10% 20%;
  --muted-foreground: 38 10% 58%;
  --border: 25 14% 24%;
}
body.dark::after {
  background: hsl(var(--background) / 0.65);
}

/* Прозрачная шапка у верха: фон/рамка/тень только после прокрутки — см. body.site-nav-pinned .site-header */

body.dark .site-footer {
  background: hsl(var(--card) / 0.85);
  border-top: 1px solid hsl(var(--border));
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: transparent;
  color: hsl(var(--foreground));
  position: relative;
}

/* Подложка на всех страницах (картинка по разделу задаётся через --underlay-url в Layout) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--underlay-url, url('/assets/hero-bg.jpg'));
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: var(--underlay-opacity, 0.29);
  z-index: -2;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: hsl(var(--background) / 0.4);
  z-index: -1;
  pointer-events: none;
}

/* Тематические подложки по разделам (виднее на ~15%) */
body.underlay-slovo-bozhie::before { --underlay-opacity: 0.31; }
body.underlay-enciklopedii::before { --underlay-opacity: 0.27; }
body.underlay-molitva::before { --underlay-opacity: 0.33; }

/* Акцент раздела Молитва — оранжевый (Слово Божие остаётся золотым) */
body.underlay-molitva {
  --gold: 32 75% 48%;
  --gold-light: 38 55% 72%;
  --gold-dark: 30 70% 32%;
}
body.underlay-lyudi::before { --underlay-opacity: 0.29; }
body.underlay-pomoshch::before { --underlay-opacity: 0.27; }
body.underlay-media::before { --underlay-opacity: 0.25; }
body.underlay-tehnicheskij::before {
  --underlay-opacity: 0.52;
  background-size: 100% 100%;
  background-position: 0 0;
}
body.underlay-home::before { opacity: 0; pointer-events: none; }

h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); }

/* У верха страницы — без фона (видны только кнопки, текст, лого на подложке); после прокрутки — панель как раньше */
.site-header {
  position: relative;
  z-index: 200;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
  box-shadow: none;
  padding: 0.275rem 0.85rem;
  overflow: visible;
}

body.site-nav-pinned .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: hsl(var(--card) / 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid hsl(var(--border) / 0.9);
  box-shadow: 0 2px 14px hsl(var(--gold) / 0.1), 0 1px 8px hsl(var(--gold) / 0.06);
  transition:
    transform 0.32s cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    background-color 0.25s ease;
  will-change: transform;
}

/* Режим чтения: шапка уезжает вверх, отступ контента убирается */
body.site-nav-pinned.site-header-retracted .site-header {
  transform: translateY(-100%);
  pointer-events: none;
  box-shadow: none;
  border-bottom-color: transparent;
}

body.dark.site-nav-pinned .site-header {
  background: hsl(var(--card) / 0.92);
}

/* Читалка: при закреплении — плотнее от подложки */
body[data-bible-reader="true"].site-nav-pinned .site-header {
  background: hsl(var(--card) / 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
  box-shadow:
    0 3px 22px hsl(25 22% 12% / 0.14),
    0 1px 0 hsl(var(--border) / 0.45);
}

body.dark[data-bible-reader="true"].site-nav-pinned .site-header {
  background: hsl(22 9% 10% / 0.97);
  box-shadow:
    0 4px 28px hsl(0 0% 0% / 0.52),
    0 1px 0 hsl(var(--border) / 0.35);
}

/* Образ (логотип) не сжимается и не оказывается «под» кнопками — ужимаются меню и блок кнопок */
.site-nav {
  --nav-bar-gap: clamp(6px, 1.2vw, 24px);
  --nav-links-gap: clamp(4px, 0.9vw, 24px);
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: var(--nav-bar-gap);
  min-width: 0;
  overflow: visible;
}

.site-nav-left {
  display: flex;
  align-items: center;
  gap: var(--nav-bar-gap);
  flex-shrink: 0;
  min-width: auto;
  position: relative;
  z-index: 2;
}

/* Индикатор текущего стиха (только на странице Библии); на читалке — кнопка открытия навигатора */
.current-verse-indicator {
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  color: hsl(var(--foreground));
  padding: 0.35rem 0.6rem;
  border-radius: 0.45rem;
  background: hsl(var(--muted) / 0.5);
  border: 1px solid hsl(var(--border) / 0.8);
  white-space: nowrap;
  cursor: pointer;
  text-align: center;
}

.current-verse-indicator:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* На читалке — один индикатор в .nav-actions (все ширины) */
body[data-bible-reader="true"] .current-verse-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0 0.55rem;
  box-sizing: border-box;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.2;
  border-radius: var(--radius);
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  max-width: min(100%, 40vw);
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-appearance: none;
  appearance: none;
}

body[data-bible-reader="true"] .current-verse-indicator:hover {
  background: hsl(var(--gold) / 0.12);
  border-color: hsl(var(--gold) / 0.5);
}

body[data-bible-reader="true"] .current-verse-indicator:focus-visible {
  outline: 2px solid hsl(var(--gold) / 0.55);
  outline-offset: 2px;
}
.current-verse-indicator:empty {
  display: none;
}

@media (min-width: 641px) {
  /* Читалка: «Быт 1:1» + кнопки по центру между образом и пунктами меню; шаг 8px между элементами центра и от колонок */
  /* Колонка образа — auto (не в 1fr), иначе иконка сжимается/перекрывается; меню и центр ужимаются */
  body[data-bible-reader="true"] .site-nav {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, max-content);
    grid-template-rows: auto;
    align-items: center;
    column-gap: clamp(4px, 1vw, 8px);
    row-gap: 0;
    justify-content: unset;
    flex-wrap: unset;
    min-width: 0;
  }

  body[data-bible-reader="true"] .site-nav-left {
    justify-self: start;
    gap: clamp(4px, 1vw, 8px);
  }

  body[data-bible-reader="true"] .nav-actions {
    justify-self: center;
    gap: clamp(4px, 1vw, 8px);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  body[data-bible-reader="true"] .nav-links {
    justify-self: end;
    min-width: 0;
    max-width: 100%;
    width: auto;
  }
}
@media (max-width: 640px) {
  /* На читалке моб.: компактная иконка вместо скрытого логотипа */
  [data-bible-reader="true"] .site-nav-left .site-logo-img {
    width: 38px;
    height: 38px;
  }

  body[data-bible-reader="true"] .site-nav {
    gap: 8px;
  }
  body[data-bible-reader="true"] .site-nav-left {
    gap: 8px;
  }
  body[data-bible-reader="true"] .nav-actions {
    gap: 8px;
  }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--nav-bar-gap, 24px);
  flex-shrink: 1;
  min-width: 0;
  flex-wrap: nowrap;
}

.nav-actions .theme-toggle-btn,
.nav-actions .section-settings-btn,
.nav-actions .nav-comments-btn,
.nav-actions .nav-menu-toggle {
  flex-shrink: 0;
}

/* Тема (☾): те же цвет текста/рамки/фона, что у «Меню» и кнопок ⚙/💬 в шапке (section-settings.css не на всех страницах) */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 1.18rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.theme-toggle-btn:hover {
  background: hsl(var(--gold) / 0.12);
  border-color: hsl(var(--gold) / 0.5);
  color: hsl(var(--gold-dark));
}

.site-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 0;
  border-radius: 10px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.site-logo:hover {
  box-shadow: 0 0 0 2px hsl(var(--gold) / 0.35);
}

.site-logo:focus-visible {
  outline: 2px solid hsl(var(--gold));
  outline-offset: 3px;
}

.site-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  object-position: center;
  border-radius: 9px;
  display: block;
  border: none;
  box-shadow: none;
  /* Вместо «прозрачного» фона логотипа — тёплый тон страницы читалки */
  background: rgb(245, 243, 237);
}

body.dark .site-logo-img {
  background: rgb(245, 243, 237);
  border: none;
  box-shadow: none;
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: var(--nav-links-gap, 24px);
  flex: 0 1 auto;
  min-width: 0;
}

.nav-menu-toggle {
  display: none;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  border-radius: 0.6rem;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  font-size: 0.92rem;
  box-shadow: inset 0 -2px 0 0 transparent;
  transition: color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.nav-menu-toggle:hover {
  color: hsl(var(--gold-dark));
  box-shadow: inset 0 -2px 0 0 hsl(var(--gold-dark));
}

/* Узкая шапка: компактнее иконки темы / настроек / комментариев (образ не трогаем) */
@media (max-width: 1200px) {
  .site-nav .theme-toggle-btn,
  .site-nav .section-settings-btn,
  .site-nav .nav-comments-btn {
    width: clamp(36px, 8vw, 44px);
    height: clamp(36px, 8vw, 44px);
    min-width: clamp(36px, 8vw, 44px);
    min-height: clamp(36px, 8vw, 44px);
    font-size: clamp(0.95rem, 2.4vw, 1.18rem);
  }
}

.nav-item {
  position: relative;
  flex-shrink: 1;
  min-width: 0;
}

.nav-item-head {
  display: flex;
  align-items: center;
  gap: var(--nav-links-gap, 24px);
  min-width: 0;
  flex-shrink: 1;
}

/* Узкая шапка: меньше шрифт и интервал между словами; подпись может обрезаться многоточием */
.nav-link {
  color: hsl(var(--foreground));
  text-decoration: none;
  font-size: clamp(0.72rem, 0.65rem + 0.35vw, 0.92rem);
  padding: 0.45rem 0;
  border-radius: 0.45rem;
  transition: color 0.22s ease, box-shadow 0.22s ease;
  display: inline-flex;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  box-shadow: inset 0 -2px 0 0 transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: var(--nav-links-gap, 24px);
  flex-shrink: 1;
  min-width: 0;
  flex-wrap: nowrap;
}
.nav-auth .nav-user { color: hsl(var(--foreground)); cursor: default; }
.nav-logout-form { display: inline; margin: 0; }
.nav-logout {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: hsl(var(--foreground));
  text-decoration: none;
  font-size: clamp(0.72rem, 0.65rem + 0.35vw, 0.92rem);
  padding: 0.45rem 0;
  border-radius: 0.45rem;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  justify-content: center;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.22s ease, box-shadow 0.22s ease;
  box-shadow: inset 0 -2px 0 0 transparent;
}
.nav-logout:hover {
  color: hsl(var(--foreground));
  background: transparent;
  box-shadow: inset 0 -2px 0 0 hsl(var(--foreground));
}

.nav-auth .nav-link:hover {
  color: hsl(var(--foreground));
  background: transparent;
  box-shadow: inset 0 -2px 0 0 hsl(var(--foreground));
}

.nav-link:hover {
  color: hsl(var(--gold-dark));
  background: transparent;
  box-shadow: inset 0 -2px 0 0 hsl(var(--gold-dark));
}

/* Навигация: hover — подчёркивание снизу + цвет текста в тоне раздела (без заливки) */
.nav-home .nav-link:hover {
  background: transparent;
  color: hsl(var(--gold-dark));
  box-shadow: inset 0 -2px 0 0 hsl(var(--gold-dark));
}
.nav-section-slovo-bozhie .nav-link:hover {
  background: transparent;
  color: hsl(var(--gold-dark));
  box-shadow: inset 0 -2px 0 0 hsl(var(--gold-dark));
}
.nav-section-enciklopedii .nav-link:hover {
  background: transparent;
  color: hsl(205 45% 28%);
  box-shadow: inset 0 -2px 0 0 hsl(205 45% 28%);
}
.nav-section-molitva .nav-link:hover {
  background: transparent;
  color: hsl(30 70% 28%);
  box-shadow: inset 0 -2px 0 0 hsl(30 70% 28%);
}
.nav-section-lyudi .nav-link:hover {
  background: transparent;
  color: hsl(158 40% 26%);
  box-shadow: inset 0 -2px 0 0 hsl(158 40% 26%);
}
.nav-section-pomoshch .nav-link:hover {
  background: transparent;
  color: hsl(350 50% 30%);
  box-shadow: inset 0 -2px 0 0 hsl(350 50% 30%);
}
.nav-section-media .nav-link:hover {
  background: transparent;
  color: hsl(268 40% 32%);
  box-shadow: inset 0 -2px 0 0 hsl(268 40% 32%);
}
.nav-section-tehnicheskij .nav-link:hover {
  background: transparent;
  color: hsl(220 12% 24%);
  box-shadow: inset 0 -2px 0 0 hsl(220 12% 24%);
}

.nav-section-slovo-bozhie .dropdown-toggle:hover,
.nav-home .dropdown-toggle:hover {
  background: transparent;
  color: hsl(var(--gold-dark));
  box-shadow: inset 0 -2px 0 0 hsl(var(--gold-dark));
}
.nav-section-enciklopedii .dropdown-toggle:hover {
  background: transparent;
  color: hsl(205 45% 28%);
  box-shadow: inset 0 -2px 0 0 hsl(205 45% 28%);
}
.nav-section-molitva .dropdown-toggle:hover {
  background: transparent;
  color: hsl(30 70% 28%);
  box-shadow: inset 0 -2px 0 0 hsl(30 70% 28%);
}
.nav-section-lyudi .dropdown-toggle:hover {
  background: transparent;
  color: hsl(158 40% 26%);
  box-shadow: inset 0 -2px 0 0 hsl(158 40% 26%);
}
.nav-section-pomoshch .dropdown-toggle:hover {
  background: transparent;
  color: hsl(350 50% 30%);
  box-shadow: inset 0 -2px 0 0 hsl(350 50% 30%);
}
.nav-section-media .dropdown-toggle:hover {
  background: transparent;
  color: hsl(268 40% 32%);
  box-shadow: inset 0 -2px 0 0 hsl(268 40% 32%);
}
.nav-section-tehnicheskij .dropdown-toggle:hover {
  background: transparent;
  color: hsl(220 12% 24%);
  box-shadow: inset 0 -2px 0 0 hsl(220 12% 24%);
}

.dropdown-toggle {
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--foreground));
  border-radius: 0.45rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 0 transparent;
  transition: color 0.22s ease, box-shadow 0.22s ease;
}

.dropdown-toggle:hover {
  color: hsl(var(--gold-dark));
  background: transparent;
  box-shadow: inset 0 -2px 0 0 hsl(var(--gold-dark));
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: -1px;
  min-width: 230px;
  max-width: min(360px, 90vw);
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  list-style: none;
  margin: 0;
  /* Как контекстное меню стиха: без боковых отступов — hover на всю ширину; вертикаль только у пунктов */
  padding: 4px 0;
  box-shadow: 0 12px 30px hsl(var(--foreground) / 0.12);
  display: none;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  z-index: 400;
}

.has-dropdown:hover > .dropdown-menu,
.has-dropdown:focus-within > .dropdown-menu,
.has-dropdown.is-open > .dropdown-menu {
  display: flex;
}

.dropdown-menu li {
  width: 100%;
  margin: 0;
}

.dropdown-menu li + li {
  margin-top: 0;
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  text-decoration: none;
  color: hsl(var(--foreground));
  font-size: 0.9rem;
  /* ~8px между строками соседних пунктов (4+4), как .verse-row-menu-item */
  padding: 4px 12px;
  border-radius: 0;
  transition: background 0.2s ease, box-shadow 0.25s ease, color 0.2s ease;
  box-shadow: 0 0 0 transparent;
}

.dropdown-menu a:hover {
  box-shadow: none;
  background: hsl(var(--muted) / 0.55);
}

.dropdown-menu a:focus-visible {
  outline: none;
  box-shadow: none;
  background: hsl(var(--muted) / 0.55);
}

/* Выпадающее меню: тон раздела заливкой на всю ширину строки (как меню стиха), без цветной рамки/свечения */
.dropdown-section-slovo-bozhie .dropdown-link:hover,
.dropdown-section-slovo-bozhie .dropdown-link:focus-visible {
  box-shadow: none;
  background: hsl(var(--gold) / 0.2);
  color: hsl(var(--gold-dark));
}
.dropdown-section-enciklopedii .dropdown-link:hover,
.dropdown-section-enciklopedii .dropdown-link:focus-visible {
  box-shadow: none;
  background: hsl(205 55% 45% / 0.16);
  color: hsl(205 45% 28%);
}
.dropdown-section-molitva .dropdown-link:hover,
.dropdown-section-molitva .dropdown-link:focus-visible {
  box-shadow: none;
  background: hsl(32 75% 48% / 0.16);
  color: hsl(30 70% 28%);
}
.dropdown-section-lyudi .dropdown-link:hover,
.dropdown-section-lyudi .dropdown-link:focus-visible {
  box-shadow: none;
  background: hsl(158 45% 42% / 0.16);
  color: hsl(158 40% 26%);
}
.dropdown-section-pomoshch .dropdown-link:hover,
.dropdown-section-pomoshch .dropdown-link:focus-visible {
  box-shadow: none;
  background: hsl(350 55% 48% / 0.14);
  color: hsl(350 50% 30%);
}
.dropdown-section-media .dropdown-link:hover,
.dropdown-section-media .dropdown-link:focus-visible {
  box-shadow: none;
  background: hsl(268 45% 48% / 0.14);
  color: hsl(268 40% 32%);
}
.dropdown-section-tehnicheskij .dropdown-link:hover,
.dropdown-section-tehnicheskij .dropdown-link:focus-visible {
  box-shadow: none;
  background: hsl(220 12% 42% / 0.14);
  color: hsl(220 12% 24%);
}

.nav-badge {
  color: hsl(var(--gold-dark));
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.site-main {
  min-height: calc(100vh - 120px);
}

/* Компенсация выхода шапки из потока в режиме fixed (высота задаётся JS: --site-header-h) */
body.site-nav-pinned .site-main {
  padding-top: var(--site-header-h, 3.25rem);
  transition: padding-top 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

body.site-nav-pinned.site-header-retracted .site-main {
  padding-top: 0;
}

/* Читалка Библии: при скрытой шапке не убирать отступ — иначе стихи скачут при автоскрытии/показе. */
body[data-bible-reader="true"].site-nav-pinned.site-header-retracted .site-main {
  padding-top: var(--site-header-h, 3.25rem);
}

@media (prefers-reduced-motion: reduce) {
  body.site-nav-pinned .site-header,
  body.site-nav-pinned .site-main {
    transition: none !important;
  }
}

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
}

.hero {
  position: relative;
  width: 100%;
  max-width: 100vw;
  height: clamp(200px, 38vh, 420px);
  min-height: 200px;
  max-height: calc(100vh - 120px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid hsl(var(--border) / 0.6);
  box-sizing: border-box;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, hsl(var(--ivory) / 0.3) 0%, hsl(var(--ivory) / 0.6) 40%, hsl(var(--ivory) / 0.95) 100%);
}

.hero-content {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 90vw;
  text-align: center;
  padding: 1rem;
  box-sizing: border-box;
}

.hero-sub {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 0.75rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.75rem);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.gold-divider {
  width: 6rem;
  height: 2.5px;
  margin: 1rem auto 0;
  background: linear-gradient(90deg, transparent, hsl(var(--gold)), transparent);
  box-shadow: 0 0 12px hsl(var(--gold) / 0.3);
}

.hero-floating-icon {
  position: absolute;
  right: 18%;
  bottom: 50%;
  transform: translateY(50%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-floating-icon img {
  width: 204px;
  height: auto;
  border-radius: 0.25rem;
  box-shadow:
    0 0 30px rgba(255, 255, 255, 1),
    0 0 65px rgba(255, 255, 255, 1),
    0 0 100px rgba(255, 255, 255, 1),
    0 0 140px rgba(255, 255, 255, 1),
    0 0 180px rgba(255, 255, 255, 0.95),
    0 0 220px rgba(255, 255, 255, 0.85),
    0 0 30px hsl(var(--gold) / 0.9),
    0 0 60px hsl(var(--gold) / 0.8),
    0 0 100px hsl(var(--gold) / 0.6);
  animation: hero-float 5s ease-in-out infinite;
}

@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@media (max-width: 768px) {
  .hero-floating-icon {
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    bottom: auto;
    top: 0.5rem;
    transform: none;
    width: max-content;
  }
  .hero-floating-icon img { width: 90px; }
}

/* ===== Стих дня ===== */
.daily-verse-section {
  display: flex;
  justify-content: center;
  padding: 2rem 1rem 0.5rem;
}
.daily-verse-block {
  max-width: 680px;
  width: 100%;
  background: hsl(var(--card) / 0.82);
  border: 1px solid hsl(var(--gold) / 0.3);
  border-radius: var(--radius);
  box-shadow: 0 2px 16px hsl(var(--gold) / 0.08), inset 0 1px 0 hsl(var(--gold) / 0.12);
  padding: 1.5rem 2rem;
  text-align: center;
  position: relative;
  backdrop-filter: blur(6px);
}
.daily-verse-block::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 2.5px;
  background: linear-gradient(90deg, transparent, hsl(var(--gold)), transparent);
  border-radius: 2px;
}
.daily-verse-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: hsl(var(--gold-dark));
  margin-bottom: 0.85rem;
  opacity: 0.85;
}
.daily-verse-text {
  font-family: var(--font-display);
  font-size: 1.13rem;
  font-style: italic;
  line-height: 1.65;
  color: hsl(var(--foreground));
  margin: 0 0 1rem;
}
.daily-verse-ref {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: hsl(var(--gold-dark));
  text-decoration: none;
  letter-spacing: 0.04em;
  border-bottom: 1px solid hsl(var(--gold) / 0.35);
  transition: color 0.2s, border-color 0.2s;
}
.daily-verse-ref:hover {
  color: hsl(var(--gold));
  border-color: hsl(var(--gold) / 0.7);
}
@media (max-width: 640px) {
  .daily-verse-block { padding: 1.25rem 1.1rem; }
  .daily-verse-text { font-size: 1rem; }
}

.features-wrap {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 0.85rem 2.4rem;
  background: transparent;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.95rem 1rem;
}

.icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  border-radius: 1rem;
  background: hsl(var(--card) / 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid hsl(var(--border) / 0.8);
  box-shadow: 0 2px 12px hsl(var(--gold-dark) / 0.06), 0 1px 0 0 hsl(var(--gold-light) / 0.15) inset;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.25s, border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.icon-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px hsl(var(--gold-dark) / 0.12), 0 1px 0 0 hsl(var(--gold) / 0.25) inset;
  border-color: hsl(var(--gold) / 0.5);
  background: hsl(var(--card) / 0.92);
}

/* При наведении — подсветка в цвет раздела (главная: карточки разделов) */
.icon-card.section-slovo-bozhie:hover { border-color: hsl(var(--gold) / 0.65); box-shadow: 0 12px 28px hsl(var(--gold) / 0.18), 0 1px 0 0 hsl(var(--gold) / 0.3) inset; }
.icon-card.section-enciklopedii:hover { border-color: hsl(205 55% 45% / 0.65); box-shadow: 0 12px 28px hsl(205 55% 45% / 0.18), 0 1px 0 0 hsl(205 55% 45% / 0.3) inset; }
.icon-card.section-molitva:hover { border-color: hsl(32 75% 48% / 0.65); box-shadow: 0 12px 28px hsl(32 75% 48% / 0.18), 0 1px 0 0 hsl(32 75% 48% / 0.3) inset; }
.icon-card.section-lyudi:hover { border-color: hsl(158 45% 42% / 0.65); box-shadow: 0 12px 28px hsl(158 45% 42% / 0.18), 0 1px 0 0 hsl(158 45% 42% / 0.3) inset; }
.icon-card.section-pomoshch:hover { border-color: hsl(350 55% 48% / 0.65); box-shadow: 0 12px 28px hsl(350 55% 48% / 0.18), 0 1px 0 0 hsl(350 55% 48% / 0.3) inset; }
.icon-card.section-media:hover { border-color: hsl(268 45% 48% / 0.65); box-shadow: 0 12px 28px hsl(268 45% 48% / 0.18), 0 1px 0 0 hsl(268 45% 48% / 0.3) inset; }
.icon-card.section-tehnicheskij:hover { border-color: hsl(220 12% 42% / 0.65); box-shadow: 0 12px 28px hsl(220 12% 42% / 0.18), 0 1px 0 0 hsl(220 12% 42% / 0.3) inset; }

/* Страница раздела (2-й уровень): карточки подразделов — подсветка в цвет раздела */
.section-slovo-bozhie .icon-card:hover { border-color: hsl(var(--gold) / 0.65); box-shadow: 0 12px 28px hsl(var(--gold) / 0.18), 0 1px 0 0 hsl(var(--gold) / 0.3) inset; }
.section-enciklopedii .icon-card:hover { border-color: hsl(205 55% 45% / 0.65); box-shadow: 0 12px 28px hsl(205 55% 45% / 0.18), 0 1px 0 0 hsl(205 55% 45% / 0.3) inset; }
.section-molitva .icon-card:hover { border-color: hsl(32 75% 48% / 0.65); box-shadow: 0 12px 28px hsl(32 75% 48% / 0.18), 0 1px 0 0 hsl(32 75% 48% / 0.3) inset; }
.section-lyudi .icon-card:hover { border-color: hsl(158 45% 42% / 0.65); box-shadow: 0 12px 28px hsl(158 45% 42% / 0.18), 0 1px 0 0 hsl(158 45% 42% / 0.3) inset; }
.section-pomoshch .icon-card:hover { border-color: hsl(350 55% 48% / 0.65); box-shadow: 0 12px 28px hsl(350 55% 48% / 0.18), 0 1px 0 0 hsl(350 55% 48% / 0.3) inset; }
.section-media .icon-card:hover { border-color: hsl(268 45% 48% / 0.65); box-shadow: 0 12px 28px hsl(268 45% 48% / 0.18), 0 1px 0 0 hsl(268 45% 48% / 0.3) inset; }
.section-tehnicheskij .icon-card:hover { border-color: hsl(220 12% 42% / 0.65); box-shadow: 0 12px 28px hsl(220 12% 42% / 0.18), 0 1px 0 0 hsl(220 12% 42% / 0.3) inset; }

.icon-circle {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(145deg, hsl(var(--gold-light) / 0.45), hsl(var(--gold) / 0.25));
  color: hsl(var(--gold-dark));
  box-shadow: 0 2px 8px hsl(var(--gold-dark) / 0.12);
}

.icon-circle-svg {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
}

.icon-circle-svg svg {
  width: 100%;
  height: 100%;
  display: block;
  color: inherit;
}

.icon-card h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  color: hsl(var(--gold-dark));
  letter-spacing: 0.01em;
}

.icon-card p {
  margin: 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
  line-height: 1.55;
}

.page-footer {
  text-align: center;
  padding: 2rem 1rem;
}

.footer-text {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.section-page {
  padding-top: 1.5rem;
}

.section-header {
  text-align: center;
  margin-bottom: 1.3rem;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.section-description {
  margin: 0.65rem auto 0;
  max-width: 760px;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

/* Кнопка «Назад» в разделах и подразделах (как в толкованиях) */
.section-back-nav {
  margin-bottom: 1rem;
}

.section-back-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.95rem;
  color: hsl(var(--gold-dark));
  text-decoration: none;
  font-weight: 500;
}

.section-back-link:hover {
  text-decoration: underline;
}

/* Акцентный цвет раздела: нижняя линия-разделитель (на 20% больше) */
.section-slovo-bozhie .gold-divider { width: 7.2rem; height: 2.5px; background: linear-gradient(90deg, transparent, hsl(var(--gold)), transparent); }
.section-enciklopedii .gold-divider { width: 7.2rem; height: 2.5px; background: linear-gradient(90deg, transparent, hsl(205 55% 45%), transparent); }
.section-molitva .gold-divider { width: 7.2rem; height: 2.5px; background: linear-gradient(90deg, transparent, hsl(32 75% 48%), transparent); }
.section-lyudi .gold-divider { width: 7.2rem; height: 2.5px; background: linear-gradient(90deg, transparent, hsl(158 45% 42%), transparent); }
.section-pomoshch .gold-divider { width: 7.2rem; height: 2.5px; background: linear-gradient(90deg, transparent, hsl(350 55% 48%), transparent); }
.section-media .gold-divider { width: 7.2rem; height: 2.5px; background: linear-gradient(90deg, transparent, hsl(268 45% 48%), transparent); }
.section-tehnicheskij .gold-divider { width: 7.2rem; height: 2.5px; background: linear-gradient(90deg, transparent, hsl(220 12% 42%), transparent); }

/* На главной: полоска сверху у карточки раздела */
.icon-card.section-slovo-bozhie { border-top: 2px solid hsl(var(--gold)); }
.icon-card.section-enciklopedii { border-top: 2px solid hsl(205 55% 45%); }
.icon-card.section-molitva { border-top: 2px solid hsl(32 75% 48%); }
.icon-card.section-lyudi { border-top: 2px solid hsl(158 45% 42%); }
.icon-card.section-pomoshch { border-top: 2px solid hsl(350 55% 48%); }
.icon-card.section-media { border-top: 2px solid hsl(268 45% 48%); }
.icon-card.section-tehnicheskij { border-top: 2px solid hsl(220 12% 42%); }

.placeholder-card {
  max-width: 720px;
  margin: 1.2rem auto 0;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  padding: 1.35rem;
  text-align: center;
}

.placeholder-card h2 {
  margin: 0;
  font-size: 1.5rem;
}

.placeholder-card p {
  margin: 0.8rem 0 1rem;
  color: hsl(var(--muted-foreground));
}

.placeholder-back {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid hsl(var(--gold-light));
  color: hsl(var(--gold-dark));
  background: hsl(var(--gold) / 0.08);
}

/* Auth (Login/Register) */
.auth-card {
  max-width: 420px;
  margin: 1.5rem auto 0;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  padding: 1.5rem;
}
.auth-card .auth-field {
  margin-bottom: 1rem;
}
.auth-card label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: hsl(var(--foreground));
}
.auth-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  font-size: 1rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}
.auth-input:focus {
  outline: none;
  border-color: hsl(var(--gold));
  box-shadow: 0 0 0 2px hsl(var(--gold) / 0.2);
}
.auth-error {
  color: #c00;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.auth-validation {
  display: block;
  color: #c00;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}
.auth-checkbox { display: flex; align-items: center; gap: 0.5rem; }
.auth-checkbox input { width: auto; }
.auth-checkbox label { margin: 0; }
.auth-actions {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.auth-btn {
  min-height: 44px;
  padding: 0.55rem 1.25rem;
  border-radius: 0.65rem;
  border: none;
  background: hsl(var(--gold));
  color: hsl(var(--gold-dark));
  font-weight: 600;
  cursor: pointer;
}
.auth-btn:hover { background: hsl(var(--gold-dark)); color: hsl(var(--ivory)); }
.auth-link {
  color: hsl(var(--gold-dark));
  text-decoration: none;
  font-size: 0.95rem;
}
.auth-link:hover { text-decoration: underline; }
.auth-msg { margin: 0.75rem 0; padding: 0.5rem 0.75rem; border-radius: 0.5rem; }
.auth-msg-success { background: hsl(120 30% 95%); color: hsl(120 40% 25%); border: 1px solid hsl(120 30% 85%); }

.cabinet-block { margin-top: 2rem; }
.cabinet-block-title { font-size: 1.1rem; margin-bottom: 0.75rem; font-weight: 600; }
.cabinet-form { margin-top: 0.75rem; margin-bottom: 1rem; }
.cabinet-field { margin: 0.25rem 0; }
.cabinet-modules-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.cabinet-modules-list li { margin: 0.5rem 0; padding-left: 0; }
.cabinet-modules-list a { color: hsl(var(--gold-dark)); text-decoration: underline; }
.cabinet-modules-list a:hover { text-decoration: none; }

@media (max-width: 640px) {
  .features-grid { grid-template-columns: 1fr; }
  .nav-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .nav-links {
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 0;
    display: none;
    padding: 0;
    overflow: visible;
    list-style: none;
  }
  .nav-links.is-open {
    display: flex;
  }
  .nav-links > .nav-item {
    display: flex;
    justify-content: center;
    align-items: stretch;
    width: 200px;
    max-width: calc(100vw - 2rem);
    min-width: 0;
  }
  .nav-item-head {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
  }
  .nav-item-head .nav-link {
    flex: 1;
    min-width: 0;
    max-width: none;
    min-height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    transition: color 0.22s ease, box-shadow 0.22s ease;
  }
  /* Пункт у верхней кромки открытого меню — цвет раздела + нижнее подчёркивание */
  .nav-links.is-open .nav-item.at-header.nav-home .nav-link,
  .nav-links.is-open .nav-item.at-header.nav-section-slovo-bozhie .nav-link {
    background: transparent;
    color: hsl(var(--gold-dark));
    box-shadow: inset 0 -2px 0 0 hsl(var(--gold-dark));
  }
  .nav-links.is-open .nav-item.at-header.nav-section-enciklopedii .nav-link {
    background: transparent;
    color: hsl(205 45% 28%);
    box-shadow: inset 0 -2px 0 0 hsl(205 45% 28%);
  }
  .nav-links.is-open .nav-item.at-header.nav-section-molitva .nav-link {
    background: transparent;
    color: hsl(30 70% 28%);
    box-shadow: inset 0 -2px 0 0 hsl(30 70% 28%);
  }
  .nav-links.is-open .nav-item.at-header.nav-section-lyudi .nav-link {
    background: transparent;
    color: hsl(158 40% 26%);
    box-shadow: inset 0 -2px 0 0 hsl(158 40% 26%);
  }
  .nav-links.is-open .nav-item.at-header.nav-section-pomoshch .nav-link {
    background: transparent;
    color: hsl(350 50% 30%);
    box-shadow: inset 0 -2px 0 0 hsl(350 50% 30%);
  }
  .nav-links.is-open .nav-item.at-header.nav-section-media .nav-link {
    background: transparent;
    color: hsl(268 40% 32%);
    box-shadow: inset 0 -2px 0 0 hsl(268 40% 32%);
  }
  .nav-links.is-open .nav-item.at-header.nav-section-tehnicheskij .nav-link {
    background: transparent;
    color: hsl(220 12% 24%);
    box-shadow: inset 0 -2px 0 0 hsl(220 12% 24%);
  }
  .nav-item-head .dropdown-toggle {
    display: none;
  }
  .dropdown-menu {
    display: none !important;
  }
  .nav-links .nav-link {
    min-height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: none;
    font-size: 0.92rem;
  }
  .nav-home {
    display: flex;
    align-items: stretch;
    width: 100%;
  }
  .nav-home .nav-link {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .nav-home::after {
    display: none;
  }
  .nav-auth {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 0.1rem;
    padding: 0;
  }
  .site-logo-img {
    width: 40px;
    height: 40px;
  }
  .site-header { padding: 0.25rem 0.55rem; }
  .hero {
    height: auto;
    min-height: clamp(200px, 40vh, 360px);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 4rem;
  }
  .hero-floating-icon {
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    bottom: auto;
    top: 4rem;
    transform: none;
    width: max-content;
  }
  .hero-floating-icon img { width: 64px; }
  .hero-content {
    margin-top: 6rem;
    padding-top: 0.25rem;
    padding-bottom: 0.75rem;
  }
}

/* Админка «Авторы» и «Файлы ПК»: общие формы и кнопки */
.pc-files-input { padding: 0.5rem 0.75rem; border: 1px solid hsl(var(--border)); border-radius: 0.5rem; font-size: 1rem; min-width: 120px; background: hsl(var(--card)); color: hsl(var(--foreground)); }
.pc-files-btn { padding: 0.5rem 1rem; background: hsl(220 12% 42%); color: #fff; border: none; border-radius: 0.5rem; cursor: pointer; font-size: 0.95rem; text-decoration: none; display: inline-block; }
.pc-files-btn:hover { background: hsl(220 12% 35%); color: #fff; }
.pc-files-btn-outline { background: transparent; color: hsl(220 12% 42%); border: 1px solid hsl(220 12% 42%); }
.pc-files-btn-outline:hover { background: hsl(220 12% 42% / 0.1); color: hsl(220 12% 42%); }
.pc-files-error { color: hsl(0 55% 45%); margin: 0.5rem 0; }
.pc-files-auth-wrap { margin: 1.5rem 0; }
.pc-files-auth-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.pc-files-header-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.pc-files-logout-form { flex-shrink: 0; }
.media-authors-admin-msg { color: hsl(120 40% 35%); margin: 0.5rem 0; }
.media-authors-admin-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.media-authors-admin-list li { margin: 0.35rem 0; display: flex; align-items: center; gap: 0.5rem; }
.media-authors-admin-list a { color: hsl(var(--gold-dark)); text-decoration: underline; }
.media-authors-admin-sort { color: hsl(var(--muted-foreground)); font-size: 0.9rem; }
.media-authors-admin-form .media-authors-admin-field { margin: 1rem 0; }
.media-authors-admin-form label { display: block; margin-bottom: 0.25rem; font-weight: 500; }
.media-authors-admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1.25rem 0; }
