/* ── iot-scene.css — the IoT sensor scene on iot.html (and a signature-van scene iot.html leaves out) ──
   Everything is scoped under .s6-physical. The finished (fully visible) state is the plain CSS;
   motion only adds the idle bob loops (below, gated by html.fx-motion) and the scroll-linked
   arrival, which app/iot-scene.js writes as inline transforms.                            */
.s6-physical {
  --dw: clamp(210px, 26vw, 390px);            /* IoT device width */
  --arw: clamp(64px, 9vw, 150px);             /* gap the arrow spans, right of the device */
  --g1: clamp(20px, 3.4vw, 56px);             /* gap left of the device (smaller: device sits slightly left) */
  --vanw: clamp(300px, 44vw, 690px);          /* van width */
  background: var(--page);
}
.s6-physical .ph-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 48px; margin-bottom: clamp(24px, 3.2vw, 44px); }
.s6-physical .ph-head .s6-lede { max-width: 32ch; }

/* ── a scene: one rounded studio plate, about one viewport tall ── */
.s6-physical .ph-scene {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: clamp(560px, calc(100vh - 120px), 820px);
  min-height: clamp(560px, calc(100svh - 120px), 820px);
  padding: clamp(18px, 2.2vw, 30px) clamp(18px, 2.6vw, 36px) clamp(26px, 3vw, 44px);
  border-radius: var(--r-panel); border: 1px solid rgba(0, 57, 108, .07);
}
.s6-physical .ph-scene + .ph-scene { margin-top: clamp(14px, 1.8vw, 24px); }
.s6-physical .ph-iot { background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%); }
.s6-physical .ph-iot::before {                 /* a faint instrument dot-grid, fading out from the device */
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background-image: radial-gradient(rgba(0, 57, 108, .16) 1px, transparent 1.4px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(55% 60% at 45% 56%, #000 0%, transparent 78%); mask-image: radial-gradient(55% 60% at 45% 56%, #000 0%, transparent 78%);
}
.s6-physical .ph-van { background: linear-gradient(180deg, #F6F8FB 0%, #ECF1F7 56%, #E1E9F2 100%); min-height: clamp(520px, calc(100vh - 190px), 730px); min-height: clamp(520px, calc(100svh - 190px), 730px); }
.s6-physical .ph-van::after {                  /* studio floor: a soft sweep, no hard horizon to misalign */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 44%; z-index: -2; pointer-events: none;
  background: radial-gradient(70% 90% at 50% 100%, rgba(0, 57, 108, .07), rgba(0, 57, 108, 0) 70%);
}

/* the scene's top bar: index · name · tag ......... link */
.s6-physical .ph-bar { position: relative; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; min-height: 42px; }
.s6-physical .ph-idx { font: 600 12px/1 var(--mono); letter-spacing: .08em; color: var(--gold-ink); display: inline-flex; align-items: center; gap: 12px; }
.s6-physical .ph-idx::after { content: ""; width: 22px; height: 1.5px; background: rgba(0, 57, 108, .22); border-radius: 2px; }
.s6-physical .ph-name { font: 700 16px/1.2 var(--font); letter-spacing: -.005em; color: var(--ink); margin: 0; }
.s6-physical .ph-tag { font: 600 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); background: var(--gold-30); border: 1px solid rgba(140, 94, 14, .22); padding: 5px 9px 4px; border-radius: 999px; }
.s6-physical .ph-link {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 16px;
  font: 700 14px/1 var(--font); color: var(--navy); text-decoration: none; white-space: nowrap;
  border-radius: 999px; background: rgba(255, 255, 255, .78); border: 1px solid var(--line-navy);
  transition: background .25s var(--ease-std), border-color .25s var(--ease-std);
}
.s6-physical .ph-link svg { width: 16px; height: 16px; transition: transform .35s var(--ease); }
.s6-physical .ph-link:hover { background: #fff; border-color: rgba(0, 57, 108, .3); }
.s6-physical .ph-link:hover svg { transform: translateX(3px); }

/* ── the layout: [card] [object] [card] ── */
.s6-physical .ph-grid { flex: 1; position: relative; display: grid; align-items: center; align-content: center; justify-content: center; padding-top: clamp(14px, 3vh, 36px); }
.s6-physical .ph-iot .ph-grid { grid-template-columns: minmax(200px, 290px) auto minmax(200px, 300px); }
.s6-physical .ph-van .ph-grid { grid-template-columns: minmax(200px, 270px) auto minmax(210px, 290px); }
.s6-physical .ph-obj { position: relative; }
.s6-physical .ph-dev { width: var(--dw); margin: 0 var(--arw) 0 var(--g1); }
.s6-physical .ph-veh { width: var(--vanw); margin: 0 clamp(14px, 2.2vw, 36px); }
.s6-physical .ph-iot .ph-l { align-self: start; }
.s6-physical .ph-iot .ph-r { align-self: center; }
.s6-physical .ph-van .ph-l { align-self: start; }
.s6-physical .ph-van .ph-r { align-self: end; }
.s6-physical .ph-move, .s6-physical .ph-pitch, .s6-physical .ph-bob { position: relative; }
.s6-physical .ph-bob img { display: block; width: 100%; height: auto; -webkit-user-drag: none; user-select: none; }

/* ── info cards: solid white, mono label, short title, one line ── */
.s6-physical .ph-card {
  position: relative; z-index: 2; background: var(--card); border-radius: var(--r-card);
  padding: clamp(18px, 1.7vw, 24px); border: 1px solid rgba(0, 57, 108, .07); box-shadow: var(--shadow-card);
}
.s6-physical .ph-lbl { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font: 600 11.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.s6-physical .ph-lbl::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--gold); flex: none; }
.s6-physical .ph-t { margin: 0 0 8px; font: 700 clamp(18px, 1.45vw, 22px)/1.22 var(--font); letter-spacing: -.012em; color: var(--ink); text-wrap: balance; }
.s6-physical .ph-d { margin: 0; font: 500 15px/1.5 var(--font); color: var(--muted); text-wrap: pretty; }

/* IoT, left card: a heartbeat line (the AC's health) */
.s6-physical .ph-ecg { display: block; width: 100%; height: auto; aspect-ratio: 240 / 36; margin-top: 16px; overflow: visible; }
.s6-physical .ph-ecg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.s6-physical .ph-ecg .base { stroke: rgba(0, 57, 108, .16); stroke-width: 1.6; }
.s6-physical .ph-ecg .run { stroke: var(--gold); stroke-width: 2.2; stroke-dasharray: 26 74; stroke-dashoffset: 84; }  /* rests on the first beat */

/* IoT, right card: the arrow that points at the device */
.s6-physical .ph-arrow { position: absolute; right: 100%; top: 50%; width: calc(var(--arw) - 16px); height: 14px; margin-top: -7px; color: var(--navy); pointer-events: none; }
.s6-physical .ph-arrow .ln { position: absolute; left: 4px; right: 0; top: 6.25px; height: 1.5px; border-radius: 2px; background: linear-gradient(90deg, var(--navy), rgba(0, 57, 108, .3)); transform-origin: 100% 50%; }
.s6-physical .ph-arrow .hd { position: absolute; left: 0; top: 0; width: 14px; height: 14px; }
.s6-physical .ph-arrow .dot { position: absolute; right: -4px; top: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(0, 57, 108, .12); }

/* van, left card: what is on board */
.s6-physical .ph-kit { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.s6-physical .ph-kit li { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 10px; border-radius: 10px; background: #F1F5FA; border: 1px solid rgba(0, 57, 108, .08); font: 600 13.5px/1 var(--font); color: var(--ink); white-space: nowrap; }
.s6-physical .ph-kit .i2 { width: 18px; height: 18px; color: var(--navy); flex: none; }

/* van, right card: warehouse → parts centres → van */
.s6-physical .ph-route { position: relative; margin-top: 16px; }
.s6-physical .ph-route ol { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.s6-physical .ph-route li { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font: 500 10.5px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.s6-physical .ph-route .ib { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #F1F5FA; border: 1px solid rgba(0, 57, 108, .1); }
.s6-physical .ph-route li:last-child .ib { background: var(--navy); border-color: var(--navy); }
.s6-physical .ph-route li:last-child .i2 { color: #fff; }
.s6-physical .ph-route .i2 { width: 20px; height: 20px; color: var(--navy); }
.s6-physical .ph-route .trk { position: absolute; top: 20px; left: 16.67%; right: 16.67%; height: 0; border-top: 1.5px dashed rgba(0, 57, 108, .28); }
.s6-physical .ph-route .run { position: absolute; left: 0; top: -1px; width: 100%; height: 0; opacity: 0; }
.s6-physical .ph-route .run::before { content: ""; position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgba(247, 183, 68, .28); }

/* ── the IoT device: glow, sensing rings, floor shadow ── */
.s6-physical .ph-dev::before {
  content: ""; position: absolute; left: 58%; top: 50%; width: 170%; aspect-ratio: 1; translate: -50% -50%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(253, 233, 199, .95), rgba(253, 233, 199, .45) 45%, rgba(253, 233, 199, 0) 74%);
}
.s6-physical .ph-rings { position: absolute; left: 66%; top: 49%; width: 150%; aspect-ratio: 1; translate: -50% -50%; pointer-events: none; }
.s6-physical .ph-rings i { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(214, 150, 40, .55); }
.s6-physical .ph-rings i:nth-child(1) { transform: scale(.56); opacity: .9; }       /* finished state: a still sonar */
.s6-physical .ph-rings i:nth-child(2) { transform: scale(.76); opacity: .55; }
.s6-physical .ph-rings i:nth-child(3) { transform: scale(.96); opacity: .25; }
.s6-physical .ph-dev .ph-shadow {
  position: absolute; left: 14%; right: 10%; bottom: -14%; height: 9%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0, 30, 60, .3), rgba(0, 30, 60, 0)); transform-origin: 50% 50%;
}
.s6-physical .ph-dev .ph-bob img { filter: drop-shadow(0 18px 26px rgba(0, 40, 80, .16)); }

/* ── the van: ground shadow (wheel contacts + soft body shadow), speed lines ── */
.s6-physical .ph-veh .ph-shadow {            /* a flat ellipse laid along the line through both wheel contacts (front 31%/100%, rear 86%/90%) */
  position: absolute; left: 8%; width: 100%; top: 88%; height: 14%; pointer-events: none; rotate: -5.4deg;
  background:
    radial-gradient(8.5% 26% at 22.5% 50%, rgba(0, 16, 32, .55), rgba(0, 16, 32, 0)),
    radial-gradient(6.5% 20% at 77.5% 47%, rgba(0, 16, 32, .45), rgba(0, 16, 32, 0)),
    radial-gradient(closest-side, rgba(0, 30, 60, .28), rgba(0, 30, 60, .12) 62%, rgba(0, 30, 60, 0));
}
.s6-physical .ph-speed { position: absolute; left: 97%; top: 36%; width: 18%; height: 36%; pointer-events: none; opacity: 0; }
.s6-physical .ph-speed i { position: absolute; left: 0; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgba(0, 57, 108, .45), rgba(0, 57, 108, 0)); }
.s6-physical .ph-speed i:nth-child(1) { top: 0; width: 70%; }
.s6-physical .ph-speed i:nth-child(2) { top: 42%; width: 100%; left: 6%; }
.s6-physical .ph-speed i:nth-child(3) { top: 84%; width: 55%; }
.s6-physical .ph-pitch { transform-origin: 58% 92%; }

/* ── motion: idle loops (paused while the scene is off-screen; iot-scene.js toggles .is-live) ── */
@keyframes ph6-bob-iot { 0%, 100% { transform: translate3d(0, 0, 0) rotate(-.7deg); } 50% { transform: translate3d(0, -12px, 0) rotate(.7deg); } }
@keyframes ph6-shadow-iot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.82); opacity: .62; } }
@keyframes ph6-bob-van { 0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); } 50% { transform: translate3d(0, -4px, 0) rotate(-.35deg); } }
@keyframes ph6-shadow-van { 0%, 100% { scale: 1; opacity: 1; } 50% { scale: .965 .9; opacity: .74; } }
@keyframes ph6-ring { 0% { transform: scale(.4); opacity: 0; } 14% { opacity: .95; } 100% { transform: scale(1.02); opacity: 0; } }
@keyframes ph6-ecg { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes ph6-run { 0% { transform: translateX(0); opacity: 0; } 10% { opacity: 1; } 88% { opacity: 1; } 100% { transform: translateX(100%); opacity: 0; } }

html.fx-motion .s6-physical .ph-dev .ph-bob { animation: ph6-bob-iot 3.8s ease-in-out infinite; }
html.fx-motion .s6-physical .ph-dev .ph-shadow { animation: ph6-shadow-iot 3.8s ease-in-out infinite; }
html.fx-motion .s6-physical .ph-veh .ph-bob { animation: ph6-bob-van 3.2s ease-in-out infinite; transform-origin: 58% 92%; }
html.fx-motion .s6-physical .ph-veh .ph-shadow { animation: ph6-shadow-van 3.2s ease-in-out infinite; }
html.fx-motion .s6-physical .ph-rings i { opacity: 0; animation: ph6-ring 4.2s cubic-bezier(.2, .6, .35, 1) infinite; }
html.fx-motion .s6-physical .ph-rings i:nth-child(2) { animation-delay: -1.4s; }
html.fx-motion .s6-physical .ph-rings i:nth-child(3) { animation-delay: -2.8s; }
html.fx-motion .s6-physical .ph-ecg .run { stroke-dasharray: 18 82; animation: ph6-ecg 2.6s linear infinite; }
html.fx-motion .s6-physical .ph-route .run { animation: ph6-run 3.2s var(--ease-std) infinite; }
/* paused unless the scene is on screen. This rule must out-rank the `animation` shorthands above
   (e.g. `.ph-dev .ph-bob`), which reset animation-play-state to running; the .ph-scene step does that. */
html.fx-motion .s6-physical .ph-scene :is(.ph-bob, .ph-shadow, .ph-rings i, .ph-ecg .run, .ph-route .run) { animation-play-state: paused; }
html.fx-motion .s6-physical .ph-scene.is-live :is(.ph-bob, .ph-shadow, .ph-rings i, .ph-ecg .run, .ph-route .run) { animation-play-state: running; }
html.fx-motion .s6-physical .ph-move, html.fx-motion .s6-physical .ph-card { will-change: transform, opacity; }
/* calm (app/fx.js): the sensor and the van hold still once in place (iot-scene.js only fades them and their cards in);
   the rings, the ECG line and the dot along the route keep going */
html.fx-calm .s6-physical .ph-scene :is(.ph-bob, .ph-shadow) { animation: none; }

/* ── widths ── */
@media (max-width: 1180px) {
  .s6-physical { --vanw: clamp(300px, 40vw, 520px); }
  .s6-physical .ph-van .ph-grid { grid-template-columns: minmax(196px, 250px) auto minmax(206px, 270px); }
}
/* 880–1000: the van row (196 + van + 206) was wider than the plate, so both cards sat ~9px from its edges */
@media (max-width: 1000px) {
  .s6-physical { --vanw: clamp(300px, 38vw, 400px); }
  .s6-physical .ph-van .ph-grid { grid-template-columns: minmax(178px, 230px) auto minmax(188px, 250px); }
  .s6-physical .ph-veh { margin: 0 clamp(12px, 1.8vw, 20px); }
}
/* tablet portrait and below: object on top, cards under it */
@media (max-width: 879px) {
  .s6-physical .ph-scene { min-height: 0; }
  .s6-physical .ph-iot .ph-grid, .s6-physical .ph-van .ph-grid { grid-template-columns: 1fr 1fr; gap: 14px; align-content: start; padding-top: 18px; }
  .s6-physical .ph-obj { grid-column: 1 / -1; justify-self: center; order: -1; }
  .s6-physical .ph-dev { width: clamp(190px, 40vw, 300px); margin: 22px 0 56px; }
  .s6-physical .ph-veh { width: min(100%, 580px); margin: 28px 0 34px; }
  .s6-physical .ph-card { align-self: stretch !important; }
  /* the right card sits below the device's right half, so its arrow turns to point straight up */
  .s6-physical .ph-arrow { right: auto; left: 34px; top: auto; bottom: 100%; width: 14px; height: 44px; margin: 0 0 4px; }
  .s6-physical .ph-arrow .ln { left: 6.25px; right: auto; top: 4px; bottom: 0; width: 1.5px; height: auto; background: linear-gradient(0deg, rgba(0, 57, 108, .3), var(--navy)); transform-origin: 50% 100%; }
  .s6-physical .ph-arrow .hd { transform: rotate(90deg); }
  .s6-physical .ph-arrow .dot { right: auto; left: 3px; top: auto; bottom: -4px; }
}
/* phones: one column */
@media (max-width: 600px) {
  .s6-physical .ph-head { gap: 12px; }
  .s6-physical .ph-scene { border-radius: 26px; padding: 16px 16px 18px; }
  .s6-physical .ph-bar { gap: 8px 10px; }
  .s6-physical .ph-link { height: 36px; padding: 0 12px 0 14px; font-size: 13.5px; }
  .s6-physical .ph-iot .ph-grid, .s6-physical .ph-van .ph-grid { grid-template-columns: 1fr; gap: 12px; }
  .s6-physical .ph-dev { width: min(62vw, 250px); margin: 24px 0 44px; }
  .s6-physical .ph-veh { width: calc(100% + 16px); margin: 26px -8px 26px; }
  .s6-physical .ph-arrow { display: none; }         /* one column: the right card is not next to the device any more */
}
