:root {
    --primary-color: #A34828; /* Теракотовий */
    --bg-color: #F9F6F0;      /* Теплий білий */
    --text-color: #222426;    /* Темний графіт */
    --accent-color: #0A2540;  /* Глибокий синій */
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Inter', sans-serif;
}

.cursor-pointer { cursor: pointer; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--accent-color);
}

.btn-brand {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    transition: 0.3s;
}

.btn-brand:hover {
    background-color: #8a3c22;
    color: #fff;
}

.text-brand { color: var(--primary-color); }
.bg-brand-dark { background-color: var(--accent-color); }

.museum-card {
    transition: transform 0.3s ease;
    border: none;
    background: #fff;
}
.museum-card:hover { transform: translateY(-5px); }

/* Кастомні стилі для навігації в шапці */
.nav-custom .nav-link {
    color: var(--text-color) !important; /* Примусово робимо текст темним */
    transition: color 0.3s ease;
}

.nav-custom .nav-link:hover,
.nav-custom .nav-link.active {
    color: var(--primary-color) !important; /* При наведенні або активному стані колір стає теракотовим */
}

/* ==========================================
   СТИЛІЗАЦІЯ МОБІЛЬНОГО МЕНЮ (ГАМБУРГЕР)
   ========================================== */

/* 1. Малюємо власну іконку теракотового кольору (%23A34828 - це HEX #A34828 для SVG) */
.navbar-light .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23A34828' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* 2. Колір рамки навколо кнопки */
.navbar-light .navbar-toggler {
    border-color: rgba(163, 72, 40, 0.3) !important; /* Напівпрозора теракотова рамка */
    border-radius: 0.5rem;
}

/* 3. Світіння (фокус) при натисканні на кнопку */
.navbar-light .navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(163, 72, 40, 0.25) !important;
    outline: none;
}

/* ==========================================
   СТИЛІЗАЦІЯ ХЛІБНИХ КРИХТ (BREADCRUMBS)
   ========================================== */
.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
    color: var(--accent-color); /* При наведенні стають темно-синіми */
}

.breadcrumb-item.active {
    color: var(--text-color);
    opacity: 0.7;
}

/* Прибираємо синій колір у розділювачів (слешів) */
.breadcrumb-divider {
    color: var(--text-color);
}

/*main > .container {*/
/*    padding: 70px 15px 20px;*/
/*    display: flex;*/
/*    flex-direction: column;*/
/*    min-height: 100%;*/
/*}*/

.not-set {
    color: var(--bs-danger);
    font-style: italic;
}

/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
    content: '';
    left: 3px;
    display: inline-block;
    width: 0;
    height: 0;
    border: solid 5px transparent;
    margin: 4px 4px 2px 4px;
    background: transparent;
}

a.asc:after {
    border-bottom: solid 7px var(--bs-body-color);
    border-top-width: 0;
}

a.desc:after {
    border-top: solid 7px var(--bs-body-color);
    border-bottom-width: 0;
}

.grid-view th {
    white-space: nowrap;
}

.hint-block {
    display: block;
    margin-top: 5px;
    color: var(--bs-secondary-color);
}

.error-summary {
    color: var(--bs-danger-text-emphasis);
    background: var(--bs-danger-bg-subtle);
    border-left: 3px solid var(--bs-danger-border-subtle);
    padding: 10px 20px;
    margin: 0 0 15px 0;
}

/* align navbar brand baseline with nav links */
.navbar > .container,
.navbar > .container-fluid {
    align-items: baseline;
}

/* style navbar logout link color, hover state, and mobile layout */
.navbar-nav .nav-link.logout {
    color: var(--bs-navbar-color);
}

@media (max-width: 767.98px) {
    .navbar-nav .nav-link.logout {
        display: block;
        text-align: left;
        width: 100%;
        padding: 10px 0;
    }
}

.navbar-nav .nav-link.logout:focus,
.navbar-nav .nav-link.logout:hover {
    color: var(--bs-navbar-hover-color);
}



/* footer logo: light logo by default (light bg-body-tertiary), dark logo for dark theme */
.footer-logo-dark { display: none; }

[data-bs-theme="dark"] .footer-logo-light { display: none; }
[data-bs-theme="dark"] .footer-logo-dark  { display: inline-block; }

/* Yii brand button */
.btn-yii {
    background: linear-gradient(135deg, #40B3D8, #3a9cbd);
    border: none;
    font-weight: 600;
    letter-spacing: .02em;
    transition: opacity .2s, transform .1s;
}

.btn-yii:hover {
    opacity: .9;
    transform: translateY(-1px);
}

.btn-yii:active {
    transform: translateY(0);
}

/* form inputs: seamless icon inside input (Volt style) */
.form-card .input-group {
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.form-card .input-group .input-group-text {
    background: var(--bs-body-bg);
    border: 0;
    padding-left: 1rem;
    padding-right: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-card .input-group .form-control {
    border: 0;
}

.form-card .input-group .form-control:focus {
    box-shadow: none;
}

.form-card .input-group:focus-within {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}

/* validation styles for browsers that support :has() */
@supports selector(.input-group:has(.is-invalid)) {
    .form-card .input-group:has(.is-invalid) ~ .invalid-feedback {
        display: block;
        margin-top: .35rem;
        margin-bottom: .5rem;
    }

    .form-card .input-group:has(.is-invalid) {
        border-color: var(--bs-danger);
    }

    .form-card .input-group:has(.is-invalid):focus-within {
        box-shadow: 0 0 0 .25rem rgba(var(--bs-danger-rgb), .25);
    }
}

/* fallback validation styles for browsers without :has() support */
@supports not selector(.input-group:has(.is-invalid)) {
    .form-card .invalid-feedback:not(:empty) {
        display: block;
        margin-top: .35rem;
        margin-bottom: .5rem;
    }

    .form-card .input-group .form-control.is-invalid {
        border: var(--bs-border-width) solid var(--bs-danger);
    }

    .form-card .input-group .form-control.is-invalid:focus {
        box-shadow: 0 0 0 .25rem rgba(var(--bs-danger-rgb), .25);
    }
}

/* login inputs: seamless icon inside input (Volt style) */
.login-split-card .input-group {
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.login-split-card .input-group .input-group-text {
    background: transparent;
    border: 0;
    padding-left: 1rem;
    padding-right: .75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-split-card .input-group .form-control {
    border: 0;
    background: transparent;
}

.login-split-card .input-group .form-control:focus {
    box-shadow: none;
}

.login-split-card .input-group:focus-within {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}

/* validation styles for login split card (browsers with :has()) */
@supports selector(.input-group:has(.is-invalid)) {
    .login-split-card .input-group:has(.is-invalid) ~ .invalid-feedback {
        display: block;
        margin-top: .35rem;
        margin-bottom: .5rem;
    }

    .login-split-card .input-group:has(.is-invalid) {
        border-color: var(--bs-danger);
    }

    .login-split-card .input-group:has(.is-invalid):focus-within {
        box-shadow: 0 0 0 .25rem rgba(var(--bs-danger-rgb), .25);
    }
}

/* fallback validation styles for login split card (browsers without :has()) */
@supports not selector(.input-group:has(.is-invalid)) {
    .login-split-card .invalid-feedback:not(:empty) {
        display: block;
        margin-top: .35rem;
        margin-bottom: .5rem;
    }

    .login-split-card .input-group .form-control.is-invalid {
        border: var(--bs-border-width) solid var(--bs-danger);
    }

    .login-split-card .input-group .form-control.is-invalid:focus {
        box-shadow: 0 0 0 .25rem rgba(var(--bs-danger-rgb), .25);
    }
}

/* login split card */
.login-split-card {
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .10);
    background-color: var(--bs-gray-100);
    width: 100%;
    max-width: 900px;
}

.login-split-card-wide {
    max-width: 960px;
}

.login-brand-title {
    font-size: 1.75rem;
    line-height: 1.3;
}

.login-brand-text {
    font-size: .9rem;
}

.login-brand-panel {
    background: linear-gradient(135deg, #40B3D8 0%, #3a9cbd 40%, #83C933 100%);
    position: relative;
    min-height: 480px;
}

.login-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(241, 138, 42, .25) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(131, 201, 51, .2) 0%, transparent 40%);
    pointer-events: none;
}

.login-btn {
    background: linear-gradient(135deg, #40B3D8, #3a9cbd);
    border: none;
    font-weight: 600;
    letter-spacing: .02em;
    transition: opacity .2s, transform .1s;
}

.login-btn:hover {
    opacity: .9;
    transform: translateY(-1px);
}

.login-btn:active {
    transform: translateY(0);
}

/* dark mode login card */
[data-bs-theme="dark"] .login-split-card {
    background-color: var(--bs-body-bg);
    box-shadow: 0 0 0 1px var(--bs-border-color), 0 4px 24px rgba(0, 0, 0, .4);
}

[data-bs-theme="dark"] .login-mobile-logo {
    filter: invert(1);
}

/* contact form textarea height */
.site-contact textarea.form-control {
    height: 140px;
}

/* form cards */
.form-card {
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .10);
}

/* dark mode: elevate form cards against dark background */
[data-bs-theme="dark"] .form-card {
    box-shadow: 0 0 0 1px var(--bs-border-color), 0 4px 24px rgba(0, 0, 0, .4);
}

/* captcha: blend with card background
.site-contact img[src*="captcha"] {
    border-radius: var(--bs-border-radius);
    mix-blend-mode: multiply;
}
 */

/* dark mode: invert captcha for visibility on dark background
[data-bs-theme="dark"] .site-contact img[src*="captcha"] {
    mix-blend-mode: screen;
    filter: invert(1) hue-rotate(180deg);
}
*/
/* centered page layout */
.site-login,
.site-signup,
.site-contact,
.site-request-password-reset,
.site-reset-password,
.site-resend-verification-email,
.site-index,
.site-error,
.site-about {
    flex: 1;
}

.site-error .site-error-content,
.site-about .site-about-content {
    width: 100%;
    max-width: 90%;
}

@media (min-width: 576px) {
    .site-error .site-error-content,
    .site-about .site-about-content {
        max-width: 80%;
    }
}

@media (min-width: 768px) {
    .site-error .site-error-content,
    .site-about .site-about-content {
        max-width: 60%;
    }
}

@media (min-width: 992px) {
    .site-error .site-error-content,
    .site-about .site-about-content {
        max-width: 50%;
    }
}

/* hero banner */
.hero-banner {
    background: linear-gradient(135deg, #83C933 0%, #3a9cbd 40%, #40B3D8 100%);
    position: relative;
}

.hero-lead {
    max-width: 520px;
}

.hero-logo {
    height: 120px;
    opacity: .45;
    right: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.hero-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at 15% 85%, rgba(241, 138, 42, .3) 0%, transparent 45%),
        radial-gradient(circle at 85% 15%, rgba(131, 201, 51, .25) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(64, 179, 216, .15) 0%, transparent 60%);
    pointer-events: none;
}

/* extension cards */
.extension-card {
    transition: transform .15s ease-in-out, box-shadow .15s ease-in-out;
}

.extension-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12) !important;
}

.extension-icon {
    font-size: 1.5rem;
    line-height: 1;
}

/* dark mode: extension cards */
[data-bs-theme="dark"] .extension-card {
    background-color: var(--bs-body-bg);
    box-shadow: 0 0 0 1px var(--bs-border-color), 0 2px 8px rgba(0, 0, 0, .3);
}

[data-bs-theme="dark"] .extension-card:hover {
    box-shadow: 0 0 0 1px var(--bs-border-color), 0 8px 24px rgba(0, 0, 0, .4) !important;
}

.btn-outline-brand {
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    background-color: transparent;
    transition: all 0.3s ease;
}

.btn-outline-brand:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* ==========================================
   РЕФАКТОРИНГ ГОЛОВНОЇ СТОРІНКИ (INDEX)
   ========================================== */

/* Hero Section */
.hero-cover-img {
    object-fit: cover;
    max-height: 550px;
}
.hero-lead-text {
    max-width: 800px;
    opacity: 0.85;
}

/* Картки та зображення */
.card-img-fixed {
    height: 220px;
    object-fit: cover;
}
.news-card-tall {
    height: 420px;
}
.line-clamp-2 {
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Кольори (перевизначення інлайн) */
.text-accent-brand { color: var(--accent-color); }
.bg-accent-brand { background-color: var(--accent-color); }

/* Блок Digital Museum (Гранти) */
.promo-dm-bg {
    height: 220px;
    background: url('/media/pano/dm_v001/preview.jpg') center/cover no-repeat;
    background-color: #1a202c;
}
.promo-dm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
}
.promo-text {
    line-height: 1.6;
    max-width: 90%;
}
.pointer-events-none {
    pointer-events: none;
}

/* 3D Оглядач кругла форма */
.model-viewer-container {
    width: 350px;
    height: 350px;
}

/* Інклюзивність: Фокус для клавіатурної навігації (WCAG) */
.museum-card-link:focus .museum-card,
.btn:focus,
a:focus,
model-viewer:focus {
    outline: 3px solid var(--primary-color) !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(163, 72, 40, 0.25);
}

/* ==========================================
   СТИЛІЗАЦІЯ ФОРМИ КОНТАКТІВ
   ========================================== */
.site-contact .input-group-text {
    border-radius: 0.5rem 0 0 0.5rem;
}
.site-contact .form-control {
    border-radius: 0 0.5rem 0.5rem 0;
}
.site-contact .form-control:focus {
    box-shadow: none;
    border-color: var(--primary-color);
}
.site-contact .input-group:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(163, 72, 40, 0.25) !important;
}
.site-contact textarea.form-control {
    border-radius: 0.5rem;
}
.captcha-wrapper input {
    max-width: 150px;
}

/* ==========================================
   СТИЛІЗАЦІЯ FLASH-ПОВІДОМЛЕНЬ (ALERT)
   ========================================== */
.alert-success {
    background-color: #d1e7dd !important; /* Світло-зелений фон */
    color: #0f5132 !important;            /* Темно-зелений текст */
    border-color: #badbcc !important;       /* Зелена рамка */
}

/* Якщо виводяться помилки при відправці (не валідації полів, а загальні) */
.alert-danger {
    background-color: #f8d7da !important;
    color: #842029 !important;
    border-color: #f5c2c7 !important;
}

/* ==========================================
   МОДУЛЬ ЕКСПОНАТІВ (КАТАЛОГ ТА ПАСПОРТ)
   ========================================== */

/* Пагінація (Адаптована під бренд) */
.pagination .page-link {
    color: var(--text-color);
    font-weight: 500;
}
.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}
.pagination .page-link:hover {
    color: var(--primary-color);
    background-color: #f8f9fa;
}

/* Картки в каталозі */
.exhibit-card-img-wrap {
    height: 250px;
    overflow: hidden;
    background-color: #f8f9fa;
}
.exhibit-card-img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Детальна сторінка (view.php) */
.exhibit-media-container {
    min-height: 500px;
    background-color: #f8f9fa;
}
.exhibit-main-img {
    object-fit: contain;
    max-height: 600px;
    cursor: zoom-in;
}
.exhibit-3d-placeholder {
    width: 100%;
    height: 500px;
}
.gallery-thumb-wrapper {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    cursor: pointer;
    transition: border-color 0.2s;
}
.gallery-thumb {
    object-fit: cover;
}
.exhibit-description {
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-color);
}
.passport-list li {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}
.passport-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
/* Логотип УКФ на сторінці Digital Museum */
.ukf-logo-horizontal {
    max-height: 100px;
    object-fit: contain;
}
.partner-logo {
    max-height: 55px;
    object-fit: contain;
}
.museum-card-img {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

/* ==========================================
   ПАНЕЛЬ ДОСТУПНОСТІ (WCAG)
   ========================================== */

/* 1. Контрастність */
body.a11y-monochrome {
    filter: grayscale(100%);
}
body.a11y-invert {
    filter: invert(100%);
    background-color: #111;
}
/* Спеціальний режим "Жовтий на чорному" */
body.a11y-yellow-black,
body.a11y-yellow-black * {
    background-color: #000 !important;
    color: #ffcc00 !important;
    border-color: #ffcc00 !important;
}

/* 2. Масштабування шрифтів до 200% */
body.a11y-font-150 { font-size: 150% !important; }
body.a11y-font-200 { font-size: 200% !important; }

/* 3. Зміна міжлітерного та міжрядкового інтервалу */
body.a11y-spacing * {
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
    line-height: 2 !important;
}

/* 4. Вимкнення анімацій */
body.a11y-no-animations * {
    transition: none !important;
    animation: none !important;
}

/* 5. Підсвічування посилань та фокус курсора */
body.a11y-highlight-links a {
    text-decoration: underline !important;
    text-decoration-thickness: 3px !important;
    font-weight: bold !important;
    background-color: #ffcc00 !important;
    color: #000 !important;
}

/* ==========================================
   АНІМОВАНЕ МЕНЮ "ГАМБУРГЕР" З ТЕКСТОМ
   ========================================== */

.animated-hamburger {
    width: 26px;
    height: 18px;
    position: relative;
    transform: rotate(0deg);
    transition: .5s ease-in-out;
    cursor: pointer;
}

/* Малюємо три смужки теракотовим кольором */
.animated-hamburger span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: .25s ease-in-out;
}

/* Позиціонуємо смужки по висоті */
.animated-hamburger span:nth-child(1) { top: 0px; }
.animated-hamburger span:nth-child(2) { top: 7px; }
.animated-hamburger span:nth-child(3) { top: 14px; }

/*
   Анімація ПРИ ВІДКРИТОМУ меню
   (Bootstrap автоматично змінює aria-expanded на true)
*/
.navbar-toggler[aria-expanded="true"] .animated-hamburger span:nth-child(1) {
    top: 7px;
    transform: rotate(135deg);
}

.navbar-toggler[aria-expanded="true"] .animated-hamburger span:nth-child(2) {
    opacity: 0;
    left: -20px; /* Виїжджає вліво і зникає */
}

.navbar-toggler[aria-expanded="true"] .animated-hamburger span:nth-child(3) {
    top: 7px;
    transform: rotate(-135deg);
}

/* Стилізація списку відділів */
.department-block {
    background-color: #ffffff;
    border-color: #e9ecef !important;
}

/* Заголовок у закритому стані */
.department-block summary {
    color: var(--primary-color, #A34828) !important;
    list-style-position: inside;
    outline: none;
    user-select: none;
}

.department-block summary:hover {
    color: var(--accent-color, #0A2540) !important;
}

/* Коли блок відкривається кліком */
.department-block[open] summary {
    margin-bottom: 0.75rem !important;
    border-bottom: 1px dashed #dee2e6;
    padding-bottom: 0.5rem;
}

/* Заголовок у відкритому стані */
.department-block[open] summary {
    color: var(--accent-color, #0A2540) !important;
}

/* ==========================================
   СТИЛІЗАЦІЯ ВИПАДАЮЧОГО МЕНЮ (DROPDOWN)
   ========================================== */

/* 1. Світлий фон для випадаючого меню замість чорного */
.navbar .dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #dee2e6;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* 2. Звичайний колір тексту для пунктів меню */
.navbar .dropdown-item {
    color: var(--text-color, #222426) !important;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* 3. Зміна кольору при наведенні (Hover) */
.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
    background-color: #f8f9fa !important;
    color: var(--primary-color, #A34828) !important;
}

/* 4. Заміна стандартного синього кольору для активної сторінки на теракотовий */
.navbar .dropdown-item.active,
.navbar .dropdown-item:active {
    background-color: var(--primary-color, #A34828) !important;
    color: #ffffff !important;
}

/* 5. Примусове скасування кольору "muted" для заголовків */
.navbar .dropdown-header {
    color: var(--primary-color, #A34828) !important;
    font-size: 1.1rem !important; /* Збільшений розмір */
    font-weight: 700 !important;
    opacity: 1 !important; /* Прибираємо системну напівпрозорість */
}

/* ==========================================
   BOOTSTRAP 3 / MODERN UI UTILITY COMPATIBILITY LAYER
   ========================================== */

/* 1. Flexbox Utilities */
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-row-reverse { flex-direction: row-reverse !important; }
.flex-column-reverse { flex-direction: column-reverse !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-wrap-reverse { flex-wrap: wrap-reverse !important; }
.flex-grow-0 { flex-grow: 0 !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.flex-shrink-1 { flex-shrink: 1 !important; }

.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }
.justify-content-evenly { justify-content: space-evenly !important; }

.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-baseline { align-items: baseline !important; }
.align-items-stretch { align-items: stretch !important; }

.align-self-auto { align-self: auto !important; }
.align-self-start { align-self: flex-start !important; }
.align-self-end { align-self: flex-end !important; }
.align-self-center { align-self: center !important; }
.align-self-baseline { align-self: baseline !important; }
.align-self-stretch { align-self: stretch !important; }

/* 2. Gap & Modern Grid */
.gap-0 { gap: 0 !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

.row.row-cols-1,
.row.row-cols-md-2,
.row.row-cols-lg-3,
.row.row-cols-lg-4,
.row.g-1, .row.g-2, .row.g-3, .row.g-4, .row.g-5 {
    display: flex;
    flex-wrap: wrap;
}

.row.g-1 { margin-right: -0.25rem; margin-left: -0.25rem; }
.row.g-1 > * { padding-right: 0.25rem; padding-left: 0.25rem; margin-bottom: 0.5rem; }
.row.g-2 { margin-right: -0.5rem; margin-left: -0.5rem; }
.row.g-2 > * { padding-right: 0.5rem; padding-left: 0.5rem; margin-bottom: 1rem; }
.row.g-3 { margin-right: -0.75rem; margin-left: -0.75rem; }
.row.g-3 > * { padding-right: 0.75rem; padding-left: 0.75rem; margin-bottom: 1rem; }
.row.g-4 { margin-right: -1rem; margin-left: -1rem; }
.row.g-4 > * { padding-right: 1rem; padding-left: 1rem; margin-bottom: 1.5rem; }
.row.g-5 { margin-right: -1.5rem; margin-left: -1.5rem; }
.row.g-5 > * { padding-right: 1.5rem; padding-left: 1.5rem; margin-bottom: 2rem; }

.col {
    flex: 1 0 0%;
    max-width: 100%;
}
.row-cols-1 > * {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
}
@media (min-width: 768px) {
    .row-cols-md-2 > * {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
    }
    .row-cols-md-3 > * {
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
        width: 33.333333% !important;
    }
}
@media (min-width: 992px) {
    .row-cols-lg-3 > * {
        flex: 0 0 33.333333% !important;
        max-width: 33.333333% !important;
        width: 33.333333% !important;
    }
    .row-cols-lg-4 > * {
        flex: 0 0 25% !important;
        max-width: 25% !important;
        width: 25% !important;
    }
}

/* 3. Spacing (BS5 ms/me/ps/pe/p/m) */
.m-0 { margin: 0 !important; }
.m-1 { margin: 0.25rem !important; }
.m-2 { margin: 0.5rem !important; }
.m-3 { margin: 1rem !important; }
.m-4 { margin: 1.5rem !important; }
.m-5 { margin: 3rem !important; }
.m-auto { margin: auto !important; }

.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.my-1 { margin-top: 0.25rem !important; margin-bottom: 0.25rem !important; }
.my-2 { margin-top: 0.5rem !important; margin-bottom: 0.5rem !important; }
.my-3 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
.my-4 { margin-top: 1.5rem !important; margin-bottom: 1.5rem !important; }
.my-5 { margin-top: 3rem !important; margin-bottom: 3rem !important; }
.my-auto { margin-top: auto !important; margin-bottom: auto !important; }

.mx-0 { margin-left: 0 !important; margin-right: 0 !important; }
.mx-1 { margin-left: 0.25rem !important; margin-right: 0.25rem !important; }
.mx-2 { margin-left: 0.5rem !important; margin-right: 0.5rem !important; }
.mx-3 { margin-left: 1rem !important; margin-right: 1rem !important; }
.mx-4 { margin-left: 1.5rem !important; margin-right: 1.5rem !important; }
.mx-5 { margin-left: 3rem !important; margin-right: 3rem !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mt-auto { margin-top: auto !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.mb-auto { margin-bottom: auto !important; }

.ms-0, .ml-0 { margin-left: 0 !important; }
.ms-1, .ml-1 { margin-left: 0.25rem !important; }
.ms-2, .ml-2 { margin-left: 0.5rem !important; }
.ms-3, .ml-3 { margin-left: 1rem !important; }
.ms-4, .ml-4 { margin-left: 1.5rem !important; }
.ms-5, .ml-5 { margin-left: 3rem !important; }
.ms-auto, .ml-auto { margin-left: auto !important; }

.me-0, .mr-0 { margin-right: 0 !important; }
.me-1, .mr-1 { margin-right: 0.25rem !important; }
.me-2, .mr-2 { margin-right: 0.5rem !important; }
.me-3, .mr-3 { margin-right: 1rem !important; }
.me-4, .mr-4 { margin-right: 1.5rem !important; }
.me-5, .mr-5 { margin-right: 3rem !important; }
.me-auto, .mr-auto { margin-right: auto !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 3rem !important; }

.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-1 { padding-left: 0.25rem !important; padding-right: 0.25rem !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.px-5 { padding-left: 3rem !important; padding-right: 3rem !important; }

.pt-0 { padding-top: 0 !important; }
.pt-1 { padding-top: 0.25rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 1rem !important; }
.pt-4 { padding-top: 1.5rem !important; }
.pt-5 { padding-top: 3rem !important; }

.pb-0 { padding-bottom: 0 !important; }
.pb-1 { padding-bottom: 0.25rem !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pb-3 { padding-bottom: 1rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }
.pb-5 { padding-bottom: 3rem !important; }

.ps-0, .pl-0 { padding-left: 0 !important; }
.ps-1, .pl-1 { padding-left: 0.25rem !important; }
.ps-2, .pl-2 { padding-left: 0.5rem !important; }
.ps-3, .pl-3 { padding-left: 1rem !important; }
.ps-4, .pl-4 { padding-left: 1.5rem !important; }
.ps-5, .pl-5 { padding-left: 3rem !important; }

.pe-0, .pr-0 { padding-right: 0 !important; }
.pe-1, .pr-1 { padding-right: 0.25rem !important; }
.pe-2, .pr-2 { padding-right: 0.5rem !important; }
.pe-3, .pr-3 { padding-right: 1rem !important; }
.pe-4, .pr-4 { padding-right: 1.5rem !important; }
.pe-5, .pr-5 { padding-right: 3rem !important; }

/* 4. Sizing & Positioning */
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }
.mw-100 { max-width: 100% !important; }

.h-25 { height: 25% !important; }
.h-50 { height: 50% !important; }
.h-75 { height: 75% !important; }
.h-100 { height: 100% !important; }
.h-auto { height: auto !important; }
.mh-100 { max-height: 100% !important; }

.position-static { position: static !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.position-sticky { position: sticky !important; }

.top-0 { top: 0 !important; }
.bottom-0 { bottom: 0 !important; }
.start-0 { left: 0 !important; }
.end-0 { right: 0 !important; }

.z-0 { z-index: 0 !important; }
.z-1 { z-index: 1 !important; }
.z-2 { z-index: 2 !important; }
.z-3 { z-index: 3 !important; }

.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }

/* 5. Typography & Font Helpers */
.fw-bold { font-weight: 700 !important; }
.fw-bolder { font-weight: bolder !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-normal { font-weight: 400 !important; }
.fw-light { font-weight: 300 !important; }
.fw-lighter { font-weight: lighter !important; }

.fst-italic { font-style: italic !important; }
.fst-normal { font-style: normal !important; }

.fs-1 { font-size: 2.5rem !important; }
.fs-2 { font-size: 2rem !important; }
.fs-3 { font-size: 1.75rem !important; }
.fs-4 { font-size: 1.5rem !important; }
.fs-5 { font-size: 1.25rem !important; }
.fs-6 { font-size: 1rem !important; }

.display-1 { font-size: calc(1.625rem + 4.5vw); font-weight: 300; line-height: 1.2; }
.display-2 { font-size: calc(1.575rem + 3.9vw); font-weight: 300; line-height: 1.2; }
.display-3 { font-size: calc(1.525rem + 3.3vw); font-weight: 300; line-height: 1.2; }
.display-4 { font-size: calc(1.475rem + 2.7vw); font-weight: 300; line-height: 1.2; }
.display-5 { font-size: calc(1.425rem + 2.1vw); font-weight: 300; line-height: 1.2; }
.display-6 { font-size: calc(1.375rem + 1.5vw); font-weight: 300; line-height: 1.2; }

.text-start { text-align: left !important; }
.text-end { text-align: right !important; }
.text-decoration-none { text-decoration: none !important; }
.text-decoration-none:hover { text-decoration: none !important; }

.text-body { color: #212529 !important; }
.text-dark { color: #212529 !important; }
.text-white { color: #ffffff !important; }
.text-muted { color: #6c757d !important; }
.text-secondary { color: #6c757d !important; }
.text-success { color: #198754 !important; }
.text-danger { color: #dc3545 !important; }
.text-warning { color: #ffc107 !important; }
.text-info { color: #0dcaf0 !important; }
.text-primary { color: #0d6efd !important; }

.lh-1 { line-height: 1 !important; }
.lh-sm { line-height: 1.25 !important; }
.lh-base { line-height: 1.5 !important; }
.lh-lg { line-height: 1.75 !important; }

.opacity-25 { opacity: 0.25 !important; }
.opacity-50 { opacity: 0.5 !important; }
.opacity-75 { opacity: 0.75 !important; }
.opacity-100 { opacity: 1 !important; }

/* 6. Borders & Radii */
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid #dee2e6 !important; }
.border-bottom { border-bottom: 1px solid #dee2e6 !important; }
.border-start { border-left: 1px solid #dee2e6 !important; }
.border-end { border-right: 1px solid #dee2e6 !important; }
.border-primary { border-color: #0d6efd !important; }
.border-secondary { border-color: #6c757d !important; }
.border-light { border-color: #f8f9fa !important; }
.border-dark { border-color: #212529 !important; }
.border-2 { border-width: 2px !important; }
.border-3 { border-width: 3px !important; }

.rounded-0 { border-radius: 0 !important; }
.rounded-1 { border-radius: 0.2rem !important; }
.rounded-2 { border-radius: 0.25rem !important; }
.rounded-3 { border-radius: 0.5rem !important; }
.rounded-4 { border-radius: 1rem !important; }
.rounded-5 { border-radius: 2rem !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: 50rem !important; }

/* 7. Badges */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}
.badge.bg-primary { background-color: #0d6efd !important; color: #fff !important; }
.badge.bg-secondary { background-color: #6c757d !important; color: #fff !important; }
.badge.bg-success { background-color: #198754 !important; color: #fff !important; }
.badge.bg-danger { background-color: #dc3545 !important; color: #fff !important; }
.badge.bg-warning { background-color: #ffc107 !important; color: #000 !important; }
.badge.bg-info { background-color: #0dcaf0 !important; color: #000 !important; }
.badge.bg-light { background-color: #f8f9fa !important; color: #000 !important; }
.badge.bg-dark { background-color: #212529 !important; color: #fff !important; }

.bg-white { background-color: #ffffff !important; }
.bg-light { background-color: #f8f9fa !important; }
.bg-dark { background-color: #212529 !important; }

/* 8. Cards */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid rgba(0,0,0,.125);
    border-radius: 0.25rem;
}
.card-body {
    flex: 1 1 auto;
    padding: 1.25rem;
}
.card-header {
    padding: 0.75rem 1.25rem;
    margin-bottom: 0;
    background-color: rgba(0,0,0,.03);
    border-bottom: 1px solid rgba(0,0,0,.125);
}
.card-footer {
    padding: 0.75rem 1.25rem;
    background-color: rgba(0,0,0,.03);
    border-top: 1px solid rgba(0,0,0,.125);
}
.card-title {
    margin-bottom: 0.75rem;
}
.card-img, .card-img-top, .card-img-bottom {
    width: 100%;
}
.card-img-top {
    border-top-left-radius: calc(0.25rem - 1px);
    border-top-right-radius: calc(0.25rem - 1px);
}

/* 9. Shadows */
.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; }
.shadow { box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; }
.shadow-lg { box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important; }

/* 10. Ratio Embeds (16x9 / 4x3 / 1x1 / 21x9) */
.ratio {
    position: relative;
    width: 100%;
}
.ratio::before {
    display: block;
    padding-top: var(--bs-aspect-ratio, 56.25%);
    content: "";
}
.ratio > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.ratio-16x9 { --bs-aspect-ratio: 56.25%; }
.ratio-4x3 { --bs-aspect-ratio: 75%; }
.ratio-1x1 { --bs-aspect-ratio: 100%; }
.ratio-21x9 { --bs-aspect-ratio: 42.85714286%; }

/* 11. Modal & Close Button */
.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em 0.25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: 0;
    border-radius: 0.25rem;
    opacity: 0.6;
    cursor: pointer;
}
.btn-close:hover { opacity: 0.9; }
.btn-close-white { filter: invert(1) grayscale(100%) brightness(200%); }

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
    margin: 1.75rem auto;
}

/* 12. Button Outlines */
.btn-outline-brand {
    color: var(--primary-color, #A34828);
    border: 2px solid var(--primary-color, #A34828);
    background-color: transparent;
    transition: 0.3s ease;
}
.btn-outline-brand:hover,
.btn-outline-brand:focus,
.btn-outline-brand.active {
    background-color: var(--primary-color, #A34828);
    color: #ffffff;
    border-color: var(--primary-color, #A34828);
}

.btn-outline-dark {
    color: #212529;
    border: 1px solid #212529;
    background-color: transparent;
    transition: 0.3s ease;
}
.btn-outline-dark:hover {
    color: #ffffff;
    background-color: #212529;
}

.btn-outline-secondary {
    color: #6c757d;
    border: 1px solid #6c757d;
    background-color: transparent;
    transition: 0.3s ease;
}
.btn-outline-secondary:hover {
    color: #ffffff;
    background-color: #6c757d;
}

.btn-outline-danger {
    color: #dc3545;
    border: 1px solid #dc3545;
    background-color: transparent;
    transition: 0.3s ease;
}
.btn-outline-danger:hover {
    color: #ffffff;
    background-color: #dc3545;
}

/* 13. Accessibility Utilities */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}