/* Key plan (Sightlines, Part C; js/ux/keyplan.js). A small paper card in the Home plan card (where you are on the floor) and the larger view that rises out of it.
   Quiet Instrument: paper white, ink, the Home level's soft shadow, no glass rim, no gradients, no filter or backdrop-filter anywhere. Targets 44px or more.
   The card sits in a corner the script picks from the drawing's ink (data-c: br, bl, tl); in the top left it sits under the mode bar, as the drawing does.
   Shown in Plan and Rooms only: any other data-pm (sun, breeze, privacy, renders, walk) fades it away. */
.u-plan { --kp-w: calc(140px * var(--ui-scale, 1)); --kp-h: calc(100px * var(--ui-scale, 1)); --kp-ink: var(--primary-bg, #1d1d1f); }

/* ---------- the card ---------- */
html body #lv-home .u-plan .kp-inset {
  position: absolute; z-index: 2; box-sizing: border-box; width: var(--kp-w); height: var(--kp-h); right: var(--s4, 16px); bottom: var(--s4, 16px); left: auto; top: auto; margin: 0; padding: 7px 8px 6px;
  display: flex; flex-direction: column; gap: 3px; text-align: left; border: 0; border-radius: var(--r-inner, 12px); background: #fff; color: #16161b;
  box-shadow: var(--mf-sh-float, 0 0 0 1px rgba(22, 22, 27, .06), 0 1px 2px rgba(22, 22, 27, .06), 0 8px 24px -12px rgba(22, 22, 27, .22)); cursor: pointer; overflow: hidden;
  opacity: 1; visibility: visible; transition: opacity .32s var(--e-x, ease), visibility 0s linear 0s; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
html body #lv-home .u-plan .kp-inset[data-c="bl"] { left: var(--s4, 16px); right: auto; }
html body #lv-home .u-plan .kp-inset[data-c="tl"] { left: var(--s4, 16px); right: auto; bottom: auto; top: calc(var(--q-hm-bar, 64px) + var(--s2, 8px)); }
/* the compact card: the same card, map and "You are here" only, for a drawing that leaves no corner free at full size (the tower and floor stay in the larger view and the label read aloud) */
html body #lv-home .u-plan .kp-inset[data-s="min"] { width: calc(116px * var(--ui-scale, 1)); height: calc(74px * var(--ui-scale, 1)); padding: 6px 8px 5px; }
html body #lv-home .u-plan .kp-inset[data-s="min"] .kp-t { display: none; }
html body #lv-home .u-plan .kp-inset[data-s="mini"] { width: calc(72px * var(--ui-scale, 1)); height: calc(56px * var(--ui-scale, 1)); padding: 6px; }   /* last resort: the map alone (44px or more each way) */
html body #lv-home .u-plan .kp-inset[data-s="mini"] :is(.kp-cap) { display: none; }
html body #lv-home .u-plan .kp-inset:focus-visible { outline: 2px solid var(--kp-ink); outline-offset: 2px; }
/* waiting for the home to land (the flight is not disturbed), a quiet fade between corners, the larger view rising out of it, and every mode but Plan and Rooms */
html body #lv-home .u-plan .kp-inset.kp-wait, html body #lv-home .u-plan .kp-inset.kp-lift { opacity: 0; visibility: hidden; pointer-events: none; transition: none; }
html body #lv-home .u-plan .kp-inset.kp-hop { opacity: 0; transition: opacity .15s var(--e-x, ease); pointer-events: none; }
html body #lv-home .u-plan[data-pm]:not([data-pm="plan"]):not([data-pm="rooms"]) .kp-inset { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s var(--e-x, ease), visibility 0s linear .3s; }   /* Sunlight, Airflow, Privacy, Renders, Walkthrough, and any mode added later */

/* the floor: the Floor level's polygons, quiet outlines; the open home in ink */
html body #lv-home .u-plan .kp-inset svg.kp-map { display: block; flex: 1 1 auto; width: 100%; height: auto; min-height: 0; overflow: hidden; fill: none; stroke: none; }
html body #lv-home .u-plan .kp-inset .kp-p { fill: rgba(22, 22, 27, .05); stroke: rgba(22, 22, 27, .38); stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: fill .32s var(--e-x, ease), stroke .32s var(--e-x, ease); }
html body #lv-home .u-plan .kp-inset .kp-p.me { fill: var(--kp-ink); stroke: var(--kp-ink); stroke-width: 1.4px; }
html body #lv-home .u-plan .kp-inset .kp-halo { fill: none; stroke: var(--kp-ink); stroke-width: 1.6px; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; pointer-events: none; }
html body #lv-home .u-plan .kp-inset .kp-cap { display: grid; gap: 1px; flex: none; min-width: 0; }
html body #lv-home .u-plan .kp-inset .kp-t { font: 600 11px/1.25 var(--sans); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #16161b; }
html body #lv-home .u-plan .kp-inset .kp-h { display: flex; align-items: center; gap: 5px; font: 500 10px/1.25 var(--sans); font-style: normal; letter-spacing: .01em; color: rgba(22, 22, 27, .62); white-space: nowrap; }
html body #lv-home .u-plan .kp-inset .kp-h u { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--kp-ink); text-decoration: none; }

/* ---------- the larger view: in place, over the plan card ---------- */
html body #lv-home .u-plan .kp-big { position: absolute; inset: 0; z-index: 8; border-radius: inherit; overflow: hidden; }
html body #lv-home .u-plan .kp-big.kp-closing { pointer-events: none; }
html body #lv-home .u-plan .kp-scrim { position: absolute; inset: 0; background: rgba(29, 29, 31, .26); }   /* no blur: the plan under it stays as it was */
html body #lv-home .u-plan .kp-panel { position: absolute; inset: var(--s3, 12px); display: flex; flex-direction: column; border-radius: var(--r-card, 20px); background: #fff; color: #16161b; overflow: hidden; will-change: transform, opacity;
  box-shadow: var(--mf-sh-float, 0 0 0 1px rgba(22, 22, 27, .06), 0 1px 2px rgba(22, 22, 27, .06), 0 8px 24px -12px rgba(22, 22, 27, .22)); transform-origin: 50% 50%; }
html body #lv-home .u-plan .kp-in { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
html body #lv-home .u-plan .kp-hd { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3, 12px); padding: var(--s4, 16px) var(--s3, 12px) 0 var(--s5, 20px); }
html body #lv-home .u-plan .kp-hd > div { min-width: 0; padding-top: 4px; }
html body #lv-home .u-plan .kp-k { margin: 0; font: var(--ty-cap, 500 12px/1.33 var(--sans)); letter-spacing: .02em; text-transform: uppercase; color: rgba(22, 22, 27, .6); }
html body #lv-home .u-plan .kp-hd h3 { margin: 2px 0 0; font: var(--ty-head, 600 17px/1.3 var(--sans)); letter-spacing: var(--tr-head, -.01em); color: #16161b; }
html body #lv-home .u-plan .kp-x { flex: none; display: grid; place-items: center; width: var(--q-ctl, 44px); height: var(--q-ctl, 44px); padding: 0; border-radius: 50%; background: rgba(22, 22, 27, .06); color: #16161b; }
html body #lv-home .u-plan .kp-x svg { width: 20px; height: 20px; }
html body #lv-home .u-plan .kp-fig { position: relative; flex: 1 1 auto; min-height: 0; margin: var(--s2, 8px) var(--s4, 16px) 0; }
html body #lv-home .u-plan .kp-fig svg.kp-bs { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: hidden; fill: none; stroke: none; }
html body #lv-home .u-plan .kp-img { transition: opacity .4s var(--e-x, ease); }
html body #lv-home .u-plan .kp-bp { fill: rgba(255, 255, 255, .001); stroke: rgba(22, 22, 27, .5); stroke-width: calc(var(--kp-sw, 1.5) * 1px); stroke-linejoin: round; cursor: pointer; outline: none; transition: fill .2s var(--e-x, ease); }
html body #lv-home .u-plan .kp-bp:active, html body #lv-home .u-plan .kp-bp:focus-visible { fill: rgba(22, 22, 27, .14); }
html body #lv-home .u-plan .kp-bp.s-hold, html body #lv-home .u-plan .kp-bp.s-mine { fill: color-mix(in srgb, var(--hold, #ff9f0a) 36%, transparent); }
html body #lv-home .u-plan .kp-bp.s-sold { fill: url(#kp-hatch); }
html body #lv-home .u-plan .kp-bp.me { fill: rgba(22, 22, 27, .2); stroke: var(--kp-ink); stroke-width: calc(var(--kp-sw, 1.5) * 2.4px); }
html body #lv-home .u-plan .kp-n { fill: #16161b; font-family: var(--sans); font-weight: 700; font-size: calc(var(--kp-fs, 22) * 1px); text-anchor: middle; paint-order: stroke; stroke: rgba(255, 255, 255, .9); stroke-width: calc(var(--kp-fs, 22) * .22px); stroke-linejoin: round; }
html body #lv-home .u-plan .kp-tag.me .kp-n { fill: #fff; stroke: none; }
html body #lv-home .u-plan .kp-dot { fill: var(--kp-ink); stroke: #fff; stroke-width: calc(var(--kp-sw, 1.5) * 1.4px); }
html body #lv-home .u-plan .kp-ft { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s3, 12px); flex-wrap: wrap; padding: var(--s2, 8px) var(--s5, 20px) var(--s4, 16px); }
html body #lv-home .u-plan .kp-ft p { margin: 0; font: var(--ty-foot, 400 13px/1.38 var(--sans)); color: rgba(22, 22, 27, .62); }
html body #lv-home .u-plan .kp-keys { display: flex; align-items: center; gap: var(--s3, 12px); flex-wrap: wrap; }
html body #lv-home .u-plan .kp-k + .kp-k, html body #lv-home .u-plan .kp-keys .kp-k { margin: 0; display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font: var(--ty-cap, 500 12px/1.33 var(--sans)); color: rgba(22, 22, 27, .72); }
html body #lv-home .u-plan .kp-keys i { flex: none; width: 12px; height: 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(22, 22, 27, .28); background: #fff; }
html body #lv-home .u-plan .kp-keys i.me { background: var(--kp-ink); box-shadow: none; }
html body #lv-home .u-plan .kp-keys i.hold { background: color-mix(in srgb, var(--hold, #ff9f0a) 55%, #fff); box-shadow: none; }
html body #lv-home .u-plan .kp-keys i.sold { background: repeating-linear-gradient(45deg, #b9b9c0 0 2px, #ececf0 2px 5px); }   /* the hatch the Floor level draws on a sold home */

@media (prefers-reduced-motion: reduce) {
  html body #lv-home .u-plan .kp-inset, html body #lv-home .u-plan .kp-inset .kp-p, html body #lv-home .u-plan .kp-bp { transition-duration: .01s; }
  html body #lv-home .u-plan .kp-panel { will-change: auto; }
}
