/* ============================================================
   DIEGO EN ESENCIA — Navegación principal
   Namespace .nv-* para no chocar con los estilos viejos
   (.nav-links quedó sin uso; esto es independiente).
   El <nav id="nav"> sigue tomando posición y fondo de
   camino-propio.css / los estilos inline de index.html.
   ============================================================ */

nav#nav { gap: 24px; }

/* ── Contenedor derecho (menú + acciones) ─────────────── */
.nv-panel {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.nv-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nv-item { position: relative; list-style: none; }

/* ── Ítems de primer nivel ────────────────────────────── */
.nv-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Sora', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 9px 13px;
  border-radius: 100px;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.nv-link:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

nav.scrolled .nv-link { color: var(--muted); }
nav.scrolled .nv-link:hover { color: var(--teal); background: var(--teal-ghost); }

.nv-item.activo > .nv-link { color: #fff; font-weight: 600; }
nav.scrolled .nv-item.activo > .nv-link { color: var(--teal-deep); }

.nv-flecha {
  width: 9px; height: 9px; flex-shrink: 0;
  stroke: currentColor; stroke-width: 2.4;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.24s ease;
  opacity: 0.75;
}
.nv-item.abierto .nv-flecha { transform: rotate(180deg); }

/* ── Submenú ──────────────────────────────────────────── */
.nv-sub {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  min-width: 232px;
  background: var(--white);
  border: 1px solid var(--teal-pale);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(10, 95, 122, 0.18);
  padding: 8px;
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 300;
}
/* Puente invisible: deja bajar el mouse sin que se corte */
.nv-sub::before {
  content: '';
  position: absolute;
  top: -16px; left: 0; right: 0; height: 16px;
}
.nv-item.abierto > .nv-sub {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nv-sub li { list-style: none; }

.nv-sub a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  font-family: 'Sora', sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nv-sub a:hover { background: var(--teal-ghost); color: var(--teal-deep); }
.nv-sub a .nv-sub-flecha {
  opacity: 0;
  color: var(--teal);
  font-size: 0.85em;
  transform: translateX(-4px);
  transition: opacity 0.18s, transform 0.18s;
}
.nv-sub a:hover .nv-sub-flecha { opacity: 1; transform: translateX(0); }

.nv-sub-sep {
  height: 1px;
  background: var(--warm-gray);
  margin: 6px 10px;
}

/* ── Botón de contacto + sesión ───────────────────────── */
.nv-acciones { display: flex; align-items: center; gap: 14px; }

/* ── Hamburguesa (mobile) ─────────────────────────────── */
.nv-burger {
  display: none;
  width: 42px; height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
  position: relative;
}
nav.scrolled .nv-burger { border-color: var(--teal-pale); background: var(--teal-ghost); }
.nv-burger span {
  position: absolute;
  left: 12px;
  width: 18px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
nav.scrolled .nv-burger span { background: var(--teal-deep); }
.nv-burger span:nth-child(1) { top: 14px; }
.nv-burger span:nth-child(2) { top: 20px; }
.nv-burger span:nth-child(3) { top: 26px; }
.nv-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nv-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nv-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1080px) {
  nav#nav { padding: 14px 20px; }
  .nv-burger { display: block; }

  .nv-panel {
    position: fixed;
    top: 68px; left: 12px; right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--white);
    border: 1px solid var(--teal-pale);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(10, 95, 122, 0.22);
    padding: 10px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  }
  .nv-panel.abierto { opacity: 1; visibility: visible; transform: translateY(0); }

  .nv-menu { flex-direction: column; align-items: stretch; gap: 2px; width: 100%; }
  .nv-item { width: 100%; }

  .nv-link {
    width: 100%;
    justify-content: space-between;
    color: var(--text);
    font-size: 0.95rem;
    padding: 14px 16px;
    border-radius: 12px;
  }
  nav.scrolled .nv-link { color: var(--text); }
  .nv-link:hover,
  nav.scrolled .nv-link:hover { background: var(--teal-ghost); color: var(--teal-deep); }
  .nv-item.activo > .nv-link,
  nav.scrolled .nv-item.activo > .nv-link { color: var(--teal); }

  /* Submenú como acordeón */
  .nv-sub {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    min-width: 0;
    border: none;
    box-shadow: none;
    background: var(--off-white);
    border-radius: 12px;
    padding: 0 8px;
    margin: 0 8px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
  }
  .nv-sub::before { display: none; }
  .nv-item.abierto > .nv-sub {
    transform: none;
    max-height: 420px;
    padding: 8px;
    margin: 4px 8px 8px;
  }
  .nv-sub a { font-size: 0.88rem; padding: 12px 14px; }

  .nv-acciones {
    flex-direction: row-reverse;
    justify-content: space-between;
    padding: 12px 8px 6px;
    margin-top: 8px;
    border-top: 1px solid var(--warm-gray);
  }
  .nv-acciones .nav-cta { background: var(--teal); color: var(--white); }
}

@media (prefers-reduced-motion: reduce) {
  .nv-sub, .nv-panel, .nv-flecha, .nv-burger span { transition: none; }
}
