/* iPhone frame: a flat-front iPhone 15 Pro Max in Black Titanium, the phone on shopify.com/editions/fall2026.
   Measurements and usage: ../iphone.md.

   Size: --w is the width of the whole frame image (buttons included), as a length. Height follows (551 : 1125).
   Inside the screen everything is laid out in iOS points of a 393 x 852 pt screen (--pt).

   Frame: --fw/--fh are the frame image's size and --sx/--sy/--sw/--sr its screen hole (left, top, width, corner
   radius), all in the image's own pixels. To use another bezel image (Apple's official PNG), change the <img> src
   and these six numbers; the hole must be 393 : 852.

   data-fit   screen  media is a whole 393 x 852 screen capture (it fills the screen)
              safe    media is a whole app screen recorded without safe areas: it is fitted, whole, between
                      the status bar (59 pt) and the home indicator (34 pt); --bg fills the room left
              top     media is part of a page: full width, directly under the status bar (--mx trims a
                      crop that lost its side margins); --bg continues below it
   data-chrome baked  the capture already has a status bar, island and home indicator: draw none
   data-ink   light   white status bar and home indicator, for dark screens
   data-island ios    the island at its true iOS size (126 x 37.33 pt) instead of Shopify's (91.9 x 35.2 pt)

   .iph-cut wraps a phone to show only its top: the box ends --tail pt under the media (--ar = media height / width),
   the way Shopify lets a phone rise out of the bottom of a card. For a page taller than the phone, --vis sets
   the cut directly (pt from the top of the screen); put it in a blank gap between rows. */

.iph {
  --w: 266px;
  --fw: 551; --fh: 1125;
  --sx: 28.72; --sy: 28.85; --sw: 491.65; --sr: 78.1;
  --g: calc(var(--w) / var(--fw));
  --pt: calc(var(--g) * var(--sw) / 393);
  --bg: #fff;
  --bar: var(--bg);
  --foot: var(--bg);
  --ink: #000;
  --isl-w: 91.9;
  --isl-h: 35.2;
  --isl-y: 13.7;
  --mx: 0;
  --iph-font: -apple-system, "SF Pro Text", "SF Pro", Inter, system-ui, sans-serif;
  position: relative;
  display: block;
  flex: none;
  width: var(--w);
  height: calc(var(--g) * var(--fh));
  margin: 0;
  -webkit-user-select: none;
  user-select: none;
}
.iph[data-island="ios"] { --isl-w: 126; --isl-h: 37.33; --isl-y: 11; }
.iph[data-ink="light"] { --ink: #fff; }

/* The frame sits on top; its screen is a transparent hole */
.iph-frame {
  position: absolute; inset: 0; z-index: 4;
  display: block; width: 100%; height: 100%;
  pointer-events: none;
}

/* The screen: the frame's hole plus half a unit of bleed under the frame on every side, so no seam shows */
.iph-screen {
  position: absolute;
  left: calc(var(--g) * (var(--sx) - .5));
  top: calc(var(--g) * (var(--sy) - .5));
  width: calc(var(--g) * (var(--sw) + 1));
  height: calc(var(--g) * (var(--sw) * 852 / 393 + 1));
  border-radius: calc(var(--g) * (var(--sr) + .5));
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

.iph-media {
  position: absolute; z-index: 0;
  display: block; max-width: none;
  background: transparent;
}
.iph[data-fit="screen"] .iph-media { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.iph[data-fit="safe"] .iph-media {
  top: calc(59 * var(--pt)); left: 0;
  width: 100%; height: calc(759 * var(--pt));
  object-fit: contain; object-position: 50% 0;
}
.iph[data-fit="top"] .iph-media {
  top: calc(59 * var(--pt)); left: calc(var(--mx) * var(--pt));
  width: calc((393 - 2 * var(--mx)) * var(--pt)); height: auto;
}

/* Status bar: the app's colour behind it, time centred beside the island on the left, icons on the right */
.iph-bar {
  position: absolute; z-index: 2; inset: 0 0 auto;
  height: calc(59 * var(--pt));
  background: var(--bar);
  color: var(--ink);
}
.iph[data-fit="screen"] .iph-bar { background: none; }
/* A page scrolled under the bar softens into it, as iOS does at a scroll edge */
.iph[data-fit="top"] .iph-bar::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%;
  height: calc(10 * var(--pt));
  background: linear-gradient(var(--bar), transparent);
}
.iph-time, .iph-icons {
  position: absolute;
  top: calc((var(--isl-y) - 1) * var(--pt));
  height: calc(var(--isl-h) * var(--pt));
  width: calc((393 - var(--isl-w)) / 2 * var(--pt));
  display: flex; align-items: center; justify-content: center;
}
.iph-time {
  left: 0;
  padding-left: calc(6 * var(--pt));
  font: 600 calc(17 * var(--pt)) / 1 var(--iph-font);
  letter-spacing: -.01em;
  font-variant-numeric: lining-nums;
}
.iph-icons { right: 0; padding-right: calc(8 * var(--pt)); }
.iph-icons::before {
  content: "";
  width: calc(74 * var(--pt)); height: calc(13 * var(--pt));
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 74 13'%3E%3Cg transform='translate(0 .5)'%3E%3Crect x='0' y='7.6' width='3.2' height='4.4' rx='1'/%3E%3Crect x='4.8' y='5.3' width='3.2' height='6.7' rx='1'/%3E%3Crect x='9.6' y='2.9' width='3.2' height='9.1' rx='1'/%3E%3Crect x='14.4' y='.4' width='3.2' height='11.6' rx='1'/%3E%3Cpath transform='translate(24 0)' d='M.22 3.62a11 11 0 0 1 15.56 0l-1.7 1.7a8.6 8.6 0 0 0-12.16 0zM3.05 6.45a7 7 0 0 1 9.9 0l-1.7 1.7a4.6 4.6 0 0 0-6.5 0zM8 11.4 5.74 9.14a3.2 3.2 0 0 1 4.52 0z'/%3E%3C/g%3E%3Cg transform='translate(46 0)'%3E%3Crect x='.5' y='.5' width='24' height='12' rx='3.8' fill='none' stroke='%23000' stroke-opacity='.4'/%3E%3Crect x='2.5' y='2.5' width='20' height='8' rx='2.2'/%3E%3Cpath d='M26 4.4v4.2c.8-.3 1.4-1.1 1.4-2.1S26.8 4.7 26 4.4z' fill-opacity='.45'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 74 13'%3E%3Cg transform='translate(0 .5)'%3E%3Crect x='0' y='7.6' width='3.2' height='4.4' rx='1'/%3E%3Crect x='4.8' y='5.3' width='3.2' height='6.7' rx='1'/%3E%3Crect x='9.6' y='2.9' width='3.2' height='9.1' rx='1'/%3E%3Crect x='14.4' y='.4' width='3.2' height='11.6' rx='1'/%3E%3Cpath transform='translate(24 0)' d='M.22 3.62a11 11 0 0 1 15.56 0l-1.7 1.7a8.6 8.6 0 0 0-12.16 0zM3.05 6.45a7 7 0 0 1 9.9 0l-1.7 1.7a4.6 4.6 0 0 0-6.5 0zM8 11.4 5.74 9.14a3.2 3.2 0 0 1 4.52 0z'/%3E%3C/g%3E%3Cg transform='translate(46 0)'%3E%3Crect x='.5' y='.5' width='24' height='12' rx='3.8' fill='none' stroke='%23000' stroke-opacity='.4'/%3E%3Crect x='2.5' y='2.5' width='20' height='8' rx='2.2'/%3E%3Cpath d='M26 4.4v4.2c.8-.3 1.4-1.1 1.4-2.1S26.8 4.7 26 4.4z' fill-opacity='.45'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}

/* Dynamic Island, with the front camera's lens showing faintly on its right */
.iph-island {
  position: absolute; z-index: 3;
  left: 50%; top: calc(var(--isl-y) * var(--pt));
  width: calc(var(--isl-w) * var(--pt)); height: calc(var(--isl-h) * var(--pt));
  translate: -50% 0;
  border-radius: calc(var(--isl-h) * var(--pt));
  background:
    radial-gradient(circle at calc(100% - var(--isl-h) * .5 * var(--pt)) 50%, #2a3050 0, #121633 calc(2.2 * var(--pt)), #070912 calc(5.2 * var(--pt)), #000 calc(6.4 * var(--pt)));
}

/* Home indicator, and the app's colour under it when the media stops short of the bottom */
.iph-home {
  position: absolute; z-index: 2;
  left: 50%; bottom: calc(8 * var(--pt));
  width: calc(139 * var(--pt)); height: calc(5 * var(--pt));
  translate: -50% 0;
  border-radius: calc(3 * var(--pt));
  background: var(--ink);
}
.iph[data-fit="safe"] .iph-screen::after {
  content: ""; position: absolute; z-index: 1; left: 0; right: 0; bottom: 0;
  height: calc(34 * var(--pt));
  background: var(--foot);
}

.iph[data-chrome="baked"] :is(.iph-bar, .iph-island, .iph-home) { display: none; }

/* A phone rising out of the bottom of its card: only the top shows, down to --tail pt under the media */
.iph-cut {
  --w: 266px;
  --fw: 551; --sy: 28.85; --sw: 491.65;
  --ar: 1;
  --tail: 18;
  width: var(--w);
  height: calc(var(--w) / var(--fw) * (var(--sy) + (var(--vis, 59 + 393 * var(--ar) + var(--tail))) * var(--sw) / 393));
  overflow: hidden;
  flex: none;
}
.iph-cut > .iph { --w: inherit; }
