/* ==========================================================================
   consent.css — the cookie banner and the /privacy/choices panel.
   Colour and type come from tokens.css. No hex values live here.

   Loaded only when the consent mechanism is switched on: the <link> is emitted
   by _ConsentBanner.cshtml itself, so with Consent:Enabled false not one byte
   of this file is requested. The choices page links it in its own Head section
   because that page is permanent and exists either way.
   ========================================================================== */

/* The server writes the decision onto this element; consent.js reads it back
   out. Never visible, never focusable, no layout of its own. */
.consent-state { display: none !important; }

/* -------------------------------------------------------------- banner */
/* Deliberately NOT a modal and NOT full-screen. There is no overlay, nothing
   is focus-trapped, and the page underneath stays readable and operable while
   the question is open — which is why no trap is needed: a trap is what you
   owe someone after you have taken the rest of the page away, and taking the
   page away to extract a yes is the pattern this file exists to avoid. */
.consent {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;                     /* the sticky masthead is 40 */
  padding: var(--space-3);
  /* The strip spans the viewport so the card can centre in it, but only the
     card takes pointer events; the rest of the bottom of the page stays live. */
  pointer-events: none;
}

/* The card is fixed over the foot of the page, so give the page a floor to
   stand on or the last paragraph of every article sits underneath it. */
body:has(.consent) { padding-bottom: 16rem; }
@media (min-width: 40rem) {
  body:has(.consent) { padding-bottom: 11rem; }
}

.consent__card {
  pointer-events: auto;
  position: relative;
  width: min(46rem, 100%);
  margin-inline: auto;
  background: var(--color-shell);
  border: 1px solid var(--color-haze);
  border-top: 3px solid var(--color-bolt);
  border-radius: var(--radius-md);
  box-shadow: 0 0.75rem 2rem color-mix(in srgb, var(--color-deep) 20%, transparent);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  /* On a short viewport the card scrolls itself rather than growing off-screen
     and putting the buttons somewhere unreachable. */
  max-height: calc(100dvh - 2 * var(--space-3));
  overflow-y: auto;
  animation: consent-rise .22s ease-out;
}

/* On a phone the card was 595px of an 812px viewport. Tightened, and capped so
   that whatever the copy grows to, two thirds of the page underneath stays
   visible and the card scrolls itself instead. */
@media (max-width: 30rem) {
  .consent__card {
    padding: var(--space-4);
    gap: var(--space-3);
    max-height: 66dvh;
  }
  /* The heading does NOT shrink here. Bodoni is a Didone and --scale-step-1 is
     19.2px, under the 20px floor where its hairlines stop rendering; four
     pixels of vertical space are not worth a heading that reads as damaged. */
  .consent__card p { font-size: .9rem; }
}

@keyframes consent-rise {
  from { transform: translateY(0.75rem); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* Bodoni is a Didone: below roughly 20px the hairlines stop rendering.
   --scale-step-2 is 24px, comfortably above the floor. */
.consent__card h2 { font-size: var(--scale-step-2); line-height: 1.15; }
.consent__card p { font-size: .95rem; max-width: 60ch; }

/* --------------------------------------------------------- the two paths */
/* "Accept all" and "Reject all" are the same control twice: same element, same
   class, same box, same border, same weight, same hover, and flex-basis 0 so
   they come out the same width whatever the labels say. Nothing here may grow
   one of them. In the EU refusing has to be as easy as accepting; everywhere
   else it is simply how you ask a question you are willing to hear no to. */
.consent__paths {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.consent__path {
  flex: 1 1 0;
  min-width: 11rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: var(--weight-body-bold);
  line-height: 1;
  text-align: center;
  cursor: pointer;
  padding: .95rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-ink);
  background: var(--color-shell);
  color: var(--color-ink);
  transition: background-color .15s ease, color .15s ease;
}
.consent__path:hover {
  background: var(--color-ink);
  color: var(--color-sand);
}

/* ------------------------------------------------------------ the panel */
.consent__panel {
  border-top: 1px solid var(--color-haze);
  padding-top: var(--space-4);
}
.consent__panel > summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: var(--weight-mono-medium);
  letter-spacing: var(--tracking-mono-label);
  text-transform: uppercase;
  color: var(--color-bolt);
  padding: .25rem 0;
}
.consent__panel > summary:hover { color: var(--color-ink); }
.consent__panel[open] > summary { margin-bottom: var(--space-4); }

.consent__cats {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.consent__cat {
  display: grid;
  grid-template-columns: 1.2rem 1fr;
  gap: .35rem .7rem;
  align-items: start;
}
.consent__cat input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: .2rem 0 0;
  accent-color: var(--color-bolt);
}
.consent__cat label {
  font-size: .98rem;
  font-weight: var(--weight-body-bold);
  color: var(--color-ink);
  cursor: pointer;
}
.consent__cat p {
  grid-column: 2;
  margin: 0;
  font-size: .88rem;
  line-height: 1.5;
  color: var(--color-dusk);
}
/* Necessary. Shown ticked and disabled because it is a statement of fact, not
   an offer — and it is the ONLY box that may arrive pre-ticked. */
.consent__cat--locked input[type="checkbox"] { accent-color: var(--color-dusk); }
.consent__cat--locked label { color: var(--color-dusk); cursor: default; }

.consent__meta {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: .68rem;
  letter-spacing: var(--tracking-mono-label);
  text-transform: uppercase;
  color: var(--color-dusk);
  margin: 0;
}
.consent__fineprint { font-size: .85rem; color: var(--color-dusk); }
.consent__fineprint a { color: var(--color-bolt); }

/* The close control is injected by consent.js and exists only where script
   runs, because a dismissal that needs JavaScript must not be painted for
   someone whose browser will never honour it. Closing records NOTHING — it is
   not a third answer, and nothing optional runs until she picks one. */
.consent__close {
  position: absolute;
  top: var(--space-2);
  inset-inline-end: var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-dusk);
  font-family: var(--font-body);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.consent__close:hover { color: var(--color-ink); border-color: var(--color-haze); }

/* ------------------------------------------------- /privacy/choices page */
.choices__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
/* Same two controls as the banner, same rule about equal weight. */
.choices__paths { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.choices__paths .consent__path { flex: 1 1 0; min-width: 12rem; }

.choices__save {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}
.choices__state {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
}
