@import url('theme.css');
@import url('site-header-strip.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}
.bg-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background: var(--bg);
}
.bg-mesh {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 55% 45% at 15% 10%, var(--warm-amber), transparent 55%),
        radial-gradient(ellipse 45% 40% at 85% 90%, var(--accent-glow), transparent 50%);
}
.bg-dots {
    position: absolute;
    inset: 0;
    opacity: .32;
    background-image: radial-gradient(rgba(232, 176, 96, .35) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, #000 10%, transparent 70%);
}
html, body { min-height: 100%; }
.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
header.site-header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 44px;
    background: var(--bg-header);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    z-index: 30;
    flex-wrap: wrap;
}
.pill-nav-container { position: relative; z-index: 100; flex: 1; min-width: 0; }
.pill-nav {
    position: relative;
    z-index: 1001;
    --nav-h: 44px;
    --pill-pad-x: 16px;
    --pill-gap: 3px;
    width: max-content;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pill-nav-items {
    display: flex;
    align-items: center;
    height: var(--nav-h);
    background: var(--nav-base);
    border-radius: 9999px;
    border: 1px solid var(--accent-border);
}
.pill-logo {
    width: var(--nav-h);
    height: var(--nav-h);
    border-radius: 50%;
    background: var(--nav-base);
    border: 1px solid var(--accent-dim);
    padding: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    text-decoration: none;
}
.pill-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pill-list { list-style: none; display: flex; gap: var(--pill-gap); margin: 0; padding: 3px; height: 100%; }
.pill-list > li { display: flex; height: 100%; }
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 var(--pill-pad-x);
    background: var(--pill-bg);
    color: var(--pill-text);
    text-decoration: none;
    border-radius: 9999px;
    font-weight: 600;
    font-size: .78rem;
    line-height: 1;
    letter-spacing: .04em;
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}
.pill .hover-circle {
    position: absolute;
    left: 50%;
    bottom: 0;
    border-radius: 50%;
    background: var(--hover-fill);
    z-index: 1;
    pointer-events: none;
    will-change: transform;
}
.pill .label-stack { position: relative; display: inline-block; line-height: 1; z-index: 2; }
.pill .pill-label, .pill .pill-label-hover { display: inline-block; line-height: 1; will-change: transform; }
.pill .pill-label-hover {
    position: absolute;
    left: 0;
    top: 0;
    color: var(--hover-text);
    z-index: 3;
    opacity: 0;
}
.pill.is-active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--nav-base);
    border-radius: 50px;
    z-index: 4;
}
.desktop-only { display: block; }
.mobile-only { display: none; }
.mobile-menu-button {
    width: var(--nav-h);
    height: var(--nav-h);
    border-radius: 50%;
    background: var(--nav-base);
    border: 1px solid var(--accent-dim);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 1002;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.hamburger-line {
    position: absolute;
    left: 50%;
    width: 18px;
    height: 2px;
    margin-left: -9px;
    margin-top: -1px;
    background: var(--pill-bg);
    border-radius: 1px;
    transform-origin: center center;
    transition: transform .3s ease, top .3s ease;
}
.hamburger-line:nth-child(1) { top: calc(50% - 5px); }
.hamburger-line:nth-child(2) { top: calc(50% + 5px); }
.mobile-menu-button.is-open .hamburger-line:nth-child(1),
.mobile-menu-button.is-open .hamburger-line:nth-child(2) { top: 50%; transform: rotate(45deg); }
.mobile-menu-button.is-open .hamburger-line:nth-child(2) { transform: rotate(-45deg); }
.mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 6, 6, .82);
    z-index: 997;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
}
.mobile-menu-backdrop.is-open { opacity: 1; visibility: visible; pointer-events: auto; }
.mobile-menu-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: max-content;
    min-width: 200px;
    max-width: min(240px, calc(100vw - 24px));
    z-index: 1100;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: transform .28s ease, visibility .28s ease;
}
.mobile-menu-popover.is-open { visibility: visible; pointer-events: auto; transform: translateY(0); }
.mobile-menu-inner {
    background: var(--menu-solid);
    border: 1px solid var(--accent-border);
    border-radius: 22px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .65);
    padding: 10px;
}
.mobile-menu-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; }
.mobile-menu-link {
    display: block;
    padding: 14px 20px;
    color: var(--pill-text);
    background: var(--pill-bg);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 700;
    border-radius: 50px;
    font-family: inherit;
    border: 1px solid var(--accent-border-strong);
}
.mobile-menu-link.is-active { background: var(--accent); border-color: var(--pill-text); }
.lang-toggle { display: flex; gap: 6px; flex-shrink: 0; }
.lang-btn {
    border: 1px solid rgba(255, 255, 255, .12);
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.lang-btn.active { background: var(--pill-bg); color: var(--pill-text); }
.content {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 44px 56px;
    flex: 1;
    width: 100%;
}
.content.content-wide { max-width: 1200px; }
footer {
    text-align: center;
    padding: 28px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: .82rem;
    margin-top: auto;
}
.lang-en, .lang-ru { display: none !important; }
.lang-en.is-visible, .lang-ru.is-visible { display: block !important; }
.post-nav .lang-en.is-visible,
.post-nav .lang-ru.is-visible,
.post-meta .lang-en.is-visible,
.post-meta .lang-ru.is-visible { display: inline !important; }
.post-article h1 .lang-en.is-visible,
.post-article h1 .lang-ru.is-visible { display: block !important; }
@media (max-width: 768px) {
    .pill-nav { width: 100%; justify-content: space-between; }
    .desktop-only { display: none; }
    .mobile-only { display: flex; }
    .mobile-menu-button { display: flex; margin-left: auto; }
    .pill-nav-container { width: 100%; }
    .mobile-menu-popover { position: fixed; top: 0; right: 0; left: auto; }
    header.site-header { padding: 12px 18px; }
    .content { padding: 32px 18px 40px; }
}
@media (max-width: 640px) {
    header.site-header {
        flex-wrap: wrap;
        align-items: center;
        padding: 12px 16px;
        gap: 10px;
    }
    .pill-nav-container { flex: 1 1 100%; width: 100%; min-width: 0; }
    .lang-toggle {
        flex: 1 1 auto;
        margin-left: auto;
        justify-content: flex-end;
    }
}
