:root {
    --color-bg: #ffffff;
    --color-text: #1f2328;
    --color-muted: #5b6470;
    --color-accent: #6b4226;
    --color-border: #e4e0da;

    /* Палітра сайту: спокійні теплі нейтральні тони */
    --color-header: #E4D6C5;
    /* шапка: теплий пісочний, темніший за сторінку */
    --color-page: #F7F2EA;
    /* фон сторінки: м’який кремовий */
    --color-footer-dark: #3B2F27;
    /* смуги підвалу 1 і 3: темна кава */
    --color-footer-light: #4D3F35;
    /* смуга підвалу 2: світліша кава */
    --color-divider: #E0D2BF;
    /* тонкі лінії у випадних меню шапки */
    --color-hover: #EFE5D8;
    /* наведення на пункт випадного меню */
    --color-card: #FFFCF8;
    /* блок вмісту текстової сторінки: теплий слонова кістка */
    --color-card-alt: #F0E6D9;
    /* блок «Зміст» текстової сторінки: світлий пісочний */
    --color-card-border: #CDB9A3;
    /* рамки карток і блоків */
    --card-border-width: 2px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--color-text);
    background: var(--color-page);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

/* Шапка */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-header);
    border-bottom: 1px solid var(--color-border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
    white-space: nowrap;
}

.logo img {
    height: 44px;
    width: auto;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    padding-left: 10px;
    border-left: 2px solid var(--color-text);
}

.logo-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.logo-sub {
    margin-top: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.65;
}

.main-nav>ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.dropdown-menu {
    list-style: none;
    margin: 0;
}

.main-nav>ul>li {
    position: relative;
}

.main-nav>ul>li>a {
    display: block;
    padding: 10px 12px;
    color: var(--color-text);
    font-weight: 500;
}

.main-nav>ul>li>a:hover {
    color: var(--color-accent);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--color-page);
    border: 1px solid var(--color-divider);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(59, 47, 39, 0.12);
    z-index: 10;
    padding: 6px 0;
}

.dropdown.open>.dropdown-menu {
    display: block;
}

@media (hover: hover) {
    .dropdown:hover>.dropdown-menu {
        display: block;
    }
}

/* Кнопка-бургер: видима лише на планшетах/телефонах */
.nav-toggle {
    display: none;
}

/* Планшети/телефони: бургер відкриває панель на всю ширину, розділи розгортаються як акордеон */
@media (max-width: 900px) {
    .header-inner {
        flex-wrap: nowrap;
        position: relative;
    }

    .nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 10px;
        border: var(--card-border-width) solid var(--color-card-border);
        border-radius: 10px;
        background: var(--color-page);
        cursor: pointer;
        /* iOS: без затримки на подвійний дотик для масштабу, без сірого спалаху при дотику */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-toggle span {
        display: block;
        height: 2px;
        border-radius: 2px;
        background: var(--color-text);
        transition: transform 0.25s ease, opacity 0.2s ease;
    }

    /* Коли меню відкрите, бургер перетворюється на хрестик */
    .site-header.nav-open .nav-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .site-header.nav-open .nav-toggle span:nth-child(2) {
        opacity: 0;
    }

    .site-header.nav-open .nav-toggle span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        background: var(--color-header);
        border-top: 1px solid var(--color-divider);
        border-bottom: var(--card-border-width) solid var(--color-card-border);
        box-shadow: 0 14px 24px rgba(59, 47, 39, 0.15);
    }

    .site-header.nav-open .main-nav {
        display: block;
    }

    .main-nav>ul {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0;
        padding: 8px 16px 16px;
    }

    .main-nav>ul>li+li {
        border-top: 1px solid var(--color-divider);
    }

    .main-nav>ul>li>a {
        padding: 14px 4px;
        font-size: 1.05rem;
    }

    /* Підменю відкривається всередині панелі, під назвою свого розділу */
    .dropdown-menu {
        position: static;
        min-width: 0;
        margin: 0 0 12px;
        box-shadow: none;
    }

    .main-nav .dropdown-menu li a {
        padding: 12px 16px;
        white-space: normal;
    }
}

.dropdown-menu li a {
    display: block;
    padding: 8px 16px;
    color: var(--color-text);
    white-space: nowrap;
}

/* Розділювачі між пунктами: короткі лінії з відступом, а не рядки таблиці на всю ширину */
.dropdown-menu li+li {
    position: relative;
}

.dropdown-menu li+li::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    border-top: 1px solid var(--color-divider);
}

.dropdown-menu li a:hover {
    background: var(--color-hover);
    color: var(--color-accent);
}

/* Банер */

.banner img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    display: block;
}

/* Секції */

section {
    padding: 48px 16px;
}

section h2 {
    font-size: 1.6rem;
    margin-bottom: 20px;
    text-align: center;
}

.btn-more {
    display: inline-block;
    margin-top: 12px;
    font-weight: 600;
    border-bottom: 2px solid var(--color-accent);
}

.intro-text {
    color: var(--color-muted);
    line-height: 1.6;
    max-width: 760px;
}

/* Стрічка фото на головній */

.gallery-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 16px 0;
    margin-top: 16px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.gallery-strip img {
    flex: 0 0 auto;
    height: 180px;
    width: auto;
    border-radius: 6px;
    object-fit: cover;
    scroll-snap-align: start;
    cursor: zoom-in;
    transition: transform 0.15s ease;
}

.gallery-strip img:hover {
    transform: scale(1.03);
}

/* Сітка напрямків */

.directions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.direction-card,
.news-card {
    border: var(--card-border-width) solid var(--color-card-border);
    border-radius: 8px;
    padding: 16px;
}

.direction-card img,
.news-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 12px;
}

/* Новини на головній: горизонтальна стрічка з гортанням (останні 5) */

/* .container скидає відступи секції; повертаємо проміжок перед підвалом */
.news.container {
    padding-bottom: 48px;
}

.news-strip {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 0 16px;
    margin-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}

.news-strip .news-card {
    flex: 0 0 300px;
    scroll-snap-align: start;
}

@media (max-width: 640px) {
    .news-strip .news-card {
        flex-basis: 82%;
    }
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 40px;
    color: var(--color-muted);
}

.pagination a {
    font-weight: 600;
    border-bottom: 2px solid var(--color-accent);
}

/* Картки головної: завжди по дві в ряд, на всю ширину сторінки */

.home-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 640px) {
    .home-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Картка: текст фіксованого розміру (4 рядки, далі «...»), посилання закріплене внизу ліворуч */

.home-card {
    display: flex;
    flex-direction: column;
}

.home-card h3 {
    margin: 0 0 8px;
}

.home-card-text {
    margin: 0 0 16px;
    line-height: 1.5;
    min-height: calc(1.5em * 4);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
}

.home-card .btn-more {
    margin-top: auto;
    align-self: flex-start;
}

.albums-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 640px) {
    .albums-grid {
        grid-template-columns: 1fr;
    }
}

.album-card {
    display: block;
    color: var(--color-text);
}

.album-card h3 {
    margin: 0 0 4px;
}

.album-card p {
    color: var(--color-muted);
    margin: 0;
}

/* Сітка фото (окремий альбом) */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

@media (max-width: 640px) {
    .photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}

.photo-grid img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    cursor: zoom-in;
    transition: transform 0.15s ease;
}

.photo-grid img:hover {
    transform: scale(1.03);
}

/* Сітка відео (окремий альбом) */

.video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 640px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

.video-tile video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    background: #000;
}

.video-embed {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-tile--link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    background: var(--color-text);
    color: #fff;
    text-align: center;
    padding: 16px;
}

.video-tile--link:hover {
    background: var(--color-accent);
}

.video-play-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    font-size: 1.1rem;
}

.video-caption {
    margin: 8px 0 0;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.video-tile--link .video-caption {
    color: #fff;
    margin: 0;
}

.album-description {
    margin: 8px 0 0;
    max-width: none;
    text-align: justify;
}

/* Rich-text вміст (CKEditor) на сторінках і в картках */

.rich-text {
    overflow-wrap: anywhere;
}

/* Текст, вставлений з Facebook/Word, приносить власний фон і колір — ігноруємо їх */
.rich-text [style*="color"],
.history-content [style*="color"],
.charter-richtext [style*="color"] {
    background-color: transparent !important;
    color: inherit !important;
}

.rich-text p {
    margin: 0 0 1em;
}

.rich-text p:last-child {
    margin-bottom: 0;
}

.rich-text a {
    text-decoration: underline;
}

.rich-text ul,
.rich-text ol {
    padding-left: 1.4em;
}

.rich-text figure {
    margin: 20px 0;
}

.rich-text figure.table {
    overflow-x: auto;
}

.rich-text figcaption {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.rich-text img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
}

.rich-text iframe,
.rich-text video {
    max-width: 100%;
}

.album-back {
    margin-top: 32px;
}

.news-date {
    color: var(--color-muted);
    font-size: 0.85rem;
    margin: 4px 0;
}

/* Рядок особи (ректорат / викладачі) */

.person-row {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 16px;
}

.person-row:last-child {
    margin-bottom: 0;
}

.person-photo {
    width: 240px;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    flex: 0 0 auto;
}

/* Викладачі: розмір фото (Ректорат зберігає 240x300, задані вище) */
.person-photo--teacher {
    width: 180px;
    height: 225px;
}

.person-info {
    flex: 1 1 320px;
    min-width: 0;
}

.person-info h3 {
    margin: 0 0 4px;
}

.person-info p {
    margin: 0 0 10px;
    font-size: 16px;
    line-height: 1.7;
}

.person-info p:last-child {
    margin-bottom: 0;
}

.rector-text {
    max-width: 1100px;
    margin: 0 auto;
    line-height: 1.7;
}

.rector-text h3 {
    margin-bottom: 4px;
}

/* Розділювач між особами (Ректорат, Викладачі): лінія з ромбом посередині */
.rectorate-member+.rectorate-member,
.person-row+.person-row {
    position: relative;
    margin-top: 64px;
    padding-top: 48px;
    border-top: var(--card-border-width) solid var(--color-card-border);
}

.rectorate-member+.rectorate-member::before,
.person-row+.person-row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 12px;
    height: 12px;
    background: var(--color-page);
    border: var(--card-border-width) solid var(--color-card-border);
    transform: translate(-50%, -50%) rotate(45deg);
}

.history-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: left;
}

.history-content {
    overflow-wrap: anywhere;
}

.history-content iframe,
.history-content video {
    max-width: 100%;
}

.history-content figure.table {
    overflow-x: auto;
}

.history-content figcaption {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.history-content a {
    text-decoration: underline;
}

.history-content a.btn-more {
    text-decoration: none;
}

.history-content p {
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.8;
}

/* Абзаци з вирівнюванням за шириною (Історія, Ректорат, Новини); переноси вирівнюють проміжки між словами (lang="uk") */
.text-justify p {
    text-align: justify;
    hyphens: auto;
}

.history-content figure {
    margin: 35px auto;
    text-align: center;
}

.history-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 12px;
}

.history-content img.news-cover {
    margin-bottom: 28px;
}

@media (max-width: 640px) {
    .person-row {
        flex-direction: column;
    }

    /* Фото стоїть окремо над текстом: центруємо його (Ректорат, Викладачі) */
    .person-row .person-photo {
        align-self: center;
    }

    .person-info {
        flex-basis: auto;
        width: 100%;
    }
}

/* ================================
   Сторінка статуту
   ================================ */
.charter-download {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 30px 0 45px;
}

.charter-download__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 12px 22px;

    border-radius: 8px;

    background: #222;
    color: #fff;

    text-decoration: none;
    font-weight: 600;

    transition: 0.2s ease;
}

.charter-download__button:hover {
    background: #444;
    transform: translateY(-1px);
}

.charter-page {
    padding: 60px 0 100px;
    color: #272727;
}

.charter-page .container {
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
}

/* Шапка */

.charter-header {
    max-width: 850px;
    margin: 0 auto 50px;
    text-align: center;
}

.charter-label {
    display: inline-block;
    margin-bottom: 14px;
    padding: 6px 12px;

    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;

    color: #666;
    background: var(--color-card-alt);
    border-radius: 999px;
}

.charter-header h1 {
    margin: 0 0 18px;

    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.charter-intro {
    max-width: 720px;
    margin: 0 auto;

    font-size: 18px;
    line-height: 1.7;
    color: #6f6f6f;
}

/* Основний макет */

.charter-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 50px;
    align-items: start;
}

/* Навігація */

.charter-navigation {
    position: sticky;
    top: 30px;
}

.navigation-card {
    padding: 24px;
    background: var(--color-card-alt);
    border: var(--card-border-width) solid var(--color-card-border);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

.navigation-card h2 {
    margin: 0 0 18px;

    font-size: 18px;
    line-height: 1.3;
}

.navigation-card nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.navigation-card a {
    display: block;
    padding: 8px 10px;

    color: #5f5f5f;
    text-decoration: none;

    font-size: 14px;
    line-height: 1.5;

    border-radius: 8px;
    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.navigation-card a:hover {
    color: #1f1f1f;
    background: var(--color-card);
}

/* Вміст */

.charter-content {
    min-width: 0;

    padding: clamp(28px, 5vw, 60px);

    background: var(--color-card);
    border: var(--card-border-width) solid var(--color-card-border);
    border-radius: 18px;
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.04);
}

/* Rich-text версія вмісту статуту (редагується в адмінці) */

.charter-layout--single {
    grid-template-columns: minmax(0, 1fr);
}

.charter-richtext h2 {
    margin: 0 0 30px;

    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.25;
    font-weight: 700;
    color: #202020;
    scroll-margin-top: 30px;
}

.charter-richtext h2:not(:first-child) {
    margin-top: 64px;
    padding-top: 55px;
    border-top: 1px solid var(--color-divider);
}

.charter-richtext h3 {
    margin: 36px 0 16px;
    font-size: 21px;
    line-height: 1.35;
    color: #202020;
}

.charter-richtext p {
    margin: 0 0 19px;

    font-size: 17px;
    line-height: 1.85;
    color: #414141;
}

.charter-richtext ul,
.charter-richtext ol {
    margin: -3px 0 24px;
    padding-left: 28px;
}

.charter-richtext li {
    margin-bottom: 12px;

    font-size: 17px;
    line-height: 1.8;
    color: #414141;
}

.charter-richtext a {
    text-decoration: underline;
}

.charter-richtext img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 10px;
}

.charter-richtext figure {
    margin: 24px 0;
}

.charter-richtext figure.table {
    overflow-x: auto;
}

/* ================================
   Планшет
   ================================ */

@media (max-width: 950px) {
    .charter-layout {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .charter-navigation {
        position: static;
    }

    .navigation-card {
        padding: 20px;
    }

    .navigation-card nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .charter-content {
        padding: 40px;
    }
}

/* ================================
   Телефон
   ================================ */

@media (max-width: 600px) {
    .charter-page {
        padding: 35px 0 60px;
    }

    .charter-page .container {
        width: min(100% - 24px, 1200px);
    }

    .charter-header {
        margin-bottom: 30px;
    }

    .charter-header h1 {
        font-size: 30px;
    }

    .charter-intro {
        font-size: 16px;
        line-height: 1.6;
    }

    .navigation-card {
        padding: 18px;
        border-radius: 12px;
    }

    .navigation-card h2 {
        margin-bottom: 14px;
    }

    .navigation-card nav {
        display: flex;
        flex-direction: column;
    }

    .navigation-card a {
        font-size: 14px;
        padding: 9px 8px;
    }

    .charter-content {
        padding: 25px 20px;
        border-radius: 14px;
    }
}


/* Перегляд фото (лайтбокс) */

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 4px;
}

/* Підвал: темний, три смуги (назва + контакти / колонки посилань / копірайт) */

.site-footer {
    --footer-bg: var(--color-footer-dark);
    /* верхня й нижня смуги */
    --footer-bg-middle: var(--color-footer-light);
    /* смуга з колонками посилань */
    --footer-text: #cfc5bb;
    --footer-muted: #b8ab9f;
    --footer-heading: #ffffff;
    --footer-icon-bg: #4d433c;
    --footer-icon-hover: #a8703f;

    background: var(--footer-bg);
    color: var(--footer-text);
    font-size: 0.95rem;
    line-height: 1.5;
}

.site-footer a {
    color: var(--footer-muted);
}

.site-footer a:hover {
    color: var(--footer-heading);
}

/* Верхня смуга */

.footer-top {
    padding: 32px 0;
}

.footer-top-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
    flex-wrap: wrap;
}

.footer-brand {
    max-width: 520px;
}

.footer-brand-name {
    color: var(--footer-heading);
    font-weight: 700;
    font-size: 1.1rem;
}

.footer-brand p {
    margin: 6px 0 0;
    color: var(--footer-muted);
}

/* Контакти рядками «підпис: значення», простим текстом (не клікабельні) */
.footer-contacts {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 16px;
    row-gap: 6px;
    margin: 0;
}

.footer-contacts dt {
    font-weight: 600;
    color: var(--footer-heading);
}

.footer-contacts dd {
    margin: 0;
    min-width: 0;
    /* довгі e-mail / адреса мають переноситися, а не розширювати сторінку */
    overflow-wrap: anywhere;
}

/* Вузькі телефони: підпис над значенням замість двох колонок */
@media (max-width: 400px) {
    .footer-contacts {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 2px;
    }

    .footer-contacts dd {
        margin-bottom: 8px;
    }
}

/* Середня смуга: колонки посилань */

.footer-middle {
    background: var(--footer-bg-middle);
    padding: 32px 0;
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 24px;
}

.footer-col h3 {
    color: var(--footer-heading);
    font-size: 0.95rem;
    margin: 0 0 14px;
}

.footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-col li {
    margin-bottom: 10px;
}

.footer-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-socials a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--footer-icon-bg);
    color: var(--footer-text);
    transition: background 0.15s ease;
}

.footer-socials a:hover {
    background: var(--footer-icon-hover);
}

.footer-socials svg {
    width: 18px;
    height: 18px;
}

/* Нижня смуга */

.footer-bottom {
    padding: 16px 0;
    border-top: 1px solid #3f3731;
}

.footer-copy {
    margin: 0;
    font-size: 0.8rem;
    color: var(--footer-muted);
}

/* ЕКСПЕРИМЕНТ: банер із м’якими, плавними краями (розчиняється у сторінці).
   Щоб прибрати: видаліть цей блок і клас "banner--soft" у home.html. */

.banner--soft img {
    --fade: 3%;
    /* ширина розчинення з кожного краю */

    -webkit-mask-image:
        linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent),
        linear-gradient(to bottom, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
    -webkit-mask-composite: source-in;
    mask-image:
        linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent),
        linear-gradient(to bottom, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
    mask-composite: intersect;
}

/* Дуже довгі слова не мають розширювати сторінку на вузьких телефонах */
h1,
h2,
h3 {
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Основний текст: без переносів, слово розривається лише тоді, коли зовсім не вміщується */
.charter-richtext,
.rich-text,
.history-content {
    overflow-wrap: break-word;
}

@media (max-width: 360px) {
    .charter-header h1 {
        font-size: 28px;
    }

    .charter-richtext h2 {
        font-size: 21px;
    }

    .charter-content {
        padding: 20px 16px;
    }

    .charter-richtext ul,
    .charter-richtext ol {
        padding-left: 20px;
    }
}

/* Сторінки двофакторного входу в адмінку: вхід, налаштування, резервні коди */

.auth-page main {
    width: min(520px, 100% - 32px);
    margin: 48px auto 72px;
    padding: 32px;
    background: var(--color-card);
    border: var(--card-border-width) solid var(--color-card-border);
    border-radius: 18px;
    line-height: 1.6;
}

.auth-page main h1 {
    margin: 0 0 16px;
    font-size: 26px;
}

.auth-page main h2,
.auth-page main h3 {
    margin: 28px 0 8px;
    font-size: 19px;
}

.auth-page main table {
    width: 100%;
    margin: 8px 0 16px;
    border-collapse: collapse;
}

.auth-page main th,
.auth-page main td {
    display: block;
    padding: 0;
    text-align: left;
}

.auth-page main th {
    margin-top: 12px;
    font-weight: 600;
}

.auth-page main input[type="text"],
.auth-page main input[type="password"],
.auth-page main input[type="number"],
.auth-page main input[type="tel"] {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    font: inherit;
    border: 1px solid var(--color-card-border);
    border-radius: 8px;
    background: #fff;
}

.auth-page main .errorlist {
    margin: 8px 0;
    padding: 10px 12px;
    list-style: none;
    color: #8a1f11;
    background: #fbe9e5;
    border-radius: 8px;
}

.auth-page main img {
    display: block;
    max-width: 220px;
    margin: 16px auto;
}

.auth-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.auth-page .btn {
    display: inline-block;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    border: 2px solid var(--color-accent);
    border-radius: 8px;
    cursor: pointer;
}

.auth-page .btn-primary {
    color: #fff;
    background: var(--color-accent);
}

.auth-page .btn-secondary,
.auth-page .btn-info {
    color: var(--color-accent);
    background: transparent;
}

.auth-page .btn-link {
    padding-left: 0;
    padding-right: 0;
    border-color: transparent;
    background: transparent;
}

.auth-page .btn-block {
    display: block;
    width: 100%;
}

.backup-tokens {
    columns: 2;
    padding-left: 20px;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 17px;
}
