/* ==========================================================================
   Plan story, App page (round 2026-11-20c, PRD Docs/rounds/2026-11-20-why-sorva-app-plan.md).
   One loop, plays on its own while in view: someone walks to the bathroom, can't get up, the room lights up on the
   plan, the phone shows where, the family is called, help arrives.
   Sources: the plan with one SORVA per room (hay-03, polestar-04, playbook trust-privacy "heat field as soft warm shapes
   in a room plan", apple-05 make the invisible visible); the phone beside the plan (apple-fitness d-02); the
   location pinned on a map in the phone and the lock-screen notification (Apple AirTag, Design-Gallery
   shots/apple-airtag d-full: "Share your lost item's location", "Lost Mode"); the stage lines (DS v3 carousel rule,
   lc-tab lines) and the pause button (apple.md §5). Screens copied from the real app (design/app-2026-11/mobile_ui1-3
   and mobile_video.mp4, Fire relabelled Immobility, no names); the call is the drawn iOS scr-call.
   js/plan-story.js sets data-step: walk · fall · push · incident · call · ack · resolved.
   ========================================================================== */
.ps { --gap: clamp(24px, 4vw, 64px); padding-inline: var(--hs-edge); }
.ps-stage { position: relative; max-width: 960px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, min(620px, 62vh)) auto; justify-content: center; align-items: center; gap: var(--gap); }

/* ---- The plan, straight on paper (the white of the drawing melts into the page) ---- */
.ps-plan { position: relative; container-type: inline-size; }
.ps-box { position: relative; width: 100%; aspect-ratio: 1000 / 860; overflow: hidden; }
.ps-box > img { position: absolute; left: -15%; top: -3.49%; width: 130.6%; height: 126.74%; max-width: none; display: block; mix-blend-mode: multiply; opacity: 0.6; }

/* A SORVA in each room: lit, a small ember point with a warm halo */
.ps-dot { position: absolute; width: 2.6%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: var(--ember); z-index: 3;
  box-shadow: 0 0 0 0.6cqw rgba(198, 61, 23, 0.16), 0 0 3cqw 1.2cqw rgba(255, 196, 120, 0.45); transition: transform 0.4s var(--ease-out); }
.ps-dot--alert::after { content: ""; position: absolute; inset: -60%; border-radius: 50%; border: 0.35cqw solid var(--ember); opacity: 0; }

/* The room that raises the alert */
.ps-room { position: absolute; z-index: 1; border-radius: 0.6cqw; background: rgba(198, 61, 23, 0.14); box-shadow: inset 0 0 0 0.3cqw var(--ember); opacity: 0; transition: opacity 0.6s var(--ease-out); }

/* People, as warmth only (the scr-plan pl-heat gradient) */
.ps-heat { position: absolute; z-index: 2; width: 7.5%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; filter: blur(0.5cqw); mix-blend-mode: multiply;
  background: radial-gradient(closest-side, #ffe680 0%, #ffb238 28%, #f2672a 52%, rgba(176, 40, 120, 0.55) 76%, rgba(120, 30, 130, 0) 100%);
  left: 14%; top: 64%; transition: transform 0.7s var(--ease-out), opacity 0.6s; }
.ps-heat--b { opacity: 0; left: 40%; top: 48.5%; }

/* Where: a pin over the room, as the AirTag map pin */
.ps-pin { position: absolute; z-index: 4; translate: -50% -100%; padding: 0.9cqw 1.8cqw; border-radius: 999px; background: var(--ink); color: var(--paper);
  font: 600 clamp(11px, 1.9cqw, 15px)/1 "Montserrat", sans-serif; white-space: nowrap; opacity: 0; transform: translateY(1cqw); transition: opacity 0.4s, transform 0.5s var(--ease-out); }
.ps-pin::after { content: ""; position: absolute; left: 50%; top: 100%; translate: -50% 0; border: 0.9cqw solid transparent; border-top-color: var(--ink); border-bottom: 0; }

/* Time since the fall */
.ps-clock { position: absolute; z-index: 4; left: 4%; top: 4%; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font: 600 clamp(12px, 1.9cqw, 15px)/1 "Montserrat", sans-serif; font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity 0.4s; }
.ps-clock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ember); }

/* ---- The phone and its screens ---- */
.ps-phone { --w: clamp(200px, min(18vw, 28vh), 260px); position: relative; }
.ps-phone .ps-scr { position: absolute; inset: calc(var(--w) * 0.035); width: auto; height: auto; border-radius: calc(var(--w) * 0.13); overflow: hidden;
  container-type: inline-size; opacity: 0; visibility: hidden; transition: opacity 0.45s var(--ease-out), visibility 0s 0.45s;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif; line-height: 1.25; text-align: left; }
.ps-phone .ps-scr * { box-sizing: border-box; margin: 0; }
.ps-sb { display: flex; justify-content: space-between; padding: 3.5cqw 7cqw 0; font-size: 3.6cqw; font-weight: 600; }

/* Alerts list (the app's home, from mobile_video.mp4 frame 1) */
.ps-list { background: #f3f3f3; color: #1d1d1f; }
.ps-list .ps-top { background: #0d0d0d; color: #fff; padding-bottom: 4cqw; }
.ps-list .ps-h { padding: 4cqw 5cqw 3cqw; font-size: 6.4cqw; font-weight: 600; }
.ps-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.4cqw; padding: 0 3.5cqw; }
.ps-tiles span { display: grid; place-items: center; gap: 0.6cqw; padding: 2.6cqw 0; border-radius: 1.8cqw; font-size: 2.6cqw; color: rgba(255, 255, 255, 0.55); }
.ps-tiles b { font-size: 5.4cqw; font-weight: 500; }
.ps-tiles .t-open { background: #3a1517; } .ps-tiles .t-open b { color: #ff5a5f; }
.ps-tiles .t-mid { background: #3a3a3c; } .ps-tiles .t-mid b { color: rgba(255, 255, 255, 0.4); }
.ps-tiles .t-res { background: #12301c; } .ps-tiles .t-res b { color: #4ade80; }
.ps-chips { display: flex; gap: 2cqw; padding: 4cqw 3.5cqw 2cqw; }
.ps-chips span { padding: 1.2cqw 2.8cqw; border-radius: 999px; background: #fff; font-size: 2.8cqw; color: #555; }
.ps-chips span:first-child { background: #3b82f6; color: #fff; }
.ps-row { display: grid; grid-template-columns: 8cqw 1fr auto; gap: 1cqw 3cqw; align-items: start; padding: 3cqw 3.5cqw 3cqw; border-bottom: 1px solid #e6e6e6; }
.ps-row i { grid-row: span 2; width: 8cqw; height: 8cqw; border-radius: 2cqw; background: #fde3e5; display: grid; place-items: center; color: #e5484d; font-style: normal; }
.ps-row i svg { width: 60%; height: 60%; fill: currentColor; }
.ps-row b { font-size: 3.4cqw; font-weight: 500; }
.ps-row small { grid-column: 2; font-size: 2.7cqw; color: #8a8a8e; }
.ps-row em { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-style: normal; font-size: 2.4cqw; padding: 0.8cqw 2cqw; border-radius: 999px; background: #dcfce7; color: #15803d; }

/* Lock screen with the notification (AirTag "Lost Mode" phone) */
.ps-lock { color: #fff; background: radial-gradient(120% 70% at 30% 85%, rgba(239, 106, 58, 0.45), transparent 60%), linear-gradient(165deg, #2c3240 0%, #12151b 60%, #0c0e11 100%); }
.ps-lock .ps-date { margin-top: 12cqw; text-align: center; font-size: 4.4cqw; font-weight: 500; opacity: 0.85; }
.ps-lock .ps-time { text-align: center; font-size: 24cqw; line-height: 1; font-weight: 300; letter-spacing: -0.02em; }
.ps-note { position: absolute; left: 4cqw; right: 4cqw; top: 70%; display: grid; grid-template-columns: 9cqw 1fr; gap: 0.6cqw 3cqw; padding: 3.6cqw; border-radius: 5cqw;
  background: rgba(255, 255, 255, 0.2); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: #fff;
  opacity: 0; transform: translateY(-8cqw) scale(0.96); transition: opacity 0.45s var(--ease-out), transform 0.6s var(--ease-out); }
.ps-note img { grid-row: span 3; width: 9cqw; height: 9cqw; border-radius: 2.2cqw; background: #fff; padding: 1.4cqw; }
.ps-note p { font-size: 3.2cqw; display: flex; justify-content: space-between; opacity: 0.8; }
.ps-note b { font-size: 3.7cqw; font-weight: 600; }
.ps-note span { font-size: 3.5cqw; }

/* Incident screen (mobile_ui1-3.jpeg, relabelled) */
.ps-inc { background: #f6f6f6; color: #1d1d1f; }
.ps-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 4cqw 4cqw 0; font-size: 3.6cqw; }
.ps-nav .back { color: #2f7cf6; }
.ps-nav .q { justify-self: end; width: 4.6cqw; height: 4.6cqw; border-radius: 50%; border: 0.35cqw solid #666; display: grid; place-items: center; font-size: 3cqw; color: #666; }
.ps-inc h4 { margin-top: 6cqw; text-align: center; font-size: 6.6cqw; font-weight: 600; letter-spacing: -0.01em; display: flex; justify-content: center; align-items: center; gap: 1.6cqw; }
.ps-inc h4 svg { width: 6cqw; height: 6cqw; }
.ps-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 2.6cqw 4cqw; padding: 4cqw 5cqw 0; }
.ps-kv small { display: block; font-size: 2.7cqw; color: #6b6e73; }
.ps-kv p { font-size: 3.4cqw; }
.ps-act { padding: 4cqw 5cqw 0; }
.ps-act > small { display: block; font-size: 2.7cqw; color: #6b6e73; margin-bottom: 1.6cqw; }
.ps-act li { list-style: none; display: grid; grid-template-columns: 4cqw 1fr; gap: 0 2cqw; align-items: center; margin-bottom: 1.8cqw; }
.ps-act li i { width: 3.4cqw; height: 3.4cqw; border-radius: 50%; background: #f59e0b; display: grid; place-items: center; }
.ps-act li i.ok { background: #22c55e; }
.ps-act li i.ok::after { content: ""; width: 1.6cqw; height: 0.9cqw; border: solid #fff; border-width: 0 0 0.5cqw 0.5cqw; rotate: -45deg; translate: 0 -0.2cqw; }
.ps-act li b { font-size: 3.4cqw; font-weight: 400; }
.ps-act li small { grid-column: 2; font-size: 2.4cqw; color: #8a8a8e; }
.ps-act .s-ack, .ps-act .s-res { display: none; }
.ps-heatimg { display: block; width: calc(100% - 8cqw); margin: 2cqw 4cqw 0; aspect-ratio: 640 / 488; border-radius: 2.4cqw; object-fit: cover; }
.ps-btns { position: absolute; left: 3cqw; right: 3cqw; bottom: 4cqw; display: grid; gap: 2cqw; }
.ps-btns span { display: block; padding: 3cqw 0; border-radius: 2.4cqw; text-align: center; font-size: 3.2cqw; font-weight: 500; color: #fff; }
.ps-btns .b-resp { background: #ef4444; }
.ps-btns .b-res { background: #22c55e; }
.ps-btns .b-false { background: #4b4b4b; }
.ps-inc .st-res { display: none; }

/* The call screen sits in the phone like the others */
.ps-phone .ps-scr.scr-call { position: absolute; }

/* ---- Stage lines under the stage (DS carousel rule, lc-tab lines on paper) ---- */
.ps-steps { max-width: 960px; margin: clamp(32px, 4vw, 56px) auto 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(12px, 2vw, 32px); }
.ps-steps li { list-style: none; color: var(--ink-3); font: 500 13px/1.3 "Montserrat", sans-serif; letter-spacing: 0.05em; text-transform: uppercase; transition: color 0.3s; }
.ps-steps li i { display: block; position: relative; height: 2px; margin-bottom: 14px; background: var(--line, rgba(15, 17, 21, 0.12)); overflow: hidden; }
.ps-steps li i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ember); }
.ps-steps li.is-done i::after { width: 100%; }
.ps-steps li.is-on { color: var(--ink); font-weight: 600; }
.ps-steps li.is-on i::after { animation: v8-fill var(--seg-time, 4s) linear forwards; }
.ps.is-paused .ps-steps li.is-on i::after, .ps.is-paused * { animation-play-state: paused !important; }
.ps .dots-row { padding-top: 24px; }

/* ---- Steps ---- */
.ps[data-step="walk"] .ps-list, .ps[data-step="fall"] .ps-list,
.ps[data-step="push"] .ps-lock,
.ps[data-step="incident"] .ps-inc, .ps[data-step="ack"] .ps-inc, .ps[data-step="resolved"] .ps-inc,
.ps[data-step="call"] .ps-call { opacity: 1; visibility: visible; transition: opacity 0.45s var(--ease-out); }

.ps[data-step="walk"] .ps-heat--a { animation: ps-walk 4.2s var(--ease-out) forwards; }
@keyframes ps-walk {
  0% { left: 14%; top: 66%; opacity: 0; }
  10% { opacity: 1; }
  30% { left: 22%; top: 52%; }
  55% { left: 38%; top: 48.5%; }
  80% { left: 53%; top: 49%; }
  100% { left: 54%; top: 57%; }
}
.ps:not([data-step="walk"]) .ps-heat--a { left: 54%; top: 58%; }
.ps:is([data-step="fall"], [data-step="push"], [data-step="incident"], [data-step="call"], [data-step="ack"]) .ps-heat--a { transform: rotate(-12deg) scale(1.55, 0.62); }

.ps:is([data-step="push"], [data-step="incident"], [data-step="call"], [data-step="ack"]) .ps-room { opacity: 1; animation: ps-pulse 1.6s ease-in-out infinite; }
.ps:is([data-step="push"], [data-step="incident"], [data-step="call"], [data-step="ack"]) .ps-dot--alert { transform: scale(1.35); }
.ps:is([data-step="push"], [data-step="incident"], [data-step="call"], [data-step="ack"]) .ps-dot--alert::after { animation: ps-ring 1.6s ease-out infinite; }
.ps:is([data-step="push"], [data-step="incident"], [data-step="call"], [data-step="ack"]) .ps-pin { opacity: 1; transform: none; }
.ps:is([data-step="fall"], [data-step="push"], [data-step="incident"], [data-step="call"], [data-step="ack"]) .ps-clock { opacity: 1; }
@keyframes ps-pulse { 50% { background: rgba(198, 61, 23, 0.28); } }
@keyframes ps-ring { 0% { opacity: 0.9; transform: scale(0.6); } 100% { opacity: 0; transform: scale(2.2); } }

.ps[data-step="push"] .ps-note { opacity: 1; transform: none; transition-delay: 0.35s; }

.ps:is([data-step="ack"], [data-step="resolved"]) .ps-heat--b { opacity: 1; animation: ps-help 1.6s var(--ease-out) forwards; }
@keyframes ps-help { from { left: 40%; top: 48.5%; } to { left: 57%; top: 55%; } }
.ps:is([data-step="ack"], [data-step="resolved"]) .ps-act .s-ack { display: grid; }
.ps[data-step="resolved"] .ps-act .s-res { display: grid; }
.ps:is([data-step="ack"], [data-step="resolved"]) .ps-btns .b-resp { display: none; }
.ps[data-step="resolved"] .ps-btns { display: none; }
.ps[data-step="resolved"] .ps-inc .st-det { display: none; }
.ps[data-step="resolved"] .ps-inc .st-res { display: inline; }

/* ---- Phone and tablet: the phone sits under the plan, overlapping its lower right ---- */
@media (max-width: 900px) {
  .ps-stage { grid-template-columns: 1fr; gap: 0; }
  .ps-phone { --w: min(46vw, 230px); justify-self: end; margin-top: -22%; margin-right: 2%; }
  .ps-steps { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
}
/* Phone (round 2026-11-20d, the user's direction Heatsig_Asset_Preview/Direction/App_mobile/After.png): the plan full
   bleed, the phone low right over the plan's foot, the four stage lines stacked in the column beside it with the
   pause under them, so plan, phone and steps read in one screen. The stage box steps aside (display: contents). */
@media (max-width: 600px) {
  .ps { padding-inline: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr; column-gap: 12px; }
  .ps-stage { display: contents; }
  .ps-plan { grid-column: 1 / -1; grid-row: 1; }
  .ps-phone { --w: min(48vw, 240px); grid-column: 2; grid-row: 2 / span 2; justify-self: end; margin: -16vw var(--hs-edge) 0 0; z-index: 5; }
  .ps-steps { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 28px; margin: 24px 0 0; padding-left: var(--hs-edge); }
  .ps-steps li { font-size: 12px; }
  .ps-steps li i { margin-bottom: 10px; }
  .ps .dots-row { grid-column: 1; grid-row: 3; align-self: start; justify-content: flex-start; padding: 28px 0 0 var(--hs-edge); }
}

/* ---- Reduced motion: one still frame (the alert), the four steps as plain captions ---- */
.ps.is-still .ps-steps li { color: var(--ink); }
.ps.is-still .ps-steps li i::after { width: 100%; animation: none; }
.ps.is-still .dots-row { display: none; }
@media (prefers-reduced-motion: reduce) {
  .ps *, .ps *::after { animation: none !important; transition: none !important; }
}

.ps-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- The app's floor-plan screen (App "Your home, at a glance", round 2026-11-20d). The same plan, dots and heat as
   the story, in the app's light screen with its title row and the rooms online under it (the real Home screen lists
   the rooms and their lights). Drawn until the app team sends a real floor-plan screenshot. ---- */
.lc-phone > .ps-planscr { position: relative; background: #f6f6f6; color: #1d1d1f; container-type: inline-size;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif; line-height: 1.25; text-align: left; }
.ps-planscr * { box-sizing: border-box; margin: 0; }
.ps-ph { display: flex; justify-content: space-between; align-items: center; padding: 5cqw 5cqw 3cqw; }
.ps-ph b { font-size: 7cqw; font-weight: 600; }
.ps-ph span { display: inline-flex; align-items: center; gap: 1.4cqw; padding: 1cqw 2.6cqw; border-radius: 999px; background: #fff; font-size: 3.2cqw; font-weight: 600; }
.ps-ph span::before { content: ""; width: 1.8cqw; height: 1.8cqw; border-radius: 50%; background: #34c759; }
.ps-planscr .ps-box { margin: 0 2cqw; width: auto; background: #fff; border-radius: 3cqw; }
.ps-planscr .ps-box > img { opacity: 0.7; }
.ps-planscr .ps-dot { width: 3.6%; }
.ps-heat--still { opacity: 1; }
.ps-rooms { list-style: none; padding: 3cqw 4cqw 0; }
.ps-rooms li { display: flex; justify-content: space-between; align-items: center; padding: 2.6cqw 1cqw; border-bottom: 1px solid #e6e6e6; font-size: 3.4cqw; }
.ps-rooms em { font-style: normal; font-size: 2.8cqw; color: #15803d; display: inline-flex; align-items: center; gap: 1.2cqw; }
.ps-rooms em::before { content: ""; width: 1.6cqw; height: 1.6cqw; border-radius: 50%; background: #22c55e; }

/* ---- Captions on the plan (round 2026-11-20e, user: a first-time visitor needs to know what the moving warmth is).
   One short line per step, bottom left of the plan, in the "Bath 1" pin's style (AirTag's map labels); a tag rides
   with the person during the walk. js/plan-story.js sets the text. ---- */
.ps-cap { position: absolute; z-index: 4; left: 4%; bottom: 5%; max-width: 70%; padding: 9px 14px; border-radius: 999px; background: var(--ink); color: var(--paper);
  font: 600 clamp(12px, 1.9cqw, 15px)/1.25 "Montserrat", sans-serif; opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.35s var(--ease-out); }
.ps-cap.is-on { opacity: 1; transform: none; }
.ps-tag { position: absolute; left: 50%; bottom: 112%; translate: -50% 0; padding: 4px 9px; border-radius: 999px; background: var(--ink); color: var(--paper);
  font: 600 clamp(10px, 1.5cqw, 12px)/1.2 "Montserrat", sans-serif; white-space: nowrap; opacity: 0; transition: opacity 0.3s; }
.ps-heat--a { filter: none; }
.ps-heat--a::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; filter: blur(0.5cqw); }
.ps-heat--a { background: none !important; }
.ps-heat--a::before { background: radial-gradient(closest-side, #ffe680 0%, #ffb238 28%, #f2672a 52%, rgba(176, 40, 120, 0.55) 76%, rgba(120, 30, 130, 0) 100%); }
.ps[data-step="walk"] .ps-tag { opacity: 1; transition-delay: 0.5s; }
@media (max-width: 600px) { .ps-cap { left: 3%; bottom: 3%; padding: 7px 11px; font-size: 12px; } }

/* Round 2026-11-20h (Stanley): the clock is the time of night (21:40:28 → 21:46), shown through the whole story */
.ps .ps-clock { opacity: 1; }
/* Phone: the caption sits at the top of the plan, under the clock, so the phone over the plan's foot never covers it
   (Stanley's screenshot Heatsig_Asset_Preview/Direction/App_mobile/a visual bug to be updated.jpeg) */
@media (max-width: 600px) {
  .ps-cap { top: calc(4% + 40px); bottom: auto; left: 4%; max-width: 92%; white-space: normal; }
}
