:root {
    --site-header-main-height: 76px;
    --social-row-height: 0px;
    --global-header-height: calc(
        var(--site-header-main-height) + var(--social-row-height)
    );
    --active-top-banner-height: 0px;
    --active-bottom-banner-height: 0px;
    --header-line: #35312d;
    --header-text: #f2efeb;
    --header-muted: #c8c1ba;
    --header-surface: #171615;
}

.has-podcast-socials {
    --social-row-height: 52px;
}

[data-theme="light"] {
    --header-line: #d7d0c9;
    --header-text: #201d1a;
    --header-muted: #625b54;
    --header-surface: #f2eee9;
}

body.has-banner-top {
    --active-top-banner-height: 100px;
}

body.has-banner-bottom {
    --active-bottom-banner-height: 100px;
}

body {
    padding-bottom: var(--active-bottom-banner-height);
}

.site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 120;
    height: var(--global-header-height);
    border-bottom: 1px solid var(--header-line);
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    backdrop-filter: blur(16px);
}

.site-header-inner {
    width: min(1180px, calc(100% - 40px));
    height: var(--site-header-main-height);
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(205px, 1fr) auto minmax(205px, 1fr);
    align-items: center;
    gap: 28px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    color: var(--header-text);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 750;
    text-transform: uppercase;
}

.site-brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.site-main-nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

.site-main-nav a {
    position: relative;
    padding: 8px 0;
    color: var(--header-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 650;
}

.site-main-nav a::after {
    content: "";
    position: absolute;
    inset: auto 0 2px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 180ms ease;
}

.site-main-nav a:hover,
.site-main-nav a[aria-current="page"] {
    color: var(--header-text);
}

.site-main-nav a:hover::after,
.site-main-nav a:focus-visible::after,
.site-main-nav a[aria-current="page"]::after {
    transform: scaleX(1);
    transform-origin: left;
}

.site-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.site-header-button {
    min-height: 44px;
    max-width: 150px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--header-line);
    border-radius: 4px;
    background: transparent;
    color: var(--header-text);
    font-size: 0.82rem;
    font-weight: 750;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.site-header-button:hover {
    border-color: var(--accent);
    background: var(--header-surface);
    transform: translateY(-1px);
}

.site-icon-button {
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid var(--header-line);
    border-radius: 50%;
    background: transparent;
    color: var(--header-text);
    cursor: pointer;
    font-size: 1rem;
}

.site-icon-button:hover {
    border-color: var(--accent);
    background: var(--header-surface);
}

.site-menu-button {
    display: none;
}

.site-header :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.podcast-social-row {
    height: var(--social-row-height);
    display: flex;
    align-items: center;
    overflow: hidden;
    border-top: 1px solid var(--header-line);
    background: var(--header-surface);
}

.podcast-social-row .social-links-container {
    width: min(1180px, calc(100% - 40px));
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.podcast-social-row .social-links-container::-webkit-scrollbar {
    display: none;
}

.podcast-social-row .social-link {
    min-height: 36px;
    padding: 3px 9px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--header-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.podcast-social-row .social-link:hover {
    border-color: var(--header-line);
    background: var(--bg-primary);
    color: var(--header-text);
    opacity: 1;
    transform: none;
}

.podcast-social-row .social-icon,
.podcast-social-row .social-text-icon {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    object-fit: contain;
}

.social-link-label {
    white-space: nowrap;
}

.main-container {
    min-height: calc(
        100vh - var(--global-header-height) -
        var(--active-top-banner-height) -
        var(--active-bottom-banner-height)
    );
}

.sidebar {
    top: calc(var(--global-header-height) + var(--active-top-banner-height));
    height: calc(
        100vh - var(--global-header-height) -
        var(--active-top-banner-height) -
        var(--active-bottom-banner-height)
    );
}

.content {
    margin-top: calc(var(--global-header-height) + var(--active-top-banner-height));
    min-height: calc(
        100vh - var(--global-header-height) -
        var(--active-top-banner-height) -
        var(--active-bottom-banner-height)
    );
}

.ad-banner-top {
    top: var(--global-header-height);
}

.ad-banner-left,
.ad-banner-right {
    top: calc(var(--global-header-height) + var(--active-top-banner-height));
    bottom: var(--active-bottom-banner-height);
}

@media (max-width: 980px) {
    .site-header-inner {
        grid-template-columns: 1fr auto;
    }

    .site-main-nav {
        position: absolute;
        inset: var(--global-header-height) 0 auto;
        padding: 18px 20px 22px;
        display: none;
        align-items: stretch;
        flex-direction: column;
        gap: 4px;
        border-bottom: 1px solid var(--header-line);
        background: var(--bg-primary);
        box-shadow: 0 16px 32px var(--shadow);
    }

    .site-main-nav.open {
        display: flex;
    }

    .site-main-nav a {
        padding: 12px;
        border-bottom: 1px solid var(--header-line);
    }

    .site-main-nav a:last-child {
        border-bottom: 0;
    }

    .site-main-nav a::after {
        display: none;
    }

    .site-menu-button {
        display: grid;
    }
}

@media (max-width: 768px) {
    :root {
        --site-header-main-height: 68px;
    }

    .has-podcast-socials {
        --social-row-height: 48px;
    }

    body.has-banner-top {
        --active-top-banner-height: 60px;
    }

    body.has-banner-bottom {
        --active-bottom-banner-height: 60px;
    }

    .site-header-inner {
        width: calc(100% - 28px);
        gap: 10px;
    }

    .podcast-social-row .social-links-container {
        width: calc(100% - 20px);
        justify-content: flex-start;
    }

    .podcast-social-row .social-link {
        min-height: 34px;
        padding-inline: 7px;
    }

    .podcast-social-row .social-icon,
    .podcast-social-row .social-text-icon {
        width: 26px;
        height: 26px;
    }

    .site-brand {
        gap: 8px;
        font-size: 0.7rem;
    }

    .site-brand img {
        width: 38px;
        height: 38px;
    }

    .site-header .site-admin-link {
        display: none !important;
    }

    .site-account-link {
        max-width: 94px;
        min-height: 38px;
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    .site-icon-button {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .site-header-actions {
        gap: 8px;
    }

    .sidebar {
        top: var(--global-header-height);
        height: 52px;
        min-height: 52px;
    }

    .search-container {
        top: calc(var(--global-header-height) + 52px);
    }

    .content {
        margin-top: calc(
            var(--global-header-height) + 132px +
            var(--active-top-banner-height)
        );
        min-height: 0;
        max-height: calc(
            100vh - var(--global-header-height) - 52px -
            var(--active-bottom-banner-height)
        );
    }

    .ad-banner-top {
        top: calc(var(--global-header-height) + 112px);
    }

    .ad-banner-left,
    .ad-banner-right {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .site-header-inner {
        width: calc(100% - 20px);
        gap: 6px;
    }

    .site-brand {
        white-space: nowrap;
    }

    .site-account-link {
        max-width: 94px;
        padding-inline: 8px;
    }
}
