/* One blue tint for both existing photos and the shared title backgrounds. */
body #mainvis:has(> .ttl_h1) {
  --drm-title-overlay: linear-gradient(90deg, rgba(11, 45, 92, .72) 0%, rgba(11, 45, 92, .64) 52%, rgba(11, 45, 92, .32) 100%);
}

body #mainvis:has(> .ttl_h1) > figure:has(img)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--drm-title-overlay);
  pointer-events: none;
}

/* Fill the shared title banners that do not already contain a photo. */
body #mainvis:has(> .ttl_h1):not(:has(> figure img)) {
  min-height: 300px;
  background-color: #0b2d5c;
  background-image: var(--drm-title-overlay), var(--drm-title-image);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center, var(--drm-title-position, center);
}

body #mainvis:has(> .ttl_h1):not(:has(> figure img)) > .ttl_h1 {
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 112px 32px 64px;
  color: #fff;
  font-size: 22px;
  letter-spacing: .12em;
  line-height: 1.6;
  text-shadow: 0 2px 12px rgba(0, 20, 46, .28);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

body #mainvis:has(> .ttl_h1):not(:has(> figure img)) > .ttl_h1 > span {
  display: block;
  margin: 10px auto 0;
  color: inherit;
  font-size: clamp(32px, 4.5vw, 64px);
  line-height: 1.15;
  letter-spacing: .08em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

/* Cap portrait enlargement so wide desktop screens retain complete faces. */
@media screen and (min-width: 1025px) {
  /* Original 830 x 495 service photos: preserve the top 332+ source pixels. */
  body.drm-mv-existing-people #mainvis {
    --drm-existing-banner-height: clamp(360px, 28vw, 440px);
    --drm-existing-photo-width: min(calc(100% - 480px), calc((var(--drm-existing-banner-height) - 64px) * 2.5));
    --drm-title-overlay: linear-gradient(90deg, #0b2d5c, rgba(11, 45, 92, .64) 20%, rgba(11, 45, 92, .50) 52%, rgba(11, 45, 92, .32));
    display: grid;
    align-items: center;
    min-height: var(--drm-existing-banner-height);
    background: #0b2d5c;
  }

  body.drm-mv-existing-people #mainvis > figure:has(img) {
    /* Match the 12px menu text plus 15px padding above and below. */
    top: 42px;
    right: 0;
    bottom: 0;
    left: auto;
    width: var(--drm-existing-photo-width);
    margin: 0;
  }

  body.drm-mv-existing-people #mainvis > figure > img {
    object-position: center top;
  }

  body.drm-mv-existing-people #mainvis > .ttl_h1 {
    box-sizing: border-box;
    width: calc(100% - var(--drm-existing-photo-width));
    max-width: none;
    margin: 0;
    padding: 112px 24px 64px max(210px, calc((100vw - 1200px) / 2));
    color: #fff;
    font-size: 18px;
    letter-spacing: .08em;
    line-height: 1.65;
    text-align: left;
    overflow-wrap: anywhere;
    text-wrap: balance;
  }

  body.drm-mv-existing-people #mainvis > .ttl_h1 > span {
    display: block;
    margin: 10px 0 0;
    font-size: clamp(32px, 3.5vw, 52px);
    line-height: 1.2;
    letter-spacing: .04em;
  }

  body #mainvis:has(> .ttl_h1):not(:has(> figure img)) {
    position: relative;
    display: grid;
    align-items: center;
    min-height: var(--drm-title-desktop-height, 300px);
    background-image: var(--drm-title-desktop-background, var(--drm-title-overlay), var(--drm-title-image));
  }

  body #mainvis:has(> .ttl_h1):not(:has(> figure img))::before {
    content: var(--drm-title-desktop-layer, none);
    position: absolute;
    inset: 0 0 0 auto;
    width: min(100%, 1672px);
    background-image: linear-gradient(90deg, #0b2d5c 0%, rgba(11, 45, 92, .64) 38%, rgba(11, 45, 92, .32) 100%), var(--drm-title-image);
    background-repeat: no-repeat;
    background-size: 100% 100%, 100% auto;
    background-position: center, var(--drm-title-position, center);
    pointer-events: none;
  }

  body #mainvis:has(> .ttl_h1):not(:has(> figure img)) > .ttl_h1 {
    width: 100%;
  }
}

@media screen and (max-width: 1024px) {
  body #mainvis:has(> .ttl_h1):not(:has(> figure img)) > .ttl_h1 {
    padding-top: calc(clamp(88px, 20vw, 160px) + 24px);
  }
}

@media screen and (max-width: 767px) {
  body #mainvis:has(> .ttl_h1) {
    --drm-title-overlay: linear-gradient(90deg, rgba(11, 45, 92, .72), rgba(11, 45, 92, .50));
  }

  body #mainvis:has(> .ttl_h1):not(:has(> figure img)) {
    min-height: 238px;
    background-image: var(--drm-title-overlay), var(--drm-title-image);
  }

  body #mainvis:has(> .ttl_h1):not(:has(> figure img)) > .ttl_h1 {
    padding-right: 20px;
    padding-bottom: 44px;
    padding-left: 20px;
    font-size: 16px;
    letter-spacing: .06em;
  }

  body #mainvis:has(> .ttl_h1):not(:has(> figure img)) > .ttl_h1 > span {
    margin-top: 10px;
    font-size: clamp(24px, 5.7vw, 38px);
    line-height: 1.2;
    letter-spacing: .06em;
  }
}
