/* V22 subpage portraits. Only explicitly marked scenes participate. Existing
   headings, actions, figures and page grids keep their layout and semantics. */
body #main .v22-cutout-stage {
  --v22-scene-height: 410px;
  --v22-scene-width: 560px;
  --v22-scene-wash: linear-gradient(145deg,#edf6ef 3%,#dce9f2 55%,#c6ddd7 100%);
}

body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage:is(.v9-hero-visual,.v17-hero-visual,.v17-sh-hero-visual,.v17-sh-profile-visual,.v22-cutout-stage--team) {
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: var(--v22-scene-width);
  height: var(--v22-scene-height);
  min-height: 0;
  max-height: none;
  padding: 0;
  margin: 0 auto;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Replace the old job/district backdrop on its existing pseudo-element.
   Decorations stay inside the scene: no off-canvas blobs or following object. */
body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage:is(.v9-hero-visual,.v17-hero-visual,.v17-sh-hero-visual,.v17-sh-profile-visual,.v22-cutout-stage--team)::before {
  content: '';
  position: absolute;
  inset: 16% 4% 0;
  width: auto;
  height: auto;
  z-index: -2;
  border: 0;
  border-radius: 47% 46% 20px 20px;
  background: var(--v22-scene-wash);
  box-shadow: inset 0 0 0 1px #ffffff80;
  opacity: 1;
  transform: none;
  filter: none;
  animation: none;
  transition: none;
  pointer-events: none;
}

body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage:is(.v9-hero-visual,.v17-hero-visual,.v17-sh-hero-visual,.v17-sh-profile-visual,.v22-cutout-stage--team)::after {
  content: '';
  position: absolute;
  inset: 28% 11% auto auto;
  width: 42%;
  height: 48%;
  z-index: -1;
  background: url('/assets/logo-white.webp') center / contain no-repeat;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  opacity: .32;
  transform: none;
  filter: none;
  animation: none;
  transition: none;
  pointer-events: none;
}

/* A frame may also be the stage itself. Reset its old crop/card surface in
   either arrangement; only a descendant frame receives the stage's height. */
body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage:is(.v9-hero-visual,.v17-hero-visual,.v17-sh-hero-visual,.v17-sh-profile-visual,.v22-cutout-stage--team).v22-cutout-frame,
body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage:is(.v9-hero-visual,.v17-hero-visual,.v17-sh-hero-visual,.v17-sh-profile-visual,.v22-cutout-stage--team) .v22-cutout-frame {
  position: relative;
  min-width: 0;
  min-height: 0;
  max-height: none;
  padding: 0;
  margin: 0 auto;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  aspect-ratio: auto;
}

body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage:is(.v9-hero-visual,.v17-hero-visual,.v17-sh-hero-visual,.v17-sh-profile-visual,.v22-cutout-stage--team) .v22-cutout-frame {
  height: var(--v22-scene-height);
}

body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage:is(.v9-hero-visual,.v17-hero-visual,.v17-sh-hero-visual,.v17-sh-profile-visual,.v22-cutout-stage--team) picture.v22-cutout-picture {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: var(--v22-scene-height);
  min-height: 0;
  max-height: none;
  padding: 0;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  aspect-ratio: auto;
}

/* The image box follows the person's intrinsic proportions. A 4:5 portrait
   at 430px high is approximately 344px wide, matching its responsive sizes. */
body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage:is(.v9-hero-visual,.v17-hero-visual,.v17-sh-hero-visual,.v17-sh-profile-visual,.v22-cutout-stage--team) picture.v22-cutout-picture > img.v22-cutout-image {
  position: relative;
  display: block;
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  margin: 0 auto;
  padding: 0;
  object-fit: contain;
  object-position: center bottom;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 12px 16px #223f4810);
  transform: none;
  animation: none;
  transition: none;
}

body #main .v22-cutout-stage.v22-cutout-stage--portrait {
  --v22-scene-height: 430px;
}
body #main .v22-cutout-stage.v22-cutout-stage--seated {
  --v22-scene-height: 440px;
  --v22-scene-width: 580px;
  --v22-scene-wash: linear-gradient(145deg,#edf5f0 2%,#dce8f3 60%,#c7dcd9 100%);
}
body #main .v22-cutout-stage.v22-cutout-stage--editorial {
  --v22-scene-height: 360px;
  --v22-scene-width: 500px;
}
body #main .v22-cutout-stage.v22-cutout-stage--contact {
  --v22-scene-height: 400px;
  --v22-scene-width: 470px;
}

/* When the stage is a whole team figure, preserve captions/quotes in normal
   flow. Only its marked picture/frame is a compact portrait scene. */
body #main .v22-cutout-stage.v22-cutout-stage--team {
  --v22-scene-height: 220px;
  --v22-scene-width: 300px;
}
body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage.v22-cutout-stage--team {
  height: auto;
}
body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage.v22-cutout-stage--team .v22-cutout-frame {
  height: auto;
}
body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage.v22-cutout-stage--team::before {
  top: calc(var(--v22-scene-height) * .16);
  bottom: auto;
  height: calc(var(--v22-scene-height) * .84);
  border-radius: 45% 45% 14px 14px;
}
body:is(.general-v17,.district-v17,.v17-shareholder-page) #main
.v22-cutout-stage.v22-cutout-stage--team::after {
  top: calc(var(--v22-scene-height) * .28);
  height: calc(var(--v22-scene-height) * .48);
  opacity: .26;
}

/* Job quotes retain an unmarked 64px avatar wrapper outside the new scene.
   Expand that wrapper only when it contains a marked team cutout. Keep the
   separate blockquote below the identity row in its original document flow. */
body.general-v17.v17-kind-job #main
figure.v20-team-voice:has(.v22-cutout-stage--team) > div:not([aria-hidden]) {
  display: grid;
  grid-template-columns: 176px minmax(0,1fr);
  align-items: center;
  gap: 18px;
}
body.general-v17.v17-kind-job #main
figure.v20-team-voice > div:not([aria-hidden]) > div:has(> .v22-cutout-stage--team) {
  flex: 0 0 176px;
  width: 176px;
  min-width: 0;
  max-width: 100%;
  height: auto;
}

/* About-us cards already have fluid wrappers, without the old avatar limit.
   A compact centered scene fits both the four-column and two-column grids. */
body.general-v17.v17-kind-about #main
.v17-team-grid .v22-cutout-stage--team {
  width: 100%;
  max-width: 220px;
  margin-inline: auto;
}

@media (max-width: 760px) {
  body #main .v22-cutout-stage,
  body #main .v22-cutout-stage.v22-cutout-stage--portrait {
    --v22-scene-height: 320px;
    --v22-scene-width: 440px;
  }
  body #main .v22-cutout-stage.v22-cutout-stage--seated {
    --v22-scene-height: 360px;
  }
  body #main .v22-cutout-stage.v22-cutout-stage--editorial {
    --v22-scene-height: 280px;
    --v22-scene-width: 400px;
  }
  body #main .v22-cutout-stage.v22-cutout-stage--contact {
    --v22-scene-height: 300px;
    --v22-scene-width: 400px;
  }
  body #main .v22-cutout-stage.v22-cutout-stage--team {
    --v22-scene-height: 200px;
    --v22-scene-width: 280px;
  }
  body.general-v17.v17-kind-job #main
  figure.v20-team-voice:has(.v22-cutout-stage--team) > div:not([aria-hidden]) {
    grid-template-columns: minmax(0,1fr);
    justify-items: center;
    gap: 12px;
  }
  body.general-v17.v17-kind-job #main
  figure.v20-team-voice > div:not([aria-hidden]) > div:has(> .v22-cutout-stage--team) {
    flex-basis: auto;
    width: 160px;
  }
  body.general-v17.v17-kind-job #main
  figure.v20-team-voice:has(.v22-cutout-stage--team) > div:not([aria-hidden]) > figcaption {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 379px) {
  body #main .v22-cutout-stage,
  body #main .v22-cutout-stage.v22-cutout-stage--portrait {
    --v22-scene-height: 300px;
  }
  body #main .v22-cutout-stage.v22-cutout-stage--seated {
    --v22-scene-height: 340px;
  }
  body #main .v22-cutout-stage.v22-cutout-stage--editorial,
  body #main .v22-cutout-stage.v22-cutout-stage--contact {
    --v22-scene-height: 280px;
  }
  body #main .v22-cutout-stage.v22-cutout-stage--team {
    --v22-scene-height: 190px;
  }
  body.general-v17.v17-kind-job #main
  figure.v20-team-voice > div:not([aria-hidden]) > div:has(> .v22-cutout-stage--team) {
    width: 152px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body #main .v22-cutout-stage,
  body #main .v22-cutout-stage::before,
  body #main .v22-cutout-stage::after,
  body #main .v22-cutout-stage picture.v22-cutout-picture,
  body #main .v22-cutout-stage img.v22-cutout-image {
    animation: none !important;
    transition: none !important;
  }
}
