/* One consistent, model-rendered top-screen crop for every marketing phone. */
.nesting-phone-top-crop {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: .92;
  overflow: hidden;
  isolation: isolate;
}
.nesting-phone-top-crop > .nesting-phone-static {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.nesting-phone-top-crop > .nesting-phone-static img,
.home-experience .bento-phone.nesting-phone-top-crop > .nesting-phone-static img {
  position: absolute;
  top: -1%;
  left: 50%;
  width: 200%;
  height: auto;
  max-width: none;
  transform: translateX(-50%);
  object-fit: contain;
}
.nesting-phone-top-crop > .nesting-phone-missing {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 51% 38%, rgba(255,249,241,.9) 0 9%, transparent 9.5%),
    radial-gradient(circle at 51% 38%, transparent 0 25%, rgba(116,151,145,.22) 25.4% 25.8%, transparent 26.2%),
    linear-gradient(145deg,#dce9df,#f2d8df 58%,#d8e9f1);
}
.nesting-phone-top-crop > .nesting-phone-missing:before,
.nesting-phone-top-crop > .nesting-phone-missing:after {
  content:"";
  position:absolute;
  left:50%;
  top:38%;
  width:43%;
  aspect-ratio:1;
  border:1px solid rgba(64,93,80,.24);
  border-radius:50%;
  transform:translate(-50%,-50%);
}
.nesting-phone-top-crop > .nesting-phone-missing:after {
  width:24%;
  background:rgba(255,249,241,.32);
  transform:translate(45%,-100%);
}
.nesting-phone-top-crop > .nesting-phone-caption {
  display: none;
}

/* Full-device presentations use the alpha-trimmed, complete 3D handset render.
   Keep its physical portrait proportions; never zoom or crop to fake scale. */
.nesting-phone-full {
  aspect-ratio: .52;
  overflow: visible;
}
.nesting-phone-full > .nesting-phone-static {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}
.nesting-phone-full > .nesting-phone-static img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  transform: none;
  object-fit: contain;
  object-position: center;
}
.nesting-phone-full > .nesting-phone-missing {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.feature-preview-art {
  position: relative;
  height: 272px;
  margin: -21px -21px 17px;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(135deg, #dce9df, #f2d8df 58%, #d8e9f1);
}
.feature-tile-phone {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}
.feature-tile-phone > .nesting-phone-static img {
  width: 200%;
}
.feature-tile .nesting-phone-caption {
  display: none;
}
.feature-group > div { align-items: stretch; }
.tool-detail-preview {
  width: min(100%, 460px);
  margin: 0 0 30px;
}
.tool-detail-preview .nesting-phone {
  width: 100%;
  margin: 0;
}
.feature-tile { overflow: hidden; }
.feature-tile .tile-mark {
  width: 32px;
  height: 32px;
  margin: 0 0 16px;
  background: #e9d5dc;
  box-shadow: inset 0 0 0 8px rgba(255, 249, 241, .58);
}
.center-semantic-media { width:100%; height:100%; }
.legacy-phone-example { width:min(100%,380px); margin:0 auto; }
.legacy-phone-example .nesting-phone-caption { display:none; }
.website-semantic-screenshot {
  display:block;
  width:100%;
  min-height:240px;
  border-radius:22px;
  background:
    radial-gradient(circle at 52% 42%,rgba(255,249,241,.85) 0 11%,transparent 11.5%),
    radial-gradient(circle at 52% 42%,transparent 0 29%,rgba(64,93,80,.2) 29.4% 29.8%,transparent 30.2%),
    linear-gradient(145deg,#dce9df,#f2d8df 58%,#d8e9f1);
}

.center-page .center-tool-media { aspect-ratio: 1 / 1; }
.center-tool-media .nesting-phone { width: 100%; height: 100%; }

/* Shared tool dialogs present the whole physical handset, beside its copy.
   This deliberately overrides every legacy top-screen crop rule above. */
#toolModal .center-modal-card {
  display: grid;
  grid-template-columns: minmax(340px, .95fr) minmax(0, 1.05fr);
  width: min(1000px, 100%);
  max-height: min(760px, calc(100dvh - 32px));
  overflow: hidden;
}
#toolModal .center-modal-card.has-phone {
  height: min(88dvh, 760px);
  min-height: min(560px, calc(100dvh - 32px));
}
#toolModal .center-modal-card:not(.has-phone) {
  display: block;
  width: min(600px, 100%);
  overflow: auto;
}
#toolModal .center-modal-media {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  height: auto;
  aspect-ratio: auto;
  padding: 18px clamp(12px, 2.4vw, 28px);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(255,250,244,.92), transparent 59%),
    linear-gradient(145deg, #dce9df, #f2d8df 58%, #d8e9f1);
}
#toolModal .center-modal-media[hidden] { display: none; }
#toolModal .center-modal-media img {
  position: absolute;
  inset: 18px 12px;
  display: block;
  width: calc(100% - 24px);
  height: calc(100% - 36px);
  max-width: none;
  max-height: none;
  transform: none;
  object-fit: contain;
  object-position: center;
}
#toolModal .center-modal-body {
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  padding: clamp(26px, 4vw, 46px);
  overflow: auto;
  overscroll-behavior: contain;
}
#toolModal .center-modal-card:not(.has-phone) .center-modal-body {
  max-height: calc(100dvh - 64px);
}
#toolModal .center-modal-close {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(48,38,64,.16);
  border-radius: 50%;
  background: rgba(255,250,244,.94);
  color: #302640;
  box-shadow: 0 5px 18px rgba(48,38,64,.12);
  cursor: pointer;
}
#toolModal .center-modal-close svg { display: block; width: 20px; height: 20px; }
#toolModal .center-modal-close:hover { background: #fff; }

@media (max-width: 620px) {
  .feature-preview-art { height: 320px; }
  .center-page .center-tool-media { aspect-ratio: 1.08 / 1; }
  #toolModal { padding: 10px; }
  #toolModal .center-modal-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: min(72dvh, 560px) minmax(0, 1fr);
    width: min(520px, 100%);
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - 20px);
    border-radius: 22px;
  }
  #toolModal .center-modal-card:not(.has-phone) { display: block; width: min(520px, 100%); }
  #toolModal .center-modal-media {
    height: auto;
    min-height: 0;
    padding: 32px 12px 8px;
  }
  #toolModal .center-modal-media img { inset: 32px 12px 8px; height: calc(100% - 40px); }
  #toolModal .center-modal-body {
    align-self: stretch;
    max-height: none;
    padding: 18px 22px 22px;
  }
  #toolModal .center-modal h2 { font-size: 24px; }
}

@media (max-height: 560px) and (min-width: 621px) {
  #toolModal .center-modal-card { max-height: calc(100dvh - 20px); }
  #toolModal .center-modal-card.has-phone { height: calc(100dvh - 20px); min-height: 0; }
  #toolModal .center-modal-media { padding: 12px 22px; }
  #toolModal .center-modal-media img { inset: 12px; height: calc(100% - 24px); }
  #toolModal .center-modal-body {
    align-self: stretch;
    padding: 24px 34px;
  }
}
@media (max-height: 460px) and (max-width: 620px) {
  #toolModal .center-modal-card.has-phone {
    grid-template-rows: minmax(96px, 36dvh) minmax(0, 1fr);
    max-height: calc(100dvh - 16px);
  }
  #toolModal .center-modal-body { padding: 12px 18px 16px; }
}
