/* Hero 3D phone add-on (from hero-phone.html). hero3d.js wraps the page's caller phone in .tilt3d,
   adds a keyboard, side edges and side buttons, and turns it to face the mouse (30° either way). */
.tilt3d{position:relative;z-index:1;flex:none;perspective:1400px}
.tilt3d .tilt{position:relative;transform-style:preserve-3d;transform-origin:50% 50%;will-change:transform}
.tilt3d .phone{position:relative}

/* Rim: copies of the phone's outline stacked a little behind it (hero3d.js sets their depth and corner radius),
   so the frame has depth all the way around, corners included */
.tilt3d .rim{position:absolute;inset:0;pointer-events:none;background:#1e2521}
.tilt3d .rim.mid{background:#29312d}

/* Side edges: carry the side buttons on the volume side and the power side */
.tilt3d .edge{position:absolute;top:6%;bottom:6%;width:5.8%;transform-style:preserve-3d;backface-visibility:hidden}
.tilt3d .edge.r{left:100%;transform-origin:left center;transform:rotateY(90deg)}
.tilt3d .edge.l{right:100%;transform-origin:right center;transform:rotateY(-90deg)}

/* Side buttons. Left: action, volume up, volume down. Right: power.
   Raised on the edges; facing front, small nubs peek past the frame and fade as it turns. */
.tilt3d .edge .btn-s{position:absolute;left:18%;right:18%;border-radius:2px;background:linear-gradient(90deg,#46514a,#232b27 50%,#48534c);box-shadow:0 0 0 .5px rgba(0,0,0,.6);transform:translateZ(1.5px)}
.tilt3d .phone>.nub{position:absolute;width:3px;background:linear-gradient(90deg,#3c4640,#1c2320);opacity:var(--nub,1)}
.tilt3d .phone>.nub.l{left:-3px;border-radius:2px 0 0 2px}.tilt3d .phone>.nub.r{right:-3px;border-radius:0 2px 2px 0}
.tilt3d .b-act{top:15%;height:4%}.tilt3d .b-vup{top:24%;height:7%}.tilt3d .b-vdn{top:34%;height:7%}.tilt3d .b-pwr{top:18%;height:11%}
.tilt3d .edge .b-act{top:10.2%;height:4.5%}.tilt3d .edge .b-vup{top:20.5%;height:8%}.tilt3d .edge .b-vdn{top:31.8%;height:8%}.tilt3d .edge .b-pwr{top:13.6%;height:12.5%}

/* Thread: messages that haven't arrived yet take no space, so scrolling to the newest one never pushes
   the visible ones off the top. Each one fades up as it arrives. A soft fade at the top replaces a hard cut. */
.tilt3d .thread>.st:not(.on){display:none}
.tilt3d .thread>.st.on{animation:tt-arrive .32s ease}
@keyframes tt-arrive{from{opacity:0;transform:translateY(2.4cqw)}}
.tilt3d .thread{-webkit-mask-image:linear-gradient(transparent,#000 6cqw);mask-image:linear-gradient(transparent,#000 6cqw)}

/* Every other phone in the demo (the owner's, the digest) gets the same side buttons, fixed in place */
#demo .phone,#trioRow .phone{position:relative}
#demo .phone>.nub,#trioRow .phone>.nub{position:absolute;width:3px;background:linear-gradient(90deg,#3c4640,#1c2320)}
#demo .phone>.nub.l,#trioRow .phone>.nub.l{left:-3px;border-radius:2px 0 0 2px}#demo .phone>.nub.r,#trioRow .phone>.nub.r{right:-3px;border-radius:0 2px 2px 0}
#demo .phone>.nub.b-act,#trioRow .phone>.nub.b-act{top:15%;height:4%}#demo .phone>.nub.b-vup,#trioRow .phone>.nub.b-vup{top:24%;height:7%}#demo .phone>.nub.b-vdn,#trioRow .phone>.nub.b-vdn{top:34%;height:7%}#demo .phone>.nub.b-pwr,#trioRow .phone>.nub.b-pwr{top:18%;height:11%}
/* Trio caller with its keyboard up */
.screen.kb-up .thread{justify-content:flex-start}   /* messages start at the top, like the hero; trio3d.js scrolls to the newest if they overflow */
.screen.kb-up .compose{padding-bottom:2.6cqw}

/* Original rebuild: the owner's phone tucks in behind the caller's instead of standing beside it.
   hero3d.js wraps it in .owner-wrap (which carries the layout), so the flash halo can sit behind it. */
.phones>.owner-wrap{flex:none;margin-left:calc(clamp(160px,18vw,228px) * -.3);margin-top:14%}
.owner-wrap>.phone.owner{margin:0}
@media (max-width:600px){.phones>.owner-wrap{display:none}}
/* It starts hidden behind the caller's phone. The first time an urgent alert comes in, it springs out to a 18° clockwise
   tilt and stays there through every replay and demo call. That first alert lands on its screen a beat after it pops
   (the delay below); afterwards alerts appear normally. */
.phones>.owner-wrap{rotate:0deg;opacity:0;transform:translate(-55%,0) scale(.9);
  transition:transform .55s cubic-bezier(.34,1.56,.64,1),rotate .55s cubic-bezier(.34,1.56,.64,1),opacity .2s ease}
.phones>.owner-wrap.popped{rotate:18deg;opacity:1;transform:translate(16%,-4%) scale(1.07)}
.phones>.owner-wrap:not(.settled) .notif.st.on{transition-delay:.45s}
/* While the owner's phone is hidden, the caller's phone sits centered in the frame (shifted right by half the room
   the owner's phone takes up), then slides left as the owner's phone pops out */
.phones>.tilt3d{translate:calc(clamp(160px,18vw,228px) * .35) 0;transition:translate .6s cubic-bezier(.22,1,.36,1)}
.phones:has(>.owner-wrap.popped)>.tilt3d{translate:0 0}
@media (prefers-reduced-motion:reduce){.phones>.tilt3d{transition:none}}
@media (max-width:600px){.phones>.tilt3d{translate:0 0}}
@media (prefers-reduced-motion:reduce){.phones>.owner-wrap{transition:none}}
/* On narrower desktops the tilted, popped phone can reach past the window edge: clip it rather than scroll sideways */
.hero:has(.phones>.owner-wrap){overflow-x:clip}
@media (prefers-reduced-motion:reduce){.phones>.owner-wrap{transition:none}}

/* Lock screen: flashlight bottom left, camera bottom right */
.lock .lk-btn{position:absolute;bottom:9cqw;width:12.5cqw;height:12.5cqw;border-radius:50%;display:grid;place-items:center;background:rgba(236,232,220,.13);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.lock .lk-btn svg{width:5.6cqw;height:5.6cqw;fill:none;stroke:#ECE8DC;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.lock .lk-btn.fl{left:9cqw}.lock .lk-btn.cam{right:9cqw}
.lock .quiet{margin-bottom:24cqw}

/* Urgent alert on the owner's phone: the rear LED flashes twice, long-long ("-- --"). Only a soft halo shows,
   coming from behind the phone at the top left, and the phone buzzes slightly. */
.owner-wrap{position:relative}
.owner-wrap>.halo{position:absolute;left:28%;top:6%;width:70%;aspect-ratio:1;translate:-50% -50%;border-radius:50%;pointer-events:none;opacity:0;
  background:radial-gradient(circle,rgba(255,249,236,.5) 0,rgba(255,249,236,.2) 22%,rgba(255,249,236,.06) 45%,transparent 68%)}
.owner-wrap.alerting>.halo{animation:tt-halo 1.5s linear}
.owner-wrap.alerting{animation:tt-buzz .09s linear 16 alternate}
@keyframes tt-halo{0%,46%,54%,100%{opacity:0}5%,38%,59%,92%{opacity:1}}
@keyframes tt-buzz{from{translate:-1.2px 0}to{translate:1.2px 0}}
@media (prefers-reduced-motion:reduce){.owner-wrap.alerting,.owner-wrap.alerting>.halo{animation:none}}

/* Keyboard: dark iOS layout in the site's greens. Keys flash as the caller types. */
.tilt3d .compose{padding-bottom:2.6cqw}
.kb{flex:none;display:grid;gap:2.6cqw;padding:2.4cqw 1.2cqw 0;background:#141A17;border-top:1px solid rgba(236,232,220,.06)}
.kb .sug{display:flex;justify-content:space-around;height:7cqw;align-items:center;font-size:3.6cqw;color:#9AA29B}
.kb .sug span+span{border-left:1px solid rgba(236,232,220,.12)}
.kb .sug span{flex:1;text-align:center}
.kb .row{display:flex;gap:1.4cqw}
.kb .row.r2{padding-inline:4.8cqw}
.kb .k{flex:1;height:10.6cqw;display:grid;place-items:center;border-radius:1.5cqw;background:#3A433E;box-shadow:0 .4cqw 0 rgba(0,0,0,.45);font:400 4.9cqw/1 var(--body);color:#ECE8DC;transition:background .12s,transform .12s}
.kb .k.fn{background:#252D29;font-size:3.6cqw}
.kb .k.sh{flex:1.42;margin-right:1.6cqw}.kb .k.del{flex:1.42;margin-left:1.6cqw}
.kb .k.n123,.kb .k.ret{flex:2.6}
.kb .k.sp{flex:5.6;font-size:3.6cqw;color:#9AA29B}
.kb .k.down{background:#65706A;transform:scale(1.06)}
.kb .k.fn.down{background:#3A433E}
.kb .home{height:8cqw;display:grid;place-items:center}
.kb .home::after{content:"";width:36%;height:1.3cqw;border-radius:999px;background:#ECE8DC;opacity:.85}
