/* ================================================================
   IntrinsicIQ public shell
   Shared navigation and footer for public/editorial pages.
   Depends on tokens.css + base.css and intentionally contains no
   independent palette: Dark and Ivory both flow from shared tokens.
   ================================================================ */

/* The legacy app header remains in page markup during migration. Loading
   this stylesheet in <head> removes it before first paint. */
#app-header,
#top-nav {
  display: none !important;
}

html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

.liq-topnav {
  position: sticky;
  top: 0;
  z-index: 250;
  width: 100%;
  background: var(--bg);
  border-bottom: 1px solid var(--border-zinc);
}

@supports (background: color-mix(in srgb, currentColor, transparent)) {
  .liq-topnav {
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
}

.liq-topnav .nav-inner {
  position: relative;
  width: min(100%, var(--max-w));
  min-height: 64px;
  margin: 0 auto;
  padding: 0 var(--s5);
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.liq-topnav .nav-brand,
.liq-footer .footer-brand-link {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.liq-topnav .nav-brand {
  flex: 0 0 auto;
  gap: 10px;
}

.liq-topnav .nav-mark {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.liq-topnav .nav-wordmark,
.liq-footer .footer-wordmark {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1;
}

.liq-topnav .nav-wordmark { font-size: 21px; }

.liq-topnav .nav-wordmark-iq,
.liq-footer .footer-wordmark-iq {
  color: var(--gold);
}

.liq-topnav .nav-panel {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.liq-topnav .nav-links {
  display: flex;
  align-items: center;
  gap: var(--s1);
}

.liq-topnav .nav-link {
  position: relative;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1;
  text-decoration: none;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.liq-topnav .nav-link:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.liq-topnav .nav-link.nav-active {
  color: var(--gold);
  background: var(--gold-bg);
}

.liq-topnav .nav-link.nav-active:not(.nav-cta)::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 3px;
  left: 10px;
  height: 1px;
  background: var(--gold-dim);
}

.liq-topnav .nav-cta {
  gap: 6px;
  margin-left: var(--s1);
  padding-inline: 14px;
  color: var(--gold);
  background: var(--gold-bg);
  border-color: var(--border);
}

.liq-topnav .nav-cta:hover {
  color: var(--gold);
  background: var(--gold-glow);
  border-color: var(--border-light);
}

.liq-topnav .nav-cta-arrow {
  transition: transform .15s ease;
}

.liq-topnav .nav-cta:hover .nav-cta-arrow {
  transform: translateX(2px);
}

.liq-topnav .theme-toggle,
.liq-topnav .nav-menu-toggle {
  min-height: 34px;
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--text-muted);
  font: 600 11px/1 var(--sans);
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.liq-topnav .theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  white-space: nowrap;
}

.liq-topnav .theme-toggle-icon {
  width: 14px;
  color: var(--gold);
  font-size: 14px;
  line-height: 1;
  text-align: center;
}

.liq-topnav .theme-toggle:hover,
.liq-topnav .nav-menu-toggle:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.liq-topnav .nav-menu-toggle {
  width: 38px;
  padding: 8px 9px;
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
}

.liq-topnav .menu-line {
  display: block;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform-origin: center;
  transition: transform .15s ease, opacity .15s ease;
}

.liq-topnav.is-menu-open .menu-line:nth-of-type(2) {
  transform: translateY(5px) rotate(45deg);
}

.liq-topnav.is-menu-open .menu-line:nth-of-type(3) {
  opacity: 0;
}

.liq-topnav.is-menu-open .menu-line:nth-of-type(4) {
  transform: translateY(-5px) rotate(-45deg);
}

.liq-topnav :is(a, button):focus-visible,
.liq-footer a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Footer --------------------------------------------------------- */
.liq-footer {
  display: block;
  padding: 44px var(--s5) 28px;
  border-top: 1px solid var(--border-zinc);
  color: var(--text-muted);
  font-size: inherit;
}

.liq-footer .footer-inner {
  width: min(100%, var(--max-w));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, auto);
  align-items: start;
  gap: var(--s6) 48px;
}

.liq-footer .footer-brand {
  min-width: 0;
}

.liq-footer .footer-brand-link {
  gap: 11px;
}

.liq-footer .footer-mark {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.liq-footer .footer-wordmark {
  font-size: 24px;
}

.liq-footer .footer-tagline {
  margin: var(--s2) 0 0 51px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .035em;
  line-height: 1.5;
}

.liq-footer .footer-links {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 11px var(--s5);
}

.liq-footer .footer-links a {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
  text-decoration: none;
  transition: color .15s ease;
}

.liq-footer .footer-links a:hover {
  color: var(--gold);
  text-decoration: none;
}

.liq-footer .footer-copy {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: var(--s4);
  border-top: 1px solid var(--border-zinc);
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.65;
  text-align: left;
}

@media (max-width: 820px) {
  .liq-topnav .nav-inner {
    min-height: 58px;
    padding-inline: var(--s4);
  }

  .liq-topnav .nav-mark {
    width: 31px;
    height: 31px;
  }

  .liq-topnav .nav-wordmark { font-size: 20px; }

  .liq-topnav .nav-menu-toggle {
    display: flex;
    margin-left: auto;
  }

  .liq-topnav .nav-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: var(--s4);
    left: var(--s4);
    margin-left: 0;
    padding: var(--s2);
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: var(--s2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-panel);
  }

  .liq-topnav.is-menu-open .nav-panel {
    display: flex;
  }

  .liq-topnav .nav-links {
    align-items: stretch;
    flex-direction: column;
    gap: 2px;
  }

  .liq-topnav .nav-link {
    justify-content: flex-start;
    min-height: 40px;
    padding: 10px 12px;
  }

  .liq-topnav .nav-link.nav-active:not(.nav-cta)::after {
    top: 9px;
    right: auto;
    bottom: 9px;
    left: 3px;
    width: 1px;
    height: auto;
  }

  .liq-topnav .nav-cta {
    justify-content: space-between;
    margin: var(--s1) 0 0;
  }

  .liq-topnav .theme-toggle {
    width: 100%;
    min-height: 40px;
  }

  .liq-footer .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--s5);
  }

  .liq-footer .footer-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s3) var(--s5);
  }

  .liq-footer .footer-copy {
    grid-column: 1;
  }
}

@media (max-width: 420px) {
  .liq-topnav .nav-inner { padding-inline: var(--s3); }
  .liq-topnav .nav-wordmark { font-size: 18px; }
  .liq-topnav .nav-panel { right: var(--s3); left: var(--s3); }

  .liq-footer {
    padding: 36px var(--s4) var(--s5);
  }

  .liq-footer .footer-wordmark { font-size: 22px; }
  .liq-footer .footer-tagline { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .liq-topnav .nav-link,
  .liq-topnav .nav-cta-arrow,
  .liq-topnav .theme-toggle,
  .liq-topnav .nav-menu-toggle,
  .liq-topnav .menu-line,
  .liq-footer .footer-links a {
    transition: none;
  }
}

@media print {
  .liq-topnav,
  .liq-footer {
    display: none !important;
  }
}
