/*!
 * Agency Consent v1.1.0 — styles
 *
 * THEMING: override any --cc-* variable on :root in the client's own CSS.
 * The defaults below use :where() so they have zero specificity and any
 * site value wins, regardless of load order.
 *
 * Font: by default the banner inherits the site's font. Set --cc-font to override.
 */

:where(:root) {
  /* Colors */
  --cc-bg: #ffffff;
  --cc-text: #17202b;
  --cc-muted: #566170;
  --cc-border: #dde2e8;
  --cc-btn-bg: #2f3fc4;
  --cc-btn-text: #ffffff;
  --cc-btn-bg-hover: #24319f;
  --cc-link: var(--cc-btn-bg);
  --cc-focus: var(--cc-btn-bg);
  --cc-switch-off: #b4bcc6;
  --cc-switch-on: var(--cc-btn-bg);
  --cc-backdrop: rgb(16 24 40 / 0.45);

  /* Type */
  /* --cc-font: "Inter", system-ui, sans-serif;   (unset = inherit site font) */
  --cc-font-size: 0.9375rem;
  --cc-line-height: 1.5;
  --cc-title-size: 1.0625rem;
  --cc-title-weight: 650;

  /* Shape & layout */
  --cc-radius: 16px;
  --cc-btn-radius: 10px;
  --cc-shadow: 0 18px 50px -12px rgb(16 24 40 / 0.28), 0 2px 6px rgb(16 24 40 / 0.08);
  --cc-offset: 20px;
  --cc-max-width: 440px;
  --cc-z: 2147483000;
}

/* ---------- Base / reset (protects against site CSS leaking in) ---------- */

.acc-root,
.acc-root *,
.acc-placeholder,
.acc-placeholder * {
  box-sizing: border-box;
}

.acc-root [hidden],
.acc-placeholder[hidden] {
  display: none !important;
}

.acc-banner,
.acc-prefs {
  font-family: var(--cc-font);
  font-size: var(--cc-font-size);
  line-height: var(--cc-line-height);
  color: var(--cc-text);
  background: var(--cc-bg);
  text-align: left;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}

.acc-title {
  margin: 0 0 6px;
  font: inherit;
  font-size: var(--cc-title-size);
  font-weight: var(--cc-title-weight);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: inherit;
  text-transform: none;
}

.acc-text {
  margin: 0;
  color: var(--cc-muted);
}

/* ---------- Banner (first layer) ---------- */

.acc-banner {
  position: fixed;
  z-index: var(--cc-z);
  bottom: calc(var(--cc-offset) + env(safe-area-inset-bottom, 0px));
  left: var(--cc-offset);
  width: min(var(--cc-max-width), calc(100vw - 2 * var(--cc-offset)));
  margin: 0;
  padding: 22px 22px 18px;
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  animation: acc-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.acc-root[data-position="bottom-right"] .acc-banner {
  left: auto;
  right: var(--cc-offset);
}

.acc-root[data-position="center"] .acc-banner {
  top: 50%;
  left: 50%;
  bottom: auto;
  translate: -50% -50%;
}

.acc-root[data-position="bottom"] .acc-banner {
  left: var(--cc-offset);
  right: var(--cc-offset);
  width: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 32px;
  align-items: center;
}

.acc-root[data-position="bottom"] .acc-banner > :not(.acc-actions) {
  grid-column: 1;
  max-width: 72ch;
}

.acc-root[data-position="bottom"] .acc-actions {
  grid-column: 2;
  grid-row: 1 / span 3;
  grid-template-columns: repeat(3, auto);
  margin-top: 0;
}

.acc-root[data-position="bottom"] .acc-actions .acc-btn--ghost {
  grid-column: auto;
}

.acc-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--cc-z) - 1);
  background: var(--cc-backdrop);
  pointer-events: none;
}

.acc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.acc-actions .acc-btn--ghost {
  grid-column: 1 / -1;
}

.acc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 14px 0 0;
  font-size: 0.8125rem;
}

.acc-links a,
.acc-link-btn {
  color: var(--cc-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Buttons ---------- */

.acc-btn {
  appearance: none;
  margin: 0;
  min-height: 44px;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
  border: 1.5px solid transparent;
  border-radius: var(--cc-btn-radius);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

/* Accept and Reject share this style on purpose: equal prominence. */
.acc-btn--choice {
  background: var(--cc-btn-bg);
  color: var(--cc-btn-text);
}

.acc-btn--choice:hover {
  background: var(--cc-btn-bg-hover);
}

.acc-btn--ghost {
  background: transparent;
  color: var(--cc-text);
  border-color: var(--cc-border);
}

.acc-btn--ghost:hover {
  border-color: var(--cc-text);
}

.acc-link-btn {
  appearance: none;
  margin: 0;
  padding: 4px;
  font: inherit;
  font-size: 0.875rem;
  background: none;
  border: 0;
  cursor: pointer;
}

.acc-btn:focus-visible,
.acc-link-btn:focus-visible,
.acc-links a:focus-visible,
.acc-switch:focus-visible,
.acc-close:focus-visible,
.acc-fab:focus-visible {
  outline: 3px solid var(--cc-focus);
  outline-offset: 2px;
}

/* ---------- Settings dialog (second layer) ---------- */

.acc-prefs {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: min(85dvh, 760px);
  padding: 0;
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  overflow: hidden;
}

.acc-prefs[open] {
  display: flex;
  flex-direction: column;
  animation: acc-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.acc-prefs::backdrop {
  background: var(--cc-backdrop);
}

.acc-prefs-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
}

.acc-prefs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 4px;
}

.acc-prefs-head .acc-title {
  margin: 0;
}

.acc-close {
  appearance: none;
  flex: none;
  width: 44px;
  height: 44px;
  margin: -6px -12px -6px 0;
  padding: 0;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: var(--cc-btn-radius);
  cursor: pointer;
}

.acc-close:hover {
  background: color-mix(in srgb, var(--cc-text) 8%, transparent);
}

.acc-prefs-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px 22px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.acc-prefs-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 22px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--cc-border);
}

.acc-btn--wide {
  grid-column: 1 / -1;
}

/* Categories */

.acc-cats {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.acc-cat {
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--cc-border);
}

.acc-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.acc-cat-title {
  font-weight: 600;
  cursor: pointer;
}

.acc-cat-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.acc-always {
  font-size: 0.8125rem;
  color: var(--cc-muted);
}

.acc-cat-desc {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--cc-muted);
  max-width: 60ch;
}

/* Switch */

.acc-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  margin: 0;
  background: var(--cc-switch-off);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.acc-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: translate 0.2s;
}

.acc-switch:checked {
  background: var(--cc-switch-on);
}

.acc-switch:checked::before {
  translate: 18px 0;
}

.acc-switch:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* ---------- Reopen button ---------- */

.acc-fab {
  position: fixed;
  z-index: calc(var(--cc-z) - 2);
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--cc-text);
  background: var(--cc-bg);
  border: 1px solid var(--cc-border);
  border-radius: 50%;
  box-shadow: var(--cc-shadow);
  cursor: pointer;
}

.acc-root[data-position="bottom-right"] .acc-fab {
  left: auto;
  right: 16px;
}

/* ---------- Placeholder for blocked embeds ---------- */

.acc-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 200px;
  padding: 24px;
  font-family: var(--cc-font);
  font-size: 0.9375rem;
  line-height: 1.5;
  text-align: center;
  color: var(--cc-text);
  background: color-mix(in srgb, var(--cc-text) 5%, var(--cc-bg));
  border: 1px dashed var(--cc-border);
  border-radius: var(--cc-btn-radius);
}

.acc-placeholder p {
  margin: 0;
  max-width: 46ch;
}

/* ---------- Motion ---------- */

@keyframes acc-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .acc-banner,
  .acc-prefs[open] {
    animation: none;
  }
  .acc-btn,
  .acc-switch,
  .acc-switch::before {
    transition: none;
  }
}

/* ---------- Small screens: everything becomes a bottom sheet ---------- */

@media (max-width: 600px) {
  .acc-root[data-position] .acc-banner {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    translate: none;
    display: block;
    width: auto;
    max-height: 85dvh;
    overflow-y: auto;
    padding: 20px 18px calc(16px + env(safe-area-inset-bottom, 0px));
    border-width: 1px 0 0;
    border-radius: var(--cc-radius) var(--cc-radius) 0 0;
  }

  .acc-root[data-position="bottom"] .acc-actions {
    grid-template-columns: 1fr 1fr;
    margin-top: 16px;
  }

  .acc-root[data-position="bottom"] .acc-actions .acc-btn--ghost {
    grid-column: 1 / -1;
  }
}

/* ---------- High contrast / print ---------- */

@media (forced-colors: active) {
  .acc-switch {
    border: 1px solid CanvasText;
  }
  .acc-switch:checked {
    background: Highlight;
  }
  .acc-switch::before {
    background: CanvasText;
  }
}

@media print {
  .acc-root,
  .acc-placeholder {
    display: none !important;
  }
}
