/* ================================================
   LinQo — Premium Slim Navigation
   ================================================ */

/* ---- Header Base ---- */
.linqo-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* Немного увеличиваем шапку, чтобы вместить крупный логотип */
    height: 100px; 
    z-index: 1000;
    overflow: visible; /* Let dropdowns show outside header bounds */
    
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    
    display: flex; /* Fallback/Mobile layout */
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px; 
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Canvas for circuit trace animation — clip strictly to header bounds */
.header__bg-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    clip-path: inset(0);
    max-height: 100%;
}
.linqo-header__logo-container {
    display: flex;
    align-items: center;
}

.linqo-header__main-logo {
    /* Neon hit effect variables (set by JS) */
    --neon-glow: 0;
    --neon-color: rgba(15, 204, 211, 0.8);
    /* Original brightness + glow */
    filter: brightness(calc(1.1 + var(--neon-glow) * 0.4)) 
            drop-shadow(0 0 calc(1px + var(--neon-glow) * 15px) var(--neon-color));
    transition: filter 0.2s ease, transform 0.2s ease;
    /* Fill header height edge-to-edge with ~2px padding */
    height: 96px;
    width: auto;
    object-fit: contain;
}



/* Container for all navigation pills */
.nav-pills-wrap {
    position: relative;
    z-index: 5;
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 24px;
}

/* Logo in navigation (shown on scroll via JS) */
.nav-logo {
    display: none;
    align-items: center;
    margin-right: 8px;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    text-decoration: none;
}

.nav-logo__img {
    height: 28px;
    width: auto;
    filter: brightness(1.1);
}

/* Mobile logo inside hamburger menu */
.nav-mobile-logo {
    height: 32px;
    width: auto;
    margin-bottom: 16px;
    filter: brightness(1.1);
}

/* When nav is in scrolled/fixed state */
.nav-pills-wrap.scrolled .nav-logo {
    display: flex;
    opacity: 1;
    transform: translateX(0);
}

/* ---- Nav pills ---- */
.nav-pill {
    pointer-events: auto;
    padding: 8px 18px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    white-space: nowrap;
    position: relative;
}

.nav-pill:hover {
    color: var(--teal-dark);
    background: var(--bg-body);
    border-color: var(--teal-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.nav-pill.active {
    color: var(--teal-dark);
    border-color: var(--teal);
    background: rgba(0, 180, 216, 0.04);
}

.nav-pill.glow {
    border-color: rgba(0, 180, 216, 0.3);
    color: var(--teal-dark);
}

/* ---- Download CTA ---- */
.nav-pill--download {
    background: linear-gradient(135deg, rgba(15, 204, 211, 0.18), rgba(15, 204, 211, 0.06));
    border-color: rgba(15, 204, 211, 0.5);
    color: #0FCCD3;
    font-weight: 600;
    animation: cta-pulse 3s ease-in-out infinite;
}

.nav-pill--download:hover {
    background: linear-gradient(135deg, rgba(15, 204, 211, 0.3), rgba(15, 204, 211, 0.12));
    border-color: rgba(15, 204, 211, 0.9);
    box-shadow: 0 0 24px rgba(15, 204, 211, 0.5), 0 0 50px rgba(15, 204, 211, 0.12);
    color: #fff;
    transform: translateY(-1px);
}

@keyframes cta-pulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(15, 204, 211, 0.15);
    }

    50% {
        box-shadow: 0 0 20px rgba(15, 204, 211, 0.35), 0 0 40px rgba(15, 204, 211, 0.1);
    }
}

/* ---- Nav groups: inline with logo ---- */
.nav-left {
    position: relative;
    z-index: 5;
    margin-left: 24px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.nav-right {
    position: relative;
    z-index: 5;
    margin-left: auto;
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ---- Mobile fullscreen menu ---- */
.nav-mobile-menu {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 999;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    
    /* Animation base */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
}

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

.nav-mobile-menu .nav-pill {
    font-size: 16px;
    padding: 14px 36px;
    width: 100%;
    max-width: 280px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.nav-mobile-menu.open .nav-pill {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger the entrance of menu items */
.nav-mobile-menu.open .nav-pill:nth-child(3) { transition-delay: 0.1s; }
.nav-mobile-menu.open .nav-pill:nth-child(4) { transition-delay: 0.15s; }
.nav-mobile-menu.open .nav-pill:nth-child(5) { transition-delay: 0.2s; }
.nav-mobile-menu.open .nav-pill:nth-child(6) { transition-delay: 0.25s; }
.nav-mobile-menu.open .nav-pill:nth-child(7) { transition-delay: 0.3s; }
.nav-mobile-menu.open .nav-pill:nth-child(8) { transition-delay: 0.35s; }
.nav-mobile-menu.open .nav-pill--download { transition-delay: 0.4s; }

.nav-mobile-menu .nav-pill:hover {
    background: var(--bg-body);
    border-color: var(--teal);
    color: var(--teal-dark);
    transform: translateY(-2px);
}

.nav-mobile-menu .nav-pill--download {
    border-color: rgba(15, 204, 211, 0.5);
    background: linear-gradient(135deg, rgba(15, 204, 211, 0.18), rgba(15, 204, 211, 0.06));
}

.nav-mobile-menu .mobile-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-main);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.nav-mobile-menu .mobile-close:hover {
    background: var(--bg-body);
    color: var(--teal);
    transform: rotate(90deg);
}

/* Mobile language switcher inside hamburger menu */
.lang-switch--mobile {
    position: relative;
    z-index: 10;
}

.lang-switch--mobile .lang-switch__dropdown--mobile {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-main);
    border-radius: 12px;
    padding: 8px 0;
    display: none;
    box-shadow: var(--shadow-elevated);
}

.lang-switch--mobile .lang-switch__dropdown--mobile.open {
    display: block;
}

/* ---- Language pill ---- */
.nav-pill--lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
}

.nav-pill--lang svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.nav-pill--lang .chevron {
    width: 10px;
    height: 10px;
}

/* Lang dropdown */
.lang-switch {
    position: relative;
}

.lang-switch__dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-main);
    border-radius: 12px;
    padding: 6px;
    min-width: 100px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
}

.lang-switch__dropdown.open {
    display: block;
}

.lang-switch__dropdown button {
    display: block;
    width: 100%;
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.lang-switch__dropdown button:hover,
.lang-switch__dropdown button.active {
    background: rgba(0, 180, 216, 0.1);
    color: var(--teal-dark);
}

/* ---- Mobile hamburger ---- */
.nav__toggle {
    display: none;
    position: relative;
    z-index: 10;
    margin-left: auto;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-main);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.nav__toggle-line {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav__toggle.active .nav__toggle-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav__toggle.active .nav__toggle-line:nth-child(2) {
    opacity: 0;
}

.nav__toggle.active .nav__toggle-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---- Sticky download bar ---- */
.sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 900;
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.08);
}

.sticky-bar.visible {
    transform: translateY(0);
    opacity: 1;
}

.sticky-bar__text {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.sticky-bar__text strong {
    color: var(--teal-dark);
}

/* ================================================
   Responsive Breakpoints
   ================================================ */
/* Collapse to mobile menu before the capsules get squeezed (padding + words = needs ~1000px width min) */
@media (max-width: 1023px) {
    .linqo-header {
        height: 70px; 
        min-height: 70px;
        padding: 0 24px;
        justify-content: center; /* Center logo properly */
    }

    .linqo-header__main-logo {
        height: 66px; /* 70px header - 4px padding */
        width: auto;
    }

    .linqo-header::after {
        display: none; 
    }

    .nav__toggle {
        display: flex;
        position: absolute;
        right: 24px;
        top: 50%;
        transform: translateY(-50%);
    }

    .nav-pills-wrap,
    .nav-column--left,
    .nav-column--right {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .linqo-header {
        height: 100px; /* Reduced from 180 to keep it manageable but big enough for logo */
        min-height: 80px;
        border-bottom: none; /* Make it feel seamless */
    }
    
    .linqo-header__main-logo {
        height: 96px; /* 100px header - 4px padding */
        width: auto;
    }
}

/* ================================================
   Desktop Slim Component Layout
   ================================================ */
@media (min-width: 1024px) {
    .linqo-header {
        display: grid;
        /* Жесткая сетка: равные боковые колонки (каждая берет 1 фракцию пространства) и центральный логотип (по контенту) */
        grid-template-columns: 1fr auto 1fr;
        gap: 20px;
        align-items: stretch; /* Растягиваем на всю высоту для позиционирования внутри */
        padding: 0 40px; 
    }

    /* Уменьшаем капсулы для шапки и готовим их к физике неонов */
    .linqo-header .nav-pill {
        padding: 6px 14px;
        font-size: 0.85rem;
        height: 32px;
        border-radius: 16px;
        background: var(--bg-card);
        border: 1px solid var(--border-main);
        
        /* CSS-переменная, которой будет управлять JS при попадании неона */
        --neon-glow: 0;
        /* При попадании бегунка: мягкое свечение */
        color: color-mix(in srgb, var(--text-muted), var(--neon-color, rgba(0, 180, 216, 1)) calc(var(--neon-glow) * 60%));
        text-shadow: 0 0 calc(var(--neon-glow) * 8px) var(--neon-color, rgba(0, 180, 216, 0.5));
        background: color-mix(in srgb, var(--bg-card), var(--neon-color, rgba(0, 180, 216, 1)) calc(var(--neon-glow) * 6%));
        box-shadow: 0 0 calc(var(--neon-glow) * 12px) var(--neon-color, rgba(0, 180, 216, 0.15));
        border-color: color-mix(in srgb, var(--border-main), var(--neon-color, rgba(0, 180, 216, 1)) calc(var(--neon-glow) * 70%));
        
        transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    }

    /* Пользовательский hover-эффект для капсул */
    .linqo-header .nav-pill:not(.nav-pill--lang):hover {
        background: var(--bg-body); 
        border-color: var(--teal);
        color: var(--teal-dark);
        box-shadow: var(--shadow-sm);
    }

    .linqo-header .btn--header {
        height: 32px;
        padding: 0 16px;
        font-size: 0.85rem;
        display: inline-flex;
        align-items: center;
        border-radius: 16px;
    }

    .nav-column {
        position: relative;
        height: 100%;
        width: 100%;
    }

    /* Left column */
    .nav-column--left {
        display: flex;
        align-items: flex-end; /* Опускаем капсулы вниз */
        justify-content: center; /* Центрируем в рамках своей колонки */
        padding-bottom: 12px; /* Отступ от низа уменьшен, чтобы опустить капсулы ниже */
    }
    
    .nav-column--left .nav-pills-wrap--left {
        display: flex;
        flex-wrap: nowrap;
        white-space: nowrap;
        gap: 24px; /* Равномерный гармоничный отступ между капсулами */
    }

    /* Center logo */
    .linqo-header__logo-container {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%; /* take all available central space */
    }

    /* Right column */
    .nav-column--right {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end; /* Все элементы прижимаем к низу */
        height: 100%;
        gap: 20px; /* Добавляем расстояние между капсулами и действиями */
    }

    /* Right column pills */
    .nav-column--right .nav-pills-wrap--right {
        display: flex;
        flex-wrap: nowrap;
        white-space: nowrap;
        align-items: flex-end; /* Опускаем капсулы вниз */
        justify-content: flex-end; /* Прижимаем к правому краю (к действиям) */
        gap: 24px; /* Равномерный гармоничный отступ между капсулами */
        padding-bottom: 12px; /* Вровень с левыми капсулами */
        flex: 1; /* Оставшееся место занято капсулами */
    }

    /* Right column actions (Lang & Download) */
    .nav-column--right .nav-actions {
        position: relative;
        z-index: 5;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        gap: 10px;
        align-items: flex-end;
        padding-bottom: 12px;
        flex-shrink: 0;
    }

    .linqo-header .nav-logo {
        display: none !important;
    }
}

/* Compact layout — covers MacBook 13" (1440px) and similar screens */
@media (min-width: 1024px) and (max-width: 1599px) {
    .linqo-header {
        padding: 0 20px;
        gap: 10px;
    }
    .linqo-header__main-logo {
        height: 72px;
    }
    .nav-column--left .nav-pills-wrap--left,
    .nav-column--right .nav-pills-wrap--right {
        gap: 8px;
        overflow: hidden;
        min-width: 0; /* Allow flex items to shrink below content size */
    }
    .linqo-header .nav-pill {
        padding: 5px 10px;
        font-size: 0.78rem;
    }
    .nav-column--right {
        gap: 8px;
    }
    /* Clip left pills, but NOT right column (actions must stay visible) */
    .nav-column--left {
        overflow: hidden;
    }
    /* Never shrink the action buttons (EN/Download) */
    .nav-column--right .nav-actions {
        flex-shrink: 0;
    }
}

/* Ultra-compact: hide least important pills on narrower desktops */
@media (min-width: 1024px) and (max-width: 1399px) {
    .nav-pills-wrap--right .nav-pill:last-child,
    .nav-pills-wrap--left .nav-pill:last-child {
        display: none;
    }
}