.site-header {
  position: absolute;
  z-index: 2;
  inset-inline: 0;
  top: calc(12px + env(safe-area-inset-top, 0px));
  width: min(calc(100% - 24px), 1274px);
  min-height: 64px;
  padding-inline: clamp(10px, 3.5vw, 30px);
  border: 1px solid transparent;
  border-radius: 20px;
  color: white;
  background-color: rgb(255 255 255 / .10);
  backdrop-filter: blur(12px) saturate(115%);
}

.site-header[data-fixed] { position: fixed; }

.site-header .wordmark {
  font-size: clamp(2.125rem, 3.4vw, 2.625rem);
  letter-spacing: -.075em;
}

.site-header nav a,
.site-header .wordmark {
  text-shadow: 0 1px 12px rgb(0 0 0 / .45);
}

.site-header nav a:hover {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: .35em;
}

.header-demo {
  border: 1px solid rgb(255 255 255 / .5);
  background: rgb(20 24 19 / .34);
  backdrop-filter: blur(12px);
}

.header-demo:hover { background: rgb(20 24 19 / .65); }

.site-header[data-scrolled] {
  color: var(--ink);
  background-color: rgb(255 255 255 / .65);
  background-image: linear-gradient(180deg, rgb(255 255 255 / .26), transparent 75%);
  border-color: rgb(32 37 30 / .24);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .55), 0 6px 24px rgb(25 27 18 / .08);
  backdrop-filter: blur(18px) saturate(120%);
}

.site-header[data-scrolled] :is(nav a, .wordmark) {
  text-shadow: none;
}

.site-header[data-scrolled] .header-demo {
  color: white;
  background: var(--ink);
  border-color: transparent;
  backdrop-filter: none;
}

.site-header[data-scrolled] .header-demo:hover { background: #383838; }

.site-header:not([data-scrolled]) :focus-visible,
.hero-stage :focus-visible {
  outline-color: white;
}

html { scroll-padding-top: var(--header-clearance, 0px); }
main [id] { scroll-margin-top: 12px; }

.site-hero {
  --scroll-distance: clamp(320px, 62svh, 680px);
  --frame-progress: 0;
  --intro-opacity: 1;
  --caption-opacity: 0;
  --frame-gutter: max(var(--gutter), (100% - 1240px) / 2);
}

/* The spacer extends the sticky stage's containing block. */
.site-hero[data-scroll]::after {
  content: "";
  display: block;
  height: var(--scroll-distance);
}

.hero-stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  isolation: isolate;
}

.site-hero[data-scroll] .hero-stage {
  position: sticky;
  top: 0;
}

.hero-frame {
  position: absolute;
  inset: calc(13% * var(--frame-progress))
    calc(var(--frame-gutter) * var(--frame-progress))
    calc(14% * var(--frame-progress));
  overflow: hidden;
  isolation: isolate;
  border-radius: calc(var(--radius) * var(--frame-progress));
  background: #3b4037;
  box-shadow: 0 12px 40px rgb(25 27 18 / calc(.16 * var(--frame-progress)));
}

.hero-frame img {
  width: 100%;
  height: 100%;
  object-position: 52% 50%;
}

.hero-frame::before,
.hero-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-frame::before {
  opacity: var(--intro-opacity);
  background:
    linear-gradient(180deg, rgb(12 17 12 / .64), transparent 25%),
    linear-gradient(0deg, rgb(12 17 12 / .67), transparent 56%),
    radial-gradient(ellipse at 10% 81%, rgb(12 17 12 / .42), transparent 58%);
}

.hero-frame::after {
  opacity: var(--caption-opacity);
  background: linear-gradient(0deg, rgb(12 17 12 / .72), transparent 42%);
}

.hero-intro {
  position: absolute;
  z-index: 1;
  inset-inline: 0;
  bottom: max(clamp(38px, 9svh, 108px), env(safe-area-inset-bottom, 0px));
  color: white;
  opacity: var(--intro-opacity);
}

.hero-intro:focus-within {
  opacity: 1;
  text-shadow: 0 1px 10px rgb(0 0 0 / .65);
}

.hero-intro h1 {
  font-size: clamp(2.6rem, 6vw, 6.4rem);
  font-weight: 550;
  letter-spacing: -.065em;
  line-height: .99;
  text-wrap: initial;
}

.hero-intro p {
  max-width: 38rem;
  margin-top: clamp(14px, 2.3svh, 22px);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.45;
}

.hero-intro .pill {
  min-height: 52px;
  margin-top: clamp(18px, 3svh, 28px);
  padding-inline: 22px;
  visibility: var(--intro-visibility, visible);
}

.hero-intro .pill:hover { background: #eeeee8; }

.hero-caption {
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(19px, 2.6vw, 34px);
  color: white;
  opacity: var(--caption-opacity);
  visibility: var(--caption-visibility, hidden);
}

.hero-caption span {
  display: block;
  margin-bottom: 4px;
  font-size: .8125rem;
}

.hero-caption strong {
  display: block;
  font-size: clamp(1.5rem, 2.6vw, 2.375rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -.045em;
}

@media (max-width: 740px) {
  .site-header {
    top: calc(8px + env(safe-area-inset-top, 0px));
    min-height: auto;
    padding-block: 8px 10px;
    border-radius: 17px;
  }

  .site-header nav {
    flex-wrap: wrap;
    gap: 6px clamp(12px, 4vw, 24px);
    margin-top: 6px;
  }

  .site-header nav a {
    display: flex;
    align-items: center;
    min-height: 28px;
  }

  .hero-frame img { object-position: 57% 50%; }

  .hero-frame::before {
    background:
      linear-gradient(180deg, rgb(12 17 12 / .74), transparent 28%),
      linear-gradient(0deg, rgb(12 17 12 / .82), transparent 58%);
  }

  .hero-intro h1 { font-size: clamp(2rem, 9.2vw, 4rem); }
  .hero-intro p { max-width: 26rem; }
}

@media (max-height: 510px) and (orientation: landscape) {
  .site-header { min-height: 64px; }
  .hero-intro { bottom: max(24px, env(safe-area-inset-bottom, 0px)); }
  .hero-intro h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
  .hero-intro p { margin-top: 10px; }
  .hero-intro .pill { min-height: 44px; margin-top: 12px; }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header { background: #22261f; backdrop-filter: none; }
  .header-demo { background: #22261f; backdrop-filter: none; }
  .site-header[data-scrolled] { background: white; backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .site-hero[data-scroll]::after { display: none; }
  .site-hero[data-scroll] .hero-stage { position: relative; }
}
