/* ==========================================================================
   styles-consent.css — aviso y panel de consentimiento de cookies
   Pieza de Milton. Prefijo propio `.gx-consent-*`, sin tokens nuevos:
   reutiliza los de :root de styles-burdeos.css (DESIGN.md de Lola).
   Reglas respetadas: tarjetas a secas (borde completo de 1 px, esquinas de la
   marca, fondo de superficie), sin barras ni filetes de acento, sin degradados,
   Raleway, intervención selectiva en burdeos.
   ========================================================================== */

:root {
  /* Distancia del aviso a los bordes de la ventana. */
  --gx-consent-margen: 24px;
}

.gx-consent-hidden {
  display: none !important;
}

/* FMT-005 (S3): mientras el aviso fijo existe, reserva su altura al hacer
   scroll por foco y al final de la página (WCAG 2.4.11). consent.js pone la
   clase en <html> y mide --gx-consent-h al crear el aviso. */
html.gx-consent-activo {
  scroll-padding-bottom: calc(var(--gx-consent-h, 0px) + var(--gx-consent-margen) + 16px);
}

html.gx-consent-activo body {
  padding-bottom: calc(var(--gx-consent-h, 0px) + var(--gx-consent-margen));
}

/* --------------------------------------------------------------------------
   Aviso: tarjeta pequeña abajo a la izquierda (auditoría A3 y decisión B2 del
   11-11-2026). Antes era una franja a todo lo ancho con filete burdeos que
   tapaba del 20 al 49 % de la pantalla. Objetivo: 420 × 150 px como máximo en
   escritorio y 170 px de alto en el iPhone.
   -------------------------------------------------------------------------- */

.gx-consent-bar {
  position: fixed;
  left: var(--gx-consent-margen);
  bottom: calc(var(--gx-consent-margen) + env(safe-area-inset-bottom, 0px));
  z-index: 9000;
  box-sizing: border-box;
  width: min(420px, calc(100vw - 2 * var(--gx-consent-margen)));
  padding: 16px 18px 18px;
  background: var(--paper, #ffffff);
  border: 1px solid var(--line, #e1e1e1);
  /* Esquinas apenas redondeadas (regla de Milton del 11-11) aunque la web ponga --radius a 0, y la sombra estándar
     de DESIGN.md, más ligera que la de la composición oscura que redefine --shadow. */
  border-radius: 4px;
  box-shadow: 0 18px 50px rgba(43, 43, 43, 0.12);
  font-family: Raleway, "Segoe UI", Arial, sans-serif;
  color: var(--graphite, #2b2b2b);
  /* Sin «fill-mode»: si la animación no llega a correr, la tarjeta se ve igual. */
  animation: gx-consent-entra 0.18s ease-out;
}

@keyframes gx-consent-entra {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.gx-consent-bar__copy {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--gray, #616160);
}

.gx-consent-bar__links {
  white-space: nowrap;
}

.gx-consent-bar__copy a,
.gx-consent-link {
  color: var(--wine, #702c36);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* «Configurar» abre el panel: es un botón con aspecto de enlace dentro de la frase. */
.gx-consent-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
}

.gx-consent-bar__copy a:hover,
.gx-consent-link:hover {
  color: var(--wine-dark, #4f1d27);
}

.gx-consent-bar__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

/* --------------------------------------------------------------------------
   Botones — «Aceptar» y «Rechazar» (y los tres del panel) son idénticos en
   forma, tamaño, color y peso: la misma jerarquía visual, así que rechazar es
   exactamente tan fácil como aceptar.
   -------------------------------------------------------------------------- */

.gx-consent-btn {
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 13px 26px;
  min-width: 132px;
  border-radius: var(--radius, 6px);
  border: 1.5px solid var(--wine, #702c36);
  cursor: pointer;
  text-align: center;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.gx-consent-btn {
  background: var(--paper, #ffffff);
  color: var(--wine, #702c36);
}

.gx-consent-bar__actions .gx-consent-btn {
  min-width: 0;
  min-height: 40px;
  padding: 10px 12px;
}

@media (hover: hover) {
  .gx-consent-btn:hover {
    background: var(--wine, #702c36);
    color: #ffffff;
  }
}

.gx-consent-btn:focus-visible,
.gx-consent-link:focus-visible,
.gx-consent-bar__copy a:focus-visible,
.gx-consent-open:focus-visible,
.gx-consent-switch input:focus-visible + .gx-consent-switch__track {
  outline: 2px solid var(--wine, #702c36);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Panel de preferencias
   -------------------------------------------------------------------------- */

.gx-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  background: rgba(6, 6, 6, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.gx-consent-panel {
  background: #f3f1ed;
  border-radius: var(--radius, 6px);
  box-shadow: var(--shadow, 0 18px 50px rgba(43, 43, 43, 0.12));
  width: 100%;
  max-width: 640px;
  margin: auto;
  font-family: Raleway, "Segoe UI", Arial, sans-serif;
  color: var(--graphite, #2b2b2b);
}

.gx-consent-panel__head {
  position: relative;
  padding: 28px 64px 18px 32px;
  border-bottom: 1px solid rgba(43, 43, 43, 0.12);
}

.gx-consent-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius, 6px);
  background: none;
  color: var(--gray, #616160);
  font: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.gx-consent-close:hover {
  color: var(--graphite, #2b2b2b);
  background: rgba(43, 43, 43, 0.06);
}

.gx-consent-close:focus-visible {
  outline: 2px solid var(--wine, #702c36);
  outline-offset: 2px;
}

.gx-consent-panel__title {
  margin: 0 0 8px;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.gx-consent-panel__intro {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--gray, #616160);
}

.gx-consent-panel__body {
  padding: 8px 32px 4px;
}

.gx-consent-group {
  padding: 20px 0;
  border-bottom: 1px solid rgba(43, 43, 43, 0.12);
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.gx-consent-group:last-child {
  border-bottom: 0;
}

.gx-consent-group__text {
  flex: 1 1 auto;
}

.gx-consent-group__name {
  margin: 0 0 5px;
  font-size: 0.98rem;
  font-weight: 700;
}

.gx-consent-group__desc {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.58;
  color: var(--gray, #616160);
}

.gx-consent-group__fixed {
  flex: 0 0 auto;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray, #616160);
  padding-top: 3px;
  white-space: nowrap;
}

/* Interruptor */

.gx-consent-switch {
  flex: 0 0 auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.gx-consent-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.gx-consent-switch__track {
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: #d6d2ca;
  border: 1px solid transparent;
  position: relative;
  transition: background-color 0.2s ease;
}

.gx-consent-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(43, 43, 43, 0.3);
  transition: transform 0.2s ease;
}

.gx-consent-switch input:checked + .gx-consent-switch__track {
  background: var(--wine, #702c36);
}

.gx-consent-switch input:checked + .gx-consent-switch__track::after {
  transform: translateX(20px);
}

.gx-consent-panel__foot {
  padding: 20px 32px 28px;
  border-top: 1px solid rgba(43, 43, 43, 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.gx-consent-panel__foot .gx-consent-btn {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 12px;
}

.gx-consent-note {
  padding: 0 32px 22px;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--gray, #616160);
}

.gx-consent-note a {
  color: var(--wine, #702c36);
}

/* --------------------------------------------------------------------------
   Enlace «Preferencias de cookies» del pie: se comporta como el resto de
   enlaces de la franja legal, pero es un botón real.
   -------------------------------------------------------------------------- */

.gx-consent-open {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.gx-consent-open:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Estado guardado (aviso breve tras elegir)
   -------------------------------------------------------------------------- */

.gx-consent-saved {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 9000;
  background: var(--graphite, #2b2b2b);
  color: #ffffff;
  font-family: Raleway, "Segoe UI", Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--radius, 6px);
  box-shadow: var(--shadow, 0 18px 50px rgba(43, 43, 43, 0.12));
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Zonas táctiles: «Política de cookies» y «Configurar» van dentro de la frase,
   pero el dedo las encuentra en 44 px de alto sin mover el texto (A1-09). */
@media (pointer: coarse) {
  .gx-consent-bar__copy a,
  .gx-consent-link {
    position: relative;
  }

  .gx-consent-bar__copy a::after,
  .gx-consent-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 44px;
    transform: translateY(-50%);
  }
}

@media (max-width: 620px) {
  :root {
    --gx-consent-margen: 12px;
  }

  .gx-consent-bar {
    padding: 14px 16px 16px;
  }

  .gx-consent-bar__actions .gx-consent-btn {
    min-height: 44px;
  }

  .gx-consent-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .gx-consent-panel {
    max-width: none;
    border-radius: var(--radius, 6px) var(--radius, 6px) 0 0;
    max-height: 92vh;
    overflow-y: auto;
  }

  .gx-consent-panel__head,
  .gx-consent-panel__body,
  .gx-consent-panel__foot,
  .gx-consent-note {
    padding-left: 22px;
    padding-right: 22px;
  }

  /* A3-14: los tres botones quedan siempre a la vista, al pie del panel, aunque el texto se desplace. */
  .gx-consent-panel__foot {
    position: sticky;
    bottom: 0;
    z-index: 1;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 14px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: #f3f1ed;
  }

  .gx-consent-panel__foot .gx-consent-btn {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 12px;
  }

  .gx-consent-panel__head {
    padding-right: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gx-consent-bar,
  .gx-consent-switch__track,
  .gx-consent-switch__track::after,
  .gx-consent-btn {
    animation: none !important;
    transition: none !important;
  }
}
