/* ══════════════════════════════════════════════════════════════════════
 * HEADER Y FOOTER — MOBILE FIRST
 *
 * CSS propio, sin frameworks: el header y el footer dejan de depender del
 * Tailwind CDN (retirarlo es una tarea de performance del roadmap; esta
 * hoja hace que header/footer ya no lo necesiten).
 *
 * Criterios mobile-first aplicados:
 *  · Los estilos base son los del teléfono; las media queries solo AGREGAN
 *    para pantallas grandes (min-width), nunca al revés.
 *  · Área táctil mínima real de 44×44 px en todo lo que se toca.
 *  · Safe-area insets: no queda nada bajo el notch ni bajo la barra de
 *    gestos del iPhone.
 *  · Tipografía fluida con clamp(): legible en 320 px sin desbordar.
 *  · Sin hover como única señal: todo tiene :focus-visible y :active.
 *  · Respeta prefers-reduced-motion (marquesina y transiciones).
 * ══════════════════════════════════════════════════════════════════════ */

.rl-hf {
  --rl-crema: #f3f1ef;
  --rl-paper: #fcfaf7;
  --rl-carbon: #292c33;
  --rl-muted: #6a6675;
  --rl-borde: #e4e0dd;
  --rl-linea: #dcd5c9;
  --rl-pino: #487265;
  --rl-pino-deep: #3a5d52;
  --rl-terra: #a85f3e;
  --rl-terra-hover: #8f4e30;
  --rl-lime: #deecc7;
  --rl-brand-ink: #5e6b48;
  --rl-hf-alto: 56px;

  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--rl-carbon);
  -webkit-tap-highlight-color: transparent;
}

.rl-hf *,
.rl-hf *::before,
.rl-hf *::after { box-sizing: border-box; }

.rl-hf a { color: inherit; text-decoration: none; }
.rl-hf a:focus-visible,
.rl-hf button:focus-visible,
.rl-hf summary:focus-visible {
  outline: 2px solid var(--rl-pino);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Saltar al contenido: invisible hasta recibir foco por teclado. */
.rl-hf-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
}
.rl-hf-skip:focus {
  left: 8px;
  top: 8px;
  background: var(--rl-pino);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

/* ── Barra de anuncio ─────────────────────────────────────────────────
 * En móvil: una sola línea, centrada, sin el enlace suelto (el bloque
 * completo es tocable). En ≥640px aparece el detalle y el CTA aparte.
 */
.rl-hf-anuncio {
  background: var(--rl-pino);
  color: #fff;
  font-size: clamp(11px, 3vw, 13px);
  line-height: 1.35;
  padding: 8px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.rl-hf-anuncio-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  text-align: center;
}
.rl-hf-anuncio a { text-decoration: underline; font-weight: 700; color: var(--rl-lime); }
.rl-hf-punto {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--rl-lime);
  flex: 0 0 auto;
  animation: rl-hf-pulse 2s ease-in-out infinite;
}
.rl-hf-anuncio-detalle { display: none; }

@media (min-width: 640px) {
  .rl-hf-anuncio-inner { justify-content: space-between; text-align: left; }
  .rl-hf-anuncio-detalle { display: inline; }
}

@keyframes rl-hf-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* ── Cabecera ─────────────────────────────────────────────────────────── */
.rl-hf-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(243, 241, 239, .94);
  border-bottom: 1px solid var(--rl-linea);
}
@supports (backdrop-filter: blur(8px)) {
  .rl-hf-header { backdrop-filter: blur(8px); }
}

.rl-hf-bar {
  max-width: 1280px;
  margin: 0 auto;
  min-height: var(--rl-hf-alto);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.rl-hf-logo { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; }
.rl-hf-logo img {
  height: 30px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  display: block;
}

.rl-hf-acciones { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* CTA: en móvil texto corto; el largo aparece desde 480px. */
.rl-hf-cta {
  background: var(--rl-terra);
  color: #fff !important;
  font-size: clamp(12px, 3.2vw, 14px);
  font-weight: 700;
  line-height: 1;
  padding: 12px 14px;
  border-radius: 999px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: background-color .18s ease;
}
.rl-hf-cta:hover,
.rl-hf-cta:active { background: var(--rl-terra-hover); }
.rl-hf-cta-largo { display: none; }

@media (min-width: 480px) {
  .rl-hf-cta-corto { display: none; }
  .rl-hf-cta-largo { display: inline; }
}

/* Botón hamburguesa: 44×44 real, icono SVG propio (sin Font Awesome). */
.rl-hf-toggle {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--rl-carbon);
}
.rl-hf-toggle svg { width: 24px; height: 24px; display: block; }
.rl-hf-toggle .rl-hf-icono-cerrar { display: none; }
.rl-hf-toggle[aria-expanded="true"] .rl-hf-icono-abrir { display: none; }
.rl-hf-toggle[aria-expanded="true"] .rl-hf-icono-cerrar { display: block; }

/* Navegación de escritorio: oculta en móvil, no existe hasta ≥1024px. */
.rl-hf-nav-desktop { display: none; }

@media (min-width: 1024px) {
  .rl-hf { --rl-hf-alto: 72px; }
  .rl-hf-logo img { height: 38px; max-width: 170px; }
  .rl-hf-toggle { display: none; }

  /* La nav DEBE poder encogerse (min-width:0): el menú es editable y
   * puede traer más ítems o etiquetas más largas que las de fábrica.
   * Si aún así no cabe, hace scroll horizontal interno (sin barra
   * visible) en vez de desbordar la página o pisar el CTA — en un
   * notebook de 1024–1366px esto es lo que evita el desborde. */
  .rl-hf-nav-desktop {
    display: flex;
    align-items: center;
    gap: clamp(12px, 1.5vw, 32px);
    font-size: 13px;
    font-weight: 600;
    color: var(--rl-muted);
    flex: 0 1 auto;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* IE/Edge viejo */
    padding: 4px 2px;           /* aire para el anillo de foco */
  }
  .rl-hf-nav-desktop::-webkit-scrollbar { display: none; } /* WebKit */
  /* padding vertical: área táctil ≥44px (accesibilidad WCAG 2.2) sin
     alterar la altura del header (el contenedor centra con flex). */
  .rl-hf-nav-desktop a { transition: color .18s ease; white-space: nowrap; padding: 14px 3px; }
  .rl-hf-nav-desktop a:hover { color: var(--rl-carbon); }
  .rl-hf-nav-desktop a.rl-hf-destacado { color: var(--rl-brand-ink); }
}

/* Franja de notebook (1024–1279px): el CTA vuelve al texto corto para
 * cederle espacio a la navegación; el largo reaparece desde 1280px. */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  .rl-hf-cta-largo { display: none; }
  .rl-hf-cta-corto { display: inline; }
}

@media (min-width: 1280px) {
  .rl-hf-logo img { height: 42px; max-width: 200px; }
  .rl-hf-nav-desktop { font-size: 14px; gap: clamp(16px, 2vw, 32px); }
}

/* ── Panel móvil ──────────────────────────────────────────────────────
 * Se despliega bajo la cabecera, ocupa el alto disponible y hace scroll
 * propio: con 8 ítems y teclado abierto no deja nada fuera de alcance.
 */
.rl-hf-panel {
  /* --rl-hf-panel-top lo fija el JS con el borde inferior real de la
     cabecera: así el panel nunca queda tapado por el header ni por la
     barra de anuncio, esté la página arriba del todo o ya scrolleada. */
  position: fixed;
  top: var(--rl-hf-panel-top, 56px);
  left: 0; right: 0;
  z-index: 899;
  background: var(--rl-paper);
  border-bottom: 1px solid var(--rl-linea);
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  max-height: calc(100dvh - var(--rl-hf-panel-top, 56px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}
.rl-hf-panel[hidden] { display: none; }

.rl-hf-panel a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--rl-muted);
  border-bottom: 1px solid rgba(228, 224, 221, .7);
}
.rl-hf-panel a:last-child { border-bottom: 0; }
.rl-hf-panel a:active { color: var(--rl-pino); }
.rl-hf-panel a.rl-hf-destacado { color: var(--rl-brand-ink); }
.rl-hf-panel .rl-hf-panel-cta {
  color: var(--rl-terra);
  font-weight: 800;
}

/* Fondo oscuro tras el panel (se toca para cerrar). */
.rl-hf-backdrop {
  position: fixed;
  inset: 0;
  z-index: 898;
  background: rgba(41, 44, 51, .45);
  border: 0;
  padding: 0;
  cursor: pointer;
}
.rl-hf-backdrop[hidden] { display: none; }

/* Bloquea el scroll del documento mientras el panel está abierto. */
body.rl-hf-menu-abierto { overflow: hidden; }

@media (min-width: 1024px) {
  .rl-hf-panel,
  .rl-hf-backdrop { display: none !important; }
}

/* ── Marquesina ───────────────────────────────────────────────────────── */
.rl-hf-marquee {
  background: var(--rl-lime);
  color: var(--rl-pino-deep);
  border-top: 1px solid var(--rl-linea);
  border-bottom: 1px solid var(--rl-linea);
  padding: 10px 0;
  overflow: hidden;
}
.rl-hf-marquee-pista {
  display: inline-flex;
  white-space: nowrap;
  animation: rl-hf-marquee 38s linear infinite;
}
.rl-hf-marquee:hover .rl-hf-marquee-pista,
.rl-hf-marquee:focus-within .rl-hf-marquee-pista { animation-play-state: paused; }
.rl-hf-marquee span {
  padding: 0 14px;
  font-size: clamp(10px, 2.6vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

@keyframes rl-hf-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Sin animación: la franja pasa a ser deslizable con el dedo. */
@media (prefers-reduced-motion: reduce) {
  .rl-hf-marquee { overflow-x: auto; }
  .rl-hf-marquee-pista { animation: none; }
  .rl-hf-punto { animation: none; }
  .rl-hf * { transition: none !important; }
}

/* ── Pie de página ────────────────────────────────────────────────────
 * En móvil cada bloque es un <details> que el usuario puede cerrar para
 * no scrollear 60 enlaces. Viene abierto por defecto (nada queda oculto
 * a un buscador ni a un lector de pantalla) y en ≥768px el resumen deja
 * de ser interactivo y se comporta como un simple título de columna.
 */
.rl-hf-footer {
  background: var(--rl-crema);
  border-top: 1px solid var(--rl-linea);
  padding: 32px 16px calc(24px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.rl-hf-footer-grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.rl-hf-footer-marca img {
  height: 36px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 12px;
  display: block;
}
.rl-hf-footer-marca p {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--rl-muted);
}

.rl-hf-col { border-top: 1px solid var(--rl-borde); }
.rl-hf-col > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 2px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--rl-carbon);
  cursor: pointer;
  list-style: none;
}
.rl-hf-col > summary::-webkit-details-marker { display: none; }
.rl-hf-col > summary::after {
  content: "";
  width: 9px; height: 9px;
  border-right: 2px solid var(--rl-muted);
  border-bottom: 2px solid var(--rl-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s ease;
  flex: 0 0 auto;
}
.rl-hf-col[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }

.rl-hf-col ul {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.rl-hf-col li { border-bottom: 1px solid rgba(228, 224, 221, .55); }
.rl-hf-col li:last-child { border-bottom: 0; }
.rl-hf-col a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 2px;
  font-size: 14px;
  color: var(--rl-muted);
}
.rl-hf-col a:active { color: var(--rl-carbon); }

.rl-hf-legal {
  max-width: 1280px;
  margin: 24px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--rl-linea);
  font-size: 11px;
  line-height: 1.6;
  color: var(--rl-muted);
  text-align: center;
}
.rl-hf-legal p { margin: 0 0 8px; }
.rl-hf-legal a { text-decoration: underline; }

@media (min-width: 768px) {
  .rl-hf-footer { padding-top: 56px; }
  .rl-hf-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 40px;
  }
  .rl-hf-col { border-top: 0; }
  .rl-hf-col > summary {
    cursor: default;
    pointer-events: none;
    min-height: 0;
    padding: 0 0 14px;
  }
  .rl-hf-col > summary::after { display: none; }
  .rl-hf-col a { min-height: 0; padding: 5px 0; font-size: 13px; }
  .rl-hf-col li { border-bottom: 0; }
  .rl-hf-legal { text-align: left; }
}

@media (min-width: 1024px) {
  .rl-hf-footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
}
