/* ═══════════════════════════════════════════════════════
   consent.css: the cookie consent card (built by site-prefs.js, classes only).
   A dock at the bottom edge, never a card over the page's first screen (owner 2026-11-29: it covered the hero CTAs):
   phones get a full-width bottom bar (text, then Reject, Accept and Manage on one row, about 150 px); from 640 px a
   centred dock, and from 720 px the first layer is one row (text, Reject + Accept, Manage) under 110 px. The Manage panel keeps a 420 px card, centred at the bottom.
   Reject and Accept share one size and weight: a refusal is never harder than consent.
   Every colour reads the site's tokens with a hard fallback, so a base that defines none still gets a readable card.
   The root exists in the DOM only while the card is open: `:root:has(.tt-consent)` is the "consent is open" switch.
   ═══════════════════════════════════════════════════════ */

.tt-consent {
  --tt-c-bg: var(--consent-bg, var(--surface, #fff));
  --tt-c-fg: var(--consent-fg, var(--ink, #111));
  --tt-c-soft: var(--consent-soft, var(--ink-soft, #55585f));
  --tt-c-line: var(--consent-border, var(--border-strong, var(--border, #8b8f98)));
  --tt-c-accent: var(--consent-accent, var(--accent, #111));
  --tt-c-on-accent: var(--consent-on-accent, var(--on-accent, #fff));

  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: var(--z-consent, 100);
  box-sizing: border-box;
  width: 100%;
  margin-inline: auto;
  max-height: 55dvh;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--tt-c-bg);
  color: var(--tt-c-fg);
  border: 0;
  border-top: 1px solid var(--tt-c-line);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -12px 32px -16px rgb(0 0 0 / 0.5);
  font: 400 0.875rem/1.5 var(--font-body, system-ui, -apple-system, "Segoe UI", sans-serif);
  text-align: start;
  opacity: 1;
  transform: none;
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

@starting-style {
  .tt-consent { opacity: 0; transform: translateY(8px); }
}

@media (min-width: 640px) {
  .tt-consent {
    inset-block-end: 16px;
    width: min(960px, calc(100vw - 48px));
    padding: 12px 20px;
    border: 1px solid var(--tt-c-line);
    border-radius: 10px;
    box-shadow: 0 12px 32px -12px rgb(0 0 0 / 0.45);
  }
  /* The Manage panel is a form, not a bar: a 420 px card, still centred on the bottom edge. */
  .tt-consent:has(.tt-consent__panel:not([hidden])) { width: min(420px, calc(100vw - 48px)); padding: 16px 20px; }
}
/* Phones: Manage joins the button row, so the bar is one text block and one 44 px row. */
.tt-consent__view:not(.tt-consent__panel):not([hidden]) { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 0 8px; }
.tt-consent__view:not(.tt-consent__panel) .tt-consent__text { grid-column: 1 / -1; }
.tt-consent__view:not(.tt-consent__panel) .tt-consent__actions { display: contents; }
.tt-consent__view:not(.tt-consent__panel) .tt-consent__manage { margin: 0; padding-inline: 4px; }
@media (min-width: 720px) {
  .tt-consent__view:not(.tt-consent__panel) .tt-consent__actions { display: flex; }
  .tt-consent__view:not(.tt-consent__panel):not([hidden]) { display: flex; align-items: center; gap: 16px; }
  .tt-consent__view:not(.tt-consent__panel) .tt-consent__text { flex: 1 1 auto; margin: 0; }
  .tt-consent__view:not(.tt-consent__panel) .tt-consent__actions { flex: 0 0 min(300px, 38%); }
  .tt-consent__view:not(.tt-consent__panel) .tt-consent__manage { flex: none; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tt-consent,
  .tt-consent__btn { transition: none; }
  .tt-consent__btn:active { transform: none; }
}

.tt-consent[hidden],
.tt-consent [hidden] { display: none !important; }

.tt-consent__text { margin: 0 0 8px; color: var(--tt-c-soft); text-wrap: pretty; }
.tt-consent__text a,
.tt-consent__link {
  color: var(--tt-c-fg);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* One row, two equal buttons. */
.tt-consent__actions { display: flex; gap: 8px; }
.tt-consent__btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid var(--tt-c-line);
  border-radius: 6px;
  background: transparent;
  color: var(--tt-c-fg);
  font: 600 0.875rem/1.2 var(--font-body, system-ui, -apple-system, "Segoe UI", sans-serif);
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease-out;
}
.tt-consent__btn:hover { background: color-mix(in srgb, var(--tt-c-fg) 8%, transparent); }
.tt-consent__btn:active { transform: scale(0.97); }
.tt-consent__btn--primary {
  background: var(--tt-c-accent);
  border-color: var(--tt-c-accent);
  color: var(--tt-c-on-accent);
}
.tt-consent__btn--primary:hover { background: color-mix(in srgb, var(--tt-c-accent) 88%, var(--tt-c-fg)); }

/* Manage: a text link under the buttons. */
.tt-consent__manage,
.tt-consent__back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--tt-c-fg);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.tt-consent__manage:hover,
.tt-consent__back:hover { text-decoration-thickness: 2px; }

/* Panel view: one row per category. */
.tt-consent__panel { display: grid; gap: 4px; }
.tt-consent__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 6px 0;
  border-bottom: 1px solid var(--tt-c-line);
}
.tt-consent__row strong { display: block; font-weight: 600; }
.tt-consent__row small { display: block; color: var(--tt-c-soft); font-size: 0.8125rem; line-height: 1.4; }
.tt-consent__badge { color: var(--tt-c-soft); font-size: 0.8125rem; white-space: nowrap; }
.tt-consent__check { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--tt-c-accent); cursor: pointer; }
.tt-consent__intro { margin: 0 0 4px; color: var(--tt-c-soft); font-size: 0.8125rem; line-height: 1.45; }
.tt-consent__panel .tt-consent__btn--primary { flex: none; width: 100%; margin-top: 8px; }

.tt-consent a:focus-visible,
.tt-consent button:focus-visible,
.tt-consent input:focus-visible {
  outline: 2px solid var(--tt-c-fg);
  outline-offset: 2px;
}

/* The footer link that reopens the card, when the template has no [data-open-cookie-settings] control of its own. */
.tt-consent-settings {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-soft, #55585f);
  font-size: 0.8125rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.tt-consent-settings--on-footer { color: rgb(255 255 255 / 0.72); }
