/* =========================================================
   ABS Global — shared navigation (every page)
   - Desktop spacing for the 11-item menu + CTA
   - Mobile sidebar (panel head, links, CTA, contact block,
     social links, backdrop) — extras are built by main.js
   Loaded after style.css on all pages.
   ========================================================= */

/* ---------- Desktop spacing (11 items) ---------- */
@media (min-width: 1024px) {
  .nav__list { gap: 0; }
  .nav__link { padding-inline: 10px; }
}
@media (min-width: 1024px) and (max-width: 1319px) {
  .header__inner { gap: 8px; }
  .nav__link { padding-inline: 3px; font-size: .85rem; }
}
/* The language switcher + divider add ~94px to the header. Tighten the
   desktop spacing on wide screens so the 11-item menu still fits inside
   the 1240px container without horizontal overflow. */
@media (min-width: 1320px) {
  .header__inner { gap: 14px; }
  .nav__link { padding-inline: 8px; }
  .header__actions { gap: 8px; }
}

/* ---------- Sidebar parts (built by main.js — hidden on desktop) ---------- */
.nav__panel-head,
.nav__aside { display: none; }

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1290;
  background: rgba(6, 18, 33, .52);
  opacity: 0;
  visibility: hidden;
  transition: opacity .32s var(--ease), visibility .32s;
}
.nav-backdrop.is-shown { opacity: 1; visibility: visible; }

/* ---------- Mobile sidebar ---------- */
/* Collapse the header a little earlier than the rest of the page: with the
   language switcher, the 11-item desktop menu needs ~1076px of content width,
   which no longer fits the container between 1041px and 1160px. */
@media (max-width: 1160px) {
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    z-index: 1300;
    display: none;
    flex-direction: column;
    width: min(374px, 88vw);
    min-height: 0;
    max-height: none;
    padding: 0 0 max(24px, env(safe-area-inset-bottom, 0px));
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: -34px 0 80px -30px rgba(6, 20, 36, .55);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(103%);
    transition: transform .42s var(--ease);
    transition: transform .42s var(--ease), display .42s allow-discrete;
  }
  .nav.is-open { display: flex; transform: none; }
  @starting-style {
    .nav.is-open { transform: translateX(103%); }
  }

  /* The sticky header's backdrop-filter both blurs and — more importantly —
     makes the header a containing block + stacking context for its fixed
     descendants. On mobile we drop the blur (the header background is
     ~opaque anyway) so the panel/backdrop can position against the real
     viewport, and we lift the header while the sidebar is open so they
     paint above the topbar (61) and fab (70) layers. */
  .header {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  body.nav-open .header { z-index: 1400; }

  .nav__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 15px 18px;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }
  .nav__panel-brand { display: inline-flex; align-items: center; }
  .nav__panel-brand img { height: 34px; width: auto; display: block; }
  .nav__close {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s, transform .25s var(--ease);
  }
  .nav__close:hover {
    background: var(--brand-50);
    border-color: var(--brand-200);
    color: var(--brand-700);
    transform: rotate(90deg);
  }
  .nav__close svg { width: 18px; height: 18px; }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 14px 14px 0;
  }
  .nav__link {
    padding: 13px 14px;
    border: 0;
    border-radius: 12px;
    font-size: .96rem;
    font-weight: 500;
    color: var(--ink);
  }
  .nav__link.is-active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
  .nav__cta-mobile { display: block; margin: 16px 14px 2px; }
  .nav-toggle { display: flex; }
  .header__cta { display: none; }

  .nav__aside {
    display: grid;
    gap: 9px;
    margin-top: auto;
    padding: 20px 18px 4px;
    border-top: 1px solid var(--line);
  }
  .nav__aside-title {
    margin: 0 0 3px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .nav__aside-item {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: .86rem;
    font-weight: 500;
    color: var(--ink-2);
    transition: color .2s;
  }
  .nav__aside-item:hover { color: var(--brand-700); }
  .nav__aside-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 11px;
    background: var(--brand-50);
    color: var(--brand);
  }
  .nav__aside-icon svg { width: 16px; height: 16px; }
  .nav__aside-social { display: flex; gap: 8px; margin-top: 9px; }
  .nav__aside-social a {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--ink-2);
    transition: background .2s, border-color .2s, color .2s;
  }
  .nav__aside-social a:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
  .nav__aside-social svg { width: 16px; height: 16px; }
}

/* ---------- Language switcher ---------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: .8rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .03em;
  white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.lang-switch img {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(13, 35, 58, .08);
}
.lang-switch:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-700);
}
.header__divider {
  width: 1px;
  height: 24px;
  flex: 0 0 1px;
  background: var(--line);
}
.nav__lang {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-2);
  font-size: .92rem;
  font-weight: 600;
  transition: background .2s, border-color .2s, color .2s;
}
.nav__lang:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); }
.nav__lang img { width: 24px; height: 16px; border-radius: 2px; object-fit: cover; }

@media (max-width: 560px) {
  .lang-switch { height: 34px; padding: 0 9px; gap: 6px; font-size: .74rem; }
  .lang-switch img { width: 19px; height: 13px; }
  .header__divider { height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav, .nav-backdrop { transition: none; }
}
