/* ===== HEADER ===== */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 500;
  transition: box-shadow 0.2s;
}

header.scrolled {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem; /* 8px */
  height: 4.25rem; /* 68px */
}

/* ===== LOGO ===== */
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 14rem; /* 224px */
  height: 4rem; /* 64px */
  margin-right: 0.5rem; /* 8px */
  max-width: 100%;
}

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

/* ===== DESKTOP NAV LIST ===== */
nav[aria-label="Primary navigation"] {
  flex: 1;
  justify-items: flex-end;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.125rem; /* 2px */
}

.nav-list li {
  position: relative;
}

/* Top-level links */
.nav-list > li > a {
  display: flex;
  align-items: center;
  gap: 0.25rem; /* 4px */
  padding: 0.4375rem 0.8125rem; /* 7px 13px */
  border-radius: 0.375rem; /* 6px */
  font-size: 0.875rem; /* 14px */
  font-weight: 500;
  color: var(--text-muted);
  transition:
    background 0.15s,
    color 0.15s;
  white-space: nowrap;
}

.nav-list > li > a:hover,
.nav-list > li > a[aria-current="page"] {
  background: var(--bg-light);
  color: var(--primary);
}

/* Chevron icon */
.nav-chevron {
  width: 0.5rem; /* 8px */
  height: 0.3125rem; /* 5px */
  fill: currentColor;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.nav-list li.has-sub:hover > a .nav-chevron {
  transform: rotate(180deg);
}

/* ===== DROPDOWN (level 1) ===== */
.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 13.125rem; /* 210px */
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.625rem; /* 10px */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  padding: 0.75rem 0.375rem 0.375rem; /* 12px 6px 6px — top padding = visual gap */
  z-index: 600;
  opacity: 0;
  transform: translateY(-0.25rem); /* -4px */
  transition:
    opacity 0.15s,
    transform 0.15s;
  pointer-events: none;
}

/* Show on hover — desktop only */
@media (min-width: 48.0625em) {
  /* 769px */
  .nav-list li.has-sub:hover > .nav-dropdown {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

.nav-dropdown li {
  position: relative;
}

.nav-dropdown a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem; /* 6px */
  padding: 0.5rem 0.75rem; /* 8px 12px */
  border-radius: 0.375rem; /* 6px */
  font-size: 0.875rem; /* 14px */
  font-weight: 500;
  color: var(--text);
  transition:
    background 0.12s,
    color 0.12s;
  white-space: nowrap;
}

.nav-dropdown a:hover {
  background: var(--bg-light);
  color: var(--primary);
}

/* Chevron points right for fly-out triggers */
.nav-dropdown .has-sub > a .nav-chevron {
  transform: rotate(-90deg);
}

.nav-dropdown .has-sub:hover > a .nav-chevron {
  transform: rotate(-90deg);
}

/* ===== FLY-OUT (level 2) ===== */
.nav-dropdown--fly {
  top: -0.75rem; /* -12px — aligns with trigger row */
  left: 100%;
  padding: 0.375rem 0.375rem 0.375rem 0.625rem; /* 6px 6px 6px 10px — left = visual gap */
}

/* ===== CTA BUTTONS ===== */
.nav-cta {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* 8px */
  flex-shrink: 0;
  margin-left: 0.5rem; /* 8px */
}

/* ===== HAMBURGER ===== */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 0.3125rem; /* 5px */
  width: 2.5rem; /* 40px */
  height: 2.5rem; /* 40px */
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 0.5rem; /* 8px */
  cursor: pointer;
  padding: 0.5rem; /* 8px */
  flex-shrink: 0;
  margin-left: auto;
  transition: border-color 0.15s;
}

.nav-hamburger:hover {
  border-color: var(--primary);
}

.nav-hamburger span {
  display: block;
  width: 100%;
  height: 2px; /* keep px — sub-pixel border-like element */
  background: var(--text);
  border-radius: 2px;
  transition:
    transform 0.25s,
    opacity 0.2s;
  transform-origin: center;
}

/* Animate hamburger → X when open */
.nav-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(0.4375rem) rotate(45deg); /* 7px */
}

.nav-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-0.4375rem) rotate(-45deg); /* -7px */
}

/* ===== OVERLAY ===== */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 700;
  backdrop-filter: blur(2px);
}

.nav-overlay.open {
  display: block;
}

/* ===== MOBILE DRAWER ===== */
.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(20rem, 85vw); /* min(320px, 85vw) */
  background: var(--bg);
  z-index: 800;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

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

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem; /* 16px 20px */
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-drawer-header .logo {
  width: 8.75rem; /* 140px */
  height: 2.25rem; /* 36px */
}

.nav-drawer-close {
  width: 2.25rem; /* 36px */
  height: 2.25rem; /* 36px */
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 0.5rem; /* 8px */
  font-size: 1.125rem; /* 18px */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  line-height: 1;
  transition:
    background 0.15s,
    color 0.15s;
}

.nav-drawer-close:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* Drawer nav list */
.nav-drawer-list {
  flex-direction: column;
  flex: 1;
  padding: 0.75rem 0.75rem 0; /* 12px 12px 0 */
}

.nav-drawer-list li {
  position: relative;
}

.nav-drawer-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem; /* 8px */
  padding: 0.625rem 0.75rem; /* 10px 12px */
  border-radius: 0.5rem; /* 8px */
  font-size: 0.9375rem; /* 15px */
  font-weight: 500;
  color: var(--text);
  transition:
    background 0.12s,
    color 0.12s;
}

.nav-drawer-list a:hover,
.nav-drawer-list a[aria-current="page"] {
  background: var(--bg-light);
  color: var(--primary);
}

/* Drawer sub-lists — accordion style */
.nav-drawer-list .nav-dropdown,
.nav-drawer-list .nav-dropdown--fly {
  display: none;
  position: static;
  box-shadow: none;
  border: none;
  border-radius: 0;
  padding: 0 0 0 1rem; /* 16px */
  opacity: 1;
  transform: none;
  pointer-events: auto;
  border-left: 2px solid var(--border);
  margin: 0.25rem 0 0.25rem 1.375rem; /* 4px 0 4px 22px */
}

.nav-drawer-list .nav-dropdown.drawer-open,
.nav-drawer-list .nav-dropdown--fly.drawer-open {
  display: block;
}

.nav-drawer-list .nav-dropdown a,
.nav-drawer-list .nav-dropdown--fly a {
  font-size: 0.875rem; /* 14px */
  padding: 0.5rem 0.625rem; /* 8px 10px */
}

/* Chevron in drawer: points right by default, rotates down when open */
.nav-drawer-list .nav-chevron {
  transform: rotate(-90deg);
}

.nav-drawer-list .has-sub.drawer-open > a .nav-chevron {
  transform: rotate(0deg);
}

/* CTA at bottom of drawer */
.nav-drawer-cta {
  display: flex;
  flex-direction: column;
  gap: 0.625rem; /* 10px */
  padding: 1.25rem; /* 20px */
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-drawer-cta .btn {
  justify-content: center;
}

/* ===== LANGUAGE SWITCHER ===== */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.lang-switcher {
  display: flex;
  align-items: center;
  border-radius: 0.3rem;
  overflow: hidden;
  flex-shrink: 0;
}

.lang-btn {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  background: var(--text-light);
  transition:
    background 0.15s,
    color 0.15s;
  line-height: 1.5;
}

.lang-btn--active {
  background: var(--primary);
  color: var(--bg);
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.lang-btn:not(.lang-btn--active):hover {
  color: var(--text);
}

/* Lang switcher in mobile drawer */
.nav-drawer-lang {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-drawer-lang .lang-btn {
  font-size: 0.8125rem;
  padding: 0.375rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 2rem;
}

.nav-drawer-lang .lang-btn--active {
  border-color: var(--primary);
}

/* ===== RESPONSIVE — hide/show ===== */
@media (max-width: 48em) {
  /* 768px */
  nav[aria-label="Primary navigation"],
  .nav-cta {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  .logo {
    width: 6rem;
    height: auto;
  }
}
