/*
 * 3Flow Cookie Consent - default styles.
 *
 * Deliberately plain so each theme can restyle it:
 *
 * 1. Set the custom properties below from the theme, e.g.
 *      :root { --tfcc-accent: #ff3500; --tfcc-radius: 0; }
 *    They're declared inside :where(), so any theme declaration wins
 *    whichever stylesheet loads first.
 * 2. Override the .tfcc-* classes. Every rule here is a single class (plus a
 *    state where needed), so a theme rule with the same selector or one more
 *    class wins.
 * 3. Or turn this stylesheet off under Cookie Consent > Settings and style
 *    everything in the theme.
 *
 * The banner, window and button inherit the page's font.
 */

:where(:root) {
  --tfcc-background: #ffffff;
  --tfcc-text: #1d1d1f;
  --tfcc-muted: #5f5f66;
  --tfcc-border: #dcdce0;
  --tfcc-accent: #1d1d1f;
  --tfcc-accent-text: #ffffff;
  --tfcc-switch-off: #a9a9b1;
  --tfcc-focus: #2563eb;
  --tfcc-radius: 8px;
  --tfcc-font-size: 15px;
  --tfcc-shadow: 0 4px 32px rgba(0, 0, 0, 0.18);
  --tfcc-backdrop: rgba(0, 0, 0, 0.5);
  --tfcc-z-index: 2147483000;
  --tfcc-banner-width: 1200px;
  --tfcc-modal-width: 640px;
  --tfcc-reopen-size: 44px;
  --tfcc-reopen-offset: 16px;
  --tfcc-placeholder-background: #f2f2f4;
  --tfcc-placeholder-text: #1d1d1f;
}

/* Shared ------------------------------------------------------------------ */

.tfcc-banner,
.tfcc-modal {
  box-sizing: border-box;
  color: var(--tfcc-text);
  background: var(--tfcc-background);
  font-family: inherit;
  font-size: var(--tfcc-font-size);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  text-align: left;
}

.tfcc-banner *,
.tfcc-modal * {
  box-sizing: inherit;
}

.tfcc-banner a,
.tfcc-modal a {
  color: inherit;
  text-decoration: underline;
}

.tfcc-banner[hidden],
.tfcc-reopen[hidden],
.tfcc-category__panel[hidden] {
  display: none;
}

.tfcc-button {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 20px;
  border: 2px solid var(--tfcc-accent);
  border-radius: var(--tfcc-radius);
  background: transparent;
  color: var(--tfcc-text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
}

.tfcc-button--primary {
  background: var(--tfcc-accent);
  color: var(--tfcc-accent-text);
}

.tfcc-button:hover {
  opacity: 0.85;
}

.tfcc-button:focus-visible,
.tfcc-modal__close:focus-visible,
.tfcc-category__toggle:focus-visible,
.tfcc-reopen:focus-visible,
.tfcc-service__cookies summary:focus-visible,
.tfcc-banner a:focus-visible,
.tfcc-modal a:focus-visible {
  outline: 2px solid var(--tfcc-focus);
  outline-offset: 2px;
}

.tfcc-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Banner ------------------------------------------------------------------ */

.tfcc-banner {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--tfcc-z-index);
  max-height: 100vh;
  overflow-y: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--tfcc-shadow);
}

.tfcc-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  max-width: var(--tfcc-banner-width);
  margin: 0 auto;
}

.tfcc-banner__content {
  flex: 1 1 400px;
}

.tfcc-banner__title {
  margin: 0 0 4px;
  color: inherit;
  font: inherit;
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.3;
}

.tfcc-banner__text p,
.tfcc-modal__intro p,
.tfcc-category__notice p {
  margin: 0 0 0.5em;
}

.tfcc-banner__text p:last-child,
.tfcc-modal__intro p:last-child,
.tfcc-category__notice p:last-child {
  margin-bottom: 0;
}

.tfcc-banner__actions {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

@media (min-width: 900px) {
  .tfcc-banner__actions {
    flex: 0 1 auto;
  }
}

/* Preferences window ------------------------------------------------------ */

.tfcc-modal {
  width: min(var(--tfcc-modal-width), calc(100% - 32px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--tfcc-radius);
  box-shadow: var(--tfcc-shadow);
}

.tfcc-modal::backdrop {
  background: var(--tfcc-backdrop, rgba(0, 0, 0, 0.5));
}

.tfcc-modal__inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
}

.tfcc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--tfcc-border);
}

.tfcc-modal__title {
  margin: 0;
  color: inherit;
  font: inherit;
  font-size: 1.25em;
  font-weight: 700;
  line-height: 1.3;
}

.tfcc-modal__close {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -8px -8px -8px 0;
  padding: 0;
  border: 0;
  border-radius: var(--tfcc-radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.tfcc-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 20px;
}

.tfcc-modal__intro {
  margin-bottom: 16px;
}

/* The visitor's consent ID, to quote if they ask what they agreed to. */
.tfcc-consent-id {
  margin: 16px 0 0;
  color: var(--tfcc-muted);
  font-size: 0.8125em;
}

.tfcc-consent-id__value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  user-select: all;
}

.tfcc-modal__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--tfcc-border);
}

/* Categories (accordion) */

.tfcc-category {
  border-top: 1px solid var(--tfcc-border);
}

.tfcc-category:last-child {
  border-bottom: 1px solid var(--tfcc-border);
}

.tfcc-category__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.tfcc-category__toggle {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.tfcc-category__icon {
  flex: none;
  transition: transform 0.2s ease;
}

.tfcc-category__toggle[aria-expanded="true"] .tfcc-category__icon {
  transform: rotate(90deg);
}

.tfcc-category__always {
  flex: none;
  color: var(--tfcc-muted);
  font-size: 0.875em;
  font-weight: 600;
}

.tfcc-category__panel {
  padding: 0 0 16px 26px;
}

.tfcc-category__description {
  margin: 0;
}

.tfcc-category__notice {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--tfcc-radius);
  background: var(--tfcc-placeholder-background);
  font-size: 0.9em;
}

/* Services */

.tfcc-services {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.tfcc-service {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--tfcc-border);
  border-radius: var(--tfcc-radius);
}

.tfcc-service__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tfcc-service__name {
  margin: 0;
  color: inherit;
  font: inherit;
  font-weight: 600;
}

.tfcc-service__description {
  margin: 4px 0 0;
  color: var(--tfcc-muted);
  font-size: 0.9em;
}

.tfcc-service__cookies {
  margin-top: 8px;
  font-size: 0.875em;
}

.tfcc-service__cookies summary {
  cursor: pointer;
  font-weight: 600;
}

.tfcc-cookies {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.tfcc-cookie {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid var(--tfcc-border);
}

.tfcc-cookie__name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tfcc-cookie__meta {
  color: var(--tfcc-muted);
}

.tfcc-cookie__description {
  flex-basis: 100%;
}

/* Switches */

.tfcc-switch {
  position: relative;
  display: inline-flex;
  flex: none;
}

.tfcc-switch__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.tfcc-switch__track {
  position: relative;
  display: block;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--tfcc-switch-off);
  transition: background-color 0.2s ease;
}

.tfcc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.tfcc-switch__input:checked + .tfcc-switch__track,
.tfcc-switch__input:indeterminate + .tfcc-switch__track {
  background: var(--tfcc-accent);
}

.tfcc-switch__input:checked + .tfcc-switch__track::after {
  transform: translateX(18px);
}

.tfcc-switch__input:indeterminate + .tfcc-switch__track::after {
  transform: translateX(9px);
}

.tfcc-switch__input:focus-visible + .tfcc-switch__track {
  outline: 2px solid var(--tfcc-focus);
  outline-offset: 2px;
}

/* Settings button --------------------------------------------------------- */

.tfcc-reopen {
  position: fixed;
  bottom: calc(var(--tfcc-reopen-offset) + env(safe-area-inset-bottom, 0px));
  left: var(--tfcc-reopen-offset);
  z-index: calc(var(--tfcc-z-index) - 1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tfcc-reopen-size);
  height: var(--tfcc-reopen-size);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--tfcc-accent);
  color: var(--tfcc-accent-text);
  box-shadow: var(--tfcc-shadow);
  cursor: pointer;
}

.tfcc-reopen__icon {
  width: 60%;
  height: 60%;
}

/* [tfcc_settings_link] and [tfcc_cookies] --------------------------------- */

.tfcc-settings-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.tfcc-cookie-list__table {
  width: 100%;
  border-collapse: collapse;
}

.tfcc-cookie-list__table th,
.tfcc-cookie-list__table td {
  padding: 8px;
  border-bottom: 1px solid currentColor;
  text-align: left;
  vertical-align: top;
}

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