/*
 * Ultimate Wins Carbon - Astra teardown, nav dropdowns and wide-screen
 * rules (1.0.2).
 *
 * Loaded after the child stylesheet. Four jobs, in order:
 *
 * 1. The Astra 4 footer shell is removed from layout entirely. The child's
 *    own visible colophon is footer.ult-colophon inside the page fragments,
 *    so the theme footer can only ever paint a light stripe at the bottom
 *    of a dark page. The whole builder tree is display:none, and any
 *    surviving shell is forced dark with zero box so a stripe is
 *    impossible even if the parent markup changes under us.
 *
 * 2. Astra's own page header (entry-header) prints the post title as a
 *    second, flat H1 above the fragment's money-led H1. It is removed:
 *    the fragment hero is the page's one and only H1.
 *
 * 3. Header navigation: the plugin's nav.php prints has-sub on hub items
 *    with children, aria-haspopup on the parent anchor and a ul.ultw-sub
 *    dropdown of up to twelve plain titles. These rules open the panel on
 *    hover and keyboard focus, mark the parent with a caret, keep the
 *    compact top labels on one row inside the 1240px measure, and turn the
 *    row into a horizontal scroll strip with fixed-width panels under
 *    1240px so nothing is clipped by the screen edge.
 *
 * 4. Wide screens: from 1600px the gutter widens to 48px so the brand and
 *    every flow block sit comfortably off the screen edges.
 */

/* 1) Remove the whole Astra 4 footer tree from layout. */
#colophon,
.site-footer,
.ast-builder-footer-row-container,
.site-above-footer-wrap,
.site-primary-footer-wrap,
.site-below-footer-wrap,
.ast-builder-grid-row,
.ast-builder-grid-row-container,
.ast-builder-grid-row-container-inner,
.site-footer-section,
.site-footer-primary-section,
#colophon .widget-area,
.site-footer .widget-area,
.site-footer .site-footer-focus-item,
.site-footer .ast-builder-layout-element,
.site-footer .ast-footer-overlay,
.ast-hb-footer,
.ast-small-footer,
.ast-footer-widget-area,
.footer-widget-area,
.footer-adv,
.footer-adv-overlay,
.ast-footer-copyright,
.ast-footer-html,
.ast-footer-html-2,
.ast-footer-menu,
.ast-footer-social {
  display: none !important;
}

/* Belt and braces: any surviving footer shell can never paint light. */
#colophon,
.site-footer,
.site-footer *,
.ast-builder-footer-row-container,
.ast-builder-footer-row-container * {
  background: #14171c !important;
  background-color: #14171c !important;
  color: #9aa3b2 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* The very bottom of the document is the theme background, whatever prints. */
html,
html body,
body,
body.ultw-dark {
  background: #14171c !important;
  background-color: #14171c !important;
}

/* Page wrappers stay see-through so the dark canvas shows everywhere. */
#page,
.site,
#content,
.site-content,
#main,
.site-main {
  background: transparent !important;
  background-color: transparent !important;
}

/* 2) Astra's flat page-title header goes: the fragment hero is the one H1. */
.page .entry-header,
.ast-separate-container .entry-header,
.entry-header .ast-single-title,
.entry-header .entry-title {
  display: none !important;
}

/* 3) Header navigation: dropdowns, caret, compact top level. */

/* The parent anchor never wraps; the caret rides after the label. */
.ultw-item.has-sub > a {
  position: relative;
  padding-right: 26px;
  white-space: nowrap;
}

.ultw-item.has-sub > a::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 140ms ease;
  pointer-events: none;
}

.ultw-item.has-sub:hover > a::after,
.ultw-item.has-sub:focus-within > a::after {
  transform: rotate(225deg);
}

/* Dropdown panel: absolute under the parent, opens on hover and focus. */
.ultw-sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 60;
  background: var(--ultw-panel);
  border: 1px solid var(--ultw-line);
  border-radius: var(--ultw-radius);
  padding: 6px;
  margin: 0;
  list-style: none;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.ultw-item.has-sub {
  position: relative;
}

.ultw-item.has-sub:hover > .ultw-sub,
.ultw-item.has-sub:focus-within > .ultw-sub {
  display: block;
}

/* The right-most panel opens leftwards so it can never leave the screen. */
.ultw-item.has-sub:last-child > .ultw-sub {
  left: auto;
  right: 0;
}

.ultw-sub a,
.ultw-sub a:visited {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--ultw-ink);
  font-size: 14px;
  white-space: normal;
}

.ultw-sub a:hover,
.ultw-sub a:focus-visible {
  background: var(--ultw-panel-2);
  color: var(--ultw-amber);
}

/* Compact top row: short labels ride beside the brand within one measure. */
.ultw-nav { margin-left: auto; }

.ultw-nav .ultw-menu {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

.ultw-item a,
.ultw-item a:visited {
  padding: 12px 11px;
  font-size: 14.5px;
}

/* Narrow desktop (below 1240px): the row scrolls horizontally and each
   dropdown becomes a fixed panel across the measure, so no item and no
   panel is ever clipped by the viewport edge. */
@media (max-width: 1239.98px) {
  .ultw-head .ultw-wrap { overflow: hidden; }

  .ultw-nav { min-width: 0; overflow-x: auto; overflow-y: visible; }

  .ultw-nav .ultw-menu {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .ultw-nav .ultw-menu::-webkit-scrollbar { display: none; }

  .ultw-sub {
    position: fixed;
    top: var(--ultw-head-h);
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: min(520px, calc(100vw - 32px));
    min-width: 0;
  }

  .admin-bar .ultw-sub { top: calc(var(--ultw-head-h) + 32px); }
}

/* Mobile admin bar is taller. */
@media (max-width: 782px) {
  .admin-bar .ultw-sub { top: calc(var(--ultw-head-h) + 46px); }
}

/* 4) Wide screens: a real gutter instead of 20px at the glass edge. */
@media (min-width: 1600px) {
  .ultw-wrap,
  .entry-content,
  .page-content {
    padding-inline: 48px;
  }
}