/* The top inset scrolls out of view before the navigation docks. Its height
   stays in document flow, so shrinking the header never moves the content. */
:root { scrollbar-gutter: stable; --mast-row-height: 3.75rem; }
.mast {
  --inset: 1.25rem;
  position: sticky;
  top: calc(0px - var(--inset));
  z-index: 10;
  padding-top: var(--inset);
  background: var(--mast-background, #fffffff5);
  border-bottom: 1px solid var(--mast-border, #e8e5ea);
  backdrop-filter: blur(14px);
}
.mast-row {
  width: min(91%, 75rem);
  margin: auto;
  min-height: var(--mast-row-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.brand { flex: 0 1 auto; min-width: 0; width: clamp(7.5rem, 17vw, 13rem); }
.brand img { display: block; width: 100%; height: auto; aspect-ratio: 431 / 100; object-fit: contain; transform-origin: left center; }
.mast nav { display: flex; flex: 0 0 auto; max-width: 100%; align-items: center; flex-wrap: wrap; gap: .4rem clamp(.8rem, 2.4vw, 2rem); }
.mast nav a { color: var(--ink); font-size: .94rem; font-weight: 650; text-decoration: none; }
.mast nav a:hover { color: var(--pink); text-decoration: underline; text-underline-offset: .3em; }
.mast .account-link, .mast .theme-toggle { border: 1px solid var(--line); border-radius: 2rem; }
.mast .account-link { padding: .5rem .85rem; }
.mast .theme-toggle {
  display: none; width: 2.5rem; height: 2.5rem; padding: 0;
  font: 1.4rem/1 system-ui, sans-serif; color: var(--ink); background: transparent;
}
[data-theme] .mast .theme-toggle { display: inline-flex; align-items: center; justify-content: center; }
.mast .theme-toggle:hover { color: var(--pink); border-color: currentColor; }
.theme-toggle::before { content: "☾"; }
[data-theme="dark"] .theme-toggle::before { content: "☀"; }
@media screen {
  [data-theme="dark"] .mast { --mast-background: #211b24f5; --mast-border: #514853; }
  [data-theme="dark"] .site-logo { content: url("brand-white.svg"); }
}
/* The first paint already has the expanded geometry. JavaScript only changes
   progress on scroll; loading it must not reposition the navigation row. */
@media screen and (prefers-reduced-motion: no-preference) and (not (scripting: none)) {
  .mast {
    --mast-progress: 0;
    top: 0;
    transform: translateY(calc(-1 * var(--inset) * var(--mast-progress)));
  }
  .mast-row {
    transform: translateY(calc((var(--mast-progress) - 1) * var(--inset) / 2));
  }
  .mast .brand img {
    transform: scale(calc(1 - .15 * var(--mast-progress)));
  }
  .mast-resizing, .mast-resizing .mast-row, .mast-resizing .brand img {
    transition: transform 160ms ease-out;
  }
}
@media (max-width: 37rem) {
  :root { --mast-row-height: 3.35rem; }
  .mast { --inset: .75rem; }
  .mast nav { column-gap: .7rem; }
  .mast nav a { font-size: .85rem; }
  .mast .account-link { padding: .35rem .55rem; }
}
@media (max-width: 27rem) {
  .mast-row { width: 95%; gap: .4rem; }
  .brand { width: 6.35rem; }
  .mast nav { column-gap: .4rem; }
  .mast .theme-toggle { width: 2rem; height: 2rem; }
}
@media (max-width: 23rem) {
  .brand { flex-shrink: 0; }
  .mast nav { flex-shrink: 1; justify-content: flex-end; }
  .mast nav a { font-size: .8rem; }
  .mast .account-link { padding-inline: .4rem; }
}
