/* Marketerra consent banner — standard v1.1.
 * Load render-blocking in <head> from the site's own domain (or inline it). Never from a CMP CDN.
 * Re-theme ONLY through the tokens below. All three buttons share ONE style on purpose:
 * DVI (LV) requires the same colour, fill and font for "Piekrītu" and "Nepiekrītu".
 * Do not add .mc-btn--primary, ghost/outline variants or a smaller reject button.
 */
:root {
  --mc-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; /* set the site font explicitly */
  --mc-bg: #ffffff;
  --mc-fg: #1f1f22;
  --mc-muted: #45454b;          /* >= 4.5:1 on --mc-bg */
  --mc-btn-bg: #12403c;         /* brand colour, same for all buttons */
  --mc-btn-fg: #ffffff;         /* >= 4.5:1 on --mc-btn-bg */
  --mc-focus: #1a73e8;
  --mc-line: rgba(0, 0, 0, .12);
  --mc-switch-off: #767676;     /* >= 3:1 non-text contrast */
  --mc-radius: 14px;
  --mc-scrim: rgba(0, 0, 0, .55);
}

/* Fixed overlay: never in document flow -> zero layout shift. */
.mc-scrim {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--mc-scrim);
  font-family: var(--mc-font);
  visibility: hidden;
  opacity: 0;
  /* visibility flips only after the fade-out ... */
  transition: opacity .2s ease, visibility 0s linear .2s;
}
html.mc-open .mc-scrim {
  visibility: visible;
  opacity: 1;
  /* ... but flips immediately on open, otherwise focus() silently fails and Tab escapes the dialog */
  transition: opacity .2s ease, visibility 0s linear 0s;
}
/* Scroll lock by class on <html>, never an inline style (pre-renderers bake inline styles into static HTML).
 * body too: iOS Safari ignores overflow on <html> alone in some versions (check on a real iPhone, verify.md). */
html.mc-open:not(.mc-inline),
html.mc-open:not(.mc-inline) body { overflow: hidden; }

/* Policy page before a choice (html.mc-inline): the same banner as a non-blocking card. The policy must be
 * readable BEFORE the choice (informed consent); trackers stay off until a button is pressed. */
html.mc-inline .mc-scrim { background: transparent; pointer-events: none; align-items: flex-end; justify-content: flex-end; }
html.mc-inline .mc-dialog { pointer-events: auto; max-height: min(50vh, 440px); box-shadow: 0 8px 40px rgba(0, 0, 0, .35); }
html.mc-open.mc-inline body { padding-bottom: min(52vh, 460px); } /* the end of the policy can scroll above the card */

.mc-dialog {
  box-sizing: border-box;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 24px;
  border-radius: var(--mc-radius);
  background: var(--mc-bg);
  color: var(--mc-fg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  font: 400 15px/1.5 var(--mc-font);
  text-align: left;
}
.mc-dialog * { box-sizing: border-box; font-family: inherit; }
.mc-dialog section[hidden] { display: none; }

.mc-title { margin: 0 0 8px; font: 600 18px/1.3 var(--mc-font); color: inherit; outline: none; }
.mc-text { margin: 0 0 12px; font-size: 14px; color: var(--mc-muted); }
.mc-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.mc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.mc-btn {
  flex: 1 1 0;
  min-width: 128px;
  min-height: 44px;
  margin: 0;
  padding: 10px 14px;
  border: 2px solid var(--mc-btn-bg);
  border-radius: 10px;
  background: var(--mc-btn-bg);
  color: var(--mc-btn-fg);
  font: 600 15px/1.2 var(--mc-font);
  text-align: center;
  cursor: pointer;
}
.mc-btn:hover { filter: brightness(1.12); }

.mc-btn:focus-visible,
.mc-link:focus-visible,
.mc-switch:focus-visible,
/* Заголовок получает фокус программно (для экранных читалок), но он не элемент управления — рамку не рисуем (WCAG 2.4.7 касается управляемых элементов). */
.mc-title:focus, .mc-title:focus-visible { outline: none; }

.mc-cat { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--mc-line); }
.mc-cat .mc-text { margin-bottom: 0; }
.mc-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;           /* whole row is the touch target for the switch */
  font-weight: 600;
  cursor: pointer;
}
.mc-always { font-size: 13px; font-weight: 400; color: var(--mc-muted); }

.mc-switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: 13px;
  background: var(--mc-switch-off);
  cursor: pointer;
  transition: background .15s;
}
.mc-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s;
}
.mc-switch:checked { background: var(--mc-btn-bg); }
.mc-switch:checked::before { transform: translateX(18px); }

@media (max-width: 480px) {
  .mc-dialog { padding: 20px; }
  .mc-btn { flex-basis: 100%; }  /* stacked, still identical */
}

@media (prefers-reduced-motion: reduce) {
  .mc-scrim,
  html.mc-open .mc-scrim,
  .mc-switch,
  .mc-switch::before { transition: none; }
}
