/* Lei Consent banner presentation. The plugin owns consent state and copy;
   the theme supplies the centered modal and market-wide visual overrides.
   Prefix rules with the container ID because the plugin stylesheet loads
   later. .cmplz-show displays the banner, .cmplz-dismissed follows a choice,
   and .cmplz-categories-visible exposes preference controls. Accept, deny,
   and preferences are available on the initial view. */

/* Dim the page while the banner asks (visual pressure only — the page
   stays interactive; pointer-events:none keeps this out of dark-pattern
   "cookie wall" territory). Must stay BELOW the banner's z-index 99999.
   Gate on .cmplz-show, the plugin's own visible-state class — matching
   :not(.cmplz-hidden) once left the dim on permanently after a choice.
   :has() misses on very old browsers, which then simply get no overlay. */
#lei-consent-banner-container:has(> .cmplz-cookiebanner.cmplz-show)::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 22, 0.5);
  z-index: 99998;
  pointer-events: none;
}

/* The first-paint banner is visible before its client handlers attach. While
   that banner is inert, let the existing full-screen dim absorb taps instead
   of passing them through to links underneath the modal. The client removes
   .leiu-cmplz-prerender as soon as the real controls are ready, restoring the
   intentionally non-blocking dim above. */
#lei-consent-banner-container:has(> .cmplz-cookiebanner.cmplz-show.leiu-cmplz-prerender)::before {
  pointer-events: auto;
}

#lei-consent-banner-container .cmplz-cookiebanner {
  /* The owned consent CSS reads these compatibility properties. */
  --cmplz_banner_background_color: #ffffff;
  --cmplz_banner_border_color: transparent;
  --cmplz_banner_border_width: 0;
  --cmplz_banner_border_radius: 16px;
  --cmplz_banner_width: 480px;
  --cmplz_button_border_radius: 10px;
  --cmplz_button_accept_background_color: var(--leiu-cta-active, #386754);
  --cmplz_button_accept_border_color: var(--leiu-cta-active, #386754);
  --cmplz_button_accept_text_color: #ffffff;
  --cmplz_button_deny_background_color: transparent;
  --cmplz_button_deny_border_color: transparent;
  --cmplz_button_deny_text_color: var(--leiu-global-color-3, #67768e);
  --cmplz_button_settings_background_color: transparent;
  --cmplz_button_settings_border_color: var(--leiu-cta-active, #386754);
  --cmplz_button_settings_text_color: var(--leiu-cta-active, #386754);
  --cmplz_text_color: var(--leiu-global-color-2, #1e293b);
  --cmplz_title_font_size: 17px;
  --cmplz_text_font_size: 13.5px;
  --cmplz_hyperlink_color: var(--leiu-cta-active, #386754);
  --cmplz_slider_active_color: var(--leiu-cta-active, #386754);
  --cmplz_slider_inactive_color: #cbd5e1;
  --cmplz_slider_bullet_color: #ffffff;
  /* Centered modal on every viewport (overrides the position-file
     bottom-right/mobile-sheet placement). */
  top: 50%;
  left: 50%;
  right: auto;
  /* Prevent any inherited placement animation from stretching the centered
     auto-height grid across half the viewport. */
  bottom: auto !important;
  animation: none !important;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 28px 28px 22px;
  box-shadow: 0 24px 64px rgba(10, 20, 16, 0.4);
}

/* The early markup can paint before Lei Consent's deferred client boots. Keep
   its controls inert for that short handoff so a tap cannot race the plugin's
   consent handlers; pointer-events is the fallback for old inert support. */
#lei-consent-banner-container .cmplz-cookiebanner.leiu-cmplz-prerender {
  pointer-events: none;
}

/* The plugin sizes .cmplz-message/.cmplz-categories to
   calc(banner_width - 42px), wider than our 28px-padded content box —
   text clipped at the right edge until pinned to the real width. */
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-message,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-categories,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-body {
  width: 100%;
  min-width: 0;
}

/* The plugin supplies a plain title and empty logo/close slots. Collapse
   the header grid to center the title. */
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-header {
  display: flex;
  justify-content: center;
}

#lei-consent-banner-container .cmplz-cookiebanner .cmplz-logo {
  display: none;
}

#lei-consent-banner-container .cmplz-cookiebanner .cmplz-title {
  font-weight: 700;
  text-align: center;
}

/* No silent dismissal: closing the dialog stores no choice. Force an
   explicit decision instead. */
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-close,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-divider-header {
  display: none !important;
}

#lei-consent-banner-container .cmplz-cookiebanner .cmplz-message {
  text-align: center;
  line-height: 1.55;
}

#lei-consent-banner-container .cmplz-cookiebanner .cmplz-links,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-documents {
  text-align: center;
}

/* Layer-1 button pair: ghost preferences + solid Accept, side by side
   on desktop, stacked (Accept on the bottom, thumb-reach) on mobile.
   The plugin gives every .cmplz-btn height:45px/width:100% and flips
   .cmplz-buttons to flex-direction:column under 768px — pin the whole
   layout here so both breakpoints behave identically. */
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
}

#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn {
  margin: 0;
  height: auto;
  min-height: 48px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
}

#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences {
  order: 1;
  flex: 1 1 44%;
  width: auto;
  border-width: 1.5px;
  border-style: solid;
}

#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept {
  order: 2;
  flex: 1 1 44%;
  width: auto;
  font-weight: 700;
}

/* base.css paints every <button> brand-green on hover — pin each
   button's hover ourselves (see theme-button-hover-green-bleed). */
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept:hover,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept:focus {
  background-color: var(--wp--preset--color--brand-dark, #2c5243) !important;
  border-color: var(--wp--preset--color--brand-dark, #2c5243) !important;
  color: #ffffff !important;
}

#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences:hover,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences:focus,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences:hover,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences:focus {
  background-color: rgba(56, 103, 84, 0.08) !important;
  border-color: var(--wp--preset--color--brand-dark, #2c5243) !important;
  color: var(--wp--preset--color--brand-dark, #2c5243) !important;
}

/* Deny: visible on layer 1 per Tanel's AKI-informed copy round
   (2026-07-04) — a quiet underlined full-width link under the
   settings/accept pair, on both layers. AKI expects refusal to be
   available, so the leiregister-style hidden layer-1 deny is out. */
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-deny {
  display: block;
  order: 3;
  flex: 1 1 100%;
  width: 100%;
  min-height: 44px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-deny:hover,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-deny:focus,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-manage-options:hover,
#lei-consent-banner-container .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-manage-options:focus {
  background-color: transparent !important;
  border-color: transparent !important;
  color: var(--leiu-global-color-2, #1e293b) !important;
}

/* The first-visit banner remains available, but no persistent post-choice tab. */
#cmplz-manage-consent {
  display: none !important;
}
