/* ============================================================
   COOKIE CONSENT BANNER — Liquid Glass (iOS 26)
   - Fixed bottom-centered, fluid dimensions (clamp / vw / %).
   - Real backdrop-filter blur + saturate, layered shadows incl.
     inset highlight, top-half diagonal "specular" sheen via ::before.
   - Hidden by default; toggled via .cookie-consent--visible.
   - z-index sits above content/header/catalog-overlay (40000) but
     BELOW privacy-modal (60500) — so clicking the privacy link in
     the banner opens the modal on top of the banner.
   ============================================================ */

.cookie-consent {
  position: fixed;
  top: calc(max(8px, env(safe-area-inset-top)) + 72px);
  left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  width: min(720px, calc(100vw - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right))));
  margin-inline: auto;
  transform: translateY(20px);
  z-index: 40000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.5s var(--ease-expo),
    transform 0.5s var(--ease-expo),
    visibility 0.5s var(--ease-expo);
}

.cookie-consent--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* ---------- Liquid Glass surface ---------- */
.cookie-consent__inner {
  position: relative;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: clamp(16px, 2vw, 22px);
  padding: clamp(20px, 3vw, 32px);
  /* Layered shadow: depth lift + soft contact + inner highlight top + soft underline bottom */
  box-shadow:
    0 24px 80px rgba(30, 30, 30, 0.18),
    0 4px 16px rgba(30, 30, 30, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 24px);
  max-block-size: calc(100svh - 72px - max(16px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
  overflow: auto; /* clips the sheen and permits internal scrolling only on short viewports */
}

/* Scope the expensive backdrop-filter composition to when the banner is
   actually visible — for returning users (consent stored) the inner never
   gets blurred at all, saving GPU work. */
.cookie-consent--visible .cookie-consent__inner {
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

/* Specular top-half highlight — fakes light pooling on glass */
.cookie-consent__inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
  border-radius: clamp(16px, 2vw, 22px) clamp(16px, 2vw, 22px) 0 0;
}

/* Fallback for engines without backdrop-filter (Firefox default, older browsers).
   Check BOTH unprefixed and -webkit- forms — older Safari supports only the
   prefixed property and would otherwise be wrongly treated as unsupported. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cookie-consent__inner {
    background: rgba(255, 255, 255, 0.92);
  }
}

/* Touch devices (mobile/tablet): backdrop-filter is the single most
   expensive composition op on iOS Safari and mobile Chrome — when the
   banner is visible on first paint it forces a CPU composite of the
   entire viewport behind it, blowing through the 16ms budget.
   Strategy: kill both blurs entirely on coarse pointers and bump the
   banner background to near-opaque so text stays readable on any bg. */
@media (pointer: coarse) {
  .cookie-consent__inner,
  .cookie-consent--visible .cookie-consent__inner {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .cookie-consent .btn-pill--outline {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .cookie-consent .btn-pill--outline:hover {
    background: rgba(255, 255, 255, 0.95);
  }
}

/* ---------- Icon + content ---------- */
.cookie-consent__icon {
  flex-shrink: 0;
  width: clamp(36px, 4vw, 48px);
  height: clamp(36px, 4vw, 48px);
  color: var(--warm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative; /* sit above the ::before sheen */
  z-index: 1;
}
.cookie-consent__icon svg {
  width: 100%;
  height: 100%;
}

.cookie-consent__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 1.8vw, 18px);
  min-width: 0; /* let text wrap correctly inside flex */
  position: relative;
  z-index: 1;
}

.cookie-consent__text {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: clamp(14px, 1.6vw, 16px);
  letter-spacing: -0.01em;
  line-height: 1.5;
  color: var(--text);
}

.cookie-consent__link {
  /* This is a <button> styled as a link — reset default button chrome. */
  display: inline;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.3s var(--ease-expo);
}

.cookie-consent__link:hover {
  color: var(--accent-hover);
}

.cookie-consent__link:focus-visible,
.cookie-consent .btn-pill:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.cookie-consent__buttons {
  display: flex;
  gap: clamp(8px, 1.5vw, 12px);
  flex-wrap: wrap;
}

/* ---------- Glassy "decline" button — only in banner context ---------- */
.cookie-consent .btn-pill--outline {
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(60, 60, 60, 0.18);
}
.cookie-consent .btn-pill--outline:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ---------- Mobile: compact safe-area dialog that leaves the hero CTA clear ---------- */
@media (max-width: 600px) {
  .quiz-page.has-cookie-consent .quiz-section {
    transform: translateY(64px);
  }
  .cookie-consent__inner,
  .cookie-consent--visible .cookie-consent__inner {
    display: block;
    background: #fff;
    padding: 14px;
    border-radius: 16px;
    max-block-size: calc(48svh - env(safe-area-inset-top));
  }
  .cookie-consent__icon {
    display: none;
  }
  .cookie-consent__content {
    gap: 10px;
  }
  .cookie-consent__text {
    font-size: 13px;
    line-height: 1.38;
  }
  .cookie-consent__buttons {
    flex-direction: row;
    width: 100%;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .cookie-consent__buttons .btn-pill {
    --pill-h: 46px;
    flex: 1 1 0;
    min-width: 0;
    padding: 0 12px;
    text-align: center;
  }
}
