/* Phase 5D adds three case-specific stages to the established environmental system. */
.case-page[data-environment] .masthead-5d {
  --masthead-edge: #102a35;
  --masthead-light: #3b626b;
  --masthead-width: 57%;
  padding-block: clamp(29px,4vw,57px) clamp(18px,3vw,38px);
  min-height: clamp(420px,39vw,555px);
  background: radial-gradient(ellipse 65% 105% at 92% 3%,var(--masthead-light),transparent 85%),
              linear-gradient(180deg,#102a36,var(--masthead-edge));
}
.case-page[data-environment] .masthead-copy {
  position: relative;
  z-index: 1;
  max-width: min(52%,640px);
}
.case-page[data-environment] .masthead-copy h1 {
  font-size: clamp(43px,5.45vw,81px);
  text-wrap: balance;
}
.case-page[data-environment] .masthead-copy .case-meta {
  background: linear-gradient(90deg,#0c222b65,transparent);
}
.masthead-art {
  position: absolute;
  inset: 0 0 0 auto;
  width: var(--masthead-width);
  margin: 0;
  overflow: hidden;
  isolation: isolate;
}
.masthead-view { position: absolute; inset: 0; }
.masthead-view img { display: block; }
.masthead-art figcaption {
  position: absolute;
  right: var(--editorial-inset);
  bottom: 13px;
  z-index: 3;
  max-width: calc(100% - 2 * var(--editorial-inset));
  padding: 4px 7px;
  background: #0b2029;
  color: #dce2dc;
  font-size: 11px;
  line-height: 1.5;
}
.masthead-cd .masthead-view,
.masthead-custom .masthead-view {
  mask-image: linear-gradient(90deg,transparent,#0003 13%,#000 41%),
              linear-gradient(0deg,transparent,#000 24%);
  mask-composite: intersect;
}
.masthead-cd img,
.masthead-custom img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.masthead-cd img { object-position: 64% 58%; }
.masthead-custom img { object-position: 67% 56%; }
.case-page[data-environment] .masthead-5d:has(.masthead-cd) {
  --masthead-light: #2a4a59;
  --masthead-width: 60%;
}
.case-page[data-environment] .masthead-5d:has(.masthead-custom) {
  --masthead-light: #3b4843;
  --masthead-edge: #122931;
  --masthead-width: 59%;
}
.masthead-custom .masthead-view {
  mask-image: linear-gradient(90deg,transparent,#0002 19%,#000 47%),
              linear-gradient(0deg,transparent,#000 24%);
}
.masthead-digital .masthead-view {
  background: radial-gradient(ellipse 68% 74% at 72% 43%,#7398a04d,transparent 76%);
}
.masthead-digital .masthead-view::after {
  content: "";
  position: absolute;
  inset: 77% 5% auto 13%;
  height: 1px;
  background: linear-gradient(90deg,transparent,#b6c8c64d,transparent);
  z-index: -1;
}
.masthead-digital img {
  position: absolute;
  height: auto;
  border: 1px solid #90a2a0;
  box-shadow: 0 22px 47px #061922b3;
}
.masthead-digital .masthead-web {
  width: 72%;
  left: 15%;
  top: 22%;
  transform: rotate(-4deg);
}
.masthead-digital .masthead-mobile {
  width: 42%;
  right: 6%;
  top: 47%;
  transform: rotate(5deg);
}
.case-page[data-environment] [data-masthead-exhibit] { margin-top: 18px; }
.case-page[data-environment] [data-masthead-exhibit]::before {
  height: 3px;
  background: linear-gradient(90deg,#dcb098,#a9988b 46%,transparent);
}
.case-cd[data-environment] .ownership-heading {
  min-height: 0;
  background: linear-gradient(110deg,#14313d,#274650);
}
.case-cd[data-environment] .ownership-heading::before { display: none; }
.case-cd[data-environment] .ownership-heading h2 { max-width: 20ch; }

@media (max-width: 1000px) {
  .case-page[data-environment] .masthead-copy { max-width: 55%; }
  .masthead-digital .masthead-web { top: 27%; }
  .masthead-digital .masthead-mobile { top: 49%; }
}
@media (max-width: 760px) {
  .case-page[data-environment] .masthead-5d { min-height: 0; padding-block: 18px 13px; }
  .case-page[data-environment] .masthead-copy { max-width: none; }
  .case-page[data-environment] .masthead-copy h1 { font-size: clamp(38px,8.8vw,64px); }
  .masthead-art {
    position: relative;
    inset: auto;
    width: auto;
    height: clamp(198px,58vw,360px);
    margin: 4px calc(-1 * var(--editorial-inset)) 0;
  }
  .masthead-view { bottom: 30px; }
  .masthead-art figcaption { bottom: 3px; }
  .masthead-cd .masthead-view,
  .masthead-custom .masthead-view {
    mask-image: linear-gradient(0deg,transparent,#000 20%,#000 88%,transparent);
  }
  .masthead-cd img { object-position: 67% 51%; }
  .masthead-custom img { object-position: 68% 58%; }
  .masthead-digital .masthead-web { width: 67%; top: 14%; left: 11%; }
  .masthead-digital .masthead-mobile { width: 40%; top: 44%; right: 9%; }
}
@media (max-width: 360px) {
  .masthead-art figcaption { font-size: 10px; }
  .masthead-digital .masthead-web { top: 15%; }
  .masthead-digital .masthead-mobile { top: 46%; }
}

@supports ((animation-timeline: view()) and (animation-range: entry)) {
  @media (prefers-reduced-motion: no-preference) {
    html[data-motion="full"] .portfolio-home[data-environment] .opening-art img {
      animation-name: masthead-departure;
      animation-range: exit 0% exit 77%;
    }
    html[data-motion="full"] .portfolio-home[data-environment] #work {
      view-timeline-name: --work-arrival;
    }
    html[data-motion="full"] .portfolio-home[data-environment] #work::before {
      animation: work-light linear both;
      animation-timeline: --work-arrival;
      animation-range: entry 0% entry 65%;
    }
    html[data-motion="full"] .portfolio-home[data-environment] .chapter-image img {
      animation-name: corridor-arrival;
      animation-range: entry 0% entry 88%;
    }
    html[data-motion="full"] .masthead-5d { view-timeline-name: --case-departure; }
    html[data-motion="full"] .masthead-5d .masthead-view {
      animation: leave-case-stage linear both;
      animation-timeline: --case-departure;
      animation-range: exit 0% exit 72%;
    }
    html[data-motion="full"] [data-masthead-exhibit]::before {
      animation-name: meet-case-stage;
      animation-range: entry 0% entry 61%;
    }
  }
}
@keyframes masthead-departure {
  from { scale: 1; }
  83%,to { scale: 1.19; }
}
@keyframes work-light {
  from { opacity: .36; }
  82%,to { opacity: 1; }
}
@keyframes corridor-arrival {
  from { transform: scale(1.25) translate(-4.5%,7%); }
  82%,to { transform: scale(1.025); }
}
@keyframes leave-case-stage {
  from { transform: scale(1); }
  81%,to { transform: scale(1.135) translateY(-1.5%); }
}
@keyframes meet-case-stage {
  from { transform: scaleX(.10); opacity: .45; }
  80%,to { transform: scaleX(1); opacity: 1; }
}
@media print {
  .masthead-art { display: none; }
  .case-page[data-environment] .masthead-copy { max-width: none; }
}
