/* Demo page: three animated "windows". Each plays when scrolled into view and can be replayed.
   With reduced motion, every window shows its finished state and nothing moves. */

.demo-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: clamp(28px, 4vw, 56px); align-items: start; }
.demo-copy { display: grid; gap: 14px; }
.demo-copy h2 { font-size: var(--step-2); }
.demo-copy > p { color: var(--muted); }
.demo-points { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.demo-points li { padding-left: 18px; position: relative; font-size: 0.95rem; }
.demo-points li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 7px; height: 2px; background: var(--sun); }
@media (max-width: 960px) { .demo-grid { grid-template-columns: 1fr; } }

.demo-wide { display: grid; grid-template-columns: 120px minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.demo-wide .demo-media { aspect-ratio: auto; border-bottom: 0; border-right: 1px solid var(--line); display: grid; place-items: center; background: var(--panel); }
.demo-wide .demo-media svg { width: 44px; height: 44px; stroke: var(--accent); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.demo-wide .demo-body { padding: 26px 28px; display: grid; gap: 8px; align-content: start; }
.demo-wide h2 { font-size: var(--step-1); }
.demo-wide .demo-body p { color: var(--muted); }
.demo-wide .status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin-top: 6px; }
.demo-wide .status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sun); }
@media (max-width: 560px) { .demo-wide { grid-template-columns: 1fr; } .demo-wide .demo-media { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px; } }

/* Window chrome */
.dw { --dw-bg: #16191c; --dw-panel: #1e2327; --dw-line: #2b3238; --dw-ink: #e8ecef; --dw-muted: #8d99a3; --dw-ok: #33b101; --dw-blue: #4aa3ff; --dw-red: #fd3b3b; --dw-sun: #fda900;
  background: var(--dw-bg); color: var(--dw-ink); border-radius: 10px; border: 1px solid var(--dw-line); overflow: hidden; box-shadow: 0 24px 50px -30px rgba(0,0,0,.6); min-width: 0; font-size: 0.9rem; }
.dw-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--dw-panel); border-bottom: 1px solid var(--dw-line); }
.dw-dots { display: inline-flex; gap: 6px; }
.dw-dots i { width: 10px; height: 10px; border-radius: 50%; background: #3a444b; }
.dw-title { font-family: var(--f-mono); font-size: 0.76rem; letter-spacing: 0.05em; color: var(--dw-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-replay { font: inherit; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dw-ink); background: transparent; border: 1px solid var(--dw-line); border-radius: 4px; padding: 5px 10px; cursor: pointer; min-height: 0; }
.dw-replay:hover { border-color: var(--dw-sun); color: var(--dw-sun); }
.dw-body { position: relative; min-height: 400px; }
.dw .eyebrow { color: var(--dw-sun); }
.dw .k { font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dw-muted); }
.dw .v { font-weight: 500; }

/* ---------- PBX ---------- */
.pbx { display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.pbx-side { padding: 18px 16px; border-right: 1px solid var(--dw-line); display: grid; gap: 14px; align-content: start; background: var(--dw-panel); }
.pbx-kv { display: grid; gap: 3px; font-size: 0.85rem; }
.pbx-state { display: inline-flex; align-items: center; gap: 7px; }
.pbx-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dw-muted); }
.pbx-state.ringing::before { background: var(--dw-sun); animation: blink .6s steps(2) infinite; }
.pbx-state.live::before { background: var(--dw-ok); }
.pbx-state.ended::before { background: var(--dw-red); }
@keyframes blink { to { opacity: .2; } }
.pbx-timer { font-family: var(--f-mono); font-size: 1.5rem; font-variant-numeric: tabular-nums; margin-top: 6px; }
.pbx-wave { display: flex; align-items: center; gap: 3px; height: 28px; }
.pbx-wave i { width: 4px; height: 4px; border-radius: 2px; background: var(--dw-muted); transition: height .2s; }
.pbx-wave.speaking i { background: var(--dw-sun); animation: wave .9s ease-in-out infinite; }
.pbx-wave.speaking i:nth-child(2n) { animation-delay: .15s; } .pbx-wave.speaking i:nth-child(3n) { animation-delay: .3s; } .pbx-wave.speaking i:nth-child(4n) { animation-delay: .45s; }
.pbx-wave.caller i { background: var(--dw-blue); }
@keyframes wave { 0%, 100% { height: 4px; } 50% { height: 22px; } }
.pbx-main { display: grid; grid-template-rows: minmax(0, 1fr); height: 430px; min-width: 0; }
.pbx-chat { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--dw-line) transparent; }
.pbx-chat > :first-child { margin-top: auto; }
.msg { max-width: 88%; display: grid; gap: 3px; animation: rise .35s ease both; }
.msg .who { font-family: var(--f-mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dw-muted); }
.msg .bubble { padding: 9px 12px; border-radius: 10px; line-height: 1.45; font-size: 0.9rem; }
.msg.ai { align-self: flex-start; } .msg.ai .bubble { background: var(--dw-panel); border: 1px solid var(--dw-line); border-top-left-radius: 3px; }
.msg.caller { align-self: flex-end; text-align: right; } .msg.caller .bubble { background: #1c3552; border-top-right-radius: 3px; text-align: left; }
.msg.sys { align-self: center; max-width: 100%; } .msg.sys .bubble { background: transparent; color: var(--dw-muted); font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.04em; padding: 4px 0; }
.msg.typing .bubble { display: inline-flex; gap: 4px; padding: 11px 12px; }
.msg.typing .bubble i { width: 6px; height: 6px; border-radius: 50%; background: var(--dw-muted); animation: dot 1s infinite; }
.msg.typing .bubble i:nth-child(2) { animation-delay: .2s; } .msg.typing .bubble i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pbx-summary { margin: 4px 0 0; padding: 14px 16px; flex: none; border-radius: 8px; background: #1a2a1c; border: 1px solid #2c4a2f; animation: rise .45s ease both; }
.pbx-summary-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.pbx-summary-time { font-family: var(--f-mono); font-size: 0.72rem; color: var(--dw-muted); }
.pbx-summary dl { margin: 0; display: grid; gap: 4px; }
.pbx-summary dl > div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 0.85rem; }
.pbx-summary dt { color: var(--dw-muted); } .pbx-summary dd { margin: 0; }
@media (max-width: 640px) { .pbx { grid-template-columns: 1fr; } .pbx-main { height: 340px; } .pbx-side { border-right: 0; border-bottom: 1px solid var(--dw-line); grid-template-columns: 1fr 1fr; } .pbx-timer, .pbx-wave { grid-column: 1 / -1; } .pbx-summary dl > div { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Wi-Fi ---------- */
.wifi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 24px; align-items: center; }
.phone { position: relative; width: 250px; max-width: 100%; aspect-ratio: 9 / 18.5; margin: 0 auto; border-radius: 28px; background: #0c0e10; border: 6px solid #2a3035; overflow: hidden; box-shadow: 0 20px 40px -20px rgba(0,0,0,.8); }
.phone-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px 0; font-family: var(--f-mono); font-size: 0.7rem; color: #fff; }
.phone-icons { display: inline-flex; gap: 5px; align-items: center; }
.phone-icons .sig { width: 12px; height: 8px; background: linear-gradient(90deg, #fff 0 2px, transparent 2px 3px, #fff 3px 5px, transparent 5px 6px, #fff 6px 8px, transparent 8px 9px, #fff 9px); clip-path: polygon(0 60%, 100% 0, 100% 100%, 0 100%); }
.phone-icons .bat { width: 18px; height: 8px; border: 1px solid #fff; border-radius: 2px; background: linear-gradient(90deg, #fff 0 70%, transparent 70%); background-clip: content-box; padding: 1px; }
.phone-screens { position: absolute; inset: 30px 0 0; }
.screen { position: absolute; inset: 0; padding: 14px 16px; display: grid; align-content: start; gap: 10px; opacity: 0; transform: translateX(30px); transition: opacity .35s, transform .35s; color: #e8ecef; }
.screen.on { opacity: 1; transform: none; }
.screen-title { font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; margin-bottom: 4px; }
.net { display: flex; justify-content: space-between; align-items: center; padding: 10px 10px; border-radius: 8px; background: #1a1f23; font-size: 0.82rem; }
.net .lock { width: 9px; height: 11px; border: 1.5px solid #8d99a3; border-radius: 2px; position: relative; }
.net .lock::before { content: ""; position: absolute; left: 1px; right: 1px; top: -5px; height: 5px; border: 1.5px solid #8d99a3; border-bottom: 0; border-radius: 4px 4px 0 0; }
.net.pick { border: 1px solid transparent; transition: border-color .2s, background .2s; }
.net.pick.sel { background: #1c3552; border-color: #4aa3ff; }
.net .chk { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #4aa3ff; opacity: 0; transition: opacity .2s; position: relative; }
.net .chk::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 7px; border: solid #4aa3ff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.net.pick.sel .chk { opacity: 1; }
.s-portal { background: #fbfaf6; color: #111; }
.portal-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.85rem; }
.portal-logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; background: var(--dw-sun); color: #111; font-family: var(--f-mono); font-size: 0.7rem; font-weight: 600; }
.s-portal h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.s-portal p { font-size: 0.74rem; color: #5d615c; line-height: 1.4; }
.pfield { display: grid; gap: 3px; }
.plabel { font-size: 0.66rem; color: #5d615c; }
.pinput { display: block; min-height: 30px; border: 1.5px solid #d6d8d1; border-radius: 6px; padding: 6px 8px; font-size: 0.76rem; background: #fff; font-family: var(--f-mono); }
.pinput.focus { border-color: var(--dw-sun); }
.pinput.focus::after { content: ""; display: inline-block; width: 1px; height: 12px; background: #111; margin-left: 1px; vertical-align: -2px; animation: blink .8s steps(2) infinite; }
.pcheck { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; }
.pbox { width: 15px; height: 15px; border: 1.5px solid #d6d8d1; border-radius: 3px; background: #fff; position: relative; transition: background .15s, border-color .15s; flex: none; }
.pbox.on { background: #111; border-color: #111; }
.pbox.on::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pbtn { display: block; text-align: center; padding: 9px; border-radius: 6px; background: #111; color: #fff; font-weight: 600; font-size: 0.8rem; transition: background .15s; }
.pbtn.busy { background: #5d615c; color: #fff; }
.pbtn.busy::after { content: "Connecting…"; }
.pbtn.busy { font-size: 0; } .pbtn.busy::after { font-size: 0.8rem; }
.s-done { place-content: center; justify-items: center; text-align: center; background: #0f2a17; }
.done-mark { width: 54px; height: 54px; border-radius: 50%; background: var(--dw-ok); position: relative; animation: pop .4s cubic-bezier(.2,.9,.3,1.4) both; }
.done-mark::after { content: ""; position: absolute; left: 19px; top: 13px; width: 13px; height: 24px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.s-done h3 { font-size: 1.1rem; font-weight: 600; margin-top: 6px; }
.s-done p { font-size: 0.78rem; color: #a9c4ae; }
.done-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.done-meta span { font-family: var(--f-mono); font-size: 0.64rem; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.08); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.tap { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: rgba(253,169,0,.35); border: 2px solid var(--dw-sun); left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; transition: left .45s cubic-bezier(.2,.7,.2,1), top .45s cubic-bezier(.2,.7,.2,1), opacity .2s, transform .2s; }
.tap.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.tap.press { transform: translate(-50%, -50%) scale(.75); }
.wifi-side { display: grid; gap: 12px; align-content: start; min-width: 0; }
.wifi-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.wifi-steps li { display: grid; gap: 2px; padding: 10px 0 10px 22px; border-bottom: 1px solid var(--dw-line); position: relative; color: var(--dw-muted); transition: color .3s; font-size: 0.85rem; }
.wifi-steps li::before { content: ""; position: absolute; left: 0; top: 15px; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--dw-line); transition: background .3s, border-color .3s; }
.wifi-steps li b { font-weight: 600; color: inherit; }
.wifi-steps li span { font-size: 0.78rem; }
.wifi-steps li.on { color: var(--dw-ink); }
.wifi-steps li.on::before { background: var(--dw-ok); border-color: var(--dw-ok); }
.wifi-steps li.on span { color: var(--dw-muted); }
@media (max-width: 640px) { .wifi { grid-template-columns: 1fr; } }

/* ---------- Cameras ---------- */
.cam { --scene: #0b1116; }
.dw-body.cams { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr); }
.cam-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: auto auto; align-content: start; gap: 6px; padding: 10px; background: #0a0c0e; min-width: 0; }
.cam { position: relative; background: var(--scene); border-radius: 4px; overflow: hidden; aspect-ratio: 16 / 9; min-width: 0; }
.cam-gate { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.cam.hot { outline: 2px solid var(--dw-red); outline-offset: -2px; }
.cam-label { position: absolute; left: 8px; top: 6px; right: 8px; z-index: 3; display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase; color: #cdd5db; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.cam-label .rec { color: var(--dw-red); }
.cam-label .rec::before { content: "●"; margin-right: 4px; animation: blink 1.2s steps(2) infinite; }
.cam-time { position: absolute; right: 8px; bottom: 6px; z-index: 3; font-family: var(--f-mono); font-size: 0.66rem; color: #cdd5db; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
/* side */
.cam-side { padding: 16px; border-left: 1px solid var(--dw-line); display: grid; gap: 12px; align-content: start; background: var(--dw-panel); min-width: 0; }
.cam-events { display: grid; gap: 6px; }
.cam-event { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 8px 10px; border-radius: 6px; background: var(--dw-bg); border: 1px solid var(--dw-line); font-size: 0.8rem; }
.cam-event .t { font-family: var(--f-mono); font-size: 0.72rem; color: var(--dw-muted); }
.cam-event.quiet { opacity: .55; }
.cam-event.hot { border-color: var(--dw-red); animation: rise .35s ease both; }
.cam-event.hot .t { color: var(--dw-red); }
.cam-store { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--dw-line); font-size: 0.8rem; }
.cam-store > div { display: grid; gap: 1px; }
.cam-toast { position: absolute; left: 14px; bottom: 14px; width: 250px; max-width: calc(100% - 28px); display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: rgba(240,243,245,.96); color: #111; box-shadow: 0 16px 40px -12px rgba(0,0,0,.7); font-size: 0.82rem; transform: translateY(20px); opacity: 0; transition: transform .4s cubic-bezier(.2,.7,.2,1), opacity .3s; z-index: 5; }
.cam-toast.show { transform: none; opacity: 1; }
.toast-app { font-family: var(--f-mono); font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; color: #5d615c; }
.cam-toast span:last-child { color: #5d615c; font-size: 0.76rem; }
@media (max-width: 640px) { .dw-body.cams { grid-template-columns: 1fr; } .cam-side { border-left: 0; border-top: 1px solid var(--dw-line); } }

@media (prefers-reduced-motion: reduce) {
  .dw *, .dw *::before, .dw *::after { animation: none !important; transition: none !important; }
}

/* Camera tiles: real video */
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #05080a; }
.cam .bbox { position: absolute; left: 20%; top: 42%; width: 10%; height: 42%; border: 1.5px solid var(--dw-ok); opacity: 0; transition: opacity .15s; z-index: 2; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.cam .bbox span { position: absolute; left: -1.5px; top: -18px; font-family: var(--f-mono); font-size: 0.6rem; letter-spacing: 0.04em; background: var(--dw-ok); color: #061; padding: 1px 5px; white-space: nowrap; font-weight: 600; }
.cam .bbox.on { opacity: 1; }
.cam-time { display: none; }

/* PBX: voice bar and cover */
.pbx-wrap { display: grid; grid-template-rows: auto 1fr; position: relative; }
.voice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; background: #121517; border-bottom: 1px solid var(--dw-line); }
.voice-play { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--dw-sun); color: #111; cursor: pointer; display: grid; place-items: center; padding: 0; min-height: 0; transition: transform .15s, background .15s; }
.voice-play:hover { transform: scale(1.06); }
.voice-play:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ico { display: block; width: 0; height: 0; border-style: solid; border-width: 8px 0 8px 14px; border-color: transparent transparent transparent currentColor; margin-left: 3px; }
.voice-play.on .ico { width: 14px; height: 16px; border: 0; margin: 0; background: linear-gradient(90deg, currentColor 0 5px, transparent 5px 9px, currentColor 9px 14px); }
.voice-mid { display: grid; gap: 7px; min-width: 0; }
.voice-row { display: flex; justify-content: space-between; gap: 10px; font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.04em; color: var(--dw-muted); }
.voice-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.voice-who.ai { color: var(--dw-sun); } .voice-who.caller { color: var(--dw-blue); }
.voice-time { font-variant-numeric: tabular-nums; flex: none; }
.voice-track { position: relative; height: 6px; border-radius: 3px; background: var(--dw-line); cursor: pointer; }
.voice-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 3px; background: var(--dw-sun); }
.voice-cues { position: absolute; inset: 0; pointer-events: none; }
.voice-cues i { position: absolute; top: -2px; bottom: -2px; width: 2px; background: rgba(255,255,255,.28); }
.voice-cues i.caller { background: rgba(74,163,255,.5); }
.voice-scope { width: 140px; height: 40px; display: block; }
.pbx-cover { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: rgba(12,14,16,.72); backdrop-filter: blur(3px); z-index: 4; text-align: center; padding: 20px; transition: opacity .3s; }
.pbx-cover.off { opacity: 0; pointer-events: none; }
.cover-btn { display: inline-flex; align-items: center; gap: 12px; padding: 14px 22px; border-radius: 999px; border: 0; background: var(--dw-sun); color: #111; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; box-shadow: 0 12px 30px -10px rgba(253,169,0,.6); }
.cover-btn:hover { transform: translateY(-1px); }
.cover-note { font-size: 0.82rem; color: var(--dw-muted); max-width: 30em; }
@media (max-width: 640px) { .voice-scope { display: none; } .voice { grid-template-columns: auto minmax(0, 1fr); } }

.pbx-cover.again { background: transparent; backdrop-filter: none; pointer-events: none; align-content: start; padding-top: 120px; }
.pbx-cover.again .cover-btn { pointer-events: auto; box-shadow: 0 16px 40px -8px rgba(0,0,0,.8), 0 0 0 6px rgba(12,14,16,.6); }
.pbx-cover.again .cover-note { background: rgba(12,14,16,.85); padding: 6px 12px; border-radius: 999px; }
.dw[data-demo="pbx"] .dw-replay { display: none; }
