/* The transparent portrait bezel is from Apple Design Resources. Its
   1350 × 2760 canvas has a 1206 × 2622 display at (72, 69). */
.hero .hero-art:has(.demo-phone) {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 0;
  padding: 18px 0 20px;
  overflow: visible;
}

.hero .hero-art:has(.demo-phone)::before {
  display: none;
}

.hero .hero-art .demo-phone {
  position: relative;
  isolation: isolate;
  flex: none;
  width: min(366px, clamp(265px, 40svh, 366px), 100%);
  height: auto;
  aspect-ratio: 1350 / 2760;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.hero .demo-phone::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: 96.6% 11% -0.7%;
  background: radial-gradient(ellipse closest-side, rgb(22 45 67 / 22%), transparent);
  filter: blur(3px);
}

.demo-phone::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background: url("./iphone-17-pro-silver.webp") center / 100% 100% no-repeat;
}

.hero .demo-phone .black-edge {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  padding: 0;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

/* One source pixel under the bezel prevents a halo at fractional scales. */
.demo-phone .screen {
  position: absolute;
  inset: 2.464% 5.259%;
  width: auto;
  height: auto;
  overflow: hidden;
  border-radius: 14% / 6.45%;
  background: #080910;
}

.demo-phone iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.hero .demo-caption {
  margin: 0;
  font: 600 12px/1.5 Inter, system-ui, sans-serif;
  text-align: center;
  color: #45617b;
}

@media (max-width: 700px) {
  .hero .hero-art:has(.demo-phone) {
    padding: 14px 0 28px;
  }

  .hero .hero-art .demo-phone {
    width: min(352px, 100% - 12px);
  }
}

/* The calendar is an exported app screen, so it exposes no controls. */
.calendar-stage .calendar-device {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: clamp(4%, 50% - 300px, 15%);
  width: min(302px, 38%);
  aspect-ratio: 1350 / 2760;
  transform: translateY(-50%) rotate(3deg);
  pointer-events: none;
}
.chat-art .chat-device {
  position: relative;
  width: min(326px, 93%);
  aspect-ratio: 1350 / 2760;
  transform: rotate(-3deg);
  pointer-events: none;
}
.calendar-device .screen { background-color: #fff5f7; }
.chat-device .screen { background-color: #f0fdf6; }
.calendar-device .screen img,
.chat-device .screen img {
  display: block;
  width: 100%;
  height: 100%;
}

/* Rotate only the bezel; the live iframe keeps normal pointer coordinates. */
.live-device-slot {
  width: 100%;
  aspect-ratio: 2760 / 1350;
  display: grid;
  place-items: center;
}
.live-device {
  position: relative;
  width: 100%;
  aspect-ratio: 2760 / 1350;
}
.live-device:not(.is-upright)::after {
  inset: auto;
  left: 50%;
  top: 50%;
  width: 48.91304%;
  height: 204.44444%;
  transform: translate(-50%, -50%) rotate(-90deg);
}
.live-device:not(.is-upright) .screen {
  inset: 5.259% 2.464%;
  border-radius: 6.45% / 14%;
  background: #0d0d0d;
}
/* The landscape width is the phone's long edge in either orientation. */
.live-device-slot:has(.is-upright) { aspect-ratio: 1; }
.live-device.is-upright {
  width: calc(100% * 1350 / 2760);
  aspect-ratio: 1350 / 2760;
}
@media (min-width: 700.01px) {
  .sync-grid > :last-child:has(.is-upright) {
    top: auto;
    bottom: 0;
  }
}
#slide-dots { display: flex; align-items: center; gap: 0; }
#slide-dots button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
#slide-dots button::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7891aa;
}
#slide-dots button[aria-pressed="true"]::before { background: #85daff; }
#slide-dots button:focus-visible { outline: 2px solid #85daff; border-radius: 5px; }

@media (max-width: 700px) {
  .calendar-stage .calendar-device {
    top: auto;
    right: 50%;
    bottom: 20px;
    width: min(276px, 80%);
    transform: translateX(50%) rotate(2deg);
  }
  .chat-art .chat-device { transform: rotate(-2deg); }
  .sync-grid > div:last-child { width: 92%; }
}

.calendar-copy .feature-mini span + span {
  display: block; width: auto; height: auto; background: transparent;
  font-size: inherit; color: inherit;
}
@media (max-width: 700px) {
  .sync-panel { container-type: inline-size; }
  .sync-panel .sync-grid {
    --projector-height: calc(100cqi * 9 / 16);
    --phone-short-edge: calc(100cqi * 1350 / 2760);
    --label-line: 13px;
    --label-gap: 14px;
    --row-gap: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--row-gap);
    min-height: 0;
  }
  .sync-grid .screen-label {
    line-height: var(--label-line);
    margin-bottom: var(--label-gap);
  }
  .sync-panel .sync-grid > div:first-child,
  .sync-panel .sync-grid > div:last-child {
    position: relative; inset: auto; width: 100%;
  }
  .sync-panel .projector { height: var(--projector-height); }
  /* Reuse the two landscape rows' combined height. The upright phone and
     congregation display share that space side by side. */
  .sync-panel .sync-grid:has(.is-upright) {
    grid-template-columns: minmax(0, 1fr) var(--phone-short-edge);
    column-gap: clamp(8px, 3vw, 16px);
    align-content: center;
    min-height: calc(var(--projector-height) + var(--phone-short-edge)
      + 2 * (var(--label-line) + var(--label-gap)) + var(--row-gap));
  }
  .sync-grid:has(.is-upright) .live-device-slot {
    aspect-ratio: 1350 / 2760;
  }
  .sync-grid .live-device.is-upright { width: 100%; }
  .sync-grid:has(.is-upright) .projector {
    display: grid;
    height: auto;
    aspect-ratio: 4 / 3;
    min-height: min-content;
    padding: 4px;
  }
  .sync-grid:has(.is-upright) .projector-inner {
    height: auto;
    min-width: 0;
    padding: 8px;
    font-size: clamp(12px, 3.2vw, 16px);
    line-height: 1.4;
  }
  .sync-panel .sync-foot { margin-top: 16px; }
}
