/* Shared handset, dimensioned from the width supplied by each exhibit. */
:where(.iphone) { --iphone-tint: #f6f6ef; --iphone-ink: #1a201f; }
:where(.iphone.iphone-chat) { --iphone-tint: #e6eee0; --iphone-ink: #17221b; }
.iphone {
  --iphone-bezel: clamp(2px,.28vw,4px);
  --iphone-depth: clamp(12px, 2vw, 22px);
  position: relative;
  display: block;
  box-sizing: border-box;
  height: auto;
  min-height: 0;
  aspect-ratio: .486;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 15.5% / 7.55%;
  background: transparent;
  box-shadow: none;
  transform-style: preserve-3d;
  transform: perspective(1050px) rotateX(var(--iphone-rx, 2deg)) rotateY(var(--iphone-ry, -5deg)) rotateZ(var(--iphone-rz, -.7deg));
  transition: transform .48s cubic-bezier(.2,.67,.22,1);
}
.iphone::before, .iphone::after {
  content: "";
  position: absolute;
  pointer-events: none;
  height: auto;
  width: auto;
  opacity: 1;
  padding: 0;
}
.iphone::before {
  inset: 0;
  border: 1px solid #87908f;
  border-radius: inherit;
  background: linear-gradient(125deg,#c7cfd2 0%,#626a71 17%,#e1e6e5 28%,#4b5259 52%,#bbc4c6 77%,#474e56 100%);
  box-shadow: inset 0 0 0 1px #d8deda80;
  transform: translateZ(.1px);
}
.iphone::after {
  inset: .62% 1.27%;
  border: var(--iphone-bezel) solid #080a0c;
  border-radius: 14.5% / 7.05%;
  background: #080a0c;
  box-shadow: 0 0 0 1px #161b1d;
  transform: translateZ(.45px);
}
/* Clip a single, flat display plane inside the bezel. The screen, system bar
   and home indicator share this contour while the metal and keys stay in 3D. */
.iphone-display, .iphone > .iphone-screen {
  position: absolute;
  inset: calc(.62% + var(--iphone-bezel)) calc(1.27% + var(--iphone-bezel));
  border-radius: 13.7% / 6.66%;
  clip-path: inset(0 round 13.7% / 6.66%);
  overflow: hidden;
  isolation: isolate;
  z-index: 1;
  background-color: var(--iphone-tint);
  transform: translateZ(.6px);
}
.iphone-display > .iphone-screen {
  position: absolute;
  inset: 5.95% 0 0;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
}
.iphone-chat .iphone-screen {
  display: flex;
  flex-direction: column;
  padding-bottom: 7%;
}
.iphone-sides, .iphone-sides > .iphone-lamina {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
}
.iphone-sides { transform-style: preserve-3d; }
.iphone-lamina {
  background: linear-gradient(162deg,#333c42 2%,#b1babd 15%,#69747b 25%,#8a969e 55%,#566168 73%,#293238 87%,#939da1);
  transform: translateZ(calc(var(--layer) * var(--iphone-depth)));
}
.iphone-lamina:first-child {
  box-shadow: 4px 10px 18px -7px #06090d59;
  background: linear-gradient(135deg,#848c90,#373f43 65%,#707a7f);
}
.iphone-key {
  position: absolute;
  width: 1.8%;
  min-width: 2px;
  left: -1.2%;
  border: .75px solid #4b5259;
  border-radius: 70%;
  background: linear-gradient(90deg,#465058,#b5c0c5 45%,#58636a);
  transform: translateZ(calc(var(--iphone-depth) * -.45));
  box-shadow: -.6px 1px 1px #22282c70;
}
.iphone-key.silent { top:18.2%; height:3.4%; }
.iphone-key.louder { top:26.4%; height:6.5%; }
.iphone-key.quieter { top:34.65%; height:6.5%; }
.iphone-key.power { left:auto; right:-1.3%; top:29%; height:10.5%; }
.iphone-system {
  position: absolute;
  inset: .65% 7.5% auto;
  height: 4.75%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--iphone-ink);
  pointer-events: none;
  z-index: 1;
  font: 650 clamp(8px, .85vw, 12px)/1 -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  container-type: inline-size;
}
.iphone-system time { margin-left: 3.8%; font-size: 4.9cqw; }
.iphone-island {
  position: absolute;
  width: 30%;
  height: 77%;
  left: 35%;
  border-radius: 100px;
  background: #06080a;
  box-shadow: inset 0 0 0 1px #14171c;
}
.iphone-island::after {
  content:""; position:absolute; right:10%; top:38%; height:24%;
  aspect-ratio:1; border-radius:100%; background:radial-gradient(circle at 63% 34%,#33415e 0%,#152034 48%,#0b101a 70%);
}
.iphone-indicators { width: 26%; height: 54%; display:flex; align-items:center; justify-content:flex-end; gap:7%; }
.iphone-signal { height: 70%; width: 24%; display:flex; gap:9%; align-items:end; }
.iphone-signal i { flex:1; height:100%; background: currentColor; border-radius:1px; }
.iphone-signal i:nth-child(1) { height:30%; }
.iphone-signal i:nth-child(2) { height:52%; }
.iphone-signal i:nth-child(3) { height:76%; }
.iphone-wifi { display:block; width:20%; height:auto; fill:currentColor; }
.iphone-battery { position:relative; width:36%; height:69%; border:1px solid currentColor; border-radius:2px; }
.iphone-battery::before { content:""; display:block; height:calc(100% - 2px); width:74%; margin:1px; background: currentColor; border-radius:.6px; }
.iphone-battery::after { content:""; position:absolute; left:calc(100% + 1px); top:26%; width:1px; height:48%; background:currentColor; }
.iphone-home-indicator {
  position:absolute; left:34%; bottom:1.1%; width:32%; height:.64%;
  background:var(--iphone-ink); border-radius:100px;
  z-index:1; pointer-events:none;
  box-shadow:0 0 1px #ffffff7a;
}
@media (prefers-reduced-motion: reduce) {
  .iphone { transform:none; transition:none; }
}
