/* File: theme/css/humanspark-nav.css
 * Purpose: Header chrome - skip link, topbar, site header, primary nav,
 *          dropdowns and rich mega panels (columns + featured slot).
 * Project: HumanSpark | Date: 2026-04-11
 *
 * Extracted from components.css to give the nav room to grow without
 * pushing components.css over its 1,050 budget. Loads after components.css
 * and before books.css in the stack.
 */

/* --- SKIP LINK --- */
.hs-skip-link {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden; z-index: 9999;
  padding: var(--size-2) var(--size-4);
  background: var(--hs-accent); color: var(--hs-navy); font-weight: 700;
}
.hs-skip-link:focus {
  position: fixed; top: 0; left: 0;
  width: auto; height: auto; overflow: visible;
}

/* --- TOPBAR ---
   Subdued navy strip so the newsletter ask doesn't compete visually with the
   body Focus Call CTAs (gold). Newsletter = secondary path; Focus Call = primary. */
.hs-topbar {
  background: var(--hs-navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative; z-index: 99;
}
.hs-topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--size-2); padding-block: 0.35rem; min-height: 38px;
}
.hs-topbar__form, .hs-topbar__form input, .hs-topbar__btn { margin-bottom: 0; }
.hs-topbar__text {
  color: rgba(255, 255, 255, 0.85); font-size: var(--hs-text-sm); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; min-width: 0;
  font-weight: 500; display: inline-flex; align-items: center; gap: 0.4em; margin: 0;
}
.hs-topbar__form { display: flex; align-items: center; gap: var(--size-2); flex-shrink: 0; height: 34px; }
.hs-topbar__form input[type="email"] {
  padding: 0.28rem 0.65rem; border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px; background: rgba(255, 255, 255, 0.08); color: var(--hs-white);
  font-size: var(--hs-text-2xs); width: 180px; height: 32px; min-height: 0;
}
.hs-topbar__form input[type="email"]::placeholder { color: rgba(255, 255, 255, 0.5); }
.hs-topbar__btn {
  background: transparent; color: var(--hs-white);
  padding: 0.28rem 0.9rem; font-size: var(--hs-text-xs); border-radius: 8px;
  font-weight: 600; text-transform: uppercase;
  height: 32px; min-height: 0; border: 1px solid rgba(255, 255, 255, 0.35);
  display: inline-flex; align-items: center; gap: 0.3em; cursor: pointer;
}
.hs-topbar__btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--hs-white); }

/* --- SITE HEADER + LOGO --- */
.hs-site-header {
  background: rgba(0, 8, 42, 0.97);
  border-bottom: 1px solid var(--hs-white-subtle);
  position: sticky; top: 0; z-index: 100; padding: 0;
}
.hs-site-header nav {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 1.1rem; min-height: 0;
}
.hs-logo { display: inline-flex; align-items: center; text-decoration: none; }
.hs-logo__image { height: 39px; width: auto; display: block; }

/* --- PRIMARY NAV LIST --- */
.hs-nav__list {
  display: flex; align-items: center;
  gap: clamp(var(--size-3), 2vw, var(--size-4));
  list-style: none; padding: 0; margin: 0;
}
.hs-nav__list > li { position: relative; }
.hs-nav__list > li > a {
  font-size: var(--hs-text-base); font-weight: 500;
  color: rgba(255, 255, 255, 0.85); text-decoration: none;
  white-space: nowrap; padding: 0.5rem 0; display: inline-block;
}
.hs-nav__list > li > a:hover { color: var(--hs-white); }
.current-menu-item > a { color: var(--hs-white) !important; font-weight: 600; }

/* Contact pill */
.hs-site-header .hs-nav__contact-btn {
  background: var(--hs-accent); color: var(--hs-navy);
  padding: 0.36rem 1.18rem; border-radius: 8px;
  font-weight: 700; font-size: var(--hs-text-sm);
}
.hs-site-header .hs-nav__contact-btn:hover { background: var(--hs-accent-dark); }

/* Dropdown toggle button */
.hs-nav__dropdown-toggle {
  font-size: var(--hs-text-base); font-weight: 500; color: rgba(255, 255, 255, 0.85);
  background: none; border: none; cursor: pointer;
  padding: 0.5rem 0; display: inline-flex; align-items: center; gap: 0.3em;
}
.hs-nav__dropdown-toggle:hover { color: var(--hs-white); }
.hs-nav__dropdown-toggle .hs-icon { transition: transform 0.2s; }
.hs-nav__dropdown.is-open .hs-nav__dropdown-toggle .hs-icon { transform: rotate(180deg); }

/* --- SIMPLE DROPDOWN (single column, no panel schema) --- */
.hs-nav__mega {
  display: none; position: absolute; top: 100%;
  left: 50%; transform: translateX(-50%);
  background: rgba(4, 14, 36, 0.97);
  border: 1px solid rgba(238, 186, 0, 0.08);
  border-top: 2px solid var(--hs-accent);
  border-radius: 0 0 12px 12px;
  padding: var(--size-3); padding-top: calc(var(--size-3) + 5px);
  min-width: 240px; z-index: 200;
}
.hs-nav__dropdown.is-open > .hs-nav__mega { display: block; }
.hs-nav__mega-col { display: flex; flex-direction: column; }
.hs-nav__mega-col a {
  display: flex; align-items: center; gap: 0.55em;
  padding: 0.65rem 0.7rem; color: rgba(255, 255, 255, 0.65);
  font-size: var(--hs-text-sm); font-weight: 500;
  border-radius: 8px; white-space: nowrap; text-decoration: none;
}
.hs-nav__mega-col a:hover { background: rgba(255, 255, 255, 0.04); color: var(--hs-white); }
.hs-nav__mega-label { display: block; padding: 0.8rem 0.7rem 0.25rem; color: rgba(255, 255, 255, 0.4); font-size: var(--hs-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--hs-tracking-wider); }
.hs-nav__mega-group { display: flex; flex-direction: column; }

/* --- RICH MEGA PANEL (columns + featured slot) ---
   Triggered by _hs_nav_mega post meta on a menu item. Content comes from
   hs_content_nav[$panel_key] and is rendered by hs_render_mega_panel().
   Right-anchored instead of centered (override the default .hs-nav__mega
   positioning) so a wide panel doesn't overflow the viewport at 1024 when
   the trigger item sits right of center. */
.hs-nav__mega--rich {
  left: auto; right: 0; transform: none;
  width: min(720px, calc(100vw - var(--size-5)));
  min-width: 0;
  padding: var(--size-4);
}
.hs-nav__panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: var(--size-4);
}
.hs-nav__panel-col { display: flex; flex-direction: column; gap: 0.15rem; }
.hs-nav__panel-title {
  font-size: var(--hs-text-2xs); font-weight: 700;
  color: rgba(255, 255, 255, 0.4); text-transform: uppercase;
  letter-spacing: var(--hs-tracking-wider);
  margin: 0 0 var(--size-2); padding-left: 0.7rem;
}
.hs-nav__panel-link {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.55rem 0.7rem; border-radius: 8px;
  color: rgba(255, 255, 255, 0.85); text-decoration: none;
  font-size: var(--hs-text-sm); font-weight: 500;
}
.hs-nav__panel-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--hs-white); }
.hs-nav__panel-link__desc {
  font-size: var(--hs-text-2xs); color: rgba(255, 255, 255, 0.45);
  font-weight: 400; line-height: var(--hs-leading-tight);
}

/* Featured tile - card-style slot at the right of the panel */
.hs-nav__featured {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: var(--size-3); border-radius: 10px;
  background: rgba(238, 186, 0, 0.05);
  border: 1px solid rgba(238, 186, 0, 0.15);
  text-decoration: none; color: var(--hs-white);
  transition: background 0.18s, border-color 0.18s;
}
.hs-nav__featured:hover { background: rgba(238, 186, 0, 0.08); border-color: rgba(238, 186, 0, 0.3); }
.hs-nav__featured__cover {
  width: 100%; height: 120px; object-fit: cover;
  border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.hs-nav__featured__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--hs-text-2xs); color: var(--hs-accent);
  text-transform: uppercase; letter-spacing: var(--hs-tracking-wider);
  font-weight: 700; margin: 0;
}
.hs-nav__featured__title {
  font-size: var(--hs-text-md); color: var(--hs-white);
  font-weight: 700; line-height: var(--hs-leading-tight);
  letter-spacing: var(--hs-tracking-snug); margin: 0;
}
.hs-nav__featured__desc {
  font-size: var(--hs-text-xs); color: rgba(255, 255, 255, 0.7);
  line-height: var(--hs-leading-tight); margin: 0;
}

/* --- MOBILE NAV TOGGLE --- */
.hs-nav__toggle {
  display: none; background: none; border: none;
  padding: var(--size-2); flex-direction: column; gap: 5px;
  min-width: 44px; min-height: 44px;
  align-items: center; justify-content: center; cursor: pointer;
}
.hs-nav__toggle span { display: block; width: 24px; height: 2px; background: var(--hs-white); transition: transform 0.2s; }

@media (max-width: 768px) {
  .hs-nav__toggle { display: flex; }
  .hs-nav__list {
    position: fixed; top: 40px; left: 0; right: 0;
    background: rgba(0, 8, 42, 0.98); flex-direction: column;
    z-index: 99; visibility: hidden; opacity: 0;
    max-height: 0; overflow: hidden; transition: all 0.25s ease;
    padding: 0 var(--size-4);
  }
  .hs-nav__list.is-open {
    visibility: visible; opacity: 1; max-height: 600px;
    overflow-y: auto; padding: var(--size-4);
  }
  .hs-nav__list > li { width: 100%; }
  .hs-nav__list > li > a,
  .hs-nav__dropdown-toggle { width: 100%; padding: var(--size-2) 0; font-size: var(--hs-text-lg); }
  .hs-nav__mega {
    position: static; transform: none; border: none;
    border-radius: 0; padding: 0 var(--size-3); background: transparent;
    min-width: 0;
  }
  /* Rich mega panel collapses to a vertical list on mobile */
  .hs-nav__mega--rich { max-width: none; padding: var(--size-2) var(--size-3); }
  .hs-nav__panel { grid-template-columns: 1fr; gap: var(--size-3); }
  .hs-nav__featured { padding: var(--size-2) var(--size-3); }
  .hs-nav__featured__cover { display: none; }
  .hs-nav__contact { margin-top: var(--size-2); }
  .hs-site-header .hs-nav__contact-btn { width: 100%; text-align: center; display: block; padding: var(--size-2); }
}

@media (max-width: 768px) {
  .hs-topbar__text { display: none; }
  .hs-topbar__inner { justify-content: center; padding-block: var(--size-2); }
  .hs-topbar__form { flex: 1; max-width: 100%; }
  .hs-topbar__form input[type="email"] { flex: 1; width: auto; min-width: 120px; padding: 0.55rem 0.75rem; }
  .hs-topbar__btn { padding: 0.55rem 1rem; font-size: var(--hs-text-sm); }
}
