/* The phone: the one owner of the phone illustration with its Dynamic Island, status bar, contact, thread and bubbles, with no input bar, cropped by a soft
   fade (.pg-phc). Used by every product page. Loads BEFORE css/product-page.css, which keeps only
   the page-specific overrides (sizes inside a layout, the hint pill and so on). The shared bubble tail, tapback and typing indicator sit
   inside it (css/bubble-tail.css, css/tapback.css, css/typing.css).
   Markup: .pg-phc > .imsg-phone.pg-phf.pg-shell > .imsg-phone-screen.pg-ph.
   The phone's iOS colour tokens are defined here for its container (.pg-phc) and for .pg (product pages), so no page needs a .pg ancestor. */

:is(.pg, .pg-phc) {
  --pg-ease: cubic-bezier(.2, .8, .2, 1);
  --pg-phone-bg: #fff; --pg-phone-ink: #000; --pg-phone-meta: rgba(60, 60, 67, .6);
  --pg-bubble-in: #e9e9eb; --pg-phone-line: rgba(16, 20, 32, .08);
  --pg-lift: 0 1px 2px rgba(16, 20, 32, .06), 0 28px 60px -24px rgba(16, 20, 32, .32);
}
[data-theme="dark"] :is(.pg, .pg-phc) {
  --pg-phone-bg: #000; --pg-phone-ink: #fff; --pg-phone-meta: rgba(235, 235, 245, .6);
  --pg-bubble-in: #26262a; --pg-phone-line: rgba(255, 255, 255, .12);
  --pg-lift: 0 1px 2px rgba(0, 0, 0, .4), 0 28px 60px -24px rgba(0, 0, 0, .7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.pg, .pg-phc) {
    --pg-phone-bg: #000; --pg-phone-ink: #fff; --pg-phone-meta: rgba(235, 235, 245, .6);
    --pg-bubble-in: #26262a; --pg-phone-line: rgba(255, 255, 255, .12);
    --pg-lift: 0 1px 2px rgba(0, 0, 0, .4), 0 28px 60px -24px rgba(0, 0, 0, .7);
  }
}

/* the phone: the shared bubble tail, tapback and typing indicator sit inside it */
.pg-phf { flex: none; width: min(100%, 320px); margin: 0; }
.pg-ph {
  container-type: inline-size; --bt-u: .95px; --ty-size: 30px; --tb-size: 30px; --tb-ring: var(--pg-phone-bg); --ty-fill: var(--pg-bubble-in);
  display: flex; flex-direction: column; background: var(--pg-phone-bg); color: var(--pg-phone-ink); text-align: left;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased;
}
.pg-ph::after { content: ""; position: absolute; left: 50%; bottom: 8px; width: 104px; height: 4px; margin-left: -52px; border-radius: 4px; background: var(--pg-phone-ink); opacity: .85; }
/* the contact header is css/thread-head.css (.th-head); the phone sizes it as .656 of the iOS 26 value on a 320 pt screen, in container units of the screen */
.pg-ph { --th-u: calc(.656 * 100cqw / 320); --th-ink: var(--pg-phone-ink); }
.pg-ph-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 7px; padding: 8px 26px 12px; overflow: hidden; }
.pg-ph-stamp { align-self: center; margin-bottom: 4px; font-size: 11px; color: var(--pg-phone-meta); }
.pg-b { position: relative; max-width: 78%; padding: 8px 13px; border-radius: 18px; font-size: 15px; line-height: 1.3; letter-spacing: -.005em; }
.pg-b.in { align-self: flex-start; background: var(--pg-bubble-in); color: var(--pg-phone-ink); }
.pg-b.out { align-self: flex-end; background: #0b84fe; color: #fff; }
/* the device keeps its real proportions and is cut off by a soft fade: only the status bar, contact and thread show */
.pg-phc {
  --pg-fade: .82;   /* the crop is solid down to this fraction of its height, then fades out */
  position: relative; flex: none; container-type: size; width: min(100%, 400px); height: 540px; padding: 20px 20px 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 calc(var(--pg-fade) * 100%), transparent); mask-image: linear-gradient(#000 calc(var(--pg-fade) * 100%), transparent);
}
.pg-phc .pg-phf { width: 100%; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06) inset, 0 0 0 1px rgba(128, 132, 145, .35), 0 2px 4px rgba(16, 20, 32, .16), 0 16px 30px -14px rgba(16, 20, 32, .35); }
/* The thread fills the phone from under the header to where the crop starts to fade, bottom-anchored (justify-content: flex-end above): the newest
   bubble is always whole and in the solid part of the crop, whatever the bubble lengths or the phone width, and older bubbles slide off the top, under
   the header, as in Messages. 100cqh is the crop's height, 100cqw the screen's width. */
.pg-ph { --pg-head-h: calc(92 * var(--th-u)); }   /* the header's height in the flow, after its overlap on the thread */
.pg-ph-thread { flex: none; height: calc(var(--pg-fade, .82) * 100cqh - 20px - 15cqw - var(--pg-head-h) - 6px); padding: calc(32 * var(--th-u)) 20px 10px; }
/* older bubbles slide off the top under the header, as iOS draws it: the header's own fade (the screen colour) is solid down to the name capsule,
   then clears over the header's 22 u of air, so a bubble is never cut against the capsule and rests where its 22 u gap ends */
.pg-ph .th-head { z-index: 2; pointer-events: none; }
.pg-ph .th-head::before {
  content: ""; position: absolute; inset: 0 0 calc(-22 * var(--th-u)); z-index: -1;
  background: linear-gradient(var(--pg-phone-bg) 0, var(--pg-phone-bg) calc(100% - 22 * var(--th-u)), transparent);
}
.pg-ph .pg-b { font-size: 16px; max-width: 84%; }
@media (max-width: 900px) {
  .pg-phc { width: min(100%, 340px); height: 480px; }
}

/* ==== shared phone (integrator) ==== */
/* One owner for the parts every page's phone shares: the frame's lift, the Dynamic Island and the status bar. Sized in container units of the screen (the .imsg-phone-screen is the container), so the same rules fit every phone width. */
.pg-shell { box-shadow: 0 0 0 1px rgba(255, 255, 255, .06) inset, 0 0 0 1px rgba(128, 132, 145, .35), 0 2px 4px rgba(16, 20, 32, .2), 0 50px 90px -28px rgba(16, 20, 32, .6), 0 18px 30px -12px rgba(16, 20, 32, .3); }
.pg-island { position: absolute; z-index: 3; left: 50%; top: 3cqw; width: 29cqw; height: 8.4cqw; margin-left: -14.5cqw; border-radius: 99px; background: #000; }
.pg-sbar { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 4.4cqw 8cqw 0 9cqw; height: 15cqw; font-size: 4.3cqw; font-weight: 600; letter-spacing: -.01em; }
.pg-sbar svg { height: 3.4cqw; width: auto; fill: currentColor; }
.pg-sbar span:last-child { display: flex; gap: 1.6cqw; align-items: center; }

/* a bubble waits (.pg-pend) and then plays in (.pg-in): the shared bubble play-in for every phone whose conversation is acted out by a script; the finished conversation is in the HTML */
.pg-pend { display: none !important; }
.pg-in { animation: pg-m-pop .5s var(--pg-ease) both; transform-origin: 0 100%; }
.pg-in.out, .pg-in.is-out { transform-origin: 100% 100%; }
@keyframes pg-m-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pg-in { animation: none; } }
