/*
 * The cookie banner and the "Cookie settings" link (see TrackingViewComponent). The banner is fixed to
 * the bottom of the window until a choice is made; it deliberately looks like the rest of the site (same
 * border, buttons and type) rather than a foreign widget. Tall when the per-category choices are open, so
 * it scrolls within itself rather than running off the screen.
 */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  max-width: 35rem;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  margin: 0 auto;
  padding: var(--space-4);
  background: var(--color-surface);
  border: var(--border-width-rule) solid var(--color-border);
  border-bottom: none;
}

/* Rich text from the CMS: paragraphs and links. */
.cookie-banner__message {
  margin: 0 0 var(--space-3);
  font-size: 0.875rem;
}

.cookie-banner__message p,
.cookie-category__description p {
  margin: 0 0 var(--space-2);
}

/* A heading an editor puts in the text would otherwise pick up the site's page-level heading style
   (a big top margin, and on h1 an underline), which reads as a hole above it inside a compact
   banner. Scoped to the CMS-written text only, not the banner's own headings. */
.cookie-banner__message :is(h1, h2, h3, h4, h5, h6),
.cookie-category__description :is(h1, h2, h3, h4, h5, h6),
.cookie-category__cookies :is(h1, h2, h3, h4, h5, h6) {
  margin: 0 0 var(--space-2);
  padding: 0;
  border: none;
  font-size: 1.125rem;
  line-height: 1.2;
}

.cookie-banner__message > :last-child,
.cookie-category__description > :last-child {
  margin-bottom: 0;
}

.cookie-banner__message a,
.cookie-category__description a,
.cookie-category__cookies a {
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

/* Equal weight: Reject all is as easy to hit as Accept all. */
.cookie-banner__actions {
  display: flex;
  gap: var(--space-2);
}

.cookie-banner__actions .btn {
  flex: 1 1 0;
}

/* "Choose cookies" opens the per-category choices in place (a native details element: no script). */
.cookie-banner__prefs {
  margin-top: var(--space-3);
}

.cookie-banner__choose {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: var(--font-weight-semibold);
  text-decoration: underline;
  text-align: center;
  list-style: none;
  padding: var(--space-2) 0;
}

.cookie-banner__choose::-webkit-details-marker {
  display: none;
}

.cookie-banner__heading {
  margin: var(--space-3) 0;
  font-size: 1rem;
}

.cookie-category {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-border-subtle);
}

.cookie-category__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

/* The whole row is the target, so the checkbox is easy to hit on a phone. */
label.cookie-category__head {
  cursor: pointer;
  justify-content: flex-start;
}

.cookie-category__checkbox {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--color-accent);
}

.cookie-category__title {
  font-weight: var(--font-weight-bold);
  font-size: 0.9375rem;
}

.cookie-category__always {
  flex: none;
  font-size: 0.75rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.cookie-category__description {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.cookie-category__details {
  margin-top: var(--space-2);
  font-size: 0.8125rem;
}

.cookie-category__details > summary {
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
}

.cookie-category__cookies {
  margin-top: var(--space-2);
  overflow-x: auto;
}

.cookie-category__cookies ul {
  margin: 0;
  padding-left: var(--space-4);
}

.cookie-category__cookies table {
  border-collapse: collapse;
  width: 100%;
}

.cookie-category__cookies th,
.cookie-category__cookies td {
  border: 1px solid var(--color-border-subtle);
  padding: var(--space-1) var(--space-2);
  text-align: left;
  vertical-align: top;
}

.cookie-banner__save-row {
  display: flex;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-subtle);
}

.cookie-banner__reference {
  margin: var(--space-3) 0 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  word-break: break-all;
}
