/* device-frame.css — one iPad, one iPhone, drawn once, used everywhere.
   Pair with device-frame.js. Every number is in device points (1 CSS px
   inside .df-body = 1 iOS point); the whole body is scaled uniformly to the
   width the page gives the .device element. See README.md for sources. */

.device{
  /* the page decides the width; the height always follows the device */
  --df-w: 925; --df-h: 1283;            /* outer box incl. button margin, set per device below */
  display:block; position:relative; width:100%;
  aspect-ratio: var(--df-w) / var(--df-h);
  contain: layout style;                 /* nothing inside can push the box */
  min-height:0; max-height:none; overflow:visible;
}
.device:not(.df-ready) > *{ display:none !important }

/* ---- sizes (points). Outer box = device + 6pt margin each side for buttons/shadow room ---- */
.device[data-device="ipad"],
.device[data-device="ipad"][data-orient="portrait"]{ --df-w: 937; --df-h: 1295 }
.device[data-device="ipad"][data-orient="landscape"]{ --df-w: 1295; --df-h: 937 }
.device[data-device="iphone"]{ --df-w: 446; --df-h: 918 }

.df-body{
  position:absolute; left:0; top:0; transform-origin:0 0;
  width:calc(var(--df-w) * 1px); height:calc(var(--df-h) * 1px);
  transform:scale(var(--df-s, 1));
}

/* ---- the shell: the bezel is the screen's spread shadow, clipped by the shell ---- */
.df-shell{
  position:absolute; left:6px; top:6px;
  width:var(--dev-w); height:var(--dev-h);
  border-radius:var(--dev-r); overflow:hidden;
  background:transparent;
  box-shadow:
    0 0 0 1.2px #6f6e6b,                 /* thin metal edge */
    0 0 0 2.4px #2b2a28,
    0 2px 3px rgba(0,0,0,.18),
    0 18px 40px -8px rgba(31,27,22,.30),  /* soft shadow on paper */
    0 40px 90px -30px rgba(31,27,22,.25);
}
.df-shell::after{ /* faint inner highlight on the glass edge */
  content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10), inset 0 1.5px 0 rgba(255,255,255,.08);
  z-index:4;
}
.df-screen{
  position:absolute; left:var(--bez-x); top:var(--bez-y);
  width:var(--scr-w); height:var(--scr-h);
  border-radius:var(--scr-r);
  box-shadow:0 0 0 200px #121212;        /* this IS the bezel */
  background:#fff; overflow:hidden; z-index:1;
  container: df-screen / inline-size;   /* style screen content with @container, never page @media */
}
.df-content{
  position:absolute; inset:0; overflow:auto; overscroll-behavior:contain;
  scrollbar-width:none; -webkit-overflow-scrolling:touch;
  border-radius:inherit;
}
.df-content::-webkit-scrollbar{ display:none }
.df-content > img:only-child,
.df-content > video:only-child,
.df-content > picture:only-child,
.df-content > picture:only-child > img{
  display:block; width:100%; height:100%; object-fit:cover; object-position:top center;
  border:0; margin:0;
}
.df-content > iframe:only-child{ display:block; width:100%; height:100%; border:0 }

/* hole mode (used by the CLI to make the overlay PNG): screen is see-through */
.device[data-hole] .df-screen{ background:transparent }
.device[data-hole] .df-content{ display:none }

/* ---- details ---- */
.df-cam, .df-island, .df-home, .df-btn{ position:absolute; pointer-events:none }
.df-cam{ /* iPad front camera, in the bezel */
  width:9px; height:9px; border-radius:50%; z-index:3;
  background:radial-gradient(circle at 35% 35%, #3a4a5c 0 18%, #0b0d10 45%, #1c1c1c 100%);
  box-shadow:0 0 0 1.5px #1d1d1d;
}
.df-island{ /* iPhone Dynamic Island, on the screen */
  left:calc(var(--bez-x) + (var(--scr-w) - 125px) / 2); top:calc(var(--bez-y) + 14px);
  width:125px; height:37px; border-radius:19px; background:#000; z-index:3;
}
.df-island::after{ content:""; position:absolute; right:13px; top:11px; width:14px; height:14px; border-radius:50%;
  background:radial-gradient(circle at 40% 40%, #1d2a3a 0 25%, #050505 60%) }
.df-home{ /* home indicator */
  left:50%; transform:translateX(-50%); height:5px; border-radius:3px; z-index:3;
  background:rgba(20,20,20,.55); mix-blend-mode:normal;
}
.device[data-home="light"] .df-home{ background:rgba(255,255,255,.75) }
.device[data-home="none"] .df-home{ display:none }
.df-btn{ /* iPhone side buttons: start under the shell, stand out ~1.8pt past its edge ring */
  background:linear-gradient(90deg,#2b2a28,#5d5b57 45%,#2b2a28); border-radius:2.5px; z-index:0;
}
.df-btn-flush{ background:#3a3936 }      /* Camera Control: nearly level with the frame */
.device.df-tiny .df-btn{ display:none }

/* iPad geometry (portrait): device 925 x 1283 pt, screen 820 x 1180 pt, corner 18 pt */
.device[data-device="ipad"]{ --dev-w:925px; --dev-h:1283px; --dev-r:70px; --scr-w:820px; --scr-h:1180px; --scr-r:18px; --bez-x:52.5px; --bez-y:51.5px }
.device[data-device="ipad"][data-orient="landscape"]{ --dev-w:1283px; --dev-h:925px; --scr-w:1180px; --scr-h:820px; --bez-x:51.5px; --bez-y:52.5px }
.device[data-device="ipad"] .df-home{ width:310px; bottom:calc(var(--bez-y) + 8px) }
/* iPhone geometry: device 434 x 906 pt, screen 402 x 874 pt, corner 62 pt */
.device[data-device="iphone"]{ --dev-w:434px; --dev-h:906px; --dev-r:78px; --scr-w:402px; --scr-h:874px; --scr-r:62px; --bez-x:16px; --bez-y:16px }
.device[data-device="iphone"] .df-home{ width:139px; bottom:calc(var(--bez-y) + 8px) }
