/* Основні змінні та стилі ВСП «ЧЕПФК УНУ» */
:root {
    --primary: #0f2342;
    --primary-light: #1c3b6b;
    --accent: #d99b26;
    --accent-hover: #b88019;
    --bg-body: #eef2f6;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(15, 35, 66, 0.06);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Merriweather', Georgia, serif;
}

body.a11y-high-contrast {
    --primary: #000000;
    --primary-light: #1a1a1a;
    --accent: #ffff00;
    --accent-hover: #e6e600;
    --bg-body: #000000;
    --bg-card: #000000;
    --text-main: #ffff00;
    --text-muted: #ffffff;
    --border-color: #ffff00;
    font-size: 118% !important;
}

body.a11y-high-contrast .main-nav a {
    background: #000000 !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
    box-shadow: none !important;
}

body.a11y-high-contrast .btn-primary {
    background: #ffff00 !important;
    color: #000000 !important;
    border: 2px solid #ffff00 !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: 0.2s ease;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 18px;
}

.topbar {
    background-color: var(--primary);
    color: #e2e8f0;
    font-size: 0.84rem;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.topbar-contacts {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.topbar-contacts span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.a11y-btn {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 4px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.a11y-btn:hover {
    background: var(--accent);
    color: var(--primary);
    border-color: var(--accent);
}

/* ================= ОСНОВНА ШАПКА ================= */
.site-header {
    background: #e3e8ef;
    box-shadow: 0 3px 14px rgba(15, 35, 66, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #cbd5e1;
}

body.admin-bar .site-header {
    top: 32px;
}
@media screen and (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    max-width: 370px;
}

.brand-crest {
    width: 58px;
    height: 66px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-title {
    font-family: var(--font-serif);
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.71rem;
    color: #334155;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.25;
    font-weight: 600;
}

/* ================= НАВІГАЦІЯ У СТИЛІ КЛАВІАТУРИ GBOARD + АНІМАЦІЯ РОЗГОРТАННЯ (GORODYSCHE STYLE) ================= */
.main-nav > ul {
    list-style: none;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}

.main-nav li {
    position: relative;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 12px;
    font-weight: 600;
    font-size: 0.86rem;
    border-radius: 9px;
    background-color: #ffffff;
    color: #1e293b;
    border: 1px solid rgba(15, 35, 66, 0.08);
    box-shadow: 0 2px 0 #94a3b8, 0 3px 6px rgba(15, 35, 66, 0.08);
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1),
                box-shadow 0.2s cubic-bezier(0.25, 0.8, 0.25, 1),
                filter 0.2s ease,
                background-color 0.2s ease,
                color 0.2s ease;
    position: relative;
}

.nav-one-line > a {
    white-space: nowrap !important;
}

.main-nav a:hover {
    transform: translateY(-1px);
    filter: brightness(0.97);
}

.main-nav a:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 #94a3b8, 0 1px 2px rgba(15, 35, 66, 0.12);
}

.gboard-key-home > a {
    background: linear-gradient(180deg, #ffffff 0%, #e0f2fe 100%);
    border-color: #bae6fd;
    color: #0c4a6e;
}

.gboard-key-about > a {
    background: linear-gradient(180deg, #ffffff 0%, #ccfbf1 100%);
    border-color: #99f6e4;
    color: #115e59;
}

.gboard-key-admin > a {
    background: linear-gradient(180deg, #ffffff 0%, #e0e7ff 100%);
    border-color: #c7d2fe;
    color: #1e1b4b;
}

.gboard-key-applicant > a {
    background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
    border-color: #f59e0b;
    box-shadow: 0 2px 0 #d97706, 0 3px 6px rgba(217, 119, 6, 0.18);
    color: #78350f;
}

.gboard-key-student > a {
    background: linear-gradient(180deg, #ffffff 0%, #dcfce7 100%);
    border-color: #bbf7d0;
    color: #14532d;
}

.gboard-key-teacher > a {
    background: linear-gradient(180deg, #ffffff 0%, #f3e8ff 100%);
    border-color: #e9d5ff;
    color: #4c1d95;
}

.gboard-key-news > a {
    background: linear-gradient(180deg, #ffffff 0%, #ffe4e6 100%);
    border-color: #fecdd3;
    color: #881337;
}

/* Плавний поворот стрілки-індикатора при розгортанні */
.main-nav li.has-submenu > a::after,
.main-nav li.menu-item-has-children > a::after {
    content: "▾";
    font-size: 0.78rem;
    margin-left: 4px;
    flex-shrink: 0;
    display: inline-block;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.main-nav li.has-submenu:hover > a::after,
.main-nav li.has-submenu.open > a::after,
.main-nav li.menu-item-has-children:hover > a::after,
.main-nav li.menu-item-has-children.open > a::after {
    transform: rotate(180deg);
}

/* ================= ВИПАДАЮЧЕ МЕНЮ 2-ГО ТА 3-ГО РІВНІВ БЕЗ ПРОБІЛІВ (ДЕСКТОП) ================= */
.main-nav > ul > li > ul {
    list-style: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #dfe5ed;
    min-width: 295px;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 35, 66, 0.22);
    border: 1px solid #cbd5e1;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 6px;
    z-index: 1020;
}

/* Місток без зазору, щоб курсор не втрачав наведення при русі до підменю */
.main-nav > ul > li::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 6px;
    display: none;
}

.main-nav > ul > li:hover::after,
.main-nav > ul > li.open::after {
    display: block;
}

.main-nav > ul > li:hover > ul,
.main-nav > ul > li.open > ul {
    display: flex;
}

.main-nav > ul > li:nth-last-child(-n+3) > ul {
    left: auto;
    right: 0;
}

/* Підменю 3-го рівня: розгортається одразу під пунктом без пробілів і порожніх ділянок */
@media (min-width: 1151px) {
    .main-nav ul ul li {
        display: flex;
        flex-direction: column;
    }

    .main-nav ul ul li > ul {
        list-style: none;
        position: static;
        display: none;
        flex-direction: column;
        gap: 5px;
        width: 100%;
        min-width: 0;
        margin-top: 5px;
        padding: 6px;
        background: #eef2f7;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        box-shadow: inset 0 1px 3px rgba(15, 35, 66, 0.08);
    }

    .main-nav ul ul li:hover > ul,
    .main-nav ul ul li.open > ul {
        display: flex;
    }

    .main-nav ul ul li:hover > a,
    .main-nav ul ul li.open > a {
        box-shadow: 0 2px 0 #d97706, 0 3px 8px rgba(217, 119, 6, 0.2);
    }
}

.main-nav ul ul li {
    width: 100%;
}

.main-nav ul ul a {
    width: 100%;
    justify-content: space-between;
    text-align: left;
    padding: 9px 13px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 2px 0 #94a3b8;
    line-height: 1.3;
}

.sub-history > a { background: linear-gradient(90deg, #ffffff 0%, #e0f2fe 100%); color: #0c4a6e; }
.sub-structure > a { background: linear-gradient(90deg, #ffffff 0%, #ccfbf1 100%); color: #115e59; }
.sub-anticorrupt > a { background: linear-gradient(90deg, #ffffff 0%, #fee2e2 100%); color: #7f1d1d; }
.sub-license > a { background: linear-gradient(90deg, #ffffff 0%, #fef3c7 100%); color: #78350f; }

.sub-docs > a { background: linear-gradient(90deg, #ffffff 0%, #e0e7ff 100%); color: #1e1b4b; }
.sub-elections > a { background: linear-gradient(90deg, #ffffff 0%, #f3e8ff 100%); color: #4c1d95; }

.sub-finance-center > a {
    justify-content: center !important;
    text-align: center !important;
    background: linear-gradient(90deg, #fef9c3 0%, #fde047 50%, #fef9c3 100%) !important;
    border-color: #eab308 !important;
    color: #713f12 !important;
    font-weight: 700 !important;
}

.sub-rules > a { background: linear-gradient(90deg, #ffffff 0%, #ffedd5 100%); color: #7c2d12; }
.sub-specs > a { background: linear-gradient(90deg, #ffffff 0%, #fef3c7 100%); color: #78350f; }
.sub-programs > a { background: linear-gradient(90deg, #ffffff 0%, #e0f2fe 100%); color: #0c4a6e; }
.sub-tuition > a { background: linear-gradient(90deg, #ffffff 0%, #dcfce7 100%); color: #14532d; }

.sub-subs > a { background: linear-gradient(90deg, #dcfce7 0%, #bbf7d0 100%); color: #14532d; }
.sub-schedule > a { background: linear-gradient(90deg, #ffffff 0%, #e0f2fe 100%); color: #0c4a6e; }
.sub-scholarship > a { background: linear-gradient(90deg, #ffffff 0%, #fef3c7 100%); color: #78350f; }
.sub-dorm > a { background: linear-gradient(90deg, #ffffff 0%, #ffedd5 100%); color: #7c2d12; }

.sub-attestation > a { background: linear-gradient(90deg, #ffffff 0%, #f3e8ff 100%); color: #4c1d95; }
.sub-method > a { background: linear-gradient(90deg, #ffffff 0%, #e0e7ff 100%); color: #1e1b4b; }
.sub-qual > a { background: linear-gradient(90deg, #ffffff 0%, #ccfbf1 100%); color: #115e59; }

.mobile-menu-toggle {
    display: none;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 0 #94a3b8;
    padding: 8px 14px;
    border-radius: 9px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--primary);
}

/* ================= АДАПТАЦІЯ ПІД СМАРТФОНИ ТА ПЛАНШЕТИ (<= 1150px) ================= */
@media (max-width: 1150px) {
    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .main-nav {
        position: fixed;
        top: 108px;
        left: 10px;
        right: 10px;
        max-height: calc(100vh - 120px);
        max-height: calc(100dvh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        background: #d8dfe8;
        border: 1px solid #94a3b8;
        border-radius: 16px;
        padding: 10px;
        box-shadow: 0 16px 40px rgba(15, 35, 66, 0.35);
        z-index: 1100;

        opacity: 0;
        visibility: hidden;
        transform: translateY(-14px) scale(0.98);
        transform-origin: top center;
        transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1),
                    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                    visibility 0.28s ease;
    }

    .main-nav.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }

    .main-nav > ul {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 7px;
        align-items: start;
    }

    .main-nav > ul > li {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .main-nav > ul > li.open {
        grid-column: 1 / -1;
    }

    .main-nav > ul > li > a {
        width: 100%;
        padding: 10px 10px;
        font-size: 0.85rem;
        min-height: 42px;
    }

    .main-nav li::after {
        display: none !important;
    }

    .main-nav li > ul,
    .main-nav ul ul li > ul {
        position: static;
        display: none;
        flex-direction: column;
        gap: 6px;
        width: 100%;
        min-width: 0;
        margin-top: 6px;
        padding: 8px;
        background: #cbd5e1;
        box-shadow: inset 0 2px 5px rgba(0,0,0,0.08);
        border: none;
        border-radius: 10px;
    }

    .main-nav ul ul li > ul {
        background: #e2e8f0;
        box-shadow: inset 0 1px 4px rgba(0,0,0,0.06);
    }

    .main-nav li.open > ul {
        display: flex;
    }

    .main-nav ul ul a {
        padding: 9px 12px;
        font-size: 0.83rem;
        white-space: normal;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    .brand {
        max-width: 245px;
        gap: 8px;
    }
    .brand-crest {
        width: 48px;
        height: 54px;
    }
    .brand-title {
        font-size: 0.92rem;
    }
    .brand-subtitle {
        font-size: 0.65rem;
    }
    .main-nav > ul > li > a {
        font-size: 0.82rem;
        padding: 9px 8px;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: var(--primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 2px solid #ffffff;
    color: #ffffff;
}

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

.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.35fr 0.65fr;
    gap: 40px;
    align-items: center;
}

.hero-badge {
    display: inline-block;
    background: rgba(217, 155, 38, 0.2);
    border: 1px solid var(--accent);
    color: #f3c65f;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 18px;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    line-height: 1.25;
    margin-bottom: 18px;
}

.hero-desc {
    font-size: 1.06rem;
    color: #cbd5e1;
    margin-bottom: 28px;
    max-width: 640px;
}

.hero-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.hero-crest-card {
    background: rgba(255, 255, 255, 0.97);
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 26px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
    color: var(--primary);
}

.hero-crest-card img {
    width: 155px;
    height: auto;
    object-fit: contain;
    margin-bottom: 12px;
}

.quick-hubs {
    margin-top: -32px;
    position: relative;
    z-index: 10;
    margin-bottom: 50px;
}

.hubs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.hub-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hub-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.hub-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(15, 35, 66, 0.08);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 14px;
}

.hub-card h3 {
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.hub-card p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.section {
    padding: 50px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    color: var(--primary);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

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

.spec-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.spec-code {
    display: inline-block;
    background: var(--primary);
    color: #f3c65f;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 6px;
    margin-bottom: 14px;
}

.spec-card h3 {
    font-size: 1.15rem;
    margin-bottom: 10px;
}

.spec-title-link {
    color: var(--primary);
    transition: color 0.2s ease;
}

.spec-title-link:hover {
    color: var(--accent-hover);
}

.spec-btn {
    margin-top: 16px;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid var(--primary);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.spec-btn:hover {
    background: var(--accent);
    color: var(--primary);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.spec-meta {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.post-thumb {
    height: 190px;
    background: linear-gradient(135deg, #1c3b6b, #0f2342);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
    font-size: 0.92rem;
    overflow: hidden;
}

.post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-body {
    padding: 22px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-date {
    font-size: 0.8rem;
    color: var(--accent-hover);
    font-weight: 600;
    margin-bottom: 8px;
}

.post-title {
    font-size: 1.12rem;
    margin-bottom: 10px;
    line-height: 1.35;
}

.post-title a:hover {
    color: var(--accent-hover);
}

.post-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-grow: 1;
}

.content-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 36px;
    margin: 30px 0;
    box-shadow: var(--shadow);
}

.entry-content h2, .entry-content h3 {
    margin: 22px 0 12px;
    color: var(--primary);
}

.entry-content p, .entry-content ul, .entry-content ol {
    margin-bottom: 16px;
}

.entry-content ul, .entry-content ol {
    padding-left: 24px;
}

.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.entry-content th, .entry-content td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
}

.entry-content th {
    background: var(--primary);
    color: #ffffff;
}

.site-footer {
    background: var(--primary);
    color: #cbd5e1;
    padding: 56px 0 24px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
    gap: 32px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.footer-col h4 {
    color: #ffffff;
    font-size: 1.05rem;
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-bottom {
    padding-top: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
}

@media (max-width: 992px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
    .hubs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .specs-grid {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .hubs-grid, .footer-grid {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 1.7rem;
    }
    .content-wrapper {
        padding: 20px;
    }
}
