.nav-group { position: relative; }
.nav-group summary { display: flex; align-items: center; cursor: pointer; list-style: none; white-space: nowrap; font-size: .875rem; font-weight: 600; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::marker { content: ""; }
.nav-group summary:hover, .nav-group[open] summary { color: var(--blue); }
.nav-group summary:focus-visible { outline: 3px solid var(--clay); outline-offset: 4px; }
.nav-submenu { position: absolute; top: calc(100% + 1rem); left: -.8rem; min-width: 13.5rem; display: flex; flex-direction: column; gap: 0; padding: .55rem; background: var(--white); border: 1px solid rgba(31, 36, 42, .12); border-radius: .6rem; box-shadow: 0 .65rem 1.8rem rgba(31, 36, 42, .1); z-index: 95; }
.nav-submenu--right { left: auto; right: -.8rem; }
.nav-submenu a { display: block; padding: .7rem .8rem; font-size: .875rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav-submenu a:hover, .nav-submenu a:focus-visible { color: var(--blue); text-decoration: underline; text-underline-offset: .2rem; }
.nav-submenu a:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

@media (max-width: 1200px) {
  .site-header__inner { gap: 1rem; }
  .menu-toggle { display: flex; flex-direction: column; justify-content: center; gap: .4rem; margin-left: auto; width: 2.75rem; height: 2.75rem; background: transparent; border: 0; z-index: 100; cursor: pointer; }
  /* Tres líneas; al abrir, la de en medio desaparece y las otras dos forman la cruz */
  .menu-toggle span { display: block; width: 1.65rem; height: 2px; background: var(--ink); transition: transform .3s ease, opacity .2s ease; }
  .menu-open .menu-toggle span:first-child { transform: translateY(calc(.4rem + 2px)) rotate(45deg); }
  .menu-open .menu-toggle span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .menu-open .menu-toggle span:last-child { transform: translateY(calc(-.4rem - 2px)) rotate(-45deg); }
  .nav { position: fixed; inset: var(--header-height) 0 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: clamp(.75rem, 2vh, 1.35rem); margin: 0; padding: clamp(1.75rem, 5vh, 3rem) 1rem 2rem; overflow-y: auto; background: var(--white); border-top: 0; visibility: hidden; opacity: 0; transform: translateY(-.8rem); pointer-events: none; transition: visibility .4s, opacity .4s ease, transform .4s ease; z-index: 81; }
  .menu-open .nav { display: flex; visibility: visible; opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav > a, .nav-group summary { justify-content: center; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.1; font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: -.035em; white-space: normal; }
  .nav-group { width: 100%; max-width: 38rem; text-align: center; }
  .nav-group summary { width: 100%; }
  .nav-submenu, .nav-submenu--right { position: static; width: 100%; min-width: 0; display: flex; align-items: center; gap: .35rem; margin: .5rem 0 .25rem; padding: .2rem 0 0; border: 0; border-radius: 0; box-shadow: none; }
  .nav-submenu a { padding: .45rem .8rem; font-size: 1rem; text-transform: uppercase; white-space: normal; }
  .menu-open .nav > * { animation: nav-appear .45s both; }
  .menu-open .nav > :nth-child(1) { animation-delay: .05s; }
  .menu-open .nav > :nth-child(2) { animation-delay: .11s; }
  .menu-open .nav > :nth-child(3) { animation-delay: .17s; }
  .menu-open .nav > :nth-child(4) { animation-delay: .23s; }
  .menu-open .nav > :nth-child(5) { animation-delay: .29s; }
  .menu-open .nav > :nth-child(6) { animation-delay: .35s; }
  @keyframes nav-appear { from { opacity: 0; transform: translateY(.8rem); } to { opacity: 1; transform: translateY(0); } }
  html:not(.js) .site-header__inner { height: auto; min-height: var(--header-height); flex-wrap: wrap; padding-block: .75rem; }
  html:not(.js) .menu-toggle { display: none; }
  html:not(.js) .nav { position: static; inset: auto; order: 3; width: 100%; max-height: none; flex-direction: row; flex-wrap: wrap; gap: 1rem; padding: 1rem 0 0; overflow: visible; border: 0; visibility: visible; opacity: 1; transform: none; pointer-events: auto; }
  html:not(.js) .nav > a, html:not(.js) .nav-group summary { font-size: 1rem; }
  html:not(.js) .nav-group { width: auto; }
  html:not(.js) .nav-submenu { position: absolute; top: 100%; left: 0; width: max-content; min-width: 12rem; padding: .5rem; border: 1px solid rgba(31, 36, 42, .12); border-radius: .6rem; background: var(--white); box-shadow: 0 .65rem 1.8rem rgba(31, 36, 42, .1); }
}

@media (max-width: 940px) { :root { --header-height: 4.75rem; } }
@media (max-width: 650px) {
  :root { --header-height: 4.375rem; }
  .nav { top: var(--header-height); gap: 1rem; }
  .nav > a, .nav-group summary { font-size: clamp(1.45rem, 6vw, 2rem); }
  .nav-submenu a { font-size: .9rem; }
  html:not(.js) .nav { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .nav, .menu-toggle span { transition: none; }
  .menu-open .nav > * { animation: none; }
}

/* Menú hamburguesa: fondo azul corporativo y texto blanco */
@media (max-width: 1200px) {
  html.js .nav { background: var(--blue); color: var(--white); }
  html.js .nav a, html.js .nav-group summary { color: var(--white); }
  html.js .nav > a:hover, html.js .nav > a:focus-visible, html.js .nav-group summary:hover, html.js .nav-group[open] summary, html.js .nav-submenu a:hover, html.js .nav-submenu a:focus-visible { color: var(--white); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
  html.js .nav-submenu { background: transparent; }
  html.js .nav > a, html.js .nav-group summary, html.js .nav-submenu a { font-weight: 500; }
  html.js .nav a:focus-visible, html.js .nav-group summary:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }
}

/* Submenú: entrada suave al abrirse */
@keyframes submenu-in { from { opacity: 0; transform: translateY(-.5rem); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 1201px) {
  .nav-group[open] .nav-submenu { animation: submenu-in .28s var(--ease-salida) both; }
}
@media (max-width: 1200px) {
  html.js .nav-group[open] .nav-submenu a { animation: submenu-in .32s var(--ease-salida) both; }
  html.js .nav-group[open] .nav-submenu a:nth-child(2) { animation-delay: .04s; }
  html.js .nav-group[open] .nav-submenu a:nth-child(3) { animation-delay: .08s; }
  html.js .nav-group[open] .nav-submenu a:nth-child(4) { animation-delay: .12s; }
  html.js .nav-group[open] .nav-submenu a:nth-child(5) { animation-delay: .16s; }
  html.js .nav-group[open] .nav-submenu a:nth-child(6) { animation-delay: .2s; }
  html.js .nav-group[open] .nav-submenu a:nth-child(n+7) { animation-delay: .24s; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-group[open] .nav-submenu, .nav-group[open] .nav-submenu a { animation: none; }
}

/* Menú móvil y tableta: enlaces a la izquierda con separadores y contacto al pie (corrección del jurado, 12/11/2026) */
.nav-contact { display: none; }
@media (max-width: 1200px) {
  html.js .nav { align-items: stretch; gap: 0; padding: clamp(.75rem, 2.5vh, 1.75rem) clamp(1.25rem, 5.5vw, 3rem) 1.5rem; }
  html.js .nav > * { width: 100%; max-width: 40rem; margin-inline: auto; }
  html.js .nav > a, html.js .nav-group { border-bottom: 1px solid rgba(255, 255, 255, .3); }
  html.js .nav > a, html.js .nav-group summary { display: flex; justify-content: space-between; align-items: center; padding: .9rem 0; font-size: clamp(1.5rem, 6vw, 2.25rem); text-align: left; }
  html.js .nav-group summary::after { content: "+"; font-weight: 300; line-height: 1; }
  html.js .nav-group[open] summary::after { content: "−"; }
  html.js .nav-submenu, html.js .nav-submenu--right { align-items: flex-start; margin: 0 0 .9rem; padding: 0; }
  html.js .nav-submenu a { padding: .45rem 0; text-align: left; }
  html.js .nav > .nav-contact { display: flex; flex-direction: column; align-items: stretch; gap: .9rem; margin-top: auto; padding-top: 2rem; border: 0; }
  html.js .nav .nav-contact__call { display: flex; justify-content: center; align-items: center; padding: 1rem 1.5rem; border-radius: 999px; background: var(--white); color: var(--blue); font-size: 1.0625rem; font-weight: 700; text-decoration: none; text-transform: none; letter-spacing: 0; }
  html.js .nav .nav-contact__call:hover { color: var(--blue); text-decoration: underline; }
  html.js .nav .nav-contact__mail { align-self: center; font-size: 1rem; font-weight: 500; text-decoration: underline; text-underline-offset: .2em; text-transform: none; letter-spacing: 0; }
  html.js .nav-contact p { margin: 0; font-size: .9375rem; text-align: center; color: var(--white); }
}
