/* ============================================================================
   ja-nav — shared site nav for jacobabdo.com
   ----------------------------------------------------------------------------
   Self-contained on purpose. The five pages this sits on use three different
   and mutually incompatible CSS regimes (the navy/green lander, the dark
   oxblood books page, the chrome-less quiz), so this component inherits
   nothing from the host page and leaks nothing back into it. Every value it
   needs is defined here as a namespaced --jn-* custom property.

   Light pages:  <nav class="ja-nav">
   Dark pages:   <nav class="ja-nav ja-nav--dark">
   Active link:  <a class="ja-nav__link is-active">

   Markup is written statically into each page rather than injected by JS.
   The retired bxtchesaintshit.com SPA proved the cost of the alternative:
   client-rendered nav is invisible to crawlers and flashes on load.
   ========================================================================= */

.ja-nav {
  --jn-bg: rgba(246, 248, 244, .82);
  --jn-fg: #12283D;
  --jn-fg-soft: #5A6B7A;
  --jn-line: #E4E9E0;
  --jn-accent: #2F5C40;
  --jn-accent-wash: #E7F0E6;
  --jn-cta-bg: #12283D;
  --jn-cta-bg-h: #2F5C40;
  --jn-cta-fg: #fff;
  --jn-mark-bg: #12283D;
  --jn-mark-fg: #fff;
  --jn-panel: #F6F8F4;

  position: sticky;
  top: 0;
  z-index: 60; /* above the lander's own z-30 header stack and ambient blobs */
  background: var(--jn-bg);
  border-bottom: 1px solid var(--jn-line);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.ja-nav--dark {
  --jn-bg: rgba(10, 10, 10, .85);
  --jn-fg: #e9e7e4;
  --jn-fg-soft: #8c8884;
  --jn-line: #262626;
  --jn-accent: #FF2400;
  --jn-accent-wash: rgba(181, 18, 27, .16);
  --jn-cta-bg: #B5121B;
  --jn-cta-bg-h: #FF2400;
  --jn-cta-fg: #fff;
  --jn-mark-bg: #B5121B;
  --jn-mark-fg: #fff;
  --jn-panel: #0a0a0a;
}

.ja-nav__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 18px;
}

/* ---- brand ---- */
.ja-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.03em;
  color: var(--jn-fg);
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
}
.ja-nav__mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--jn-mark-bg);
  color: var(--jn-mark-fg);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

/* ---- link row ---- */
.ja-nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}
.ja-nav__link {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--jn-fg-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease;
}
.ja-nav__link:hover,
.ja-nav__link:focus-visible {
  color: var(--jn-fg);
  background: var(--jn-accent-wash);
}
.ja-nav__link.is-active {
  color: var(--jn-accent);
  background: var(--jn-accent-wash);
}

/* ---- cta ---- */
.ja-nav__cta {
  flex: 0 0 auto;
  margin-left: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--jn-cta-fg);
  background: var(--jn-cta-bg);
  text-decoration: none;
  white-space: nowrap;
  border: 0;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.ja-nav__cta:hover { background: var(--jn-cta-bg-h); }
.ja-nav__cta:active { transform: scale(.97); }

/* ---- hamburger ---- */
.ja-nav__burger {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--jn-line);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.ja-nav__burger span {
  position: absolute;
  left: 11px;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--jn-fg);
  transition: transform .22s ease, opacity .18s ease;
}
.ja-nav__burger span:nth-child(1) { top: 14px; }
.ja-nav__burger span:nth-child(2) { top: 19px; }
.ja-nav__burger span:nth-child(3) { top: 24px; }
.ja-nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.ja-nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.ja-nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ---- mobile ---- */
@media (max-width: 860px) {
  .ja-nav__inner { gap: 12px; padding: 0 18px; }
  .ja-nav__burger { display: block; }

  .ja-nav__links {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 18px 16px;
    background: var(--jn-panel);
    border-bottom: 1px solid var(--jn-line);
    /* collapsed by default; opened by toggling [data-open] on the nav */
    display: none;
  }
  .ja-nav[data-open="true"] .ja-nav__links { display: flex; }

  .ja-nav__link {
    padding: 13px 12px;
    font-size: 15.5px;
    border-radius: 9px;
  }
  .ja-nav__cta {
    margin: 8px 0 0;
    text-align: center;
    padding: 13px 16px;
    font-size: 15px;
  }
}

/* Desktop: the CTA lives inline in the bar, not inside the collapsing list. */
@media (min-width: 861px) {
  .ja-nav__links .ja-nav__cta { display: none; }
}
@media (max-width: 860px) {
  .ja-nav__inner > .ja-nav__cta { display: none; }
}

/* Respect users who have asked the OS to reduce motion. */
@media (prefers-reduced-motion: reduce) {
  .ja-nav__link,
  .ja-nav__cta,
  .ja-nav__burger span { transition: none; }
}
