/* ===========================================================================
 * cookie-consent.css — universal EU/UK cookie-consent banner.
 *
 * Deliberately built on ONLY the universal --hz-* semantic tokens from
 * design-system/tokens.css (surface/text/border/shadow/radius/space/z-index),
 * never the marketing-only short aliases (--surface, --text, --blue, ...)
 * that public/css/marketing.css defines for its own register. This banner
 * ships on marketing pages (blue/expressive register) AND on the chrome-less
 * app shell (blue product register, via
 * design-system/primitives.css) — using only tokens both registers define
 * means one stylesheet renders correctly on either, with no fallback chains
 * that could bottom out on an undefined custom property.
 *
 * One markup, one stylesheet, NO width breakpoints. The panel is a
 * content-driven "switcher": text and actions share one row while both fit
 * (a ~60px strip on tablet/desktop), and the actions drop onto their own row,
 * as two equal side-by-side buttons, only when they don't (phones). The
 * decision is made by the real rendered widths of the real labels in the
 * reader's language — not by a px guess tuned to today's English strings —
 * so a longer translation (German, Spanish) or a larger system font reflows
 * instead of clipping.
 * ========================================================================= */
.hz-cookie {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* Defensive: on a very narrow viewport (~320px), unrelated page content
     that overflows horizontally (e.g. the site header's action cluster) can
     expand the browser's layout viewport itself, which left:0/right:0 would
     otherwise inherit — pushing this fixed banner off-screen too. max-width:
     100vw always resolves to the true device width regardless of what else
     on the page is overflowing, so the banner stays fully on-screen even
     when something else doesn't. */
  max-width: 100vw;
  box-sizing: border-box;
  z-index: var(--hz-z-overlay);
  display: flex;
  justify-content: center;
  /* Clear the iPhone home indicator and, in landscape, the notch / rounded
     corners — env() is 0 everywhere else. */
  padding: var(--hz-space-2);
  padding-left: max(var(--hz-space-2), env(safe-area-inset-left));
  padding-right: max(var(--hz-space-2), env(safe-area-inset-right));
  padding-bottom: max(var(--hz-space-2), env(safe-area-inset-bottom));
  pointer-events: none;
}
.hz-cookie[hidden] { display: none; }
/* Focused programmatically (tabindex=-1) so screen readers announce it and
   Tab starts inside it; the container is not a control, so no ring. */
.hz-cookie:focus { outline: none; }

.hz-cookie__panel {
  pointer-events: auto;
  box-sizing: border-box;
  width: 100%;
  max-width: 880px;
  /* --hz-card-raised-bg already resolves per-register: the marketing gradient
     on marketing pages, --hz-surface-raised on the product register. */
  background: var(--hz-card-raised-bg);
  border: 1px solid var(--hz-border-strong);
  border-radius: var(--hz-radius-lg);
  box-shadow: var(--hz-shadow-lg);
  /* Tight on purpose: on a phone this strip is the first thing under the
     page's own call to action, so every line it saves is page shown. */
  padding: var(--hz-space-2) var(--hz-space-3);
  padding-inline-start: var(--hz-space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--hz-space-2) var(--hz-space-4);
  animation: hzCookieIn .32s var(--hz-ease-out);
  /* Both answers read at full text contrast. The app's button register
     skins the secondary label with its muted ink (3.8:1 on this panel, under
     AA) — fine for a "Cancel", but here it would make "Reject all" visibly
     fainter than "Accept all", the asymmetry the equal sizing exists to
     prevent. Re-pointed on the panel, so it holds on every register. */
  --hz-btn-secondary-fg: var(--hz-text);
}
@keyframes hzCookieIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .hz-cookie__panel { animation: none; }
}

/* The switcher. The text claims the row (grow 999) down to a readable
   measure (16rem); once text + buttons no longer fit side by side, the
   actions wrap onto their own row and, growing 1, take all of it. */
.hz-cookie__text {
  flex: 999 1 16rem;
  min-width: 0;
  margin: 0;
  font-family: var(--hz-font-body);
  font-size: .875rem;
  line-height: 1.45;
  color: var(--hz-text);
  overflow-wrap: anywhere;
}
.hz-cookie__text a { color: var(--hz-cookie-link); text-decoration: underline; text-underline-offset: 2px; }

.hz-cookie__actions {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--hz-space-2);
}

/* Equal prominence (ICO / CNIL): Reject and Accept share ONE sizing rule —
   same height, same flex share, same 8rem preferred width — so they render the same
   width: on their own row each takes half; on the desktop strip each is the
   8rem floor, which today's labels fit (the longest across the en/ru/de/
   es/ar catalogs, German "Alle akzeptieren", is ~8rem). min-width: max-content means a label is
   never squeezed (.hz-btn is white-space:nowrap by design-system contract):
   a longer future label just grows its button, and if the two can't fit
   side by side they wrap and each takes the full row, identical again.
   2 x 8rem + gap fits the 320px iPhone SE side by side. */
#hzCookieReject,
#hzCookieAccept {
  flex: 1 1 auto;
  /* The floor is the preferred width, not flex-basis: every engine sizes
     the strip's intrinsic width from it (Chromium's flex intrinsic-sizing
     algorithm under-measures a non-auto basis and wrapped the buttons). */
  width: 8rem;
  min-width: max-content;
}

/* Touch screens: a full 44px target (Apple HIG / WCAG 2.5.5), the 36px
   --sm height stays for mouse pointers where the strip should be slim. */
@media (pointer: coarse) {
  #hzCookieReject,
  #hzCookieAccept { min-height: var(--hz-tap-min); }
}
