/* =========================================================
   Main menu — every page (markup: includes/header.php, script: js/menu.js)
   - 1440px and up: menu in the header card; dropdowns (and flyouts) open on hover or keyboard focus
   - below 1440px: the hamburger opens a slide-in drawer with accordion sections
   ========================================================= */

:root {
  --menu-panel: #0b2a4a;            /* dropdown panel (OneSolution navy, deeper) */
  --menu-panel-2: #0e3359;          /* flyout panel / hovered row */
  --menu-line: rgba(255, 255, 255, 0.08);
  --menu-text: rgba(255, 255, 255, 0.92);
  --menu-accent: #5fd3fb;           /* hovered / current item (light OneSolution blue) */
  --menu-ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Desktop menu row (replaces the old .main-nav list; same type and spacing) ---------- */
.site-menu .menu { display: flex; gap: 3.7px; margin: 0; padding: 0; list-style: none; }
.menu-item { position: relative; }
.menu-link {
  display: flex; align-items: center; gap: 5px;
  padding: 14.75px 7px 15.25px;
  font-family: var(--font-nav); font-weight: 500; font-size: 15px; line-height: 15px;
  color: rgba(0, 0, 0, 0.8); text-decoration: none; white-space: nowrap;
  transition: color .2s;
}
a.menu-link:hover, .menu-item:focus-within > .menu-link, .menu-item.is-open > .menu-link,
.menu-link[aria-current="page"] { color: var(--blue); }
.menu-chev { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--menu-ease); }
.menu-item:hover > .menu-link .menu-chev, .menu-item.is-open > .menu-link .menu-chev { transform: rotate(180deg); }

/* ---------- Dropdown + flyout panels ---------- */
.menu-sub, .menu-fly {
  position: absolute; z-index: 70;
  min-width: 270px; margin: 0; padding: 6px 0; list-style: none;
  border-radius: 10px; background: var(--menu-panel);
  box-shadow: 0 22px 48px rgba(6, 22, 40, 0.35);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  /* closing waits a moment, so moving the mouse diagonally doesn't snap the menu shut */
  transition: opacity .18s ease .12s, transform .18s ease .12s, visibility 0s linear .3s;
}
.menu-sub { top: 100%; left: -14px; }
.menu-fly { top: -6px; left: 100%; margin-left: 2px; background: var(--menu-panel-2); transform: translateX(-6px); }
/* invisible bridge over the gap between the menu row and its panel */
.menu-sub::before { content: ''; position: absolute; left: 0; right: 0; top: -14px; height: 14px; }
.menu-fly::before { content: ''; position: absolute; top: 0; bottom: 0; left: -8px; width: 8px; }

.menu-item:hover > .menu-sub, .menu-item:focus-within > .menu-sub, .menu-item.is-open > .menu-sub,
.menu-sub-item:hover > .menu-fly, .menu-sub-item:focus-within > .menu-fly, .menu-sub-item.is-open > .menu-fly {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .18s ease, transform .2s var(--menu-ease), visibility 0s;
}
/* Esc / script-closed: hide even while hovered or focused */
.menu-item.is-closed > .menu-sub, .menu-sub-item.is-closed > .menu-fly { opacity: 0; visibility: hidden; transform: translateY(8px); transition: none; }

.menu-sub-item { position: relative; }
.menu-sub-item + .menu-sub-item { border-top: 1px solid var(--menu-line); }
.menu-sub-link {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 14px 20px;
  font-family: var(--font-nav); font-weight: 500; font-size: 15px; line-height: 1.3;
  color: var(--menu-text); text-decoration: none; white-space: nowrap;
  transition: background-color .2s, color .2s, padding-left .2s var(--menu-ease);
}
.menu-sub-link:hover, .menu-sub-link:focus-visible,
.menu-sub-item:hover > .menu-sub-link, .menu-sub-item.is-open > .menu-sub-link {
  background: rgba(255, 255, 255, 0.07); color: var(--menu-accent); padding-left: 24px;
}
.menu-sub-link[aria-current="page"] { color: var(--menu-accent); }
.menu-sub-link[aria-current="page"]::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--menu-accent); }
.menu-sub-link .menu-chev { opacity: .7; }
.menu-link:focus-visible, .menu-sub-link:focus-visible { outline: 2px solid var(--menu-accent); outline-offset: -2px; border-radius: 6px; }
.menu-link:focus-visible { outline-color: var(--blue); }

/* Translated pages (GTranslate sets <html lang="es">): longer words → slightly tighter desktop menu */
html:not([lang="en"]) .site-menu .menu { gap: 0; }
html:not([lang="en"]) .menu-link { font-size: 13.5px; padding-left: 5px; padding-right: 5px; }

/* ---------- Mobile drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 1100; }
.drawer[hidden] { display: none; }
.drawer-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 37, 64, 0.55); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .3s ease;
}
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  width: min(380px, 88vw);
  background: #fff; box-shadow: -18px 0 50px rgba(10, 37, 64, 0.25);
  transform: translateX(100%); transition: transform .35s var(--menu-ease);
  outline: none;
}
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer.is-open .drawer-panel { transform: none; }
html.menu-open { overflow: hidden; }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 18px 18px 20px; border-bottom: 1px solid #eef1f4;
}
.drawer-logo img { width: 180px; height: auto; display: block; }
.drawer-close {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: #eef2f5; color: var(--navy); cursor: pointer;
  transition: background-color .2s, transform .2s;
}
.drawer-close:hover { background: #e2e8ee; transform: rotate(90deg); }
.drawer-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.drawer-nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.drawer-menu, .drawer-sub { margin: 0; padding: 0; list-style: none; }
.drawer-item { border-bottom: 1px solid #eef1f4; }
.drawer-item.is-sub { border-bottom-color: #e8edf1; }
.drawer-item.is-sub:last-child { border-bottom: 0; }
.drawer-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 17px 20px;
  border: 0; background: none; text-align: left; cursor: pointer;
  font-family: var(--font-nav); font-weight: 500; font-size: 16.5px; line-height: 1.35;
  color: var(--navy); text-decoration: none;
  transition: background-color .2s, color .2s;
}
.drawer-link:hover { background: #f7f9fb; }
.drawer-link[aria-current="page"] { color: var(--blue); }
.drawer-link.is-text { cursor: default; color: #8a97a5; }
.drawer-link.is-text:hover { background: none; }
.drawer-link:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.drawer-toggle[aria-expanded="true"] { color: var(--blue); }
.drawer-chev { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--menu-ease); }
.drawer-toggle[aria-expanded="true"] .drawer-chev { transform: rotate(180deg); }

/* accordion: animates its height (0fr → 1fr) */
.drawer-collapse { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--menu-ease); }
.drawer-collapse.is-open { grid-template-rows: 1fr; }
.drawer-collapse > .drawer-sub { overflow: hidden; min-height: 0; background: #f6f8fa; border-top: 1px solid #eef1f4; }
.drawer-sub .drawer-link { padding: 14px 20px 14px 32px; font-size: 15px; font-weight: 400; color: #4b5a68; }
.drawer-sub .drawer-link[aria-current="page"] { color: var(--blue); font-weight: 600; box-shadow: inset 3px 0 0 var(--blue); }
.drawer-sub .drawer-sub { background: #eef2f5; }
.drawer-sub .drawer-sub .drawer-link { padding-left: 44px; }

.drawer-foot { display: grid; gap: 10px; padding: 16px; border-top: 1px solid #eef1f4; background: #fff; }
.drawer-call { text-align: center; font-family: var(--font-nav); font-weight: 600; font-size: 15px; color: var(--navy); text-decoration: none; padding: 4px; }
.drawer-call:hover { color: var(--blue); }
.drawer-book {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; border-radius: 12px;
  background: var(--navy); color: #fff; text-decoration: none;
  font-family: var(--font-body); font-weight: 600; font-size: 17px;
  box-shadow: 0 10px 22px rgba(0, 72, 134, 0.25);
  transition: background-color .2s, transform .2s;
}
.drawer-book:hover { background: #003a6c; transform: translateY(-1px); }

/* drawer is a small-screen tool: never show it on wide screens */
@media (min-width: 1440px) {
  .drawer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .menu-sub, .menu-fly, .drawer-panel, .drawer-backdrop, .drawer-collapse, .menu-chev, .drawer-chev { transition: none !important; }
}
