/* ============================================================
   GLOBAL NAV + FOOTER  ·  liminate.dev
   Single source of truth for site-wide navigation chrome.
   Linked from every HTML page as /static/global-nav.css
   (absolute path so it resolves from any route depth).

   Self-contained: defines its own CSS custom properties so it
   does not depend on any page's variables. Defaults are tuned
   for the Night ground (#111018). Pages on other grounds add a
   modifier class on the element:
       <nav class="gn gn-paper">  ·  Paper ground (#F5F1E8)
       <nav class="gn gn-ink">    ·  Ink ground   (#0B1C38)
       <footer class="gf gf-paper"> · Paper-ground footer
   ============================================================ */

/* === GLOBAL NAV === */
:root {
  --gn-stack-offset: 61px;
}

.gn {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 28px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--gn-border, rgba(245,241,232,0.08));
  background: var(--gn-bg, rgba(17,16,24,0.78));
  font-family: 'Figtree', system-ui, sans-serif;
}
.gn-left { display: flex; align-items: center; justify-self: start; }
.gn-home {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.gn-wordmark {
  font-family: 'Recursive', system-ui, sans-serif;
  font-variation-settings: 'CASL' 0.45, 'MONO' 0;
  font-weight: 500; font-size: 16px;
  color: var(--gn-text, #E8DFD0);
  letter-spacing: -0.04em;
}
.gn-center { display: flex; align-items: center; gap: 4px; justify-self: center; }
.gn-tab {
  font-size: 12px; padding: 5px 14px; border-radius: 4px;
  text-decoration: none; font-weight: 500;
  color: var(--gn-tab, rgba(245,241,232,0.62));
  transition: color 0.15s, background 0.15s;
  font-family: 'Figtree', system-ui, sans-serif;
  white-space: nowrap;
}
.gn-tab:hover {
  color: var(--gn-tab-hover, rgba(245,241,232,0.9));
  background: var(--gn-tab-hover-bg, rgba(245,241,232,0.04));
  text-decoration: none;
}
.gn-tab.current {
  font-weight: 500;
  color: var(--gn-tab-current, #E8A84C);
  background: var(--gn-tab-current-bg, rgba(232,168,76,0.08));
}
.gn-right { display: flex; align-items: center; justify-self: end; }
.gn-cta {
  font-family: 'Commit Mono', monospace;
  font-size: 11px; font-weight: 500;
  padding: 7px 16px; border-radius: 3px; border: none;
  cursor: pointer; text-decoration: none;
  color: var(--gn-cta-text, #111018);
  background: var(--gn-cta-bg, #C0780F);
  transition: filter 0.15s;
}
.gn-cta:hover { filter: brightness(1.08); text-decoration: none; }

.gn a:focus-visible,
.gn button:focus-visible,
.gf a:focus-visible {
  outline: 3px solid var(--gn-focus, #E8A84C);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Mobile hamburger */
.gn-toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 10px;
  background: transparent; border: none; cursor: pointer;
}
.gn-toggle span {
  display: block; height: 2px; width: 100%;
  background: var(--gn-text, #E8DFD0); border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.gn.open .gn-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.gn.open .gn-toggle span:nth-child(2) { opacity: 0; }
.gn.open .gn-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Paper ground override (homepage + constellation) --- */
.gn.gn-paper {
  --gn-bg: rgba(245,241,232,0.92);
  --gn-border: rgba(11,28,56,0.06);
  --gn-text: #0B1C38;
  --gn-tab: rgba(11,28,56,0.62);
  --gn-tab-hover: rgba(11,28,56,0.9);
  --gn-tab-hover-bg: rgba(11,28,56,0.04);
  --gn-tab-current: #C0780F;
  --gn-tab-current-bg: rgba(192,120,15,0.07);
  --gn-cta-text: #F5F1E8;
  --gn-cta-bg: #0B1C38;
}

/* --- Ink ground override (Agreements pages) --- */
.gn.gn-ink {
  --gn-bg: rgba(11,28,56,0.88);
}

@media (max-width: 640px) {
  .gn { grid-template-columns: 1fr auto; padding: 14px 20px; }
  .gn-center {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    justify-self: stretch;
    flex-direction: column; align-items: stretch;
    background: var(--gn-bg, rgba(17,16,24,0.97));
    backdrop-filter: blur(16px); border-bottom: 1px solid var(--gn-border, rgba(245,241,232,0.08));
    padding: 6px 20px 14px; gap: 0;
  }
  .gn.open .gn-center { display: flex; }
  .gn-center .gn-tab { padding: 13px 0; font-size: 14px; border-radius: 0; border-bottom: 1px solid var(--gn-border, rgba(245,241,232,0.08)); }
  .gn-center .gn-tab:last-child { border-bottom: none; }
  .gn-right { display: none; }
  .gn-toggle { display: flex; }
  .gn-cta, .gn-tab { min-height: 44px; display: inline-flex; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  .gn *,
  .gf * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* === GLOBAL FOOTER === */
.gf {
  padding: 32px 48px;
  border-top: 1px solid var(--gf-border, rgba(245,241,232,0.12));
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'Figtree', system-ui, sans-serif;
  font-size: 11px;
  color: var(--gf-text, rgba(232,223,208,0.38));
}
.gf a {
  color: var(--gf-link, rgba(232,223,208,0.62));
  text-decoration: none;
}
.gf a:hover { color: var(--gf-link-hover, #E8DFD0); }
.gf-links { display: flex; gap: 24px; }

/* --- Paper ground footer override --- */
.gf.gf-paper {
  --gf-border: rgba(11,28,56,0.08);
  --gf-text: rgba(11,28,56,0.3);
  --gf-link: rgba(11,28,56,0.45);
  --gf-link-hover: #0B1C38;
}

@media (max-width: 640px) {
  .gf {
    flex-direction: column; gap: 16px; text-align: center;
    padding: 32px 24px;
  }
  .gf-links { justify-content: center; flex-wrap: wrap; }
}
