/*
 * CINEMATICS BY SAIKIRAN — COMPACT HEADER v1.3
 * ONE native Kadence header row (desktop only, 1025px+).
 * Visual order: OUR WORK | BUILD YOUR QUOTE | ORIGINAL LOGO | ABOUT | LOGIN
 * Uses Kadence's existing logo and WordPress Primary Navigation.
 * No second header, no logo recolor, no extra WordPress nav.
 * The custom layout requires the CBS 4-link menu (section 6 in CBS Website).
 */
@media screen and (min-width: 1025px) {
  /* Restore ONE horizontal row; v1.2 incorrectly stacked the sections. */
  body.cbs-wm-centered-logo #masthead #main-header .site-main-header-inner-wrap {
    position: relative !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
  }

  /* The section holding Kadence's original logo is the center anchor. */
  body.cbs-wm-centered-logo #masthead #main-header :is(
    .site-header-main-section-left,
    .site-header-main-section-center,
    .site-header-main-section-right
  ):has(.site-branding) {
    position: relative !important;
    z-index: 3 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 30% !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 !important;
  }
  body.cbs-wm-centered-logo #masthead #main-header .site-branding,
  body.cbs-wm-centered-logo #masthead #main-header .site-branding a.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto !important;
    text-align: center;
  }
  body.cbs-wm-centered-logo #masthead #main-header .site-branding img {
    display: block;
    object-fit: contain;
    width: auto;
    max-width: min(29vw, 310px) !important;
    max-height: 66px !important;
    height: auto;
  }

  /* Allow the original four menu links to occupy both sides of the logo,
     without changing its WordPress links or creating another header. */
  body.cbs-wm-centered-logo #masthead #main-header :is(
    .site-header-main-section-left,
    .site-header-main-section-center,
    .site-header-main-section-right
  ):has(.main-navigation):not(:has(.site-branding)) {
    position: absolute !important;
    z-index: 2 !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none;
  }
  body.cbs-wm-centered-logo #masthead #main-header .main-navigation,
  body.cbs-wm-centered-logo #masthead #main-header .primary-menu-container {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
  }

  /* GRID leaves an empty middle track for the REAL logo.
     Applied only to exactly four top-level links so other menus are not distorted. */
  body.cbs-wm-centered-logo #masthead #main-header
    .main-navigation .primary-menu-container > ul:has(> li:nth-child(4):last-child) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) max-content minmax(250px, 31vw) max-content minmax(0, 1fr) !important;
    align-items: center !important;
    justify-content: stretch !important;
    column-gap: clamp(8px, 1.3vw, 20px) !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    pointer-events: none;
  }
  body.cbs-wm-centered-logo #masthead #main-header
    .main-navigation .primary-menu-container > ul:has(> li:nth-child(4):last-child) > li {
    display: block !important;
    width: max-content !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;
    pointer-events: auto !important;
  }
  body.cbs-wm-centered-logo #masthead #main-header
    .main-navigation .primary-menu-container > ul:has(> li:nth-child(4):last-child) > li:nth-child(1) {
    grid-column: 1 !important;
    justify-self: end;
  }
  body.cbs-wm-centered-logo #masthead #main-header
    .main-navigation .primary-menu-container > ul:has(> li:nth-child(4):last-child) > li:nth-child(2) {
    grid-column: 2 !important;
    justify-self: end;
  }
  body.cbs-wm-centered-logo #masthead #main-header
    .main-navigation .primary-menu-container > ul:has(> li:nth-child(4):last-child) > li:nth-child(3) {
    grid-column: 4 !important;
    justify-self: start;
  }
  body.cbs-wm-centered-logo #masthead #main-header
    .main-navigation .primary-menu-container > ul:has(> li:nth-child(4):last-child) > li:nth-child(4) {
    grid-column: 5 !important;
    justify-self: start;
  }
  body.cbs-wm-centered-logo #masthead #main-header
    .main-navigation .primary-menu-container > ul:has(> li:nth-child(4):last-child) > li > a {
    padding: 8px 3px !important;
    font-size: clamp(11px, 1vw, 13px) !important;
    line-height: 1.35 !important;
    letter-spacing: .055em;
    white-space: nowrap;
  }

  /* Do not let empty Kadence header sections add unwanted height or spacing. */
  body.cbs-wm-centered-logo #masthead #main-header .site-header-main-section-center:empty {
    display: none !important;
  }
}

/* On tablet/mobile Kadence controls its normal header and hamburger menu. */
