/* ==========================================================================
   CB NOVA TECH — LAYOUT CHROME
   Announcement bar, sticky header, desktop nav + mega menu, mobile drawer,
   footer, mobile CTA bar.
   ========================================================================== */

/* ==========================================================================
   1. ANNOUNCEMENT BAR
   ========================================================================== */

.cb-announce {
  position: relative;
  z-index: var(--cb-z-announce);
  background: var(--cb-navy-900);
  color: var(--cb-on-dark);
  font-size: var(--cb-fs-xs);
}
.cb-announce__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--cb-sp-4);
  min-height: var(--cb-announce-h);
  padding-block: var(--cb-sp-2);
  text-align: center;
}
.cb-announce__text { display: inline-flex; align-items: center; gap: var(--cb-sp-2); }
.cb-announce__icon { width: 14px; height: 14px; color: var(--cb-cyan-400); flex: none; }
.cb-announce__link {
  color: var(--cb-cyan-300);
  font-weight: var(--cb-fw-semibold);
  text-decoration: none;
  border-bottom: 1px solid rgba(111,220,255,0.4);
  white-space: nowrap;
}
.cb-announce__link:hover { color: #fff; border-bottom-color: #fff; }
.cb-announce__close {
  position: absolute; right: var(--cb-gutter); top: 50%;
  transform: translateY(-50%);
  /* The visible chip stays small so it doesn't dominate a 40px bar, but the
     hit area is expanded to 44px via the ::before below. */
  width: 28px; height: 28px;
  display: grid; place-items: center;
  color: var(--cb-on-dark-muted);
  border-radius: var(--cb-r-sm);
}
.cb-announce__close::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: var(--cb-tap);
  height: var(--cb-tap);
}
.cb-announce__close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.cb-announce__close svg { width: 14px; height: 14px; }

/* On very small screens the secondary link would wrap awkwardly — hide it
   and let the whole bar be the message. */
@media (max-width: 599px) {
  .cb-announce__link { display: none; }
  .cb-announce__close { right: var(--cb-sp-3); }
  .cb-announce__inner { padding-inline: var(--cb-sp-8); }
}

/* ==========================================================================
   2. HEADER
   ========================================================================== */

.cb-header {
  position: sticky;
  top: 0;
  z-index: var(--cb-z-header);
  background: rgba(255,255,255,0.86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition:
    background-color var(--cb-dur-base) var(--cb-ease),
    border-color var(--cb-dur-base) var(--cb-ease),
    box-shadow var(--cb-dur-base) var(--cb-ease);
}
/* Browsers without backdrop-filter get an opaque bar rather than a
   half-legible translucent one. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cb-header { background: #fff; }
}

.cb-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--cb-sp-5);
  height: var(--cb-header-h);
  transition: height var(--cb-dur-base) var(--cb-ease);
}

/* Scrolled state — solid, shadowed, slightly shorter. */
.cb-header.is-scrolled {
  background: rgba(255,255,255,0.97);
  border-bottom-color: var(--cb-border);
  box-shadow: 0 1px 3px rgba(10,27,51,0.05), 0 8px 26px rgba(10,27,51,0.07);
}
.cb-header.is-scrolled .cb-header__inner { height: var(--cb-header-h-scroll); }

/* Transparent overlay variant — used where a dark hero sits directly below.
   Reverts to the solid style the moment the user scrolls. */
.cb-header--overlay {
  position: fixed;
  left: 0; right: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.cb-header--overlay:not(.is-scrolled) .cb-logo__name { color: #fff; }
.cb-header--overlay:not(.is-scrolled) .cb-logo__tag { color: var(--cb-cyan-300); }
.cb-header--overlay:not(.is-scrolled) .cb-nav__link { color: rgba(255,255,255,0.88); }
.cb-header--overlay:not(.is-scrolled) .cb-nav__link:hover { color: #fff; }
.cb-header--overlay:not(.is-scrolled) .cb-burger { color: #fff; }
.cb-header--overlay:not(.is-scrolled) .cb-header__cta {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.34);
  color: #fff;
  box-shadow: none;
}
.cb-header--overlay:not(.is-scrolled) .cb-header__cta:hover {
  background: #fff; color: var(--cb-navy-800); border-color: #fff;
}
/* Offset the body so fixed-overlay headers don't cover the hero top. */
body.cb-has-overlay-header { --cb-header-offset: 0px; }

/* ==========================================================================
   3. DESKTOP NAVIGATION
   ========================================================================== */

.cb-nav { display: none; }

@media (min-width: 1080px) {
  .cb-nav { display: block; margin-inline: auto; }
  .cb-nav__list { display: flex; align-items: center; gap: var(--cb-sp-2); }
  .cb-nav__item { position: relative; }

  .cb-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.6rem 0.85rem;
    font-size: var(--cb-fs-sm);
    font-weight: var(--cb-fw-medium);
    color: var(--cb-ink);
    text-decoration: none;
    border-radius: var(--cb-r-sm);
    white-space: nowrap;
    transition: color var(--cb-dur-fast) var(--cb-ease),
                background-color var(--cb-dur-fast) var(--cb-ease);
  }
  .cb-nav__link:hover { color: var(--cb-blue-600); background: rgba(11,95,208,0.05); }

  /* Current page — marked with weight AND an underline, not colour alone. */
  .cb-nav__item.current-menu-item > .cb-nav__link,
  .cb-nav__item.current-menu-ancestor > .cb-nav__link,
  .cb-nav__item.current-menu-parent > .cb-nav__link {
    color: var(--cb-blue-600);
    font-weight: var(--cb-fw-semibold);
  }
  .cb-nav__item.current-menu-item > .cb-nav__link::after,
  .cb-nav__item.current-menu-ancestor > .cb-nav__link::after {
    content: "";
    position: absolute;
    left: 0.85rem; right: 0.85rem; bottom: -2px;
    height: 2px;
    background: var(--cb-grad-brand);
    border-radius: 2px;
  }

  .cb-nav__caret {
    width: 11px; height: 11px;
    opacity: 0.55;
    transition: transform var(--cb-dur-base) var(--cb-ease);
  }
  .cb-nav__item:hover > .cb-nav__link .cb-nav__caret,
  .cb-nav__item:focus-within > .cb-nav__link .cb-nav__caret { transform: rotate(180deg); }

  /* ---- Dropdown / mega panel ---- */
  .cb-nav__sub {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    min-width: 280px;
    padding: var(--cb-sp-3);
    background: #fff;
    border: 1px solid var(--cb-border);
    border-radius: var(--cb-r-lg);
    box-shadow: var(--cb-shadow-xl);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity var(--cb-dur-base) var(--cb-ease),
      transform var(--cb-dur-base) var(--cb-ease-out),
      visibility var(--cb-dur-base);
  }
  /* Invisible bridge so the pointer can travel from link to panel without
     passing over a gap that would close the menu. */
  .cb-nav__sub::before {
    content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px;
  }
  .cb-nav__item:hover > .cb-nav__sub,
  .cb-nav__item:focus-within > .cb-nav__sub,
  .cb-nav__item.is-open > .cb-nav__sub {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
  }

  .cb-nav__sub-link {
    display: flex;
    align-items: flex-start;
    gap: var(--cb-sp-3);
    padding: 0.7rem 0.8rem;
    border-radius: var(--cb-r-md);
    text-decoration: none;
    color: var(--cb-ink);
    transition: background-color var(--cb-dur-fast) var(--cb-ease);
  }
  .cb-nav__sub-link:hover { background: var(--cb-mist); color: var(--cb-blue-600); }
  .cb-nav__sub-icon {
    width: 34px; height: 34px; flex: none;
    display: grid; place-items: center;
    color: var(--cb-blue-600);
    background: rgba(11,95,208,0.08);
    border-radius: var(--cb-r-sm);
  }
  .cb-nav__sub-icon svg { width: 17px; height: 17px; }
  .cb-nav__sub-label { font-size: var(--cb-fs-sm); font-weight: var(--cb-fw-semibold); line-height: 1.35; }
  .cb-nav__sub-desc {
    display: block;
    font-size: var(--cb-fs-xs);
    font-weight: var(--cb-fw-regular);
    color: var(--cb-ink-faint);
    margin-top: 2px;
  }

  /* Wide mega panel for Services */
  .cb-nav__sub--mega {
    min-width: 620px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--cb-sp-1);
  }

  /* ---- Overlay-header overrides -------------------------------------
     These MUST come after the current-menu-item rules above. Both selectors
     carry the same specificity, so source order decides — and without this
     block the active nav item keeps its brand-blue colour while sitting on
     the dark hero, which measures 3.16:1 and is the least readable link in
     the whole header. The dropdown panel is excluded because it has its own
     solid white background. */

  .cb-header--overlay:not(.is-scrolled) .cb-nav__item.current-menu-item > .cb-nav__link,
  .cb-header--overlay:not(.is-scrolled) .cb-nav__item.current-menu-ancestor > .cb-nav__link,
  .cb-header--overlay:not(.is-scrolled) .cb-nav__item.current-menu-parent > .cb-nav__link {
    color: #fff;
  }

  .cb-header--overlay:not(.is-scrolled) .cb-nav__link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
  }

  /* The active-item underline needs to read against navy, not against white. */
  .cb-header--overlay:not(.is-scrolled) .cb-nav__item.current-menu-item > .cb-nav__link::after,
  .cb-header--overlay:not(.is-scrolled) .cb-nav__item.current-menu-ancestor > .cb-nav__link::after {
    background: linear-gradient(90deg, var(--cb-cyan-400), var(--cb-blue-400));
  }
}

/* ==========================================================================
   4. HEADER ACTIONS
   ========================================================================== */

.cb-header__actions { display: flex; align-items: center; gap: var(--cb-sp-3); flex: none; }
.cb-header__cta { display: none; }
@media (min-width: 640px) { .cb-header__cta { display: inline-flex; } }

/* Hamburger */
.cb-burger {
  display: grid;
  place-items: center;
  width: var(--cb-tap); height: var(--cb-tap);
  color: var(--cb-navy-800);
  border-radius: var(--cb-r-md);
  transition: background-color var(--cb-dur-fast) var(--cb-ease);
}
.cb-burger:hover { background: rgba(11,95,208,0.07); }
@media (min-width: 1080px) { .cb-burger { display: none; } }

.cb-burger__box { width: 22px; height: 15px; position: relative; }
.cb-burger__bar {
  position: absolute; left: 0;
  width: 100%; height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--cb-dur-base) var(--cb-ease-out),
              opacity var(--cb-dur-fast) var(--cb-ease);
}
.cb-burger__bar:nth-child(1) { top: 0; }
.cb-burger__bar:nth-child(2) { top: 6.5px; }
.cb-burger__bar:nth-child(3) { top: 13px; }
.cb-burger[aria-expanded="true"] .cb-burger__bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.cb-burger[aria-expanded="true"] .cb-burger__bar:nth-child(2) { opacity: 0; transform: scaleX(0.2); }
.cb-burger[aria-expanded="true"] .cb-burger__bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ==========================================================================
   5. MOBILE DRAWER
   ========================================================================== */

.cb-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--cb-z-drawer);
  background: rgba(4,18,43,0.5);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--cb-dur-base) var(--cb-ease), visibility var(--cb-dur-base);
}
.cb-drawer-overlay.is-open { opacity: 1; visibility: visible; }

.cb-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: calc(var(--cb-z-drawer) + 1);
  width: min(400px, 88vw);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -12px 0 48px rgba(4,18,43,0.22);
  transform: translateX(100%);
  transition: transform var(--cb-dur-slow) var(--cb-ease-out);
  /* iOS momentum scroll + safe-area padding for notched devices. */
  overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.cb-drawer.is-open { transform: translateX(0); }
@media (min-width: 1080px) { .cb-drawer, .cb-drawer-overlay { display: none; } }

.cb-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--cb-sp-4);
  padding: var(--cb-sp-4) var(--cb-sp-5);
  border-bottom: 1px solid var(--cb-border);
  flex: none;
}
.cb-drawer__close {
  display: grid; place-items: center;
  width: var(--cb-tap); height: var(--cb-tap);
  color: var(--cb-ink-muted);
  border-radius: var(--cb-r-md);
}
.cb-drawer__close:hover { background: var(--cb-mist); color: var(--cb-ink); }
.cb-drawer__close svg { width: 20px; height: 20px; }

.cb-drawer__body { flex: 1; overflow-y: auto; padding: var(--cb-sp-4) var(--cb-sp-5); }
.cb-drawer__foot {
  flex: none;
  padding: var(--cb-sp-5);
  border-top: 1px solid var(--cb-border);
  background: var(--cb-mist);
  display: grid;
  gap: var(--cb-sp-4);
}
.cb-drawer__contact {
  display: flex; align-items: center; gap: var(--cb-sp-3);
  /* Full 44px touch target — these are phone/email links on a phone, which
     makes them among the most likely things to be tapped on the whole site. */
  min-height: var(--cb-tap);
  font-size: var(--cb-fs-sm);
  color: var(--cb-ink-muted);
  text-decoration: none;
  /* Long email addresses must wrap rather than push the drawer wider. */
  overflow-wrap: anywhere;
}
.cb-drawer__contact svg { width: 16px; height: 16px; color: var(--cb-blue-600); flex: none; }
.cb-drawer__contact:hover { color: var(--cb-blue-600); }

/* Drawer nav */
.cb-dnav__item { border-bottom: 1px solid var(--cb-line-soft); }
.cb-dnav__item:last-child { border-bottom: 0; }
.cb-dnav__link {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--cb-sp-3);
  width: 100%;
  min-height: var(--cb-tap);
  padding: 0.9rem 0;
  font-family: var(--cb-font-display);
  font-size: var(--cb-fs-base);
  font-weight: var(--cb-fw-semibold);
  color: var(--cb-ink);
  text-decoration: none;
  text-align: left;
}
.cb-dnav__link:hover { color: var(--cb-blue-600); }
.cb-dnav__item.current-menu-item > .cb-dnav__link { color: var(--cb-blue-600); }

.cb-dnav__toggle-icon {
  width: 20px; height: 20px; flex: none;
  color: var(--cb-ink-faint);
  transition: transform var(--cb-dur-base) var(--cb-ease);
}
.cb-dnav__link[aria-expanded="true"] .cb-dnav__toggle-icon { transform: rotate(180deg); color: var(--cb-blue-600); }

/* Collapsible submenu — grid-template-rows animates cleanly from 0 to auto,
   which max-height hacks cannot do without guessing a height. */
.cb-dnav__sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--cb-dur-slow) var(--cb-ease-out);
}
.cb-dnav__sub.is-open { grid-template-rows: 1fr; }
.cb-dnav__sub-inner { overflow: hidden; }
.cb-dnav__sub-link {
  display: block;
  min-height: var(--cb-tap);
  padding: 0.7rem 0 0.7rem var(--cb-sp-4);
  font-size: var(--cb-fs-sm);
  color: var(--cb-ink-muted);
  text-decoration: none;
  border-left: 2px solid var(--cb-line);
  margin-left: 2px;
}
.cb-dnav__sub-link:hover { color: var(--cb-blue-600); border-left-color: var(--cb-blue-600); }
.cb-dnav__sub-inner > :last-child { margin-bottom: var(--cb-sp-3); }

/* Body scroll lock while the drawer is open. */
body.cb-no-scroll { overflow: hidden; }

/* ==========================================================================
   6. MOBILE STICKY CTA
   Deliberately restrained: appears only after the user has scrolled past the
   hero, is dismissible, and never covers the footer CTA.
   ========================================================================== */

.cb-mobile-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--cb-z-header);
  display: flex;
  gap: var(--cb-sp-3);
  padding: var(--cb-sp-3) var(--cb-sp-4);
  padding-bottom: calc(var(--cb-sp-3) + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--cb-border);
  box-shadow: 0 -4px 24px rgba(10,27,51,0.09);
  transform: translateY(110%);
  transition: transform var(--cb-dur-slow) var(--cb-ease-out);
}
.cb-mobile-cta.is-visible { transform: translateY(0); }
.cb-mobile-cta .cb-btn { flex: 1; }
@media (min-width: 768px) { .cb-mobile-cta { display: none; } }

/* ==========================================================================
   7. FOOTER
   ========================================================================== */

.cb-footer {
  position: relative;
  background: var(--cb-navy-900);
  color: var(--cb-on-dark-muted);
  padding-top: var(--cb-section-y);
  overflow: hidden;
}
.cb-footer::before {
  /* Single hairline of brand colour across the top edge. */
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cb-blue-600) 30%, var(--cb-cyan-500) 70%, transparent);
  opacity: 0.55;
}

.cb-footer__grid {
  display: grid;
  gap: clamp(2rem, 1.4rem + 2.4vw, 3.5rem);
  padding-bottom: var(--cb-sp-9);
}
@media (min-width: 640px)  { .cb-footer__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cb-footer__grid { grid-template-columns: 1.6fr 1fr 1fr 1.2fr; } }

.cb-footer__brand-text {
  font-size: var(--cb-fs-sm);
  line-height: var(--cb-lh-body);
  margin-top: var(--cb-sp-5);
  max-width: 34ch;
}
.cb-footer .cb-logo__name { color: #fff; }
.cb-footer .cb-logo__tag { color: var(--cb-cyan-300); }

.cb-footer__heading {
  font-family: var(--cb-font-display);
  font-size: var(--cb-fs-xs);
  font-weight: var(--cb-fw-bold);
  letter-spacing: var(--cb-ls-label);
  text-transform: uppercase;
  color: #fff;
  margin-bottom: var(--cb-sp-5);
}
.cb-footer__list { display: grid; gap: var(--cb-sp-1); }
.cb-footer__link {
  display: inline-flex;
  align-items: center;
  gap: var(--cb-sp-3);
  /* Comfortable tap targets in the footer too — commonly overlooked. */
  min-height: 40px;
  padding-block: 0.25rem;
  font-size: var(--cb-fs-sm);
  color: var(--cb-on-dark-muted);
  text-decoration: none;
  transition: color var(--cb-dur-fast) var(--cb-ease),
              transform var(--cb-dur-fast) var(--cb-ease);
}
.cb-footer__link:hover { color: #fff; transform: translateX(3px); }
.cb-footer__link svg { width: 16px; height: 16px; flex: none; color: var(--cb-cyan-400); }

.cb-footer__social { display: flex; gap: var(--cb-sp-3); margin-top: var(--cb-sp-5); }
.cb-footer__social-link {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  color: var(--cb-on-dark-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--cb-border-dark);
  border-radius: var(--cb-r-md);
  transition: all var(--cb-dur-base) var(--cb-ease);
}
.cb-footer__social-link:hover {
  color: #fff; background: var(--cb-blue-600); border-color: transparent;
  transform: translateY(-2px);
}
.cb-footer__social-link svg { width: 17px; height: 17px; }

.cb-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--cb-sp-4);
  padding-block: var(--cb-sp-5);
  border-top: 1px solid var(--cb-border-dark);
  font-size: var(--cb-fs-xs);
}
.cb-footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cb-sp-2) var(--cb-sp-5);
  list-style: none;
  margin: 0;
  padding: 0;
}
.cb-footer__legal a {
  display: inline-flex;
  align-items: center;
  /* Legal links are small text and were the tightest tap target on the page.
     40px keeps them comfortably reachable without adding visible bulk. */
  min-height: 40px;
  color: var(--cb-on-dark-muted);
  text-decoration: none;
}
.cb-footer__legal a:hover { color: #fff; text-decoration: underline; }

@media (max-width: 639px) {
  .cb-footer__bottom { flex-direction: column; align-items: flex-start; text-align: left; }
}
