/* The chassis follows the actual screenshot dimensions, including in landscape. */
.device-frame {
  --bezel: clamp(3px, .55vw, 8px);
  --corner: clamp(10px, 2vw, 26px);
  --metal: #666561;
  position: relative;
  display: block;
  box-sizing: border-box;
  width: min(100%, calc(var(--frame-screen-height, 680px) * var(--device-ratio) + 2 * var(--bezel)));
  margin-inline: auto;
  padding: var(--bezel);
  border: 1px solid var(--metal);
  border-radius: var(--corner);
  background: #131416;
  box-shadow: inset 0 0 0 1px #ffffff20, 0 6px 14px #0005;
}

.device-frame > img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  margin: 0;
  border: 0;
  border-radius: max(2px, calc(var(--corner) - var(--bezel) - 2px));
  object-fit: contain;
}

.device-frame[data-device="iphone"] {
  --corner: clamp(15px, 2.6vw, 34px);
  --metal: #a29a8b;
}

.device-frame[data-device="ipad"] {
  --bezel: clamp(5px, .8vw, 11px);
  --corner: clamp(9px, 1.5vw, 20px);
  --metal: #888782;
}

.device-frame[data-device^="duo-"] {
  --metal: #99958b;
  --corner: clamp(10px, 1.7vw, 23px);
}

.device-frame[data-device="duo-closed"] {
  box-shadow: inset 0 0 0 1px #ffffff20, 3px 1px 0 #555550, 0 6px 14px #0005;
}

.device-frame[data-device="duo-open"]::after {
  content: "";
  position: absolute;
  inset: -1px auto -1px 50%;
  width: 3px;
  transform: translateX(-50%);
  background: linear-gradient(#959189 0 var(--bezel), transparent var(--bezel) calc(100% - var(--bezel)), #959189 calc(100% - var(--bezel)));
  pointer-events: none;
}

.device-frame[data-device="duo-open"][data-orientation="portrait"]::after {
  inset: 50% -1px auto;
  width: auto;
  height: 3px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, #959189 0 var(--bezel), transparent var(--bezel) calc(100% - var(--bezel)), #959189 calc(100% - var(--bezel)));
}

.device-frame:is([data-device="mac"], [data-device="windows"]) {
  --corner: clamp(5px, 1vw, 12px);
}

.device-frame[data-device="mac"] {
  padding-bottom: calc(var(--bezel) + 9px);
  background: linear-gradient(to top, #898b8e, #57595c 8px, #131416 9px);
}

.device-frame[data-device="windows"] {
  margin-bottom: 17px;
  padding-bottom: calc(var(--bezel) + 4px);
}

.device-frame[data-device="windows"]::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 40%;
  width: 20%;
  height: 16px;
  background: linear-gradient(#55575a, #888a8c);
  clip-path: polygon(39% 0, 61% 0, 66% 73%, 100% 82%, 100% 100%, 0 100%, 0 82%, 34% 73%);
}

.lh-shots-grid .device-frame { --frame-screen-height: 610px; }
.fh-capture a:has(> .device-frame) { aspect-ratio: auto; }
.capture-open:has(> .device-frame) { padding: 10px; }
.ios-showcase .device-frame { --frame-screen-height: 380px; }
.capture-open > .device-frame > img,
.lh-shots-grid .device-frame > img,
.fh-capture .device-frame > img {
  height: auto;
  max-height: none;
}

.capture-dialog > .device-frame,
.lh-shot-dialog > .device-frame {
  --frame-screen-height: 74dvh;
  max-width: 88vw;
}
.lh-shot-dialog .device-frame > img { max-height: none; width: 100%; }

.device-frame[data-device="iphone"][data-orientation="portrait"]::after {
  content: "";
  position: absolute;
  top: 24%;
  right: -3px;
  width: 2px;
  height: 13%;
  border-radius: 0 2px 2px 0;
  background: var(--metal);
  pointer-events: none;
}

.device-frame[data-device="iphone"][data-orientation="landscape"]::after {
  content: "";
  position: absolute;
  left: 24%;
  top: -3px;
  width: 13%;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--metal);
  pointer-events: none;
}

.creative-app-card figure > .device-frame {
  width: calc(100% - 24px);
}

.creative-app-card figure > .device-frame > img {
  height: auto;
  object-fit: contain;
}

.device-image-dialog {
  width: min(94vw, 1500px);
  max-height: 94dvh;
  padding: 12px;
  border: 1px solid #e0cbae55;
  border-radius: 18px;
  background: #111315;
  color: #fff;
}

.device-image-dialog::backdrop { background: #000d; }
.device-image-dialog form { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.device-image-dialog button {
  width: 42px;
  height: 42px;
  border: 1px solid #e0cbae55;
  border-radius: 50%;
  background: #292b2e;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}
.device-image-dialog .device-frame { --frame-screen-height: 74dvh; }
