/*
 * Оболочка портала: тёмно-синий header, футер, мобильный таб-бар.
 * Reference — 1fort.png (2.txt §19, §123).
 */

.shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.shell__main {
    flex: 1 0 auto;
    padding-bottom: var(--section-gap);
}

/* Header */

.header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--header-h);
    background: var(--brand-900);
    color: var(--text-on-brand);
    box-shadow: var(--shadow-header);
}

.header__inner {
    display: flex;
    align-items: center;
    gap: 28px;
    height: 100%;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header__logo-mark {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.header__logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.header__logo-top {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .22em;
    color: var(--text-on-brand-muted);
    text-transform: uppercase;
}

.header__logo-bottom {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .02em;
}

.header__nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: auto;
}

.header__link {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--text-on-brand-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}

.header__link:hover {
    background: rgba(255, 255, 255, .1);
    color: var(--text-on-brand);
}

.header__link--active {
    background: var(--primary);
    color: var(--text-on-brand);
}

.header__more {
    position: relative;
}

.header__more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 36px;
    padding: 0 10px 0 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-on-brand-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.header__more-btn:hover {
    background: rgba(255, 255, 255, .1);
    color: var(--text-on-brand);
}

.header__more-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 210px;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card-hover);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

.header__more--open .header__more-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header__more--open .header__more-btn {
    background: rgba(255, 255, 255, .1);
    color: var(--text-on-brand);
}

.header__more-link {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: var(--fs-sm);
    font-weight: 600;
}

.header__more-link:hover {
    background: var(--bg-soft);
    color: var(--primary);
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-brand);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .08);
    color: var(--text-on-brand);
    transition: background var(--transition);
}

.header__icon-btn:hover {
    background: rgba(255, 255, 255, .18);
}

.header__burger {
    display: none;
}

/* Выдвижное меню разделов (мобильный и планшет) */

.drawer {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.drawer[hidden] {
    display: none;
}

.drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, .45);
}

.drawer__panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    overflow-y: auto;
    background: var(--bg-card);
    box-shadow: var(--shadow-card-hover);
}

.drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.drawer__title {
    font-size: var(--fs-h3);
    font-weight: 800;
}

.drawer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
}

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

.drawer__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: 700;
}

.drawer__link:hover {
    background: var(--bg-soft);
    color: var(--primary);
}

.drawer__link--plain {
    font-weight: 600;
    color: var(--text-secondary);
}

.drawer__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: var(--radius-xs);
    background: var(--bg-soft);
    color: var(--primary);
}

.drawer__group-title {
    margin: 20px 0 8px 12px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

/* Footer */

.footer {
    flex-shrink: 0;
    background: var(--brand-900);
    color: var(--text-on-brand-muted);
    padding: 48px 0 32px;
}

.footer__top {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(0, 1fr));
    gap: 32px var(--gap);
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-brand);
}

.footer__brand-text {
    margin-top: 14px;
    font-size: var(--fs-sm);
    max-width: 30ch;
}

.footer__col-title {
    margin-bottom: 12px;
    color: var(--text-on-brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.footer__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer__link {
    font-size: var(--fs-sm);
    transition: color var(--transition);
}

.footer__link:hover {
    color: var(--text-on-brand);
}

.footer__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 24px;
    font-size: var(--fs-xs);
}

.footer__disclaimer {
    max-width: 72ch;
}

/* Мобильный таб-бар */

.tabbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.tabbar__list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: var(--tabbar-h);
}

.tabbar__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.tabbar__link--active {
    color: var(--primary);
}

@media (max-width: 1180px) {
    .header__nav {
        gap: 0;
    }

    .header__link {
        padding: 0 9px;
    }
}

@media (max-width: 1024px) {
    .header__nav,
    .header__more {
        display: none;
    }

    .header__burger {
        display: inline-flex;
        margin-right: auto;
    }

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

@media (max-width: 768px) {
    .tabbar {
        display: block;
    }

    .shell__main {
        padding-bottom: calc(var(--tabbar-h) + 16px);
    }

    .footer {
        padding: 32px 0 calc(var(--tabbar-h) + 24px);
    }

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

    .footer__brand {
        grid-column: 1 / -1;
    }
}
