/* MacDupl · shared site header
 * One header on every page: generated pages get the markup from
 * scripts/site/chrome.py header(); hand-written pages from the
 * GENERATED:header region scripts/site/build.py splices in. Edit the markup
 * there, never in site/*.html.
 *
 * Look: a floating rounded bar that sticks to the top with a little air
 * around it — paper-white with a hairline and a soft shadow, not a full-bleed
 * strip. Filled cobalt "Buy", outlined "Download". Below 940px the links fold
 * into a <details> menu (no JS needed).
 */
html:has(.hdr) { scroll-padding-top: 92px; }

.hdr {
  position: sticky; top: 0; z-index: var(--z-sticky);
  padding: 10px clamp(0.5rem, 2vw, 1rem) 0;
  font-family: var(--font-body);
  pointer-events: none; /* the gutter around the bar stays click-through */
}
.hdr__bar {
  pointer-events: auto;
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--space-sm);
  height: 60px; padding: 0 10px 0 18px;
  background: color-mix(in oklab, var(--color-paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border: 1px solid var(--color-rule);
  border-radius: 18px;
  box-shadow: 0 1px 2px oklch(20% 0.02 260 / 0.04), 0 10px 30px -14px oklch(20% 0.02 260 / 0.22);
}
.hdr a { text-decoration: none; }
.hdr a:focus-visible, .hdr button:focus-visible, .hdr summary:focus-visible {
  outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: 8px;
}

.hdr__brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em;
  color: var(--color-ink); white-space: nowrap;
}
.hdr__brand svg { width: 24px; height: 24px; flex: none; }
.hdr__plat {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em;
  color: var(--color-muted); white-space: nowrap;
  padding: 2px 8px; border: 1px solid var(--color-rule); border-radius: 999px;
}

.hdr__links { display: flex; align-items: center; gap: 2px; margin-left: var(--space-md); flex: 1; }
.hdr__link {
  padding: 8px 12px; border-radius: 10px;
  font-size: 0.9375rem; font-weight: 500; color: var(--color-ink-2); white-space: nowrap;
  transition: background var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.hdr__link:hover { background: var(--color-paper-2); color: var(--color-ink); }

.hdr__end { display: flex; align-items: center; gap: var(--space-xs); margin-left: auto; }
.hdr__icon {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 10px; border-radius: 10px;
  background: none; border: 0; color: var(--color-ink-2); cursor: pointer; list-style: none;
}
.hdr__icon::-webkit-details-marker { display: none; }
.hdr__icon:hover { background: var(--color-paper-2); color: var(--color-ink); }
.hdr__icon svg { width: 19px; height: 19px; }
.hdr__icon kbd {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--color-muted);
  padding: 0 5px; border: 1px solid var(--color-rule); border-bottom-width: 2px; border-radius: 5px;
}

.hdr__btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 18px; border-radius: 999px;
  font-size: 0.9375rem; font-weight: 600; white-space: nowrap;
  transition: background var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.hdr__btn:active { transform: translateY(1px); }
.hdr__btn svg { width: 17px; height: 17px; }
.hdr__btn--buy { background: var(--color-accent); color: var(--color-accent-ink); border: 1.5px solid var(--color-accent); }
.hdr__btn--buy:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); color: var(--color-accent-ink); }
.hdr__btn--dl { background: transparent; color: var(--color-accent); border: 1.5px solid var(--color-accent); }
.hdr__btn--dl:hover { background: color-mix(in oklab, var(--color-accent) 8%, transparent); color: var(--color-accent); }

/* Menu: only below the breakpoint. */
.hdr__menu { display: none; position: relative; }
.hdr__sheet {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 220px; padding: 6px;
  display: flex; flex-direction: column;
  background: var(--color-paper); border: 1px solid var(--color-rule); border-radius: 14px;
  box-shadow: var(--shadow-panel);
}
.hdr__sheet a { padding: 11px 12px; border-radius: 9px; color: var(--color-ink); font-size: 0.9375rem; font-weight: 500; }
.hdr__sheet a:hover { background: var(--color-paper-2); }
.hdr__sheet a:last-child { margin-top: 4px; border-top: 1px solid var(--color-rule); border-radius: 0 0 9px 9px; color: var(--color-accent); }

@media (max-width: 1060px) {
  .hdr__link { padding: 8px 9px; }
  .hdr__plat { display: none; }
}
@media (max-width: 940px) {
  .hdr__links { display: none; }
  .hdr__menu { display: block; }
  .hdr__icon kbd { display: none; }
}
@media (max-width: 520px) {
  .hdr__bar { padding: 0 6px 0 14px; height: 56px; gap: 4px; }
  .hdr__btn--buy { display: none; } /* still in the menu */
  .hdr__btn { padding: 0 14px; }
}
@media (pointer: coarse) {
  .hdr__btn, .hdr__icon { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .hdr__btn, .hdr__link { transition: none; }
}
@media print { .hdr { display: none; } }
