/* ==========================================================================
   Cookie banner and settings dialog (inc/consent.php)
   ========================================================================== */

/* Pinned to the bottom, never covering the whole page: the site stays usable
   while the question waits for an answer. */
.consent {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 9990;
  padding: 0 var(--gutter) max(1rem, env(safe-area-inset-bottom));
  pointer-events: none;
}
.consent[hidden] { display: none; }

.consent__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container);
  margin-inline: auto;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
}

.consent__copy { flex: 1 1 32rem; min-width: 0; }
.consent__title {
  margin: 0 0 0.3rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.consent__text { margin: 0; font-size: 0.9rem; line-height: 1.55; color: var(--fg-muted); }
.consent__text a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; }

.consent__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

@media (max-width: 640px) {
  .consent__inner { padding: 1.1rem; }
  /* Equal-width Accept and Reject on a phone: neither one looks like the default. */
  .consent__actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .consent__actions .btn { width: 100%; }
  .consent__actions .btn--outline { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------------ Dialog */
.consent-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--paper);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
}
.consent-dialog::backdrop { background: rgba(8, 17, 29, 0.55); }

.consent-dialog__form { position: relative; padding: 1.75rem 1.75rem 1.5rem; }
.consent-dialog__title {
  margin: 0 2rem 1rem 0;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
}

.consent-dialog__row {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  justify-content: space-between;
  padding-block: 1rem;
  border-top: 1px solid var(--line-soft);
}
.consent-dialog__row h3 { margin: 0 0 0.25rem; font-family: var(--font-sans); font-size: 0.95rem; font-weight: 700; }
.consent-dialog__row p { margin: 0; font-size: 0.86rem; line-height: 1.5; color: var(--fg-muted); }

.consent-dialog__always {
  flex: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate-500);
  white-space: nowrap;
}

/* A plain checkbox, drawn as a switch. Still a real checkbox underneath, so
   keyboards, screen readers and forced-colours mode all keep working. */
.consent-dialog__switch {
  flex: none;
  position: relative;
  width: 2.75rem;
  height: 1.55rem;
  margin: 0.1rem 0 0;
  border-radius: var(--r-full);
  background: var(--sand-2);
  box-shadow: inset 0 0 0 1px var(--line);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.consent-dialog__switch::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(8, 17, 29, 0.25);
  transition: transform 0.2s var(--ease);
}
.consent-dialog__switch:checked { background: var(--blue-600); box-shadow: none; }
.consent-dialog__switch:checked::after { transform: translateX(1.2rem); }
.consent-dialog__switch:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 3px; }

@media (forced-colors: active) {
  .consent-dialog__switch { appearance: auto; -webkit-appearance: auto; width: auto; height: auto; }
  .consent-dialog__switch::after { display: none; }
}

.consent-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
}

.consent-dialog__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--slate-500);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.consent-dialog__close:hover { background: var(--sand); color: var(--fg); }

@media (prefers-reduced-motion: reduce) {
  .consent-dialog__switch,
  .consent-dialog__switch::after { transition: none; }
}

/* ---------------------------------------------- Footer "Cookie settings" */
.footer__cookie-settings {
  padding: 3px 0; /* Same 24px+ tap height as the footer links beside it. */
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.footer__cookie-settings:hover { color: #fff; text-decoration: underline; text-underline-offset: 0.15em; }
