/* The consent banner (analytics/_banner.html) and the privacy choices page. Loaded by the website and the app, so it
   reads only tokens both define (--s-*, --paper, --ink, --rule-strong, --carbon-50, --focus, --bw-ring) and never a px
   value. Accept and Reject share one class: same size, same colours, same weight (EDPB 05/2020). */
:root { --cbar-link: var(--link, var(--accent)); }

:root { --cbar-room: 16rem; --cbar-lift: 0rem; }
@media (min-width: 48em) { :root { --cbar-room: 9rem; } }

/* room at the end of the page, so the banner never hides the last links (WCAG 2.2 focus not obscured) */
body:has(> .cbar) { padding-block-end: var(--cbar-room); }
/* a page with its own sticky bottom bar (the composer) keeps that room above the bar instead of under it, so the bar
   always reaches the bottom of the screen and the lifted banner never sits on it, even scrolled to the very end */
body:has(> .cbar):has(> .app .actionbar) { padding-block-end: 0; }
body:has(> .cbar) .app:has(.actionbar) .main { padding-block-end: var(--cbar-room); }

/* in the app the banner sits above the tab bar on a phone and beside the sidebar on a desktop; where a page has its own
   bottom bar (the composer's action bar) consent.js lifts it above that bar with --cbar-lift */
@media (max-width: 59.9375em) { .app ~ .cbar { inset-block-end: calc(var(--bar) + env(safe-area-inset-bottom)); } }
.app.shell--focus ~ .cbar { inset-block-end: var(--cbar-lift); }
/* the week screen keeps its Approve all bar above the tab bar on a phone: the banner sits above both (consent.js measures the lift) */
@media (max-width: 59.9375em) { .app:has(.wk-bar) ~ .cbar { inset-block-end: max(var(--cbar-lift), calc(var(--bar) + env(safe-area-inset-bottom))); } }
@media (min-width: 60em) { .app ~ .cbar { inset-inline-start: var(--side); } }

/* the flow shell (sign-up, sign-in) is one screen high on a desktop with its toggles and action bar pinned to the bottom of
   it: an overlay would sit on them with no scroll room to lift them. So the banner takes its own row after the shell
   (sticky at the bottom, never a fixed overlay) and the shell, its sidebar and its action bar stop above it by the
   banner's measured height (--cbar-room, kept by consent.js). A phone keeps the overlay above the page's own bar. */
@media (min-width: 60em) {
  body:has(> .ob ~ .cbar) { padding-block-end: 0; }
  .ob ~ .cbar { position: sticky; inset-block-end: 0; }
  body:has(> .ob ~ .cbar) .ob,
  body:has(> .ob ~ .cbar) .ob__main { min-block-size: calc(100dvh - var(--cbar-room)); }
  body:has(> .ob ~ .cbar) .ob .sidebar { block-size: calc(100dvh - var(--cbar-room)); }
  body:has(> .ob ~ .cbar) .ob .actionbar { inset-block-end: var(--cbar-room); }
}

.cbar {
  position: fixed;
  inset-inline: 0;
  inset-block-end: var(--cbar-lift);
  z-index: 60;
  max-block-size: 70dvh;
  overflow-y: auto;
  padding: var(--s-3) var(--s-4);
  padding-block-end: max(var(--s-3), env(safe-area-inset-bottom));
  background-color: var(--paper);
  color: var(--ink);
  border-block-start: 0.125rem solid var(--rule-strong);
  box-shadow: 0 -0.5rem 1.5rem rgb(0 0 0 / .18);
}

.cbar__form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-5);
  max-inline-size: 72rem;
  margin-inline: auto;
}

.cbar__body { flex: 1 1 22rem; min-inline-size: 0; }
.cbar__title { margin: 0; font-weight: 700; font-size: 0.9375rem; }
.cbar__text { margin: var(--s-1) 0 0; font-size: 0.9375rem; line-height: 1.45; }

.cbar__actions {
  display: flex;
  flex: 1 1 18rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2) var(--s-3);
  min-inline-size: 0;
}

.cbar__btn {
  flex: 1 1 auto;  /* as wide as its words; the row wraps instead of squeezing a word (el "Απόρριψη όλων" at 390) */
  min-block-size: 3rem;
  padding-inline: var(--s-4);
  overflow-wrap: normal;  /* the body's "anywhere" would split a word in two */
  border: 0.125rem solid var(--rule-strong);
  border-radius: var(--r-sm);
  background-color: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.cbar__btn:hover { background-color: var(--carbon-50); }
.cbar__btn:focus-visible,
.cbar__link:focus-visible { outline: var(--bw-ring) solid var(--focus); outline-offset: var(--bw-ring); }

.cbar__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-block-size: 3rem;
  padding-inline: var(--s-3);
  color: var(--cbar-link);
  font-weight: 600;
}

/* the privacy choices page */
.cpage { max-inline-size: 44rem; }
.cpage h2 { margin-block: var(--s-5) var(--s-2); }
.cpage__list { padding-inline-start: var(--s-5); }
.cpage__list li { margin-block-end: var(--s-3); }
.cpage__state { font-weight: 700; margin-block: var(--s-5) var(--s-3); }
.cpage__purpose { margin-block-end: var(--s-4); }
.cpage__purpose p { margin-block: var(--s-1) 0; }
.cpage__purpose input { inline-size: 1.25rem; block-size: 1.25rem; vertical-align: middle; }
.cpage__buttons { display: flex; flex-wrap: wrap; gap: var(--s-3); max-inline-size: 40rem; }
