/* CORVASEC FIX66.75.194 — universal public breadcrumb rhythm.
   Fixes the original header-to-breadcrumb gap on nested pages as well as the
   directory landings. Avoids resizing content, menus, or the site header.
   Only applies when the first page wrapper contains a first-position breadcrumb.
   Works in CORVA and CORVASEC Hybrid, including smaller screens. */

/* Detect a breadcrumb at the START of the page, not navigation further down. */
@supports selector(:has(> *)) {
  /* Eliminate stacked main + page-wrapper padding (the source of the gap). */
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main):has(> :first-child > :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])),
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main):has(> :first-child > :first-child > :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])),
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main):has(> :first-child > :first-child > :first-child > :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])) {
    padding-top: 0 !important;
  }

  /* A top-level wrapper is never allowed to introduce a second top inset. */
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) > :first-child:has(> :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])),
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) > :first-child:has(> :first-child > :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])),
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) > :first-child:has(> :first-child > :first-child > :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])) {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* Put one controlled gap before the breadcrumb, at its immediate wrapper. */
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) > :first-child:has(> :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])) ,
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) > :first-child > :first-child:has(> :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])),
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) > :first-child > :first-child > :first-child:has(> :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])) {
    padding-top: 10px !important;
    margin-top: 0 !important;
  }

  /* Consistent breadcrumb-to-content gap. This selector addresses only a
     breadcrumb which is the first element of its own container. */
  :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"]):first-child {
    margin-top: 0 !important;
    margin-bottom: 9px !important;
  }

  /* Fallback theme has no #corva-main; it outputs content directly below its
     site header in .bc-page-shell. Keep this separate from account/admin. */
  body.bc-frontend-body .bc-page-shell > :has(> :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])),
  body.bc-frontend-body .bc-page-shell > :has(> :first-child > :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])) {
    padding-top: 10px !important;
    margin-top: 0 !important;
  }
}

/* Site-specific compatibility for modern pages which may insert another
   invisible node before the breadcrumb, or have a heavily-styled outer shell.
   Restrict this to the directory/detail families originally reported. */
body.corva-theme.cv-resource-detail-page #corva-main,
body.corva-theme.cv-doc-detail-page #corva-main,
body.corva-theme.cv-ref-detail-page #corva-main,
body.corva-theme.cv-resources-hub185 #corva-main,
body.corva-theme.cv-resource-suggest-page #corva-main {
  padding-top: 0 !important;
}
body.corva-theme.cv-resource-detail-page #corva-main > .cv-tools-v2 > .cv-tools-v2__inner,
body.corva-theme.cv-doc-detail-page #corva-main > .cv-doc,
body.corva-theme.cv-ref-detail-page #corva-main > .cv6623-ref,
body.corva-theme.cv-resources-hub185 #corva-main > .cvhub185,
body.corva-theme.cv-resource-suggest-page #corva-main > .cv-resource-suggest,
body.corva-theme.cv-resources-page #corva-main > .cv-tools-v2 > .cv-tools-v2__inner,
body.corvasec-hybrid.cv-resource-detail-page #cv29-main > .cv-tools-v2 > .cv-tools-v2__inner,
body.corvasec-hybrid.cv-doc-detail-page #cv29-main > .cv-doc,
body.corvasec-hybrid.cv-ref-detail-page #cv29-main > .cv6623-ref {
  padding-top: 10px !important;
}

@media (max-width: 680px) {
  @supports selector(:has(> *)) {
    :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) > :first-child:has(> :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])),
    :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) > :first-child > :first-child:has(> :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])),
    :is(body.corva-theme #corva-main, body.corvasec-hybrid #cv29-main) > :first-child > :first-child > :first-child:has(> :is(nav[aria-label="Breadcrumb"], nav[class*="crumb"])) {
      padding-top: 8px !important;
    }
  }
  body.corva-theme.cv-resource-detail-page #corva-main > .cv-tools-v2 > .cv-tools-v2__inner,
  body.corva-theme.cv-doc-detail-page #corva-main > .cv-doc,
  body.corva-theme.cv-ref-detail-page #corva-main > .cv6623-ref,
  body.corva-theme.cv-resources-page #corva-main > .cv-tools-v2 > .cv-tools-v2__inner,
  body.corvasec-hybrid.cv-resource-detail-page #cv29-main > .cv-tools-v2 > .cv-tools-v2__inner,
  body.corvasec-hybrid.cv-doc-detail-page #cv29-main > .cv-doc,
  body.corvasec-hybrid.cv-ref-detail-page #cv29-main > .cv6623-ref {
    padding-top: 8px !important;
  }
}
