/* ==========================================================================
   Atlas Security — Navigation
   Top bar, sticky header, desktop menu, mobile drawer and utilities.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Development banner
   -------------------------------------------------------------------------- */
.dev-bar {
    position: relative;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 7px 0;
    background: linear-gradient(90deg, var(--atlas-primary), var(--atlas-primary-dark));
    color: #0b0f14;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.dev-bar i {
    font-size: .7rem;
}

/* --------------------------------------------------------------------------
   2. Top bar
   -------------------------------------------------------------------------- */
.topbar {
    position: relative;
    z-index: 60;
    background: rgba(0, 0, 0, .34);
    border-bottom: 1px solid var(--atlas-line);
    font-size: .82rem;
    color: var(--atlas-text-soft);
}

[data-theme="light"] .topbar {
    background: var(--atlas-bg-alt);
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 44px;
}

.topbar__list {
    display: flex;
    align-items: center;
    gap: 26px;
    flex-wrap: wrap;
}

.topbar__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.topbar__item i {
    color: var(--atlas-primary);
}

.topbar a:hover {
    color: var(--atlas-primary);
}

.topbar__social {
    display: flex;
    gap: 10px;
}

.topbar__social a {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--atlas-line);
    font-size: .72rem;
    transition: all .3s var(--atlas-ease);
}

.topbar__social a:hover {
    background: var(--atlas-primary);
    border-color: var(--atlas-primary);
    color: #0b0f14;
    transform: translateY(-2px);
}

@media (max-width: 860px) {
    .topbar__list--secondary { display: none; }
    .topbar__inner { justify-content: center; }
}

/* --------------------------------------------------------------------------
   2. Header
   -------------------------------------------------------------------------- */
.atlas-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: transparent;
    transition: background-color .4s var(--atlas-ease), box-shadow .4s var(--atlas-ease),
                border-color .4s var(--atlas-ease), backdrop-filter .4s var(--atlas-ease);
    border-bottom: 1px solid transparent;
}

.atlas-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(8, 11, 16, .82);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    opacity: 0;
    transition: opacity .4s var(--atlas-ease);
    pointer-events: none;
}

[data-theme="light"] .atlas-header::before {
    background: rgba(255, 255, 255, .88);
}

.atlas-header.is-stuck {
    border-bottom-color: var(--atlas-line);
    box-shadow: 0 18px 40px -30px rgba(0, 0, 0, .9);
}

.atlas-header.is-stuck::before {
    opacity: 1;
}

.atlas-header__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: var(--atlas-header-h);
    flex-wrap: nowrap;
    transition: min-height .4s var(--atlas-ease);
}

.atlas-header.is-stuck .atlas-header__inner {
    min-height: 70px;
}

/* --------------------------------------------------------------------------
   3. Brand
   -------------------------------------------------------------------------- */
.header-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    flex: none;
}

/* Theme-aware logo: white + gold crest on dark, charcoal crest on light */
.logo-swap {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    line-height: 0;
}

.logo-swap > * {
    grid-area: 1 / 1;
    display: block;
    width: 100%;
    height: 100%;
}

.logo-swap picture,
.logo-swap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-swap__on-light {
    display: none !important;
}

[data-theme="light"] .logo-swap__on-dark {
    display: none !important;
}

[data-theme="light"] .logo-swap__on-light {
    display: block !important;
}

.header-brand .logo-swap {
    width: 44px;
    height: 44px;
}

.drawer__head .logo-swap {
    width: 42px;
    height: 42px;
}

.header-brand:hover .logo-swap {
    transform: rotate(-8deg) scale(1.05);
    transition: transform .5s var(--atlas-ease-out);
}

.header-brand__name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.06rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--atlas-heading);
    line-height: 1;
}

.header-brand__tag {
    display: block;
    font-size: .55rem;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--atlas-primary);
    margin-top: 6px;
}

/* --------------------------------------------------------------------------
   4. Desktop navigation
   -------------------------------------------------------------------------- */
.nav {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 13px;
    border-radius: var(--atlas-radius-pill);
    font-family: 'Outfit', sans-serif;
    font-size: .9rem;
    font-weight: 500;
    color: var(--atlas-text-soft);
    white-space: nowrap;
    transition: color .3s var(--atlas-ease), background-color .3s var(--atlas-ease);
}

.nav__link::after {
    content: '';
    position: absolute;
    left: 13px;
    right: 13px;
    bottom: 4px;
    height: 1.5px;
    background: var(--atlas-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .4s var(--atlas-ease-out);
}

.nav__link:hover,
.nav__link.is-active {
    color: var(--atlas-heading);
}

.nav__link:hover::after,
.nav__link.is-active::after {
    transform: scaleX(1);
}

.nav__link.is-active {
    color: var(--atlas-primary);
}

/* --------------------------------------------------------------------------
   5. Header actions
   -------------------------------------------------------------------------- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    flex-wrap: nowrap;
}

.theme-toggle {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--atlas-line);
    color: var(--atlas-text-soft);
    transition: all .3s var(--atlas-ease);
}

.theme-toggle:hover {
    border-color: var(--atlas-primary);
    color: var(--atlas-primary);
    transform: rotate(-18deg);
}

.theme-toggle .fa-sun { display: none; }
[data-theme="light"] .theme-toggle .fa-sun { display: inline-block; }
[data-theme="light"] .theme-toggle .fa-moon { display: none; }

/* --------------------------------------------------------------------------
   5b. Language switcher
   -------------------------------------------------------------------------- */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: var(--atlas-radius-pill);
    border: 1px solid var(--atlas-line);
    background: var(--atlas-surface);
}

.lang-switch__link {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--atlas-radius-pill);
    font-family: 'Outfit', sans-serif;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--atlas-muted);
    transition: color .3s var(--atlas-ease), background-color .3s var(--atlas-ease);
}

.lang-switch__link:hover {
    color: var(--atlas-heading);
    background: rgba(var(--atlas-primary-rgb), .12);
}

.lang-switch__link.is-active {
    background: var(--atlas-gradient);
    color: #0b0f14;
    box-shadow: 0 6px 16px -8px rgba(var(--atlas-primary-rgb), .9);
}

.header-phone {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: var(--atlas-radius-pill);
    border: 1px solid var(--atlas-line);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: .92rem;
    color: var(--atlas-text);
    transition: all .3s var(--atlas-ease);
}

.header-phone i {
    color: var(--atlas-primary);
}

.header-phone:hover {
    border-color: var(--atlas-primary);
    background: rgba(var(--atlas-primary-rgb), .1);
}

/* --------------------------------------------------------------------------
   6. Mobile drawer
   -------------------------------------------------------------------------- */
.nav-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid var(--atlas-line);
    place-items: center;
    color: var(--atlas-heading);
}

.nav-toggle__bars {
    position: relative;
    width: 20px;
    height: 14px;
}

.nav-toggle__bars span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .35s var(--atlas-ease-out), opacity .25s var(--atlas-ease);
}

.nav-toggle__bars span:nth-child(1) { top: 0; }
.nav-toggle__bars span:nth-child(2) { top: 6px; }
.nav-toggle__bars span:nth-child(3) { top: 12px; }

.nav-toggle.is-open .nav-toggle__bars span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-open .nav-toggle__bars span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open .nav-toggle__bars span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.drawer {
    position: fixed;
    inset: 0;
    z-index: 999;
    visibility: hidden;
    pointer-events: none;
}

.drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 5, 8, .68);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity .4s var(--atlas-ease);
}

.drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(400px, 88vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 26px 26px 40px;
    background: var(--atlas-bg);
    border-left: 1px solid var(--atlas-line);
    transform: translateX(100%);
    transition: transform .5s var(--atlas-ease-out);
    overflow-y: auto;
}

.drawer.is-open {
    visibility: visible;
    pointer-events: auto;
}

.drawer.is-open .drawer__backdrop {
    opacity: 1;
}

.drawer.is-open .drawer__panel {
    transform: translateX(0);
}

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

.drawer__close {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--atlas-line);
    color: var(--atlas-text);
    transition: all .3s var(--atlas-ease);
}

.drawer__close:hover {
    background: var(--atlas-primary);
    color: #0b0f14;
    border-color: var(--atlas-primary);
}

.drawer__nav {
    display: grid;
    gap: 4px;
}

.drawer__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 4px;
    border-bottom: 1px solid var(--atlas-line);
    font-family: 'Outfit', sans-serif;
    font-size: 1.12rem;
    font-weight: 600;
    color: var(--atlas-text-soft);
    opacity: 0;
    transform: translateX(-16px);
    transition: color .3s var(--atlas-ease), opacity .4s var(--atlas-ease-out), transform .4s var(--atlas-ease-out);
}

.drawer.is-open .drawer__link {
    opacity: 1;
    transform: translateX(0);
}

.drawer__link i {
    font-size: .7rem;
    opacity: .5;
    transition: transform .3s var(--atlas-ease);
}

.drawer__link:hover {
    color: var(--atlas-primary);
}

.drawer__link:hover i {
    transform: translateX(5px);
}

.drawer__link.is-active {
    color: var(--atlas-primary);
}

.drawer__footer {
    margin-top: auto;
    display: grid;
    gap: 18px;
}

.drawer__contact {
    display: grid;
    gap: 10px;
    padding: 20px;
    border-radius: var(--atlas-radius);
    background: var(--atlas-surface);
    border: 1px solid var(--atlas-line);
}

.drawer__lang {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--atlas-radius);
    border: 1px solid var(--atlas-line);
    background: var(--atlas-surface);
}

.drawer__lang-label {
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--atlas-muted);
}

.lang-switch--drawer {
    border-color: transparent;
    background: transparent;
    padding: 0;
}

.lang-switch--drawer .lang-switch__link {
    min-width: auto;
    padding: 0 12px;
}

.drawer__contact a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: .95rem;
    color: var(--atlas-text-soft);
}

.drawer__contact i {
    color: var(--atlas-primary);
}

/* --------------------------------------------------------------------------
   7. Scroll progress
   -------------------------------------------------------------------------- */
.scroll-progress {
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 2px;
    width: 0;
    background: var(--atlas-gradient);
    z-index: 2;
    transition: width .12s linear;
}

/* --------------------------------------------------------------------------
   8. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .header-phone { display: none; }
}

@media (max-width: 1024px) {
    .nav { display: none; }
    .nav-toggle { display: grid; }
}

@media (max-width: 940px) {
    .header-actions .btn { display: none; }
}

@media (max-width: 860px) {
    /* Only the header switcher is hidden — the drawer keeps its own */
    .header-actions .lang-switch { display: none; }
}

@media (max-width: 480px) {
    .theme-toggle { display: none; }
}
