/* =====================================================================
   ІМПУЛЬС — стилі ВНУТРІШНІХ сторінок (підключати ПІСЛЯ css/site.css).
   Використовується на: project-example.html, page-template.html,
   team.html, oferta.html і всіх нових сторінках, створених із шаблону.

   Блоки (кожен можна копіювати окремо):
     .page-notice    плашка «це приклад / шаблон» над шапкою сторінки
     .page-hero      темна шапка сторінки: хлібні крихти, мітка, h1, лід,
                     праворуч (або знизу на телефоні) декоративний патерн
     .page-layout    сітка: текст .prose + необов'язкова бічна картка .facts
     .prose          колонка читання: h2/h3, абзаци, списки, .callout,
                     figure, .table-wrap, .prose-gallery, .prose-actions
     .facts          картка «Коротко» (напрям з іконкою, статус, команда)
     .pager          блок «Назад / Далі»
   Фірмовий стиль: без градієнтів і тіней, кути 12–16 px, іконки лише
   темно-сині або білі, помаранчевий текст на білому — лише #C74400.
   ===================================================================== */

/* ---------- Плашка «Приклад / Шаблон» ---------- */
.page-notice {
  background: var(--gray-bg);
  border-bottom: 1px solid var(--line-on-light);
  color: var(--navy);
}
.page-notice__inner {
  display: flex; align-items: flex-start; gap: 12px;
  padding-block: 14px;
  font-size: 15px; line-height: 1.5;
}
.page-notice .icon { margin-top: 0; }
.page-notice strong { font-weight: 800; }

/* ---------- Шапка сторінки ---------- */
.page-hero {
  background: var(--navy);
  color: var(--white);
  padding-block: 40px 56px;
}
@media (min-width: 768px) { .page-hero { padding-block: 56px 72px; } }
@media (min-width: 1024px) { .page-hero { padding-block: 64px 80px; } }

.page-hero__grid { display: grid; gap: 40px; }
@media (min-width: 960px) {
  .page-hero__grid { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 64px; }
}
.page-hero__text > * + * { margin-top: 16px; }
.page-hero__text .label { margin-top: 32px; }
.page-hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.1;
  max-width: 22ch;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.page-hero .lead { color: var(--muted-on-dark); max-width: 60ch; margin-top: 20px; }

/* ОБКЛАДИНКА СТОРІНКИ (.page-hero__art) — три стани:
   1) з фото:   <figure class="page-hero__art page-hero__art--photo"><img …></figure>
   2) патерн:   <div class="page-hero__art" aria-hidden="true"></div>  (декор, без тексту на доріжках)
   3) без блоку: видаліть елемент — шапка сама стане на одну колонку (.page-hero__text:only-child). */
.page-hero__art {
  margin: 0;                                   /* скидаємо відступи <figure> */
  min-height: 112px;                           /* патерн на телефоні: тонка смуга під текстом */
  border-radius: var(--radius);
  background-color: var(--navy);
  background-image: url("../assets/pattern/pattern-tile.svg");
  background-repeat: repeat;
  background-size: 360px auto;
  background-position: 0 0;
  border: 1px solid var(--line-on-dark);
  overflow: hidden;
}
@media (min-width: 960px) {
  .page-hero__grid { align-items: center; }
  .page-hero__art {
    aspect-ratio: 4 / 3;                       /* стабільні пропорції, не залежать від висоти тексту */
    min-height: 0;
    background-size: 420px auto; background-position: -40px -24px;
  }
}

/* Стан 1: фото. Патерн під фото не показуємо (щоб не просвічував під час завантаження). */
.page-hero__art--photo {
  background-image: none;
  aspect-ratio: 16 / 9;                        /* на вужчих екранах: смуга під текстом 16:9 */
  max-height: 220px;                           /* …але на телефоні не вища за 220 px */
  min-height: 0;
  width: 100%;
}
@media (min-width: 600px) { .page-hero__art--photo { max-height: 320px; } }
@media (min-width: 960px) { .page-hero__art--photo { aspect-ratio: 4 / 3; max-height: none; } }
.page-hero__art--photo img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;                           /* фото обрізається, а не розтягується */
  object-position: center;                     /* точку кадрування можна змінити: style="object-position: 50% 30%" */
  color: var(--muted-on-dark);                 /* якщо файл не завантажився — видно alt на темному тлі */
  font-size: 14px; line-height: 1.4;
}

/* Стан 3: блоку обкладинки немає — текст на всю ширину контейнера */
.page-hero__text:only-child { grid-column: 1 / -1; }

/* Хлібні крихти */
.breadcrumbs ol {
  list-style: none;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0;
  font-size: 14px; font-weight: 600; line-height: 1.4;
  color: var(--muted-on-dark);
}
.breadcrumbs li { display: inline-flex; align-items: center; }
.breadcrumbs li + li::before {
  content: ""; flex: none;
  width: 6px; height: 6px; margin-inline: 10px 12px;
  border-top: 2px solid currentColor; border-right: 2px solid currentColor;
  border-radius: 1px;
  transform: rotate(45deg);
  opacity: .7;
}
.breadcrumbs a { color: var(--white); text-decoration: none; }
.breadcrumbs a:hover { color: var(--orange); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumbs [aria-current="page"] { color: var(--muted-on-dark); }

/* ---------- Сітка контенту ---------- */
.page-body { padding-block: 56px 80px; }
@media (min-width: 768px) { .page-body { padding-block: 72px 104px; } }

.page-layout { display: grid; gap: 40px; }
@media (min-width: 1024px) {
  .page-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-areas: "main aside";
    gap: 80px; align-items: start;
  }
  .page-layout > .prose { grid-area: main; }
  .page-layout > .facts { grid-area: aside; position: sticky; top: calc(var(--header-h) + 32px); }
}

/* ---------- Колонка читання ---------- */
.prose { max-width: 760px; min-width: 0; }
.prose > * + * { margin-top: 20px; }
.prose h2 { font-size: clamp(26px, 3.2vw, 34px); margin-top: 56px; }
.prose h3 { font-size: clamp(20px, 2.2vw, 22px); margin-top: 40px; }
.prose h2 + *, .prose h3 + * { margin-top: 16px; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose li { max-width: 68ch; }
.prose a:not(.btn) { color: var(--orange-dark); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:not(.btn):hover { text-decoration-thickness: 2px; }
.prose strong { font-weight: 800; }

/* Маркований список: вузол-кільце, як на доріжці плати */
.prose ul:not([class]) { list-style: none; display: grid; gap: 10px; }
.prose ul:not([class]) > li { position: relative; padding-left: 28px; }
.prose ul:not([class]) > li::before {
  content: ""; position: absolute; left: 2px; top: .58em;
  width: 10px; height: 10px; border: 2px solid var(--navy); border-radius: 50%;
}

/* Нумерований список: номер у кільці */
.prose ol:not([class]) { list-style: none; counter-reset: step; display: grid; gap: 14px; }
.prose ol:not([class]) > li { position: relative; padding-left: 44px; counter-increment: step; min-height: 28px; }
.prose ol:not([class]) > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 2px solid var(--navy); border-radius: 50%;
  font-size: 14px; font-weight: 800; line-height: 1;
}

/* Виноска / порада */
.callout {
  background: var(--gray-bg);
  border-radius: var(--radius);
  padding: 24px;
}
@media (min-width: 768px) { .callout { padding: 28px 32px; } }
.prose .callout { margin-top: 32px; margin-bottom: 8px; }
.callout > * + * { margin-top: 12px; }
.callout .label { display: flex; }
.callout p { max-width: none; }

/* Фото з підписом */
.prose figure, .figure { margin: 32px 0 0; }
.prose figure .ph, .figure .ph { min-height: 0; height: auto; aspect-ratio: 16 / 9; }
.prose figure .photo, .figure .photo { height: auto; aspect-ratio: 16 / 9; }
.prose figcaption, .figure figcaption, .table-caption {
  margin-top: 12px;
  font-size: 14px; line-height: 1.5; color: var(--gray-text);
}

/* Таблиця: на вузьких екранах гортається всередині рамки */
.table-wrap {
  margin-top: 32px;
  overflow-x: auto;
  border: 1px solid var(--line-on-light);
  border-radius: var(--radius);
}
.table-wrap:focus-visible { outline-offset: 2px; }
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px; line-height: 1.5;
}
.table-wrap caption { caption-side: bottom; text-align: left; padding: 12px 16px; border-top: 1px solid var(--line-on-light); font-size: 14px; color: var(--gray-text); }
.table-wrap th, .table-wrap td { padding: 12px 16px; text-align: left; vertical-align: top; }
.table-wrap thead th {
  background: var(--gray-bg);
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gray-text);
}
.table-wrap tbody th { font-weight: 800; }
@media (max-width: 599px) {
  .table-wrap th, .table-wrap td { padding: 10px 10px; overflow-wrap: break-word; }
  .table-wrap th:first-child, .table-wrap td:first-child { padding-left: 14px; }
  .table-wrap tbody th { width: 1%; white-space: nowrap; }
  .table-wrap table { font-size: 14px; }
  .table-wrap thead th { letter-spacing: 0.04em; font-size: 12px; }
}
.table-wrap tbody tr + tr > * { border-top: 1px solid var(--line-on-light); }

/* Маленька галерея: 2 колонки, з модифікатором --3 — три на ширших екранах */
.prose-gallery {
  list-style: none;
  margin-top: 32px;
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
/* три фото на телефоні: перше на всю ширину, щоб не лишалося «сироти» */
.prose-gallery--3 > :first-child { grid-column: span 2; }
.prose-gallery--3 > :first-child .ph, .prose-gallery--3 > :first-child .photo { aspect-ratio: 16 / 9; }
@media (min-width: 768px) {
  .prose-gallery { gap: 16px; }
  .prose-gallery--3 > :first-child { grid-column: auto; }
  .prose-gallery--3 > :first-child .ph, .prose-gallery--3 > :first-child .photo { aspect-ratio: 4 / 3; }
  .prose-gallery--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.prose-gallery .ph { min-height: 0; height: auto; aspect-ratio: 4 / 3; padding: 12px; gap: 8px; }
.prose-gallery .ph svg { width: 32px; height: 32px; }
.prose-gallery .photo { height: auto; aspect-ratio: 4 / 3; }
.prose-gallery + figcaption, .prose-gallery-caption { margin-top: 12px; font-size: 14px; color: var(--gray-text); }

/* Кнопки в кінці тексту */
.prose-actions {
  margin-top: 48px !important;
  padding-top: 32px;
  border-top: 1px solid var(--line-on-light);
}
.prose-actions__title { font-size: 20px; font-weight: 800; line-height: 1.3; }
.prose-actions__buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

/* ---------- Бічна картка «Коротко» ---------- */
.facts {
  border: 1px solid var(--line-on-light);
  border-radius: var(--radius);
  padding: 24px;
}
@media (min-width: 768px) { .facts { padding: 28px; } }
.facts__title {
  font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gray-text);
}
.facts dl { margin: 16px 0 0; display: grid; gap: 0; }
@media (min-width: 600px) and (max-width: 1023px) {
  .facts dl { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; grid-auto-flow: row dense; }
  .facts dl > div:not(.facts__row--tall) { grid-column: 1; }
  /* довгий рядок (напр. список напрямів) — окремою колонкою праворуч */
  .facts__row--tall { grid-column: 2; grid-row: 1 / span 3; }
}
.facts__row { padding-block: 14px; border-top: 1px solid var(--line-on-light); }
.facts dt { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; color: var(--gray-text); }
.facts dd { margin: 6px 0 0; font-weight: 600; line-height: 1.45; }
.facts .tag { font-size: 16px; }
.facts .tag img { width: 28px; height: 28px; }
.facts__dirs { list-style: none; display: grid; gap: 8px; }
.facts__dirs .tag { font-size: 15px; }
.facts__dirs .tag img { width: 24px; height: 24px; }

/* ---------- Назад / Далі ---------- */
.pager { padding-block: 48px; }
@media (min-width: 768px) { .pager { padding-block: 64px; } }
.pager__grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .pager__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
.pager__link {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 24px;
  background: var(--white);
  border: 2px solid transparent;
  border-radius: var(--radius);
  text-decoration: none; color: var(--navy);
  transition: border-color .2s;
}
@media (min-width: 768px) { .pager__link { padding: 24px 32px; } }
.pager__link:hover { border-color: var(--navy); }
.pager__dir {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--orange-dark);
}
.pager__dir .icon { width: 18px; height: 18px; }
.pager__name { font-size: 19px; font-weight: 800; line-height: 1.3; }
@media (min-width: 640px) {
  .pager__link--next { text-align: right; align-items: flex-end; }
  .pager__link--next:only-child { grid-column: 2; }
}

/* ---------- Заповнювачі в шаблоні ---------- */
.placeholder { color: var(--gray-text); font-style: normal; }
.page-hero .placeholder { color: var(--muted-on-dark); }

/* Код у тексті (назви файлів, фрагменти розмітки) */
.prose code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--gray-bg);
  border-radius: 6px;
  padding: .1em .4em;
  overflow-wrap: anywhere;
}
.prose-actions__buttons:first-child { margin-top: 0; }
