/* The header stays on its original grid. Its initial state sits above the pale cover. */
body:has(.hero-shell) .d1-header:not(.is-compact, .is-menu-open, .is-solid) {
  color: var(--ink);
  background: var(--cream);
}
body:has(.hero-shell) .d1-header .header-inner {
  border-bottom-color: transparent;
}
body:has(.hero-shell) .d1-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: var(--line);
  pointer-events: none;
}
body:has(.hero-shell) .d1-header :focus-visible {
  outline-color: var(--clay);
}

.hero-shell {
  --hero-inset: var(--gutter);
  --hero-header: var(--measured-header, var(--header-height));
  --hero-sand: 248 234 215;
  --hero-paper: rgb(var(--hero-sand));
  position: relative;
  isolation: isolate;
  padding-top: var(--hero-header);
  background: var(--hero-paper);
  color: var(--ink);
  touch-action: pan-y pinch-zoom;
}
.hero-stage { position: relative; }
.hero-slides {
  display: grid;
  grid-template: auto auto / minmax(0, 1fr);
}
.hero-slide {
  grid-area: 1 / 1 / span 2;
  display: grid;
  grid-template-rows: subgrid;
  grid-template-columns: minmax(0, 1fr);
  position: relative;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .55s ease, visibility 0s .55s;
}
.hero-slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
  pointer-events: auto;
  transition-delay: 0s;
}
/* Match the image row across slides, including slides without a photo. */
.hero-media {
  position: relative;
  grid-row: 1;
  inline-size: 100%;
  aspect-ratio: 1.9;
  max-block-size: 21rem;
  overflow: hidden;
  mask-image: linear-gradient(#000 84%, transparent);
}
.hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hero-focus-x, 50%) 38%;
}
.hero-slide[data-photo-focus="left"] { --hero-focus-x: 0%; }
.hero-slide[data-photo-focus="right"] { --hero-focus-x: 100%; }
.hero-copy {
  grid-row: 2;
  padding: 16px var(--hero-inset) 12px;
  overflow-wrap: break-word;
}
.hero-copy .hero-accent {
  margin: 0 0 10px;
  color: var(--clay-hover);
  font: 700 .75rem/1.5 var(--body);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero-copy :is(h1, h2) {
  margin: 0;
  color: var(--ink);
  font: 500 clamp(2rem, 5vw + .9rem, 3.25rem) / .98 var(--display);
  text-wrap: balance;
}
.hero-description {
  max-width: 42ch;
  margin-top: 12px;
  font-size: clamp(.9375rem, 2.25vw, 1.0625rem);
  line-height: 1.55;
}
.hero-copy .btn {
  max-width: 100%;
  min-height: 44px;
  margin-top: 16px;
  border-radius: 32px;
  white-space: normal;
  text-align: center;
  background: var(--clay-hover);
  color: white;
}
.hero-copy .btn:hover { background: var(--ink); }
.hero-controls {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  padding: 4px var(--hero-inset) 16px;
}
.hero-controls[inert] { visibility: hidden; }
.hero-controls .icon-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  color: var(--clay-hover);
  background: var(--cream);
  border-color: var(--clay-hover);
}
.hero-controls .icon-btn .icon { width: 19px; height: 19px; }
.hero-controls .icon-btn:hover {
  color: var(--cream);
  background: var(--clay-hover);
}
.hero-count {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  font: 500 .875rem/1 var(--body);
  font-variant-numeric: tabular-nums;
}
.hero-current { color: var(--clay-hover); font-size: 1.25rem; font-weight: 750; }
.hero-next-topic {
  display: grid;
  align-content: center;
  gap: 2px;
  max-width: 32ch;
  min-width: 0;
  color: var(--ink);
  font: 650 .875rem/1.3 var(--body);
  overflow-wrap: anywhere;
}
.hero-next-label {
  color: var(--clay-hover);
  font: 700 .6875rem/1.2 var(--body);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.trust-line {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block: 1px solid var(--line);
  background: var(--cream);
}
.trust-line > a {
  display: grid;
  place-items: center;
  padding: 14px 6px;
  font-size: clamp(.75rem, 1.35vw, .9375rem);
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
}
.trust-line > a + a { border-inline-start: 1px solid var(--line); }
.trust-line > a:hover { background: var(--surface-hover); }
.hero-shell :focus-visible {
  outline: 2px solid var(--clay-hover);
  outline-offset: 3px;
}
.trust-line > a:focus-visible { outline-offset: -4px; }

@media (max-width: 899px) {
  .hero-next-topic { min-block-size: 3.2rem; }
}
@media (max-width: 359px) {
  .hero-next-topic { min-block-size: 4.4rem; }
}
@media (max-width: 430px) and (max-height: 650px) {
  .hero-media { aspect-ratio: 2.03; }
}
@media (max-width: 899px) and (orientation: landscape) and (max-height: 499px) {
  .hero-media { max-block-size: 48vh; }
}

@media (min-width: 900px) {
  .hero-shell { --hero-inset: clamp(32px, 7.8vw, 17rem); }
  .hero-stage {
    display: grid;
    grid-template: minmax(min-content, 1fr) auto / minmax(0, 1fr);
    min-block-size: calc(97vh - var(--hero-header));
    min-block-size: calc(97svh - var(--hero-header));
  }
  .hero-slides {
    grid-area: 1 / 1 / span 2;
    display: grid;
    grid-template-rows: subgrid;
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-media {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
    max-block-size: none;
    mask-image: none;
  }
  .hero-media img { object-position: var(--hero-focus-x, 50%) 47%; }
  .hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg,
      rgb(var(--hero-sand) / 61%), rgb(var(--hero-sand) / 32%) 33%, transparent 60%);
  }
  .hero-slide[data-hero-illustration] .hero-media::after {
    background: linear-gradient(90deg, rgb(var(--hero-sand) / 40%), rgb(var(--hero-sand) / 24%) 32%, transparent 58%);
  }
  .hero-copy {
    grid-area: 1 / 1;
    align-self: center;
    position: relative;
    box-sizing: content-box;
    width: min(45vw, 49rem);
    padding: clamp(24px, 5vh, 65px) 0;
    margin-inline-start: var(--hero-inset);
  }
  .hero-copy :is(h1, h2) {
    font-size: clamp(3.25rem, 5.05vw, 6.2rem);
    line-height: .94;
  }
  .hero-copy h1 { max-width: 6.5em; }
  .hero-copy .hero-accent { margin-bottom: 16px; font-size: clamp(.75rem, .85vw, 1rem); }
  .hero-description {
    max-width: 44ch;
    margin-top: 19px;
    font-size: clamp(1rem, 1.2vw, 1.375rem);
  }
  .hero-copy .btn {
    margin-top: 20px;
    min-height: clamp(44px, 3.6vw, 58px);
    padding-inline: clamp(18px, 1.6vw, 30px);
    font-size: clamp(.875rem, 1.04vw, 1.1875rem);
  }
  .hero-controls {
    grid-area: 2 / 1;
    justify-self: start;
    max-width: 62%;
    padding-block: 0 clamp(18px, 3.4vh, 44px);
  }
  .hero-next-topic { min-block-size: calc(2lh + .825rem + 2px); }
  .trust-line > a { min-height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-slide { transition: none; }
}
