/* Advertising consent panel and its re-open button. Injected into <body> on
   landing and the research app, outside .ds-app, so it sets its own type. */
.atlas-marketing-consent, .atlas-marketing-settings { font-family: var(--ds-font-sans); }
.atlas-marketing-consent {
  position: fixed;
  z-index: var(--ds-z-dialog);
  inset-inline-end: max(var(--ds-space-4), env(safe-area-inset-right));
  inset-block-end: max(var(--ds-space-4), env(safe-area-inset-bottom));
  box-sizing: border-box;
  width: min(24rem, calc(100% - var(--ds-space-8)));
  max-height: calc(100dvh - max(var(--ds-space-4), env(safe-area-inset-bottom)) - var(--ds-space-4));
  margin: 0;
  padding: var(--ds-space-5);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: var(--ds-border-width) solid var(--ds-color-border);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-color-surface);
  color: var(--ds-color-text);
  box-shadow: var(--ds-shadow-overlay);
  font-size: var(--ds-text-sm);
}
.atlas-marketing-consent[hidden], .atlas-marketing-settings[hidden] { display: none; }
.atlas-marketing-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--ds-space-3); margin-bottom: var(--ds-space-2); }
/* Where a chat's composer reaches the corner, the settings button rests just above it, over
   the scrolling answer, and never over the composer or the pinned title. */
@media (max-width: 90rem) {
  .ds-chat__composer { anchor-name: --atlas-chat-composer; scroll-margin-block-start: calc(var(--ds-size-control-md) + var(--ds-space-8)); }
  body:has(.ds-chat__composer) .atlas-marketing-settings { position-anchor: --atlas-chat-composer; inset-block-end: calc(anchor(top) + var(--ds-space-2)); }
}
/* On a narrow start screen the button rests just below the form and its scope, in the room kept for it. */
@media (max-width: 48rem) {
  .ds-chat__start > .ds-scope { anchor-name: --atlas-chat-start; scroll-margin-block-end: calc(var(--ds-size-control-md) + var(--ds-space-8)); }
  body:has(.ds-chat__start > .ds-scope) .atlas-marketing-settings { position-anchor: --atlas-chat-start; inset-block-start: calc(anchor(bottom) + var(--ds-space-2)); inset-block-end: auto; }
}
/* A chat's last actions and start form, and a page's end, can always scroll clear of the button. */
body:has(> .atlas-marketing-settings) :is(.ds-chat__scroll, .ds-chat__start, main.ds-section) { padding-block-end: calc(var(--ds-size-control-md) + var(--ds-space-8)); }
@media (max-width: 30rem) {
  /* The button shows only its name. Its state stays in the accessible name and the panel it opens. */
  .atlas-marketing-settings__state { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* Outside a chat the page itself scrolls, so the button joins its end and covers nothing.
     It keeps its place while the panel is open, so the page doesn't shift, and a short
     sign-in page gives up that much height instead of scrolling. */
  body:not(:has(.ds-chat)) .atlas-marketing-settings { position: static; display: flex; width: fit-content; margin: var(--ds-space-4) auto; box-shadow: none; }
  body:not(:has(.ds-chat)) .atlas-marketing-settings[hidden] { visibility: hidden; }
  body:has(> .atlas-marketing-settings) .ds-auth { --ds-auth-min-height: calc(100dvh - var(--ds-size-control-sm) - 2 * var(--ds-space-4)); }
}
.atlas-marketing-consent h2 { flex: 1 1 12rem; min-width: 0; margin: 0; font-size: var(--ds-text-lg); font-weight: var(--ds-weight-strong); }
.atlas-marketing-consent p { margin: 0 0 var(--ds-space-3); }
.atlas-marketing-status { font-weight: var(--ds-weight-strong); }
.atlas-marketing-consent details { margin-bottom: var(--ds-space-4); }
.atlas-marketing-consent summary { display: flex; align-items: center; min-height: var(--ds-size-control-md); color: var(--ds-color-accent); cursor: pointer; }
.atlas-marketing-consent details p { margin: 0; color: var(--ds-color-text-muted); }
.atlas-marketing-consent :focus-visible, .atlas-marketing-settings:focus-visible { outline: 2px solid var(--ds-color-focus); outline-offset: 2px; }
.atlas-marketing-actions { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); }
.atlas-marketing-actions > .ds-button { flex: 1 1 8rem; }
.atlas-marketing-settings {
  position: fixed;
  z-index: var(--ds-z-dialog);
  inset-inline-end: max(var(--ds-space-4), env(safe-area-inset-right));
  inset-block-end: max(var(--ds-space-4), env(safe-area-inset-bottom));
  max-width: calc(100vw - var(--ds-space-8));
  box-shadow: var(--ds-shadow-overlay);
}
