/* =============================================================
   PPA Shared Navigation
   Loaded globally for every page via base.njk.
   Self-contained: no CSS var dependencies.
   ============================================================= */

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: center;
  padding: 16px 24px;
  transition: padding 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav--scrolled { padding: 12px 24px; }

.nav__inner {
  position: relative;
  max-width: 1200px; width: 100%; margin: 0 auto;
  display: flex; align-items: center; gap: 32px;
  padding: 0; border-radius: 0;
  background: transparent; border: 1px solid transparent;
  transition: max-width 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav--scrolled .nav__inner {
  max-width: 1180px; padding: 10px 28px;
  background: rgba(15,10,30,0.80);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-color: rgba(255,255,255,0.08);
  border-radius: 9999px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.nav__brand {
  text-decoration: none; margin-right: auto;
  display: flex; align-items: center;
}
.nav__logo { display: block; height: 44px; width: auto; filter: brightness(0) invert(1); }

.nav__links { display: flex; align-items: center; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav__links > li { display: inline-flex; align-items: center; }
.nav__links a {
  display: inline-flex; align-items: center; line-height: 1;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem; font-weight: 500; color: rgba(255,255,255,0.60);
  text-decoration: none; transition: color 0.25s;
  white-space: nowrap;
}
.nav__links a:hover { color: #fff; }
.nav__links a.nav__link--active { color: #A78BFA; font-weight: 600; }
.nav__link--active { color: #A78BFA !important; font-weight: 600; }

.nav__cta {
  font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.825rem;
  padding: 8px 20px; border-radius: 9999px;
  background: #7C3AED; color: #fff;
  text-decoration: none; transition: background 0.25s, transform 0.25s;
  white-space: nowrap;
}
.nav__cta:hover { background: #A78BFA; transform: translateY(-1px); }

/* Mobile-only CTA lives inside the links list; desktop-only CTA sits beside it. */
.nav__links > .nav__links-cta-item { display: none; }

.nav__toggle { display: none; background: none; border: none; color: rgba(255,255,255,0.60); cursor: pointer; }

/* --- Courses dropdown --- */
.nav__dropdown { position: relative; }
.nav__dropdown-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; padding: 0; margin: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem; font-weight: 500; line-height: 1; color: rgba(255,255,255,0.60);
  transition: color 0.25s;
  white-space: nowrap;
}
.nav__dropdown-btn:hover,
.nav__dropdown-btn[aria-expanded="true"] { color: #fff; }
.nav__dropdown-chevron { transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); flex-shrink: 0; }
.nav__dropdown-btn[aria-expanded="true"] .nav__dropdown-chevron { transform: rotate(180deg); }
.nav__dropdown-menu {
  position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(-8px);
  padding: 8px 0; margin: 0; list-style: none;
  background: rgba(15,10,30,0.92);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s;
  z-index: 200;
}
.nav__dropdown-menu.is-open { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.nav__links .nav__dropdown-item {
  display: flex; align-items: center;
  width: 100%; padding: 10px 20px; white-space: nowrap;
  font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 400;
  color: rgba(255,255,255,0.70); text-decoration: none;
  transition: color 0.2s, background 0.2s;
}
.nav__links .nav__dropdown-item:hover,
.nav__links .nav__dropdown-item:focus-visible { color: #fff; background: rgba(255,255,255,0.06); outline: none; }
.nav__links .nav__dropdown-item.is-active { color: #A78BFA; font-weight: 600; }
.nav__dropdown-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 20px 4px; padding: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.6rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}
.nav__dropdown-divider::before,
.nav__dropdown-divider::after {
  content: ''; flex: 1 1 auto; height: 1px;
  background: rgba(255,255,255,0.12);
}
.nav__dropdown-divider span { flex: 0 0 auto; }

/* --- Language selector --- */
.lang-selector { position: relative; }
.lang-selector__btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 0.825rem;
  color: rgba(255,255,255,0.60);
  padding: 6px 10px; border-radius: 9999px;
  transition: color 0.25s, background 0.25s;
}
.lang-selector__btn:hover,
.lang-selector__btn[aria-expanded="true"] {
  color: #fff; background: rgba(255,255,255,0.06);
}
.lang-selector__btn svg { flex-shrink: 0; }
.lang-selector__chevron { transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.lang-selector__btn[aria-expanded="true"] .lang-selector__chevron { transform: rotate(180deg); }
.lang-selector__dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 180px; padding: 8px 0;
  background: rgba(15,10,30,0.92);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s;
  z-index: 200; list-style: none;
}
.lang-selector__dropdown.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-selector__option {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 400;
  color: rgba(255,255,255,0.60); text-decoration: none;
  transition: color 0.2s, background 0.2s; cursor: pointer;
}
.lang-selector__option:hover { color: #fff; background: rgba(255,255,255,0.06); }
.lang-selector__option.is-active { color: #A78BFA; font-weight: 600; }
.lang-selector__option-native { margin-left: auto; font-size: 0.75rem; color: rgba(255,255,255,0.40); }

/* --- Mobile nav (≤1023px) --- */
@media (max-width: 1023px) {
  .nav__links, .nav__cta--desktop { display: none; }
  .nav__toggle { display: block; }
  .nav__links--open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: calc(100% + 8px); left: auto; right: 12px;
    width: calc(100% - 24px); max-width: 300px;
    background: #1A1038; padding: 8px 0 12px; gap: 0; z-index: 1001;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
  }
  .nav__links--open > li { width: 100%; display: block; }
  .nav__links--open > li > a:not(.nav__cta) {
    display: flex; align-items: center;
    width: 100%;
    padding: 12px 20px;
    border-radius: 0;
  }
  .nav__links--open > li > a:not(.nav__cta):hover,
  .nav__links--open > li > a:not(.nav__cta):focus-visible {
    background: rgba(255,255,255,0.06); outline: none;
  }

  .nav__links > .nav__links-cta-item {
    display: flex; justify-content: center;
    margin-top: 12px;
  }

  .lang-selector__dropdown { right: -12px; }
  .nav__logo { height: 36px; }

  /* Courses dropdown — accordion style on mobile */
  .nav__dropdown { width: 100%; }
  .nav__dropdown-btn {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%;
    padding: 12px 20px;
    min-height: 44px;
    border-radius: 0;
    font-size: 0.85rem; font-weight: 500;
    color: rgba(255,255,255,0.60);
  }
  .nav__dropdown-btn > span { flex: 1 1 auto; text-align: left; }
  .nav__dropdown-btn:hover,
  .nav__dropdown-btn:focus-visible {
    background: rgba(255,255,255,0.06); outline: none;
  }
  .nav__dropdown-btn[aria-expanded="true"] {
    background: rgba(255,255,255,0.04);
    border-radius: 0;
  }

  .nav__dropdown-menu,
  .nav__dropdown-menu.is-open {
    position: static; transform: none;
    opacity: 1; visibility: visible;
    background: rgba(255,255,255,0.04);
    border: none;
    border-radius: 0;
    box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    padding: 4px 0 8px;
    margin: 0;
    min-width: 0;
    text-align: left;
  }
  .nav__dropdown-menu { display: none; }
  .nav__dropdown-menu.is-open { display: block; }
  .nav__links .nav__dropdown-item {
    display: flex; align-items: center;
    padding: 10px 20px;
    border-radius: 0;
    white-space: normal;
    text-align: left;
    color: rgba(255,255,255,0.92);
  }
  .nav__links .nav__dropdown-item:hover,
  .nav__links .nav__dropdown-item:focus-visible {
    background: rgba(255,255,255,0.10); color: #fff;
  }
  .nav__dropdown-divider {
    margin: 10px 20px 4px;
    padding: 0;
    justify-content: center;
    text-align: center;
  }
  .nav__dropdown-divider::before,
  .nav__dropdown-divider::after { display: none; }
}

/* Below 768px the logo shares the bar with the language switcher and a
   44px hamburger. The SVG wordmark's ~7:1 aspect ratio makes height-based
   sizing overflow the toggle off-screen, so switch to width-based. */
@media (max-width: 767px) {
  .nav__logo { height: auto; width: 176px; }
}

/* --- xs breakpoint (≤479px) --- */
@media (max-width: 479px) {
  .nav { padding: 12px 16px; }
  .nav--scrolled { padding: 12px 16px; }
  .nav__inner { gap: 12px; }
  .nav--scrolled .nav__inner { padding: 10px 16px; }
  .nav__logo { width: 132px; }
}

/* =====================================================
   ACCESSIBILITY — Touch targets (WCAG 2.5.8)
   Applies globally so every page gets the same nav metrics.
   ===================================================== */
.nav__links a { min-height: 44px; }
.nav__toggle { min-width: 44px; min-height: 44px; }
