/* ============================================================================
   Meridian — shared grouped/mega header (apex landing + blog)
   Ported 1:1 from the study pilot (web/src/app/globals.css nav block) so the
   apex marketing site and the Next.js pilot present ONE consistent header.
   CSS-only: hover + focus-within → mouse/keyboard/touch; checkbox hamburger →
   no JS. Colours are hard-coded hex (NOT page CSS vars) so this file is
   portable identically across index.html, tr/index.html and the 6 blog files,
   whose :root variable names differ. Classes are `m-nav-*` prefixed to avoid
   collisions with each page's legacy `.nav-*` style blocks.
   Palette (matches both pilot + landing): ink #0F172A · ink-soft #475569 ·
   ink-faint #94A3B8 · line #E2E8F0 · line-soft #EEF2F6 · accent #2563EB ·
   accent-deep #1D4ED8 · brand-orange #F97316 / hover #EA580C.
   ============================================================================ */

/* position:fixed — both landing variants (home hero `padding:10rem 0`, blog
   `.blog-hero padding:8rem 0`) are laid out to clear a FIXED header. The pilot
   uses sticky, but its pages have small top padding; copying sticky here would
   stack the in-flow 64px bar ON TOP of the landing's clearance padding and add
   ~64px of dead whitespace. Visually identical (pinned blur header) either way. */
#mainNav.m-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  background: rgba(248, 250, 252, 0.82);
  border-bottom: 1px solid #E2E8F0;
}
.m-nav-bar {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  height: 64px; max-width: 1200px; margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}
.m-nav-logo { display: inline-flex; align-items: center; text-decoration: none; }
.m-nav-logo img { height: 30px; width: auto; display: block; }
.m-nav-wrap { display: flex; align-items: center; gap: 0.9rem; }

/* ---- grouped dropdown nav ---- */
.m-nav-links { display: flex; gap: 0.25rem; }
.m-nav-group { position: relative; }
.m-nav-trigger {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.5rem 0.8rem; border: 0; border-radius: 9px; background: transparent;
  font-family: inherit; font-size: 0.95rem; font-weight: 500; color: #475569;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.m-nav-trigger:hover, .m-nav-group:focus-within .m-nav-trigger { color: #0F172A; background: #EEF2F6; }
.m-nav-chev { transition: transform 0.2s ease; }
.m-nav-group:hover .m-nav-chev, .m-nav-group:focus-within .m-nav-chev { transform: rotate(180deg); }
.m-nav-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 196px;
  box-sizing: border-box; max-width: calc(100vw - 1.5rem);
  display: flex; flex-direction: column; gap: 2px; padding: 0.45rem;
  background: #fff; border: 1px solid #E2E8F0; border-radius: 13px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
  opacity: 0; visibility: hidden; transform: translateY(-5px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}
.m-nav-group:hover .m-nav-menu, .m-nav-group:focus-within .m-nav-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.m-nav-menu a {
  padding: 0.55rem 0.7rem; border-radius: 8px; font-size: 0.92rem; font-weight: 500;
  color: #475569; white-space: nowrap; text-decoration: none; font-family: inherit;
}
.m-nav-menu a:hover { background: #EEF2F6; color: #0F172A; text-decoration: none; }
/* Wide 2-column panel with a Blog news sub-layer.
   Right-anchored (left:auto;right:0): the nav cluster sits on the right, so the
   wide panel grows LEFT to stay inside the viewport — left:0 clipped the promo. */
.m-nav-menu-wide { flex-direction: row; gap: 0.5rem; min-width: 460px; padding: 0.6rem; left: auto; right: 0; }
.m-nav-col { display: flex; flex-direction: column; gap: 2px; min-width: 150px; }
.m-nav-col-news { border-left: 1px solid #E2E8F0; padding-left: 0.6rem; min-width: 250px; }
.m-nav-col-h { padding: 0.3rem 0.7rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: #94A3B8; }
.m-nav-col-news a { display: flex; flex-direction: column; gap: 1px; padding: 0.45rem 0.7rem; border-radius: 8px; }
.m-nav-col-news a strong { font-size: 0.88rem; font-weight: 600; color: #0F172A; line-height: 1.3; white-space: normal; }
.m-nav-col-news a em { font-size: 0.74rem; font-style: normal; color: #94A3B8; }
.m-nav-col-news a:hover { background: #EEF2F6; }
.m-nav-col-news a:hover strong { color: #1D4ED8; }
.m-nav-col-all { font-size: 0.82rem !important; font-weight: 600; color: #2563EB !important; }
.m-nav-col-all:hover { color: #1D4ED8 !important; }

/* ---- Destinations mega-panel (Explore) — country grid + promo card ---- */
.m-nav-dest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-bottom: 2px; }
.m-nav-dest-grid a {
  padding: 0.45rem 0.6rem; border-radius: 8px; font-size: 0.9rem; font-weight: 500;
  color: #475569; white-space: nowrap; text-decoration: none; font-family: inherit;
}
.m-nav-dest-grid a:hover { background: #EEF2F6; color: #0F172A; text-decoration: none; }
/* Narrow-desktop guard (above the 860px mobile breakpoint, below ~1140px): the
   wide panel is right-anchored to its trigger which sits mid-bar, so a 2-col grid
   makes the panel wide enough to clip the viewport's LEFT edge. Collapse to one
   column there to shrink the footprint and keep the whole panel on-screen. */
@media (min-width: 861px) and (max-width: 1140px) {
  .m-nav-dest-grid { grid-template-columns: 1fr; }
}
.m-nav-menu-sub { font-size: 0.86rem !important; color: #64748B !important; }
.m-nav-promo {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 0.6rem;
  min-width: 220px; padding: 1.05rem 1.1rem; border-radius: 12px; text-decoration: none;
  background: linear-gradient(135deg, #1D4ED8 0%, #2563EB 58%, #F97316 240%);
}
.m-nav-promo:hover { text-decoration: none; filter: brightness(1.04); }
.m-nav-promo-top { display: flex; flex-direction: column; gap: 0.3rem; }
.m-nav-promo-eyebrow { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: rgba(255,255,255,0.72); }
.m-nav-promo-h { font-size: 1.02rem; font-weight: 700; color: #fff; line-height: 1.25; }
.m-nav-promo-sub { font-size: 0.78rem; font-weight: 500; color: rgba(255,255,255,0.85); line-height: 1.35; }
.m-nav-promo-cta {
  position: relative; z-index: 1; align-self: flex-start; margin-top: auto;
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.4rem 0.85rem; border-radius: 100px;
  background: #fff; color: #1D4ED8; font-size: 0.8rem; font-weight: 700;
  box-shadow: 0 4px 12px rgba(15,23,42,0.18);
}
.m-nav-promo:hover .m-nav-promo-cta { background: #F8FAFC; }
.m-nav-promo::after {
  content: ""; position: absolute; right: -38px; bottom: -42px;
  width: 150px; height: 150px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.18), rgba(255,255,255,0.04) 70%);
}

/* Language toggle — home uses <a> (URL-based) + .lang-on; blog keeps
   <button class="lang-btn" data-lang onclick="setLang()"> (JS in-page i18n). */
.m-nav-lang { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid #E2E8F0; border-radius: 9px; background: #fff; }
.m-nav-lang a, .m-nav-lang button.lang-btn {
  padding: 0.28rem 0.6rem; border-radius: 6px; font-family: inherit; font-size: 0.8rem;
  font-weight: 600; color: #475569; text-decoration: none; border: 0; background: transparent; cursor: pointer;
}
.m-nav-lang a:hover, .m-nav-lang button.lang-btn:hover { color: #0F172A; text-decoration: none; }
.m-nav-lang a.lang-on, .m-nav-lang button.lang-btn.active { background: #EEF2F6; color: #0F172A; }

/* Unified brand CTA. Dark text on orange (#0F172A) — matches the apex's own
   button convention (--text-on-orange) and passes WCAG AA: dark/orange = 6.4:1,
   whereas the pilot's white/orange is only 2.8:1 (fails AA). */
.m-nav-cta {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 0.5rem 1rem; border-radius: 9px;
  background: #F97316; color: #0F172A; text-decoration: none;
  font-family: inherit; font-size: 0.9rem; font-weight: 700; transition: background 0.15s ease;
}
.m-nav-cta:hover { background: #EA580C; color: #0F172A; text-decoration: none; }

/* CSS-only responsive menu (checkbox hack) — no JS. */
.m-nav-toggle { display: none; }
.m-nav-burger { display: none; }
@media (max-width: 860px) {
  .m-nav-burger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 40px; height: 40px; padding: 9px; cursor: pointer; border-radius: 8px;
  }
  .m-nav-burger span { display: block; height: 2px; width: 100%; background: #0F172A; border-radius: 2px; }
  .m-nav-wrap {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0.9rem;
    padding: 1rem 1.25rem 1.4rem; background: #F8FAFC; border-bottom: 1px solid #E2E8F0;
    max-height: calc(100dvh - 64px); overflow-y: auto;
  }
  .m-nav-toggle:checked ~ .m-nav-wrap { display: flex; }
  .m-nav-links { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .m-nav-group { width: 100%; }
  .m-nav-trigger { width: 100%; justify-content: space-between; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: #94A3B8; pointer-events: none; }
  .m-nav-chev { display: none; }
  /* On mobile the groups are always expanded (static list), not dropdowns. */
  .m-nav-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; padding: 0 0 0 0.4rem; min-width: 0; }
  .m-nav-menu a { padding: 0.5rem 0.4rem; font-size: 1rem; }
  .m-nav-menu-wide { flex-direction: column; min-width: 0; padding: 0; gap: 0.4rem; }
  .m-nav-col-news { border-left: 0; padding-left: 0; min-width: 0; }
  .m-nav-col-news a strong { font-size: 0.95rem; }
  .m-nav-dest-grid { grid-template-columns: 1fr; }
  .m-nav-promo { min-width: 0; margin-top: 0.4rem; }
  .m-nav-lang { align-self: flex-start; }
  .m-nav-cta { justify-content: center; }
}
