/* ============================================================
   WEAZEL NEWS — PERSONNEL DATABASE
   site.css
   ============================================================ */


/* ============================================================
   1. Variables
   ============================================================ */

:root {
    --bg: #080a0f;
    --line: #242936;

    --text: #f3f4f7;
    --muted: #8f96a6;

    --red: #e21e2b;
    --red2: #ff4651;
    --green: #52df95;
    --amber: #e9bd62;
}


/* ============================================================
   2. Reset / Base
   ============================================================ */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;

    background: var(--bg);
    color: var(--text);

    font-family: Inter, Arial, sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;

    pointer-events: none;

    background-image:
        linear-gradient(
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px
        );

    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
}

a {
    color: inherit;
    text-decoration: none;
}


/* ============================================================
   3. Ambient Background
   ============================================================ */

.ambient {
    position: fixed;

    border-radius: 50%;
    filter: blur(110px);

    pointer-events: none;
    opacity: 0.2;
}

.ambient-one {
    width: 460px;
    height: 460px;

    top: 40px;
    right: -180px;

    background: #d51628;
}

.ambient-two {
    width: 420px;
    height: 420px;

    left: -250px;
    bottom: 0;

    background: #4b2233;
}


/* ============================================================
   4. Header / Branding
   ============================================================ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;

    height: 88px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.07);

    background: rgba(8, 10, 15, 0.76);
    backdrop-filter: blur(18px);
}

.topbar-inner {
    width: min(1440px, calc(100% - 56px));
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;

    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.brand-logo {
    display: block;

    width: auto;
    height: 46px;

    flex-shrink: 0;
    object-fit: cover;

    /* Реальное скругление bitmap, а не только рамки img. */
    border-radius: 9px;
    clip-path: inset(0 round 9px);
    overflow: hidden;

    /* Убирает артефакты по краям в Chromium/WebKit. */
    transform: translateZ(0);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-copy strong {
    font: 800 14px Manrope;
    letter-spacing: 0.09em;
}

.brand-copy small {
    color: var(--muted);

    font-size: 11px;
    letter-spacing: 0.08em;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 9px;

    color: #a5abba;

    font-size: 12px;
}

.live-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--green);

    box-shadow: 0 0 0 5px rgba(82, 223, 149, 0.08);
}


/* ============================================================
   5. Main Layout
   ============================================================ */

.shell {
    width: min(1440px, calc(100% - 56px));
    margin: 0 auto;
}


/* ============================================================
   6. Hero
   ============================================================ */

.hero {
    position: relative;

    min-height: 390px;

    display: grid;
    grid-template-columns: 1.45fr 0.75fr;
    gap: 40px;
    align-items: start;

    padding: 70px 0 48px;

    border-bottom: 1px solid var(--line);
}

.hero::after {
    content: attr(data-code);

    position: absolute;
    right: 18px;
    bottom: -28px;

    color: rgba(255, 255, 255, 0.018);

    font: 800 180px Manrope;
    letter-spacing: -0.08em;

    pointer-events: none;
}

.eyebrow {
    margin-bottom: 18px;

    color: #9aa1b0;

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.eyebrow span {
    display: inline-block;

    width: 26px;
    height: 2px;

    margin-right: 9px;

    vertical-align: middle;

    background: var(--red);
}

.hero h1 {
    margin: 0;

    font: 800 clamp(50px, 6vw, 88px) / 0.9 Manrope;
    letter-spacing: -0.06em;
}

.hero h1 em {
    color: var(--red2);
    font-style: normal;
}

.hero-copy p {
    max-width: 650px;
    margin: 26px 0 0;

    color: #979ead;

    font-size: 15px;
    line-height: 1.7;
}

.hero-panel {
    width: min(100%, 410px);
    justify-self: end;

    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;

    padding: 24px;

    border: 1px solid #2a2f3c;
    border-radius: 28px;

    background:
        linear-gradient(
            145deg,
            rgba(26, 30, 41, 0.92),
            rgba(13, 16, 22, 0.94)
        );

    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.3);
}

.hero-stat {
    padding: 20px;

    border: 1px solid #222735;
    border-radius: 18px;

    background: #0b0e14;
}

.hero-stat span {
    color: #7f8797;

    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-stat strong {
    display: block;

    margin-top: 7px;

    font: 800 42px Manrope;
}

.hero-caption {
    grid-column: 1 / -1;

    padding: 16px 4px 0;

    font: 700 15px Manrope;
    letter-spacing: 0.02em;
}

.hero-caption small {
    display: block;

    margin-top: 4px;

    color: #727989;

    font: 500 11px Inter;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}


/* ============================================================
   7. Toolbar / Search / Filters
   ============================================================ */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    padding: 32px 0;
}

.search {
    height: 54px;
    max-width: 610px;
    flex: 1;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 0 17px;

    border: 1px solid #292e3a;
    border-radius: 16px;

    background: #0d1016;

    transition: 0.2s;
}

.search:focus-within {
    border-color: #535b6e;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.025);
}

.search-icon {
    color: #777f90;

    font-size: 22px;

    transform: rotate(-15deg);
}

.search input {
    width: 100%;

    border: 0;
    outline: 0;

    background: transparent;
    color: #fff;

    font: 500 13px Inter;
}

.search input::placeholder {
    color: #646c7c;
}

.filters {
    display: flex;
    gap: 5px;

    padding: 5px;

    border: 1px solid #262b37;
    border-radius: 15px;

    background: #0d1016;
}

.filter {
    padding: 11px 15px;

    border-radius: 10px;

    color: #858d9c;

    font-size: 12px;
    font-weight: 700;
}

.filter.active {
    background: #222733;
    color: #fff;
}


/* ============================================================
   8. Directory Header
   ============================================================ */

.directory-head {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 8px 0 18px;
}

.directory-head > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-index {
    color: var(--red2);

    font: 800 11px Manrope;
}

.directory-head h2 {
    margin: 0;

    font: 700 18px Manrope;
}

.result-count {
    color: #6e7686;

    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}


/* ============================================================
   9. Employee Grid / Cards
   ============================================================ */

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.employee-card {
    position: relative;

    display: flex;
    flex-direction: column;

    height: 100%;
    overflow: hidden;

    border: 1px solid #252a36;
    border-radius: 24px;

    background: linear-gradient(180deg, #121620 0%, #0e1118 100%);

    transition:
        transform 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease;
}

.employee-card:hover {
    transform: translateY(-4px);

    border-color: #3b4252;

    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}


/* Portrait
   ------------------------------------------------------------ */

.portrait-wrap {
    position: relative;

    height: 285px;
    overflow: hidden;

    background: #171b24;
}

.portrait-wrap::after {
    content: "";

    position: absolute;
    inset: auto 0 0;

    height: 50%;

    background:
        linear-gradient(
            to top,
            rgba(9, 11, 16, 0.95),
            transparent
        );
}

.portrait {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;

    filter: saturate(0.82) contrast(1.03);
}

.portrait.placeholder {
    display: grid;
    place-items: center;

    background:
        radial-gradient(
            circle at 50% 30%,
            #333a49,
            #161a23 62%
        );
}

.portrait.placeholder span {
    color: #70798c;

    font: 800 64px Manrope;
}


/* Status Badge
   ------------------------------------------------------------ */

.status {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 2;

    display: flex;
    align-items: center;
    gap: 7px;

    padding: 7px 10px;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 99px;

    background: rgba(7, 9, 13, 0.78);
    backdrop-filter: blur(10px);

    font-size: 10px;
    font-weight: 700;
}

.status i {
    width: 7px;
    height: 7px;

    border-radius: 50%;
}

.status-active i {
    background: var(--green);
    box-shadow: 0 0 12px rgba(82, 223, 149, 0.7);
}

.status-vacation i {
    background: var(--amber);
}

.status-inactive i {
    background: #7d8492;
}


/* Static ID Badge
   ------------------------------------------------------------ */

.static-chip {
    position: absolute;
    right: 15px;
    bottom: 14px;
    z-index: 2;

    padding: 7px 10px;

    border-radius: 9px;

    background: var(--red);
    color: #fff;

    font: 800 12px Manrope;

    box-shadow: 0 8px 25px rgba(226, 30, 43, 0.25);
}


/* Card Content
   ------------------------------------------------------------ */

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;

    padding: 21px 21px 15px;
}

.role {
    margin-bottom: 7px;

    color: var(--red2);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.card-body h3 {
    margin: 0 0 18px;

    font: 600 20px / 1.15 Manrope;
    letter-spacing: -0.025em;
}

.card-body h3 strong {
    font-weight: 800;
}

.facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.fact-timezone,
.fact-full {
    grid-column: 1 / -1;
}

.fact {
    min-width: 0;

    padding: 11px 12px;

    border: 1px solid #242936;
    border-radius: 12px;

    background: #0b0e14;
}

.fact span {
    display: block;

    margin-bottom: 5px;

    color: #666e7e;

    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.fact b {
    display: block;

    overflow: hidden;

    font-size: 11px;
    font-weight: 600;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.bio {
    height: 58px;
    min-height: 58px;
    margin: 16px 0 4px;

    display: -webkit-box;
    overflow: hidden;

    color: #9299a8;

    font-size: 12px;
    line-height: 1.6;

    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}


/* Card Footer
   ------------------------------------------------------------ */

.card-footer {
    flex-shrink: 0;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 13px 0 21px;

    border-top: 1px solid #202531;
}

.card-footer > span {
    color: #4d5463;

    font: 800 8px Manrope;
    letter-spacing: 0.18em;
}

.expand {
    width: 30px;
    height: 30px;

    border: 1px solid #2d3340;
    border-radius: 9px;

    background: #171b24;
    color: #aeb5c2;

    cursor: pointer;

    transition: 0.2s;
}

.expand:hover {
    border-color: var(--red);

    background: var(--red);
    color: #fff;
}


/* ============================================================
   10. Empty State
   ============================================================ */

.empty {
    padding: 90px 20px;

    border: 1px dashed #2c3240;
    border-radius: 24px;

    text-align: center;
}

.empty-mark {
    width: 64px;
    height: 64px;

    display: grid;
    place-items: center;

    margin: 0 auto 20px;

    border-radius: 18px;

    background: #171b24;
    color: var(--red);

    font: 800 18px Manrope;
}

.empty h3 {
    margin: 0 0 8px;
}

.empty p {
    color: var(--muted);
}

.empty a {
    display: inline-block;

    margin-top: 10px;

    color: var(--red2);

    font-size: 13px;
    font-weight: 700;
}


/* ============================================================
   11. Modal
   ============================================================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;

    display: none;
}

.modal.open {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;

    background: rgba(4, 5, 8, 0.78);
    backdrop-filter: blur(10px);
}

.modal-card {
    position: relative;

    width: min(520px, calc(100% - 32px));
    max-height: 90vh;

    margin: 5vh auto;

    overflow: auto;

    border-radius: 24px;
    background: #0e1118;

    box-shadow: 0 40px 110px rgba(0, 0, 0, 0.6);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 9;

    width: 36px;
    height: 36px;

    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;

    background: rgba(10, 12, 17, 0.75);
    color: #fff;

    font-size: 23px;

    cursor: pointer;
}

.modal .employee-card {
    transform: none;
    border-radius: 24px;
}

.modal .portrait-wrap {
    height: 430px;
}

.modal .bio {
    height: auto;
    min-height: 0;
    overflow: visible;

    display: block;

    -webkit-line-clamp: unset;
}

.modal .card-footer {
    display: none;
}

.modal-open {
    overflow: hidden;
}


/* ============================================================
   12. Footer
   ============================================================ */

footer {
    display: flex;
    justify-content: space-between;

    margin-top: 50px;
    padding: 28px 0 40px;

    border-top: 1px solid var(--line);

    color: #555d6c;

    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.15em;
}


/* ============================================================
   13. Responsive — Desktop / Tablet
   ============================================================ */

@media (max-width: 1150px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .hero {
        grid-template-columns: 1.25fr 0.75fr;
    }

    .hero h1 {
        font-size: 64px;
    }
}


/* ============================================================
   14. Responsive — Tablet
   ============================================================ */

@media (max-width: 860px) {
    .topbar {
        padding: 0 20px;
    }

    .shell {
        width: min(100% - 32px, 1440px);
    }

    .hero {
        grid-template-columns: 1fr;

        padding-top: 48px;
    }

    .hero-panel {
        width: 100%;

        justify-self: start;
    }

    .hero::after {
        display: none;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search {
        max-width: none;
    }

    .filters {
        align-self: flex-start;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ============================================================
   15. Responsive — Mobile
   ============================================================ */

@media (max-width: 560px) {
    .topbar {
        height: 72px;
    }

    .brand-logo {
        height: 38px;

        border-radius: 8px;
        clip-path: inset(0 round 8px);
    }

    .brand-copy strong {
        font-size: 12px;
    }

    .brand-copy small {
        font-size: 9px;
    }

    .topbar-meta {
        font-size: 10px;
    }

    .shell {
        width: calc(100% - 24px);
    }

    .hero {
        min-height: 0;

        padding: 42px 0 34px;
    }

    .hero h1 {
        font-size: 49px;
    }

    .hero-copy p {
        font-size: 13px;
    }

    .hero-panel {
        padding: 14px;

        border-radius: 20px;
    }

    .hero-stat {
        padding: 15px;
    }

    .hero-stat strong {
        font-size: 34px;
    }

    .toolbar {
        gap: 14px;
    }

    .filters {
        width: 100%;

        overflow-x: auto;
    }

    .filter {
        flex: 1;

        text-align: center;
        white-space: nowrap;
    }

    .directory-head {
        padding-top: 0;
    }

    .result-count {
        display: none;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .portrait-wrap {
        height: 360px;
    }

    footer {
        flex-direction: column;
        gap: 12px;
    }

    .modal .portrait-wrap {
        height: 380px;
    }
}


/* ============================================================
   16. Main Navigation
   ============================================================ */

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;

    padding: 5px;

    border: 1px solid #262b37;
    border-radius: 14px;

    background: #0d1016;
}

.main-nav a {
    padding: 9px 12px;

    border-radius: 9px;

    color: #7f8797;

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;

    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.main-nav a:hover {
    color: #fff;
}

.main-nav a.active {
    background: #222733;
    color: #fff;
}


/* ============================================================
   17. Home / Department Cards
   ============================================================ */

.home-hero {
    min-height: 360px;
}

.department-title {
    max-width: 880px;

    font-size: clamp(46px, 5vw, 76px) !important;
    line-height: 0.98 !important;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 38px 0 20px;
}

.section-heading > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-heading h2 {
    margin: 0;

    font: 700 20px Manrope;
}

.department-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.department-card {
    min-height: 330px;

    display: flex;
    flex-direction: column;

    padding: 26px;

    overflow: hidden;
    position: relative;

    border: 1px solid #252a36;
    border-radius: 24px;

    background:
        radial-gradient(
            circle at 95% 0%,
            rgba(226, 30, 43, 0.13),
            transparent 38%
        ),
        linear-gradient(180deg, #121620 0%, #0e1118 100%);

    transition:
        transform 0.22s ease,
        border-color 0.22s ease,
        box-shadow 0.22s ease;
}

.department-card:hover {
    transform: translateY(-4px);

    border-color: #41495a;

    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.department-code {
    position: absolute;
    top: -12px;
    right: 16px;

    color: rgba(255, 255, 255, 0.035);

    font: 800 116px / 1 Manrope;
    letter-spacing: -0.08em;

    pointer-events: none;
}

.department-card-content {
    position: relative;
    z-index: 1;
}

.department-kicker {
    color: var(--red2);

    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.department-card h3 {
    max-width: 310px;

    margin: 18px 0 12px;

    font: 800 28px / 1.05 Manrope;
    letter-spacing: -0.035em;
}

.department-card p {
    max-width: 360px;
    margin: 0;

    color: #8f96a6;

    font-size: 12px;
    line-height: 1.65;
}

.department-card-footer {
    position: relative;
    z-index: 1;

    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: end;
    gap: 22px;

    margin-top: auto;
    padding-top: 24px;

    border-top: 1px solid #202531;
}

.department-card-footer > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.department-card-footer strong {
    font: 800 23px Manrope;
}

.department-card-footer span:not(.department-arrow) {
    color: #646c7c;

    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.department-arrow {
    justify-self: end;

    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    border: 1px solid #2d3340;
    border-radius: 10px;

    background: #171b24;
    color: #aeb5c2;

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

.department-card:hover .department-arrow {
    border-color: var(--red);

    background: var(--red);
    color: #fff;
}


/* ============================================================
   18. Employee Fact Layout
   ============================================================ */

.fact-timezone b {
    overflow: visible;

    white-space: normal;
    text-overflow: unset;
    line-height: 1.45;
}


/* ============================================================
   19. Responsive — Navigation / Departments
   ============================================================ */

@media (max-width: 1100px) {
    .topbar-meta {
        display: none;
    }

    .department-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .topbar-inner {
        width: calc(100% - 32px);
        gap: 18px;
    }

    .brand-copy {
        display: none;
    }

    .main-nav {
        margin-left: auto;
        overflow-x: auto;
    }

    .main-nav a {
        padding: 8px 10px;
    }
}

@media (max-width: 620px) {
    .topbar {
        height: auto;
        min-height: 76px;

        padding: 10px 0;
    }

    .topbar-inner {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .brand-logo {
        height: 38px;
    }

    .main-nav {
        width: 100%;
        order: 3;

        justify-content: flex-start;
    }

    .main-nav a {
        flex: 0 0 auto;
    }

    .department-grid {
        grid-template-columns: 1fr;
    }

    .department-card {
        min-height: 290px;
    }

    .department-title {
        font-size: 43px !important;
    }
}


/* ============================================================
   20. Home Directory
   ============================================================ */

/*
 * Главная использует те же базовые компоненты, что и страницы отделов:
 * .toolbar, .directory-head, .grid и .employee-card.
 * Здесь остаются только правила, которых нет на странице отдела.
 */

.home-search-toolbar .search {
    width: 100%;
    max-width: none;
}

.home-search-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 0 16px;

    border: 1px solid #2a303d;
    border-radius: 12px;

    background: #11151d;

    color: #a9afbc;

    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.home-search-reset:hover {
    border-color: #3a4252;
    color: #fff;
}

.home-search-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin: -14px 0 24px;
    padding: 11px 14px;

    border: 1px solid #222834;
    border-radius: 12px;

    background: rgba(15, 18, 26, 0.72);

    color: #7f8796;

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.home-search-summary strong {
    color: #f0f2f6;
    font-size: 12px;
}

.home-directory-section + .home-directory-section {
    margin-top: 46px;
}

.home-directory-section .directory-head {
    padding: 8px 0 18px;
}

.home-directory-section .grid,
.home-directory-section .department-grid {
    margin: 0;
}

.home-directory-section .empty {
    margin-top: 0;
}

.home-directory-section:last-of-type {
    margin-bottom: 10px;
}


/* ============================================================
   Employee facts / card height refinement
   ============================================================ */

.facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fact-timezone,
.fact-full {
    grid-column: 1 / -1;
}

/*
 * Do not stretch the card body just to match the tallest card in the row.
 * Cards keep their natural content height; the grid row no longer creates
 * a large empty area under shorter bios.
 */
.grid {
    align-items: start;
}

.employee-card {
    height: auto;
}

.card-body {
    flex: 0 0 auto;
}

.card-footer {
    margin-top: 0;
}


/* ============================================================
   21. Mobile UI — authoritative responsive layer
   This block intentionally comes last and overrides the older
   560/620/860px rules without changing the desktop layout.
   ============================================================ */

.mobile-nav-toggle {
    display: none;
}

@media (max-width: 760px) {
    /* Header -------------------------------------------------- */
    .topbar {
        height: 70px;
        min-height: 70px;
        padding: 0;

        background: rgba(8, 10, 15, 0.96);
        backdrop-filter: blur(22px);
        -webkit-backdrop-filter: blur(22px);
    }

    .topbar-inner {
        position: relative;

        width: calc(100% - 28px);
        height: 70px;

        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 12px;

        margin: 0 auto;
    }

    .brand {
        min-width: 0;
        gap: 10px;
    }

    .brand-logo {
        width: 42px;
        height: 42px;

        border-radius: 9px;
        clip-path: inset(0 round 9px);
    }

    .brand-copy {
        display: flex;
        min-width: 0;
    }

    .brand-copy strong {
        font-size: 13px;
        line-height: 1.1;
        white-space: nowrap;
    }

    .brand-copy small {
        margin-top: 3px;

        font-size: 9px;
        line-height: 1;
        white-space: nowrap;
    }

    .topbar-meta {
        display: none;
    }

    .mobile-nav-toggle {
        position: relative;
        z-index: 2;

        width: 42px;
        height: 42px;

        display: grid;
        place-content: center;
        gap: 5px;

        padding: 0;

        border: 1px solid #2b313d;
        border-radius: 12px;

        background: #11151d;
        color: #fff;

        cursor: pointer;
    }

    .mobile-nav-toggle span {
        width: 18px;
        height: 2px;

        display: block;

        border-radius: 999px;
        background: currentColor;

        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .topbar.nav-open .mobile-nav-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

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

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

    .main-nav {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        right: 0;
        z-index: 40;

        width: 100%;
        margin: 0;
        padding: 8px;

        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;

        overflow: hidden;

        border: 1px solid #2b313d;
        border-radius: 16px;

        background: rgba(13, 16, 22, 0.985);
        box-shadow: 0 20px 55px rgba(0, 0, 0, 0.48);

        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px) scale(0.985);
        transform-origin: top center;
        pointer-events: none;

        transition:
            opacity 0.18s ease,
            visibility 0.18s ease,
            transform 0.18s ease;
    }

    .topbar.nav-open .main-nav {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }

    .main-nav a {
        min-width: 0;
        min-height: 42px;

        display: flex;
        align-items: center;
        justify-content: center;

        padding: 0 8px;

        border: 1px solid transparent;
        border-radius: 10px;

        background: #11151d;

        font-size: 11px;
        letter-spacing: 0.05em;
        white-space: nowrap;
    }

    .main-nav a:first-child {
        grid-column: 1 / -1;
    }

    .main-nav a.active {
        border-color: #343b49;
        background: #242a36;
    }

    /* Base mobile spacing ------------------------------------ */
    .shell {
        width: calc(100% - 28px);
    }

    .hero {
        min-height: 0;
        grid-template-columns: 1fr;
        gap: 28px;

        padding: 42px 0 36px;
    }

    .hero h1 {
        font-size: clamp(46px, 14vw, 62px);
    }

    .department-title {
        font-size: clamp(38px, 11vw, 52px) !important;
        line-height: 1.02 !important;
    }

    .hero-copy p {
        max-width: none;
        font-size: 13px;
        line-height: 1.65;
    }

    .hero-panel {
        width: 100%;
        padding: 14px;
        border-radius: 20px;
    }

    .toolbar {
        gap: 12px;
        margin: 22px 0 30px;
    }

    .search {
        min-height: 48px;
    }

    .search input {
        min-width: 0;
        font-size: 13px;
    }

    .filters {
        width: 100%;
        padding: 4px;
    }

    .filter {
        min-width: 0;
        flex: 1 1 0;
        padding: 10px 8px;
    }

    /* Sections ------------------------------------------------ */
    .home-directory-section {
        position: relative;
    }

    .home-directory-section + .home-directory-section {
        margin-top: 72px;
    }

    .home-directory-section + .home-directory-section::before {
        content: "";

        position: absolute;
        top: -36px;
        left: 0;
        right: 0;

        height: 1px;
        background: linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.12) 12%,
            rgba(255, 255, 255, 0.12) 88%,
            transparent
        );
    }

    .directory-head,
    .home-directory-section .directory-head {
        min-height: 0;

        align-items: flex-start;
        padding: 0 0 22px;
    }

    .directory-head > div {
        gap: 11px;
    }

    .section-index {
        min-width: 32px;
        height: 27px;

        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;

        border: 1px solid rgba(255, 70, 81, 0.25);
        border-radius: 8px;

        background: rgba(255, 70, 81, 0.07);

        font-size: 10px;
    }

    .directory-head h2 {
        font-size: 25px;
        line-height: 1.08;
    }

    .result-count {
        display: none;
    }

    .grid,
    .home-directory-section .grid {
        grid-template-columns: 1fr;
        gap: 24px;
        align-items: start;
    }

    /* Employee cards ----------------------------------------- */
    .employee-card {
        height: auto;
        border-radius: 20px;
    }

    .portrait-wrap {
        height: auto;
        aspect-ratio: 1 / 1.02;
    }

    .card-body {
        padding: 22px 20px 18px;
    }

    .role {
        margin-bottom: 8px;
        font-size: 10px;
        line-height: 1.35;
    }

    .card-body h3 {
        margin-bottom: 22px;
    }

    .card-body h3 strong {
        font-size: 25px;
        line-height: 1.1;
    }

    .facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .fact {
        min-width: 0;
        padding: 13px 14px;
    }

    .fact b {
        font-size: 11px;
    }

    .fact-timezone,
    .fact-full {
        grid-column: 1 / -1;
    }

    .bio {
        min-height: 0;
        margin: 18px 0 0;
        font-size: 12px;
        line-height: 1.6;
    }

    .card-footer {
        min-height: 58px;
        padding: 12px 20px;
    }

    /* Departments -------------------------------------------- */
    .department-grid,
    .home-directory-section .department-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .department-card {
        min-height: 0;
        padding: 20px;

        border: 1px solid #303746;
        border-radius: 20px;

        background:
            radial-gradient(
                circle at 105% -12%,
                rgba(226, 30, 43, 0.20),
                transparent 46%
            ),
            linear-gradient(180deg, #151923 0%, #0e1118 100%);

        box-shadow:
            0 14px 35px rgba(0, 0, 0, 0.22),
            inset 0 1px 0 rgba(255, 255, 255, 0.025);
    }

    .department-card:active {
        transform: scale(0.99);
    }

    .department-code {
        position: static;

        width: fit-content;
        margin: 0 0 13px;
        padding: 7px 9px;

        border: 1px solid rgba(255, 70, 81, 0.24);
        border-radius: 8px;

        background: rgba(255, 70, 81, 0.075);
        color: var(--red2);

        font: 800 11px / 1 Manrope;
        letter-spacing: 0.13em;
    }

    .department-kicker {
        color: #727a8a;
        font-size: 8px;
    }

    .department-card h3 {
        max-width: none;
        margin: 13px 0 10px;

        font-size: clamp(23px, 7vw, 28px);
        line-height: 1.08;
    }

    .department-card p {
        max-width: none;
        margin: 0;

        color: #a2a9b8;
        font-size: 13px;
        line-height: 1.6;
    }

    .department-card-footer {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
        align-items: center;
        gap: 12px;

        margin-top: 22px;
        padding-top: 16px;
    }

    .department-card-footer strong {
        font-size: 21px;
    }

    .department-card-footer span:not(.department-arrow) {
        font-size: 8px;
    }

    .department-arrow {
        width: 40px;
        height: 40px;
        border-radius: 11px;
    }

    /* Footer ------------------------------------------------- */
    .home-directory-section:last-of-type {
        margin-bottom: 48px;
    }

    footer {
        margin-top: 42px;
        padding: 26px 0 34px;
        gap: 8px;
    }

    /* Modal -------------------------------------------------- */
    .modal-card {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 20px;
    }

    .modal .portrait-wrap {
        height: auto;
        aspect-ratio: 1 / 1.02;
    }

    .modal .bio {
        height: auto;
        max-height: none;
        overflow: visible;

        display: block;

        -webkit-line-clamp: unset;
    }
}

@media (max-width: 390px) {
    .topbar-inner,
    .shell {
        width: calc(100% - 22px);
    }

    .brand-logo {
        width: 39px;
        height: 39px;
    }

    .brand-copy strong {
        font-size: 12px;
    }

    .main-nav a {
        min-height: 40px;
        font-size: 10px;
    }

    .directory-head h2 {
        font-size: 23px;
    }

    .card-body {
        padding-inline: 18px;
    }

    .card-body h3 strong {
        font-size: 23px;
    }

    .department-card {
        padding: 18px;
    }
}


/* ============================================================
   22. Mobile modal viewport fix
   Samsung Internet / Chrome dynamic browser bars
   ============================================================ */

@media (max-width: 760px) {
    /*
     * 100vh on mobile can include the area hidden behind browser chrome.
     * Use dvh so the modal tracks the actually visible viewport.
     */
    .modal {
        width: 100%;
        height: 100vh;
        height: 100dvh;

        overflow: hidden;
    }

    .modal.open {
        display: flex;
        align-items: center;
        justify-content: center;

        padding:
            max(10px, env(safe-area-inset-top))
            10px
            max(10px, env(safe-area-inset-bottom));
    }

    .modal-backdrop {
        position: fixed;
        inset: 0;
    }

    .modal-card {
        width: 100%;
        max-width: 520px;

        /* fallback for older browsers, then dynamic viewport override */
        max-height: calc(100vh - 20px);
        max-height: calc(
            100dvh
            - max(10px, env(safe-area-inset-top))
            - max(10px, env(safe-area-inset-bottom))
        );

        margin: 0;

        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;

        scrollbar-gutter: stable;
    }

    /*
     * Keep the close button visible while the user scrolls a long card.
     */
    .modal-close {
        position: sticky;
        top: 12px;

        float: right;

        margin-right: 12px;
        margin-bottom: -48px;
    }
}


/* ============================================================
   23. Desktop scroll-to-top button
   ============================================================ */

.scroll-top {
    position: fixed;
    right: 32px;
    bottom: 32px;
    z-index: 90;

    width: 52px;
    height: 52px;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #303746;
    border-radius: 15px;

    background: rgba(17, 21, 29, 0.94);
    box-shadow:
        0 14px 34px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);

    color: #f0f2f7;
    cursor: pointer;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px);

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.scroll-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.scroll-top:hover {
    border-color: rgba(255, 62, 74, 0.65);
    background: #e21e2b;
}

.scroll-top:focus-visible {
    outline: 2px solid var(--red2);
    outline-offset: 3px;
}

.scroll-top svg {
    width: 24px;
    height: 24px;

    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.modal-open .scroll-top {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 760px) {
    .scroll-top {
        display: none !important;
    }
}


/* ============================================================
   24. Knowledge Base
   ============================================================ */

.knowledge-hero {
    position: relative;
    min-height: 330px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;

    padding: 68px 0 48px;
    overflow: hidden;

    border-bottom: 1px solid var(--line);
}

.knowledge-hero h1 {
    margin: 0;

    font: 800 clamp(54px, 7vw, 94px) / .92 Manrope, sans-serif;
    letter-spacing: -.065em;
}

.knowledge-hero h1 em {
    color: var(--red);
    font-style: normal;
}

.knowledge-hero p {
    max-width: 650px;
    margin: 24px 0 0;

    color: #939aaa;
    font-size: 14px;
    line-height: 1.7;
}

.knowledge-hero-mark {
    flex: 0 0 auto;

    color: rgba(255, 255, 255, .025);
    font: 800 clamp(130px, 18vw, 260px) / .8 Manrope, sans-serif;
    letter-spacing: -.1em;
    user-select: none;
}

.knowledge-directory {
    padding: 46px 0 18px;
}

.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.knowledge-card {
    position: relative;
    min-height: 300px;

    display: flex;
    flex-direction: column;

    padding: 26px;
    overflow: hidden;

    border: 1px solid #252b37;
    border-radius: 24px;

    background:
        radial-gradient(circle at 100% 0%, rgba(226, 30, 43, .13), transparent 42%),
        linear-gradient(180deg, #121620, #0e1118);

    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.knowledge-card:hover {
    transform: translateY(-4px);
    border-color: #454d5d;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}

.knowledge-card-index {
    position: absolute;
    top: -18px;
    right: 18px;

    color: rgba(255, 255, 255, .035);
    font: 800 118px/1 Manrope, sans-serif;
    letter-spacing: -.08em;
}

.knowledge-card-body,
.knowledge-card-footer {
    position: relative;
    z-index: 1;
}

.knowledge-card-kicker {
    color: var(--red2);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .16em;
}

.knowledge-card h2 {
    max-width: 520px;
    margin: 18px 0 12px;

    font: 800 clamp(25px, 3vw, 35px)/1.08 Manrope, sans-serif;
    letter-spacing: -.04em;
}

.knowledge-card p {
    max-width: 540px;
    margin: 0;

    color: #8f96a6;
    font-size: 12px;
    line-height: 1.65;
}

.knowledge-card-footer {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;

    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid #202531;
}

.knowledge-card-footer > span:first-child {
    display: flex;
    flex-direction: column;
    gap: 4px;

    color: #697282;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.knowledge-card-footer strong {
    color: #d9dde5;
    font-size: 11px;
}

.knowledge-card-arrow {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border: 1px solid #2d3340;
    border-radius: 10px;

    background: #171b24;
    color: #aeb5c2;

    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.knowledge-card:hover .knowledge-card-arrow {
    border-color: var(--red);
    background: var(--red);
    color: #fff;
}

.knowledge-empty {
    margin-top: 0;
}

.knowledge-detail-head {
    padding: 52px 0 34px;
    border-bottom: 1px solid var(--line);
}

.knowledge-back {
    display: inline-flex;
    margin-bottom: 34px;

    color: #8d95a5;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.knowledge-back:hover {
    color: #fff;
}

.knowledge-detail-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 50px;
    align-items: end;
}

.knowledge-detail-title h1 {
    max-width: 1000px;
    margin: 12px 0 0;

    font: 800 clamp(42px, 6vw, 76px)/.98 Manrope, sans-serif;
    letter-spacing: -.055em;
}

.knowledge-detail-title > div:first-child > p {
    max-width: 800px;
    margin: 20px 0 0;
    color: #929aaa;
    font-size: 13px;
    line-height: 1.7;
}

.knowledge-meta {
    min-width: 190px;

    display: flex;
    flex-direction: column;
    gap: 5px;

    padding: 15px 16px;

    border: 1px solid #272d39;
    border-radius: 14px;
    background: #10141c;
}

.knowledge-meta span {
    color: #697282;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.knowledge-meta strong {
    font: 800 12px Manrope, sans-serif;
}

.knowledge-meta small {
    color: #8f96a6;
    font-size: 10px;
}

.knowledge-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 46px;
    align-items: start;

    padding: 40px 0 30px;
}

.knowledge-sidebar {
    position: sticky;
    top: 112px;

    padding: 16px;
    border: 1px solid #242a35;
    border-radius: 16px;
    background: rgba(14, 17, 24, .84);
}

.knowledge-sidebar-label {
    display: block;
    margin: 0 8px 10px;

    color: #687181;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.knowledge-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.knowledge-sidebar nav a {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;

    padding: 9px 10px;
    border-radius: 9px;

    color: #8e96a5;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.35;
}

.knowledge-sidebar nav a span {
    color: #5e6675;
    font-size: 9px;
}

.knowledge-sidebar nav a:hover,
.knowledge-sidebar nav a.active {
    background: #1a1f29;
    color: #fff;
}

.knowledge-sidebar nav a.active span {
    color: var(--red2);
}

.knowledge-toc {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #242a35;
}

.knowledge-toc nav a {
    display: block;
    padding: 7px 9px;
    font-size: 9px;
    font-weight: 600;
}

.knowledge-toc nav a.is-h3 {
    padding-left: 19px;
    color: #747d8d;
}

.knowledge-document {
    min-width: 0;
    max-width: 980px;

    padding: 34px 40px 50px;

    border: 1px solid #252b37;
    border-radius: 22px;
    background: #0e1219;

    color: #d4d9e2;
    font-size: 14px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.knowledge-document > :first-child {
    margin-top: 0 !important;
}

.knowledge-document > :last-child {
    margin-bottom: 0 !important;
}

.knowledge-document h2,
.knowledge-document h3,
.knowledge-document h4 {
    scroll-margin-top: 116px;
    color: #fff;
    font-family: Manrope, sans-serif;
    letter-spacing: -.025em;
}

.knowledge-document h2 {
    margin: 2em 0 .7em;
    padding-bottom: 12px;
    border-bottom: 1px solid #262c38;
    font-size: 30px;
    line-height: 1.18;
}

.knowledge-document h3 {
    margin: 1.7em 0 .55em;
    font-size: 22px;
    line-height: 1.25;
}

.knowledge-document h4 {
    margin: 1.5em 0 .5em;
    font-size: 17px;
}

.knowledge-document p {
    margin: .85em 0;
}

.knowledge-document ul,
.knowledge-document ol {
    margin: 1em 0;
    padding-left: 24px;
}

.knowledge-document li + li {
    margin-top: .35em;
}

.knowledge-document strong {
    color: #f3f5f8;
}

.knowledge-document a {
    color: #ff5963;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.knowledge-document blockquote {
    margin: 22px 0;
    padding: 14px 18px;

    border-left: 3px solid var(--red);
    background: #151a23;
    color: #bdc4cf;
}

.knowledge-document hr {
    height: 1px;
    margin: 30px 0;
    border: 0;
    background: #292f3b;
}

.knowledge-document table {
    width: 100%;
    margin: 24px 0;
    border-collapse: collapse;
    border: 1px solid #303744;
    font-size: 12px;
}

.knowledge-document th,
.knowledge-document td {
    padding: 11px 13px;
    border: 1px solid #303744;
    text-align: left;
    vertical-align: top;
}

.knowledge-document th {
    background: #171d27;
    color: #fff;
    font-weight: 800;
}

.knowledge-document tr:nth-child(even) td {
    background: rgba(255, 255, 255, .012);
}

.knowledge-document .wn-text-accent {
    color: #ff5963;
}

.knowledge-document .wn-text-muted {
    color: #818999;
}

.knowledge-document .wn-highlight {
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(226, 30, 43, .18);
    color: #fff;
}

.knowledge-document .wn-callout {
    margin: 22px 0;
    padding: 14px 17px;
    border: 1px solid #303744;
    border-radius: 12px;
    background: #141a23;
}

.knowledge-document .wn-callout p:first-child { margin-top: 0; }
.knowledge-document .wn-callout p:last-child { margin-bottom: 0; }
.knowledge-document .wn-callout-info { border-left: 3px solid #6e9cff; }
.knowledge-document .wn-callout-warning { border-left: 3px solid var(--red); }

.knowledge-document-empty {
    color: #747d8c;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .knowledge-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .knowledge-layout {
        grid-template-columns: 210px minmax(0, 1fr);
        gap: 24px;
    }

    .knowledge-document {
        padding: 28px;
    }
}

@media (max-width: 760px) {
    .knowledge-hero {
        min-height: 0;
        padding: 46px 0 34px;
    }

    .knowledge-hero h1 {
        font-size: clamp(48px, 16vw, 68px);
    }

    .knowledge-hero p {
        margin-top: 18px;
        font-size: 12px;
    }

    .knowledge-hero-mark {
        display: none;
    }

    .knowledge-directory {
        padding-top: 34px;
    }

    .knowledge-grid {
        grid-template-columns: 1fr;
    }

    .knowledge-card {
        min-height: 245px;
        padding: 22px;
        border-radius: 18px;
    }

    .knowledge-card h2 {
        font-size: 27px;
    }

    .knowledge-detail-head {
        padding: 34px 0 26px;
    }

    .knowledge-back {
        margin-bottom: 24px;
    }

    .knowledge-detail-title {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .knowledge-detail-title h1 {
        font-size: clamp(38px, 12vw, 56px);
    }

    .knowledge-meta {
        min-width: 0;
        width: 100%;
    }

    .knowledge-layout {
        grid-template-columns: 1fr;
        gap: 18px;
        padding-top: 24px;
    }

    .knowledge-sidebar {
        position: static;
        top: auto;
        padding: 12px;
    }

    .knowledge-sidebar > nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .knowledge-toc {
        display: none !important;
    }

    .knowledge-document {
        width: 100%;
        padding: 24px 20px 34px;
        border-radius: 18px;
        font-size: 13px;
        line-height: 1.72;
    }

    .knowledge-document h2 {
        font-size: 25px;
    }

    .knowledge-document h3 {
        font-size: 20px;
    }

    .knowledge-document table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 420px) {
    .knowledge-sidebar > nav {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Desktop departments — center incomplete 5-card row
   ============================================================ */

@media (min-width: 1101px) {
    .department-grid,
    .home-directory-section .department-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .department-grid > .department-card,
    .home-directory-section .department-grid > .department-card {
        grid-column: span 2;
    }

    /* Exactly five departments: center cards 4 and 5. */
    .department-grid > .department-card:nth-child(4):nth-last-child(2),
    .home-directory-section .department-grid > .department-card:nth-child(4):nth-last-child(2) {
        grid-column: 2 / span 2;
    }

    .department-grid > .department-card:nth-child(5):last-child,
    .home-directory-section .department-grid > .department-card:nth-child(5):last-child {
        grid-column: 4 / span 2;
    }
}
