/* cookie-consent — minimal, dark-mode aware. Override any --cc-* token. */
:root {
  --cc-bg: #ffffff;
  --cc-text: #1a1a2e;
  --cc-muted: #6b7280;
  --cc-border: #e5e7eb;
  --cc-link: #4361ee;
  --cc-btn-bg: #4361ee;
  --cc-btn-fg: #ffffff;
  --cc-radius: 8px;
  --cc-shadow: 0 -2px 16px rgba(0, 0, 0, 0.12);
  --cc-z: 2147483600;
}
@media (prefers-color-scheme: dark) {
  :root {
    --cc-bg: #1e1e2e;
    --cc-text: #e4e4e7;
    --cc-muted: #9ca3af;
    --cc-border: #2d2d3d;
    --cc-link: #8ea2ff;
    --cc-shadow: 0 -2px 16px rgba(0, 0, 0, 0.5);
  }
}

.cc-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--cc-z);
  background: var(--cc-bg);
  color: var(--cc-text);
  border-top: 1px solid var(--cc-border);
  box-shadow: var(--cc-shadow);
  padding: 16px clamp(16px, 4vw, 32px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: var(--cc-font, inherit);
}
.cc-text { flex: 1 1 320px; min-width: 0; }
.cc-link { color: var(--cc-link); text-decoration: underline; }

.cc-title { display: block; font-weight: var(--cc-font-weight-strong, 600); }
.cc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* One button style for every action in the banner and the modal: equal prominence (required). */
.cc-btn {
  appearance: none;
  background: var(--cc-btn-bg);
  color: var(--cc-btn-fg);
  border: 1px solid transparent;
  border-radius: var(--cc-radius);
  padding: 10px 18px;
  font: inherit;
  font-weight: var(--cc-font-weight-strong, 600);
  cursor: pointer;
}
.cc-btn:focus-visible, .cc-close:focus-visible { outline: 2px solid var(--cc-link); outline-offset: 2px; }

/* The settings modal: a native <dialog> opened with showModal() (top layer, page behind inert). */
.cc-modal {
  /* Centre it ourselves: any author reset (Tailwind's preflight, a plain `* { margin: 0 }`) outranks the browser's own
     centring (its `margin: auto` and `inset: 0` for a dialog), and showModal() would then pin it to a top corner. A plain
     class on purpose, so a host can still restyle it; README Gotchas lists the resets this cannot beat. */
  margin: auto;
  inset: 0;
  padding: 0;
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  background: var(--cc-bg);
  color: var(--cc-text);
  box-shadow: var(--cc-shadow);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: var(--cc-font, inherit);
  animation: cc-pop 160ms ease-out;
}
.cc-modal::backdrop { background: rgba(0, 0, 0, 0.5); }
/* An author display rule (a host theme, or this sheet) would otherwise show the closed dialog. */
.cc-modal:not([open]) { display: none !important; }
.cc-modal-body { padding: 20px clamp(16px, 4vw, 28px); display: flex; flex-direction: column; gap: 16px; }
.cc-modal-title { margin: 0; font-size: 18px; line-height: 1.3; font-weight: var(--cc-font-weight-strong, 700); }
.cc-rows { display: flex; flex-direction: column; gap: 12px; }
.cc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.cc-label { display: inline-flex; align-items: center; gap: 8px; font-weight: var(--cc-font-weight-strong, 600); }
.cc-label input { accent-color: var(--cc-btn-bg); }
.cc-badge { color: var(--cc-muted); font-size: 12px; }
.cc-desc { flex-basis: 100%; margin: 0; color: var(--cc-muted); }
.cc-close {
  align-self: flex-start;
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 0;
  font: inherit;
  color: var(--cc-link);
  text-decoration: underline;
  cursor: pointer;
}
@keyframes cc-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cc-modal { animation: none; } }

@media (max-width: 560px) {
  .cc-actions { width: 100%; }
  .cc-btn { flex: 1 1 auto; }
}

/* A host may hide a banner or modal child with the `hidden` attribute (the modal's Tab loop skips it); the JS sets none
   itself. An author `display` rule (.cc-row above, or a host theme) outranks the browser's own [hidden] rule, so
   restate it here, scoped to our two roots — never the host page. */
.cc-banner [hidden], .cc-modal [hidden] { display: none !important; }
