/*
Theme Name: Perm-03
Description: Тема для сайта Пермской станции скорой медицинской помощи
Author: Разработано с Claude
Version: 0.1
Text Domain: perm03
*/

:root {
  --bg: #F7F9FA;
  --surface: #FFFFFF;
  --ink: #1B1B1B;
  --ink-soft: #4A5560;
  --brand: #0B3D5C;
  --brand-accent: #3E92CC;
  --brand-soft: #E7EEF2;
  --accent-soft: #E4F1FA;
  --warm: #E8974A;
  --warm-soft: #FBEADA;
  --calm: #3F9C7B;
  --calm-soft: #E1F2EB;
  --line: #E3E8EC;
  --urgent: #D32F2F;
  --urgent-ink: #FFFFFF;
  --focus: #0B3D5C;
  --font-body: 'PT Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-accent); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img { max-width: 100%; display: block; height: auto; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* Top utility bar */
.utility { background: var(--brand); color: #fff; font-family: var(--font-ui); font-size: 14px; }
.utility .wrap { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; padding-bottom: 8px; gap: 16px; flex-wrap: wrap; }
.utility a { color: #fff; text-decoration: none; opacity: .9; }
.utility a:hover { opacity: 1; text-decoration: underline; }
.utility .links { display: flex; gap: 20px; flex-wrap: wrap; }

/* Header */
header.site { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-icon-link, .brand-text-link { text-decoration: none; }
.brand svg { flex-shrink: 0; }
.brand img.custom-logo { height: 58px; width: auto; display: block; flex-shrink: 0; }
.brand-text { line-height: 1.25; }
.brand-text .eyebrow { font-family: var(--font-ui); font-size: 13px; color: var(--ink-soft); }
.brand-text .name { font-family: var(--font-ui); font-weight: 700; font-size: 18px; color: var(--brand); }

.call-block { display: flex; align-items: center; gap: 14px; background: var(--urgent); color: var(--urgent-ink); border-radius: 10px; padding: 12px 20px; font-family: var(--font-ui); }
.call-block-nums { display: flex; flex-direction: column; gap: 1px; line-height: 1; }
.call-block .num { font-size: 22px; font-weight: 700; line-height: 1.15; }
.call-block .lbl { font-size: 13px; opacity: .95; max-width: 220px; }

/* Nav */
nav.main { border-top: 1px solid var(--line); }
.nav-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
nav.main ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; }
nav.main li { margin: 0; position: relative; }
nav.main > div > ul > li > a { display: block; padding: 14px 10px; font-family: var(--font-ui); font-weight: 500; font-size: 15px; color: var(--ink); text-decoration: none; border-bottom: 3px solid transparent; }
nav.main > div > ul > li > a:hover, nav.main .current-menu-item > a { border-bottom-color: var(--brand-accent); color: var(--brand-accent); }

/* Пункт с выпадающим подменю: маленькая стрелка-индикатор */
nav.main .menu-item-has-children > a::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-left: 7px;
  margin-bottom: 1px;
}

/* Выпадающее подменю */
nav.main .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  margin: 0;
  z-index: 30;
  flex-direction: column;
  gap: 0;
}
nav.main li:hover > .sub-menu,
nav.main li:focus-within > .sub-menu {
  display: flex;
}
nav.main .sub-menu a {
  display: block;
  padding: 10px 12px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: none;
  border-radius: 6px;
}
nav.main .sub-menu a:hover {
  background: var(--accent-soft);
  color: var(--brand-accent);
}

/* Поиск по сайту */
.site-search { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
.site-search input[type="search"] {
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 12px;
  font-family: var(--font-body); font-size: 14px; width: 180px; color: var(--ink); background: var(--surface);
}
.site-search input[type="search"]:focus { outline: none; border-color: var(--brand-accent); }
.site-search button {
  background: var(--brand-soft); border: none; border-radius: 7px; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center; color: var(--brand); cursor: pointer;
}
.site-search button:hover { background: var(--accent-soft); color: var(--brand-accent); }
.screen-reader-text { position: absolute; left: -9999px; }

/* Hero */
.hero { position: relative; padding: 72px 0 64px; border-bottom: 1px solid var(--line); overflow: hidden; background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 78%); }
.hero.has-image { background-size: cover; background-position: center; }
.hero.has-image::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,32,48,.92) 0%, rgba(8,32,48,.8) 100%); z-index: 0; }
.hero.has-image .hero-bg { display: none; }
.hero.has-image h1, .hero.has-image p.lead { color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; max-width: 780px; text-align: left; }
.hero h1 { font-family: var(--font-ui); font-size: clamp(28px, 4vw, 42px); font-weight: 700; line-height: 1.2; margin: 0 0 18px; color: var(--ink); }
.hero p.lead { font-size: 19px; color: var(--ink-soft); margin: 0 0 28px; max-width: 60ch; }
.hero .cta-row { display: flex; gap: 14px; flex-wrap: wrap; }
.btn { font-family: var(--font-ui); font-weight: 600; font-size: 15px; padding: 13px 22px; border-radius: 8px; text-decoration: none; display: inline-block; border: 1px solid transparent; cursor: pointer; }
.btn-urgent { background: var(--urgent); color: var(--urgent-ink); }
.btn-urgent:hover { filter: brightness(1.08); }
.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); }
.hero.has-image .btn-outline { color: #fff; border-color: #fff; }
.hero.has-image .btn-outline:hover { background: rgba(255,255,255,.15); }

/* Sections */
section.block { padding: 48px 0; }
section.striped { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
h2.section-title { font-family: var(--font-ui); font-size: 22px; font-weight: 700; margin: 0 0 22px; color: var(--ink); }

.columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
@media (max-width: 860px) { .columns { grid-template-columns: 1fr; } }
.col p { color: var(--ink-soft); margin: 0 0 14px; }
.col ul { margin: 0 0 14px; padding-left: 20px; color: var(--ink-soft); }
.col ul li { margin-bottom: 6px; }

.news-item { display: flex; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.news-item:first-child { border-top: none; padding-top: 0; }
.news-icon { flex-shrink: 0; width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.news-icon img { width: 100%; height: 100%; object-fit: cover; }
.news-icon.c-accent { background: var(--accent-soft); }
.news-icon.c-warm { background: var(--warm-soft); }
.news-icon.c-calm { background: var(--calm-soft); }
.news-body time { font-family: var(--font-ui); font-size: 13px; color: var(--ink-soft); }
.news-body h3 { font-size: 16px; margin: 4px 0 0; font-weight: 600; }
.news-body h3 a { color: var(--ink); text-decoration: none; }
.news-body h3 a:hover { color: var(--brand-accent); text-decoration: underline; }

/* Quick link tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--brand-accent); }
.tile .tile-icon { width: 36px; height: 36px; border-radius: 9px; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; }
.tile .tile-title { font-family: var(--font-ui); font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.tile .tile-sub { font-size: 13px; color: var(--ink-soft); }

/* Сетка карточек сотрудников */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px; margin-top: 8px; }
.staff-card { text-decoration: none; color: var(--ink); text-align: center; }
.staff-card .staff-photo {
  width: 140px; height: 140px; border-radius: 50%; overflow: hidden;
  margin: 0 auto 14px; background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center;
}
.staff-card .staff-photo img { width: 100%; height: 100%; object-fit: cover; }
.staff-card h3 { font-family: var(--font-ui); font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.staff-card:hover h3 { color: var(--brand-accent); }
.staff-card .staff-role { font-size: 13px; color: var(--ink-soft); line-height: 1.4; }

/* Пагинация (архивы рубрик) */
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pagination .page-numbers {
  display: inline-block;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink);
}
.pagination .page-numbers:hover { border-color: var(--brand-accent); color: var(--brand-accent); }
.pagination .page-numbers.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .page-numbers.dots { border: none; padding: 8px 4px; }

/* Карточка сотрудника (одиночная страница) */
.staff-bio {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-top: 20px;
}
.staff-bio-photo {
  flex: 0 0 240px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--brand-soft);
}
.staff-bio-photo img { width: 100%; height: auto; display: block; }
.staff-bio-content { flex: 1; min-width: 0; }
.staff-bio-content p { margin: 0 0 16px; }
.staff-bio-content p:first-child {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--brand);
  font-size: 17px;
}
@media (max-width: 640px) {
  .staff-bio { flex-direction: column; }
  .staff-bio-photo { flex-basis: auto; max-width: 240px; }
}

/* Фильтр по году на странице новостей */
.news-year-filter {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px; font-family: var(--font-ui); font-size: 14px; color: var(--ink-soft);
}
.news-year-filter select {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px;
  font-family: var(--font-ui); font-size: 14px; color: var(--ink); background: var(--surface);
}

/* Слайдер (лайтбокс) для галерей */
.joomla-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; opacity: 0; visibility: hidden; transition: opacity .2s ease;
}
.joomla-lightbox.is-open { opacity: 1; visibility: visible; }
.jlb-img { max-width: 88vw; max-height: 85vh; object-fit: contain; border-radius: 6px; }
.jlb-btn {
  position: absolute; background: rgba(255,255,255,.12); color: #fff; border: none;
  border-radius: 50%; width: 44px; height: 44px; font-size: 22px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.jlb-btn:hover { background: rgba(255,255,255,.25); }
.jlb-close { top: 20px; right: 20px; }
.jlb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.jlb-next { right: 20px; top: 50%; transform: translateY(-50%); }
.jlb-counter {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: #fff; font-family: var(--font-ui); font-size: 14px; opacity: .85;
}
@media (max-width: 600px) {
  .jlb-prev, .jlb-next { width: 38px; height: 38px; font-size: 18px; }
}

/* Кнопка скачивания документа (PDF и т.д.) */
.entry-content a.file-download {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--brand-accent); color: #fff;
  border-radius: 8px; padding: 12px 20px; margin: 6px 8px 6px 0;
  font-family: var(--font-ui); font-weight: 600; font-size: 15px;
  text-decoration: none;
}
.entry-content a.file-download:hover { background: var(--brand); color: #fff; }
.entry-content a.file-download::before { content: "📄"; }

/* Стандартный блок "Галерея" WordPress — подключён к тому же слайдеру */
.entry-content .wp-block-gallery figure img,
.entry-content .wp-block-gallery .wp-block-image img {
  cursor: zoom-in;
  border-radius: 8px;
  transition: transform .15s ease;
}
.entry-content .wp-block-gallery figure:hover img { transform: scale(1.03); }

/* Одиночная картинка в тексте статьи (блок "Изображение") со ссылкой
   "на файл медиа" — открывается тем же лайтбоксом, что и галереи (см. footer.php) */
.entry-content .wp-block-image a img {
  cursor: zoom-in;
  transition: transform .15s ease;
}
.entry-content .wp-block-image a:hover img { transform: scale(1.03); }

/* Галереи из Joomla ({gallery}...{/gallery}) */
.joomla-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 20px 0; clear: both; }
.joomla-gallery-item { display: block; aspect-ratio: 1 / 1; overflow: hidden; border-radius: 8px; border: 1px solid var(--line); }
.entry-content .joomla-gallery-item img { width: 100% !important; height: 100% !important; max-width: 100% !important; margin: 0 !important; object-fit: cover; display: block; transition: transform .15s ease; }
.joomla-gallery-item:hover img { transform: scale(1.06); }

/* Страница "Вакансии" */
.vacancy-info-box, .help-info-box {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 26px;
  max-width: 760px;
}
.vacancy-info-box p, .help-info-box p { margin: 0 0 14px; }
.vacancy-info-box p:last-child, .help-info-box p:last-child { margin-bottom: 0; }
.vacancy-info-box ul, .help-info-box ul { margin: 0 0 14px; padding-left: 20px; }
/* Подзаголовки и списки внутри инфобоксов: воздух над заголовком, плотнее к своему абзацу */
.vacancy-info-box h2, .vacancy-info-box h3, .vacancy-info-box h4,
.help-info-box h2, .help-info-box h3, .help-info-box h4 {
  font-family: var(--font-ui); font-weight: 700; line-height: 1.3; color: var(--brand);
  margin: 22px 0 8px;
}
.vacancy-info-box h2, .help-info-box h2 { font-size: 20px; }
.vacancy-info-box h3, .help-info-box h3 { font-size: 17px; }
.vacancy-info-box h4, .help-info-box h4 { font-size: 15px; }
.vacancy-info-box > :first-child, .help-info-box > :first-child { margin-top: 0; }
.vacancy-info-box li, .help-info-box li { margin-bottom: 6px; }
.vacancy-info-box li:last-child, .help-info-box li:last-child { margin-bottom: 0; }
.vacancy-info-box ul:last-child, .help-info-box ul:last-child { margin-bottom: 0; }

.vacancy-list { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.vacancy-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand-accent);
  border-radius: 10px; padding: 18px 22px; text-decoration: none; color: var(--ink);
}
.vacancy-card.c-warm { border-left-color: var(--warm); }
.vacancy-card.c-calm { border-left-color: var(--calm); }
.vacancy-card:hover { border-color: var(--brand-accent); background: var(--accent-soft); }
.vacancy-card-body { flex: 1; min-width: 0; }
.vacancy-card-body h4 { font-family: var(--font-ui); font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.vacancy-card-body p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
.vacancy-card-arrow { font-size: 20px; color: var(--brand-accent); flex-shrink: 0; }

/* Раздел "Что делать, если..." — узкие плитки (как .tiles), тонкая цветная полоса сверху вместо тени/смещения */
.help-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-accent);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s ease;
}
.help-tile.c-warm { border-top-color: var(--warm); }
.help-tile.c-calm { border-top-color: var(--calm); }
.help-tile:hover { border-color: var(--brand-accent); }
.help-tile.c-warm:hover { border-color: var(--warm); }
.help-tile.c-calm:hover { border-color: var(--calm); }
.help-tile-icon { width: 36px; height: 36px; border-radius: 9px; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.help-tile.c-warm .help-tile-icon { background: var(--warm-soft); }
.help-tile.c-calm .help-tile-icon { background: var(--calm-soft); }
.help-tile-title { font-family: var(--font-ui); font-weight: 600; font-size: 15px; }

/* Сводка по подстанциям на странице "Сотрудники" */
.substation-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.substation-stat { text-align: center; padding: 18px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.substation-stat-num { font-family: var(--font-ui); font-size: 28px; font-weight: 700; color: var(--brand); }
.substation-stat-name { font-size: 13px; color: var(--ink-soft); margin-top: 6px; line-height: 1.35; }

/* Карточная сетка новостей */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 26px; }
.news-card { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.news-card:hover { border-color: var(--brand-accent); }
.news-card-img { aspect-ratio: 4 / 3; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.news-card-img.c-accent { background: var(--accent-soft); }
.news-card-img.c-warm { background: var(--warm-soft); }
.news-card-img.c-calm { background: var(--calm-soft); }
.news-card-img img { width: 100%; height: 100%; object-fit: cover; }
.news-card-body { padding: 14px 16px 18px; }
.news-card-body time { font-family: var(--font-ui); font-size: 13px; color: var(--ink-soft); }
.news-card-body h3 { font-size: 16px; font-weight: 600; line-height: 1.35; margin: 6px 0 0; }
.news-card:hover h3 { color: var(--brand-accent); }

/* Панель "Версия для слабовидящих" */
.a11y-panel {
  position: sticky; top: 0; z-index: 100;
  background: #1a1a1a; color: #fff;
  border-bottom: 3px solid #000;
}
.a11y-panel-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 14px 24px; font-family: var(--font-ui); }
.a11y-panel-title { font-size: 14px; }
.a11y-group { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.a11y-btn {
  background: #fff; color: #000; border: 2px solid #fff;
  border-radius: 6px; padding: 6px 12px; font-family: var(--font-ui);
  font-weight: 600; cursor: pointer; font-size: 14px;
}
.a11y-btn.is-active { background: #000; color: #fff; border-color: #fff; }
.a11y-btn-close { margin-left: auto; background: transparent; color: #fff; }

/* Уровни размера шрифта (применяются к html.a11y-fs-l / .a11y-fs-xl) */
html.a11y-fs-l body { font-size: 19px !important; }
html.a11y-fs-l .hero h1 { font-size: clamp(32px, 4.4vw, 46px) !important; }
html.a11y-fs-l h1.entry-title, html.a11y-fs-l h2.section-title { font-size: 26px !important; }
html.a11y-fs-l nav.main a, html.a11y-fs-l .tile-title, html.a11y-fs-l .news-card-body h3,
html.a11y-fs-l .staff-card h3, html.a11y-fs-l .btn { font-size: 17px !important; }

html.a11y-fs-xl body { font-size: 22px !important; line-height: 1.7 !important; }
html.a11y-fs-xl .hero h1 { font-size: clamp(36px, 4.8vw, 50px) !important; }
html.a11y-fs-xl h1.entry-title, html.a11y-fs-xl h2.section-title { font-size: 30px !important; }
html.a11y-fs-xl nav.main a, html.a11y-fs-xl .tile-title, html.a11y-fs-xl .news-card-body h3,
html.a11y-fs-xl .staff-card h3, html.a11y-fs-xl .btn { font-size: 19px !important; }

/* Схема "чёрным по белому": высокий контраст на светлом фоне */
html.a11y-scheme-contrast body { background: #fff !important; color: #000 !important; }
html.a11y-scheme-contrast a { color: #00308F !important; text-decoration: underline !important; }
html.a11y-scheme-contrast .utility { background: #000 !important; }
html.a11y-scheme-contrast .utility a { color: #fff !important; text-decoration: underline !important; }
html.a11y-scheme-contrast .hero-bg { display: none !important; }
html.a11y-scheme-contrast .hero { background: #fff !important; }
html.a11y-scheme-contrast .hero.has-image::before { background: rgba(0,0,0,.8) !important; }
html.a11y-scheme-contrast .call-block { background: #000 !important; color: #fff !important; }
html.a11y-scheme-contrast .btn-urgent { background: #000 !important; color: #fff !important; }
html.a11y-scheme-contrast .btn-outline { color: #000 !important; border-color: #000 !important; }
html.a11y-scheme-contrast nav.main a, html.a11y-scheme-contrast .tile, html.a11y-scheme-contrast .news-item,
html.a11y-scheme-contrast .staff-card, html.a11y-scheme-contrast .news-card,
html.a11y-scheme-contrast .about-doc-card,
html.a11y-scheme-contrast .footer-cols, html.a11y-scheme-contrast header.site { border-color: #000 !important; }
html.a11y-scheme-contrast .tile { border-width: 2px !important; }
html.a11y-scheme-contrast .ink-soft, html.a11y-scheme-contrast .tile-sub, html.a11y-scheme-contrast .news-body time,
html.a11y-scheme-contrast .staff-role { color: #333 !important; }
html.a11y-scheme-contrast footer.site { background: #f0f0f0 !important; }

/* Схема "белым по чёрному": инверсия, тёмный фон */
html.a11y-scheme-invert body { background: #000 !important; color: #fff !important; }
html.a11y-scheme-invert a { color: #8ab4ff !important; text-decoration: underline !important; }
html.a11y-scheme-invert .utility { background: #000 !important; border-bottom: 1px solid #444; }
html.a11y-scheme-invert .utility a { color: #fff !important; text-decoration: underline !important; }
html.a11y-scheme-invert header.site, html.a11y-scheme-invert footer.site,
html.a11y-scheme-invert .surface, html.a11y-scheme-invert .tile, html.a11y-scheme-invert .news-card,
html.a11y-scheme-invert .staff-card, html.a11y-scheme-invert .news-item,
html.a11y-scheme-invert .about-doc-card { background: #111 !important; border-color: #555 !important; }
html.a11y-scheme-invert .hero-bg { display: none !important; }
html.a11y-scheme-invert .hero { background: #000 !important; }
html.a11y-scheme-invert .hero.has-image::before { background: rgba(0,0,0,.85) !important; }
html.a11y-scheme-invert nav.main a { color: #fff !important; }
html.a11y-scheme-invert .call-block { background: #b3261e !important; }
html.a11y-scheme-invert .ink-soft, html.a11y-scheme-invert .tile-sub, html.a11y-scheme-invert .news-body time,
html.a11y-scheme-invert .staff-role { color: #bbb !important; }

/* Карта сайта */
.sitemap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; margin-top: 24px; }
@media (max-width: 720px) { .sitemap-grid { grid-template-columns: 1fr; } }
.sitemap-col h3 { font-family: var(--font-ui); font-size: 16px; margin: 0 0 14px; color: var(--brand); }
.sitemap-col ul { list-style: none; margin: 0; padding: 0; }
.sitemap-col li { margin-bottom: 10px; }
.sitemap-col a { color: var(--ink); text-decoration: none; }
.sitemap-col a:hover { color: var(--brand-accent); text-decoration: underline; }
.sitemap-count { color: var(--ink-soft); font-size: 13px; }

/* Таблицы внутри текста (блок "Таблица" в Gutenberg) */
.entry-content .wp-block-table {
  margin: 24px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.entry-content table thead th {
  background: var(--brand);
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 600;
  text-align: left;
  padding: 13px 16px;
  border: none;
}
.entry-content table td,
.entry-content table th {
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.entry-content table tbody tr:last-child td { border-bottom: none; }
.entry-content table tbody tr:nth-child(even) { background: var(--bg); }
.entry-content table tbody tr:hover { background: var(--accent-soft); }

/* Блок "Подробности" — используем как аккордеон для FAQ и подобных страниц */
.entry-content details {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 0 0 12px;
  background: var(--surface);
}
.entry-content details summary {
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  color: var(--brand);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.entry-content details summary::-webkit-details-marker { display: none; }
.entry-content details summary::after {
  content: "+";
  font-size: 22px;
  line-height: 1;
  color: var(--brand-accent);
  flex-shrink: 0;
  font-weight: 400;
}
.entry-content details[open] summary::after { content: "–"; }
.entry-content details[open] summary {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.entry-content details p:last-child { margin-bottom: 0; }
.entry-content details:hover { border-color: var(--brand-accent); }

/* Single post / page */
.entry { padding: 48px 0; max-width: 760px; margin: 0 auto; }
.entry time { font-family: var(--font-ui); font-size: 14px; color: var(--ink-soft); }
.entry h1.entry-title { font-family: var(--font-ui); font-size: clamp(26px, 3.6vw, 36px); margin: 8px 0 24px; line-height: 1.25; }
.entry .entry-thumb { margin-bottom: 24px; border-radius: 12px; overflow: hidden; }
.entry .entry-content p { margin: 0 0 18px; }
.entry .entry-content img { border-radius: 8px; margin: 18px 0; }

/* Картинки, встроенные в текст старых статей Joomla, часто имеют обтекание (float)
   без отступа — добавляем отступ независимо от того, слева картинка или справа,
   плюс ограничиваем ширину и убираем "вылезание" картинки за пределы блока текста. */
.entry-content img {
  max-width: 45% !important;
  height: auto !important;
  margin: 4px 20px 16px 20px !important;
  border-radius: 8px;
}
.entry-content::after { content: ""; display: table; clear: both; }
@media (max-width: 600px) {
  .entry-content img {
    float: none !important;
    max-width: 100% !important;
    margin: 16px 0 !important;
  }
}
.entry .back-link { display: inline-block; margin-top: 32px; font-family: var(--font-ui); font-weight: 500; }

/* Footer */
footer.site { background: var(--brand-soft); border-top: 1px solid var(--line); padding: 40px 0 24px; font-size: 15px; }
.footer-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; margin-bottom: 28px; }
@media (max-width: 860px) { .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.footer-cols h4 { font-family: var(--font-ui); font-size: 14px; margin: 0 0 12px; color: var(--ink-soft); }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin-bottom: 8px; }
.footer-cols a { color: var(--ink); text-decoration: none; font-size: 14px; }
.footer-cols a:hover { text-decoration: underline; }

.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); font-family: var(--font-ui); font-size: 13px; color: var(--ink-soft); }
.badge-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 12px; color: var(--ink-soft); }

/* Рубрика "Об учреждении": текст страницы "О нас" сверху */
.about-intro { max-width: 760px; margin-bottom: 40px; }
.about-intro .entry-content p { margin: 0 0 16px; }
.about-intro .entry-content p:first-child {
  font-family: var(--font-ui);
  font-weight: 700;
  color: var(--brand);
  font-size: 19px;
}

/* Карточки документов и разделов в рубрике "Об учреждении" */
.about-doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 4px; }
@media (max-width: 860px) { .about-doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .about-doc-grid { grid-template-columns: 1fr; } }

/* Карточки в рубрике "Пациентам" — та же карточка (.about-doc-card), сетка 4 колонки */
.patients-doc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 4px; }
@media (max-width: 900px) { .patients-doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .patients-doc-grid { grid-template-columns: 1fr; } }
.about-doc-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; text-decoration: none; color: var(--ink);
  transition: border-color .15s ease;
}
.about-doc-card:hover { border-color: var(--brand-accent); }
.about-doc-icon {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.about-doc-icon img { width: 100%; height: 100%; object-fit: cover; }
.about-doc-icon.c-accent { background: var(--accent-soft); }
.about-doc-icon.c-warm { background: var(--warm-soft); }
.about-doc-icon.c-calm { background: var(--calm-soft); }
.about-doc-title {
  flex: 1; font-family: var(--font-ui); font-weight: 600; font-size: 15.5px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.about-doc-card:hover .about-doc-title { color: var(--brand-accent); }
.about-doc-arrow { flex-shrink: 0; font-size: 18px; color: var(--brand-accent); }

/* Рубрика "Обратная связь": карточки отзывов с началом текста
   (у всех записей одинаковый заголовок, поэтому показываем текст).
   Цвет — мягкая заливка + тонкая полоса сверху (как .help-tile). Без теней.
   Сетка строго 3 → 2 → 1 колонка: perm03_grid_icon_class( $i, 3 ) сдвигает цвета по диагонали. */
.thanks-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 960px) { .thanks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .thanks-grid { grid-template-columns: 1fr; } }
.thanks-card {
  display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: var(--ink);
  background: var(--accent-soft); border: 1px solid var(--line); border-top: 3px solid var(--brand-accent);
  border-radius: 12px; padding: 18px 20px;
  transition: border-color .15s ease;
}
.thanks-card.c-warm { background: var(--warm-soft); border-top-color: var(--warm); }
.thanks-card.c-calm { background: var(--calm-soft); border-top-color: var(--calm); }
.thanks-card:hover { border-color: var(--brand-accent); }
.thanks-card.c-warm:hover { border-color: var(--warm); }
.thanks-card.c-calm:hover { border-color: var(--calm); }
.thanks-card time { font-family: var(--font-ui); font-size: 13px; color: var(--ink-soft); }
.thanks-card-text { font-size: 16px; line-height: 1.5; margin: 0; flex: 1; }
.thanks-card-more { font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--brand); }
.thanks-card:hover .thanks-card-more { text-decoration: underline; }
.thanks-intro .help-info-box { margin-bottom: 18px; }

/* Заголовки внутри инфобоксов в описании рубрик — всегда жирные (с запасом по специфичности) */
.thanks-intro .help-info-box h3, .thanks-intro .help-info-box h4,
.thanks-intro .help-info-box h3 strong, .thanks-intro .help-info-box h4 strong { font-weight: 700; color: var(--brand); }
.thanks-intro .help-info-box h3 { font-size: 19px; margin-top: 0; }
.thanks-intro .help-info-box h4 { font-size: 16px; }

/* Баннер согласия на cookie / обработку персональных данных.
   Спокойная светлая плашка внизу окна, без теней, в цветах темы. */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 400;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 14px 20px;
  font-family: var(--font-ui); font-size: 14px; line-height: 1.5; color: var(--ink);
}
.cookie-banner[hidden] { display: none; }
.cookie-container {
  max-width: 1140px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px;
}
.cookie-text { margin: 0; flex: 1; min-width: 280px; color: var(--ink-soft); }
.cookie-text a { color: var(--brand); text-decoration: underline; }
.cookie-text a:hover { color: var(--brand-accent); }
.cookie-btn {
  font-family: var(--font-ui); font-weight: 600; font-size: 15px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: 10px 26px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.cookie-btn:hover { background: var(--brand-accent); border-color: var(--brand-accent); }
.cookie-btn:focus-visible, .cookie-text a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 600px) { .cookie-btn { width: 100%; } }
@media print { .cookie-banner { display: none !important; } }
html.a11y-fs-l .cookie-banner { font-size: 17px; }
html.a11y-fs-xl .cookie-banner { font-size: 19px; }
html.a11y-scheme-contrast .cookie-banner { background: #fff !important; border-top: 2px solid #000 !important; }
html.a11y-scheme-contrast .cookie-text { color: #000 !important; }
html.a11y-scheme-contrast .cookie-btn { background: #000 !important; color: #fff !important; border-color: #000 !important; }
html.a11y-scheme-invert .cookie-banner { background: #111 !important; border-top-color: #555 !important; }
html.a11y-scheme-invert .cookie-text { color: #fff !important; }
html.a11y-scheme-invert .cookie-btn { background: #fff !important; color: #000 !important; border-color: #fff !important; }

/* Фоторепортажи (category-photoalbum.php): разделы, карточки-репортажи, ссылка на проект. Без теней. */
.album-project {
  display: flex; align-items: center; gap: 20px; max-width: 760px; margin: 0 0 28px;
  background: var(--calm-soft); border: 1px solid var(--line); border-left: 4px solid var(--calm);
  border-radius: 12px; padding: 18px 22px; text-decoration: none; color: var(--ink);
  transition: border-color .15s ease;
}
.album-project:hover { border-color: var(--calm); }
.album-project-body { flex: 1; min-width: 0; }
.album-project-title { font-family: var(--font-ui); font-weight: 700; font-size: 18px; color: var(--brand); margin-bottom: 6px; }
.album-project p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-soft); }
.album-project-arrow { font-size: 22px; color: var(--brand); flex-shrink: 0; }

.album-jump { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 8px; font-family: var(--font-ui); font-size: 14px; }
.album-jump a {
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink); text-decoration: none;
}
.album-jump a:hover { border-color: var(--brand-accent); color: var(--brand); }
.album-jump a span { color: var(--ink-soft); margin-left: 4px; }
.album-section-title { font-family: var(--font-ui); font-size: 20px; font-weight: 700; color: var(--brand); margin: 36px 0 16px; }

.album-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 960px) { .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .album-grid { grid-template-columns: 1fr; } }
.album-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  transition: border-color .15s ease;
}
.album-card:hover { border-color: var(--brand-accent); }
.album-card-img {
  aspect-ratio: 4 / 3; background: var(--accent-soft); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.album-card.c-warm .album-card-img { background: var(--warm-soft); }
.album-card.c-calm .album-card-img { background: var(--calm-soft); }
.album-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-card-body { padding: 14px 18px 18px; }
.album-card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--font-ui); font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.album-card-body h4 { margin: 0; font-family: var(--font-ui); font-size: 16px; font-weight: 600; line-height: 1.35; }
.album-card:hover h4 { color: var(--brand-accent); }

/* Фотовыставка «Мы — жизнь!» (category-fotovystavka-my-zhizn.php): карточки очерков */
.exhibit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
@media (max-width: 960px) { .exhibit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .exhibit-grid { grid-template-columns: 1fr; } }
.exhibit-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand-accent);
  border-radius: 12px; overflow: hidden; transition: border-color .15s ease;
}
.exhibit-card.c-warm { border-top-color: var(--warm); }
.exhibit-card.c-calm { border-top-color: var(--calm); }
.exhibit-card:hover { border-color: var(--brand-accent); }
.exhibit-card.c-warm:hover { border-color: var(--warm); }
.exhibit-card.c-calm:hover { border-color: var(--calm); }
.exhibit-card-img { aspect-ratio: 808 / 460; background: var(--accent-soft); overflow: hidden; }
.exhibit-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.exhibit-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.exhibit-card-body h3 { margin: 0; font-family: var(--font-ui); font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--brand); }
.exhibit-card-role {
  margin: 0; font-family: var(--font-ui); font-size: 13.5px; line-height: 1.4; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.exhibit-card-quote { margin: 0; font-size: 15px; line-height: 1.5; font-style: italic; flex: 1; }
.exhibit-card-more { font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--brand); }
.exhibit-card:hover .exhibit-card-more { text-decoration: underline; }

/* Переход между очерками внизу записи */
.exhibit-nav {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); font-family: var(--font-ui); font-size: 15px;
}
.exhibit-nav a { text-decoration: none; color: var(--brand); font-weight: 600; }
.exhibit-nav a:hover { color: var(--brand-accent); text-decoration: underline; }
.exhibit-nav a span { display: block; font-weight: 400; font-size: 13px; color: var(--ink-soft); margin-bottom: 2px; }
.exhibit-nav-next { text-align: right; }
.exhibit-nav-all { text-align: center; white-space: nowrap; }
@media (max-width: 700px) {
  .exhibit-nav { grid-template-columns: 1fr; text-align: left; }
  .exhibit-nav-next, .exhibit-nav-all { text-align: left; }
}
@media print { .exhibit-nav { display: none; } }
html.a11y-scheme-contrast .album-card, html.a11y-scheme-contrast .exhibit-card, html.a11y-scheme-contrast .album-project { border-color: #000 !important; }
html.a11y-scheme-invert .album-card, html.a11y-scheme-invert .exhibit-card { background: #111 !important; border-color: #555 !important; }
html.a11y-scheme-invert .album-project { background: #111 !important; border-color: #555 !important; }

/* Рубрика «Противодействие коррупции»: баннер «Сообщить о факте коррупции». Подписи карточек короткие (perm03_anticor_label). */
.anticor-report {
  display: flex; align-items: center; gap: 18px; max-width: 760px; margin: 0 0 28px;
  background: var(--calm-soft); border: 1px solid var(--line); border-left: 4px solid var(--calm);
  border-radius: 12px; padding: 18px 22px; text-decoration: none; color: var(--ink);
  transition: border-color .15s ease;
}
.anticor-report:hover { border-color: var(--calm); }
.anticor-report-icon {
  flex-shrink: 0; width: 52px; height: 52px; border-radius: 12px; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
}
.anticor-report-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.anticor-report-title { font-family: var(--font-ui); font-weight: 700; font-size: 18px; color: var(--brand); }
.anticor-report-text { font-size: 15px; line-height: 1.45; color: var(--ink-soft); }
.anticor-report-arrow { font-size: 22px; color: var(--brand); flex-shrink: 0; }
html.a11y-scheme-contrast .anticor-report { border-color: #000 !important; background: #fff !important; }
html.a11y-scheme-invert .anticor-report { background: #111 !important; border-color: #555 !important; }
html.a11y-scheme-invert .anticor-report-icon { background: #000 !important; }

/* =====================================================================
   Версия для слабовидящих: доработка схем «белым по чёрному» и «контрастная».
   Раньше схемы перекрашивали только часть блоков, а всё, что построено на
   цветах-переменных (выпадающее меню, кнопки, поиск, таблицы, файлы), оставалось
   светлым — белый текст на белом. Теперь переменные переопределяются целиком.
   ===================================================================== */
html.a11y-scheme-invert {
  --bg: #000; --surface: #0b0b0b; --ink: #fff; --ink-soft: #cfcfcf;
  --brand: #fff; --brand-accent: #8ab4ff; --brand-soft: #141414;
  --accent-soft: #10233a; --warm: #ffb266; --warm-soft: #2b1c0d; --calm: #6fd6ab; --calm-soft: #0e2b21;
  --line: #6b6b6b; --focus: #ffd54a;
}
html.a11y-scheme-contrast {
  --ink: #000; --ink-soft: #222; --line: #333; --brand-accent: #00308F;
}

/* Карточки и плитки — это ссылки целиком: текст не синий и без подчёркивания, как в обычной версии */
html.a11y-scheme-invert .tile, html.a11y-scheme-invert .news-card, html.a11y-scheme-invert .news-item,
html.a11y-scheme-invert .staff-card, html.a11y-scheme-invert .about-doc-card, html.a11y-scheme-invert .help-tile,
html.a11y-scheme-invert .vacancy-card, html.a11y-scheme-invert .thanks-card, html.a11y-scheme-invert .album-card,
html.a11y-scheme-invert .exhibit-card, html.a11y-scheme-invert .album-project, html.a11y-scheme-invert .anticor-report,
html.a11y-scheme-invert .brand-icon-link, html.a11y-scheme-invert .brand-text-link, html.a11y-scheme-invert .album-jump a {
  color: #fff !important; text-decoration: none !important;
}
html.a11y-scheme-contrast .tile, html.a11y-scheme-contrast .news-card, html.a11y-scheme-contrast .news-item,
html.a11y-scheme-contrast .staff-card, html.a11y-scheme-contrast .about-doc-card, html.a11y-scheme-contrast .help-tile,
html.a11y-scheme-contrast .vacancy-card, html.a11y-scheme-contrast .thanks-card, html.a11y-scheme-contrast .album-card,
html.a11y-scheme-contrast .exhibit-card, html.a11y-scheme-contrast .album-project, html.a11y-scheme-contrast .anticor-report,
html.a11y-scheme-contrast .brand-icon-link, html.a11y-scheme-contrast .brand-text-link, html.a11y-scheme-contrast .album-jump a {
  color: #000 !important; text-decoration: none !important;
}
html.a11y-scheme-invert .thanks-card-more, html.a11y-scheme-contrast .thanks-card-more,
html.a11y-scheme-invert .exhibit-card-more, html.a11y-scheme-contrast .exhibit-card-more { text-decoration: underline; }

/* Кнопки */
html.a11y-scheme-invert .btn { text-decoration: none !important; }
html.a11y-scheme-invert .btn-urgent { background: #b3261e !important; color: #fff !important; border-color: #fff !important; }
html.a11y-scheme-invert .btn-outline,
html.a11y-scheme-invert .hero.has-image .btn-outline { color: #fff !important; border-color: #fff !important; background: transparent !important; }
html.a11y-scheme-invert .btn-outline:hover { background: #222 !important; }
html.a11y-scheme-contrast .btn { text-decoration: none !important; }
html.a11y-scheme-contrast .btn-outline:hover { background: #eee !important; }

/* Кнопки-ссылки на файлы */
html.a11y-scheme-invert .entry-content a.file-download,
html.a11y-scheme-invert .entry-content a.file-download:hover { background: #fff !important; color: #000 !important; text-decoration: none !important; }
html.a11y-scheme-contrast .entry-content a.file-download,
html.a11y-scheme-contrast .entry-content a.file-download:hover { background: #000 !important; color: #fff !important; text-decoration: none !important; }

/* Постраничная навигация, таблицы */
html.a11y-scheme-invert .pagination .page-numbers { text-decoration: none !important; }
html.a11y-scheme-invert .pagination .page-numbers.current { background: #fff !important; color: #000 !important; border-color: #fff !important; }
html.a11y-scheme-invert .entry-content table thead th { background: #2a2a2a !important; color: #fff !important; border-bottom: 2px solid #fff; }
html.a11y-scheme-invert .entry-content table tbody tr:nth-child(even) { background: #141414; }
html.a11y-scheme-contrast .pagination .page-numbers.current { background: #000 !important; color: #fff !important; border-color: #000 !important; }
html.a11y-scheme-contrast .entry-content table thead th { background: #000 !important; color: #fff !important; }

/* Меню: выпадающее подменю и подсветка текущего пункта */
html.a11y-scheme-invert nav.main .sub-menu { background: #0b0b0b !important; border-color: #6b6b6b !important; }
html.a11y-scheme-invert nav.main .sub-menu a:hover { background: #10233a !important; }
html.a11y-scheme-invert nav.main > div > ul > li > a:hover,
html.a11y-scheme-invert nav.main .current-menu-item > a { border-bottom-color: #8ab4ff !important; }
html.a11y-scheme-contrast nav.main .sub-menu { border-color: #000 !important; }
html.a11y-scheme-contrast nav.main a { color: #000 !important; text-decoration: none !important; }
html.a11y-scheme-contrast nav.main .current-menu-item > a,
html.a11y-scheme-contrast nav.main > div > ul > li > a:hover { border-bottom-color: #000 !important; }
html.a11y-scheme-invert nav.main a { text-decoration: none !important; }

/* Вступительные блоки с голубой подложкой */
html.a11y-scheme-invert .help-info-box, html.a11y-scheme-invert .vacancy-info-box { background: #10233a !important; border-color: #6b6b6b !important; color: #fff !important; }
html.a11y-scheme-invert .help-info-box h3, html.a11y-scheme-invert .help-info-box h4,
html.a11y-scheme-invert .vacancy-info-box h3, html.a11y-scheme-invert .vacancy-info-box h4 { color: #fff !important; }
html.a11y-scheme-contrast .help-info-box, html.a11y-scheme-contrast .vacancy-info-box { border-color: #000 !important; }

/* Подвал */
html.a11y-scheme-invert .badge { background: #0b0b0b !important; border-color: #6b6b6b !important; color: #fff !important; }

/* Страницы-хабы («О нас», «Сотрудникам», блок «Разделы» у «Пациентам») */
.about-doc-text { flex: 1; min-width: 0; }
.about-doc-text .about-doc-title { flex: none; }
.hub-card-desc { margin-top: 4px; font-size: 13.5px; line-height: 1.4; color: var(--ink-soft); }
.about-doc-card:hover .hub-card-desc { color: var(--ink-soft); }
html.a11y-scheme-invert .hub-card-desc { color: #d8d8d8 !important; }
html.a11y-scheme-contrast .hub-card-desc { color: #000 !important; }

/* Хаб в две колонки (главная страница «Пациентам») */
.hub-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 4px; }
@media (max-width: 640px) { .hub-grid-2 { grid-template-columns: 1fr; } }

/* Главная: плитки «Что делать, если…» в три колонки */
.tiles.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .tiles.tiles-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .tiles.tiles-3 { grid-template-columns: 1fr; } }
.home-help-lead { max-width: 70ch; margin: 0 0 20px; }

/* Главная: яркие плитки «Что делать, если…» — цветная заливка, белый круг под иконкой, полоса сверху. Без теней. */
.home-help-tile {
  display: flex; flex-direction: column; gap: 14px;
  min-height: 140px; padding: 20px 20px 16px;
  text-decoration: none; color: var(--ink);
  background: var(--accent-soft); border: 1px solid var(--line); border-top: 4px solid var(--brand-accent);
  border-radius: 12px; transition: border-color .15s ease;
}
.home-help-tile.c-warm { background: var(--warm-soft); border-top-color: var(--warm); }
.home-help-tile.c-calm { background: var(--calm-soft); border-top-color: var(--calm); }
.home-help-tile:hover { border-color: var(--brand-accent); }
.home-help-tile.c-warm:hover { border-color: var(--warm); }
.home-help-tile.c-calm:hover { border-color: var(--calm); }
.home-help-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; }
.home-help-icon svg { width: 26px; height: 26px; }
.home-help-title { font-family: var(--font-ui); font-weight: 700; font-size: 17px; line-height: 1.3; }
.home-help-more { margin-top: auto; font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--brand); }
.home-help-tile:hover .home-help-more { text-decoration: underline; }
html.a11y-scheme-invert .home-help-tile { color: #fff !important; text-decoration: none !important; }
html.a11y-scheme-contrast .home-help-tile { color: #000 !important; text-decoration: none !important; }

/* Главная: яркие плитки «Полезные ссылки» — те же приёмы, что у «Что делать, если…» */
.tile.tile-bright {
  display: flex; flex-direction: column;
  padding: 22px 20px 18px;
  background: var(--accent-soft); border-top: 4px solid var(--brand-accent);
  border-radius: 12px; transition: border-color .15s ease;
}
.tile.tile-bright.c-warm { background: var(--warm-soft); border-top-color: var(--warm); }
.tile.tile-bright.c-calm { background: var(--calm-soft); border-top-color: var(--calm); }
.tile.tile-bright.c-brand { background: var(--brand-soft); border-top-color: var(--brand); }
.tile.tile-bright:hover { border-color: var(--brand-accent); }
.tile.tile-bright.c-warm:hover { border-color: var(--warm); }
.tile.tile-bright.c-calm:hover { border-color: var(--calm); }
.tile.tile-bright.c-brand:hover { border-color: var(--brand); }
.tile-bright .tile-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--surface); margin-bottom: 14px; }
.tile-bright .tile-icon svg { width: 24px; height: 24px; }
.tile-bright .tile-title { font-weight: 700; font-size: 16px; line-height: 1.3; margin-bottom: 6px; }
.tile-bright .tile-sub { color: var(--ink-soft); line-height: 1.4; }
html.a11y-scheme-invert .tile-bright .tile-icon, html.a11y-scheme-invert .home-help-icon { background: #000 !important; }

/* Подвал: тёмно-синий, в тон верхней полосе и главному блоку (на всём сайте) */
footer.site { background: var(--brand); border-top: none; color: #fff; }
footer.site .footer-cols h4 { color: rgba(255,255,255,.65); }
footer.site .footer-cols a { color: #fff; }
footer.site .footer-bottom { border-top-color: rgba(255,255,255,.2); color: rgba(255,255,255,.75); }
footer.site .badge { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.3); color: #fff; }
/* Версия для слабовидящих: «контрастная» остаётся светлой, «белым по чёрному» — как было */
html.a11y-scheme-contrast footer.site, html.a11y-scheme-contrast footer.site .footer-cols a,
html.a11y-scheme-contrast footer.site .footer-cols h4, html.a11y-scheme-contrast footer.site .footer-bottom { color: #000 !important; }
html.a11y-scheme-contrast footer.site .footer-bottom { border-top-color: #000 !important; }
html.a11y-scheme-contrast footer.site .badge { background: #fff !important; border-color: #000 !important; color: #000 !important; }
html.a11y-scheme-invert footer.site, html.a11y-scheme-invert footer.site .footer-cols h4,
html.a11y-scheme-invert footer.site .footer-bottom { color: #fff !important; }

/* Подвал: баннеры и кнопка ВКонтакте */

.footer-banner { display: block; border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,.3); background: #fff; line-height: 0; transition: border-color .15s ease; }
.footer-banner:hover { border-color: #fff; }
.footer-banner img { display: block; max-width: 100%; height: auto; }
footer.site a.badge-link { text-decoration: none; font-weight: 600; padding: 8px 14px; font-size: 13px; }
footer.site a.badge-link:hover { background: rgba(255,255,255,.18); border-color: #fff; }
html.a11y-scheme-contrast .footer-banners, html.a11y-scheme-contrast .footer-banner { border-color: #000 !important; }
html.a11y-scheme-contrast footer.site a.badge-link { color: #000 !important; text-decoration: none !important; }
html.a11y-scheme-invert footer.site a.badge-link { text-decoration: none !important; }

/* Подвал: полоса контактов сверху, три колонки ссылок и колонка с маленькими баннерами */
.footer-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 44px; padding-bottom: 24px; margin-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,.2); font-size: 15px; }
.footer-contact a { color: #fff; text-decoration: none; }
.footer-contact a:hover { text-decoration: underline; }
.footer-contact-label { font-family: var(--font-ui); font-size: 12px; color: rgba(255,255,255,.65); }
.footer-contact-phones { font-family: var(--font-ui); font-size: 30px; font-weight: 700; line-height: 1.15; }
.footer-contact-phones span { color: rgba(255,255,255,.5); font-weight: 400; }
.footer-contact-links { display: flex; flex-direction: column; gap: 6px; margin-left: auto; font-size: 14px; }
@media (max-width: 720px) { .footer-contact-links { margin-left: 0; } }
.footer-cols.footer-cols-banners { grid-template-columns: repeat(3, minmax(0, 1fr)) 224px; }
.footer-banner-col { display: flex; flex-direction: column; gap: 12px; }
.footer-banner img { width: 100%; }
@media (max-width: 860px) {
  .footer-cols.footer-cols-banners { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-banner-col { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .footer-banner-col .footer-banner { width: 224px; }
}
html.a11y-scheme-contrast .footer-contact { border-bottom-color: #000 !important; }
html.a11y-scheme-contrast .footer-contact a, html.a11y-scheme-contrast .footer-contact,
html.a11y-scheme-contrast .footer-contact-label, html.a11y-scheme-contrast .footer-contact-phones span { color: #000 !important; }
html.a11y-scheme-invert .footer-contact, html.a11y-scheme-invert .footer-contact-label { color: #fff !important; }

/* Карта сайта: блоки внутри колонок и вложенные списки */
.sitemap-block { margin-bottom: 30px; }
.sitemap-col h3 a { color: var(--brand); font-weight: 700; }
.sitemap-col h3 a:hover { color: var(--brand-accent); }
.sitemap-col ul ul { margin: 8px 0 0; padding-left: 16px; border-left: 2px solid var(--line); }
.sitemap-col ul ul li { margin-bottom: 8px; font-size: 15px; }

/* Заголовок страницы рубрики теперь h1 (раньше h2) — выглядит так же */
h1.section-title { font-family: var(--font-ui); font-size: 22px; font-weight: 700; margin: 0 0 22px; color: var(--ink); }
html.a11y-fs-l h1.section-title { font-size: 26px !important; }
html.a11y-fs-xl h1.section-title { font-size: 30px !important; }

/* =====================================================================
   Страница 404 (404.php): иллюстрация «машина скорой потерялась на карте»
   Все цвета — переменные, поэтому обе схемы для слабовидящих подхватываются сами.
   ===================================================================== */
.e404 { text-align: center; padding: 28px 0 60px; }
.e404-title { font-family: var(--font-ui); font-size: clamp(26px, 4vw, 40px); font-weight: 700; line-height: 1.2; margin: 0 0 4px; color: var(--brand); }
.e404-art { max-width: 880px; margin: 6px auto 0; overflow: hidden; }
.e404-svg { display: block; width: 100%; height: auto; }
.e404-lead { max-width: 58ch; margin: 0 auto 26px; font-size: 19px; color: var(--ink-soft); }
.e404-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-fill { background: var(--brand); color: var(--surface); border-color: var(--brand); }
.btn-fill:hover { filter: brightness(1.15); }
.e404-search { display: flex; gap: 8px; justify-content: center; max-width: 440px; margin: 34px auto 0; }
.e404-search input[type="search"] { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; font-family: var(--font-body); font-size: 15px; color: var(--ink); background: var(--surface); }
.e404-search input[type="search"]:focus { outline: none; border-color: var(--brand-accent); }
.e404-search .btn { padding: 11px 18px; }
.e404-urgent { max-width: 640px; margin: 30px auto 0; padding-top: 22px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 16px; }
.e404-urgent a { font-weight: 700; color: var(--urgent); text-decoration: none; white-space: nowrap; }
.e404-urgent a:hover { text-decoration: underline; }

/* Движение: машина проезжает по маршруту, мигалки мигают, маршрут «бежит», метка покачивается */
.e404-car { animation: e404-drive 7s linear infinite; }
.e404-light-a { animation: e404-blink 1s steps(1) infinite; }
.e404-light-b { animation: e404-blink 1s steps(1) infinite .5s; }
.e404-route { animation: e404-dash 1.1s linear infinite; }
.e404-pin { animation: e404-bob 2.6s ease-in-out infinite; }
@keyframes e404-drive {
  0%   { transform: translate(0, 0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translate(294px, 170px); opacity: 0; }
}
@keyframes e404-blink { 0% { opacity: 1; } 50% { opacity: .2; } }
@keyframes e404-dash  { to { stroke-dashoffset: -16; } }
@keyframes e404-bob   { 50% { transform: translateY(-7px); } }

/* Тем, кто отключил анимацию в системе, — статичная картинка с машиной посередине маршрута */
@media (prefers-reduced-motion: reduce) {
  .e404-car, .e404-light-a, .e404-light-b, .e404-route, .e404-pin { animation: none; }
  .e404-car { transform: translate(120px, 69px); opacity: 1; }
}

@media (max-width: 600px) {
  .e404 { padding: 18px 0 44px; }
  /* на узком экране показываем середину карты крупнее — края всё равно растворяются */
  .e404-svg { width: 150%; max-width: none; margin-left: -25%; }
  .e404-lead { font-size: 17px; }
}

/* Версия для слабовидящих */
html.a11y-fs-l .e404-lead { font-size: 22px; }
html.a11y-fs-xl .e404-lead { font-size: 26px; }
html.a11y-fs-l .e404-urgent { font-size: 19px; }
html.a11y-fs-xl .e404-urgent { font-size: 22px; }
html.a11y-scheme-invert .btn-fill { background: #fff !important; color: #000 !important; border-color: #fff !important; }
html.a11y-scheme-contrast .btn-fill { background: #000 !important; color: #fff !important; border-color: #000 !important; }
html.a11y-scheme-invert .e404-urgent a { color: #ff8a80 !important; }
html.a11y-scheme-invert .e404-search input[type="search"], html.a11y-scheme-contrast .e404-search input[type="search"] { border-color: var(--ink); }

/* Подвал: полоса баннеров под колонками ссылок.
   На широком экране — один ряд одинаковой высоты (160 px): [военная служба + «Так здорово»] [Госуслуги] [MAX] [независимая оценка + соответствие ФЗ].
   Уже 1060 px — баннеры переносятся: сверху Госуслуги, ниже остальные. */
@media (min-width: 861px) { .footer-cols.footer-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.footer-banners { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; padding-top: 28px; margin-bottom: 28px; border-top: 1px solid rgba(255,255,255,.2); }
.footer-banner-stack { display: contents; }
.footer-banners .footer-banner { width: 297px; max-width: 100%; }
.footer-banners .footer-banner img { width: 100%; height: auto; max-width: 100%; }
.footer-banners .footer-banner-max { width: 250px; max-width: 100%; }
.footer-banners .footer-banner-pill { padding: 6px 8px; text-align: center; }
.footer-banners .footer-banner-pill img { width: auto; }
.footer-gosuslugi { order: -1; flex: 1 1 100%; min-width: 0; max-width: 760px; border-radius: 8px; overflow: hidden; }
html.a11y-scheme-contrast .footer-banners { border-top-color: #000 !important; }
html.a11y-scheme-contrast .footer-gosuslugi { border: 1px solid #000; }

@media (min-width: 1060px) {
  .footer-banners { display: grid; grid-template-columns: 177px minmax(360px, 1fr) 234px 200px; grid-template-rows: 160px; align-items: stretch; }
  .footer-gosuslugi { order: 0; max-width: none; height: 100%; }
  .footer-banner-stack { display: flex; flex-direction: column; gap: 10px; width: auto; height: 100%; min-height: 0; }
  .footer-banners .footer-banner { width: auto; }
  .footer-banner-stack .footer-banner { flex: 1 1 0; min-height: 0; }
  .footer-banner-stack .footer-banner img { width: 100%; height: 100%; object-fit: contain; }
  .footer-banners .footer-banner-max { width: auto; height: 100%; }
  .footer-banners .footer-banner-max img { height: 100%; object-fit: cover; }
  .footer-banner-stack-d .footer-banner:first-child { flex: 0 0 auto; }
  .footer-banner-stack-d .footer-banner:first-child img { height: auto; }
  .footer-banner-stack-d .footer-banner-pill { flex: 1 1 0; display: flex; align-items: center; justify-content: center; }
  .footer-banner-stack-d .footer-banner-pill img { width: auto; height: auto; max-width: 100%; }

  /* Виджет Госуслуг: тот же код, но компактная раскладка — текст слева, картинка справа, высота ряда */
  .footer-gosuslugi #js-show-iframe-wrapper { height: 100%; min-width: 0; }
  .footer-gosuslugi #js-show-iframe-wrapper .bf-12 { grid-template-columns: minmax(0, 1fr) 130px !important; grid-template-rows: 100% !important; height: 100%; }
  .footer-gosuslugi #js-show-iframe-wrapper .bf-12__content { grid-column: 1; grid-row: 1 !important; padding: 14px 8px 14px 18px !important; }
  .footer-gosuslugi #js-show-iframe-wrapper .bf-12__decor { grid-column: 2; grid-row: 1; }
  .footer-gosuslugi #js-show-iframe-wrapper .bf-12__text { font-size: 18px !important; margin: 0 0 12px !important; }
  .footer-gosuslugi #js-show-iframe-wrapper .bf-12__btn-wrap { max-width: none !important; }
  .footer-gosuslugi #js-show-iframe-wrapper .pos-banner-btn_2 { min-height: 40px; font-size: 14px; }
  .footer-gosuslugi #js-show-iframe-wrapper .bf-12__logo { width: 58px !important; }
  .footer-gosuslugi #js-show-iframe-wrapper .bf-12__slogan { font-size: 11px !important; }
  .footer-gosuslugi #js-show-iframe-wrapper .bf-12__logo-wrap { top: 12px !important; right: 10px !important; }
}

/* Схема проезда: встроенная карта на странице «Контакты» */
.map-embed { margin: 20px 0 8px; border: 1px solid var(--line, #d9e1e8); border-radius: 8px; overflow: hidden; background: var(--brand-soft, #eef3f7); }
.map-embed iframe { display: block; width: 100%; height: 420px; border: 0; }
.map-embed-note { margin: 0 0 20px; font-size: 14px; }
@media (max-width: 640px) { .map-embed iframe { height: 320px; } }
html.a11y-scheme-contrast .map-embed { border-color: #000; }

/* Плашка вызова в шапке: надпись слева, справа две строки «подпись + номер», прижатые к правому краю */
.call-block { flex-direction: row; align-items: center; gap: 16px; padding: 12px 20px; }
.call-block .lbl { max-width: 115px; font-size: 13px; line-height: 1.35; opacity: 1; padding-right: 16px; border-right: 1px solid rgba(255,255,255,.4); }
.call-block .lbl strong { display: block; font-weight: 700; }
.call-block-row { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.call-item { display: flex; align-items: baseline; gap: 10px; }
.call-block .call-item .cap { font-size: 13px; line-height: 1.3; }
.call-block .call-item .num { font-size: 26px; font-weight: 700; line-height: 1.1; white-space: nowrap; }
@media (max-width: 560px) {
  .call-block { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 16px; }
  .call-block .lbl { max-width: none; width: 100%; padding: 0 0 8px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.4); }
  .call-block .lbl strong { display: inline; }
  .call-block-row { width: 100%; align-items: stretch; }
  .call-item { justify-content: space-between; }
  .call-block .call-item .num { font-size: 22px; }
}

/* Логотип в шапке: не сжимается и не искажается на узких экранах */
.brand .custom-logo-link { flex: 0 0 auto; display: block; line-height: 0; }
.brand img.custom-logo { height: 58px; width: auto; max-width: none; flex: 0 0 auto; }
@media (max-width: 480px) {
  .brand { gap: 12px; }
  .brand img.custom-logo { height: 50px; }
}
