/**
 * Aviso de consentimiento: una caja abajo, centrada, por encima de todo.
 * Ver site/snippets/consent.php.
 *
 * El ancho se limita para que el texto no se estire de lado a lado en
 * pantallas grandes; en móvil deja el mismo margen que el <body>.
 */
.consent {
  position: fixed;
  inset-inline: var(--fs-base);
  bottom: var(--fs-base);
  z-index: 2;
  max-width: 28em;
  margin-inline: auto;
  padding: var(--fs-base);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
  background-color: var(--background);
  border: 1px solid var(--foreground);

  &[hidden] {
    display: none;
  }

  p {
    margin: 0;
  }
}

.consent-actions {
  display: flex;
  justify-content: center;
  gap: var(--fs-base);
  margin-top: var(--fs-base);
}

/**
 * Pie con el botón que vuelve a abrir el aviso. Va al final de la
 * página, centrado como el menú, separado del contenido por la unidad
 * de la marca.
 */
.consent-footer {
  display: flex;
  justify-content: center;
  margin-top: var(--space-iterare);
  font-size: var(--fs-small);
  line-height: var(--lh-small);
}

/**
 * Los botones se leen como los enlaces del site: texto sin adornos que
 * se rodea de paréntesis al pasar por encima. Ver links.css.
 */
:is(.consent-actions, .consent-footer) {
  button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;

    &::before,
    &::after {
      opacity: 0;
      transition: opacity 120ms ease-in-out;
    }

    &::before {
      content: "(";
    }

    &::after {
      content: ")";
    }

    &:is(:hover, :focus-visible)::before,
    &:is(:hover, :focus-visible)::after {
      opacity: 1;
    }

    &:focus-visible {
      outline: none;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  :is(.consent-actions, .consent-footer) button::before,
  :is(.consent-actions, .consent-footer) button::after {
    transition: none;
  }
}
