/* ==========================================================================
   iPhone 16 Pro mockup — drawn, not photographed.
   Geometry is real: 393 x 852pt display, 1.55mm bezel, 1.4mm titanium band,
   scaled from the physical 71.5mm x 148.4mm body. Everything inside .screen
   is therefore 1 CSS px = 1 iOS pt, which is what lets the app UI be rebuilt
   inside it at true size instead of eyeballed.
   ========================================================================== */

.iphone {
  --sw: 393;            /* screen width,  pt */
  --sh: 852;            /* screen height, pt */
  --bezel: 9.5;         /* black surround */
  --band: 8;            /* titanium rail  */
  --scale: 1;

  --bw: calc((var(--sw) + (var(--bezel) + var(--band)) * 2) * 1px);   /* 428 */
  --bh: calc((var(--sh) + (var(--bezel) + var(--band)) * 2) * 1px);   /* 887 */

  position: relative;
  width: calc(var(--bw) * var(--scale));
  height: calc(var(--bh) * var(--scale));
  flex: none;
}

.iphone__stage {
  position: absolute;
  top: 0; left: 0;
  width: var(--bw);
  height: var(--bh);
  transform: scale(var(--scale));
  transform-origin: top left;
}

/* ----------------------------------------------------------- the body ---- */

.iphone__body {
  position: absolute;
  inset: 0;
  border-radius: 71px;
  padding: calc(var(--band) * 1px);
  /* Polished titanium: the bright bands are where the chamfer catches light. */
  background:
    linear-gradient(101deg,
      #5f5f66  0%,
      #c9c9d1  5%,
      #f4f4f7 10%,
      #9d9da6 17%,
      #6d6d75 27%,
      #8e8e97 40%,
      #c3c3cc 50%,
      #ededf1 58%,
      #93939c 70%,
      #63636b 82%,
      #b4b4bd 92%,
      #78787f 100%);
  box-shadow:
    0 0 0 .5px rgba(255,255,255,.5) inset,
    0 1px 1px rgba(255,255,255,.6) inset,
    0 -1px 1px rgba(0,0,0,.35) inset,
    0 2px 4px rgba(12,12,20,.18),
    0 18px 40px -14px rgba(12,12,20,.4),
    0 60px 110px -40px rgba(12,12,20,.5);
}

/* Vertical shading over the rail so the top and bottom edges are not a smear
   of the horizontal gradient. */
.iphone__body::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg,
    rgba(255,255,255,.55) 0%,
    rgba(255,255,255,0) 5%,
    rgba(0,0,0,0) 92%,
    rgba(0,0,0,.28) 100%);
  pointer-events: none;
}

.iphone__bezel {
  position: absolute;
  inset: calc(var(--band) * 1px);
  border-radius: 63px;
  padding: calc(var(--bezel) * 1px);
  background: #05050a;
  box-shadow:
    0 0 0 .5px rgba(255,255,255,.14) inset,
    0 0 12px 2px rgba(0,0,0,.6) inset;
}

.iphone__screen {
  position: relative;
  width: calc(var(--sw) * 1px);
  height: calc(var(--sh) * 1px);
  border-radius: 54px;
  overflow: hidden;
  background: var(--paper-2);
  isolation: isolate;
  /* Kill the sub-pixel seam between the rounded screen and the black bezel. */
  transform: translateZ(0);
}

/* ------------------------------------------------------- dynamic island -- */

.iphone__island {
  position: absolute;
  top: calc((var(--band) + var(--bezel) + 11) * 1px);
  left: 50%;
  transform: translateX(-50%);
  width: 125px;
  height: 36px;
  border-radius: 19px;
  background: #000;
  z-index: 6;
  box-shadow: 0 0 0 .5px rgba(255,255,255,.06);
}
/* Front camera — the faint iris you can actually see on the real thing. */
.iphone__island::after {
  content: '';
  position: absolute;
  right: 11px; top: 50%;
  width: 11px; height: 11px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #2b3550 0%, #10131f 46%, #05060a 100%);
  box-shadow: 0 0 0 .5px rgba(120,140,190,.22);
}

/* ------------------------------------------------------------ buttons ---- */

.iphone__btn {
  position: absolute;
  width: 3px;
  background: linear-gradient(90deg, #64646c, #d2d2da 40%, #8e8e97 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
  z-index: 1;
}
.iphone__btn--l { left: -2.5px; border-radius: 3px 0 0 3px; }
.iphone__btn--r { right: -2.5px; border-radius: 0 3px 3px 0; }

.iphone__btn--action { top: 148px; height: 30px; }
.iphone__btn--volup  { top: 205px; height: 63px; }
.iphone__btn--voldn  { top: 282px; height: 63px; }
.iphone__btn--power  { top: 232px; height: 92px; }

/* Antenna bands on the rail */
.iphone__seam {
  position: absolute;
  height: 2.5px;
  width: calc(var(--band) * 1px + 1px);
  background: rgba(255,255,255,.45);
  mix-blend-mode: overlay;
  z-index: 2;
}
.iphone__seam--tl { top: 92px;  left: 0; }
.iphone__seam--bl { bottom: 92px; left: 0; }
.iphone__seam--tr { top: 92px;  right: 0; }
.iphone__seam--br { bottom: 92px; right: 0; }

/* ------------------------------------------------------------- glass ----- */

.iphone__glare {
  position: absolute;
  inset: calc((var(--band) + var(--bezel)) * 1px);
  border-radius: 54px;
  pointer-events: none;
  z-index: 7;
  background:
    linear-gradient(126deg,
      rgba(255,255,255,.20) 0%,
      rgba(255,255,255,.06) 16%,
      rgba(255,255,255,0)   34%,
      rgba(255,255,255,0)   72%,
      rgba(255,255,255,.05) 92%,
      rgba(255,255,255,.11) 100%);
  mix-blend-mode: screen;
  opacity: .75;
}
/* Inner edge highlight — the curved glass catching the rail. */
.iphone__glare::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(255,255,255,.10) inset;
}

/* Floor shadow, separate from the body so it can be softened independently. */
.iphone__cast {
  position: absolute;
  left: 8%; right: 8%;
  bottom: -34px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(12,12,20,.30), rgba(12,12,20,0) 70%);
  filter: blur(14px);
  z-index: -1;
}

/* ------------------------------------------------------------ chrome ----- */

/* Content scrolling under the clock has to fade out, the way StatusBarScrim
   does it in the app — otherwise the time collides with a macro number. */
.pscreen__scrim {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 59px;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(180deg,
    var(--s-surface) 0%,
    var(--s-surface) 46%,
    color-mix(in srgb, var(--s-surface) 55%, transparent) 78%,
    color-mix(in srgb, var(--s-surface) 0%, transparent) 100%);
}

.pscreen__status {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 59px;
  padding: 14px 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 5;
  pointer-events: none;
  font-family: -apple-system, 'SF Pro Text', 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--s-ink, #000);
  font-variant-numeric: tabular-nums;
}
.pscreen__status-r { display: flex; align-items: center; gap: 6px; }

.st-batt {
  width: 25px; height: 13px;
  border-radius: 4px;
  border: 1.2px solid currentColor;
  opacity: .95;
  position: relative;
  padding: 1.4px;
}
.st-batt::after {
  content: '';
  position: absolute; right: -3.4px; top: 50%;
  transform: translateY(-50%);
  width: 1.8px; height: 5px;
  border-radius: 0 2px 2px 0;
  background: currentColor;
  opacity: .5;
}
.st-batt i { display: block; height: 100%; width: 78%; border-radius: 2px; background: currentColor; }

.pscreen__home {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 139px; height: 5px;
  border-radius: 3px;
  background: var(--s-home, rgba(0,0,0,.3));
  z-index: 12;
}

/* --------------------------------------------------------- responsive ---- */

/* The inline --scale on each .iphone is the desktop size; these override it.
   The floor is set by legibility, not by fit: the app's own type runs 11-17pt,
   so anything under about .62 stops being readable and the device stops being
   worth showing. */
@media (max-width: 760px) {
  [data-hero] { --scale: .72 !important; }
}
@media (max-width: 400px) {
  .iphone__btn, .iphone__seam { display: none; }
  [data-hero]  { --scale: .66 !important; }
  .step__phone .iphone { --scale: .66 !important; }
}
@media (max-width: 340px) {
  [data-hero]  { --scale: .58 !important; }
  .step__phone .iphone { --scale: .58 !important; }
}

/* ==========================================================================
   The real app, framed
   landing/app/ is the app compiled for web. The iframe is sized in points so
   the app lays out exactly as it does on a 393 x 852pt device, and the frame's
   own scale() does the rest.
   ========================================================================== */

.pscreen-frame {
  width: 393px;
  height: 852px;
  border: 0;
  display: block;
  background: #F4F4F7;
  color-scheme: light;
}

/* ==========================================================================
   Article device figures
   --------------------------------------------------------------------------
   A live app screen sitting in the flow of a help article.

   Display-only by default: the surrounding prose describes what is on the
   screen, and a reader who navigates the frame elsewhere is left reading a
   caption about something no longer shown. `.is-live` opts one frame in.

   The scrim is a sibling rather than a filter on the frame itself, because a
   `filter` on an ancestor creates a containing block for fixed-position
   descendants and the app inside uses them for its own sheets.
   ========================================================================== */

.devfig {
  margin: 2.4rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .9rem;
}

.devfig__stage {
  position: relative;
  display: flex;
  justify-content: center;
}

/* The inert state. `pointer-events` stops the mouse; `inert` on the iframe
   (set in main.js) stops the keyboard and the screen reader. Both are needed —
   a pointer-events-none iframe is still focusable and still a full application
   for anyone tabbing through the article. */
.devfig:not(.is-live) .devfig__stage .pscreen-frame { pointer-events: none; }

.devfig:not(.is-live) .devfig__stage::after {
  content: '';
  position: absolute;
  inset: 0;
  cursor: default;
}

/* The toggle. Deliberately below the phone rather than floating over it: an
   overlay button on top of a screenshot reads as part of the app, and this one
   is emphatically not. */
.devfig__live {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .44rem .9rem;
  border: 1px solid var(--hairline, rgba(0,0,0,.12));
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--ink-muted, #6b6b70);
  font: 500 .82rem/1 var(--font-ui, system-ui, -apple-system, sans-serif);
  letter-spacing: .01em;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.devfig__live:hover { color: var(--ink, #111); border-color: var(--ink-faint, rgba(0,0,0,.25)); }
.devfig__live:focus-visible { outline: 2px solid var(--accent, #4C8DFF); outline-offset: 2px; }

.devfig__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
}

.devfig.is-live .devfig__live {
  color: var(--ink, #111);
  border-color: var(--ink-faint, rgba(0,0,0,.25));
}

.devfig.is-live .devfig__dot {
  background: #4CC97F;
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(76, 201, 127, .2);
}

@media (prefers-reduced-motion: reduce) {
  .devfig__live { transition: none; }
}

.devfig__cap {
  max-width: 34rem;
  margin: 0;
  text-align: center;
  color: var(--ink-muted, #6b6b70);
  font: 400 .92rem/1.55 var(--font-ui, system-ui, -apple-system, sans-serif);
  text-wrap: pretty;
}

.devfig__cap strong { color: var(--ink, #111); font-weight: 600; }

/* Two frames side by side on a wide screen, stacked below it. Used where an
   article is comparing two screens rather than describing one. */
.devfig-pair {
  display: grid;
  gap: 1.6rem;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .devfig-pair { grid-template-columns: 1fr 1fr; }
  .devfig-pair .devfig { margin: 0; }
}

/* Frames inside an article are smaller than the marketing ones and need to
   shrink further before the article's own column does. */
@media (max-width: 560px) {
  .devfig .iphone { --scale: .52 !important; }
}

@media (max-width: 400px) {
  .devfig .iphone { --scale: .44 !important; }
}
