: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.16s cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 0.125s ease,
    border-color 0.125s ease,
    background-color 0.125s 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.16s cubic-bezier(0.32, 0.72, 0, 1);
}

body.site-nav-pinned.site-header-retracted .site-main {
  /* Отступ не убираем: иначе при дне страницы меняется scrollHeight и шапка дёргается. */
  padding-top: var(--site-header-h, 3.25rem);
}

/* Читалка Библии: то же поведение (явное правило для ясности). */
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;
    width: 44px;
    min-width: 44px;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
  }
  .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;
  }

  /* Открытое мобильное меню: без логотипа и лишних кнопок, список на всю ширину */
  body.site-nav-menu-open {
    overflow: hidden;
  }

  body.site-nav-menu-open .site-header {
    background: hsl(var(--card) / 0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid hsl(var(--border));
    box-shadow: 0 2px 14px hsl(25 22% 12% / 0.1);
  }

  body.site-nav-menu-open .site-nav {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
  }

  body.site-nav-menu-open .site-nav-left {
    display: none;
  }

  body.site-nav-menu-open .nav-actions {
    flex: 1 1 100%;
    justify-content: flex-end;
    gap: 0;
    padding: 0 0 0.3rem;
    border-bottom: 1px solid hsl(var(--border) / 0.75);
  }

  body.site-nav-menu-open .nav-actions > :not(.nav-menu-toggle) {
    display: none !important;
  }

  body.site-nav-menu-open .nav-menu-toggle {
    font-size: 1.25rem;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  body.site-nav-menu-open .nav-links.is-open {
    flex: 1 1 100%;
    width: 100%;
    align-items: stretch;
    padding: 0.05rem 0 0.35rem;
    max-height: min(72vh, calc(100dvh - 4.5rem));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.site-nav-menu-open .nav-links > .nav-item {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
    border-bottom: 1px solid hsl(var(--border) / 0.35);
  }

  body.site-nav-menu-open .nav-links > .nav-item:last-child {
    border-bottom: none;
  }

  body.site-nav-menu-open .nav-item-head .nav-link,
  body.site-nav-menu-open .nav-links .nav-link,
  body.site-nav-menu-open .nav-home .nav-link {
    justify-content: flex-start;
    text-align: left;
    min-height: 0;
    padding: 0.42rem 0.25rem;
    line-height: 1.25;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
  }

  body.site-nav-menu-open .nav-auth {
    justify-content: flex-start;
    gap: 1rem;
    margin-top: 0.1rem;
    padding: 0.35rem 0.25rem 0.05rem;
    border-top: 1px solid hsl(var(--border) / 0.45);
  }

  body.site-nav-menu-open .nav-auth .nav-link {
    min-height: 0;
    padding: 0.35rem 0;
    font-size: 0.88rem;
  }

  .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; }

/* Interview questions (Технический) */
.interview-questions-page .placeholder-card.iq-card,
.interview-questions-page .iq-card {
  max-width: 980px;
  margin: 0 auto;
  text-align: left;
}

.interview-questions-page .iq-list,
.interview-questions-page .iq-item,
.interview-questions-page .iq-item-header,
.interview-questions-page .iq-item-body,
.interview-questions-page .iq-item-question,
.interview-questions-page .iq-answer,
.interview-questions-page .iq-answer-md,
.interview-questions-page .iq-answer-md :is(p, li, ul, ol, blockquote, div, table, th, td) {
  text-align: left;
}

.interview-questions-page .iq-item-question,
.interview-questions-page .iq-item-body,
.interview-questions-page .iq-answer-md {
  min-width: 0;
  max-width: 100%;
}

.interview-questions-page .placeholder-card p:not(.iq-pager-info):not(.iq-status) {
  text-align: left;
}

.iq-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.5rem;
}

.iq-field {
  min-width: 0;
}

.iq-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.iq-select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #d9c7a3;
  border-radius: 6px;
  background: hsl(var(--card));
  font: inherit;
}

.iq-field-action {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.iq-download-btn {
  width: 100%;
  white-space: nowrap;
}

.iq-download-dialog {
  border: 1px solid #d9c7a3;
  border-radius: 10px;
  padding: 0;
  max-width: 28rem;
  width: calc(100% - 2rem);
  background: hsl(var(--card));
  color: inherit;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.iq-download-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.iq-download-form {
  padding: 1.1rem 1.25rem 1.25rem;
}

.iq-download-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.iq-download-hint {
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
}

.iq-download-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.iq-download-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.iq-download-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #d9c7a3;
  border-radius: 6px;
  background: hsl(var(--background));
  font: inherit;
}

.iq-download-error {
  margin: 0.75rem 0 0;
  color: hsl(0 55% 42%);
  font-size: 0.9rem;
}

.iq-download-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.iq-download-cancel {
  background: transparent;
  border: 1px solid #d9c7a3;
}

.iq-status {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
}

.iq-status-error {
  color: hsl(0 55% 42%);
}

.iq-status-error {
  color: hsl(0 55% 42%);
}

.iq-legend-panel {
  margin: 0 0 1rem;
  border: 1px solid #d9c7a3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
}

.iq-legend-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: none;
  background: rgba(201, 169, 98, 0.12);
  color: hsl(var(--gold-dark));
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.iq-legend-toggle:hover {
  background: rgba(201, 169, 98, 0.2);
}

.iq-legend-chevron {
  flex-shrink: 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

.iq-legend-body {
  padding: 1rem 1.1rem 1.25rem;
  border-top: 1px solid #e8dcc4;
  max-height: min(70vh, 720px);
  overflow-y: auto;
}

.iq-legend-body :is(h1, h2, h3, h4) {
  color: hsl(var(--gold-dark));
  margin: 1.25rem 0 0.6rem;
}

.iq-legend-body h1:first-child,
.iq-legend-body h2:first-child,
.iq-legend-body h3:first-child {
  margin-top: 0;
}

.iq-legend-body blockquote {
  margin: 0.75rem 0;
  padding: 0.6rem 0.9rem;
  border-left: 3px solid hsl(var(--gold));
  background: rgba(201, 169, 98, 0.08);
}

.iq-legend-loading {
  margin: 0;
  color: hsl(var(--muted-foreground));
}

.iq-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.iq-empty {
  margin: 0.5rem 0;
  color: hsl(var(--muted-foreground));
}

.iq-item {
  border: 1px solid #d9c7a3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.35);
  overflow: visible;
}

.iq-item-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: inherit;
}

@media (min-width: 640px) {
  .iq-item-header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 1rem;
  }
}

.iq-item-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

.iq-item-question {
  flex: 0 1 auto;
  font-weight: 600;
  line-height: 1.4;
}

@media (min-width: 640px) {
  .iq-item-question {
    flex: 1 1 12rem;
  }
}

.iq-item-question pre {
  margin: 0.5em 0 0;
  font-weight: 400;
}

.iq-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.iq-tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  color: hsl(var(--muted-foreground));
}

.iq-freq {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

.iq-chevron {
  font-size: 0.65rem;
  color: hsl(var(--muted-foreground));
  transition: transform 0.15s ease;
}

.iq-item[data-open="true"] .iq-chevron {
  transform: rotate(180deg);
}

.iq-item-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid rgba(217, 199, 163, 0.5);
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.iq-answer {
  margin-top: 0.75rem;
  line-height: 1.55;
  font-size: 0.95rem;
  color: #1a1a1a;
}

.iq-answer-md {
  white-space: normal;
  word-wrap: break-word;
  color: #1a1a1a;
}

.iq-answer-md p,
.iq-answer-md li,
.iq-answer-md blockquote,
.iq-answer-md td,
.iq-answer-md th {
  color: inherit;
}

body.dark .iq-answer,
body.dark .iq-answer-md {
  color: hsl(38 22% 92%);
}

.iq-answer-md p {
  margin: 0.55em 0;
}

.iq-answer-md p:first-child {
  margin-top: 0;
}

.iq-answer-md p:last-child {
  margin-bottom: 0;
}

.iq-answer-md ul,
.iq-answer-md ol {
  margin: 0.5em 0;
  padding-left: 1.35em;
}

.iq-answer-md li {
  margin: 0.25em 0;
}

.iq-answer-md strong {
  font-weight: 600;
}

.iq-answer-md pre {
  margin: 0.65em 0;
  padding: 0.75rem 0.85rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.07);
  border: 1px solid rgba(217, 199, 163, 0.6);
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  overflow-x: auto;
  overflow-y: hidden;
  font-size: 0.82rem;
  line-height: 1.45;
  -webkit-overflow-scrolling: touch;
}

.iq-answer-md code {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.iq-answer-md pre code {
  display: block;
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
  white-space: pre;
  text-align: left;
  word-break: normal;
  overflow-wrap: normal;
}
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  display: inline-block;
  max-width: 100%;
  text-align: left;
  vertical-align: top;
  overflow-x: auto;
  word-break: break-word;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}

/* Длинный inline-код в абзаце — не ломать вёрстку */
.iq-answer-md p > code:only-child,
.iq-answer-md p > code {
  max-width: 100%;
}

.iq-answer-md p:has(> code) {
  overflow-x: auto;
}

.iq-answer-md a {
  color: hsl(220 35% 38%);
  word-break: break-word;
}

.iq-answer-empty,
.iq-answer-empty-wrap .iq-answer-empty {
  color: hsl(var(--muted-foreground));
  font-style: italic;
}

.iq-answer-image {
  display: block;
  max-width: 100%;
  margin-top: 0.75rem;
  border-radius: 6px;
  border: 1px solid #d9c7a3;
}

.iq-pager {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.iq-pager-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
}

.iq-pager-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem 0;
}

.iq-pager-page {
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.4rem;
  border: 1px solid #d9c7a3;
  border-radius: 6px;
  background: hsl(var(--card));
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  color: inherit;
}

.iq-pager-page:hover {
  background: rgba(0, 0, 0, 0.04);
}

.iq-pager-page-active {
  background: hsl(220 12% 42%);
  color: #fff;
  border-color: hsl(220 12% 42%);
  font-weight: 600;
}

.iq-pager-page-active:hover {
  background: hsl(220 12% 36%);
}

.iq-pager-ellipsis {
  padding: 0 0.2rem;
  color: hsl(var(--muted-foreground));
  user-select: none;
}

.iq-pager-btn {
  min-width: 2.5rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.iq-pager-info {
  margin: 0;
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

.iq-pager-btn:disabled,
.iq-pager-page:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 639px) {
  .interview-questions-page .iq-card {
    padding: 1rem 0.75rem;
    border-radius: 0.75rem;
  }

  .interview-questions-page .iq-item-header {
    padding: 0.65rem 0.75rem;
    gap: 0.35rem;
  }

  .iq-toolbar {
    grid-template-columns: 1fr;
  }

  .iq-item-question {
    flex: 0 0 auto;
    font-size: 0.95rem;
    width: 100%;
  }

  .iq-item-question pre {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .iq-item-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .iq-freq {
    white-space: normal;
  }

  .iq-item-body {
    padding: 0 0.65rem 0.85rem;
  }

  .iq-answer {
    font-size: 0.9rem;
  }

  .iq-answer-md pre {
    padding: 0.65rem 0.7rem;
    font-size: 0.78rem;
  }

  .iq-answer-md p:has(> code) {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .iq-pager-prev .iq-pager-next,
  .iq-pager-btn {
    flex-shrink: 0;
  }

  .iq-pager-page {
    min-width: 2rem;
    height: 2rem;
    font-size: 0.85rem;
  }
}

/* User reviews (Технический → Отзывы пользователей) */
.user-reviews-page .user-reviews-card {
  padding: 1.1rem 1.2rem 1.35rem;
}

.user-reviews-slider {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-reviews-slider-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.user-reviews-slider-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border) / 0.75);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.user-reviews-slider-nav:hover:not(:disabled) {
  border-color: hsl(var(--gold) / 0.55);
  background: hsl(var(--gold) / 0.12);
}

.user-reviews-slider-nav:focus-visible {
  outline: 2px solid hsl(var(--gold) / 0.55);
  outline-offset: 2px;
}

.user-reviews-slider-nav:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.user-reviews-slider-counter {
  min-width: 5rem;
  text-align: center;
  font-size: 0.95rem;
  color: hsl(var(--muted-foreground));
}

.user-reviews-slider-frame-wrap {
  position: relative;
}

.user-reviews-slider-frame {
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background: hsl(var(--muted) / 0.25);
  border: 1px solid hsl(var(--border) / 0.65);
  line-height: 0;
  cursor: zoom-in;
}

.user-reviews-slider-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(78vh, 920px);
  object-fit: contain;
  object-position: top center;
  margin: 0 auto;
  background: #fff;
}

.user-reviews-slider-side {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid hsl(var(--border) / 0.75);
  background: hsl(var(--background) / 0.94);
  color: hsl(var(--foreground));
  box-shadow: 0 2px 12px hsl(0 0% 0% / 0.14);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.user-reviews-slider-side:hover:not(:disabled) {
  border-color: hsl(var(--gold) / 0.55);
  background: hsl(var(--gold) / 0.14);
  transform: translateY(-50%) scale(1.05);
}

.user-reviews-slider-side:focus-visible {
  outline: 2px solid hsl(var(--gold) / 0.55);
  outline-offset: 2px;
}

.user-reviews-slider-side:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.user-reviews-slider-side-prev {
  left: 0.55rem;
}

.user-reviews-slider-side-next {
  right: 0.55rem;
}

.user-reviews-slider-caption {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
  color: hsl(var(--muted-foreground));
}

.user-reviews-empty {
  text-align: center;
}

@media (max-width: 640px) {
  .user-reviews-page .user-reviews-card {
    padding: 0.85rem 0.65rem 1rem;
  }

  .user-reviews-slider-toolbar {
    gap: 0.55rem;
  }

  .user-reviews-slider-nav span {
    display: none;
  }

  .user-reviews-slider-nav {
    padding: 0.45rem 0.55rem;
  }

  .user-reviews-slider-img {
    max-height: min(70vh, 720px);
  }

  .user-reviews-slider-side {
    width: 2.35rem;
    height: 2.35rem;
  }

  .user-reviews-slider-side-prev {
    left: 0.35rem;
  }

  .user-reviews-slider-side-next {
    right: 0.35rem;
  }
}

.user-review-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  box-sizing: border-box;
}

.user-review-lightbox:fullscreen,
.user-review-lightbox:-webkit-full-screen,
.user-review-lightbox:-moz-full-screen {
  width: 100%;
  height: 100%;
}

.user-review-lightbox.open {
  display: block;
}

.user-review-lightbox-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3.25rem 0.75rem 1rem;
  box-sizing: border-box;
}

.user-review-lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 4.5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
}

.user-review-lightbox-counter {
  color: hsl(0 0% 92%);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.user-review-lightbox-close,
.user-review-lightbox-prev,
.user-review-lightbox-next {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid hsl(0 0% 100% / 0.22);
  border-radius: 999px;
  background: hsl(0 0% 0% / 0.45);
  color: hsl(0 0% 96%);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.user-review-lightbox-close:hover,
.user-review-lightbox-prev:hover:not(:disabled),
.user-review-lightbox-next:hover:not(:disabled) {
  transform: scale(1.06);
  background: hsl(0 0% 100% / 0.12);
  border-color: hsl(0 0% 100% / 0.35);
}

.user-review-lightbox-prev:disabled,
.user-review-lightbox-next:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.user-review-lightbox-close {
  top: 0.75rem;
  right: 0.75rem;
}

.user-review-lightbox-prev {
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
}

.user-review-lightbox-next {
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
}

.user-review-lightbox-prev:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.06);
}

.user-review-lightbox-next:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.06);
}

@media (max-width: 640px) {
  .user-review-lightbox-inner {
    padding: 3rem 0.5rem 0.75rem;
  }

  .user-review-lightbox-img {
    max-height: calc(100vh - 3.75rem);
  }

  .user-review-lightbox-close {
    top: 0.5rem;
    right: 0.5rem;
    width: 2.25rem;
    height: 2.25rem;
  }

  .user-review-lightbox-prev {
    left: 0.35rem;
    width: 2.25rem;
    height: 2.25rem;
  }

  .user-review-lightbox-next {
    right: 0.35rem;
    width: 2.25rem;
    height: 2.25rem;
  }
}
