html:has(body > header) {
  scroll-padding-top: calc(var(--pw-header-height, 7rem) + 1rem);
}

body > header:is(.mast, .header, .site-header),
body.gc-page > header.header,
body.validator-edition > header {
  position: sticky;
  top: 0;
  z-index: 20;
}

body > :is(.skip, .gc-skip):focus {
  position: fixed;
  z-index: 21;
}

.studio-story .story-contents {
  top: calc(var(--pw-header-height, 7rem) + 1rem);
  max-height: calc(100dvh - var(--pw-header-height, 7rem) - 2rem);
}

@media (max-width: 48rem) {
  .studio-story .story-contents { max-height: none; }
}

body > .mast #nav.open {
  max-height: calc(100dvh - var(--pw-header-height, 7rem));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pw-back-to-top {
  position: fixed;
  inset-inline-end: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 19;
  display: grid;
  place-items: center;
  inline-size: max(48px, 2.75rem);
  block-size: max(48px, 2.75rem);
  padding: 0;
  border: 1px solid #fffdf7;
  border-radius: 2px;
  background: #202b2a;
  color: #fffdf7;
  box-shadow: 0 2px 12px #202b2a40;
  font: 600 1.5rem/1 system-ui, sans-serif;
  cursor: pointer;
}

.pw-back-to-top[hidden] { display: none; }

.pw-back-to-top:hover { background: #873425; }

.pw-back-to-top:focus-visible {
  outline: 3px solid #de702c;
  outline-offset: 3px;
}
