/* Fixed header (transparent over the painting, solid once you scroll) and the menu drawer. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.site-header {
  --head-fg: var(--on-art);
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-header);
  color: var(--head-fg);
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: var(--max);
  height: var(--header-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.4rem);
  letter-spacing: -0.01em;
  line-height: 1;
}

.site-nav ul {
  display: flex;
  gap: clamp(20px, 3vw, 44px);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* scrolled: the header turns into a paper bar */
html[data-scrolled="true"] .site-header {
  --head-fg: var(--text);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  box-shadow: 0 1px 0 var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

html[data-scrolled="true"] .site-header .uv-pill {
  --pill-bg: var(--ink-900);
  --pill-fg: var(--cream-50);
  --pill-wipe: var(--cobalt-600);
  --pill-hover-fg: var(--cream-50);
}

html[data-theme="night"][data-scrolled="true"] .site-header .uv-pill {
  --pill-bg: var(--cream-100);
  --pill-fg: var(--ink-900);
  --pill-wipe: var(--gold-500);
  --pill-hover-fg: var(--ink-900);
}

html[data-scrolled="true"] .site-header .uv-burger__btn:focus-visible + .uv-burger__toggle {
  outline-color: var(--focus);
}

/* drawer */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: var(--z-drawer);
  width: min(440px, 100vw);
  padding: 112px clamp(24px, 4vw, 44px) 40px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 100% 0, rgb(169 198 195 / 0.28), transparent 55%),
    var(--cobalt-800);
  color: var(--on-art);
  visibility: hidden;
  transform: translateX(104%);
  transition: transform 0.5s var(--ease), visibility 0s linear 0.5s;
}

html:has(#menu-toggle[aria-expanded="true"]) .drawer {
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

html:has(#menu-toggle[aria-expanded="true"]) .site-header {
  z-index: calc(var(--z-drawer) + 1); /* keeps the menu button above the open drawer */
  --head-fg: var(--on-art);
  background: var(--cobalt-800);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html:has(#menu-toggle[aria-expanded="true"]) .site-header .uv-pill {
  --pill-bg: var(--cream-100);
  --pill-fg: var(--ink-900);
  --pill-wipe: var(--ink-900);
  --pill-hover-fg: var(--cream-100);
}

html:has(#menu-toggle[aria-expanded="true"]) .uv-burger__btn:focus-visible + .uv-burger__toggle {
  outline-color: var(--art-focus);
}

/* the back-to-top button sits above the drawer in z-order; the open menu doesn't need it */
html:has(#menu-toggle[aria-expanded="true"]) .uv-top {
  visibility: hidden;
}

.drawer__links {
  display: grid;
  gap: 4px;
}

.drawer__settings {
  display: grid;
  gap: 14px;
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid rgb(246 244 238 / 0.3);
}

.drawer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 1rem;
}

@media (max-width: 1023px) {
  .site-nav {
    display: none;
  }
}

@media (max-width: 559px) {
  .site-header__actions .uv-pill {
    display: none;
  }
}
