/* ==========================================================================
   Cookie banner  (brand/consent.css)
   Markup is built by growth/js/tc.js (classes .tc-cc*). Every value is a brand
   token (tokens.css) with its light-theme value as the fallback, so a page
   without tokens.css (the scorers, later) still gets the brand look; the dark
   block at the end covers those pages in dark mode. On the site the tokens
   always win, including data-theme overrides.

   Behaviour: fixed to the bottom (a card bottom-left from 640 px), so it never
   moves the page (no layout shift). It sits first in the DOM for keyboard and
   screen-reader order. "Accept all" and "Necessary only" are styled the same:
   saying no is as easy as saying yes.
   ========================================================================== */
:root { --tc-consent-css: 1; } /* tc.js checks this before loading the file itself */

.tc-cc {
  --tc-bg: var(--color-surface, #ffffff);
  --tc-ink: var(--color-ink, #1b1712);
  --tc-muted: var(--color-ink-muted, #5c5246);
  --tc-line: var(--color-line, #e2d5bf);
  --tc-edge: var(--color-line-strong, #1b1712);
  --tc-pop: var(--color-pop, #1b1712);
  --tc-well: var(--color-surface-2, #f4ead8);
  --tc-control: var(--color-control-edge, #857866);
  --tc-accent: var(--color-accent, #ffc21a);
  --tc-accent-hover: var(--color-accent-hover, #ffb000);
  --tc-accent-ink: var(--color-accent-ink, #1b1712);
  --tc-link: var(--color-link, #a23b0a);
  --tc-focus: var(--color-focus, #1e5fcd);
  --tc-display: var(--font-display, "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, sans-serif);

  position: fixed;
  z-index: 70; /* above the sticky header (40) and the chips buy bar (20) */
  left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  max-height: calc(100dvh - 16px);
  overflow: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: 14px 16px 14px;
  background: var(--tc-bg);
  color: var(--tc-ink);
  border: var(--border-width, 2px) solid var(--tc-edge);
  border-radius: var(--radius-lg, 22px);
  box-shadow: var(--shadow-pop, 4px 4px 0 var(--tc-pop)), var(--shadow-lg, 0 22px 44px -16px rgb(27 23 18 / 0.3));
  font-family: var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  font-size: var(--text-sm, 0.9375rem);
  line-height: 1.45;
  text-align: left;
}
.tc-cc *, .tc-cc *::before, .tc-cc *::after { box-sizing: border-box; }
@media (min-width: 640px) {
  .tc-cc {
    left: max(24px, env(safe-area-inset-left));
    right: auto;
    bottom: max(24px, env(safe-area-inset-bottom));
    width: min(29rem, calc(100vw - 48px));
    padding: 18px 20px 20px;
  }
}

.tc-cc__title {
  margin: 0 2.25rem 4px 0;
  font-family: var(--tc-display);
  font-size: var(--text-lg, 1.125rem);
  font-weight: var(--weight-semibold, 600);
  line-height: 1.2;
  letter-spacing: var(--tracking-tight, -0.015em);
  color: var(--tc-ink);
}
.tc-cc__title:focus { outline: none; }
.tc-cc__title:focus-visible { outline: 3px solid var(--tc-focus); outline-offset: 2px; border-radius: var(--radius-xs, 4px); }
.tc-cc p { margin: 0 0 10px; }
.tc-cc a { color: var(--tc-link); text-underline-offset: 0.18em; }
.tc-cc__gpc { font-size: var(--text-xs, 0.8125rem); color: var(--tc-muted); }

.tc-cc__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.tc-cc__btn {
  flex: 1 1 8.5rem;
  min-height: 48px; /* the site's button height (.btn) */
  margin: 0;
  padding: 8px 14px;
  border: var(--border-width, 2px) solid var(--tc-edge);
  border-radius: var(--radius-pill, 999px);
  background: var(--tc-accent);
  color: var(--tc-accent-ink);
  font-family: var(--tc-display);
  font-size: var(--text-base, 1rem);
  font-weight: var(--weight-semibold, 600);
  line-height: 1.1;
  box-shadow: var(--shadow-pop-sm, 2px 2px 0 var(--tc-pop));
  cursor: pointer;
  transition: transform var(--dur-fast, 120ms) var(--ease-out, ease), box-shadow var(--dur-fast, 120ms) var(--ease-out, ease), background-color var(--dur-fast, 120ms);
}
.tc-cc__btn:hover { background: var(--tc-accent-hover); transform: translate(-1px, -1px); box-shadow: var(--shadow-pop, 4px 4px 0 var(--tc-pop)); }
.tc-cc__btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--tc-pop); }
.tc-cc__more {
  flex: 0 0 auto;
  min-height: 44px;
  margin: 0 0 0 auto;
  padding: 8px 6px;
  border: 0;
  background: none;
  color: var(--tc-ink);
  font: inherit;
  font-weight: var(--weight-semibold, 600);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
/* Phones: the two equal buttons share a row, "Customize" sits centred under them. */
@media (max-width: 639px) {
  .tc-cc__more { flex-basis: 100%; min-height: 44px; margin: 0; padding: 4px 6px; text-align: center; }
}
.tc-cc.is-open .tc-cc__first { display: none; } /* the open panel has its own buttons */
.tc-cc :focus-visible { outline: 3px solid var(--tc-focus); outline-offset: 2px; }
.tc-cc__btn:focus-visible { outline-offset: 3px; border-radius: var(--radius-pill, 999px); }

.tc-cc__prefs fieldset { margin: 4px 0 12px; padding: 0; border: 0; min-width: 0; }
.tc-cc__opt {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--tc-line);
}
.tc-cc__opt label { cursor: pointer; }
.tc-cc__opt b { display: block; font-family: var(--tc-display); font-size: var(--text-base, 1rem); font-weight: var(--weight-semibold, 600); }
.tc-cc__opt span { display: block; color: var(--tc-muted); font-size: var(--text-xs, 0.8125rem); line-height: 1.4; }
.tc-cc__switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 50px;
  height: 30px;
  margin: 0;
  border: var(--border-width, 2px) solid var(--tc-control);
  border-radius: var(--radius-pill, 999px);
  background: var(--tc-well);
  cursor: pointer;
  transition: background-color var(--dur-fast, 120ms), border-color var(--dur-fast, 120ms);
}
.tc-cc__switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--tc-muted);
  transition: transform var(--dur, 200ms) var(--ease-out, ease), background-color var(--dur-fast, 120ms);
}
.tc-cc__switch:checked { background: var(--tc-accent); border-color: var(--tc-edge); }
.tc-cc__switch:checked::after { transform: translateX(20px); background: var(--tc-accent-ink); }
.tc-cc__switch:disabled { cursor: not-allowed; opacity: 0.6; }
.tc-cc__switch:focus-visible { outline-offset: 3px; }

.tc-cc__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--tc-ink);
  font: 400 28px/1 var(--font-body, system-ui, sans-serif);
  cursor: pointer;
}
.tc-cc__close:hover { background: var(--tc-well); }
.tc-cc__sr {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.tc-cc [hidden] { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
  .tc-cc { animation: tc-cc-in var(--dur, 200ms) var(--ease-out, ease) both; }
  @keyframes tc-cc-in { from { opacity: 0; transform: translateY(12px); } }
}
@media (forced-colors: active) {
  .tc-cc { border: 2px solid CanvasText; }
  .tc-cc__switch { border: 2px solid CanvasText; }
  .tc-cc__switch:checked::after { background: CanvasText; }
}

/* Pages without tokens.css in dark mode: the brand's dark values. */
@media (prefers-color-scheme: dark) {
  .tc-cc {
    --tc-bg: var(--color-surface, #221e18);
    --tc-ink: var(--color-ink, #f7efe2);
    --tc-muted: var(--color-ink-muted, #bdb1a0);
    --tc-line: var(--color-line, #3a332a);
    --tc-edge: var(--color-line-strong, #e3d6bf);
    --tc-pop: var(--color-pop, #8c7f6c);
    --tc-well: var(--color-surface-2, #2b261f);
    --tc-control: var(--color-control-edge, #9d907c);
    --tc-accent: var(--color-accent, #ffc933);
    --tc-accent-hover: var(--color-accent-hover, #ffd75e);
    --tc-link: var(--color-link, #ffb27a);
    --tc-focus: var(--color-focus, #8ab4ff);
  }
}
