/* Keep the stock Aperture layout contract while CISS owns the primary navigation row. */
.aperture-theme {
  --ciss-theme-font: Ubuntu, sans-serif;
  --ciss-theme-heading-font: Ubuntu, sans-serif;
  --ciss-theme-header-background: var(--dnn-color-tertiary-light, #3c7a9a);
  --ciss-theme-header-text: var(--dnn-color-tertiary-contrast, #fff);
  --ciss-theme-control-radius: 6px;
}

.aperture-ciss-menu-shell {
  flex: 1 1 auto;
  min-width: 0;
}

.aperture-ciss-utility,
.aperture-ciss-auth {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.aperture-ciss-utility a,
.aperture-ciss-utility span {
  color: var(--dnn-color-tertiary-contrast, #fff);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.aperture-ciss-utility a:hover,
.aperture-ciss-utility a:focus {
  color: var(--dnn-color-primary-light, #1aaee3);
}

.aperture-ciss-header .am {
  position: static;
  width: 100%;
  background: transparent;
  font-family: var(--acme-menu-font-family, inherit);
}

.aperture-ciss-header .am-sticky {
  position: static;
}

.aperture-ciss-header .am-header-inner {
  max-width: none;
  min-height: 64px;
  padding: 0;
  justify-content: flex-end;
}

.aperture-ciss-header .am-header,
.aperture-ciss-header .am-sticky {
  box-shadow: none !important;
}

/* The outer Aperture header is already sticky. Keep CISS' scroll state from
   shrinking or repainting only the menu subtree inside the blue row. */
.aperture-ciss-header .am-sticky.am-scrolled .am-header {
  box-shadow: none !important;
}

.aperture-ciss-header .am-sticky.am-scrolled .am-header-inner {
  min-height: 64px;
}

.aperture-ciss-header .am-brand {
  display: none;
}

.aperture-ciss-header .am .am-header.am-style-modern .am-header-inner,
.aperture-ciss-header .am .am-header.am-style-minimal .am-header-inner,
.aperture-ciss-header .am .am-header.am-style-bold .am-header-inner,
.aperture-ciss-header .am .am-header.am-style-elegant .am-header-inner,
.aperture-ciss-header .am .am-header.am-style-german .am-header-inner,
.aperture-ciss-header .am .am-header.am-style-centered .am-header-inner,
.aperture-ciss-header .am .am-header.am-style-centered.am-scrolled .am-header-inner {
  min-height: 64px;
  height: auto;
  max-width: none;
  padding: 0;
}

/* Elegant and Centered split the navigation around CISS' own central brand.
   Flatten those three grid tracks into the existing Aperture logo/menu row. */
.aperture-ciss-header .am .am-header.am-style-elegant .am-header-inner,
.aperture-ciss-header .am .am-header.am-style-centered .am-header-inner {
  display: flex;
  grid-template-columns: none;
  justify-content: flex-end;
  gap: 0;
}

.aperture-ciss-header .am .am-header.am-style-elegant .am-nav-left,
.aperture-ciss-header .am .am-header.am-style-centered .am-nav-left,
.aperture-ciss-header .am .am-header.am-style-elegant .am-nav-right,
.aperture-ciss-header .am .am-header.am-style-centered .am-nav-right {
  flex: 0 1 auto;
  width: auto;
  max-width: none;
  padding: 0;
  overflow: visible;
}

.aperture-ciss-header .am .am-header.am-style-elegant .am-bar-right,
.aperture-ciss-header .am .am-header.am-style-centered .am-bar-right {
  display: flex;
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  padding: 0;
  gap: 0;
  overflow: visible;
  margin-left: 0.75rem;
}

.aperture-ciss-header .am .am-header.am-style-elegant .am-nav,
.aperture-ciss-header .am .am-header.am-style-centered .am-nav {
  gap: 0.75rem;
}

/* Bold remains visually distinct, but its dark surface belongs to the nav
   itself instead of becoming a second full-width header inside Aperture. */
.aperture-ciss-header .am .am-header.am-style-bold .am-nav {
  align-self: center;
  min-height: 64px;
  padding: 0 0.35rem;
  background: #0f0a09;
}

/* Aperture colors every header link white. Resolve colors from the runtime
   header class because the persisted body preset can briefly be stale. */
.aperture-ciss-header .am-header.am-style-modern .am-nav-link {
  color: #5f6368;
}

.aperture-ciss-header .am-header.am-style-modern .am-nav-link:hover,
.aperture-ciss-header .am-header.am-style-modern .am-nav-item.am-expanded > .am-nav-link {
  color: #111111;
}

.aperture-ciss-header .am-header.am-style-minimal .am-nav-link {
  color: rgba(15, 10, 9, 0.55);
}

.aperture-ciss-header .am-header.am-style-bold .am-nav-link {
  color: rgba(255, 255, 255, 0.7);
}

.aperture-ciss-header .am-header.am-style-elegant .am-nav-link {
  color: #5f5a54;
}

.aperture-ciss-header .am-header.am-style-german .am-nav-link,
.aperture-ciss-header .am-header.am-style-centered .am-nav-link {
  color: rgba(15, 10, 9, 0.7);
}

/* The standalone Elegant demo includes promotional copy in pseudo-elements.
   That text belongs to ACME sample content, not to a portable skin object. */
.aperture-ciss-header .am-header.am-style-elegant {
  min-height: 0;
}

.aperture-ciss-header .am-header.am-style-elegant::before,
.aperture-ciss-header .am-header.am-style-elegant::after {
  content: none;
  display: none;
}

.aperture-ciss-header .am-header.am-style-elegant .am-header-inner {
  top: 0;
}

/* positionMega() already computes the width that fits beside Aperture's logo
   and utility controls. The card must honor that computed panel width. */
.aperture-ciss-header .am-panels > .am-mega .am-mega-card {
  width: 100%;
  max-width: 100%;
}

.aperture-ciss-header .am-mega-card,
.aperture-ciss-header .am-mega-card * {
  min-width: 0;
}

/* Classic is the "use the host theme" choice in ApertureCiss. The CISS
   header must remain transparent so Aperture's blue logo/menu row is the
   actual surface; otherwise the inherited white navigation text disappears
   against AcmeMega's default white card background. */
.acme-mb-acme-original .aperture-ciss-header .am-header:not([class*="am-style-"]),
.acme-mb-acme-original .aperture-ciss-header .am-header.am-style-original {
  background: transparent;
  border-color: transparent;
}

.acme-mb-acme-original .aperture-ciss-header .am-header:not([class*="am-style-"]) .am-nav-link,
.acme-mb-acme-original .aperture-ciss-header .am-header:not([class*="am-style-"]) .am-nav-link:hover,
.acme-mb-acme-original .aperture-ciss-header .am-header:not([class*="am-style-"]) .am-nav-item.am-expanded > .am-nav-link,
.acme-mb-acme-original .aperture-ciss-header .am-header.am-style-original .am-nav-link,
.acme-mb-acme-original .aperture-ciss-header .am-header.am-style-original .am-nav-link:hover,
.acme-mb-acme-original .aperture-ciss-header .am-header.am-style-original .am-nav-item.am-expanded > .am-nav-link {
  color: var(--dnn-color-tertiary-contrast, #fff);
}

.acme-mb-acme-original .aperture-ciss-header .am-header:not([class*="am-style-"]) .am-search-inner,
.acme-mb-acme-original .aperture-ciss-header .am-header.am-style-original .am-search-inner {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 3px 10px rgba(18, 54, 72, 0.18);
}

.acme-mb-acme-original .aperture-ciss-header .am-header:not([class*="am-style-"]) .am-search-input,
.acme-mb-acme-original .aperture-ciss-header .am-header:not([class*="am-style-"]) .am-search-submit,
.acme-mb-acme-original .aperture-ciss-header .am-header.am-style-original .am-search-input,
.acme-mb-acme-original .aperture-ciss-header .am-header.am-style-original .am-search-submit {
  color: var(--dnn-color-tertiary-contrast, #fff);
}

.acme-mb-acme-original .aperture-ciss-header .am-header:not([class*="am-style-"]) .am-search-input::placeholder,
.acme-mb-acme-original .aperture-ciss-header .am-header.am-style-original .am-search-input::placeholder {
  color: rgba(255, 255, 255, 0.82);
}

.aperture-ciss-header .am-search {
  margin-left: auto;
}

/* Aperture's global `header a` rule paints links white. Simple drawer links
   have no stronger color of their own, so they disappeared on the white
   mobile drawer while button-based items remained visible. */
.aperture-ciss-header .am-drawer-link {
  color: var(--am-fg, #0f0a09);
}

.aperture-ciss-header .am-drawer-link:hover,
.aperture-ciss-header .am-drawer-link:focus {
  color: var(--am-primary, #ef4444);
}

.aperture-ciss-ai-content,
.aperture-ciss-edit-menu {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid currentColor;
  border-radius: 4px;
  color: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
}

.aperture-ciss-ai-content:hover,
.aperture-ciss-ai-content:focus,
.aperture-ciss-edit-menu:hover,
.aperture-ciss-edit-menu:focus {
  color: #fff;
  background: var(--dnn-color-primary-dark, #008cc0);
  text-decoration: none;
}

@media (max-width: 1023px) {
  .aperture-ciss-header .logo-menu-bar > .aperture-container {
    flex-wrap: wrap;
  }

  .aperture-ciss-menu-shell { min-width: 44px; }

  .aperture-ciss-header .am-drawer {
    left: var(--am-admin-left, 0px);
    width: calc(100% - var(--am-admin-left, 0px));
  }

  .aperture-ciss-utility {
    flex-wrap: wrap;
    margin-left: auto;
  }

  .aperture-ciss-header .am-header-inner {
    height: 64px;
    padding: 0;
  }

  .aperture-ciss-header .am-sticky.am-scrolled .am-header-inner {
    height: 64px;
  }

  .aperture-ciss-header .am-mobile-toggle {
    display: inline-flex;
    flex: 0 0 36px;
    width: 36px;
    min-width: 36px;
    color: var(--dnn-color-tertiary-contrast, #fff);
  }

  .aperture-ciss-header .am-header.am-style-modern .am-mobile-toggle,
  .aperture-ciss-header .am-header.am-style-minimal .am-mobile-toggle,
  .aperture-ciss-header .am-header.am-style-elegant .am-mobile-toggle,
  .aperture-ciss-header .am-header.am-style-german .am-mobile-toggle,
  .aperture-ciss-header .am-header.am-style-centered .am-mobile-toggle {
    color: var(--am-fg, #0f0a09);
  }

  .aperture-ciss-header .am-header.am-style-bold .am-mobile-toggle {
    color: #fff;
  }

  .aperture-ciss-header .am-search {
    display: none;
  }

  .aperture-ciss-auth {
    display: none;
  }

  .aperture-ciss-ai-content,
  .aperture-ciss-edit-menu {
    padding: 0 9px;
  }
}

@media (max-width: 720px) {
  .aperture-ciss-utility { padding-bottom: 8px; }
  .aperture-ciss-ai-content span {
    display: none;
  }

  .aperture-ciss-ai-content {
    justify-content: center;
    width: 30px;
    padding: 0;
  }
}
