/* ============================================================
   Whitepaper / deep-dive site chrome
   Shared sticky nav + footer that make a standalone Mono document
   feel like part of the Dusty Baars portfolio. Uses the host page's
   Mono tokens (--bg, --ink, --accent, --line, ...) so the chrome
   stays in the document's own palette while matching the portfolio's
   structure and typography.
   ============================================================ */

/* Offset in-page anchor jumps for the sticky nav (.wp-sitenav is ~49px tall).
   Without this, every TOC link lands with its heading tucked behind the sticky
   bar. scroll-padding-top is honoured by both the page's smooth scrollIntoView
   (the inline TOC handler) and native on-load fragment navigation. The safe-area
   inset keeps anchors clear when the bar grows behind the Dynamic Island. */
html { scroll-padding-top: calc(72px + env(safe-area-inset-top, 0px)); }
/* Keep the reading-progress bar below the safe-area inset (clear of the notch).
   `html .progress` outranks the page's own inline `.progress` rule. */
html .progress { top: calc(env(safe-area-inset-top, 0px) + 4px); }

.wp-sitenav {
  position: sticky;
  top: 0;
  z-index: 150;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 14px 40px;
  /* Keep nav content clear of the Dynamic Island; the notch strip is filled by the
     fixed html::before bar below (pinned above the nav), independent of the
     backdrop-filter, which iOS does not paint into the safe-area inset. */
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line-soft);
  font-family: "Switzer", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Solid fill for the Dynamic Island / status-bar inset, pinned above the sticky
   nav (z-index 151 > 150) so the bar always covers the notch. Zero height without
   an inset, so no effect on desktop / non-notch browsers. */
html::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0px);
  background: var(--bg);
  z-index: 151;
  pointer-events: none;
}
.wp-sitenav__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: color 160ms ease;
}
.wp-sitenav__brand svg { width: 18px; height: 18px; }
.wp-sitenav__brand:hover { color: var(--accent); }

.wp-sitenav__links {
  display: flex;
  justify-content: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.wp-sitenav__links a {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink-mute);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease;
}
.wp-sitenav__links a:hover { color: var(--ink); border-bottom-color: var(--line); }
.wp-sitenav__links a.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.wp-sitenav__right {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Hamburger toggle — shown only on mobile. chrome.js wires the open/close. */
.wp-sitenav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 9px;
  margin: 0;
  background: none;
  border: 0;
  cursor: pointer;
  position: relative;
  z-index: 160;
}
.wp-sitenav__toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 180ms ease, opacity 180ms ease;
}
.wp-sitenav.is-open .wp-sitenav__toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.wp-sitenav.is-open .wp-sitenav__toggle-bar:nth-child(2) { opacity: 0; }
.wp-sitenav.is-open .wp-sitenav__toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 940px) {
  /* Brand left, language + hamburger right; the links drop into a panel
     beneath the sticky bar when the menu is open (no more hidden links). */
  /* Solid, non-backdrop-filtered bar on phones (Safari 26 Liquid Glass safe-area fix);
     the html::before bar fills the notch. */
  .wp-sitenav { display: flex; align-items: center; gap: 14px; padding: calc(12px + env(safe-area-inset-top, 0px)) 24px 12px; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .wp-sitenav__brand { margin-right: auto; }
  .wp-sitenav__toggle { display: inline-flex; }

  .wp-sitenav__links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 10px 24px 22px;
    background: var(--bg);
    border-bottom: 1px solid var(--line-soft);
    box-shadow: 0 26px 44px -30px rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 220ms ease, transform 220ms ease, visibility 220ms;
  }
  .wp-sitenav.is-open .wp-sitenav__links { opacity: 1; visibility: visible; transform: none; }
  .wp-sitenav__links a { display: block; padding: 11px 0; font-size: 1.0625rem; }
}

/* ---- Footer ---- */
.wp-sitefooter {
  margin-top: 88px;
  padding: 40px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-family: "Switzer", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
.wp-sitefooter__inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  align-items: center;
  justify-content: space-between;
}
.wp-sitefooter__sig {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.wp-sitefooter__sig svg { width: 18px; height: 18px; }
.wp-sitefooter__sig:hover { color: var(--accent); }
.wp-sitefooter__name { font-weight: 600; }
.wp-sitefooter__links {
  display: inline-flex;
  gap: 22px;
  flex-wrap: wrap;
}
.wp-sitefooter__links a {
  color: var(--ink-mute);
  text-decoration: none;
  font-size: 14px;
  transition: color 160ms ease;
}
.wp-sitefooter__links a:hover { color: var(--accent); }
.wp-sitefooter__meta {
  max-width: 920px;
  margin: 22px auto 0;
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

@media (max-width: 600px) {
  .wp-sitefooter__inner { flex-direction: column; align-items: flex-start; }
}
