/* ============================================================
   LeDor VaDor · V5 · CABECERA
   Módulo «cabecera» del kit funcional de Wolf, vestido con la
   mesa 3 de Johi: fondo ciruela, logo de los 20 años, menú
   «Qué significa / Qué es / El proyecto» en la letra editorial y
   DONÁ en ocre (r05: en el rojo de la maqueta).
   Decisión de Efra (17/11): fija y compacta. Arriba de todo tiene el
   alto de la mesa (210,7); al bajar se reduce a --cab-compacta.
   Es fija (no sticky) para que el cambio de alto no mueva la página.
   En el celular, DONÁ queda en la cabecera y no hay botón flotante.
   Corte escritorio/celular: 60em (960 px), como en el kit.
   ============================================================ */

.cab {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: var(--c-ciruela);
  color: var(--c-crema);
}

.cab :focus-visible { outline-color: var(--c-foco-claro); }

.cab-interior {
  width: min(100% - 2 * var(--margen), var(--ancho-contenido));
  height: var(--cab-pleno);
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cab-marca {
  display: block;
  flex: none;
  line-height: 0;
  color: inherit;
}
.cab-marca img {
  height: 2.25rem;
  width: auto;
}

/* ---------- Menú de escritorio ---------- */
.cab-nav { margin-left: auto; display: none; }

.cab-enlaces {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--f-lectura);
  font-size: var(--t-nav);
  line-height: 1.2;
}
.cab-enlaces a {
  display: inline-block;
  padding-block: 0.35em;
  color: inherit;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.cab-enlaces a:hover { border-bottom-color: currentColor; }
/* «Qué significa / Qué es / El proyecto»: la barra es decorativa. */
.cab-enlaces li + li::before {
  content: "/";
  margin-inline: 0.3em;
}

/* ---------- Acciones ---------- */
.cab-acciones {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* DONÁ: Arial Bold, blanco sobre ocre, como en el AI. */
.cab-boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.5em 1em;
  font-family: var(--f-interfaz);
  font-size: var(--t-boton);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  background: var(--c-rojo);              /* r05: rojo de la maqueta */
  color: var(--c-blanco);
  border: 2px solid var(--c-rojo);
  transition: background-color 0.18s, color 0.18s;
}
.cab-boton:hover { background: transparent; color: var(--c-crema); }

/* ---------- Botón del menú móvil ---------- */
.cab-menu-boton {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: transparent;
  /* r05: en la maqueta, las tres barras sin recuadro. El borde queda
     transparente (sigue el área táctil de 44 px) y se ve con el foco. */
  border: 2px solid transparent;
  color: inherit;
  cursor: pointer;
}
.cab-menu-icono,
.cab-menu-icono::before,
.cab-menu-icono::after {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  transition: transform 0.25s, opacity 0.2s;
}
.cab-menu-icono { position: relative; }
.cab-menu-icono::before,
.cab-menu-icono::after { content: ""; position: absolute; left: 0; }
.cab-menu-icono::before { top: -6px; }
.cab-menu-icono::after { top: 6px; }
.cab-menu-boton[aria-expanded="true"] .cab-menu-icono { background: transparent; }
.cab-menu-boton[aria-expanded="true"] .cab-menu-icono::before { transform: translateY(6px) rotate(45deg); }
.cab-menu-boton[aria-expanded="true"] .cab-menu-icono::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Panel móvil ---------- */
.cab-panel {
  position: fixed;
  top: var(--cab-alto, 4rem);
  right: 0;
  z-index: 99;
  width: min(100%, 26rem);
  height: calc(100dvh - var(--cab-alto, 4rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem var(--margen) 2.5rem;
  background: var(--c-ciruela);
  color: var(--c-crema);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.6, 0.05, 0.2, 1);
}
.cab-panel.cab-panel--abierto { transform: translateX(0); }
.cab-panel ul { margin: 0; padding: 0; list-style: none; }
.cab-panel li { border-top: 1px solid rgb(237 235 223 / 0.3); }
.cab-panel li:last-child { border-bottom: 1px solid rgb(237 235 223 / 0.3); }
.cab-panel a {
  display: block;
  padding: 1.1rem 0;
  font-family: var(--f-titular);
  font-size: 1.75rem;
  line-height: 1.15;
  color: inherit;
  text-decoration: none;
}
.cab-panel a:hover { text-decoration: underline; }

.cab-fondo {
  position: fixed;
  inset: var(--cab-alto, 4rem) 0 0 0;
  z-index: 98;
  background: rgb(0 0 0 / 0.45);
}

html.cab-bloqueado { overflow: hidden; }

/* El contenido empieza debajo de la cabecera fija. */
.cab-espacio { height: var(--cab-pleno); }

/* Marca para saber si se bajó: cuando sale de la pantalla, la
   cabecera se compacta (cabecera.js). */
.cab-centinela {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 2rem;
  pointer-events: none;
}

/* ---------- Escritorio ---------- */
@media (min-width: 60em) {
  .cab-interior {
    gap: calc(45.7 * var(--u));
    transition: height 0.25s ease;
  }
  .cab-nav { display: block; }
  .cab-acciones { margin-left: 0; }
  .cab-menu-boton,
  .cab-panel,
  .cab-fondo { display: none !important; }

  /* Medidas de la mesa: logo 91 de alto, DONÁ 186,5 × 91,5. */
  .cab-marca img {
    height: max(2.75rem, calc(91 * var(--u)));
    transition: height 0.25s ease;
  }
  .cab-boton {
    min-height: max(2.75rem, calc(91.5 * var(--u)));
    padding: calc(30.5 * var(--u)) calc(38 * var(--u)) calc(21.8 * var(--u));
    transition: background-color 0.18s, color 0.18s, min-height 0.25s ease, padding 0.25s ease, font-size 0.25s ease;
  }

  /* Compacta, al bajar. */
  .cab--compacta .cab-interior { height: var(--cab-compacta); }
  .cab--compacta .cab-marca img { height: 2.75rem; }
  .cab--compacta .cab-boton {
    min-height: 2.75rem;
    padding: 0.5em 1.1em 0.4em;
    font-size: 1.0625rem;
  }
}

@media print {
  .cab { position: static; }
  .cab-espacio { display: none; }
  .cab-menu-boton, .cab-panel, .cab-fondo { display: none !important; }
}
