/* ==========================================================
   cw-header.css
   ChildWatch blog header / nav — mirrors the main ASP.NET site.

   Source of truth: /css/childwatch.css  (sections 1, 3, 5, 6, 21)
   and /Masters/Site1.Master on the main site.

   Only the chrome (top bar + nav) is ported here. The global
   resets from childwatch.css section 2 (body / a / h1-h6 / p) are
   deliberately NOT included, so UnderStrap keeps owning the
   typography and layout of the blog's article content.

   If the main site's nav changes, update this file and header.php
   together.
   ========================================================== */

/* ----------------------------------------------------------
   1. DESIGN TOKENS  (from childwatch.css section 1)
   ---------------------------------------------------------- */
:root {
  --cw-navy:        #17324D;
  --cw-blue:        #2563EB;
  --cw-blue-dark:   #1D4ED8;
  --cw-blue-light:  #EAF6FF;
  --cw-orange:      #F97316;
  --cw-orange-dark: #EA6C0A;
  --cw-white:       #FFFFFF;
  --cw-text:        #1F2937;
  --cw-muted:       #64748B;
  --cw-border:      #E5E7EB;
  --cw-light-gray:  #F8FAFC;

  --cw-font-sans:   'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --cw-container:   1180px;

  --cw-radius-sm:   6px;
  --cw-radius-pill: 999px;

  --cw-shadow-card: 0 4px 20px rgba(0,0,0,.09);
  --cw-shadow-nav:  0 2px 16px rgba(23,50,77,.12);

  --cw-transition:  0.2s ease;
}

/* ----------------------------------------------------------
   2. LAYOUT HELPER  (from childwatch.css section 3)
   ---------------------------------------------------------- */
.cw-container {
  width: 100%;
  max-width: var(--cw-container);
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ----------------------------------------------------------
   3. BUTTONS  (from childwatch.css section 5 — only the
      variants the header actually uses)
   ---------------------------------------------------------- */
.cw-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--cw-font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.6rem;
  border-radius: var(--cw-radius-pill);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--cw-transition);
  white-space: nowrap;
  line-height: 1.3;
}

.cw-btn-primary {
  background-color: var(--cw-orange);
  color: var(--cw-white);
  border-color: var(--cw-orange);
}
.cw-btn-primary:hover {
  background-color: var(--cw-orange-dark);
  border-color: var(--cw-orange-dark);
  color: var(--cw-white);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(249,115,22,.35);
}

.cw-btn-sm {
  font-size: 0.875rem;
  padding: 0.5rem 1.2rem;
}

/* ----------------------------------------------------------
   4. TOP BAR  (from childwatch.css section 6)
   ---------------------------------------------------------- */
.cw-topbar {
  width: 100%;
  background-color: var(--cw-navy);
  color: rgba(255,255,255,.75);
  font-family: var(--cw-font-sans);
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.cw-topbar a { color: rgba(255,255,255,.85); text-decoration: none; }
.cw-topbar a:hover { color: var(--cw-white); text-decoration: none; }
.cw-topbar p { margin: 0; }
.cw-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.cw-topbar-phone { display: flex; align-items: center; gap: 0.4rem; }
.cw-topbar-phone i { color: var(--cw-orange); }
.cw-topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

/* ----------------------------------------------------------
   5. MAIN NAV  (from childwatch.css section 6)
   ---------------------------------------------------------- */
#cw-navbar {
  width: 100%;
  background-color: var(--cw-white);
  font-family: var(--cw-font-sans);
  border-bottom: 1px solid var(--cw-border);
  box-shadow: var(--cw-shadow-nav);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background .3s ease, box-shadow .3s ease, border-color .3s ease;
}
#cw-navbar .cw-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 1rem;
}
.cw-nav-logo { display: inline-flex; align-items: center; }
.cw-nav-logo img {
  height: 48px;
  width: auto;
  max-width: none;
}

/* Nav links */
.cw-nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}
.cw-nav-links li { position: relative; list-style: none; }

/* TOP-LEVEL links only — child combinator prevents flex bleeding
   into dropdown items */
.cw-nav-links > li > a {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 1rem 0.6rem; /* extra bottom padding extends hover zone */
  font-family: var(--cw-font-sans);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--cw-navy);
  background-color: transparent;
  border: 0;
  border-radius: var(--cw-radius-sm);
  transition: color var(--cw-transition), background var(--cw-transition);
  white-space: nowrap;
  text-decoration: none;
}
.cw-nav-links > li > a:hover,
.cw-nav-links > li > a:focus,
.cw-nav-links > li > a.active {
  color: var(--cw-blue);
  background-color: var(--cw-blue-light);
  text-decoration: none;
}

/* CTA pill */
.cw-nav-links .cw-nav-cta { margin-left: 0.5rem; }
.cw-nav-links .cw-nav-cta > a {
  background-color: var(--cw-orange) !important;
  color: #ffffff !important;
  border-radius: var(--cw-radius-pill) !important;
  padding: 0.5rem 1.2rem !important;
}
.cw-nav-links .cw-nav-cta > a:hover {
  background-color: var(--cw-orange-dark) !important;
  color: #ffffff !important;
}

/* ----------------------------------------------------------
   6. DROPDOWNS
   ---------------------------------------------------------- */
.cw-nav-links .cw-dropdown { position: relative; }
.cw-nav-links .cw-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  border: 1px solid var(--cw-border);
  border-top: none;
  min-width: 220px;
  padding: 0.5rem 0.4rem 0.4rem;
  z-index: 1050;
  list-style: none;
  margin: 0;
}
.cw-nav-links .cw-dropdown:hover .cw-dropdown-menu,
.cw-nav-links .cw-dropdown-menu:hover {
  display: block;
}

/* Invisible hover bridge — fills the gap between trigger and
   dropdown so the menu never retracts mid-travel */
.cw-nav-links .cw-dropdown > a::after {
  content: '';
  display: block;
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

/* Dropdown item links — hardened with !important to beat
   Bootstrap + UnderStrap's global link rules */
.cw-nav-links .cw-dropdown-menu li { margin: 0; padding: 0; }
.cw-nav-links .cw-dropdown-menu li a,
.cw-nav-links .cw-dropdown-menu li a:link,
.cw-nav-links .cw-dropdown-menu li a:visited {
  display: block !important;
  padding: 0.5rem 0.9rem !important;
  font-family: var(--cw-font-sans) !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  color: #1F2937 !important;
  background-color: transparent !important;
  border: 0 !important;
  border-radius: 8px !important;
  white-space: normal !important;
  text-decoration: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
  transition: background .15s, color .15s !important;
}
.cw-nav-links .cw-dropdown-menu li a:hover,
.cw-nav-links .cw-dropdown-menu li a:focus {
  background-color: #EAF6FF !important;
  color: #2563EB !important;
  text-decoration: none !important;
}

/* Section label inside a dropdown ("MOBILE APPS") */
.cw-dropdown-label {
  display: block;
  font-family: var(--cw-font-sans);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #94A3B8;
  padding: .25rem .9rem .1rem;
}
.cw-dropdown-divider {
  border-top: 1px solid var(--cw-border);
  margin-top: .3rem;
  padding-top: .3rem;
}
.cw-dropdown-menu li a .cw-dd-icon {
  margin-right: .4rem;
  font-size: .8rem;
}

/* ----------------------------------------------------------
   7. HAMBURGER / MOBILE TOGGLE
   ---------------------------------------------------------- */
#cw-nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--cw-navy);
  font-size: 1.4rem;
  line-height: 1;
}

/* ----------------------------------------------------------
   8. SCROLLED: DARK NAV  (from childwatch.css)
      JS adds .cw-nav-scrolled to #cw-navbar past the threshold.
   ---------------------------------------------------------- */
#cw-navbar.cw-nav-scrolled {
  background: #000000 !important;
  border-bottom-color: rgba(255,255,255,.08) !important;
  box-shadow: 0 2px 20px rgba(0,0,0,.3) !important;
}
#cw-navbar.cw-nav-scrolled .cw-nav-links > li > a {
  color: rgba(255,255,255,.88) !important;
  text-decoration: none !important;
}
#cw-navbar.cw-nav-scrolled .cw-nav-links > li > a:hover,
#cw-navbar.cw-nav-scrolled .cw-nav-links > li > a.active {
  color: #ffffff !important;
  background-color: rgba(255,255,255,.12) !important;
}
#cw-navbar.cw-nav-scrolled .cw-nav-cta > a {
  background-color: var(--cw-orange) !important;
  color: #ffffff !important;
}
#cw-navbar.cw-nav-scrolled #cw-nav-toggle { color: #ffffff !important; }
/* Dropdown menus stay white — they float over page content */
#cw-navbar.cw-nav-scrolled .cw-dropdown-menu {
  background: #ffffff !important;
  border-color: #E5E7EB !important;
}
#cw-navbar.cw-nav-scrolled .cw-dropdown-menu li a,
#cw-navbar.cw-nav-scrolled .cw-dropdown-menu li a:link,
#cw-navbar.cw-nav-scrolled .cw-dropdown-menu li a:visited {
  color: #1F2937 !important;
}
#cw-navbar.cw-nav-scrolled .cw-dropdown-menu li a:hover {
  background-color: #EAF6FF !important;
  color: #2563EB !important;
}
#cw-navbar.cw-nav-scrolled .cw-dropdown-label { color: #94A3B8 !important; }

/* ----------------------------------------------------------
   9. DROPDOWN ACCESSIBILITY
      :focus-within so keyboard users can open menus too.
   ---------------------------------------------------------- */
.cw-nav-links .cw-dropdown:focus-within .cw-dropdown-menu { display: block; }

/* ----------------------------------------------------------
   10. RESPONSIVE  (from childwatch.css section 21)
   ---------------------------------------------------------- */
@media (max-width: 768px) {
  #cw-nav-toggle { display: flex; }
  .cw-nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--cw-white);
    border-top: 1px solid var(--cw-border);
    box-shadow: var(--cw-shadow-card);
    padding: 0.75rem;
    gap: 0.25rem;
    z-index: 999;
  }
  .cw-nav-links.open { display: flex; }
  .cw-nav-links li { width: 100%; }
  .cw-nav-links > li > a { justify-content: space-between; width: 100%; }
  .cw-dropdown-menu {
    position: static !important;
    box-shadow: none;
    border: none;
    background: var(--cw-light-gray);
    border-radius: var(--cw-radius-sm);
    display: none;
    margin-top: 0.25rem;
  }
  .cw-dropdown-menu.open { display: block; }
  #cw-navbar { position: relative; }

  /* Mobile: open via the JS class toggle, not hover */
  .cw-nav-links .cw-dropdown:hover .cw-dropdown-menu { display: none; }
  .cw-nav-links .cw-dropdown-menu.open { display: block !important; }

  /* Stack the top bar so the phone number stays readable */
  .cw-topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* ----------------------------------------------------------
   11. WORDPRESS INTEGRATION FIXES
   ---------------------------------------------------------- */

/* Keep the sticky nav clear of the logged-in WP admin bar */
body.admin-bar #cw-navbar { top: 32px; }
@media screen and (max-width: 782px) {
  body.admin-bar #cw-navbar { top: 46px; }
}

/* NOTE on the sticky nav: position:sticky can only travel within its own
   parent, so header.php places .cw-topbar and #cw-navbar directly inside
   #page instead of UnderStrap's #wrapper-navbar div, which is only as tall
   as the header itself. If the nav ever stops sticking, the usual cause is
   a new `overflow` value on html, body or #page — sticky is clipped by any
   ancestor that establishes a scroll container. */
