:root { --route-label-top: calc(var(--chapter-header, 76px) + clamp(26px, 4.5svh, 52px)); }
/* The high label stays separate; headline and explanation form one centred
   composition between equal flexible spaces. Text stays in normal flow. */
main.page-shell > section.page-intro,
html.chapter-scroll main.page-shell > section.page-intro {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  align-content: stretch;
  padding-top: var(--route-label-top);
  padding-bottom: clamp(64px, 9.5svh, 110px);
  row-gap: 0;
}
main.page-shell > section.page-intro > .eyebrow { grid-row: 1; margin: 0; align-self: start; }
main.page-shell > section.page-intro > h1 {
  grid-row: 3;
  align-self: center;
  justify-self: center;
  text-align: center;
  width: min(100%, 1200px);
  max-width: 1200px;
  margin: 0;
  padding-block: .045em;
  overflow: visible;
  clip-path: none;
  text-wrap: balance;
}
main.page-shell > section.page-intro > .page-intro__body,
html.chapter-scroll main.page-shell > section.page-intro > .page-intro__body {
  grid-row: 4;
  justify-self: center;
  width: min(100%, 54ch);
  max-width: 54ch;
  margin: clamp(24px, 3.5svh, 38px) 0 0;
  text-align: center;
  text-wrap: balance;
}
main.page-shell > section.page-intro > .back-link {
  position: absolute;
  top: calc(var(--chapter-header, 76px) + 24px);
  left: var(--gutter);
  margin: 0;
}
main.page-shell > section.page-intro:has(> .back-link) { padding-top: calc(var(--chapter-header, 76px) + 88px); }
main.page-shell > section.page-intro > .case-page__location { grid-row: 5; align-self: start; justify-self: center; margin: 12px 0 0; font-size: 12px; text-align: center; color: #666; }
.page-intro__body, .contact-intro__body { position: relative; }
.page-intro__typing { position: absolute; inset: 0; pointer-events: none; }
.page-intro__copy-animating .page-intro__text-source { opacity: 0; }
.page-intro__copy-animating .page-intro__character { animation: page-intro-character 1ms linear both; animation-delay: calc(680ms + var(--typing-index) * 8ms); }
@keyframes page-intro-character { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 767px) {
  :root { --route-label-top: calc(var(--chapter-header, 70px) + 28px); }
  main.page-shell > section.page-intro,
  html.chapter-scroll main.page-shell > section.page-intro { padding-top: var(--route-label-top); padding-bottom: 64px; }
  main.page-shell > section.page-intro > .page-intro__body,
  html.chapter-scroll main.page-shell > section.page-intro > .page-intro__body { margin-top: 24px; }
  main.page-shell > section.page-intro:has(> .back-link) { padding-top: calc(var(--chapter-header, 70px) + 88px); }
}

@media (max-height: 600px) {
  main.page-shell > section.page-intro,
  html.chapter-scroll main.page-shell > section.page-intro { min-height: auto; grid-template-rows: auto auto auto; row-gap: 24px; padding-bottom: 32px; }
  main.page-shell > section.page-intro > h1 { grid-row: 2; padding-block: 20px; }
  main.page-shell > section.page-intro > .page-intro__body,
  html.chapter-scroll main.page-shell > section.page-intro > .page-intro__body { grid-row: 3; margin-top: 0; }
  main.page-shell > section.page-intro > .case-page__location { grid-row: 4; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .page-intro__copy-animating .page-intro__text-source { opacity: 1; }
  .page-intro__typing { display: none; }
  .page-intro__character { animation: none !important; }
}

/* Hold the PHP first paint and route replacement until entrance effects exist.
   No-script/reduced-motion visitors see the normal text. The delayed release
   also leaves the page readable if a browser module fails to load. */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  :is(.page-intro, .contact-intro)[data-intro-pending] > :is(h1, .page-intro__body, .contact-intro__body) {
    visibility: hidden;
    animation: page-intro-pending-release 0s 4s forwards;
  }
}
@keyframes page-intro-pending-release { to { visibility: visible; } }
