/*
 * consent.css — styles for the shared cookie-consent module (js/consent.js).
 *
 * Self-contained on purpose: it loads on marketing pages, the legal pages, the SPA
 * AND the builder-generated pages, which do NOT share a CSS-variable set — so the
 * brand tokens are declared LOCALLY on the banner element (never inherited from the
 * page) and every value is explicit. This is the ONE place the banner geometry is
 * set (Engineering T2): a centered floating card that clears the bottom corners, and
 * while it is open the chat launcher is lifted clear of it (PUB-13).
 *
 * Design: the 1Gesture brand kit (deep green #00552B, lime #B3FF7A, ink #232824,
 * Libre Franklin). Two states share one card — the intro (Accept all / Reject
 * non-essential / Manage preferences) and the granular preferences panel. Accept all
 * and Reject non-essential are EQUAL-prominence (identical size/shape/weight), per
 * UK GDPR / ICO guidance (reject as easy as accept). Analytics defaults OFF.
 */

/* Brand type — self-hosted, only the two weights the banner uses; font-display:swap
   with an Arial Narrow / system fallback so text is never invisible while it loads. */
@font-face { font-family: 'Libre Franklin 1G'; font-weight: 600; font-display: swap; src: url('/branding/fonts/LibreFranklin-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Libre Franklin 1G'; font-weight: 800; font-display: swap; src: url('/branding/fonts/LibreFranklin-ExtraBold.woff2') format('woff2'); }

/* ---- banner shell ------------------------------------------------------- */

.cookie-banner.og-consent {
  /* brand tokens, scoped locally (self-contained; not from page vars) */
  --cc-green: #00552B;
  --cc-green-dark: #003D20;
  --cc-lime: #B3FF7A;
  --cc-ink: #232824;
  --cc-ink-soft: #4B534C;
  --cc-border: #E2E5E1;
  --cc-amber: #A35E00;

  font-family: 'Libre Franklin 1G', 'Arial Narrow', system-ui, -apple-system, sans-serif;
  /* A centered floating CARD (not a full-width bottom bar): it never covers the
     bottom-left app controls or the bottom-right chat launcher, so it cannot
     intercept their clicks. PUB-13 is handled by lifting the launcher clear. */
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, calc(100vw - 32px));
  z-index: 2147483000;
  background: #ffffff;
  color: var(--cc-ink);
  border: 1px solid var(--cc-border);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(35, 40, 36, 0.22);
  padding: 22px;
  /* Non-modal: the card surface never captures clicks meant for the app behind it.
     Only the card's own controls are interactive (re-enabled below). Consent is
     enforced by default-deny in the tracker, not by blocking UI. */
  pointer-events: none;
  /* Default-hidden; [hidden] and .is-visible drive display so BOTH the SPA and
     marketing test idioms work against one element. */
  display: none;
}

/* Re-enable interaction only on the card's own controls. */
.cookie-banner.og-consent button,
.cookie-banner.og-consent a,
.cookie-banner.og-consent .cookie-switch {
  pointer-events: auto;
}

.cookie-banner.og-consent.is-visible { display: block; }
/* The [hidden] attribute must always win (SPA hides via el.hidden = true). */
.cookie-banner.og-consent[hidden] { display: none; }

/* ---- intro / panel state toggle ----------------------------------------- */

.cookie-banner.og-consent .cookie-banner__panel { display: none; }
.cookie-banner.og-consent.og-consent--prefs .cookie-banner__intro { display: none; }
.cookie-banner.og-consent.og-consent--prefs .cookie-banner__panel { display: block; }

/* Stale-version "our policy changed" notice (set by consent.js on a re-ask). */
.cookie-banner.og-consent .og-consent__lede:not(:empty) {
  display: block;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cc-amber);
  margin: 0 0 8px;
}

/* ---- intro ---------------------------------------------------------------- */

.cookie-banner.og-consent .cookie-banner__title {
  font-weight: 800;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--cc-ink);
  margin: 0 0 8px;
}

.cookie-banner.og-consent .cookie-banner__text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--cc-ink-soft);
  margin: 0 0 16px;
}

.cookie-banner.og-consent .cookie-banner__text a {
  color: var(--cc-green);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Accept all + Reject non-essential — EQUAL prominence: identical size, shape,
   weight and hit area (Legal T1.5 / QA T4 veto on any accept-dominant styling).
   They differ only by fill + label, both high-contrast solid pills. */
.cookie-banner.og-consent .cookie-banner__actions { display: flex; gap: 10px; }

.cookie-banner.og-consent .cookie-banner__btn {
  font: inherit;
  font-weight: 800;
  font-size: 14.5px;
  line-height: 1.2;
  border-radius: 999px;
  padding: 12px 16px;
  min-height: 48px;                 /* AA touch target */
  cursor: pointer;
  border: 2px solid transparent;
  flex: 1 1 0;                       /* equal width */
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.cookie-banner.og-consent .cookie-banner__btn:active { transform: translateY(1px); }

.cookie-banner.og-consent .cookie-banner__accept,
.cookie-banner.og-consent .cookie-banner__accept2,
.cookie-banner.og-consent .cookie-banner__save {
  background: var(--cc-green); color: #ffffff; border-color: var(--cc-green);
}
.cookie-banner.og-consent .cookie-banner__accept:hover,
.cookie-banner.og-consent .cookie-banner__accept2:hover,
.cookie-banner.og-consent .cookie-banner__save:hover {
  background: var(--cc-green-dark); border-color: var(--cc-green-dark);
}

.cookie-banner.og-consent .cookie-banner__decline {
  background: var(--cc-ink); color: #ffffff; border-color: var(--cc-ink);
}
.cookie-banner.og-consent .cookie-banner__decline:hover { background: #000000; border-color: #000000; }

/* Manage preferences — tertiary: a quiet text control (it opens options, it is not
   a consent decision, so it does not compete with Accept/Reject). */
.cookie-banner.og-consent .cookie-banner__manage-row { margin-top: 12px; text-align: center; }
.cookie-banner.og-consent .cookie-banner__manage {
  font: inherit; font-weight: 600; font-size: 13.5px;
  color: var(--cc-ink); background: none; border: none; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; padding: 6px 8px;
}
.cookie-banner.og-consent .cookie-banner__manage:hover { color: var(--cc-green); }

/* Visible keyboard focus everywhere (AA 2.4.7). */
.cookie-banner.og-consent button:focus-visible,
.cookie-banner.og-consent a:focus-visible,
.cookie-banner.og-consent .cookie-switch__input:focus-visible ~ .cookie-switch__track {
  outline: 3px solid var(--cc-ink);
  outline-offset: 2px;
}

/* ---- preferences panel --------------------------------------------------- */

.cookie-banner.og-consent .cookie-banner__panel-title {
  font-weight: 800; font-size: 18px; color: var(--cc-ink); margin: 0 0 4px;
}
.cookie-banner.og-consent .cookie-banner__panel-sub {
  font-size: 13px; line-height: 1.55; color: var(--cc-ink-soft); margin: 0 0 14px;
}

.cookie-banner.og-consent .cookie-cat {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 0; border-top: 1px solid var(--cc-border);
}
.cookie-banner.og-consent .cookie-cat:first-of-type { border-top: none; padding-top: 4px; }
.cookie-banner.og-consent .cookie-cat__txt { flex: 1; }
.cookie-banner.og-consent .cookie-cat__name {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 14.5px; color: var(--cc-ink); margin: 0 0 3px;
}
.cookie-banner.og-consent .cookie-cat__desc {
  font-size: 12.5px; line-height: 1.5; color: var(--cc-ink-soft); margin: 0;
}
.cookie-banner.og-consent .cookie-cat__always {
  font-weight: 800; font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--cc-green); background: var(--cc-lime); border-radius: 999px; padding: 3px 9px;
}

/* Analytics toggle. Clicking the label toggles the (visually hidden but focusable)
   checkbox natively; on/off is conveyed by the knob position AND the On/Off label,
   never colour alone (WCAG 1.4.1). Default OFF. */
.cookie-banner.og-consent .cookie-switch {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer; margin-top: 2px;
}
.cookie-banner.og-consent .cookie-switch__input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: -1px; overflow: hidden;
}
.cookie-banner.og-consent .cookie-switch__track {
  position: relative; flex: 0 0 auto; width: 50px; height: 29px;
  background: #c2ccc2; border-radius: 999px; transition: background 0.16s ease;
}
.cookie-banner.og-consent .cookie-switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 23px; height: 23px;
  border-radius: 50%; background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.16s ease;
}
.cookie-banner.og-consent .cookie-switch__input:checked ~ .cookie-switch__track { background: var(--cc-green); }
.cookie-banner.og-consent .cookie-switch__input:checked ~ .cookie-switch__track::after { transform: translateX(21px); }
.cookie-banner.og-consent .cookie-switch__state {
  min-width: 22px; font-weight: 800; font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--cc-ink-soft);
}

.cookie-banner.og-consent .cookie-banner__panel-foot { display: flex; gap: 10px; margin-top: 16px; }
.cookie-banner.og-consent .cookie-banner__panel-foot .cookie-banner__save { flex: 2; }
.cookie-banner.og-consent .cookie-banner__panel-foot .cookie-banner__accept2 { flex: 1; }

/* Narrow screens: stack the two equal buttons (still equal, full width). */
@media (max-width: 460px) {
  .cookie-banner.og-consent .cookie-banner__actions,
  .cookie-banner.og-consent .cookie-banner__panel-foot { flex-direction: column; }
  .cookie-banner.og-consent .cookie-banner__btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-banner.og-consent .cookie-banner__btn,
  .cookie-banner.og-consent .cookie-switch__track,
  .cookie-banner.og-consent .cookie-switch__track::after { transition: none; }
}

/* ---- launcher de-conflict (PUB-13) --------------------------------------
 * While the banner is open, lift the floating chat launcher above the card so
 * their boxes never overlap. consent.js sets --og-consent-h to the live banner
 * height (recomputed when the panel opens); it returns to rest on hide(). */
body.og-consent-open .og-chat-launcher {
  transform: translateY(calc(-1 * (var(--og-consent-h, 96px) + 24px)));
}

/* ---- persistent "Cookie settings" re-open control ------------------------ */

.og-consent-settings {
  font-family: 'Libre Franklin 1G', 'Arial Narrow', system-ui, sans-serif;
  color: #00552B;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  /* DEF-048: the control is now the cookie ICON, so lay it out as an icon
     button (no text underline). The accessible name lives on aria-label/title. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.og-consent-settings svg { display: block; }
.og-consent-settings:hover { color: #003D20; }
.og-consent-settings:focus-visible { outline: 3px solid #232824; outline-offset: 2px; }

/* Footer variant: inline with the other footer links. DEF-048 follow-up — the
   marketing footers are DARK green, and the base control colour is the SAME deep
   green (#00552B), so the icon was invisible against the footer. Inherit the
   footer's own (light) text colour and match the links' 85% opacity instead. */
.og-consent-settings--footer {
  display: inline-flex; align-items: center; margin: 8px 12px 0;
  color: inherit; opacity: 0.85;
}
.og-consent-settings--footer:hover { color: inherit; opacity: 1; }

/* Fixed variant (SPA + builder pages, which have no <footer>): a small unobtrusive
   pill in the bottom-LEFT, clear of the chat launcher in the bottom-right (PUB-13). */
.og-consent-settings--fixed {
  /* DEF-048 (owner follow-up): a FLOATING launcher-style circle, mirroring the
     chat launcher (bottom-right) but pinned bottom-LEFT so the two never
     collide, and lifted above page content. Deep-green icon on a solid white
     disc reads on any page background. */
  position: fixed; left: 20px; bottom: 20px; z-index: 9998;
  /* Match the chat launcher exactly: 56px green (#22C55E) disc, white icon,
     no border, same shadow + hover. */
  width: 56px; height: 56px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #ffffff; background: #22C55E;
  border: none; border-radius: 50%;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.og-consent-settings--fixed svg { width: 26px; height: 26px; }
.og-consent-settings--fixed:hover {
  color: #ffffff; background: #16A34A;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.45);
}
/* While the consent banner itself is open the re-open control is redundant and
   could overlap the banner on narrow screens, so hide the floating button. */
body.og-consent-open .og-consent-settings--fixed { display: none; }

/* Explicit in-page control on the legal pages (cookie-policy / privacy-policy):
   a proper button rather than a text link, so it reads as an action. */
.cookie-policy__settings-btn {
  font-family: 'Libre Franklin 1G', 'Arial Narrow', system-ui, sans-serif;
  font-weight: 800;
  color: #ffffff;
  background: #00552B;
  border: 1px solid #00552B;
  border-radius: 999px;
  padding: 12px 24px;
  min-height: 44px;
  cursor: pointer;
}
.cookie-policy__settings-btn:hover { background: #003D20; border-color: #003D20; }
.cookie-policy__settings-btn:focus-visible { outline: 3px solid #232824; outline-offset: 2px; }
