/* ============================================================
   Theme glue — WordPress-specific patches layered on top of the
   verbatim V8 design (v8.css). Enqueued LAST so it wins on
   equal-specificity overrides. Keep this small; do not edit v8.css.
   ============================================================ */

/* ── Mobile nav: the V8 homepage hid .nav-menu at ≤980px with no drawer.
   We add a working dropdown toggled by .nav-toggle (see header.php/main.js). ── */
@media (max-width: 980px) {
  /* The nav's backdrop-filter makes any position:fixed descendant anchor to the
     72px nav box instead of the viewport — that capped the old dropdown menu. Drop
     the blur on mobile (the 0.95 bg is already near-opaque) so it can go full-screen. */
  .nav { backdrop-filter: none; -webkit-backdrop-filter: none; }

  /* Mobile menu = full-screen overlay below the 72px header: SOLID bg (no
     bleed-through of the page beneath), scrolls internally only if it overflows. */
  .nav-menu.is-open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px var(--pad-x, 40px) calc(28px + env(safe-area-inset-bottom, 0px));
    background: var(--g900, #111827);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 49;
  }
  [data-theme="light"] .nav-menu.is-open { background: #fff; }
  .nav-menu.is-open li { width: 100%; }
  .nav-menu.is-open a {
    display: block;
    padding: 18px 2px;
    font-size: 19px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }
  [data-theme="light"] .nav-menu.is-open a { border-bottom-color: var(--g100, #f1f5f9); }
  /* Admin bar shifts the nav down (.admin-bar .nav{top:32px}) → overlay starts lower. */
  .admin-bar .nav-menu.is-open { top: 104px; }
  /* Lock the page behind the open overlay (main.js toggles body.nav-open). */
  body.nav-open { overflow: hidden; }

  /* Burger bars: v8.css only toggles .nav-toggle's *display* (none ⇄ inline-flex)
     and never styles the three <span>s, so the button rendered invisible — no
     way to open the menu on mobile. Style the bars (theme-aware) + morph to an X
     on open, driven by the aria-expanded toggle main.js already sets. */
  .nav-toggle {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
  }
  .nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: var(--g200, #e5e7eb);   /* dark header → light bars */
    transition: transform .25s var(--ease), opacity .2s var(--ease);
  }
  [data-theme="light"] .nav-toggle span { background: var(--g700, #374151); }  /* light header → dark bars */
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ── WP admin bar offset for the sticky nav ── */
.admin-bar .nav { top: 32px; }
@media (max-width: 782px) {
  .admin-bar .nav { top: 46px; }
  .admin-bar .nav-menu.is-open { top: 118px; }  /* 46px admin bar + 72px nav */
}

/* ── WP admin bar offset for the contact-modal scrim ──
   The overlay is position:fixed; inset:0. Logged in, it must start below the
   32px admin bar (mirrors .nav above). Without it WebKit — where the admin
   bar's html{margin-top} shifts fixed elements — slipped the scrim and left a
   strip leaking at the bottom. Logged-out visitors have no .admin-bar class,
   so the scrim stays full-viewport. */
.admin-bar .modal-overlay { top: 32px; }
@media (max-width: 782px) {
  .admin-bar .modal-overlay { top: 46px; }
}

/* ── Gutenberg alignment helpers inside theme sections (parity-safe) ── */
.si-section .alignwide { max-width: var(--container-wide, 1440px); }
.si-section .alignfull { max-width: none; }

/* ── ACF InnerBlocks: on the frontend ACF wraps inner blocks in a
   .acf-innerblocks-container <div>, which becomes the SOLE grid child and
   collapses the layout to one column. display:contents dissolves that wrapper
   so the card primitives become direct grid items of the V8 grid. ── */
.services-grid > .acf-innerblocks-container,
.adv-grid > .acf-innerblocks-container,
.stats-grid > .acf-innerblocks-container,
.logo-wall > .acf-innerblocks-container,
.si-section__inner > .acf-innerblocks-container {
  display: contents;
}

/* ── Progressive enhancement: scroll-reveal only hides content when JS can
   bring it back. Without JS (or before the observer runs), content stays
   visible — fixes the V8 no-JS / crawler blank-content flaw. ── */
html:not(.js) .reveal,
html:not(.js) .reveal-stagger > * {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

/* ── Contact Form 7 → V8 form. The CF7 form template reuses the V8
   .form-grid/.field markup, so fields inherit V8 styling; these rules only
   cover CF7's own wrappers, validation tips, and AJAX response output. ── */
.field .wpcf7-form-control-wrap { display: block; }
.field .wpcf7-form-control-wrap > input,
.field .wpcf7-form-control-wrap > select,
.field .wpcf7-form-control-wrap > textarea { width: 100%; }
.field .wpcf7-not-valid { border-color: #e5484d; }
.wpcf7-not-valid-tip {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.3;
  color: #e5484d;
}
.wpcf7 form .wpcf7-response-output {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-width: 1px;
  border-radius: 10px;
  font-size: 14px;
}
.wpcf7-spinner { margin-inline-start: 8px; }
/* Success is shown via #successView (main.js / wpcf7mailsent); hide CF7's own
   green banner so it doesn't double up inside the modal. */
.modal .wpcf7 form.sent .wpcf7-response-output { display: none; }

/* ── Skip-to-content link (WCAG 2.4.1). Visually hidden until focused, then
   revealed top-left so keyboard users can bypass the nav. No .screen-reader-text
   was defined anywhere in the theme, so it lives here (enqueued on every page). ── */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100000;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  white-space: normal;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--blue, #2563eb);
  color: #fff;
  font: 600 15px/1.2 var(--font-sans, Inter, system-ui, sans-serif);
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* ── Cookie consent banner (Complianz) → V8 brand look ──
   Complianz ships a generic banner; restyle it to the site brand without
   touching the plugin. The #cmplz-cookiebanner-container scope + !important
   beat the plugin's own CSS. theme-glue loads after v8.css, so --blue/--g*
   tokens resolve (hex fallbacks kept for safety). ── */
#cmplz-cookiebanner-container .cmplz-cookiebanner {
  font-family: inherit !important;
  background: #fff !important;
  color: var(--g600, #4B5563) !important;
  border: 1px solid var(--g200, #E5E7EB) !important;
  border-radius: 16px !important;            /* corner box (position: bottom-right) — round all corners */
  box-shadow: 0 16px 48px -12px rgba(17, 24, 39, .25) !important;
  padding: 22px 24px !important;
}
#cmplz-cookiebanner-container .cmplz-title {
  font-family: inherit !important;
  font-weight: 700 !important;
  color: var(--g900, #111827) !important;
}
#cmplz-cookiebanner-container .cmplz-message,
#cmplz-cookiebanner-container .cmplz-body {
  color: var(--g600, #4B5563) !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}
#cmplz-cookiebanner-container .cmplz-links a,
#cmplz-cookiebanner-container .cmplz-documents a {
  color: var(--blue, #1E3A8A) !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}
#cmplz-cookiebanner-container .cmplz-links a:hover { text-decoration: underline !important; }

/* Buttons mirror .btn-primary (accept) and a light ghost (deny / preferences). */
#cmplz-cookiebanner-container .cmplz-btn {
  font-family: inherit !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  border-radius: 10px !important;
  padding: 11px 22px !important;
  box-shadow: none !important;
  transition: background .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .2s var(--ease) !important;
}
#cmplz-cookiebanner-container .cmplz-btn.cmplz-accept {
  background: var(--blue, #1E3A8A) !important;
  color: #fff !important;
  border: 1px solid var(--blue, #1E3A8A) !important;
}
#cmplz-cookiebanner-container .cmplz-btn.cmplz-accept:hover {
  background: var(--blue-2, #2A4DBF) !important;
  border-color: var(--blue-2, #2A4DBF) !important;
  transform: translateY(-1px) !important;
}
#cmplz-cookiebanner-container .cmplz-btn.cmplz-deny,
#cmplz-cookiebanner-container .cmplz-btn.cmplz-view-preferences,
#cmplz-cookiebanner-container .cmplz-btn.cmplz-save-preferences {
  background: var(--g100, #F1F5F9) !important;   /* subtle fill so secondary buttons read as buttons */
  color: var(--g700, #374151) !important;
  border: 1px solid var(--g200, #E5E7EB) !important;
}
#cmplz-cookiebanner-container .cmplz-btn.cmplz-deny:hover,
#cmplz-cookiebanner-container .cmplz-btn.cmplz-view-preferences:hover,
#cmplz-cookiebanner-container .cmplz-btn.cmplz-save-preferences:hover {
  border-color: var(--blue, #1E3A8A) !important;
  color: var(--blue, #1E3A8A) !important;
}

/* Preferences view: category titles + active toggle in brand blue. */
#cmplz-cookiebanner-container .cmplz-category-title { color: var(--g900, #111827) !important; font-weight: 600 !important; }
#cmplz-cookiebanner-container .cmplz-banner-checkbox input:checked + .cmplz-label { background: var(--blue, #1E3A8A) !important; }
