/* ============================================================
   ВМІСТ СТОРІНОК (content.css)
   ------------------------------------------------------------
   Стилі для розмітки, яка приходить із РЕДАКТОРА (post_content),
   а не з шаблонів теми. Через це файл підключається ЗАВЖДИ —
   такий вміст може опинитися на будь-якій сторінці.

   Правила цього шару:
     • тільки класи — жодних глобальних селекторів по тегах;
       якщо стиль потрібен для li/p — він обмежений контекстом
       (.lab-list li, .panel-blog p);
     • кольори — через змінні з brand.css, де відповідник існує.

   Джерело: d1/templates/css/main.css (секції «картка керівника»,
   «Акордион для страниц — v2», «Картка персони») + inline <style>
   зі сторінки 147 (блок .adm-*).
   ============================================================ */

/* ====================== Ритм звичайного тексту ===================== */
/* base.css скидає поля заголовків (вони потрібні шаблонам), а рукописні
   style="margin" з тексту прибрало очищення вмісту. :where() тримає
   специфічність на рівні одного класу - будь-який компонент нижче
   (.lab-h3, .iep-card h3 ...) перекриває ці поля без зусиль. */
.iep-content :where(h2, h3, h4, h5, h6) { margin: 1.5em 0 .55em; }
.iep-content :where(h2, h3, h4, h5, h6):first-child,
.iep-toc-main > :where(h2, h3, h4, h5, h6):first-child { margin-top: 0; }
.iep-content :where(ul, ol) { margin: 0 0 16px; padding-left: 1.5em; }
.iep-content :where(li) { margin-bottom: 4px; }
.iep-content :where(li > ul, li > ol) { margin: 4px 0 0; }
.iep-content :where(figure) { margin: 0 0 18px; }
.iep-content :where(figcaption) { margin-top: 8px; font-size: 13.5px; color: var(--c-muted); }
.iep-content :where(img.aligncenter, figure.aligncenter) { margin-inline: auto; }
.iep-content :where(.alignleft) { float: left; margin: 4px 22px 14px 0; max-width: 50%; }
.iep-content :where(.alignright) { float: right; margin: 4px 0 14px 22px; max-width: 50%; }
.iep-content::after { content: ""; display: block; clear: both; }
@media (max-width: 560px) {
  .iep-content :where(.alignleft, .alignright) { float: none; margin: 0 0 16px; max-width: 100%; }
}

/* ======================== Картка керівника ======================== */
.lab-head {
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-left: 4px solid var(--c-brand);
  border-radius: 0 10px 10px 0;
  padding: 17px 22px 19px;
  margin: 0 0 26px;
}

.lh-role {
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-brand-text);
  font-weight: 700;
  margin-bottom: 4px;
}

.lh-name {
  font-size: 23px;
  font-weight: 700;
  color: var(--c-heading);
  line-height: 1.25;
}

.lh-deg {
  font-size: 15.5px;
  color: var(--c-ink-soft);
  margin-top: 3px;
  line-height: 1.45;
}

/* Додатковий рядок картки («Посада:», «Відділ:») — у d1 стилю не мав. */
.lh-extra {
  font-size: 15.5px;
  color: var(--c-ink);
  margin-top: 5px;
  line-height: 1.45;
}

.lh-line {
  border: none;
  border-top: 1px solid var(--c-line);
  margin: 14px 0 12px;
  height: 0;
}

.lh-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 30px;
  font-size: 15.5px;
  color: var(--c-ink);
  line-height: 1.5;
}

.lh-contacts > span {
  position: relative;
  display: inline-block;
  padding-left: 25px;
}

.lh-contacts a {
  color: var(--c-brand-text);
  text-decoration: none;
}

.lh-contacts a:hover {
  text-decoration: underline;
}

.lh-tel::before,
.lh-mail::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 16px;
  height: 16px;
  background-repeat: no-repeat;
  background-size: contain;
}

.lh-tel::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238fa9c0' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3 19.5 19.5 0 0 1-6-6 19.8 19.8 0 0 1-3-8.7A2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .3 1.9.7 2.8a2 2 0 0 1-.5 2.1L8.1 9.9a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2Z'/%3E%3C/svg%3E");
}

.lh-mail::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238fa9c0' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='m22 7-10 6L2 7'/%3E%3C/svg%3E");
}

/* ============= Підзаголовки розділів усередині сторінки ============ */
.lab-h3 {
  margin: 28px 0 13px;
  color: var(--c-heading);
  font-size: 21px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--c-line-strong);
}

.lab-h3 strong { font-weight: 700; }

/* ================= Списки на сторінках відділів =================== */
.lab-list {
  margin: 0 0 20px;
  padding-left: 0;
  list-style: none;
}

.lab-list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
  line-height: 1.6;
  color: var(--c-ink);
  text-align: justify;
  list-style: none;
}

.lab-list li::marker { content: ""; }

.lab-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: .62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-brand);
}

/* ============================ Акордеон ============================ */
/* Механіка: .accordion-blog — кнопка-заголовок, наступний sibling —
   .panel-blog; розкриття через inline max-height зі скрипта. */
.accordion-h5 {
  margin-top: 20px;
}

.accordion-blog {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  cursor: pointer;
  text-align: left;
  outline: none;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  padding: 14px 18px;
  margin-bottom: 8px;
  border-radius: 8px;
  /* біле на фірмовому синьому - 4.6:1 (було 2.8:1 на світло-блакитному) */
  background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-dark) 100%);
  box-shadow: 0 1px 2px rgba(15, 60, 100, .18);
  transition: filter .18s, box-shadow .18s;
}

.accordion-blog:hover {
  filter: brightness(1.06);
  box-shadow: 0 3px 8px rgba(15, 60, 100, .22);
}

.accordion-blog:focus-visible {
  outline: 2px solid var(--c-deep);
  outline-offset: 2px;
}

.active-blog {
  background: linear-gradient(135deg, var(--c-brand-dark) 0%, var(--c-brand-darker) 100%);
  border-radius: 8px 8px 0 0;
  margin-bottom: 0;
}

.accordion-blog::after {
  content: "";
  margin-left: auto;
  width: 9px;
  height: 9px;
  flex: none;
  border-right: 2px solid rgba(255, 255, 255, .9);
  border-bottom: 2px solid rgba(255, 255, 255, .9);
  transform: rotate(45deg) translateY(-2px);
  transition: transform .25s;
}

.active-blog::after {
  transform: rotate(-135deg) translateY(-2px);
}

.panel-blog {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease-out;
  background-color: var(--c-surface-2);
  padding: 0 18px;
  border-radius: 0 0 8px 8px;
}

.active-blog + .panel-blog {
  padding: 16px 18px 18px;
  margin-bottom: 8px;
  border: 1px solid var(--c-line-strong);
  border-top: none;
}

.panel-blog p {
  text-align: justify;
  line-height: 1.65;
}

/* ==================== Картка персони (dir-*) ====================== */
.dir-card {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-left: 4px solid var(--c-brand);
  border-radius: 0 10px 10px 0;
  padding: 22px 24px;
  margin: 0 0 24px;
}

.dir-photo {
  flex: none;
  width: 230px;
  margin: 0;
}

.dir-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(15, 60, 100, .18);
}

.dir-info {
  flex: 1 1 auto;
  min-width: 0;
}

.dir-role {
  font-size: 12px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--c-brand-text);
  font-weight: 700;
  margin-bottom: 6px;
}

.dir-degree {
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-ink);
  margin-bottom: 10px;
}

.dir-position {
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-heading);
  font-weight: 600;
  margin-bottom: 4px;
}

.dir-line {
  border: none;
  border-top: 1px solid var(--c-line);
  margin: 14px 0 12px;
  height: 0;
}

.dir-contacts {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 15.5px;
  color: var(--c-ink);
  line-height: 1.5;
}

.dir-contacts > span {
  position: relative;
  padding-left: 25px;
}

.dir-contacts a {
  color: var(--c-brand-text);
  text-decoration: none;
}

.dir-contacts a:hover {
  text-decoration: underline;
}

.dir-contacts .lh-fax::before {
  content: "Факс";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--c-faint);
  font-weight: 700;
  padding-left: 0;
}

/* Підпис англійською на англійській версії сайту. */
html[lang^="en"] .dir-contacts .lh-fax::before {
  content: "Fax";
}

.dir-contacts .lh-fax {
  padding-left: 44px;
}

.dir-cv {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 4px 0 8px;
  padding: 9px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-line-strong);
  border-radius: 8px;
  font-size: 15px;
  color: var(--c-brand-text);
  text-decoration: none;
  transition: background .18s, box-shadow .18s;
}

.dir-cv:hover {
  background: var(--c-surface-2);
  box-shadow: 0 2px 6px rgba(15, 60, 100, .12);
}

.dir-cv .fa {
  color: var(--c-danger);
  font-size: 17px;
}

/* ================= Картки відділів / персоналу (adm-*) ============= */
/* Джерело: inline <style> у вмісті сторінок 147 і її EN-двійника.
   Тут — щоб inline перестав бути ЄДИНИМ джерелом і його можна було
   прибрати з вмісту окремою задачею. Самі сторінки не змінювались. */
.adm-wrap {
  color: var(--c-ink);
  line-height: 1.55;
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px;
}

.adm-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.adm-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 22px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(26, 77, 124, .06);
  transition: box-shadow .25s, transform .25s;
}

.adm-card:hover {
  box-shadow: 0 10px 24px rgba(26, 77, 124, .12);
  transform: translateY(-2px);
}

.adm-photo {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

.adm-placeholder {
  width: 200px;
  height: 200px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-darker) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  font-weight: 700;
  letter-spacing: 3px;
}

.adm-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.adm-name {
  margin: 0 0 4px;
  color: var(--c-heading);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}

.adm-name a {
  color: var(--c-heading);
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 77, 124, .4);
  transition: color .2s, border-color .2s;
}

.adm-name a:hover {
  color: var(--c-heading);
  border-bottom-color: var(--c-heading);
}

.adm-position {
  color: var(--c-ink-soft);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}

.adm-title {
  color: var(--c-ink-soft);
  font-size: 14px;
  margin: 0 0 4px;
  font-style: italic;
  line-height: 1.5;
}

.adm-dept {
  color: var(--c-ink-soft);
  font-size: 14px;
  margin: 0 0 10px;
  line-height: 1.5;
}

/* Заголовок групи карток: підпис по центру лінії */
.adm-section {
  margin: 32px 0 14px;
  text-align: center;
  position: relative;
}
.adm-section h3 {
  display: inline-block;
  font-size: 13px;
  color: var(--c-brand-text);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  margin: 0;
  padding: 0 18px;
  background: var(--c-surface);
  position: relative;
  z-index: 1;
  font-weight: 700;
}
.adm-section::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--c-line);
  z-index: 0;
}

.adm-contacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: var(--c-ink);
  padding-top: 8px;
  border-top: 1px solid var(--c-line);
}

.adm-contact {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.adm-contact span.lbl {
  color: var(--c-brand-text);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 18px;
}

.adm-contact a {
  color: var(--c-heading);
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 77, 124, .3);
  word-break: break-word;
}

/* ============================ Мобільне ============================ */
@media (max-width: 640px) {
  .lab-head { padding: 15px 16px 17px; }
  .lh-name { font-size: 20px; }
  .lh-contacts { gap: 8px 18px; }

  .accordion-blog {
    font-size: 15px;
    padding: 13px 14px;
  }
  .panel-blog { padding: 0 14px; }
  .active-blog + .panel-blog { padding: 14px 14px 16px; }

  .dir-card {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
  .dir-photo {
    width: 200px;
    max-width: 60%;
    margin: 0 auto;
  }

  .adm-card {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .adm-photo,
  .adm-placeholder {
    margin: 0 auto;
    width: 160px;
    height: 160px;
  }
  .adm-placeholder { font-size: 42px; }
  .adm-contacts { text-align: left; }
}

/* ==================== Документи PDF у вмісті ======================= */
/* Джерело розмітки — inc/pdf.php (фільтр the_content, пріоритет 9).
   Стара тема малювала тег <pdf> скриптом, який вставляв iframe на
   docs.google.com; тут блок збирається на сервері, а PDF показує сам
   браузер через <object>. */

.iep-pdf {
  margin: 18px 0 24px;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  background: var(--c-surface);
  overflow: hidden;
}

.iep-pdf__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 16px;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-line);
}

.iep-pdf__ic {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--c-danger-bg);
  color: var(--c-danger);
}

.iep-pdf__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 220px;
}

.iep-pdf__name {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--c-heading);
  overflow-wrap: anywhere;
}

.iep-pdf__size { font-size: 12.5px; color: var(--c-muted); }

.iep-pdf__acts { flex: none; display: flex; flex-wrap: wrap; gap: 8px; }
.iep-pdf__acts .btn { text-decoration: none; }

.iep-pdf__view { background: var(--c-surface-3); }

.iep-pdf__obj {
  display: block;
  width: 100%;
  height: 800px;
  border: 0;
}

.iep-pdf__fallback {
  margin: 0;
  padding: 26px 18px;
  text-align: center;
  font-size: 14.5px;
  color: var(--c-ink-soft);
}

/* На вузькому екрані вбудований перегляд не показуємо: мобільні
   браузери все одно малюють у <object> лише перший екран або нічого.
   Лишаються кнопки «Відкрити» і «Завантажити». */
@media (max-width: 767px) {
  .iep-pdf__view { display: none; }
  .iep-pdf__head { border-bottom: 0; }
  .iep-pdf__acts { width: 100%; }
}

/* --------- Звичайні посилання на .pdf у тексті сторінок ----------- */
/* Підкреслення лишається ТІЛЬКИ на тексті посилання: інакше воно
   тягнулося б і під іконку, і під розмір файла. */

a.iep-pdf-link,
.iep-content a.iep-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.iep-pdf-link__ic { flex: none; display: inline-flex; color: var(--c-danger); }
.iep-pdf-link__t { text-decoration: underline; text-underline-offset: 2px; }
.iep-pdf-link:hover .iep-pdf-link__t { color: var(--c-brand-text-strong); }

.iep-pdf-link__size {
  flex: none;
  font-size: 12px;
  color: var(--c-muted);
  white-space: nowrap;
}

/* ===================== Сторінка «Контакти» ========================= */
/* Розмітку збирає page-contacts.php із вмісту сторінки; сам вміст у
   базі не змінювався. */

.iep-contacts {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.iep-contacts__cards { display: grid; gap: 12px; }

.iep-cc {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 17px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  transition: border-color .18s, box-shadow .18s;
}
.iep-cc:hover { border-color: var(--c-line-strong); box-shadow: 0 8px 20px rgba(0, 119, 187, .10); }

.iep-cc__ic {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--c-surface-3);
  color: var(--c-brand-text);
}

.iep-cc__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.iep-cc__label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-muted);
}

.iep-cc__v {
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--c-heading);
  overflow-wrap: anywhere;
  text-decoration: none;
}
a.iep-cc__v { color: var(--c-brand-text); }
a.iep-cc__v:hover { color: var(--c-brand-text-strong); text-decoration: underline; }

.iep-contacts__photo {
  margin: 0;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  overflow: hidden;
}
.iep-contacts__photo img { display: block; width: 100%; height: 100%; object-fit: cover; }

.iep-contacts__rest { margin-top: 18px; }
.iep-map-block { margin-top: 26px; }

/* Адаптивна рамка для мапи та інших врізок з вмісту */
.iep-embed {
  position: relative;
  aspect-ratio: 16 / 7;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--c-surface-3);
}
.iep-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

@media (max-width: 860px) {
  .iep-contacts { grid-template-columns: 1fr; }
  .iep-embed { aspect-ratio: 4 / 3; }
}


/* ============ Картка персони: варіант з фото ліворуч (EN) ============ */
.dir-card__photo { flex: 0 0 280px; max-width: 280px; }
.dir-card__photo img { width: 100%; height: auto; display: block; border-radius: 8px; }
.dir-card__text { flex: 1 1 320px; min-width: 0; }
@media (max-width: 640px) {
  .dir-card__photo { flex: 0 0 100%; max-width: 100%; }
}

/* ================= Блоки-гачки після очищення вмісту =================
   Очищення (scripts/migration/lib/content-fixes.php) прибрало зі вмісту
   рукописні style="border/background/padding" і лишило замість них клас:
     .iep-card   рамка + поля (картка документа, картка лекції);
     .iep-note   виноска з кольоровою рискою ліворуч;
     .iep-badge  мітка-підпис (PDF, «Посилання»);
     .iep-btn    посилання-кнопка.
   Оформлення - тут, одне на весь сайт. */

.iep-card {
  padding: 16px 20px;
  margin: 0 0 12px;
  gap: 12px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  color: var(--c-ink);
}
.iep-card:last-child { margin-bottom: 0; }
/* сусідні картки у flex/grid-обгортці відступ уже мають від gap */
[style*="gap"] > .iep-card { margin-bottom: 0; }
.iep-card > div { gap: 10px 14px; min-width: 0; }
.iep-card :is(h2, h3, h4, h5) {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--c-heading);
}
.iep-card :is(h2, h3, h4, h5):last-child { margin-bottom: 0; }
.iep-card img { border-radius: 10px; }

a.iep-card,
.iep-content a.iep-card {
  text-decoration: none;
  font-weight: 500;
  color: var(--c-heading);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
a.iep-card:hover {
  border-color: var(--c-brand);
  box-shadow: 0 8px 20px rgba(0, 119, 187, .12);
  transform: translateY(-1px);
  color: var(--c-heading);
}
a.iep-card:hover :is(h2, h3, h4, h5) { color: var(--c-brand-text); }

.iep-note {
  padding: 14px 20px;
  margin: 20px 0;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-left: 4px solid var(--c-brand);
  border-radius: 0 10px 10px 0;
}
.iep-note > :first-child { margin-top: 0; }
.iep-note > :last-child { margin-bottom: 0; }
.iep-note :is(h3, h4, h5, h6) { margin: 0 0 6px; }

.iep-badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  align-self: center;
  margin-left: 10px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--c-surface-3);
  color: var(--c-brand-text-strong);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

a.iep-btn,
.iep-content a.iep-btn {
  padding: 10px 20px;
  border-radius: 8px;
  background: var(--c-brand);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background .18s, box-shadow .18s;
}
a.iep-btn:hover { background: var(--c-brand-dark); color: #fff; box-shadow: 0 4px 12px rgba(0, 119, 187, .28); }

/* ============ Кольорові класи блокового редактора ============
   has-*-color / has-*-background-color ядро малює через !important
   (global-styles). Кольори, зашиті в текст запису, сперечаються з
   темою і ламають темну тему («білий текст на білому»), тому тут вони
   зводяться до кольорів теми. Білі розділювачі редактори ставили як
   невидимі відступи - такими вони й лишаються. */
.iep-content :is(p, h1, h2, h3, h4, h5, h6, li, div, span, td, th, a, blockquote).has-text-color { color: inherit !important; }
.iep-content :is(h1, h2, h3, h4, h5, h6).has-text-color { color: var(--c-heading) !important; }
.iep-content .has-cyan-bluish-gray-color { color: var(--c-muted) !important; }
.iep-content .has-vivid-cyan-blue-color,
.iep-content .has-link-color a { color: var(--c-link) !important; }
.iep-content :is(p, div, h1, h2, h3, h4, h5, h6, td, th).has-background { background-color: var(--c-surface-2) !important; }
.iep-content :is(p, h1, h2, h3, h4, h5, h6).has-background { padding: 12px 18px; border-radius: 8px; }
.iep-content .has-white-background-color:not(hr) { background-color: transparent !important; padding: 0; }
.iep-content :is(.has-small-font-size, .has-medium-font-size, .has-large-font-size, .has-x-large-font-size):not(h1, h2, h3, h4, h5, h6) { font-size: inherit !important; }
.iep-content h2[class*="-font-size"] { font-size: clamp(22px, 1.9vw, 27px) !important; }
.iep-content h3[class*="-font-size"] { font-size: clamp(19px, 1.5vw, 22px) !important; }
.iep-content h4[class*="-font-size"] { font-size: 17px !important; }

.iep-content hr.wp-block-separator {
  border: 0;
  border-top: 1px solid var(--c-line);
  background: none !important;
  color: var(--c-line) !important;
  opacity: 1;
  margin: 22px 0;
}
.iep-content hr.wp-block-separator.has-white-background-color,
.iep-content hr.wp-block-separator.has-white-color { border-top-color: transparent; margin: 8px 0; }

/* =========================== Таблиці =============================== */
/* Обгортку .iep-table додає inc/content.php (фільтр the_content). */
.iep-table {
  margin: 18px 0 22px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--c-line);
  border-radius: 10px;
}
.iep-table:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 2px; }
.iep-content figure.wp-block-table { margin: 0; }

.iep-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--c-ink);
  background: var(--c-surface);
}
.iep-content :is(th, td) {
  padding: 9px 13px;
  border: 1px solid var(--c-line);
  text-align: left;
  vertical-align: top;
}
.iep-content :is(th, td).has-text-align-center { text-align: center; }
.iep-content :is(th, td).has-text-align-right { text-align: right; }
.iep-content th,
.iep-content thead td {
  background: var(--c-surface-3);
  color: var(--c-heading);
  font-weight: 600;
}
.iep-content tbody tr:nth-child(even) > td { background: var(--c-surface-2); }
.iep-content td p:last-child { margin-bottom: 0; }
/* «смугаста» таблиця редактора: ядро фарбує рядки в #f0f0f0 - у темній
   темі світлий текст на ній не читається */
.iep-content .wp-block-table.is-style-stripes { border-bottom: 0; }
.iep-content .wp-block-table.is-style-stripes tbody tr:nth-child(odd) { background-color: transparent; }
.iep-content .wp-block-table.is-style-stripes :is(th, td) { border-color: var(--c-line); }

/* рамку малює обгортка - крайні лінії клітинок прибираємо, щоб не двоїлось */
.iep-table > table,
.iep-table > figure > table { margin: 0; }
.iep-table tr > :first-child { border-left: 0; }
.iep-table tr > :last-child { border-right: 0; }
.iep-table tr:first-child > * { border-top: 0; }
.iep-table tbody:last-child > tr:last-child > *,
.iep-table table > tr:last-child > * { border-bottom: 0; }

@media (max-width: 720px) {
  /* вузький екран: таблиця тримає читабельну ширину і гортається вбік */
  .iep-table table { min-width: 560px; font-size: 14px; }
  .iep-table table:has(tr > :nth-child(5)) { min-width: 720px; }
  .iep-table table:not(:has(tr > :nth-child(3))) { min-width: 0; }
}

/* ======================= Відео та врізки =========================== */
.iep-embed--video { aspect-ratio: 16 / 9; max-width: 860px; margin: 18px 0 22px; background: #000; }
.iep-embed--map { margin: 18px 0 22px; }
.iep-content iframe { max-width: 100%; }
.iep-content :is(video, embed) { max-width: 100%; height: auto; }
@media (max-width: 860px) {
  .iep-embed--video { aspect-ratio: 16 / 9; }
}

/* ===================== Зміст довгої сторінки ======================= */
/* Розмітку додає inc/content.php: <details class="iep-toc"> + .iep-toc-main.
   Десктоп - липка колонка праворуч; вузький екран - згорнутий блок. */
.iep-toc-wrap { display: block; }
.iep-toc-main { min-width: 0; }

.iep-toc {
  margin: 0 0 22px;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  background: var(--c-surface-2);
  font-size: 14px;
  line-height: 1.4;
}
.iep-toc__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-heading);
  cursor: pointer;
  list-style: none;
  border-radius: 12px;
}
.iep-toc__title::-webkit-details-marker { display: none; }
.iep-toc__title::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .2s;
}
.iep-toc[open] > .iep-toc__title::after { transform: rotate(-135deg) translate(-2px, -2px); }
.iep-toc__list {
  list-style: none;
  margin: 0;
  padding: 2px 8px 10px;
}
.iep-toc__item { margin: 0; }
.iep-toc__item a,
.iep-content .iep-toc__item a {
  display: block;
  padding: 6px 10px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  color: var(--c-ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.iep-toc__item--3 a { padding-left: 24px; font-size: 13.5px; color: var(--c-ink-soft); }
.iep-toc__item a:hover { background: var(--c-surface-3); color: var(--c-brand-text-strong); }
.iep-toc__item a[aria-current="true"] {
  border-left-color: var(--c-brand);
  background: var(--c-surface-3);
  color: var(--c-brand-text-strong);
  font-weight: 600;
}

/* якір не ховається під липким меню */
.iep-toc-main :is(h2, h3, .accordion-blog)[id] { scroll-margin-top: 72px; }

@media (min-width: 1100px) {
  .iep-toc-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 0 34px;
    align-items: start;
  }
  .iep-toc {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: 68px;                      /* 52px липке меню + відступ */
    max-height: calc(100vh - 88px); /* довгий зміст гортається сам */
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
  }
  .iep-toc-main { grid-column: 1; grid-row: 1; }
  .iep-toc__title { cursor: default; }
  .iep-toc__title::after { display: none; }
}

/* ===================== Ширина тексту ============================== */
/* Текст вмісту займає всю ширину картки сторінки - як просив власник
   (зріз 9). Міра рядка 78ch із зрізу 4b прибрана: вона лишала порожню
   колонку праворуч. Картка сама обмежена --w-page (1440px), а на довгих
   сторінках праворуч стоїть зміст - рядок і так не надто довгий. */

/* ===================== Картинки у вмісті =========================== */
/* Розмітку готує inc/media.php (фільтр вмісту):
     .iep-figure        блок однієї картинки (figure, p, div.wp-block-image
                        або сама img) зі змінними --iw / --ih - ширина й
                        висота показу в px (з атрибутів, менша з width і
                        style="width");
     .iep-figure--left / --right   обтікання (alignleft / alignright);
     .iep-figure--nodim розмір невідомий (зовнішня картинка без width);
     .iep-gallery       кілька картинок поспіль - сітка мініатюр;
     img.iep-zoom       відкривається в перегляді (assets/js/lightbox.js).
   Картки, таблиці, колонки й авторські блоки мають власні стилі -
   inc/media.php їх не позначає. Дрібні картинки (< 300 px: логотипи,
   значки) лишаються в природному розмірі.
   Ширина обчислюється з --iw / --ih ще до завантаження файла - верстка
   не стрибає. !important - бо старі авторські стилі блоків
   (.rn-photo img, .in-full-image img ...) розтягують картинки на 100%. */

/* одиночна: до 60% колонки, до 480 px заввишки, по центру */
.iep-content .iep-figure {
  display: block;
  float: none;
  clear: both;
  width: auto;
  max-width: 100%;
  margin: 8px 0 22px;
  text-align: center;
}
.iep-content .iep-figure :is(figure, div, p, picture) {
  display: block;
  float: none;
  width: auto;
  max-width: 100%;
  margin: 0;
}
.iep-content .iep-figure img,
.iep-content img.iep-figure {
  display: block;
  margin-inline: auto;
  width: min(calc(var(--iw) * 1px), 60%, calc(480px * var(--iw) / var(--ih))) !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: none;
}
.iep-content .iep-figure--nodim img,
.iep-content img.iep-figure--nodim { max-width: 60% !important; max-height: 480px; }
.iep-content .iep-figure figcaption { text-align: center; }

/* обтікання: до 40% колонки, до 360 px заввишки */
.iep-content .iep-figure.iep-figure--left,
.iep-content .iep-figure.iep-figure--right {
  width: min(calc(var(--iw) * 1px), 40%, calc(360px * var(--iw) / var(--ih))) !important;
  clear: none;
}
.iep-content .iep-figure--left { float: left; margin: 4px 24px 14px 0; }
.iep-content .iep-figure--right { float: right; margin: 4px 0 14px 24px; }
.iep-content :is(.iep-figure--left, .iep-figure--right) img { width: 100% !important; }
.iep-content :is(.iep-figure--left, .iep-figure--right).iep-figure--nodim { width: auto !important; max-width: 40%; }

/* кілька поспіль: сітка однакових мініатюр 4 / 3 / 2 колонки */
.iep-content .iep-gallery {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 22px;
  padding: 0;
  clear: both;
  text-align: center;
}
.iep-content .iep-gallery__item,
.iep-content .iep-gallery__item :is(figure, div, p, picture, a) {
  display: block;
  float: none;
  width: auto;
  max-width: none;
  margin: 0;
}
.iep-content .iep-gallery__item img,
.iep-content img.iep-gallery__item {
  display: block;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--c-surface-2);
}
.iep-content .iep-gallery__item figcaption { margin-top: 6px; font-size: 13px; }

/* галереї редактора блоків: та сама сітка замість рядів core-стилів */
.iep-content .wp-block-gallery.has-nested-images {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 8px 0 22px;
}
.iep-content .wp-block-gallery.has-nested-images figure.wp-block-image {
  width: auto !important;
  max-width: none;
  margin: 0 !important;
}
.iep-content .wp-block-gallery.has-nested-images figure.wp-block-image img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
}

/* картинку можна відкрити */
.iep-content img.iep-zoom { cursor: zoom-in; }
.iep-content img.iep-zoom[tabindex]:focus-visible { outline: 3px solid var(--c-brand); outline-offset: 3px; }

@media (max-width: 900px) {
  .iep-content .iep-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .iep-content .iep-figure img,
  .iep-content img.iep-figure { width: min(calc(var(--iw) * 1px), 100%) !important; }
  .iep-content .iep-figure--nodim img,
  .iep-content img.iep-figure--nodim { max-width: 100% !important; }
  .iep-content .iep-figure.iep-figure--left,
  .iep-content .iep-figure.iep-figure--right { float: none; width: auto !important; max-width: 100%; margin: 8px 0 22px; }
  .iep-content :is(.iep-figure--left, .iep-figure--right) img { width: min(calc(var(--iw) * 1px), 100%) !important; }
  .iep-content .iep-gallery,
  .iep-content .wp-block-gallery.has-nested-images { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

/* посилання на тонованих підкладках: темніший відтінок, щоб контраст лишався >= 4.5:1 */
.iep-content :is(.iep-note, .iepor-note, .iepor-callout, .iepor-highlight, .iep-pdf__fallback, .has-background, th) a:not([class]) { color: var(--c-brand-text-strong); }
