/* ==========================================================================
   header.css — Slim fixed top bar + slide-down glass nav panel
   ========================================================================== */

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --sh-h:           90px;                        /* top bar height */
  --sh-bg:          #0F172A;                     /* bar background */
  --sh-border:      rgba(255, 255, 255, 0.08);   /* bar bottom border */
  --sh-text:        rgba(241, 245, 249, 0.90);   /* default text */
  --sh-muted:       rgba(148, 163, 184, 0.80);   /* phone / secondary */
  --sh-accent:      #f59e0b;                     /* orange CTA */
  --sh-zindex:      1000;

  --np-bg:          rgba(10, 20, 40, 0.45);      /* glass panel bg */
  --np-blur:        16px;                        /* backdrop blur */
  --np-border:      rgba(255, 255, 255, 0.10);   /* panel bottom border */
  --np-zindex:      999;

  --ns-bg:          rgba(8, 20, 44, 0.98);       /* submenu bg */
  --ns-border:      rgba(255, 255, 255, 0.12);
  --ns-radius:      14px;

  --nb-zindex:      998;                         /* backdrop z-index */

  --t-spring:       0.28s cubic-bezier(0.22, 1, 0.36, 1);
  --t-ease:         0.22s ease;
}

/* ── Body offset so content isn't hidden under fixed bar ─────────────────── */
body { padding-top: var(--sh-h); }

/* ── Scroll lock when panel is open ──────────────────────────────────────── */
body.menu-open { overflow: hidden; }

/* ── Hero sections: compensate bar height ────────────────────────────────── */
.dh-hero,
.pl-hero,
.video-hero {
  min-height: calc(100vh - var(--sh-h));
}

/* ══════════════════════════════════════════════════════════════════════════
   TOP BAR
   ══════════════════════════════════════════════════════════════════════════ */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--sh-h);
  z-index: var(--sh-zindex);
  background: var(--sh-bg);
  display: flex;
  align-items: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sh-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Right column (RTL start): utilities — phone + portal */
.site-header__utils {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-start; /* RTL: visual right */
}

/* Center: logo */
.site-header__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  flex-shrink: 0;
  text-decoration: none;
  padding: 0 12px;
}

.site-header__brand-text {
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

/* Logo image */
.site-header__logo-img {
  height: 64px;
  width: auto;
  max-width: none !important;
  object-fit: contain;
  display: block;
  transition: transform 0.3s ease;
}

.site-header__brand:hover .site-header__logo-img {
  transform: scale(1.05);
}

/* Always render logo with its original colors (orange/navy). */
.site-logo {
  filter: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
  -webkit-filter: none !important;
}

/* Placement landing pages: improve logo contrast on dark hero backgrounds */
.site-header--exam-logo-contrast {
  background: #0F172A !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-header--exam-logo-contrast .exam-logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.65);
  padding: 6px 16px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.site-header--exam-logo-contrast .exam-logo {
  height: 50px;
  max-height: 52px;
  width: auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4)) !important;
  -webkit-filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4)) !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
}

/* Left column (RTL end): toggle */
.site-header__toggle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end; /* RTL: visual left */
}

/* ── Phone link ─────────────────────────────────────────────────────────── */
.site-header__phone {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sh-muted);
  font-size: 0.82rem;
  text-decoration: none;
  direction: ltr;
  white-space: nowrap;
  transition: color var(--t-ease);
}

.site-header__phone:hover { color: var(--sh-text); }

/* ── Portal button — brand-orange primary CTA ───────────────────────────── */
.site-header__portal {
  display: inline-flex;
  align-items: center;
  align-self: center;          /* vertical center inside flex utils row */
  gap: 6px;
  padding: 8px 18px;
  background-color: #FF7A00;
  border: none;
  border-radius: 999px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(255, 122, 0, 0.35);
  transition: background-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.site-header__portal:hover {
  background-color: #e66d00;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(255, 122, 0, 0.45);
}

.site-header__portal:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(255, 122, 0, 0.30);
}

/* ── Hamburger toggle button ────────────────────────────────────────────── */
.nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: var(--sh-text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-ease), border-color var(--t-ease);
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.28);
}

.nav-toggle__label { user-select: none; }

/* Hamburger icon — 3 lines → X */
.nav-toggle__ham {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 18px;
  height: 16px;
  flex-shrink: 0;
}

.nav-toggle__ham span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transform-origin: center;
  transition: transform var(--t-ease), opacity var(--t-ease);
}

/* Animate to X when panel is open */
body.menu-open .nav-toggle .nav-toggle__ham span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
body.menu-open .nav-toggle .nav-toggle__ham span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
body.menu-open .nav-toggle .nav-toggle__ham span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ══════════════════════════════════════════════════════════════════════════
   NAV PANEL — slides down from below the top bar
   ══════════════════════════════════════════════════════════════════════════ */

.nav-panel {
  position: fixed;
  top: var(--sh-h);
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--sh-h));
  overflow-y: auto;
  z-index: var(--np-zindex);
  background: var(--np-bg);
  backdrop-filter: blur(var(--np-blur));
  -webkit-backdrop-filter: blur(var(--np-blur));
  border-bottom: 1px solid var(--np-border);
  padding: 12px 0 20px;

  /* Closed state */
  transform: translateY(-16px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0s linear 0.2s;
}

body.menu-open .nav-panel {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0s linear 0s;
}

.nav-panel__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Nav list ────────────────────────────────────────────────────────────── */

.nav-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Top-level nav item ─────────────────────────────────────────────────── */

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--sh-text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 10px;
  white-space: nowrap;
  transition: background var(--t-ease), color var(--t-ease);
}

.nav-link:hover,
.nav-item--has-children:hover > .nav-link,
.nav-item--sub-open > .nav-link {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.nav-link__icon {
  font-size: 1rem;
  line-height: 1;
}

.nav-link__caret {
  display: inline-flex;
  align-items: center;
  opacity: 0.65;
  transition: transform var(--t-ease);
}

.nav-item--sub-open > .nav-link .nav-link__caret,
.nav-item--has-children:hover > .nav-link .nav-link__caret {
  transform: rotate(180deg);
}

/* ══════════════════════════════════════════════════════════════════════════
   SUBMENU — desktop: absolute dropdown on hover
              mobile:  accordion on click
   ══════════════════════════════════════════════════════════════════════════ */

.nav-submenu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Desktop submenu ───────────────────────────────────────────────────── */
@media (min-width: 641px) {
  .nav-submenu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0; /* RTL: open to the left of the parent item */
    min-width: 190px;
    background: var(--ns-bg);
    border: 1px solid var(--ns-border);
    border-radius: var(--ns-radius);
    padding: 8px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    transition:
      opacity 0.18s ease,
      transform 0.18s ease,
      visibility 0s linear 0.18s;
    z-index: 10;
  }

  /* Show on hover or JS-added class */
  .nav-item--has-children:hover > .nav-submenu,
  .nav-item--sub-open > .nav-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition:
      opacity 0.18s ease,
      transform 0.18s ease,
      visibility 0s linear 0s;
  }
}

/* ── Mobile submenu (accordion) ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-submenu {
    overflow: hidden;
    max-height: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0 6px;
    margin-top: 2px;
    transition: max-height 0.3s ease, padding 0.25s ease;
  }

  .nav-item--sub-open > .nav-submenu {
    max-height: 480px;
    padding: 6px 6px;
  }

  /* Caret rotates on open */
  .nav-link__caret {
    transition: transform 0.22s ease;
  }
  .nav-item--sub-open > .nav-link .nav-link__caret {
    transform: rotate(180deg);
  }
}

/* ── Submenu link ───────────────────────────────────────────────────────── */

.nav-sub-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: rgba(241, 245, 249, 0.82);
  font-size: 0.88rem;
  text-decoration: none;
  border-radius: 8px;
  transition: background var(--t-ease), color var(--t-ease);
  white-space: nowrap;
}

.nav-sub-link:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.nav-sub-badge {
  display: inline-block;
  padding: 1px 7px;
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  font-size: 0.72rem;
  border-radius: 999px;
  margin-inline-start: 4px;
}

/* ══════════════════════════════════════════════════════════════════════════
   BACKDROP
   ══════════════════════════════════════════════════════════════════════════ */

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--nb-zindex);
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0s linear 0.2s;
}

body.menu-open .nav-backdrop {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition:
    opacity 0.2s ease,
    visibility 0s linear 0s;
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — mobile adjustments
   ══════════════════════════════════════════════════════════════════════════ */

/* Tablet / narrow desktop: hide phone text */
@media (max-width: 860px) {
  .site-header__phone span { display: none; }
  .site-header__portal { font-size: 0.77rem; padding: 6px 14px; }
}

@media (max-width: 768px) {
  :root { --sh-h: 70px; }
  .site-header__logo-img { height: 48px; max-width: none !important; }
  .site-header--exam-logo-contrast .exam-logo { height: 48px; max-height: 50px; }
  .site-header--exam-logo-contrast .exam-logo-wrapper { padding: 5px 12px; }
}

/* Mobile: stack nav list vertically */
@media (max-width: 640px) {
  .site-header__phone { display: none; }

  .nav-panel { padding: 8px 0 16px; }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .nav-link {
    padding: 12px 16px;
    font-size: 1rem;
    border-radius: 10px;
    justify-content: space-between;
  }

  .nav-sub-link { padding: 10px 18px; font-size: 0.92rem; }
}

/* Very small screens */
@media (max-width: 400px) {
  .site-header__portal { display: none; }
  .nav-toggle__label { display: none; }
  .nav-toggle { padding: 8px 10px; }
}
