body {
  padding-bottom: calc(2rem + var(--analytics-space, 0px));
}

/* Footer control: styled to match the adjacent Privacy link. */
.analytics-preferences {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.analytics-preferences:hover,
.analytics-preferences:focus-visible {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}

/* Consent bar: same width as the paper column, text aligned with the content. */
.analytics-panel {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1.25rem;
  width: min(100% - 2rem, 820px);
  max-height: 50vh;
  margin-inline: auto;
  padding-block: 0.75rem;
  padding-inline: calc((min(100vw - 2rem, 820px) - min(100vw - 2rem, 710px)) / 2 + clamp(1.25rem, 4vw, 2rem));
  overflow: auto;
  border-top: 1px solid var(--rule);
  background: var(--paper);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.analytics-panel[hidden],
.analytics-preferences[hidden] {
  display: none;
}

.analytics-panel p {
  max-width: none;
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}

.analytics-actions {
  display: flex;
  gap: 0.5rem;
}

/* Decline and Allow share one style so neither choice is favored. */
.analytics-actions button {
  min-width: 5rem;
  min-height: 2.75rem;
  padding: 0.375rem 1rem;
  border: 1px solid color-mix(in srgb, var(--link) 35%, transparent);
  border-radius: 4px;
  background: var(--paper);
  color: var(--link);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.analytics-actions button:hover {
  border-color: var(--link);
  background: var(--wash);
  color: var(--link-hover);
}

.analytics-actions button:focus-visible,
.analytics-preferences:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 0.2rem;
}

@media (max-width: 520px) {
  .analytics-panel {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .analytics-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-actions button {
    min-width: 0;
  }
}

@media (max-width: 399px) {
  .analytics-panel {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
  }

  .analytics-panel p {
    text-wrap: balance;
  }

  .analytics-panel p a {
    white-space: nowrap;
  }
}
