/* Floating pill header, ported from the Terra Series homepage (site.css) so every Terra page shares it.
   Loads after styles.css and overrides its full-width sticky header. */
:root { --header-gap: 14px; }
html { scroll-padding-top: calc(var(--header-h) + var(--header-gap) + 16px); }

.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: auto; padding: var(--header-gap) 16px;
  background: none; backdrop-filter: none; border-bottom: 0;
  pointer-events: none;
}
.header-pill {
  position: relative; pointer-events: auto;
  max-width: var(--wide); margin-inline: auto;
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--space-3);
  padding-inline: 22px;
}
.header-pill::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid rgba(17,17,17,.07);
  box-shadow: var(--shadow);
}
.brand-mark, .nav, .nav-toggle { position: relative; z-index: 1; }
.brand-word {
  max-width: 12em; overflow: hidden; white-space: nowrap;
  transition: max-width .4s cubic-bezier(.22,.61,.36,1), opacity .3s ease, margin .4s ease;
}

/* The header is fixed, so the hero clears it. */
.hero { padding-top: calc(var(--header-h) + var(--header-gap) + var(--space-4)); }

@media (max-width: 820px) {
  :root { --header-h: 52px; }
  .header-pill::before { opacity: 0 !important; }
  .header-pill { padding-inline: 6px; gap: 0; }

  .brand-mark {
    width: var(--header-h); height: var(--header-h); justify-content: center;
    gap: 0; z-index: 2; border-radius: 999px;
    background: rgba(255,255,255,.82); border: 1px solid rgba(17,17,17,.07);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
  }
  .brand-word { max-width: 0; opacity: 0; margin: 0; }

  .nav-toggle {
    display: inline-flex; margin-left: auto; z-index: 2;
    width: var(--header-h); height: var(--header-h); border-radius: 999px;
    align-items: center; justify-content: center; flex-direction: column; gap: 5px;
    background: rgba(255,255,255,.82); border: 1px solid rgba(17,17,17,.07);
    box-shadow: var(--shadow); cursor: pointer; padding: 0;
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
  }
  .nav-toggle span {
    width: 20px; height: 2px; background: var(--ink); display: block; border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
  }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .nav {
    position: fixed; inset: 0; margin: 0; z-index: 0;
    flex-direction: column; align-items: stretch; justify-content: center; gap: 0;
    padding: max(16vh, 110px) 34px calc(env(safe-area-inset-bottom) + 32px);
    background: rgba(255,255,255,.88);
    -webkit-backdrop-filter: saturate(160%) blur(22px);
    backdrop-filter: saturate(160%) blur(22px);
    border: 0; box-shadow: none; transform: none;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .28s ease, visibility 0s linear .28s;
  }
  .nav.open {
    opacity: 1; visibility: visible; pointer-events: auto; transform: none;
    transition: opacity .28s ease;
  }
  .nav a {
    font-family: var(--font-display); font-size: 1.7rem; font-weight: 600;
    color: var(--ink); padding: 0.55em 0; border-bottom: 1px solid var(--gray-line);
  }
  .nav a:last-child { border-bottom: none; }

  .hero { padding-top: calc(var(--header-h) + var(--header-gap) + var(--space-3)); }
  /* The mobile brand circle is for the header only; keep the footer brand as plain text. */
  .site-footer .brand-mark { width: auto; height: auto; justify-content: flex-start; gap: .55em; background: transparent; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

}
