/* ---------- Devices ----------
   Every device is drawn 100em wide, so its font-size is a hundredth of the
   width you want and everything inside scales with it. A .devbox sizes the
   device it holds to its own width; a .shot sets the sizes itself.

   Markup: <div class="dev dev-iphone"><div class="screen"><img …></div> …chrome…</div> */

.dev { position: relative; width: 100em; flex: none; }
.dev .screen { position: absolute; overflow: hidden; background: #000; isolation: isolate; }
.dev .screen > img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.dev .screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(108deg, rgba(255,255,255,.14), rgba(255,255,255,.035) 30%, transparent 46%);
}
.devbox { container-type: inline-size; }
.devbox > .dev { font-size: 1cqw; }

/* The key is a side button; bands, crown, stand and base are what they say. */
.dev .key { position: absolute; border-radius: .6em; background: linear-gradient(90deg, #3a3a3f, #6a6a70 45%, #2a2a2e); }

/* iPhone 16 Pro: titanium band, black bezel, Dynamic Island, four keys. */
.dev-iphone {
  height: 209em; border-radius: 17em;
  background: linear-gradient(155deg, #6a6a70, #3a3a3f 35%, #1f1f23 65%, #4a4a50);
  box-shadow: inset 0 0 0 .35em rgba(255,255,255,.22), 0 3em 6em -2em rgba(0,0,0,.7);
}
.dev-iphone::before { content: ""; position: absolute; inset: 1.4em; border-radius: 15.6em; background: #060608; }
.dev-iphone .screen { inset: 3.9em; border-radius: 13.4em; padding-top: 17em; background: #f2f3f7; } /* the status bar's own strip */
.dev-iphone .island { position: absolute; left: 50%; top: 9.2em; width: 26em; height: 7.6em; margin-left: -13em; border-radius: 4em; background: #000; z-index: 3; }
.dev-iphone .key { width: 1.3em; }
.dev-iphone .k1 { left: -1.2em; top: 34em; height: 6.5em; }
.dev-iphone .k2 { left: -1.2em; top: 47em; height: 13em; }
.dev-iphone .k3 { left: -1.2em; top: 63em; height: 13em; }
.dev-iphone .k4 { right: -1.2em; top: 54em; height: 21em; background: linear-gradient(90deg, #2a2a2e, #6a6a70 55%, #3a3a3f); }
.dev-iphone .k5 { right: -1em; top: 118em; height: 9em; width: 1em; background: linear-gradient(90deg, #2a2a2e, #6a6a70 55%, #3a3a3f); }
.dev-iphone .status {
  position: absolute; z-index: 4; left: 2.15em; right: 1.9em; top: 2.15em; /* in its own em: 4.7 of the device's */
  display: flex; justify-content: space-between; align-items: center;
  font: 600 4.7em/1 -apple-system, "SF Pro Text", system-ui, sans-serif; color: #000; letter-spacing: -.01em;
}
.dev-iphone .status svg { width: 4.6em; height: 1em; display: block; }
.dev-iphone .screen.dark .status { color: #fff; }

/* iPhone Duo: the open foldable, one wide screen with a soft crease. */
.dev-duo {
  height: 142em; border-radius: 10em;
  background: linear-gradient(155deg, #6a6a70, #3a3a3f 35%, #1f1f23 65%, #4a4a50);
  box-shadow: inset 0 0 0 .35em rgba(255,255,255,.22), 0 3em 6em -2em rgba(0,0,0,.7);
}
.dev-duo::before { content: ""; position: absolute; inset: 1.4em; border-radius: 8.8em; background: #060608; }
.dev-duo .screen { inset: 3.4em; border-radius: 7em; }
.dev-duo .crease { position: absolute; z-index: 3; left: 50%; top: 3.4em; bottom: 3.4em; width: 1.4em; margin-left: -.7em; background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(255,255,255,.14) 50%, rgba(0,0,0,.18)); }
.dev-duo .island { position: absolute; z-index: 3; left: 71%; top: 7.4em; width: 3.6em; height: 3.6em; border-radius: 50%; background: #000; }
.dev-duo .key { width: 1.3em; }
.dev-duo .k1 { right: -1.2em; top: 30em; height: 16em; }
.dev-duo .k2 { right: -1.2em; top: 50em; height: 9em; }

/* iPad Pro, landscape: a thin even bezel and the camera on the long edge. */
.dev-ipad {
  height: 76.5em; border-radius: 5.6em;
  background: linear-gradient(155deg, #d9d9dd, #9a9aa0 40%, #7a7a80 70%, #b5b5ba);
  box-shadow: inset 0 0 0 .3em rgba(255,255,255,.5), 0 3em 6em -2em rgba(0,0,0,.7);
}
.dev-ipad::before { content: ""; position: absolute; inset: .9em; border-radius: 4.8em; background: #0a0a0c; }
.dev-ipad .screen { inset: 3em; border-radius: 2.6em; }
.dev-ipad .cam { position: absolute; left: 50%; top: 1.3em; width: 1.1em; height: 1.1em; margin-left: -.55em; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #3a4a6a, #000 70%); z-index: 3; }

/* MacBook Pro: the lid is the 100em, the base reaches past it on both sides. */
.dev-mac { height: 68.4em; }
.dev-mac .lid {
  position: absolute; left: 0; right: 0; top: 0; height: 64.5em; border-radius: 3.6em 3.6em 0 0;
  background: linear-gradient(180deg, #d0d0d5, #a9a9af 60%, #8f8f95);
  box-shadow: inset 0 0 0 .3em rgba(255,255,255,.45), 0 3em 6em -2em rgba(0,0,0,.7);
}
.dev-mac .lid::before { content: ""; position: absolute; inset: .8em .8em 0; border-radius: 3em 3em 0 0; background: #050507; }
.dev-mac .screen { left: 2.6em; right: 2.6em; top: 2.6em; bottom: 3.6em; border-radius: 1.2em 1.2em .3em .3em; padding-top: 2em; background: #15112c; }
.dev-mac .notch { position: absolute; z-index: 3; left: 50%; top: 2.6em; width: 11.5em; height: 1.9em; margin-left: -5.75em; background: #050507; border-radius: 0 0 1em 1em; }
.dev-mac .base {
  position: absolute; left: -8em; right: -8em; top: 64.5em; height: 3.9em; border-radius: .5em .5em 2.2em 2.2em;
  background: linear-gradient(180deg, #e4e4e8, #c2c2c8 45%, #8c8c92 80%, #6a6a70);
  box-shadow: 0 2.6em 4em -1.6em rgba(0,0,0,.9);
}
.dev-mac .base::before { content: ""; position: absolute; left: 50%; top: 0; width: 16em; height: 1.2em; margin-left: -8em; border-radius: 0 0 1.4em 1.4em; background: linear-gradient(180deg, #8a8a90, #b0b0b6); }
.dev-mac .base::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: .35em; background: rgba(255,255,255,.55); }

/* Chromebook: the same shape in darker aluminium, a camera instead of a notch. */
.dev-chrome { height: 68.4em; }
.dev-chrome .lid {
  position: absolute; left: 0; right: 0; top: 0; height: 64.5em; border-radius: 3em 3em 0 0;
  background: linear-gradient(180deg, #5b6068, #3b3f46 60%, #2b2e34);
  box-shadow: inset 0 0 0 .3em rgba(255,255,255,.18), 0 3em 6em -2em rgba(0,0,0,.7);
}
.dev-chrome .lid::before { content: ""; position: absolute; inset: .8em .8em 0; border-radius: 2.4em 2.4em 0 0; background: #050507; }
.dev-chrome .screen { left: 3em; right: 3em; top: 3.4em; bottom: 4.4em; border-radius: .8em; }
.dev-chrome .cam { position: absolute; z-index: 3; left: 50%; top: 1.5em; width: 1em; height: 1em; margin-left: -.5em; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #3a4a6a, #000 70%); }
.dev-chrome .base {
  position: absolute; left: -8em; right: -8em; top: 64.5em; height: 3.9em; border-radius: .5em .5em 2.2em 2.2em;
  background: linear-gradient(180deg, #6d727a, #4a4f57 45%, #2f3238 80%, #202227);
  box-shadow: 0 2.6em 4em -1.6em rgba(0,0,0,.9);
}
.dev-chrome .base::before { content: ""; position: absolute; left: 50%; top: 0; width: 16em; height: 1.2em; margin-left: -8em; border-radius: 0 0 1.4em 1.4em; background: #2b2e34; }

/* Apple Watch: titanium case, crown and side button, a band above and below. */
.dev-watch {
  height: 118em; border-radius: 30em;
  background: linear-gradient(155deg, #6a6a70, #3a3a3f 35%, #1f1f23 65%, #4a4a50);
  box-shadow: inset 0 0 0 .4em rgba(255,255,255,.25), 0 3em 6em -2em rgba(0,0,0,.7);
}
.dev-watch::before { content: ""; position: absolute; inset: 2em; border-radius: 28em; background: #060608; }
.dev-watch .screen { inset: 8em; border-radius: 23em; background: #000; }
.dev-watch .crown { position: absolute; right: -3.4em; top: 32em; width: 4em; height: 18em; border-radius: 1.6em; background: repeating-linear-gradient(180deg, #5a5a60 0 .9em, #2a2a2e .9em 1.6em); box-shadow: inset 0 0 0 .4em rgba(255,255,255,.08); }
.dev-watch .crown::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1.8em; height: 1.8em; margin: -.9em 0 0 -.9em; border-radius: 50%; background: #ff7a59; opacity: .9; }
.dev-watch .side { position: absolute; right: -2.4em; top: 58em; width: 2.6em; height: 24em; border-radius: 1.2em; background: linear-gradient(90deg, #2a2a2e, #6a6a70 55%, #3a3a3f); }
.dev-watch .band { position: absolute; left: 14em; right: 14em; height: 30em; z-index: -1; background: linear-gradient(90deg, #1f1f24, #35353c 50%, #1f1f24); }
.dev-watch .band.top { top: -28em; border-radius: 9em 9em 3em 3em; }
.dev-watch .band.bottom { bottom: -28em; border-radius: 3em 3em 9em 9em; }

/* Apple TV: a television, thin black bezel and a slim foot. */
.dev-tv { height: 57.6em; }
.dev-tv .panel { position: absolute; inset: 0 0 2.4em; border-radius: 1em; background: #121214; box-shadow: inset 0 0 0 .3em #2a2a2e, 0 3em 6em -2em rgba(0,0,0,.8); }
.dev-tv .screen { inset: .9em .9em 3.3em; border-radius: .5em; }
.dev-tv .stand { position: absolute; left: 32em; right: 32em; bottom: 1.2em; height: 1.2em; background: linear-gradient(180deg, #2a2a2e, #4a4a50); border-radius: 0 0 .6em .6em; }
.dev-tv .foot { position: absolute; left: 24em; right: 24em; bottom: 0; height: 1.3em; border-radius: .7em; background: linear-gradient(180deg, #6a6a70, #3a3a3f); }

/* Vision Pro: a window of glass floating in the room, with its bar underneath. */
.dev-vision { height: 56.3em; }
.dev-vision .screen { inset: 0 0 2.8em; border-radius: 4.2em; box-shadow: inset 0 0 0 .5em rgba(255,255,255,.45), 0 4em 8em -2em rgba(0,0,0,.8); }
.dev-vision .screen::after { background: linear-gradient(108deg, rgba(255,255,255,.22), rgba(255,255,255,.06) 30%, transparent 50%); }
.dev-vision .bar { position: absolute; left: 50%; bottom: 0; width: 22em; height: 1.4em; margin-left: -11em; border-radius: 1em; background: rgba(255,255,255,.7); box-shadow: 0 .6em 2em rgba(0,0,0,.4); }

/* Android phone: a slim dark frame, the camera in a hole, keys on the right. */
.dev-android {
  height: 212em; border-radius: 13em;
  background: linear-gradient(155deg, #4a4a52, #26262c 40%, #141418 70%, #35353c);
  box-shadow: inset 0 0 0 .3em rgba(255,255,255,.2), 0 3em 6em -2em rgba(0,0,0,.7);
}
.dev-android::before { content: ""; position: absolute; inset: 1.2em; border-radius: 11.8em; background: #060608; }
.dev-android .screen { inset: 2.6em; border-radius: 10.6em; }
.dev-android .cam { position: absolute; z-index: 3; left: 50%; top: 6.2em; width: 4.4em; height: 4.4em; margin-left: -2.2em; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #2d3a55, #000 65%); box-shadow: 0 0 0 .5em rgba(0,0,0,.6); }
.dev-android .key { width: 1.2em; right: -1.1em; background: linear-gradient(90deg, #26262c, #5a5a62 55%, #35353c); }
.dev-android .k1 { top: 46em; height: 10em; }
.dev-android .k2 { top: 60em; height: 20em; }

/* Android tablet, landscape. */
.dev-atab {
  height: 64em; border-radius: 6em;
  background: linear-gradient(155deg, #4a4a52, #26262c 40%, #141418 70%, #35353c);
  box-shadow: inset 0 0 0 .3em rgba(255,255,255,.2), 0 3em 6em -2em rgba(0,0,0,.7);
}
.dev-atab::before { content: ""; position: absolute; inset: 1em; border-radius: 5em; background: #060608; }
.dev-atab .screen { inset: 3.2em; border-radius: 3em; }
.dev-atab .cam { position: absolute; z-index: 3; left: 50%; top: 1.3em; width: 1.1em; height: 1.1em; margin-left: -.55em; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #2d3a55, #000 65%); }

/* The open foldable shows one screen per half. */
.dev .screen.split { display: flex; }
.dev .screen.split > img { width: 50%; object-position: left top; }

/* ---------- Depth ----------
   The script stacks a few .slab copies of a device's outline behind its
   face, a step apart, so it has an edge when it is seen from the side.
   --t is the step, --edge the metal of the edge, --back the rear face. */
.slab {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  transform: translateZ(calc(var(--i) * var(--t, 1em) * -1));
  background: var(--edge, linear-gradient(90deg, #232327, #8b8b93 16%, #3a3a40 50%, #8b8b93 84%, #232327));
}
.slab.last { background: var(--back, linear-gradient(155deg, #5a5a61, #2a2a2f 45%, #44444b)); }
.dev-iphone { --t: 1.4em; }
.dev-watch { --t: 2.4em; }
.dev-ipad { --t: .9em; --edge: linear-gradient(90deg, #86868c, #ececf0 50%, #86868c); --back: linear-gradient(155deg, #d9d9dd, #9a9aa0); }
.dev-mac .lid { --t: .5em; --edge: linear-gradient(90deg, #86868c, #ececf0 50%, #86868c); --back: linear-gradient(180deg, #cfcfd4, #a2a2a8); }

/* A MacBook with its keyboard: the script adds the .deck and this class.
   The lid turns on its hinge (--lid), the deck lies flat towards you and
   the old front strip becomes the front edge of the body. */
.mac3d { height: 66.3em; transform-style: preserve-3d; }
.mac3d .lid { transform-style: preserve-3d; transform-origin: 50% 100%; transform: rotateX(var(--lid, 12deg)); }
.mac3d .deck {
  position: absolute; left: -2em; right: -2em; top: 64.5em; height: 68em; border-radius: .8em .8em 2.6em 2.6em;
  transform-origin: 50% 0; transform: rotateX(90deg); transform-style: preserve-3d;
  --t: .6em; --edge: linear-gradient(90deg, #77777d, #d2d2d7 50%, #77777d); --back: #4f4f55;
  background:
    repeating-linear-gradient(90deg, #111114 0 .55em, transparent .55em 6.37em) 50% 10% / 89.7% 47% no-repeat,
    repeating-linear-gradient(180deg, #111114 0 .55em, transparent .55em 5.4em) 50% 10% / 89.7% 47% no-repeat,
    linear-gradient(#2b2b31, #2b2b31) 50% 10% / 89.7% 47% no-repeat,
    linear-gradient(180deg, #b3b3b9, #c6c6cb) 50% 94% / 40% 31% no-repeat,
    linear-gradient(180deg, #b6b6bc, #d6d6da);
  box-shadow: inset 0 0 0 .25em rgba(255, 255, 255, .4);
}
.mac3d .base { left: -2em; right: -2em; height: 1.8em; border-radius: .3em .3em 1.2em 1.2em; transform: translateZ(68em); box-shadow: none; }
.mac3d .base::before { height: .9em; }
