/* ============================================================
   Heven — Global Header / Navigation + Mobile Drawer
   ------------------------------------------------------------
   Loaded on EVERY page (see heven_scripts()) so the responsive
   menu works site-wide — not only on the homepage template set.
   This file is the single source of truth for the header; the
   matching rules were removed from homepage.css to avoid clashes.
   ============================================================ */

/* Header needs these tokens on pages where homepage.css isn't loaded. */
:root {
  --purple:          #7B2FBE;
  --purple-dark:     #5B1A9A;
  --purple-light:    #F3EAFF;
  --dark:            #0F0524;
  --body:            #4B5563;
  --muted:           #9CA3AF;
  --white:           #FFFFFF;
  --border:          #E9E0F5;
  --shadow:          0 4px 24px rgba(0,0,0,.10);
  --shadow-lg:       0 8px 40px rgba(0,0,0,.14);
  --radius:          10px;
  --radius-lg:       16px;
  --trans:           all .25s ease;

  /* Accent for the mobile-menu item icons. Change this one value
     (e.g. to #E63946) to recolour every drawer icon at once. */
  --gec-menu-accent: var(--purple);
}

/* Container (header/footer both use it — needed globally). */
.gec-container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 24px;
}

/* ── Header shell ──────────────────────────────────────────── */
.gec-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .3s;
}
.gec-header.scrolled { box-shadow: 0 4px 24px rgba(123,47,190,.12); }

.gec-nav {
  display: flex;
  align-items: center;
  height: 68px;
  gap: 0;
}

/* ── Logo ──────────────────────────────────────────────────── */
.gec-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
}
.gec-logo .custom-logo-link { display: flex; align-items: center; line-height: 0; }
.gec-logo img,
.gec-logo .custom-logo {
  height: 44px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
  display: block;
}
img.custom-logo { width: 100px; }
.gec-logo .logo-placeholder {
  width: 44px;
  height: 44px;
  background: var(--purple);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

/* ── Desktop nav list ──────────────────────────────────────── */
.gec-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gec-nav-links > li { position: relative; list-style: none; }
.gec-nav-links > li > a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
  border-radius: 6px;
  transition: var(--trans);
  white-space: nowrap;
}
.gec-nav-links > li > a:hover { color: var(--purple); background: var(--purple-light); }
.gec-nav-links > li > a .arrow { display: inline-flex; align-items: center; color: var(--body); transition: transform .2s; }
.gec-nav-links > li > a .arrow svg { width: 15px; height: 15px; display: block; }
.gec-nav-links > li:hover > a .arrow { transform: rotate(180deg); }
.gec-nav-links .nav-badge { color: var(--purple); font-weight: 600; }

/* Item icon — hidden on desktop, shown inside the mobile drawer. */
.gec-nav-ico { display: none; }

/* ── Dropdown ──────────────────────────────────────────────── */
.gec-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 200px;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all .2s ease;
  z-index: 100;
}
.gec-dropdown a {
  display: block;
  padding: 9px 18px;
  font-size: 14px;
  color: var(--body);
  transition: all .15s;
}
.gec-dropdown a:hover { color: var(--purple); background: var(--purple-light); }
.gec-nav-links > li:hover .gec-dropdown,
.gec-nav-links > li:focus-within .gec-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ── Mega menu (Study Abroad) ──────────────────────────────── */
.gec-has-mega { position: relative; }
.gec-mega {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 4px 28px;
  min-width: 540px;
  padding: 22px 26px;
  border-radius: var(--radius-lg);
}
.gec-mega-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.gec-mega-col-dest { border-left: 1px solid var(--border); padding-left: 28px; }
.gec-mega-link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  transition: var(--trans);
}
.gec-mega-link:hover { background: var(--purple-light); }
.gec-mega-link-title { display: block; font-size: 14px; font-weight: 600; color: var(--dark); }
.gec-mega-link-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.gec-mega-dest {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
  transition: var(--trans);
}
.gec-mega-dest:hover { background: var(--purple-light); color: var(--purple); }
.gec-mega-flag { font-size: 18px; line-height: 1; }

/* ── Contact button ────────────────────────────────────────── */
.gec-nav-btns { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }
.gec-nav-btns .btn-nav-contact {
  background: var(--purple);
  color: #fff;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--trans);
  white-space: nowrap;
}
.gec-nav-btns .btn-nav-contact:hover {
  background: var(--purple-dark);
  box-shadow: 0 4px 16px rgba(123,47,190,.35);
}

/* ── Hamburger ─────────────────────────────────────────────── */
.gec-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
}
.gec-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--dark);
  border-radius: 2px;
  transition: all .3s;
}
.gec-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.gec-hamburger.open span:nth-child(2) { opacity: 0; }
.gec-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Drawer chrome (overlay + head) — hidden until mobile ───── */
.gec-mobile-overlay { display: none; }
.gec-drawer-head    { display: none; }

/* ============================================================
   MOBILE  ≤ 900px  →  full-height slide-in side drawer
   ============================================================ */
@media (max-width: 900px) {

  .gec-nav-btns  { display: none; }
  .gec-hamburger { display: flex; }

  .gec-logo img,
  .gec-logo .custom-logo { height: 40px; max-width: 160px; }

  /* Dim overlay behind the drawer. */
  .gec-mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15,5,36,.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease;
    z-index: 1100;
    border: 0;
    cursor: pointer;
  }
  body.gec-menu-open .gec-mobile-overlay { opacity: 1; visibility: visible; }

  /* The <ul> generated by wp_nav_menu becomes the sliding panel. */
  .gec-nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    width: min(78vw, 320px);
    background: var(--white);
    box-shadow: var(--shadow-lg);
    padding: 72px 0 32px;              /* room for the fixed drawer head */
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 1200;
    transform: translateX(100%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
  }
  body.gec-menu-open .gec-nav-links { transform: translateX(0); }

  /* Fixed drawer header: brand + close button. */
  .gec-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: fixed;
    top: 0;
    right: 0;
    width: min(78vw, 320px);
    height: 64px;
    padding: 0 12px 0 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    z-index: 1300;
    transform: translateX(100%);
    transition: transform .32s cubic-bezier(.4,0,.2,1);
  }
  body.gec-menu-open .gec-drawer-head { transform: translateX(0); }
  .gec-drawer-brand img,
  .gec-drawer-brand .custom-logo { height: 34px; width: auto; max-width: 150px; object-fit: contain; }
  .gec-drawer-brand {
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
  }
  .gec-drawer-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: none;
    background: none;
    color: var(--dark);
    cursor: pointer;
    border-radius: 8px;
    transition: background .2s, color .2s;
  }
  .gec-drawer-close:hover { background: var(--purple-light); color: var(--purple); }
  .gec-drawer-close svg { width: 34px; height: 34px; }

  /* Hide the hamburger while the drawer is open. */
  body.gec-menu-open .gec-hamburger { opacity: 0; pointer-events: none; }

  /* Drawer rows. */
  .gec-nav-links > li { width: 100%; }
  .gec-nav-links > li > a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    width: 100%;
    font-size: 15px;
    font-weight: 500;
    color: var(--dark);
    border-radius: 0;
    white-space: normal;
  }
  .gec-nav-links > li > a:hover,
  .gec-nav-links > li > a:focus { background: var(--purple-light); color: var(--purple); }

  /* Item icon. */
  .gec-nav-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: var(--gec-menu-accent);
  }
  .gec-nav-ico svg { width: 22px; height: 22px; display: block; }

  /* Expand/collapse caret pushed to the right edge — bigger, tappable. */
  .gec-nav-links > li > a .arrow {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: -8px;
    color: var(--body);
    transition: transform .25s ease;
  }
  .gec-nav-links > li > a .arrow svg { width: 18px; height: 18px; }
  .gec-nav-links > li:hover > a .arrow { transform: none; }
  .gec-nav-links > li.mobile-show-dropdown > a .arrow { transform: rotate(180deg); }

  /* Sub-panels collapse into an indented stacked list. */
  .gec-dropdown,
  .gec-mega {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: transparent;
    min-width: 0;
    width: 100%;
    padding: 0 0 6px;
    margin: 0;
    display: none;
    grid-template-columns: 1fr;
    gap: 0;
  }
  .gec-nav-links > li.mobile-show-dropdown > .gec-dropdown { display: block; }

  .gec-dropdown a,
  .gec-mega-link,
  .gec-mega-dest {
    padding: 11px 22px 11px 60px;
    font-size: 14px;
    border-radius: 0;
  }
  .gec-mega-link-title { font-size: 14px; }
  .gec-mega-col,
  .gec-mega-col-dest { border: 0; padding: 0; }
  .gec-mega-title {
    padding: 12px 22px 2px 60px;
    margin: 0;
  }
}

@media (max-width: 640px) {
  .gec-logo img,
  .gec-logo .custom-logo { height: 34px; max-width: 130px; }
}
