/**
 * Cookie Consent & GDPR Compliance — frontend styles.
 *
 * Layout is the only thing that varies between the ten presets; the banner's
 * internals are identical in all of them, so a colour or type change applies
 * everywhere at once.
 */

/* ================================================================ */
/* Shell                                                             */
/* ================================================================ */

.ccg-root {
  font-family: var(--ccg-font);
  font-size: var(--ccg-font-size);
  line-height: 1.55;
}

.ccg-root *,
.ccg-root *::before,
.ccg-root *::after {
  box-sizing: border-box;
}

.ccg-root [hidden] {
  display: none !important;
}

/* Scroll lock while a blocking layout is up. */
body.ccg-locked {
  overflow: hidden;
}

/* Page-dimming overlay (modal / fullscreen / panel layouts).
 *
 * `pointer-events: none` is the safety net, not a detail. These are full-viewport
 * fixed layers: any state in which one is left in the document while the surface
 * it belongs to is closed would otherwise silently swallow every click on the
 * site. They may intercept clicks only while their surface is actually open. */
.ccg-overlay,
.ccg-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--ccg-overlay);
  z-index: 999998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ccg-anim-duration) ease;
}

.ccg-modal-overlay {
  z-index: 1000000;
}

.ccg-root.ccg-visible .ccg-overlay,
.ccg-root.ccg-modal-open .ccg-modal-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Only paint the blur when one is actually configured — `backdrop-filter` is
   expensive enough that we don't want it on by default. */
.ccg-root[style*="--ccg-overlay-blur: 0px"] .ccg-overlay {
  backdrop-filter: none;
}

.ccg-overlay {
  backdrop-filter: blur(var(--ccg-overlay-blur));
}

/* ================================================================ */
/* Banner surface (shared by every layout)                           */
/* ================================================================ */

/* Entry animation.
 *
 * Every layout has a resting transform (most have none, but the centred ones are
 * centred *with* a transform) and an entry transform it animates in from. Both
 * are custom properties set on the root by the layout and animation classes, so
 * the banner itself has exactly one `transform` declaration in each state.
 *
 * They used to be written as competing `transform` rules, which meant the plain
 * `.ccg-visible` rule could out-specify a layout's centring transform and drop
 * the banner half its own width off-centre. Resolving it through a variable
 * makes that impossible: there is nothing left to out-specify. */
.ccg-root {
  --ccg-tx-rest: none;
  --ccg-tx-enter: none;
}

.ccg-banner {
  position: fixed;
  z-index: 999999;
  display: flex;
  gap: 20px;
  background: var(--ccg-bg);
  color: var(--ccg-text);
  padding: var(--ccg-padding);
  border: var(--ccg-border-width) solid var(--ccg-border);
  border-radius: var(--ccg-radius);
  box-shadow: var(--ccg-shadow);
  opacity: 0;
  pointer-events: none;
  transform: var(--ccg-tx-enter);
  transition:
    opacity var(--ccg-anim-duration) ease,
    transform var(--ccg-anim-duration) cubic-bezier(.22, .61, .36, 1);
}

.ccg-root.ccg-visible .ccg-banner {
  opacity: 1;
  pointer-events: auto;
  transform: var(--ccg-tx-rest);
}

.ccg-banner-body {
  flex: 1;
  min-width: 0;
}

.ccg-title {
  margin: 0 0 8px;
  font-size: var(--ccg-title-size);
  line-height: 1.3;
  font-weight: 700;
  color: var(--ccg-title);
}

.ccg-message {
  margin: 0;
  color: var(--ccg-text);
}

.ccg-message p {
  margin: 0 0 8px;
}

.ccg-message p:last-child {
  margin-bottom: 0;
}

.ccg-message a,
.ccg-policy-link {
  color: var(--ccg-link);
  text-decoration: underline;
}

.ccg-message a:hover,
.ccg-policy-link:hover {
  color: var(--ccg-link-hover);
}

.ccg-policy-links {
  margin: 10px 0 0;
  font-size: .92em;
}

.ccg-sep {
  margin: 0 8px;
  opacity: .5;
}

.ccg-logo {
  display: block;
  max-height: 36px;
  width: auto;
  margin-bottom: 12px;
}

/* Close X ---------------------------------------------------------- */

.ccg-x {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ccg-text);
  border-radius: 50%;
  cursor: pointer;
  opacity: .6;
  transition: opacity .18s ease, background-color .18s ease;
}

.ccg-x:hover {
  opacity: 1;
  background: rgba(127, 127, 127, .14);
}

.ccg-x svg {
  width: 16px;
  height: 16px;
}

/* ================================================================ */
/* Buttons                                                           */
/* ================================================================ */

.ccg-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ccg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--ccg-btn-pad-y) var(--ccg-btn-pad-x);
  border-width: var(--ccg-btn-border-width);
  border-style: solid;
  border-radius: var(--ccg-btn-radius);
  font-family: inherit;
  font-size: var(--ccg-btn-font-size);
  font-weight: var(--ccg-btn-font-weight);
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.ccg-btn:focus-visible {
  outline: 2px solid var(--ccg-link);
  outline-offset: 2px;
}

/* Equal weight: a "Reject all" that is visibly harder to find than "Accept all"
   is a dark pattern, and regulators have repeatedly said so. When this is on,
   the two buttons are forced to the same width. */
.ccg-actions.ccg-equal .ccg-btn-accept,
.ccg-actions.ccg-equal .ccg-btn-reject {
  flex: 1 1 auto;
  min-width: 140px;
}

.ccg-btn-accept {
  background: var(--ccg-accept-bg);
  color: var(--ccg-accept-text);
  border-color: var(--ccg-accept-border);
}

.ccg-btn-accept:hover {
  background: var(--ccg-accept-hover-bg);
  color: var(--ccg-accept-hover-text);
}

.ccg-btn-reject {
  background: var(--ccg-reject-bg);
  color: var(--ccg-reject-text);
  border-color: var(--ccg-reject-border);
}

.ccg-btn-reject:hover {
  background: var(--ccg-reject-hover-bg);
  color: var(--ccg-reject-hover-text);
}

.ccg-btn-prefs {
  background: var(--ccg-prefs-bg);
  color: var(--ccg-prefs-text);
  border-color: var(--ccg-prefs-border);
}

.ccg-btn-prefs:hover {
  background: var(--ccg-prefs-hover-bg);
  color: var(--ccg-prefs-hover-text);
}

.ccg-btn-save {
  background: var(--ccg-save-bg);
  color: var(--ccg-save-text);
  border-color: var(--ccg-save-border);
}

.ccg-btn-save:hover {
  background: var(--ccg-save-hover-bg);
  color: var(--ccg-save-hover-text);
}

/* ================================================================ */
/* THE TEN LAYOUTS                                                   */
/* ================================================================ */

/* 1 — Bar, bottom -------------------------------------------------- */
.ccg-layout-bar-bottom .ccg-banner {
  left: 0;
  right: 0;
  bottom: 0;
  align-items: center;
  flex-direction: row;
  border-radius: 0;
  border-width: var(--ccg-border-width) 0 0 0;
}

.ccg-anim-slide.ccg-layout-bar-bottom { --ccg-tx-enter: translateY(100%); }
.ccg-anim-zoom.ccg-layout-bar-bottom  { --ccg-tx-enter: scale(.96); }

/* 2 — Bar, top ----------------------------------------------------- */
.ccg-layout-bar-top .ccg-banner {
  left: 0;
  right: 0;
  top: 0;
  align-items: center;
  flex-direction: row;
  border-radius: 0;
  border-width: 0 0 var(--ccg-border-width) 0;
}

.ccg-anim-slide.ccg-layout-bar-top { --ccg-tx-enter: translateY(-100%); }
.ccg-anim-zoom.ccg-layout-bar-top  { --ccg-tx-enter: scale(.96); }

/* 3 — Box, bottom-left --------------------------------------------- */
.ccg-layout-box-bottom-left .ccg-banner {
  left: 20px;
  bottom: 20px;
  flex-direction: column;
  width: calc(100% - 40px);
  max-width: var(--ccg-max-width);
}

.ccg-anim-slide.ccg-layout-box-bottom-left { --ccg-tx-enter: translateY(20px); }
.ccg-anim-zoom.ccg-layout-box-bottom-left  { --ccg-tx-enter: scale(.94); }

/* 4 — Box, bottom-right -------------------------------------------- */
.ccg-layout-box-bottom-right .ccg-banner {
  right: 20px;
  bottom: 20px;
  flex-direction: column;
  width: calc(100% - 40px);
  max-width: var(--ccg-max-width);
}

.ccg-anim-slide.ccg-layout-box-bottom-right { --ccg-tx-enter: translateY(20px); }
.ccg-anim-zoom.ccg-layout-box-bottom-right  { --ccg-tx-enter: scale(.94); }

/* 5 — Modal, centre ------------------------------------------------ */
/* Centred with a transform, so its resting state is a transform — not `none`. */
.ccg-layout-modal-center {
  --ccg-tx-rest: translate(-50%, -50%);
  --ccg-tx-enter: translate(-50%, -50%);
}

.ccg-layout-modal-center .ccg-banner {
  top: 50%;
  left: 50%;
  flex-direction: column;
  width: calc(100% - 40px);
  max-width: var(--ccg-max-width);
  max-height: 88vh;
  overflow-y: auto;
}

.ccg-anim-slide.ccg-layout-modal-center { --ccg-tx-enter: translate(-50%, calc(-50% + 24px)); }
.ccg-anim-zoom.ccg-layout-modal-center  { --ccg-tx-enter: translate(-50%, -50%) scale(.94); }

/* 6 — Full-screen interstitial ------------------------------------- */
.ccg-layout-overlay-fullscreen .ccg-banner {
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 0;
  border-radius: 0;
  overflow-y: auto;
}

.ccg-layout-overlay-fullscreen .ccg-banner-body {
  flex: 0 1 auto;
  max-width: var(--ccg-max-width);
}

.ccg-layout-overlay-fullscreen .ccg-actions {
  justify-content: center;
  margin-top: 24px;
}

.ccg-anim-zoom.ccg-layout-overlay-fullscreen { --ccg-tx-enter: scale(.97); }

/* 7 — Slide-in panel, left ----------------------------------------- */
.ccg-layout-panel-left .ccg-banner {
  top: 0;
  bottom: 0;
  left: 0;
  flex-direction: column;
  width: 100%;
  max-width: var(--ccg-max-width);
  border-radius: 0;
  border-width: 0 var(--ccg-border-width) 0 0;
  overflow-y: auto;
}

.ccg-layout-panel-left .ccg-actions {
  margin-top: auto;
  padding-top: 20px;
  flex-direction: column;
  align-items: stretch;
}

.ccg-anim-slide.ccg-layout-panel-left { --ccg-tx-enter: translateX(-100%); }
.ccg-anim-zoom.ccg-layout-panel-left  { --ccg-tx-enter: scale(.96); }

/* 8 — Slide-in panel, right ---------------------------------------- */
.ccg-layout-panel-right .ccg-banner {
  top: 0;
  bottom: 0;
  right: 0;
  flex-direction: column;
  width: 100%;
  max-width: var(--ccg-max-width);
  border-radius: 0;
  border-width: 0 0 0 var(--ccg-border-width);
  overflow-y: auto;
}

.ccg-layout-panel-right .ccg-actions {
  margin-top: auto;
  padding-top: 20px;
  flex-direction: column;
  align-items: stretch;
}

.ccg-anim-slide.ccg-layout-panel-right { --ccg-tx-enter: translateX(100%); }
.ccg-anim-zoom.ccg-layout-panel-right  { --ccg-tx-enter: scale(.96); }

/* 9 — Floating cloud ----------------------------------------------- */
/* Horizontally centred with a transform — same rule as the modal. */
.ccg-layout-cloud-bottom {
  --ccg-tx-rest: translateX(-50%);
  --ccg-tx-enter: translateX(-50%);
}

.ccg-layout-cloud-bottom .ccg-banner {
  left: 50%;
  bottom: 24px;
  flex-direction: column;
  width: calc(100% - 40px);
  max-width: var(--ccg-max-width);
  border-radius: 22px;
  text-align: center;
}

.ccg-layout-cloud-bottom .ccg-actions {
  justify-content: center;
  margin-top: 16px;
}

.ccg-anim-slide.ccg-layout-cloud-bottom { --ccg-tx-enter: translate(-50%, 24px); }
.ccg-anim-zoom.ccg-layout-cloud-bottom  { --ccg-tx-enter: translateX(-50%) scale(.94); }

/* 10 — Minimal corner ---------------------------------------------- */
.ccg-layout-minimal-corner .ccg-banner {
  right: 16px;
  bottom: 16px;
  flex-direction: column;
  gap: 12px;
  width: calc(100% - 32px);
  max-width: 340px;
  padding: 16px;
}

.ccg-layout-minimal-corner .ccg-title {
  font-size: calc(var(--ccg-title-size) * .8);
  margin-bottom: 4px;
}

.ccg-layout-minimal-corner .ccg-message {
  font-size: .92em;
}

.ccg-layout-minimal-corner .ccg-btn {
  padding: 8px 14px;
  font-size: calc(var(--ccg-btn-font-size) * .92);
}

.ccg-layout-minimal-corner .ccg-actions {
  gap: 8px;
}

.ccg-anim-slide.ccg-layout-minimal-corner { --ccg-tx-enter: translateY(16px); }
.ccg-anim-zoom.ccg-layout-minimal-corner  { --ccg-tx-enter: scale(.94); }

/* Fade and none enter from the resting position — no movement, just opacity.
   `--ccg-tx-enter` already defaults to the layout's resting transform, so
   neither has anything to declare beyond killing the transition. */
.ccg-anim-none .ccg-banner,
.ccg-anim-none .ccg-modal {
  transition: none;
}

/* ================================================================ */
/* Preferences modal                                                 */
/* ================================================================ */

.ccg-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1000001;
  display: flex;
  flex-direction: column;
  width: calc(100% - 40px);
  max-width: 640px;
  max-height: 86vh;
  background: var(--ccg-bg);
  color: var(--ccg-text);
  border: var(--ccg-border-width) solid var(--ccg-border);
  border-radius: var(--ccg-radius);
  box-shadow: var(--ccg-shadow);
  opacity: 0;
  transform: translate(-50%, -48%);
  transition:
    opacity var(--ccg-anim-duration) ease,
    transform var(--ccg-anim-duration) cubic-bezier(.22, .61, .36, 1);
}

.ccg-root.ccg-modal-open .ccg-modal {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.ccg-modal-head {
  position: relative;
  padding: 20px var(--ccg-padding);
  border-bottom: 1px solid var(--ccg-border);
}

.ccg-modal-head .ccg-title {
  margin: 0;
  padding-right: 36px;
}

.ccg-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px var(--ccg-padding);
}

.ccg-modal-foot {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 16px var(--ccg-padding);
  border-top: 1px solid var(--ccg-border);
}

/* Category rows ---------------------------------------------------- */

.ccg-cat {
  border: 1px solid var(--ccg-border);
  border-radius: 8px;
  margin-top: 12px;
  overflow: hidden;
}

.ccg-cat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.ccg-cat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ccg-title);
  font-family: inherit;
  font-size: 1em;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.ccg-caret {
  display: inline-block;
  transition: transform .18s ease;
  opacity: .6;
}

.ccg-cat.is-open .ccg-caret {
  transform: rotate(90deg);
}

.ccg-always-on {
  font-size: .82em;
  font-weight: 600;
  opacity: .65;
  white-space: nowrap;
}

.ccg-cat-body {
  padding: 0 14px 14px;
}

.ccg-cat-desc {
  font-size: .94em;
  opacity: .9;
}

/* Toggle switch ---------------------------------------------------- */

.ccg-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.ccg-switch-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.ccg-switch-track {
  display: block;
  width: 44px;
  height: 24px;
  background: var(--ccg-toggle-off);
  border-radius: 999px;
  transition: background-color .2s ease;
  pointer-events: none;
}

.ccg-switch-knob {
  display: block;
  width: 18px;
  height: 18px;
  margin: 3px;
  background: var(--ccg-toggle-knob);
  border-radius: 50%;
  transition: transform .2s ease;
}

.ccg-switch-input:checked + .ccg-switch-track {
  background: var(--ccg-toggle-on);
}

.ccg-switch-input:checked + .ccg-switch-track .ccg-switch-knob {
  transform: translateX(20px);
}

.ccg-switch-input:focus-visible + .ccg-switch-track {
  outline: 2px solid var(--ccg-link);
  outline-offset: 2px;
}

.ccg-sr,
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Cookie tables ---------------------------------------------------- */

.ccg-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

.ccg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86em;
}

.ccg-table th,
.ccg-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--ccg-border);
  vertical-align: top;
}

.ccg-table th {
  font-weight: 600;
  opacity: .75;
  white-space: nowrap;
}

.ccg-table code {
  font-size: .92em;
  word-break: break-all;
}

/* ================================================================ */
/* Reopen badge                                                      */
/* ================================================================ */

/* The badge is rendered outside .ccg-root, so the `[hidden]` guard scoped to the
   root does not reach it — and an author `display` beats the UA sheet's
   `[hidden] { display: none }`. Without this it shows through its own hidden
   attribute and floats over the page before consent has even been asked for. */
.ccg-badge[hidden] {
  display: none !important;
}

.ccg-badge {
  position: fixed;
  bottom: 18px;
  z-index: 999997;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  background: var(--ccg-badge-bg);
  color: var(--ccg-badge-color);
  border: 1px solid var(--ccg-badge-border);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .16);
  font-family: var(--ccg-font);
  font-size: 20px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

/* The icon is an inline SVG inheriting currentColor, so it always matches the
   badge's own colour setting — which an emoji glyph never could. */
.ccg-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.ccg-badge-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.ccg-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

.ccg-badge-bottom-left  { left: 18px; }
.ccg-badge-bottom-right { right: 18px; }

.ccg-badge-labelled {
  width: auto;
  height: auto;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
}

.ccg-badge-text {
  font-weight: 600;
  white-space: nowrap;
}

.ccg-badge:focus-visible {
  outline: 2px solid var(--ccg-link);
  outline-offset: 2px;
}

/* ================================================================ */
/* Blocked-embed placeholder                                         */
/* ================================================================ */

.ccg-blocked {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 180px;
  padding: 24px;
  background: #f3f4f6;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #374151;
  font-family: var(--ccg-font, inherit);
  text-align: center;
}

.ccg-blocked-inner {
  max-width: 420px;
}

.ccg-blocked-icon {
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto 10px;
  opacity: .55;
}

.ccg-blocked-text {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.5;
}

.ccg-blocked-btn {
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .18s ease;
}

.ccg-blocked-btn:hover {
  background: #1d4ed8;
}

/* ================================================================ */
/* Cookie declaration (shortcode)                                    */
/* ================================================================ */

.ccg-declaration {
  font-family: var(--ccg-font);
}

.ccg-decl-cat {
  margin-bottom: 32px;
}

.ccg-decl-cat h3 {
  margin: 0 0 6px;
}

.ccg-decl-desc {
  margin-bottom: 10px;
  opacity: .85;
}

.ccg-decl-empty {
  font-style: italic;
  opacity: .7;
}

/* ================================================================ */
/* Responsive                                                        */
/* ================================================================ */

@media (max-width: 782px) {
  /* Bars have nowhere near enough width for a side-by-side button row on a
     phone, so every layout collapses to a stack. */
  .ccg-layout-bar-bottom .ccg-banner,
  .ccg-layout-bar-top .ccg-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .ccg-banner {
    max-height: 84vh;
    overflow-y: auto;
  }

  .ccg-actions {
    width: 100%;
  }

  /* Full-width buttons on mobile — the default, because a 44px-tall target that
     spans the screen is far easier to hit than three buttons crammed on a row. */
  .ccg-root:not(.ccg-btn-auto) .ccg-actions .ccg-btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .ccg-modal {
    max-height: 90vh;
  }

  .ccg-modal-foot {
    flex-direction: column;
  }

  .ccg-modal-foot .ccg-btn {
    width: 100%;
  }

  .ccg-layout-panel-left .ccg-banner,
  .ccg-layout-panel-right .ccg-banner {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ccg-banner,
  .ccg-modal,
  .ccg-overlay,
  .ccg-modal-overlay,
  .ccg-switch-track,
  .ccg-switch-knob,
  .ccg-badge {
    transition: none !important;
  }
}
