:root {
  --tprt-consent-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tprt-consent-font-size: 0.9375rem;
  --tprt-consent-font-size-small: 0.8125rem;
  --tprt-consent-font-weight: 400;
  --tprt-consent-font-weight-strong: 600;
  --tprt-consent-line-height: 1.5;
  --tprt-consent-title-size: 1.25rem;
  --tprt-consent-title-line-height: 1.3;
  --tprt-consent-text: #1d1d1d;
  --tprt-consent-text-muted: #555;
  --tprt-consent-bg: #fff;
  --tprt-consent-bg-subtle: #f5f5f5;
  --tprt-consent-border: #d0d0d0;
  --tprt-consent-accent: #1d1d1d;
  --tprt-consent-accent-text: #fff;
  --tprt-consent-link: #1d1d1d;
  --tprt-consent-focus: #1d1d1d;
  --tprt-consent-switch-off: #767676;
  --tprt-consent-switch-thumb: #fff;
  --tprt-consent-overlay: rgb(0 0 0 / 0.5);
  --tprt-consent-shadow: 0 -2px 12px rgb(0 0 0 / 0.12);
  --tprt-consent-panel-shadow: 0 8px 32px rgb(0 0 0 / 0.24);
  --tprt-consent-radius: 0.5rem;
  --tprt-consent-button-radius: 0.375rem;
  --tprt-consent-space-1: 0.25rem;
  --tprt-consent-space-2: 0.5rem;
  --tprt-consent-space-3: 0.75rem;
  --tprt-consent-space-4: 1rem;
  --tprt-consent-space-6: 1.5rem;
  --tprt-consent-panel-width: 40rem;
  --tprt-consent-switch-width: 2.5rem;
  --tprt-consent-switch-height: 1.5rem;
  --tprt-consent-border-width: 1px;
  --tprt-consent-outline-width: 2px;
  --tprt-consent-outline-offset: 2px;
  --tprt-consent-tab-indicator: 2px;
  --tprt-consent-button-min-width: 8rem;
  --tprt-consent-panel-max-height: 40rem;
  --tprt-consent-close-size: 1.5rem;
  --tprt-consent-switch-inset: 2px;
  --tprt-consent-switch-thumb-size: calc(var(--tprt-consent-switch-height) - 2 * var(--tprt-consent-outline-width) - 2 * var(--tprt-consent-switch-inset));
  --tprt-consent-switch-check-left: 0.4rem;
  --tprt-consent-switch-check-width: 0.3rem;
  --tprt-consent-switch-check-height: 0.55rem;
  --tprt-consent-group-title-tracking: 0.04em;
  --tprt-consent-transition: 0.15s;
  --tprt-consent-z-choices: 99990;
  --tprt-consent-z-bar: 100000;
  --tprt-consent-z-overlay: 100010;
}

/* cookieconsent's own markup is never shown; the plugin draws the bar and panel. */
#cc-main {
  display: none !important;
}

.tprt-consent-blocked {
  display: none;
}

/* Bar, panel and floating button set their own type so theme element styles do not leak in. */
.tprt-consent-bar,
.tprt-consent-overlay,
.tprt-consent-choices,
.tprt-consent-embed {
  font-family: var(--tprt-consent-font);
  font-size: var(--tprt-consent-font-size);
  font-weight: var(--tprt-consent-font-weight);
  line-height: var(--tprt-consent-line-height);
  color: var(--tprt-consent-text);
  letter-spacing: normal;
  text-transform: none;
}

/* Component rules below override this for headings, labels and small text. */
.tprt-consent-bar *,
.tprt-consent-overlay *,
.tprt-consent-embed * {
  box-sizing: border-box;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

/* Buttons */

.tprt-consent-button {
  font: inherit;
  cursor: pointer;
  padding: var(--tprt-consent-space-2) var(--tprt-consent-space-4);
  border: var(--tprt-consent-border-width) solid var(--tprt-consent-accent);
  border-radius: var(--tprt-consent-button-radius);
  text-align: center;
}

.tprt-consent-button:focus-visible {
  outline: var(--tprt-consent-outline-width) solid var(--tprt-consent-focus);
  outline-offset: var(--tprt-consent-outline-offset);
}

/* Reject all and Accept all share one variant so neither looks preferred. */
.tprt-consent-button--choice,
.tprt-consent-button--primary {
  color: var(--tprt-consent-accent-text);
  background: var(--tprt-consent-accent);
}

.tprt-consent-button--outline {
  color: var(--tprt-consent-accent);
  background: transparent;
}

/* Bar */

.tprt-consent-bar {
  position: fixed;
  inset: auto 0 0;
  z-index: var(--tprt-consent-z-bar);
  display: flex;
  flex-direction: column;
  gap: var(--tprt-consent-space-3);
  padding: var(--tprt-consent-space-4);
  background: var(--tprt-consent-bg);
  box-shadow: var(--tprt-consent-shadow);
}

.tprt-consent-bar__text {
  flex: 1;
  margin: 0;
}

.tprt-consent-bar__link {
  color: var(--tprt-consent-link);
  text-decoration: underline;
}

.tprt-consent-bar__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--tprt-consent-space-2);
}

/* Narrow screens: Manage on its own row, the two choices sharing the row below. */
.tprt-consent-bar__actions .tprt-consent-button--outline {
  grid-column: 1 / -1;
}

@media (min-width: 40rem) {
  .tprt-consent-bar {
    flex-direction: row;
    align-items: center;
    gap: var(--tprt-consent-space-6);
    padding: var(--tprt-consent-space-4) var(--tprt-consent-space-6);
  }

  /* The actions box is sized to its content, so the two 1fr tracks both take the wider label's width. */
  .tprt-consent-bar__actions {
    flex-shrink: 0;
    grid-template-columns: auto minmax(var(--tprt-consent-button-min-width), 1fr) minmax(var(--tprt-consent-button-min-width), 1fr);
  }

  .tprt-consent-bar__actions .tprt-consent-button--outline {
    grid-column: auto;
  }
}

/* Panel */

.tprt-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--tprt-consent-z-overlay);
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--tprt-consent-overlay);
}

.tprt-consent-overlay[hidden] {
  display: none;
}

.tprt-consent-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--tprt-consent-bg);
  box-shadow: var(--tprt-consent-panel-shadow);
}

@media (min-width: 40rem) {
  .tprt-consent-overlay {
    align-items: center;
    padding: var(--tprt-consent-space-4);
  }

  .tprt-consent-panel {
    width: var(--tprt-consent-panel-width);
    height: auto;
    max-height: min(var(--tprt-consent-panel-max-height), 100%);
    border-radius: var(--tprt-consent-radius);
  }
}

.tprt-consent-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tprt-consent-space-4);
  padding: var(--tprt-consent-space-4) var(--tprt-consent-space-6);
}

.tprt-consent-panel__title {
  margin: 0;
  font-family: var(--tprt-consent-font);
  font-size: var(--tprt-consent-title-size);
  font-weight: var(--tprt-consent-font-weight-strong);
  line-height: var(--tprt-consent-title-line-height);
  color: var(--tprt-consent-text);
}

.tprt-consent-panel__close {
  font-size: var(--tprt-consent-close-size);
  line-height: 1;
  cursor: pointer;
  padding: var(--tprt-consent-space-1) var(--tprt-consent-space-2);
  color: var(--tprt-consent-text);
  background: transparent;
  border: 0;
  border-radius: var(--tprt-consent-button-radius);
}

.tprt-consent-panel__close:focus-visible {
  outline: var(--tprt-consent-outline-width) solid var(--tprt-consent-focus);
}

.tprt-consent-tabs {
  display: flex;
  gap: var(--tprt-consent-space-1);
  padding: 0 var(--tprt-consent-space-6);
  border-bottom: var(--tprt-consent-border-width) solid var(--tprt-consent-border);
}

.tprt-consent-tabs__tab {
  font: inherit;
  cursor: pointer;
  margin-bottom: calc(-1 * var(--tprt-consent-border-width));
  padding: var(--tprt-consent-space-2) var(--tprt-consent-space-3);
  color: var(--tprt-consent-text-muted);
  background: transparent;
  border: 0;
  border-bottom: var(--tprt-consent-tab-indicator) solid transparent;
}

.tprt-consent-tabs__tab[aria-selected="true"] {
  color: var(--tprt-consent-text);
  border-bottom-color: var(--tprt-consent-accent);
}

.tprt-consent-tabs__tab:focus-visible {
  outline: var(--tprt-consent-outline-width) solid var(--tprt-consent-focus);
  outline-offset: calc(-1 * var(--tprt-consent-outline-width));
}

.tprt-consent-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--tprt-consent-space-4) var(--tprt-consent-space-6);
}

.tprt-consent-panel__body[hidden] {
  display: none;
}

.tprt-consent-panel__footer {
  display: flex;
  flex-direction: column;
  gap: var(--tprt-consent-space-2);
  padding: var(--tprt-consent-space-4) var(--tprt-consent-space-6);
  border-top: var(--tprt-consent-border-width) solid var(--tprt-consent-border);
}

@media (min-width: 40rem) {
  .tprt-consent-panel__footer {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
  }

  /* Reject all or the do-not-sell switch sits on the left, the rest on the right. */
  .tprt-consent-panel__footer > :first-child {
    margin-inline-end: auto;
  }

  /* Reject all and Accept all share equal tracks on the left; Save choices sits alone on the right. */
  .tprt-consent-panel__footer--choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(var(--tprt-consent-button-min-width), 1fr)) 1fr auto;
  }

  .tprt-consent-panel__footer--choices > :first-child {
    margin-inline-end: 0;
  }

  .tprt-consent-panel__footer--choices > :nth-child(3) {
    grid-column: 4;
  }
}

/* Rows */

.tprt-consent-list {
  display: flex;
  flex-direction: column;
  gap: var(--tprt-consent-space-4);
}

.tprt-consent-row {
  display: flex;
  flex-direction: column;
  gap: var(--tprt-consent-space-1);
  padding-bottom: var(--tprt-consent-space-4);
  border-bottom: var(--tprt-consent-border-width) solid var(--tprt-consent-border);
}

.tprt-consent-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.tprt-consent-row__description,
.tprt-consent-row__count,
.tprt-consent-service__cookies {
  margin: 0;
  color: var(--tprt-consent-text-muted);
}

.tprt-consent-row__count,
.tprt-consent-service__cookies {
  font-size: var(--tprt-consent-font-size-small);
}

.tprt-consent-group {
  display: flex;
  flex-direction: column;
  gap: var(--tprt-consent-space-3);
}

.tprt-consent-group__title {
  margin: 0;
  font-size: var(--tprt-consent-font-size-small);
  font-weight: var(--tprt-consent-font-weight-strong);
  text-transform: uppercase;
  letter-spacing: var(--tprt-consent-group-title-tracking);
  color: var(--tprt-consent-text-muted);
}

.tprt-consent-about p {
  margin: 0 0 var(--tprt-consent-space-3);
}

.tprt-consent-about a {
  color: var(--tprt-consent-link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.tprt-consent-about__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--tprt-consent-space-2) var(--tprt-consent-space-6);
  margin: var(--tprt-consent-space-4) 0 0;
  padding: var(--tprt-consent-space-3) 0 0;
  list-style: none;
  border-top: var(--tprt-consent-border-width) solid var(--tprt-consent-border);
}

.tprt-consent-about__links li {
  margin: 0;
  padding: 0;
}

/* Switch: the native checkbox sits invisibly over the drawn track so it keeps its role, label and keyboard behavior. */

.tprt-consent-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--tprt-consent-space-3);
  font-weight: var(--tprt-consent-font-weight-strong);
  cursor: pointer;
}

.tprt-consent-switch__input {
  position: absolute;
  top: 50%;
  left: 0;
  width: var(--tprt-consent-switch-width);
  height: var(--tprt-consent-switch-height);
  margin: 0;
  opacity: 0;
  cursor: inherit;
  transform: translateY(-50%);
}

.tprt-consent-switch__track {
  position: relative;
  flex-shrink: 0;
  width: var(--tprt-consent-switch-width);
  height: var(--tprt-consent-switch-height);
  background: var(--tprt-consent-bg);
  border: var(--tprt-consent-outline-width) solid var(--tprt-consent-switch-off);
  border-radius: var(--tprt-consent-switch-height);
  transition: background-color var(--tprt-consent-transition), border-color var(--tprt-consent-transition);
}

.tprt-consent-switch__track::after {
  content: "";
  position: absolute;
  top: var(--tprt-consent-switch-inset);
  left: var(--tprt-consent-switch-inset);
  width: var(--tprt-consent-switch-thumb-size);
  height: var(--tprt-consent-switch-thumb-size);
  background: var(--tprt-consent-switch-off);
  border-radius: 50%;
  transition: transform var(--tprt-consent-transition), background-color var(--tprt-consent-transition);
}

/* The check mark makes "on" readable without relying on color or thumb position. */
.tprt-consent-switch__track::before {
  content: "";
  position: absolute;
  top: 50%;
  left: var(--tprt-consent-switch-check-left);
  width: var(--tprt-consent-switch-check-width);
  height: var(--tprt-consent-switch-check-height);
  border: solid var(--tprt-consent-switch-thumb);
  border-width: 0 var(--tprt-consent-outline-width) var(--tprt-consent-outline-width) 0;
  opacity: 0;
  transform: translateY(-60%) rotate(45deg);
}

.tprt-consent-switch__input:checked + .tprt-consent-switch__track {
  background: var(--tprt-consent-accent);
  border-color: var(--tprt-consent-accent);
}

.tprt-consent-switch__input:checked + .tprt-consent-switch__track::before {
  opacity: 1;
}

.tprt-consent-switch__input:checked + .tprt-consent-switch__track::after {
  background: var(--tprt-consent-switch-thumb);
  transform: translateX(calc(var(--tprt-consent-switch-width) - var(--tprt-consent-switch-height)));
}

.tprt-consent-switch__input:focus-visible + .tprt-consent-switch__track {
  outline: var(--tprt-consent-outline-width) solid var(--tprt-consent-focus);
  outline-offset: var(--tprt-consent-outline-offset);
}

.tprt-consent-switch__input:disabled {
  cursor: default;
}

/* Required switches stay full strength: a faded dark track reads as "off". */
.tprt-consent-switch__input:disabled + .tprt-consent-switch__track {
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .tprt-consent-switch__track,
  .tprt-consent-switch__track::after {
    transition: none;
  }
}

/* Embed placeholder */

.tprt-consent-embed {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--tprt-consent-space-4);
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: var(--tprt-consent-space-6);
  text-align: center;
  background: var(--tprt-consent-bg-subtle);
  border: var(--tprt-consent-border-width) solid var(--tprt-consent-border);
  border-radius: var(--tprt-consent-radius);
}

/* Core's responsive embed wrapper already reserves the ratio with padding, so the placeholder fills it instead of adding its own 16:9 box. */
.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper > .tprt-consent-embed {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  height: 100%;
}

.tprt-consent-embed p {
  margin: 0;
}

.tprt-consent-embed__button {
  font: inherit;
}

/* The floating button takes its type from the shared rule at the top, not from the page. */
.tprt-consent-embed__button,
.tprt-consent-choices {
  cursor: pointer;
  color: var(--tprt-consent-accent-text);
  background: var(--tprt-consent-accent);
  border: var(--tprt-consent-border-width) solid var(--tprt-consent-accent);
  border-radius: var(--tprt-consent-button-radius);
}

.tprt-consent-embed__button:focus-visible,
.tprt-consent-choices:focus-visible {
  outline: var(--tprt-consent-outline-width) solid var(--tprt-consent-focus);
  outline-offset: var(--tprt-consent-outline-offset);
}

.tprt-consent-embed__button {
  padding: var(--tprt-consent-space-2) var(--tprt-consent-space-4);
}

.tprt-consent-choices {
  position: fixed;
  bottom: var(--tprt-consent-space-4);
  left: var(--tprt-consent-space-4);
  z-index: var(--tprt-consent-z-choices);
  padding: var(--tprt-consent-space-1) var(--tprt-consent-space-3);
  font-size: var(--tprt-consent-font-size-small);
}

.tprt-consent-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
