/* ==========================================================================
   Consent — the banner and the preference centre
   The marketing site and the dealership page. CAA Console and Passport load
   nothing third-party and measure nothing, so neither shell links this file.

   Drawn from core.css's role tokens (docs/DESIGN-SYSTEM.md), so it needs no
   palette of its own on either page. The banner is a raised card; the
   preference centre is the shared .dialog (components/dialog.js) and its
   switches are the shared .switch, so this file only lays out what is inside.

   Everything here is a real stylesheet rather than injected styles because the
   CSP carries no 'unsafe-inline' (src/worker.js) and tools/worker.test.mjs
   asserts it stays that way. tools/a11y.test.mjs holds it to the same rules as
   site.css: no motion beyond colour, no blur, no gradient.
   ========================================================================== */

/* --- The banner ------------------------------------------------------------
   Bottom-anchored. z-index 90 puts it over a menu sheet (70) and under toasts
   (120): a toast is a reply to something the visitor just did and must not be
   buried by this.
   -------------------------------------------------------------------------- */
.consent {
  position: fixed;
  left: var(--sp-3);
  right: var(--sp-3);
  /* Above the Ask Des launcher (16px up, 44px tall) with a gap, so the two
     never sit on each other in the bottom-right corner. */
  bottom: calc(var(--bar-inset, 0px) + var(--sp-7) + var(--sp-5));
  z-index: 90;
  padding: var(--sp-4);
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-top-color: var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  color: var(--ink);
}

.consent[hidden] {
  display: none;
}

/* The configurator's estimate bar sits along the foot of /quote; stack above it. */
body:has(.estimate) .consent {
  bottom: calc(var(--bar-inset, 0px) + var(--sp-7) + var(--sp-5) + var(--sp-4));
}

@media (min-width: 720px) {
  .consent {
    left: auto;
    right: var(--sp-5);
    width: min(440px, calc(100vw - 2 * var(--sp-5)));
    padding: var(--sp-5);
  }
}

.consent__inner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.consent__title {
  margin: 0 0 var(--sp-1);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
}

.consent__text {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}

/* Reject all and Accept all are one class and one size, side by side, and
   share the row's width equally. Choose is a small quiet button after them: on
   the same row when the three fit (a 360px phone does), otherwise wrapped
   beneath and kept to the right. Declining is not a secondary action dressed
   down to be missed. */
.consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.consent__actions .btn {
  flex: 1 1 6rem;
  min-width: 0;
  padding-inline: var(--sp-3);
}

.consent__actions .consent__choose {
  flex: 0 0 auto;
  margin-left: auto;
}

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

/* --- The preference centre (inside .dialog) -------------------------------- */
.consent-prefs__lede {
  margin: 0 0 var(--sp-4);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}

.consent-prefs__list {
  display: flex;
  flex-direction: column;
}

.consent-prefs__row {
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--border);
}

.consent-prefs__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-1);
}

.consent-prefs__label {
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
}

.consent-prefs__fixed {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.consent-prefs__summary {
  margin: 0 0 var(--sp-2);
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}

.consent-prefs__more {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}

.consent-prefs__more summary {
  display: inline-block;
  min-height: 24px;
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.consent-prefs__more summary:focus-visible {
  outline: 2px solid transparent; /* forced-colors still draws it */
  box-shadow: var(--ring);
  border-radius: var(--r-xs);
}

.consent-prefs__more p {
  margin: var(--sp-2) 0 0;
}

/* --- The record ------------------------------------------------------------ */
.consent-prefs__record {
  margin-top: var(--sp-2);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

.consent-prefs__note,
.consent-prefs__id {
  margin: 0 0 var(--sp-2);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  line-height: var(--lh-base);
}

/* The reference is meant to be read aloud down a phone or pasted into an
   email, so it is set where it can be selected whole. */
.consent-prefs__id code {
  color: var(--ink);
  font-family: var(--font-num, inherit);
  word-break: break-all;
}

.consent-prefs__withdraw {
  min-height: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--danger);
  font: inherit;
  font-size: var(--fs-xs);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

@media (hover: hover) {
  .consent-prefs__withdraw:hover {
    color: var(--ink);
  }
}

.consent-prefs__withdraw:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--ring);
  border-radius: var(--r-xs);
}
