/* DeSpy site chrome — the ONE canonical header + footer, shared byte-for-byte
   across every public page (homepage, legal, forms, blog, Q&A, newsletter,
   learn, brokers). Extracted from the homepage (public/index.html) so the whole
   site keeps one identity.

   Scope discipline: this file styles ONLY the chrome (.nav / .brand / .footer /
   .footer-nav / .socials and friends) plus the tiny `body.chrome` accommodation
   that lets the fixed nav sit on standalone (non-hero) pages. It must NOT restyle
   page bodies — no article/main/h1/h2 rules live here. The design tokens are the
   full set the blog/learn stylesheets rely on, so this doubles as the token
   source; a page with a different palette (the dark form pages) keeps its own by
   re-declaring the colliding tokens in an inline <style> that loads AFTER this
   file — the chrome only ever reads --sage / --forest, which those pages leave
   untouched. */

:root {
  color-scheme: light;
  --forest: #061513;
  --forest-2: #0b2821;
  --forest-3: #12392f;
  --ink: #101915;
  --muted: #54625b;
  --paper: #fbf8f1;
  --paper-2: #f4f0e7;
  --line: #ddd8ce;
  --sage: #bfe0b9;
  --sage-2: #8eb487;
  --cream: #fffdf8;
  --link: #1c6b52;
  --shadow: 0 24px 60px rgba(20, 31, 24, .14);
  --serif: Georgia, "Times New Roman", ui-serif, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* --- header / nav ------------------------------------------------------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: min(72rem, calc(100% - 2rem));
  min-height: 5rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  isolation: isolate;
}
.nav::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: -1;
  opacity: 0;
  background: rgba(6, 21, 19, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(191, 224, 185, .14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  transition: opacity 220ms ease;
}
.nav.is-scrolled::before {
  opacity: 1;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}
.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  color: var(--sage);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(.7rem, 1.8vw, 1.5rem);
  font-size: .92rem;
}
.nav-links a {
  color: rgba(255, 255, 255, .88);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding: .35rem 0;
}
.nav-links a:hover,
.nav-links a:focus-visible {
  border-color: var(--sage);
  outline: 0;
}
.nav-links a[aria-current="page"] {
  color: #ffffff;
  border-color: var(--sage);
}
.nav-cta {
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  gap: .55rem;
  padding: .85rem 1.35rem;
  border: 1px solid rgba(191, 224, 185, .72);
  border-radius: 7px;
  color: #061513;
  background: linear-gradient(180deg, #d7edcf, var(--sage));
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(191, 224, 185, .16);
}
.nav-cta:hover {
  transform: translateY(-1px);
}

/* --- footer ------------------------------------------------------------- */
.footer {
  color: rgba(255, 255, 255, .84);
  background:
    radial-gradient(circle at 92% 80%, rgba(191, 224, 185, .12), transparent 16rem),
    var(--forest);
}
.footer-inner {
  width: min(72rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.8rem 0 2.1rem;
  display: grid;
  grid-template-columns: 1.2fr repeat(3, minmax(8rem, .7fr));
  gap: 2rem;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.footer .brand {
  font-size: 1.3rem;
}
.footer p {
  margin: .7rem 0 1.4rem;
  color: rgba(255, 255, 255, .8);
}
.footer small {
  color: rgba(255, 255, 255, .65);
}
.footer-nav {
  display: grid;
  gap: .55rem;
  align-content: start;
  font-size: .9rem;
}
.footer-nav a {
  color: rgba(255, 255, 255, .78);
  text-decoration: none;
}
.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--sage);
  outline: 0;
}
.socials {
  display: flex;
  gap: .8rem;
  align-items: start;
}
.socials a {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--sage);
  background: rgba(191, 224, 185, .12);
  text-decoration: none;
  font-weight: 900;
}

/* --- standalone (non-hero) pages ---------------------------------------
   The homepage nav floats transparent over the dark hero and only gains its
   solid backdrop on scroll. Every OTHER page opts in with `class="chrome"` on
   <body>: the nav backdrop is solid from the start (so its light text is
   readable over a light page) and the page content clears the fixed bar. In-page
   anchor targets get a matching scroll offset so headings aren't hidden beneath
   the nav. */
body.chrome {
  padding-top: 5rem;
}
body.chrome .nav::before {
  opacity: 1;
}
body.chrome :target {
  scroll-margin-top: 5.5rem;
}

/* Mobile menu toggle — injected by site-chrome.js (it is useless without JS,
   so it never appears in the static markup). Hidden on desktop. */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 8px;
  padding: .55rem .6rem;
  cursor: pointer;
  line-height: 0;
  color: #f4faf3;
}
.nav-toggle svg {
  width: 1.35rem;
  height: 1.35rem;
  stroke: currentColor;
}
.nav-toggle:hover,
.nav-toggle:focus-visible {
  border-color: var(--sage, #bfe0b9);
  color: var(--sage, #bfe0b9);
}

@media (max-width: 980px) {
  .nav {
    align-items: center;
    padding-top: 0;
    flex-wrap: wrap;
  }
  .nav-toggle {
    display: inline-flex;
    order: 2;
    margin-left: auto;
  }
  .nav-cta {
    order: 3;
    margin-left: .6rem;
  }
  /* Collapsed by default; .menu-open (toggled by site-chrome.js) reveals the
     links as a full-width dropdown panel under the bar. */
  .nav-links {
    display: none;
  }
  .nav.menu-open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    order: 4;
    flex-basis: 100%;
    gap: 0;
    margin-top: .6rem;
    padding: .4rem .9rem .6rem;
    /* Own solid panel background so links stay readable regardless of what the
       page paints behind the (fixed, otherwise-transparent-at-top) nav. */
    background: #07130f;
    border-top: 1px solid rgba(255, 255, 255, .18);
    border-radius: 0 0 12px 12px;
  }
  .nav.menu-open .nav-links a {
    padding: .85rem .5rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }
  .nav.menu-open .nav-links a:last-child {
    border-bottom: 0;
  }
  /* Solid backdrop behind the bar too, so the brand + toggle never float over
     light page content while the menu is open. */
  .nav.menu-open::before {
    opacity: 1;
  }
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .nav {
    min-height: 4.4rem;
  }
  .brand-mark {
    width: 2rem;
    height: 2rem;
  }
  .nav-cta {
    min-height: 2.65rem;
    padding: .7rem .9rem;
    font-size: .88rem;
  }
  body.chrome {
    padding-top: 4.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav::before {
    transition: none;
  }
  .nav-cta:hover {
    transform: none;
  }
}
