/* ==========================================================================
   Site Header component — nav, brand, dropdowns, mobile nav, scroll progress.
   Unscoped: loaded via SDC on every page that includes qde:site-header.
   Token vars (--bg, --ink, etc.) are declared per page in app.css.
   ========================================================================== */

/* ── Scroll progress bar ─────────────────────────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 60;
  transition: width 0.1s linear;
}

/* ── Nav shell (glass pill) ──────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 50;
  padding: 12px 24px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background:
    radial-gradient(ellipse 600px 80px at 50% 0%, rgba(255, 255, 255, 0.22), transparent 70%),
    radial-gradient(ellipse 400px 60px at 80% 100%, rgba(255, 255, 255, 0.04), transparent 70%),
    rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(180%) brightness(110%);
  -webkit-backdrop-filter: blur(20px) saturate(180%) brightness(110%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    inset 1px 0 0 rgba(255, 255, 255, 0.05),
    inset -1px 0 0 rgba(255, 255, 255, 0.05),
    0 4px 18px rgba(0, 0, 0, 0.14);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.nav.scrolled {
  background:
    radial-gradient(ellipse 600px 80px at 50% 0%, rgba(255, 255, 255, 0.26), transparent 70%),
    radial-gradient(ellipse 400px 60px at 80% 100%, rgba(255, 255, 255, 0.05), transparent 70%),
    rgba(255, 255, 255, 0.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    inset 1px 0 0 rgba(255, 255, 255, 0.05),
    inset -1px 0 0 rgba(255, 255, 255, 0.05),
    0 6px 22px rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .nav {
  background: radial-gradient(ellipse 600px 80px at 50% 0%, rgba(255, 255, 255, 0.6), transparent 70%), radial-gradient(ellipse 400px 60px at 80% 100%, rgba(255, 255, 255, 0.15), transparent 70%), rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(26, 37, 64, 0.04), inset 1px 0 0 rgba(255, 255, 255, 0.3), inset -1px 0 0 rgba(255, 255, 255, 0.3), 0 4px 18px rgba(26, 37, 64, 0.10);
}

[data-theme="light"] .nav.scrolled {
  background:
    radial-gradient(ellipse 600px 80px at 50% 0%, rgba(255, 255, 255, 0.7), transparent 70%),
    radial-gradient(ellipse 400px 60px at 80% 100%, rgba(255, 255, 255, 0.18), transparent 70%),
    rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(26, 37, 64, 0.05),
    inset 1px 0 0 rgba(255, 255, 255, 0.35),
    inset -1px 0 0 rgba(255, 255, 255, 0.35),
    0 6px 22px rgba(26, 37, 64, 0.14);
}

@media (min-width: 768px) {
  .nav {
    padding: 14px 32px;
    top: 20px;
    left: 24px;
    right: 24px;
  }
}

@media (min-width: 1200px) {
  .nav {
    padding: 14px 36px;
    top: 24px;
    left: 32px;
    right: 32px;
  }
}

/* ── Brand / logo ────────────────────────────────────────────────────── */
.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Poppins", "IBM Plex Sans Arabic", sans-serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}

.brand-logo-light {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.brand-logo-dark {
  opacity: 1;
  transition: opacity 0.45s ease;
}

body.over-dark .brand-logo-light,
.nav.over-dark .brand-logo-light {
  opacity: 1;
}

body.over-dark .brand-logo-dark,
.nav.over-dark .brand-logo-dark {
  opacity: 0;
}

@media (max-width: 600px) {
  .brand-logo {
    height: 32px;
  }
}

@media (max-width: 380px) {
  .brand-logo {
    height: 28px;
  }
}

/* ── Nav links ───────────────────────────────────────────────────────── */
.nav-links {
  display: none;
  gap: 32px;
  align-items: center;
}

@media (min-width: 980px) {
  .nav-links {
    display: flex;
  }
}

.nav-links a {
  color: var(--ink-70);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
  position: relative;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

/* ── Nav right (lang + CTA + hamburger) ──────────────────────────────── */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 600px) {
  .nav-right .btn-primary {
    display: none;
  }

  .nav-right .lang-toggle {
    display: none;
  }
}

/* ── Language toggle ─────────────────────────────────────────────────── */
.lang-toggle {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-55);
  background: transparent;
  border: 1px solid var(--ink-10);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.lang-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-25);
  background: var(--ink-05);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition:
    transform 0.25s cubic-bezier(0.2, 0, 0, 1),
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink-25);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: var(--ink-05);
}

.btn-lg {
  padding: 14px 24px;
  font-size: 14px;
}

.btn .arrow {
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.btn:hover .arrow {
  transform: translate(2px, -2px);
}

/* ── Nav dropdown ────────────────────────────────────────────────────── */
.nav-item {
  position: relative;
}

.nav-item>a {
  cursor: pointer;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 240px;
  background: var(--bg-raised);
  border: 1px solid var(--ink-10);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 24px 48px -16px rgba(26, 37, 64, 0.18);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  z-index: 60;
}

.nav-item:hover>.nav-dropdown,
.nav-item:focus-within>.nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown a {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-70);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-dropdown a::after {
  display: none;
}

.nav-dropdown a:hover {
  background: var(--surface);
  color: var(--ink);
}

/* ── Mobile hamburger ────────────────────────────────────────────────── */
.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--ink-10);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  align-items: center;
}

@media (min-width: 980px) {
  .menu-toggle {
    display: none;
  }
}

.menu-toggle span {
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.3s, opacity 0.3s;
}

body.menu-open .menu-toggle span:nth-child(1) {
  transform: translateY(3.25px) rotate(45deg);
}

body.menu-open .menu-toggle span:nth-child(2) {
  transform: translateY(-3.25px) rotate(-45deg);
}

/* ── Mobile nav drawer ───────────────────────────────────────────────── */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 49;
  padding: 100px 24px 40px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  overflow-y: auto;
}

body.menu-open .mobile-nav {
  opacity: 1;
  visibility: visible;
}

@media (min-width: 980px) {
  .mobile-nav {
    display: none;
  }
}

.mobile-nav-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--ink-10);
}

.mobile-nav-section h6 {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-40);
  margin: 0 0 14px;
  font-weight: 500;
}

/* Makes the top-level heading tappable without altering its appearance.
   `all: unset` strips the generic ".mobile-nav-section a" link styles
   (font, color, padding) so the h6 inherits from its section div exactly
   as it did when unwrapped; `display: contents` means the anchor itself
   generates no box, so the h6's layout is unchanged. */
.mobile-nav-section a.mobile-nav-heading-link {
  all: unset;
  display: contents;
  cursor: pointer;
}

.mobile-nav-section a {
  display: block;
  padding: 10px 0;
  font-family: "Poppins", "IBM Plex Sans Arabic", sans-serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.mobile-nav-section a:hover {
  color: var(--accent);
}

/* ── Over-dark state (nav floating over dark hero) ───────────────────── */
.nav.over-dark {
  /* background: color-mix(in srgb, #0f1726 88%, transparent); */
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.nav.over-dark .nav-links a {
  color: rgba(255, 255, 255, 0.72);
}

.nav.over-dark .nav-links a:hover {
  color: #fff;
}

.nav.over-dark .nav-links a::after {
  background: #fff;
}

.nav.over-dark .menu-toggle {
  border-color: rgba(255, 255, 255, 0.2);
}

.nav.over-dark .menu-toggle span {
  background: #fff;
}

.nav.over-dark .btn-primary {
  background: #fff;
  color: #0f1726;
}

.nav.over-dark .btn-primary:hover {
  background: rgba(255, 255, 255, 0.85);
}

.nav.over-dark .lang-toggle {
  color: rgba(255, 255, 255, 0.65);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav.over-dark .lang-toggle:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.nav.over-dark .nav-dropdown {
  background: rgba(15, 23, 38, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav.over-dark .nav-dropdown a {
  color: rgba(255, 255, 255, 0.7);
}

.nav.over-dark .nav-dropdown a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}