/* KasaGo demo-frame.css — the live-demo device frame (canon §9.7, W-64).
   One component, two hosts: the hero popup on / (loaded by demo-frame.js on demand) and the frame on /demo.
   The iframe keeps its own CSS size (tablet 1180×820 · phone 390×844); demo-frame.js scales the whole
   device with a transform to fit the space. Bezel = CSS only. Every class is prefixed kdf-. Token values are
   repeated as fallbacks because the home page carries its own inline :root instead of tokens.css. */

.kdf{--kdf-ink:var(--ink,#0F172A); --kdf-pur:var(--purple,#7358C4); --kdf-pur7:var(--purple-700,#5C44A6);
  --kdf-g6:var(--gray-600,#5B6476); --kdf-line:var(--line,#ECECF0); --kdf-ease:var(--ease,cubic-bezier(.22,.8,.3,1));
  --kdf-bezel:#0B1020; --kdf-w:390px;
  position:relative; display:flex; flex-direction:column; align-items:center; width:100%;}
.kdf-stage{width:100%; display:flex; justify-content:center}
.kdf-fit{position:relative; z-index:1; flex:none}
/* before demo-frame.js has measured: a device-shaped placeholder of about the final size (no overflow, little shift) */
.kdf:not(.kdf-ready) .kdf-fit{width:min(100%, calc((100vh - 300px) * 1.4167)); aspect-ratio:1224/864; border-radius:30px;
  background:linear-gradient(160deg,#1A2236,#0B1020 40%,#05070E)}
.kdf:not(.kdf-ready) .kdf-dev{display:none}
@media (max-width:767px){ .kdf:not(.kdf-ready) .kdf-fit{width:min(100%, calc((100vh - 250px) * .477)); aspect-ratio:414/868; border-radius:34px} }

/* ---- the device (unscaled; demo-frame.js sets transform: scale(s)) ---- */
.kdf-dev{position:absolute; left:0; top:0; transform-origin:0 0; box-sizing:content-box;
  padding:22px; border-radius:46px; background:linear-gradient(160deg,#1A2236 0%,var(--kdf-bezel) 38%,#05070E 100%);
  box-shadow:inset 0 0 0 2px #2A3350, inset 0 0 0 5px #070A13, 0 2px 0 1px rgba(255,255,255,.04),
    0 40px 80px -30px rgba(9,13,24,.65), 0 18px 36px -24px rgba(9,13,24,.5);}
.kdf-dev::before{content:''; position:absolute; top:8px; left:50%; width:7px; height:7px; margin-left:-3.5px; border-radius:50%;
  background:radial-gradient(circle at 40% 35%,#3A4566,#0D1220 70%); box-shadow:0 0 0 1px #1E2638}   /* camera, on the bezel */
.kdf[data-mode="pho"] .kdf-dev{padding:12px; border-radius:58px}
.kdf[data-mode="pho"] .kdf-dev::before{display:none}
.kdf[data-mode="pho"] .kdf-dev::after{content:''; position:absolute; right:-3px; top:180px; width:3px; height:86px; border-radius:0 3px 3px 0;
  background:#1E2638}                                                                                 /* side key */
.kdf-screen{position:relative; overflow:hidden; width:1180px; height:820px; border-radius:24px; background:#F7F8FB}
.kdf[data-mode="pho"] .kdf-screen{width:390px; height:844px; border-radius:46px}
.kdf-if{position:absolute; inset:0; width:100%; height:100%; border:0; display:block; background:#fff;
  opacity:0; transition:opacity .35s var(--kdf-ease)}
.kdf-if.on{opacity:1}

/* ---- skeleton: calm placeholder of the Kasa screen until the iframe has loaded (no spinner) ---- */
.kdf-skel{position:absolute; inset:0; display:grid; grid-template-rows:64px 1fr; background:#F7F8FB; overflow:hidden;
  transition:opacity .3s var(--kdf-ease)}
.kdf-skel.off{opacity:0; pointer-events:none}
.kdf-skel i{display:block; background:#E9ECF3; border-radius:12px}
.kdf-sk-top{display:flex; align-items:center; gap:14px; padding:0 22px; background:#fff; border-bottom:1px solid #ECEEF4}
.kdf-sk-top i:nth-child(1){width:110px; height:22px}
.kdf-sk-top i:nth-child(2){width:84px; height:28px; border-radius:999px; margin-left:auto}
.kdf-sk-top i:nth-child(3){width:34px; height:34px; border-radius:50%}
.kdf-sk-body{display:grid; grid-template-columns:1fr 340px; min-height:0}
.kdf-sk-main{padding:20px 22px; display:flex; flex-direction:column; gap:18px; min-height:0}
.kdf-sk-chips{display:flex; gap:10px}
.kdf-sk-chips i{width:96px; height:36px; border-radius:999px}
.kdf-sk-grid{display:grid; grid-template-columns:repeat(4,1fr); gap:16px}
.kdf-sk-grid i{height:150px; border-radius:18px; background:#fff; box-shadow:inset 0 0 0 1px #ECEEF4}
.kdf-sk-cart{background:#fff; border-left:1px solid #ECEEF4; padding:22px; display:flex; flex-direction:column; gap:14px}
.kdf-sk-cart i{height:18px}
.kdf-sk-cart i:nth-child(1){width:60%; height:24px}
.kdf-sk-cart i:last-child{margin-top:auto; height:56px; border-radius:16px; background:#E3DDF5}
.kdf[data-mode="pho"] .kdf-skel{grid-template-rows:118px 1fr; padding-top:0}
.kdf[data-mode="pho"] .kdf-sk-top{padding:54px 20px 0}
.kdf[data-mode="pho"] .kdf-sk-body{grid-template-columns:1fr}
.kdf[data-mode="pho"] .kdf-sk-grid{grid-template-columns:repeat(2,1fr)}
.kdf[data-mode="pho"] .kdf-sk-cart{display:none}
.kdf-skel::after{content:''; position:absolute; inset:0; transform:translateX(-100%);
  background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,.55) 50%,transparent 70%);
  animation:kdfShimmer 1.8s ease-in-out infinite}
@keyframes kdfShimmer{to{transform:translateX(100%)}}

/* ---- the call to action, attached to the device: a tray sliding out from under the tablet's lower edge;
        on the phone a compact block right under the device. Never over the screen. ---- */
.kdf-cta{--kdf-tuck:16px; position:relative; z-index:0; box-sizing:border-box; width:min(calc(var(--kdf-w) - 56px), 760px);
  margin-top:calc(-1 * var(--kdf-tuck)); padding:calc(var(--kdf-tuck) + 12px) 16px 14px 18px; display:flex; align-items:center; gap:14px;
  background:#fff; border:1px solid var(--kdf-line); border-top:0; border-radius:0 0 22px 22px;
  box-shadow:0 24px 44px -26px rgba(15,23,42,.45);}
.kdf-cta::before{content:''; position:absolute; left:18px; right:18px; top:var(--kdf-tuck); height:1px;
  background:linear-gradient(90deg,transparent,rgba(115,88,196,.35),transparent)}                    /* the seam under the bezel */
.kdf-copy{flex:1; min-width:0}
.kdf-h{margin:0; font-family:var(--font-display,'Poppins',sans-serif); font-weight:700; font-size:17px; line-height:1.25; letter-spacing:-.01em; color:var(--kdf-ink)}
.kdf-l{margin:4px 0 0; font-size:13.5px; line-height:1.4; color:var(--kdf-g6)}
.kdf-btn{flex:none; display:inline-flex; align-items:center; gap:8px; height:46px; padding:0 20px; border-radius:999px;
  background:var(--kdf-pur); color:#fff; font-weight:600; font-size:15.5px; text-decoration:none; white-space:nowrap;
  box-shadow:0 14px 26px -14px rgba(115,88,196,.75); transition:background .18s var(--kdf-ease), transform .2s var(--kdf-ease)}
.kdf-btn:hover{background:var(--kdf-pur7); transform:translateY(-1px)}
.kdf-btn svg{display:block}
.kdf-re{flex:none; width:42px; height:42px; display:grid; place-items:center; border-radius:50%; cursor:pointer;
  background:#fff; color:var(--kdf-g6); border:1px solid #E1E4EC; transition:color .18s var(--kdf-ease), border-color .18s var(--kdf-ease)}
.kdf-re:hover{color:var(--kdf-pur7); border-color:#CFC5EE}
.kdf-re svg{display:block; transition:transform .45s var(--kdf-ease)}
.kdf-re:active svg{transform:rotate(-200deg)}
.kdf-btn:focus-visible, .kdf-re:focus-visible{outline:2px solid var(--kdf-pur); outline-offset:3px}
/* phone: the headline on top, restart + the button below it (the line goes first when space is tight) */
.kdf[data-mode="pho"] .kdf-cta{width:min(calc(var(--kdf-w) - 16px), 420px); padding:calc(var(--kdf-tuck) + 10px) 10px 10px; border-radius:0 0 26px 26px;
  display:grid; grid-template-columns:auto minmax(0,1fr); grid-template-areas:"copy copy" "re btn"; gap:8px 8px}
.kdf[data-mode="pho"] .kdf-copy{grid-area:copy; text-align:center; padding:0 4px}
.kdf[data-mode="pho"] .kdf-re{grid-area:re; width:44px; height:44px}
.kdf[data-mode="pho"] .kdf-btn{grid-area:btn; justify-content:center; height:44px; padding:0 16px; font-size:15px}
.kdf[data-mode="pho"] .kdf-h{font-size:15px}
.kdf[data-mode="pho"] .kdf-l{font-size:12.5px; margin-top:2px}
.kdf.kdf-compact .kdf-l{display:none}

/* ---- the popup on / (native <dialog>: Esc, inert page; demo-frame.js adds backdrop click, focus return, scroll lock) ---- */
.kdf-modal{position:fixed; inset:0; width:100%; height:100%; max-width:none; max-height:none; margin:0; border:0;
  padding:56px 16px 16px; box-sizing:border-box; background:transparent; overflow:hidden; color:inherit}
.kdf-modal[open]{display:flex; flex-direction:column; justify-content:center}
.kdf-modal::backdrop{background:rgba(7,10,19,.8); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px)}
.kdf-modal[open]{animation:kdfIn .28s var(--ease,cubic-bezier(.22,.8,.3,1))}
@keyframes kdfIn{from{opacity:0; transform:translateY(10px) scale(.985)}}
.kdf-x{position:absolute; top:8px; right:10px; width:44px; height:44px; display:grid; place-items:center; border-radius:50%;
  border:1px solid rgba(255,255,255,.22); background:rgba(255,255,255,.08); color:#fff; cursor:pointer; z-index:2;
  transition:background .18s var(--ease,ease)}
.kdf-x:hover{background:rgba(255,255,255,.18)}
.kdf-x:focus-visible{outline:2px solid #C4B5F0; outline-offset:2px}
.kdf-modal .kdf-dev{box-shadow:inset 0 0 0 2px #2A3350, inset 0 0 0 5px #070A13, 0 0 0 1px rgba(255,255,255,.14), 0 50px 90px -30px rgba(0,0,0,.8)}
html.kdf-lock, html.kdf-lock body{overflow:hidden}

@media (prefers-reduced-motion:reduce){
  .kdf-skel::after{animation:none; display:none}
  .kdf-if, .kdf-skel, .kdf-btn, .kdf-re, .kdf-re svg, .kdf-x{transition:none}
  .kdf-modal[open]{animation:none}
}
