:root {
  --bga-consent-paper: var(--bga-paper, #f5f2eb);
  --bga-consent-white: var(--bga-white, #fff);
  --bga-consent-ink: var(--bga-ink, #0a0f2c);
  --bga-consent-blue: var(--bga-blue-600, #0057ff);
  --bga-consent-muted: var(--bga-text-60, rgba(10, 15, 44, 0.68));
  --bga-consent-border: var(--bga-control-border, #687087);
  --bga-consent-line: var(--bga-line, rgba(10, 15, 44, 0.14));
  --bga-consent-radius: var(--radius-surface, 18px);
}

.bga-consent,
.bga-consent * {
  box-sizing: border-box;
}

.bga-consent {
  color: var(--bga-consent-ink);
  font-family: "Inter Tight", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.bga-consent-banner {
  position: fixed;
  z-index: 2147483000;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--bga-consent-border);
  border-radius: 16px;
  background: var(--bga-consent-paper);
  box-shadow: 0 24px 50px -28px rgba(10, 15, 44, 0.45);
  font-size: 14px;
  line-height: 1.45;
}

.bga-consent-banner .bga-consent__eyebrow {
  margin-block-end: 4px;
  font-size: 10.5px;
}

.bga-consent-banner .bga-consent__title {
  margin-block-end: 6px;
  font-size: clamp(20px, 2.2vw, 24px);
  line-height: 1.1;
}

.bga-consent-banner .bga-consent__copy {
  font-size: 14px;
  line-height: 1.45;
}

.bga-consent-banner .bga-consent__copy a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding-inline: 2px;
  vertical-align: middle;
}

.bga-consent-banner[hidden] {
  display: none;
}

html:not(.bga-consent-decided) .bga-privacy-controls {
  display: none;
}

.bga-privacy-controls {
  position: fixed;
  z-index: 2147482000;
  left: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--bga-consent-border);
  border-radius: 999px;
  background: var(--bga-consent-paper);
  box-shadow: 0 12px 28px -20px rgba(10, 15, 44, 0.46);
  color: var(--bga-consent-ink);
  font: 600 13px/1.2 "Inter Tight", Inter, system-ui, sans-serif;
}

.bga-privacy-controls a,
.bga-privacy-controls button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #0039d1;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* P2(a): on short desktop viewports (~<=920px tall — 1440x900 among them)
 * the hero left column's trust badges ("Working since 2020" / its RU
 * equivalent) can land inside this pill's own bottom-12px..+58px vertical
 * band (RU copy renders shorter there, so the badge row sits higher up than
 * on EN) — the pill (huge z-index, fixed) then paints over it. Moving the
 * pill elsewhere isn't safe either: bottom-right looks empty at a glance but
 * the hero-visual card's portrait/photo variant actually reaches that corner
 * (verified — it would just trade the badge-row collision for one over the
 * CEO photo). Instead, compact the pill on short viewports so its whole
 * footprint fits under the badge row with room to spare; only gated by
 * min-width so it never fights the mobile icon-collapse rule below. */
@media (min-width: 720px) and (max-height: 920px) {
  .bga-privacy-controls {
    bottom: 4px;
    padding: 3px;
    gap: 3px;
  }
  .bga-privacy-controls a,
  .bga-privacy-controls button {
    min-height: 28px;
    padding: 3px 10px;
  }
}

.bga-privacy-controls a:hover,
.bga-privacy-controls button:hover {
  background: rgba(0, 87, 255, 0.08);
}

/* Icon glyph is desktop-hidden by default — the ≤719.98px breakpoint below
 * swaps the text label for it so the pill collapses to an icon-only circle
 * on mobile without changing the desktop two-link pill (P1). */
.bga-privacy-controls__icon {
  display: none;
}

.bga-consent__eyebrow {
  margin: 0 0 8px;
  color: var(--bga-consent-muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bga-consent__title {
  margin: 0 0 10px;
  color: var(--bga-consent-ink);
  font-family: "BGA Gothic", "Century Gothic", Futura, system-ui, sans-serif;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.12;
}

.bga-consent__copy {
  margin: 0;
  color: var(--bga-consent-muted);
}

.bga-consent a {
  color: #0039d1;
  text-underline-offset: 3px;
}

.bga-consent__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  justify-content: end;
  margin-top: 14px;
}

.bga-consent__choice,
.bga-consent__settings-button,
.bga-consent__close {
  min-height: 52px;
  border: 1px solid var(--bga-consent-border);
  border-radius: 999px;
  background: var(--bga-consent-white);
  color: var(--bga-consent-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.bga-consent__choice {
  width: 280px;
  height: 52px;
  padding: 0 20px;
}

.bga-consent-banner .bga-consent__choice {
  width: 100%;
  min-height: 44px;
  height: 44px;
  padding-inline: 12px;
  font-size: 13.5px;
}

.bga-consent__settings-button {
  grid-column: 1 / -1;
  justify-self: center;
  min-height: 44px;
  padding: 8px 20px;
  border-color: transparent;
  background: transparent;
  color: #0039d1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bga-consent-banner .bga-consent__settings-button {
  min-height: 44px;
  padding: 4px 12px;
  font-size: 13.5px;
}

.bga-consent button:hover {
  border-color: var(--bga-consent-blue);
}

.bga-consent button:focus-visible,
.bga-consent a:focus-visible,
[data-bga-cookie-settings]:focus-visible {
  outline: 3px solid var(--bga-consent-blue);
  outline-offset: 3px;
}

.bga-consent-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: 760px;
  height: min(88dvh, 760px);
  max-height: 88dvh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--bga-consent-border);
  border-radius: var(--bga-consent-radius);
  background: var(--bga-consent-paper);
  color: var(--bga-consent-ink);
  box-shadow: 0 28px 80px -30px rgba(10, 15, 44, 0.58);
}

.bga-consent-dialog[open] {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.bga-consent-dialog::backdrop {
  background: rgba(0, 12, 54, 0.58);
}

.bga-consent-dialog__body {
  min-height: 0;
  max-height: none;
  padding: 28px 28px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.bga-consent-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.bga-consent__close {
  flex: 0 0 auto;
  min-width: 84px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 11px;
}

.bga-consent-categories {
  display: grid;
  gap: 0;
  margin-top: 24px;
  border-top: 1px solid var(--bga-consent-line);
}

.bga-consent-category {
  padding: 20px 0;
  border-bottom: 1px solid var(--bga-consent-line);
}

.bga-consent-category__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.bga-consent-category__name {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.bga-consent-category__description {
  margin: 8px 0 0;
  color: var(--bga-consent-muted);
  font-size: 14px;
}

.bga-consent-category__locked {
  flex: 0 0 auto;
  color: var(--bga-consent-muted);
  font-size: 13px;
  font-weight: 700;
}

.bga-consent-switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: 52px;
  height: 44px;
}

.bga-consent-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.bga-consent-switch__track {
  width: 52px;
  height: 30px;
  border: 2px solid var(--bga-consent-border);
  border-radius: 999px;
  background: var(--bga-consent-white);
  transition: background 160ms ease, border-color 160ms ease;
}

.bga-consent-switch__track::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin: 3px;
  border-radius: 50%;
  background: var(--bga-consent-border);
  transition: transform 160ms ease, background 160ms ease;
}

.bga-consent-switch input:checked + .bga-consent-switch__track {
  border-color: var(--bga-consent-blue);
  background: var(--bga-consent-blue);
}

.bga-consent-switch input:checked + .bga-consent-switch__track::after {
  transform: translateX(22px);
  background: var(--bga-consent-white);
}

.bga-consent-switch input:focus-visible + .bga-consent-switch__track {
  outline: 3px solid var(--bga-consent-blue);
  outline-offset: 3px;
}

.bga-consent-provider-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.bga-consent-provider {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid rgba(0, 57, 209, 0.16);
  border-radius: 10px;
  background: rgba(0, 57, 209, 0.05);
  color: var(--bga-consent-muted);
  font-size: 13px;
}

.bga-consent-provider strong {
  color: var(--bga-consent-ink);
}

.bga-consent-dialog__actions {
  position: static;
  display: grid;
  grid-template-columns: repeat(2, 260px);
  gap: 12px;
  justify-content: end;
  padding: 20px 28px max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--bga-consent-border);
  background: var(--bga-consent-paper);
}

.bga-consent-dialog__actions .bga-consent__choice {
  width: 260px;
}

.bga-consent__save {
  grid-column: 1 / -1;
  justify-self: end;
  min-width: 180px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--bga-consent-blue);
  border-radius: 999px;
  background: var(--bga-consent-blue);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 719.98px) {
  .bga-consent-banner {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-bottom));
    padding: 15px;
  }

  .bga-consent__actions,
  .bga-consent-dialog__actions {
    grid-template-columns: 1fr;
  }

  .bga-consent__choice,
  .bga-consent-dialog__actions .bga-consent__choice {
    width: 100%;
    height: 52px;
  }

  .bga-consent-banner .bga-consent__choice {
    height: 44px;
  }

  .bga-consent__settings-button,
  .bga-consent__save {
    grid-column: 1;
    width: 100%;
  }

  .bga-consent-dialog {
    width: 100vw;
    max-width: none;
    height: min(88dvh, 720px);
    max-height: 88dvh;
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  .bga-consent-dialog__body {
    padding: 22px 20px 16px;
  }

  .bga-consent-dialog__actions {
    padding: 16px 20px max(16px, env(safe-area-inset-bottom));
  }

  .bga-privacy-controls {
    /* Moved off the bottom-left entirely and collapsed to an icon-only
     * circle. The bottom-of-screen band is contested real estate at this
     * breakpoint: the sticky .mobile-cta bar owns the very bottom, and the
     * in-hero primary CTA ("Get a free consultation →" / its RU equivalent,
     * which runs noticeably longer and spans nearly the full width) sits
     * right above it at scroll=0 on common phone viewports — there is no
     * static left/right/bottom offset that clears both a short- and a
     * long-text CTA there. Anchoring under the sticky header instead is
     * stable across locales, viewport heights and scroll position, since
     * that header is itself sticky at top:0 (P1). */
    left: auto;
    right: 10px;
    bottom: auto;
    top: calc(73px + env(safe-area-inset-top, 0px) + 10px);
    max-width: calc(100vw - 16px);
    flex-wrap: wrap;
    /* Collapse the full two-link pill to a compact icon-only circle. The
     * "Privacy" link is hidden here (kept in the DOM for the other
     * locale/legal checks) and duplicated as a real link inside the
     * cookie-settings dialog (buildDialog in consent.js), so the legal
     * affordance survives the collapse. */
    padding: 0;
    gap: 0;
  }

  .bga-privacy-controls > a {
    display: none;
  }

  .bga-privacy-controls > button {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
  }

  .bga-privacy-controls__text {
    display: none;
  }

  .bga-privacy-controls__icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
  }
}

/* Fully hide the pill while the mobile drawer covers the screen — it would
 * otherwise float over the drawer's own bottom CTA (P1). body.mnav-open is
 * toggled by app.js; the drawer-open state also makes the pill unreachable
 * behind the scrim, so hiding it here doesn't remove a reachable affordance. */
body.mnav-open .bga-privacy-controls {
  display: none;
}

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