/* FDI's existing page controls, with a translucent panel that leaves the site interactive. */
.fdi-analytics-consent[hidden],
.fdi-analytics-consent [hidden],
.fdi-cookie-settings[hidden] { display: none; }

.fdi-analytics-consent {
  --fdi-corner-gap: 12px;
  position: fixed;
  z-index: 38;
  right: max(var(--fdi-corner-gap), env(safe-area-inset-right, 0px));
  bottom: max(
    calc(var(--fdi-corner-gap) + env(safe-area-inset-bottom, 0px)),
    var(--fdi-film-clearance, 0px)
  );
  inline-size: min(370px, calc(100% - 2 * var(--fdi-corner-gap) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-block-size: calc(100vh - var(--hdr) - 36px);
  max-block-size: calc(100dvh - var(--hdr) - 36px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 16px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: rgb(17 23 22 / 94%);
  color: var(--ice);
  text-align: start;
}

.fdi-analytics-consent h2 {
  display: flex;
  align-items: center;
  min-block-size: 36px;
  margin: 0;
  padding-inline-end: 44px;
  font: 600 19px/1.25 var(--f-body);
  text-transform: none;
  letter-spacing: normal;
}

.fdi-cookie-settings {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fdi-consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 12px;
}

.fdi-consent-actions button {
  flex: 1 1 auto;
  min-block-size: 44px;
  padding: 7px 10px;
  border: 1px solid var(--dim);
  border-radius: 2px;
  background: var(--panel-2);
  color: var(--ice);
  font: 600 15px/1.25 var(--f-body);
  cursor: pointer;
}

.fdi-consent-actions button:hover { background: var(--scope); }

.fdi-cookie-settings {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.fdi-analytics-consent .fdi-consent-link {
  display: inline-flex;
  align-items: center;
  min-inline-size: 44px;
  min-block-size: 44px;
  color: var(--ice);
  font: 600 15px/1.25 var(--f-body);
  text-decoration: none;
}

.fdi-analytics-consent .fdi-consent-link:hover { color: var(--hud); }

.fdi-consent-close {
  position: absolute;
  inset-block-start: 4px;
  inset-inline-end: 4px;
  inline-size: 44px;
  block-size: 44px;
  border: 4px solid transparent;
  border-radius: 6px;
  background: var(--hud) padding-box;
  color: var(--hud-ink);
  cursor: pointer;
}

.fdi-consent-close::before,
.fdi-consent-close::after {
  content: "";
  position: absolute;
  inset-block-start: calc(50% - 1px);
  inset-inline-start: calc(50% - 8px);
  inline-size: 16px;
  block-size: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.fdi-consent-close::after { transform: rotate(-45deg); }
.fdi-consent-close:hover { background-color: var(--hud-hover); }

.fdi-consent-categories {
  max-block-size: min(42vh, 300px);
  max-block-size: min(42dvh, 300px);
  overflow: auto;
  overscroll-behavior: contain;
  margin-block-start: 8px;
  padding: 3px;
  display: grid;
  gap: 8px;
}

.fdi-consent-category {
  padding: 4px 8px;
  border-radius: 8px;
  background: rgb(17 23 22 / 52%);
}

.fdi-consent-category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-block-size: 44px;
  padding-inline: 4px;
  font: 600 16px/1.25 var(--f-body);
}

.fdi-consent-category-heading h3 {
  margin: 0;
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
}

.fdi-consent-category-heading > h3 + span,
.fdi-consent-category-heading small {
  font: 400 14px/1.3 var(--f-body);
}

.fdi-consent-category-heading small { display: block; }
label.fdi-consent-category-heading { cursor: pointer; }

.fdi-consent-category-heading input {
  flex: none;
  inline-size: 18px;
  block-size: 18px;
  margin: 0;
  accent-color: var(--hud);
}

.fdi-consent-category summary {
  min-block-size: 40px;
  padding: 9px 4px;
  border-radius: 2px;
  font: 500 15px/1.4 var(--f-body);
  cursor: pointer;
}

.fdi-consent-category summary:hover { background: rgb(232 238 236 / 8%); }

.fdi-consent-category p,
.fdi-consent-category code {
  display: block;
  margin: 0 16px 8px;
  font: 400 14px/1.4 var(--f-body);
  overflow-wrap: anywhere;
}

.fdi-consent-category code { font-family: var(--f-mono); }
.fdi-consent-preferences .fdi-consent-actions { margin-block-start: 8px; }

.fdi-analytics-consent :focus-visible, .fdi-cookie-settings:focus-visible {
  outline: 2px solid var(--hud);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .fdi-analytics-consent {
    inline-size: min(350px, calc(100% - 2 * var(--fdi-corner-gap) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    padding: 8px 12px 4px;
  }

  .fdi-analytics-consent h2 { font-size: 17px; }
  .fdi-consent-actions { margin-block-start: 8px; }
  .fdi-consent-actions button { padding-inline: 6px; }
}

/* Keep the same frosted surface as visitors move between notice and preferences. */
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .fdi-analytics-consent {
    border-radius: 16px;
    border-color: rgb(232 238 236 / 24%);
    border-block-start-color: rgb(232 238 236 / 48%);
    background: linear-gradient(rgb(17 23 22 / 34%), transparent 65%) rgb(17 23 22 / 59%);
    box-shadow: inset 0 1px 0 rgb(232 238 236 / 12%), 0 8px 24px rgb(5 7 6 / 24%);
    -webkit-backdrop-filter: blur(11px) saturate(1.2) brightness(.68);
    backdrop-filter: blur(11px) saturate(1.2) brightness(.68);
  }

  .fdi-consent-close {
    border-radius: 50%;
  }

  .fdi-analytics-consent .fdi-consent-actions button {
    border-radius: 8px;
    border-color: rgb(232 238 236 / 44%);
    background: rgb(17 23 22 / 38%);
  }

  .fdi-analytics-consent .fdi-consent-actions button:hover {
    background: rgb(17 23 22 / 55%);
  }

  .fdi-analytics-consent .fdi-consent-notice .fdi-consent-link:hover {
    color: #fff;
  }
}

@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  .fdi-analytics-consent {
    background: var(--panel-2);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (forced-colors: active) {
  .fdi-consent-close { border-color: ButtonText; }
}
