/* Header, mobile menu and footer (D-27 to D-29, §5, §6)
   Backgrounds run full-bleed; contents sit on the frame lines. */

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--blanco);
  /* Always 1px so the height never changes; only the color appears on scroll */
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
  border-bottom-color: var(--bruma);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--header-pad);
}

.brand {
  display: block;
  flex: none;
}

/* Desktop navigation (≥720px) */

.nav-principal {
  display: none;
}

.nav-principal__list {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Nav links are identified by their place in the header, not by underline.
   The current page gets weight 600 + a 4px orange bar + aria-current (D-08). */
.nav-principal__list a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  padding-inline: var(--space-1);
  color: var(--azul);
  font-size: var(--fs-ui);
  font-weight: 400;
  line-height: var(--lh-ui);
  text-decoration: none;
}

.nav-principal__list a:hover {
  text-decoration: underline;
  text-decoration-thickness: 3px;
}

.nav-principal__list a[aria-current="page"] {
  font-weight: 600;
}

.nav-principal__list a[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: var(--space-1);
  bottom: 6px;
  left: var(--space-1);
  height: 4px;
  background: var(--naranja);
}

.nav-principal__list a[aria-current="page"]:hover {
  text-decoration: none;
}

@media (min-width: 720px) {
  .nav-principal {
    display: flex;
    align-items: center;
    gap: var(--space-5);
  }
}

/* Mobile toggle (<720px). Without JS the fallback link to #pie-nav shows;
   js/nav.js swaps it for the button. */

.nav-toggle,
.nav-toggle-fallback {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: var(--control-h);
  min-height: var(--control-h);
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--azul);
  font-size: var(--fs-ui);
  font-weight: 600;
  line-height: var(--lh-ui);
  text-decoration: none;
  cursor: pointer;
}

/* Three bars of unequal length, echoing the slabs of the E */
.nav-toggle__glyph {
  display: grid;
  gap: 4px;
  width: 20px;
}

.nav-toggle__glyph > span {
  display: block;
  height: 3px;
  background: currentColor;
}

.nav-toggle__glyph > span:nth-child(1) {
  width: 20px;
}

.nav-toggle__glyph > span:nth-child(2) {
  width: 16px;
}

.nav-toggle__glyph > span:nth-child(3) {
  width: 12px;
}

@media (min-width: 720px) {
  .nav-toggle,
  .nav-toggle-fallback {
    display: none;
  }
}

/* Mobile panel and scrim. Fixed below the header; the header's rendered
   height comes from --header-h (js/main.js). */

.menu-movil {
  position: fixed;
  top: var(--header-h);
  right: 0;
  left: 0;
  max-height: calc(100vh - var(--header-h));
  max-height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: var(--space-5);
  background: var(--blanco);
  opacity: 0;
  transform: translateY(-12px);
  transition:
    opacity var(--dur-menu-out) ease-in,
    transform var(--dur-menu-out) ease-in;
}

.menu-movil.is-open {
  opacity: 1;
  transform: none;
  transition-duration: var(--dur-menu-in);
  transition-timing-function: var(--ease-out);
}

.menu-scrim {
  position: fixed;
  top: var(--header-h);
  right: 0;
  bottom: 0;
  left: 0;
  background: rgb(77 78 80 / 0.4); /* --gris at 40% */
  opacity: 0;
  transition: opacity var(--dur-menu-out) ease-in;
}

.menu-scrim.is-open {
  opacity: 1;
  transition-duration: var(--dur-menu-in);
}

.menu-movil__list {
  border-top: 1px solid var(--bruma);
}

.menu-movil__list li {
  max-width: none;
  border-bottom: 1px solid var(--bruma);
}

/* The whole row is the link (§5) */
.menu-movil__list a {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding-inline: var(--space-3);
  color: var(--azul);
  font-size: var(--fs-body);
  line-height: var(--lh-ui);
  text-decoration: none;
}

.menu-movil__list a:hover {
  text-decoration: underline;
  text-decoration-thickness: 3px;
}

.menu-movil__list a:focus-visible {
  outline-offset: calc(-1 * var(--focus-width));
}

.menu-movil__list a[aria-current="page"] {
  font-weight: 600;
  box-shadow: inset 4px 0 0 var(--naranja);
}

.menu-movil__extra {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3) 0;
}

.menu-movil__extra .btn {
  margin-bottom: var(--space-3);
}

/* Scroll lock while the menu is open (root element, §5) */
html.menu-abierto {
  overflow: hidden;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--hondo);
  color: var(--perla);
}

.site-footer a {
  color: var(--perla);
}

.site-footer__inner {
  display: grid;
  gap: var(--space-5);
  padding-block: var(--space-6);
}

.site-footer__top {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 720px) {
  .site-footer__inner {
    padding-block: var(--space-7) var(--space-6);
  }

  .site-footer__top {
    grid-template-columns: auto minmax(0, 36rem);
    justify-content: space-between;
    align-items: start;
  }
}

/* Cajetín: razón social, correo, horario. Nothing else (D-37). */
.cajetin {
  border: 1px solid var(--perla);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

.cajetin__row {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-3);
}

.cajetin__row + .cajetin__row {
  border-top: 1px solid var(--perla);
}

.cajetin dt {
  color: var(--blanco);
  font-weight: 600;
}

.cajetin dd {
  overflow-wrap: anywhere;
}

@media (min-width: 720px) {
  .cajetin__row {
    grid-template-columns: 9rem minmax(0, 1fr);
    gap: var(--space-4);
    padding: var(--space-2) var(--space-3);
  }
}

.pie-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

.pie-nav__list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--fs-ui);
}

.pie-nav__list a[aria-current="page"] {
  color: var(--blanco);
  font-weight: 600;
}

.site-footer__legal {
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}
