:root {
  --bg: #0a1220;
  --bg-alt: #0d1729;
  --panel: #12203a;
  --panel-2: #172a4a;
  --line: #22385c;
  --text: #e8eff9;
  --muted: #98abc7;
  --cyan: #00b0f0;
  --cyan-2: #5fd4ff;
  --warm: #ffc857;
  --red: #ff5d6c;
  --green: #3ddc97;
  --violet: #b18cff;
  --radius: 16px;
  --display: "Space Grotesk", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; }
a { color: var(--cyan-2); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); font-weight: 700; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .9em; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.eyebrow {
  font: 600 .78rem/1 var(--body);
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--cyan);
  margin-bottom: 14px;
}
.hl {
  background: linear-gradient(90deg, var(--cyan), var(--cyan-2));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--cyan);
  color: #021320;
  font: 600 1rem/1 var(--body);
  text-decoration: none;
  border: 1px solid var(--cyan);
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(0,176,240,.35); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--cyan); box-shadow: none; }
.btn-small { padding: 9px 16px; font-size: .9rem; }
:focus-visible { outline: 2px solid var(--cyan-2); outline-offset: 3px; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10,18,32,.78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(34,56,92,.6);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 1.25rem var(--display); }
.nav-links { display: none; gap: 22px; margin-left: auto; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .93rem; }
.nav-links a:hover { color: var(--text); }
.nav .btn { margin-left: auto; }
@media (min-width: 900px) { .nav-links { display: flex; } .nav .btn { margin-left: 8px; } }

/* hero */
.hero {
  position: relative;
  padding: 64px 0 40px;
  background:
    radial-gradient(900px 500px at 85% 20%, rgba(0,176,240,.14), transparent 60%),
    radial-gradient(600px 400px at 0% 100%, rgba(177,140,255,.08), transparent 60%);
}
.hero-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.05fr 1fr; padding-top: 24px; } }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 32px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 10px 28px; list-style: none; padding: 0; margin: 0; color: var(--muted); font-size: .92rem; }
.hero-facts strong { color: var(--text); font: 700 1.05rem var(--display); margin-right: 4px; }
.hero-svg { width: 100%; max-width: 560px; display: block; margin: 0 auto; overflow: visible; }
.hero-svg .roof { fill: none; stroke: var(--cyan); stroke-width: 14; stroke-linejoin: miter; }
.hero-svg .walls { fill: rgba(0,176,240,.05); stroke: rgba(0,176,240,.4); stroke-width: 2; stroke-dasharray: 6 8; }
.hero-svg .links line { stroke: rgba(95,212,255,.45); stroke-width: 2; }
.hero-svg .links .faint { stroke-dasharray: 3 6; stroke: rgba(95,212,255,.2); }
.hero-svg .packets circle { fill: var(--cyan-2); filter: drop-shadow(0 0 6px var(--cyan)); }
.hero-svg .packets circle.up { fill: var(--warm); filter: drop-shadow(0 0 6px var(--warm)); }
.hero-svg .hnode circle { fill: var(--panel-2); stroke: var(--cyan); stroke-width: 2; }
.hero-svg .hnode text { font-size: 16px; text-anchor: middle; }
.hero-svg .hbrain rect { fill: var(--cyan); }
.hero-svg .hbrain .chip { fill: #fff; }
.hero-svg .hbrain .pins line { stroke: #fff; stroke-width: 3; }
.hero-svg .pulse { fill: none; stroke: var(--cyan); stroke-width: 2; transform-origin: 260px 250px; animation: pulse 2.6s ease-out infinite; }
.hero-svg .hlabel { fill: var(--text); font: 600 15px var(--display); text-anchor: middle; }
@keyframes pulse { from { transform: scale(.7); opacity: .9; } to { transform: scale(1.5); opacity: 0; } }

/* sections */
.section { padding: 88px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid rgba(34,56,92,.5); border-bottom: 1px solid rgba(34,56,92,.5); }
.section-lede { color: var(--muted); font-size: 1.08rem; max-width: 46em; margin-bottom: 40px; }

/* pieces */
.pieces { display: grid; gap: 20px; }
@media (min-width: 900px) { .pieces { grid-template-columns: 320px 1fr; } }
.piece-tabs { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (min-width: 900px) { .piece-tabs { grid-template-columns: 1fr; } }
.piece-tabs button {
  display: flex; align-items: center; gap: 14px;
  text-align: left; padding: 14px 16px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; font: inherit;
  transition: border-color .2s, background .2s, transform .15s;
}
.piece-tabs button:hover { transform: translateX(2px); }
.piece-tabs button[aria-selected="true"] { border-color: var(--cyan); background: linear-gradient(135deg, rgba(0,176,240,.18), var(--panel)); }
.piece-tabs b { display: block; font-family: var(--display); }
.piece-tabs small { color: var(--muted); font-size: .82rem; }
.pico { font-size: 1.6rem; width: 44px; height: 44px; display: grid; place-items: center; background: var(--panel-2); border-radius: 12px; flex: none; }
.piece-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; min-height: 340px; }
.piece-panel article { display: none; animation: rise .35s ease; }
.piece-panel article.active { display: block; }
.piece-panel h3 { font-size: 1.6rem; }
.piece-panel p { color: var(--muted); }
.ticks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.ticks li { padding-left: 28px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--green); font-weight: 700; }
.serial { font-size: .9rem; border-top: 1px dashed var(--line); padding-top: 14px; margin: 0; }
.serial code { color: var(--cyan-2); }
.serial code span { color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* demo */
.demo { display: grid; gap: 28px; align-items: start; }
@media (min-width: 1000px) { .demo { grid-template-columns: 1fr 300px; } }
/* on narrow screens the floor plan sticks to the top while you scroll the phone */
@media (max-width: 999px) {
  .demo { gap: 14px; }
  .stage-wrap { display: contents; }
  #stage { position: sticky; top: 72px; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
  .stage-controls, .legend { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
}
.stage-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
#stage { width: 100%; height: auto; display: block; }
#stage text { font-family: var(--body); }
.rooms rect { fill: rgba(255,255,255,.015); stroke: #3a5580; stroke-width: 3; }
.room-names text { fill: var(--muted); font-size: 13px; font-weight: 600; }
.st-small { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.st-label { fill: var(--text); font: 600 13px var(--display); text-anchor: middle; }
.st-cap { fill: var(--muted); font-size: 11px; text-anchor: middle; letter-spacing: .12em; text-transform: uppercase; }
.st-temp { fill: var(--text); font: 600 15px var(--display); text-anchor: end; }
.tunnel { fill: none; stroke: var(--violet); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; opacity: .35; transition: opacity .4s; }
.tunnel-cap { fill: var(--violet); opacity: .7; }
.cell { stroke: var(--violet); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; opacity: 0; transition: opacity .4s; }
.away .tunnel { opacity: .9; }
.away .cell { opacity: .9; }
.relay path { fill: #1d2c4b; stroke: var(--violet); stroke-width: 2; }
.mesh line { stroke: rgba(95,212,255,.4); stroke-width: 2; }
.mesh line.wifi { stroke: rgba(61,220,151,.45); stroke-dasharray: 4 5; }
.out-of-range { stroke: rgba(255,93,108,.35); stroke-width: 1.5; stroke-dasharray: 3 6; }
.oor { fill: rgba(255,93,108,.7); }
.node circle:first-child { fill: var(--panel-2); stroke: var(--cyan); stroke-width: 2.5; }
.led { fill: #2a3a55; stroke: #0a1220; stroke-width: 2; transition: fill .3s; }
.brain rect { fill: var(--cyan); }
.brain .chip { fill: #fff; }
.hue rect { fill: #263a5e; stroke: #8fa7cc; stroke-width: 1.5; }
.hue circle { fill: #8fa7cc; }
.fan ellipse { fill: #8fa7cc; opacity: .8; }
.fan-hub { fill: var(--text); }
.fan.on { animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#g-living, #g-bedroom, #g-garage { transition: opacity .5s; }
#heat { opacity: 0; transition: opacity .6s; pointer-events: none; }
.door { cursor: pointer; }
.door line { stroke: var(--warm); stroke-width: 7; stroke-linecap: round; transition: all .5s; }
.door.open line { stroke-dasharray: 8 14; opacity: .55; }
.door:hover line { stroke: #ffe09a; }
.phone-marker rect { fill: #e8eff9; }
.phone-marker .screen { fill: var(--cyan); }
.pkt { filter: drop-shadow(0 0 5px currentColor); }

.stage-controls { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; padding: 14px 6px 4px; }
.temp-ctl { display: grid; gap: 6px; flex: 1 1 260px; font-size: .92rem; color: var(--muted); }
.temp-ctl b { color: var(--text); }
input[type=range] { accent-color: var(--cyan); width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; padding: 8px 6px 2px; margin: 0; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 8px; border-radius: 2px; }
.k-wifi { border-color: var(--green) !important; }
.k-mesh { border-color: var(--cyan-2) !important; }
.k-net { border-color: var(--violet) !important; }

/* phone mock */
.phone {
  width: 100%; max-width: 320px; margin: 0 auto;
  background: #060c17;
  border: 2px solid #2d4468;
  border-radius: 38px;
  padding: 12px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 0 0 6px #0b1424;
  position: relative;
}
.phone-notch { width: 90px; height: 20px; background: #0b1424; border-radius: 0 0 14px 14px; margin: -12px auto 6px; }
.app-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px 10px; font-family: var(--display); }
.conn { margin-left: auto; font: 600 .7rem/1 var(--body); padding: 5px 9px; border-radius: 999px; background: rgba(61,220,151,.15); color: var(--green); transition: all .3s; }
.conn.remote { background: rgba(177,140,255,.16); color: var(--violet); }
.app-body { background: #0e1a2f; border-radius: 24px; padding: 10px; display: grid; gap: 8px; max-height: 470px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.room-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.room-card h4 { font-size: .9rem; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.ent { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .84rem; padding: 4px 0; min-height: 30px; }
.ent small { color: var(--muted); font-size: .7rem; display: block; line-height: 1.1; }
.ent input[type=range] { width: 110px; }
.ent select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; font: inherit; }
.val { font-family: var(--display); transition: color .3s; }
.val.flash { color: var(--cyan-2); }
.tog {
  width: 42px; height: 24px; border-radius: 999px; border: 0; padding: 0; cursor: pointer;
  background: #2a3a55; position: relative; transition: background .25s; flex: none;
}
.tog::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s; }
.tog[aria-pressed="true"] { background: var(--cyan); }
.tog[aria-pressed="true"]::after { transform: translateX(18px); }
.tog.pending, select.pending, input.pending { animation: blink .7s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }
.rule-card p { font-size: .8rem; color: var(--muted); margin: 0; line-height: 1.5; }
.rule-card b { color: var(--text); }
.chip-state { font: 600 .66rem/1 var(--body); text-transform: uppercase; letter-spacing: .08em; padding: 4px 7px; border-radius: 999px; background: rgba(61,220,151,.15); color: var(--green); }
.chip-state.fired { background: rgba(255,93,108,.18); color: var(--red); }
.activity { padding: 8px 6px 4px; }
.activity h4 { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin: 6px 4px; }
#log { list-style: none; margin: 0; padding: 0 4px; display: grid; gap: 4px; font-size: .74rem; color: var(--muted); min-height: 92px; }
#log li { animation: rise .3s ease; display: flex; gap: 8px; }
#log time { font-family: var(--mono); color: #5d7397; flex: none; }
#log .rule { color: var(--red); }
#log .net { color: var(--violet); }

/* mesh split */
.split { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } }
.split p { color: var(--muted); font-size: 1.05rem; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.stat-row div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat-row b { display: block; font: 700 1.4rem var(--display); color: var(--cyan-2); }
.stat-row span { font-size: .8rem; color: var(--muted); line-height: 1.35; display: block; }
.hop-art svg { width: 100%; max-width: 520px; display: block; margin: 0 auto; overflow: visible; }
.hop-line { fill: none; stroke: rgba(95,212,255,.35); stroke-width: 2; stroke-dasharray: 5 7; }
.hop-dot { fill: var(--warm); filter: drop-shadow(0 0 6px var(--warm)); }
.hop-node circle { fill: var(--panel-2); stroke: var(--cyan); stroke-width: 2.5; }
.hop-node text, .hop-brain text { fill: var(--muted); font-size: 13px; text-anchor: middle; }
.hop-brain rect { fill: var(--cyan); }
.range { fill: rgba(0,176,240,.05); stroke: rgba(0,176,240,.35); stroke-dasharray: 4 6; }
.range-cap { fill: var(--cyan); font-size: 12px; text-anchor: middle; opacity: .7; }

/* yaml */
.yaml-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.yaml-tabs button { font: 500 .85rem var(--mono); padding: 8px 14px; border-radius: 10px; background: transparent; color: var(--muted); border: 1px solid var(--line); cursor: pointer; }
.yaml-tabs button[aria-selected="true"] { color: var(--text); border-color: var(--cyan); background: rgba(0,176,240,.12); }
.yaml-grid { display: grid; gap: 18px; align-items: center; }
@media (min-width: 900px) { .yaml-grid { grid-template-columns: 1.15fr auto 1fr; } }
.code { margin: 0; background: #060d19; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; overflow-x: auto; font: 13.5px/1.65 var(--mono); color: #c9d6ea; min-height: 380px; }
.code .k { color: var(--cyan-2); }
.code .s { color: #ffd27a; }
.code .c { color: #5d7397; font-style: italic; }
.code .n { color: var(--violet); }
.yaml-arrow { font: 700 2rem var(--display); color: var(--cyan); text-align: center; }
@media (max-width: 899px) { .yaml-arrow { transform: rotate(90deg); } }
.device-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.dc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.dc-head b { font: 600 1.1rem var(--display); }
.dc-head small { margin-left: auto; font: .75rem var(--mono); color: var(--muted); }
.dot-online { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
#dc-ents { list-style: none; margin: 0; padding: 0; }
#dc-ents li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed rgba(34,56,92,.7); font-size: .92rem; opacity: 0; animation: rise .35s ease forwards; }
#dc-ents li span.kind { font: .7rem var(--mono); color: var(--muted); background: var(--panel-2); padding: 3px 7px; border-radius: 6px; }
#dc-ents li em { margin-left: auto; font-style: normal; font-family: var(--display); color: var(--cyan-2); }
.dc-foot { font-size: .82rem; color: var(--muted); margin: 14px 0 0; }

/* away */
.away-diagram { display: grid; gap: 10px; align-items: center; margin-bottom: 40px; }
@media (min-width: 900px) { .away-diagram { grid-template-columns: 1fr 1.1fr 1fr 1.1fr 1fr; } }
.ad-node { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; display: grid; gap: 4px; }
.ad-node small { color: var(--muted); font-size: .82rem; }
.ad-ico { font-size: 1.9rem; }
.ad-relay { border-color: var(--violet); }
.ad-brain { border-color: var(--cyan); }
.ad-link { position: relative; text-align: center; font: .75rem var(--mono); color: var(--violet); padding: 8px 0; }
.ad-link i { display: block; height: 3px; margin-top: 8px; border-radius: 3px; background: repeating-linear-gradient(90deg, var(--violet) 0 6px, transparent 6px 12px); background-size: 24px 3px; animation: flow 1s linear infinite; }
.ad-rev i { animation-direction: reverse; }
@keyframes flow { to { background-position: 24px 0; } }
.cards3 { display: grid; gap: 16px; }
@media (min-width: 900px) { .cards3 { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card p { color: var(--muted); margin: 0; }

/* features */
.features { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 32px; }
.feat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; transition: border-color .2s, transform .2s; }
.feat:hover { border-color: var(--cyan); transform: translateY(-3px); }
.feat > span { font-size: 1.6rem; display: block; margin-bottom: 10px; }
.feat p { color: var(--muted); margin: 0; font-size: .95rem; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 0; max-width: 760px; }
.timeline li { position: relative; padding: 0 0 26px 40px; border-left: 2px solid var(--line); margin-left: 10px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -11px; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); }
.timeline li.done::before { background: var(--green); border-color: var(--green); }
.timeline li.now::before { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 0 6px rgba(0,176,240,.2); }
.timeline b { display: block; font-family: var(--display); font-size: 1.1rem; }
.timeline span { color: var(--muted); font-size: .95rem; }

/* closing */
.closing { text-align: center; background: radial-gradient(700px 360px at 50% 30%, rgba(0,176,240,.14), transparent 70%); }
.closing-inner { display: grid; justify-items: center; }
.closing p { color: var(--muted); max-width: 36em; font-size: 1.08rem; margin-bottom: 28px; }
.closing img { margin-bottom: 18px; }

.foot { border-top: 1px solid var(--line); padding: 26px 0; color: var(--muted); font-size: .88rem; }
.foot-inner { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.foot img { vertical-align: -2px; margin-right: 4px; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
