/* Toolbar navigation, ported from the Furlong site so the two share one
   language. The bar stays put; it only grows a hairline and a blur once you
   have actually left the top. */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  transition: box-shadow .3s ease, background-color .3s ease;
}
.topbar.stuck {
  box-shadow: 0 1px 0 var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(120%) blur(9px);
  -webkit-backdrop-filter: saturate(120%) blur(9px);
}

/* The bar borrows the page's .wrap for alignment, so cancel that wrap's tall
   vertical padding. Only the masthead sets the bar's height. */
.topbar > .wrap { padding-top: 0; padding-bottom: 0; }

.masthead {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem 1rem;
  padding: 1.5rem 0 1.2rem;
}
.masthead .wordmark {
  font-size: .8rem; letter-spacing: .34em; font-weight: 700;
  color: var(--hint); text-decoration: none;
}
.masthead .wordmark:hover { color: var(--ink); }

.masthead nav {
  position: relative;
  display: flex; flex-wrap: wrap; gap: .4rem 1.3rem;
  padding-bottom: .45rem;
}
.masthead nav a {
  position: relative;
  font-size: .86rem; color: var(--hint); text-decoration: none;
  transition: color .28s ease;
}
.masthead nav a:hover,
.masthead nav a.is-active { color: var(--ink); }

/* The rule under the nav. One element, moved with a transform so it never
   reflows the links. */
.nav-ink {
  position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--ink); opacity: 0; pointer-events: none;
  transition: transform .44s cubic-bezier(.22,.7,.24,1),
              width .44s cubic-bezier(.22,.7,.24,1),
              opacity .25s ease;
}
@media (prefers-reduced-motion: reduce) {
  .nav-ink { transition: none; }
}

/* Moving between pages swaps <main id="page"> in place, so the bar above it
   never reloads. Browsers with View Transitions morph between the two; the
   rest get the fade below. Naming #page lifts it out of the root snapshot so
   the masthead holds still and only the content under it moves. */
#page { view-transition-name: page; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(page) { animation: page-fade-out .22s ease both; }
::view-transition-new(page) { animation: page-fade-in .40s cubic-bezier(.2,.7,.3,1) both; }
@keyframes page-fade-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes page-fade-in  { from { opacity: 0; transform: translateY(14px); } }

#page { transition: opacity .18s ease, transform .18s ease; }
#page.page-out      { opacity: 0; transform: translateY(-6px); }
#page.page-in-start { opacity: 0; transform: translateY(10px); transition: none; }

html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }

@media (prefers-reduced-motion: reduce) {
  #page { view-transition-name: none; }
  html { scroll-behavior: auto; }
}

/* One footer shape on every page: the other pages, then contact, then the
   line. Links carry their own spacing so the markup stays plain. */
footer p { margin: 0 0 .5rem; }
footer p a { margin-right: 1.4rem; }
footer p a:last-child { margin-right: 0; }
footer .small { color: var(--hint); font-size: .85rem; margin: 0; }

/* ---- the cover mark ---- */
/* Full-bleed band. Without the wrapper the bare <svg> contributes its 1000-unit
   viewBox as an intrinsic width and pushes the page wider than the phone. */
.markband { width: 100%; max-width: 100%; overflow: hidden; line-height: 0; }
.mark { display: block; width: 100%; height: clamp(120px, 22vw, 210px); }
.mark path {
  fill: none; stroke-linecap: round; stroke-width: 2.2; opacity: .85;
  /* Must exceed the true path length, or the tail of each ribbon lands in the
     dash gap and never draws. */
  stroke-dasharray: 2600; stroke-dashoffset: 2600;
  animation: draw 1.5s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .mark path { animation: none; stroke-dashoffset: 0; }
}
