/* 4reelz consent banner + preferences dialog (UI1 #735).
 * Loaded on landing, demo and app. No layout is reserved on the landing page:
 * the banner is fixed, so the hero cannot shift. The demo picker overlay gets
 * bottom padding while the banner is open (see html[data-consent="open"]).
 */

.consent-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--card, #fff);
  border-top: 1px solid var(--line, #eceae4);
  box-shadow: 0 -12px 36px rgba(23, 22, 26, 0.12);
  color: var(--ink, #17161a);
}

.consent-banner[hidden] {
  display: none;
}

.consent-inner {
  width: min(100%, var(--maxw, 1120px));
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
}

.consent-copy {
  flex: 1 1 420px;
  min-width: 0;
}

.consent-title {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.consent-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted, #5f5e66);
  max-width: 78ch;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.consent-btn {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line, #eceae4);
  background: var(--card, #fff);
  color: var(--ink, #17161a);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.consent-btn--all,
.consent-btn--analytics,
.consent-btn--reject {
  flex: 0 1 auto;
}

.consent-btn--all {
  background: var(--accent, #0a34c1);
  border-color: var(--accent, #0a34c1);
  color: #fff;
}

.consent-btn:hover {
  border-color: var(--accent, #0a34c1);
}

.consent-btn:focus-visible {
  outline: 2px solid var(--accent, #0a34c1);
  outline-offset: 2px;
}

.consent-note {
  flex: 0 0 auto;
  margin: 0;
  font-size: 11px;
}

.consent-note a {
  color: var(--muted, #5f5e66);
}

/* ---- app + demo: keep to the centred phone frame ------------------------ */

html[data-surface="app"] .consent-inner,
html[data-surface="demo"] .consent-inner {
  width: min(100%, 460px);
  padding: 0 16px;
}

html[data-surface="app"] .consent-copy,
html[data-surface="demo"] .consent-copy {
  flex-basis: 100%;
}

html[data-surface="app"] .consent-actions,
html[data-surface="demo"] .consent-actions {
  width: 100%;
}

html[data-surface="app"] .consent-btn,
html[data-surface="demo"] .consent-btn {
  flex: 1 1 0;
}

/* ---- demo picker: reserve room for the banner from first paint ---------- */

@media (max-width: 559px) {
  html[data-consent="open"] .demo-overlay {
    padding-bottom: calc(20px + var(--consent-banner-h, 300px) + 12px);
  }
}

@media (min-width: 560px) {
  html[data-consent="open"] .demo-overlay {
    padding-bottom: calc(20px + var(--consent-banner-h, 172px) + 12px);
  }
}

html[data-consent="open"] .demo-sheet {
  max-height: calc(100dvh - var(--consent-banner-h, 300px) - 56px);
  overflow: auto;
}

/* ---- preferences dialog ------------------------------------------------- */

.consent-dialog {
  width: min(100% - 32px, 440px);
  max-height: min(80vh, 560px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line, #eceae4);
  border-radius: 18px;
  background: var(--card, #fff);
  color: var(--ink, #17161a);
  box-shadow: 0 24px 64px rgba(23, 22, 26, 0.24);
}

.consent-dialog::backdrop {
  background: rgba(23, 22, 26, 0.42);
}

.consent-dialog[open] {
  overflow: auto;
}

.consent-dialog-inner {
  padding: 22px 22px calc(22px + env(safe-area-inset-bottom, 0px));
}

.consent-dialog h2 {
  margin: 0 0 8px;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.consent-dialog p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted, #5f5e66);
}

.consent-actions--dialog {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.consent-actions--dialog .consent-btn {
  width: 100%;
}

.consent-close {
  margin-top: 10px;
  min-height: 44px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #5f5e66);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.consent-close:focus-visible {
  outline: 2px solid var(--accent, #0a34c1);
  outline-offset: 2px;
}

/* ---- 320px: stacked, full-width buttons --------------------------------- */

@media (max-width: 559px) {
  .consent-inner {
    padding: 0 16px;
    gap: 12px;
  }

  .consent-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .consent-btn {
    width: 100%;
  }

  .consent-note {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .consent-banner,
  .consent-btn,
  .consent-dialog {
    transition: none;
  }
}

/* app profile menu: full-width preferences row under the mode/account block */
.profile-consent {
  width: 100%;
  margin-top: 6px;
}
