/* ==========================================================================
   HALO · Estilos compartidos para páginas legales y banner de cookies
   Reutiliza los tokens del brandbook usados en index.html.
   ========================================================================== */

:root {
  --halo-forest: #618E5B;
  --halo-sand: #E9E3D2;
  --halo-charcoal: #1C1C1C;
  --halo-neutral: #B79B72;
  --halo-border: #D4CFC0;
  --halo-accent: #FFB64D;
}

/* --------------------------------------------------------------------------
   Banner de cookies (se carga también en index.html)
   -------------------------------------------------------------------------- */

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  background: var(--halo-charcoal);
  color: #ffffff;
  border-top: 3px solid var(--halo-forest);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
  padding: 20px 0;
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cookie-banner__text {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  max-width: 720px;
}

.cookie-banner__text strong {
  color: #ffffff;
}

.cookie-banner__text a {
  color: var(--halo-accent);
  text-decoration: underline;
}

.cookie-banner__actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.cookie-btn {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 50px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.cookie-btn--accept {
  background: var(--halo-forest);
  color: #ffffff;
}

.cookie-btn--accept:hover {
  background: #4f7a4a;
}

.cookie-btn--reject {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.cookie-btn--reject:hover {
  border-color: #ffffff;
}

/* El botón flotante de WhatsApp no debe taparse con el banner */
body.cookie-banner-open .floating-whatsapp {
  bottom: 150px;
}

@media (max-width: 720px) {
  .cookie-banner {
    padding: 16px 0;
  }

  .cookie-banner__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 0 16px;
  }

  .cookie-banner__text {
    font-size: 13px;
  }

  .cookie-btn {
    padding: 11px 20px;
  }

  /* Rechazar y Aceptar en una fila, Configurar debajo a todo el ancho */
  .cookie-banner__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .cookie-banner__actions .cookie-btn--reject { order: 1; }
  .cookie-banner__actions .cookie-btn--accept { order: 2; }

  .cookie-banner__actions .cookie-btn--ghost {
    order: 3;
    grid-column: 1 / -1;
  }

  .cookie-btn {
    width: 100%;
  }

  body.cookie-banner-open .floating-whatsapp {
    bottom: 240px;
  }

  .consent-placeholder {
    padding: 16px;
    gap: 10px;
  }

  .consent-placeholder__text {
    font-size: 13px;
  }

  .consent-placeholder__note {
    font-size: 11px;
  }
}

/* --------------------------------------------------------------------------
   Marcador de contenido de terceros bloqueado (mapa de Google)
   -------------------------------------------------------------------------- */

/* Contenedor del mapa: 16:9 como el resto del sitio, pero con una altura
   mínima en pantallas estrechas para que quepa el aviso de consentimiento. */
.map-slot {
  aspect-ratio: 16 / 9;
}

/* Mientras el mapa no se ha cargado, el hueco crece con el texto del aviso
   para que no se recorte en pantallas estrechas. Al cargar el iframe vuelve
   a ser 16:9. */
.map-slot:has(.consent-placeholder) {
  aspect-ratio: auto;
}

@media (max-width: 640px) {
  .map-slot {
    min-height: 300px;
  }
}

.consent-placeholder {
  width: 100%;
  height: 100%;
  min-height: 280px;
  background: var(--halo-sand);
  border: 1px dashed var(--halo-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 24px;
}

.consent-placeholder__text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--halo-charcoal);
  margin: 0;
  max-width: 420px;
}

.consent-placeholder__note {
  font-size: 12px;
  color: var(--halo-neutral);
  margin: 0;
}

.consent-placeholder__btn,
.legal-btn {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--halo-forest);
  color: #ffffff;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.consent-placeholder__btn:hover,
.legal-btn:hover {
  background: #4f7a4a;
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Páginas legales (terminos.html, cookies.html)
   -------------------------------------------------------------------------- */

.legal-hero {
  padding: 140px 0 48px;
  background: var(--halo-sand);
}

.legal-hero h1 {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 700;
  color: var(--halo-charcoal);
  margin: 0 0 16px;
}

.legal-hero p {
  color: var(--halo-neutral);
  font-size: 18px;
  margin: 0;
}

.legal-body {
  padding: 56px 0 96px;
  background: #ffffff;
}

.legal-content {
  max-width: 820px;
  margin: 0 auto;
  color: var(--halo-charcoal);
  line-height: 1.75;
}

.legal-content h2 {
  font-size: clamp(20px, 3vw, 28px);
  color: var(--halo-forest);
  margin: 48px 0 16px;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content h3 {
  font-size: 17px;
  color: var(--halo-charcoal);
  margin: 32px 0 12px;
}

.legal-content h4 {
  font-size: 15px;
  color: var(--halo-charcoal);
  margin: 24px 0 10px;
}

.legal-content p {
  margin: 0 0 16px;
}

.legal-content ul,
.legal-content ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.legal-content li {
  margin-bottom: 8px;
}

.legal-content a {
  color: var(--halo-forest);
  text-decoration: underline;
}

.legal-content a:hover {
  opacity: 0.75;
}

.legal-meta {
  font-size: 14px;
  color: var(--halo-neutral);
  border-top: 1px solid var(--halo-border);
  padding-top: 24px;
  margin-top: 48px;
}

.legal-toc {
  background: var(--halo-sand);
  border: 1px solid var(--halo-border);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 48px;
}

.legal-toc h2 {
  font-size: 14px;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
  color: var(--halo-charcoal);
}

.legal-toc ol {
  margin: 0;
  padding-left: 20px;
  font-size: 15px;
}

.legal-table-wrap {
  overflow-x: auto;
  margin-bottom: 24px;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 620px;
}

.legal-table th,
.legal-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--halo-border);
  vertical-align: top;
}

.legal-table th {
  font-weight: 600;
  color: var(--halo-forest);
  font-family: 'Poppins', system-ui, sans-serif;
}

.legal-callout {
  background: var(--halo-sand);
  border-left: 4px solid var(--halo-forest);
  border-radius: 0 12px 12px 0;
  padding: 20px 24px;
  margin: 0 0 24px;
}

.legal-callout p:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .legal-hero {
    padding: 110px 0 32px;
  }

  .legal-body {
    padding: 40px 0 64px;
  }
}

/* --------------------------------------------------------------------------
   Base compartida (index.html ya define estas reglas en línea; aquí están
   para que las páginas legales se vean igual sin duplicar todo el CSS)
   -------------------------------------------------------------------------- */

.legal-page {
  font-family: 'Poppins', system-ui, sans-serif;
  background: #ffffff;
  color: var(--halo-charcoal);
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0;
}

.legal-page h1,
.legal-page h2,
.legal-page h3,
.legal-page h4 {
  font-family: 'Clash Display', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.legal-page .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.legal-page .nav-blur {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(233, 227, 210, 0.95);
  border-bottom: 1px solid var(--halo-border);
}

.focus-ring:focus-visible {
  outline: 3px solid var(--halo-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .legal-page .container {
    padding: 0 16px;
  }
}

/* --------------------------------------------------------------------------
   Panel de configuración de cookies
   -------------------------------------------------------------------------- */

.cookie-panel {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cookie-panel[hidden] {
  display: none;
}

.cookie-panel__dialog {
  background: #ffffff;
  border: 1px solid var(--halo-border);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}

.cookie-panel__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--halo-charcoal);
}

.cookie-panel__close:hover {
  opacity: 0.7;
}

.cookie-panel h2 {
  font-family: 'Clash Display', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 22px;
  color: var(--halo-forest);
  margin: 0 0 12px;
}

.cookie-panel__intro {
  font-size: 14px;
  line-height: 1.7;
  color: var(--halo-charcoal);
  margin: 0 0 24px;
}

.cookie-group {
  border: 1px solid var(--halo-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.cookie-group__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.cookie-group__title {
  font-weight: 600;
  font-size: 15px;
  color: var(--halo-charcoal);
  margin: 0;
}

.cookie-group__desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--halo-charcoal);
  margin: 0;
}

.cookie-group__fixed {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--halo-forest);
  white-space: nowrap;
  padding-top: 4px;
}

/* Interruptor accesible: es un checkbox real con apariencia de switch */
.cookie-switch {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 30px;
}

.cookie-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.cookie-switch__track {
  position: absolute;
  inset: 0;
  background: #C9C3B4;
  border-radius: 30px;
  transition: background 0.25s ease;
  pointer-events: none;
}

.cookie-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s ease;
}

.cookie-switch input:checked + .cookie-switch__track {
  background: var(--halo-forest);
}

.cookie-switch input:checked + .cookie-switch__track::after {
  transform: translateX(22px);
}

.cookie-switch input:focus-visible + .cookie-switch__track {
  outline: 3px solid var(--halo-accent);
  outline-offset: 2px;
}

.cookie-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.cookie-panel__actions .cookie-btn {
  flex: 1 1 160px;
}

.cookie-btn--ghost {
  background: transparent;
  color: var(--halo-charcoal);
  border-color: var(--halo-border);
}

.cookie-btn--ghost:hover {
  border-color: var(--halo-charcoal);
}

/* Sobre el fondo oscuro del banner, el botón secundario va en claro */
.cookie-banner .cookie-btn--ghost {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
}

.cookie-banner .cookie-btn--ghost:hover {
  border-color: #ffffff;
}

.cookie-panel__link {
  display: inline-block;
  margin-top: 16px;
  font-size: 13px;
  color: var(--halo-forest);
  text-decoration: underline;
}

@media (max-width: 720px) {
  .cookie-panel__dialog {
    padding: 24px 20px;
  }

  .cookie-panel__actions .cookie-btn {
    flex: 1 1 100%;
  }
}
