/* consent.css: styles for the consent card built by assets/js/consent.js.
   One implementation shared by several static sites.
   Only the SITE TOKENS block differs: it maps the card onto this site's
   own colour, type and shape variables, so light/dark follow the site theme. */

/* =========================== SITE TOKENS ============================== */
.cc-root {
  --cc-bg: var(--bg-2);
  --cc-ink: var(--ink);
  --cc-ink-2: var(--ink-2);
  --cc-muted: var(--muted);
  --cc-line: var(--line);
  --cc-line-strong: var(--muted);
  --cc-accent: var(--accent);
  --cc-accent-ink: var(--accent-ink);
  --cc-link: var(--accent);
  --cc-switch-off: var(--bg);
  --cc-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  --cc-radius: 4px;
  --cc-pad: 1.25rem;
  --cc-font: var(--sans);
  --cc-title-font: var(--mono);
  --cc-title-size: 0.78rem;
  --cc-title-weight: 500;
  --cc-title-tracking: 0.06em;
  --cc-title-case: uppercase;
  --cc-title-ink: var(--accent);
  --cc-btn-font: var(--mono);
  --cc-btn-size: 0.8rem;
  --cc-btn-weight: 500;
  --cc-btn-tracking: 0.02em;
  --cc-btn-case: none;
  --cc-btn-ink: var(--ink);
  --cc-btn-bg: transparent;
  --cc-btn-border: var(--line);
  --cc-btn-radius: 999px;
  --cc-btn-hover-ink: var(--accent);
  --cc-btn-hover-bg: transparent;
  --cc-btn-hover-border: var(--accent);
}

/* ======================== END SITE TOKENS ============================= */

/* Everything below is shared and identical on every site. To fix a bug,
   change it once and copy this part into each site's consent.css. */

/* A non-modal card: bottom-right corner, a full-width bottom sheet on
   phones. position: fixed, so it never shifts the page; no backdrop, and
   only the card itself takes pointer events. */
.cc-root[hidden] { display: none; }
.cc-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  width: 26rem;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.cc-dialog {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--cc-pad);
  background: var(--cc-bg);
  color: var(--cc-ink);
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  font-family: var(--cc-font);
  font-size: 1rem;
  line-height: 1.5;
  text-align: left;
  pointer-events: auto;
}

@media (max-width: 480px) {
  .cc-root { left: 0; right: 0; bottom: 0; width: auto; max-width: none; }
  .cc-dialog {
    max-height: 88vh;
    max-height: 88dvh;
    padding-bottom: max(var(--cc-pad), env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: var(--cc-radius) var(--cc-radius) 0 0;
  }
}

/* Extra scroll room at the end of the page while the card is open, so the
   footer can be scrolled clear of it. Height is set by consent.js. */
.cc-spacer { display: block; flex: none; width: 100%; grid-column: 1 / -1; margin: 0; padding: 0; pointer-events: none; }

/* Polite screen-reader announcement; visually hidden. */
.cc-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.cc-dialog:focus { outline: none; }
.cc-dialog *, .cc-dialog *::before, .cc-dialog *::after { box-sizing: border-box; }

.cc-root .cc-panel { margin: 0; padding: 0; }
.cc-root .cc-panel[hidden] { display: none; }

.cc-root .cc-head { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0; padding: 0; }
.cc-root .cc-head .cc-title { flex: 1 1 auto; min-width: 0; padding-top: 0.15rem; }
.cc-root .cc-close {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -0.7rem -0.7rem 0 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1;
  color: var(--cc-muted);
  background: transparent;
  border: 0;
  border-radius: var(--cc-btn-radius);
  cursor: pointer;
  transform: none;
}
.cc-root .cc-close:hover { color: var(--cc-ink); }
.cc-root .cc-close:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: -4px; }

.cc-root .cc-title {
  margin: 0 0 0.6rem;
  max-width: none;
  padding: 0;
  font-family: var(--cc-title-font);
  font-size: var(--cc-title-size);
  font-weight: var(--cc-title-weight);
  letter-spacing: var(--cc-title-tracking);
  text-transform: var(--cc-title-case);
  line-height: 1.25;
  color: var(--cc-title-ink);
}
.cc-root .cc-title::before, .cc-root .cc-title::after { content: none; }
.cc-root .cc-title:focus { outline: none; }
.cc-root .cc-title:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 3px; }

.cc-root .cc-text, .cc-root .cc-gpc, .cc-root .cc-cat-desc {
  margin: 0;
  max-width: none;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--cc-ink-2);
}
.cc-root .cc-gpc { margin-top: 0.6rem; font-size: 0.86rem; color: var(--cc-muted); }
.cc-root .cc-gpc[hidden] { display: none; }
.cc-root .cc-policy {
  color: var(--cc-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  white-space: nowrap;
}
.cc-root .cc-policy:hover { color: var(--cc-accent); }

.cc-root .cc-cats { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--cc-line); }
.cc-root .cc-cat { margin: 0; padding: 0.85rem 0; border-bottom: 1px solid var(--cc-line); }
.cc-root .cc-cat::before { content: none; }
.cc-root .cc-cat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin: 0 0 0.3rem; }
.cc-root .cc-cat-name {
  flex: 1 1 9rem;
  min-width: 0;
  font-family: var(--cc-btn-font);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--cc-ink);
  cursor: pointer;
}
.cc-root .cc-always { margin-left: auto; font-size: 0.8rem; color: var(--cc-muted); }
.cc-root .cc-cat-desc { font-size: 0.88rem; }
.cc-root .cc-vendors { color: var(--cc-muted); }

/* Toggle switch: a real checkbox, restyled. */
.cc-root .cc-switch {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 auto;
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0;
  border: 1px solid var(--cc-line-strong);
  border-radius: 999px;
  background: var(--cc-switch-off);
  cursor: pointer;
}
/* 44px-tall hit area around the 24px-tall switch. */
.cc-root .cc-switch::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.cc-root .cc-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.5rem - 6px);
  height: calc(1.5rem - 6px);
  border-radius: 50%;
  background: var(--cc-ink-2);
}
.cc-root .cc-cat-head .cc-switch { margin-left: auto; }
.cc-root .cc-cat-head .cc-always + .cc-switch { margin-left: 0; }
.cc-root .cc-switch:checked { background: var(--cc-accent); border-color: var(--cc-accent); }
.cc-root .cc-switch:checked::after { left: calc(100% - 1.5rem + 4px); background: var(--cc-accent-ink); }
.cc-root .cc-switch:disabled { cursor: not-allowed; opacity: 0.6; }
.cc-root .cc-switch:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 3px; }

/* Buttons: every choice gets the same style on purpose. */
.cc-root .cc-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin: 1rem 0 0;
}
.cc-root .cc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: max(44px, 2.75rem);
  margin: 0;
  padding: 0.5rem 0.9rem;
  font-family: var(--cc-btn-font);
  font-size: var(--cc-btn-size);
  font-weight: var(--cc-btn-weight);
  letter-spacing: var(--cc-btn-tracking);
  text-transform: var(--cc-btn-case);
  line-height: 1.25;
  text-align: center;
  color: var(--cc-btn-ink);
  background: var(--cc-btn-bg);
  border: 1px solid var(--cc-btn-border);
  border-radius: var(--cc-btn-radius);
  cursor: pointer;
  transform: none;
}
.cc-root .cc-btn:hover { color: var(--cc-btn-hover-ink); background: var(--cc-btn-hover-bg); border-color: var(--cc-btn-hover-border); }
.cc-root .cc-btn:focus-visible { outline: 2px solid var(--cc-accent); outline-offset: 3px; }

/* The card creeps up from below the edge of the window. With reduced motion
   it simply appears. */
@media (prefers-reduced-motion: no-preference) {
  .cc-root:not([hidden]) .cc-dialog { animation: cc-rise 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .cc-root.cc-first:not([hidden]) .cc-dialog { animation: cc-creep 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .cc-root .cc-switch::after { transition: left 0.15s ease; }
  .cc-root .cc-btn { transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
}
@keyframes cc-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes cc-creep { from { transform: translateY(calc(100% + 40px)); } to { transform: none; } }

@media print {
  .cc-root, .cc-spacer, .cc-status { display: none !important; }
}

@media (forced-colors: active) {
  .cc-root .cc-switch:checked::after { background: Highlight; }
  .cc-root .cc-btn { border: 1px solid ButtonText; }
}
