/* ───────────────────────── tokens ───────────────────────── */
:root {
  --bg: #080b11;
  --bg-2: #0c1018;
  --surface: #11161f;
  --surface-2: #161c27;
  --surface-3: #1c2330;
  --line: #273041;
  --line-soft: #1e2532;
  --text: #e8eef8;
  --text-2: #c3cddd;
  --muted: #8e9bb3;
  --ble: #56d1ff;
  --wifi: #a98cff;
  --ok: #5fe3a8;
  --warm: #ffb270;

  --tier1-fill: rgba(86, 209, 255, .08);
  --tier3-fill: rgba(169, 140, 255, .08);
  --ok-fill: rgba(95, 227, 168, .12);
  --wifi-fill: rgba(169, 140, 255, .14);
  --warm-fill: rgba(255, 178, 112, .14);
  --chip-solid: #141a25;
  --chip-fill: rgba(86, 209, 255, .1);

  --screen-a: #0f1724;
  --screen-b: #151e2e;
  --screen-bar: #1b2433;
  --screen-line: #2c3747;
  --screen-strong: #46556b;
  --card-fill: #18202d;
  --card-edge: #2a3447;
  --dev-body: #161c27;
  --dev-edge: #2b3545;
  --dev-base: #1f2734;

  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .45);
  --maxw: 1120px;
  --gutter: 20px;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--sans);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fb;
    --bg-2: #eef1f7;
    --surface: #ffffff;
    --surface-2: #f3f5fa;
    --surface-3: #e9edf5;
    --line: #d5dce8;
    --line-soft: #e3e8f1;
    --text: #0e1521;
    --text-2: #2c3747;
    --muted: #5b6678;
    --ble: #0a7fb5;
    --wifi: #6a44d6;
    --ok: #0f8a5f;
    --warm: #a2590b;

    --tier1-fill: rgba(10, 127, 181, .07);
    --tier3-fill: rgba(106, 68, 214, .07);
    --ok-fill: rgba(15, 138, 95, .1);
    --wifi-fill: rgba(106, 68, 214, .12);
    --warm-fill: rgba(162, 89, 11, .12);
    --chip-solid: #ffffff;
    --chip-fill: rgba(10, 127, 181, .08);

    --screen-a: #e7ecf5;
    --screen-b: #dde4f0;
    --screen-bar: #d2dae8;
    --screen-line: #c2ccdd;
    --screen-strong: #8e9bb3;
    --card-fill: #ffffff;
    --card-edge: #d5dce8;
    --dev-body: #ffffff;
    --dev-edge: #c8d1e0;
    --dev-base: #dbe2ee;

    --shadow: 0 20px 50px rgba(22, 36, 64, .12);
  }
}

/* ───────────────────────── base ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
.art { display: block; width: 100%; height: auto; }

a { color: var(--ble); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }

:focus-visible {
  outline: 2px solid var(--ble);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); color: var(--text);
  padding: 12px 18px; z-index: 50; border-radius: 0 0 10px 0;
}
.skip:focus { left: 0; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { max-width: 780px; }

h1, h2, h3 { font-family: var(--display); line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
p { margin: 0 0 1em; }

/* ───────────────────────── header ───────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 1.1rem;
  color: var(--text); text-decoration: none; letter-spacing: -0.01em;
}
.brand-mark { width: 26px; height: 26px; flex: none; }

.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 500;
}
.nav a:hover { color: var(--text); }

/* ───────────────────────── buttons ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 22px; border-radius: 12px; font-weight: 600; font-size: 1rem;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn-sm { padding: 8px 16px; font-size: .9rem; margin-left: 4px; }
.btn-primary {
  background: linear-gradient(135deg, var(--ble), var(--wifi));
  color: #05080e; border-color: transparent;
}
.btn-sm:not(.btn-ghost) { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-primary:hover { color: #05080e; transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ble); color: var(--text); }
.btn-sm:hover { border-color: var(--ble); color: var(--text); }

/* ───────────────────────── hero ───────────────────────── */
.hero {
  padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 6vw, 72px);
  background:
    radial-gradient(900px 420px at 72% 10%, color-mix(in srgb, var(--wifi) 12%, transparent), transparent 70%),
    radial-gradient(700px 400px at 12% 0%, color-mix(in srgb, var(--ble) 12%, transparent), transparent 70%);
}
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(28px, 4vw, 56px); align-items: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: .82rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; background: var(--surface); margin: 0 0 22px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }

h1 { font-size: clamp(2.1rem, 5.6vw, 3.9rem); font-weight: 700; margin-bottom: 20px; }
.grad {
  background: linear-gradient(100deg, var(--ble), var(--wifi) 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: clamp(1.02rem, 1.5vw, 1.18rem); color: var(--text-2); max-width: 54ch; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 20px; }
.meta-line { font-size: .88rem; color: var(--muted); margin: 0; }

.hero-art { filter: drop-shadow(var(--shadow)); }

.stats {
  list-style: none; margin: clamp(40px, 6vw, 72px) 0 0; padding: 22px 0 0;
  border-top: 1px solid var(--line-soft);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px;
}
.stats li { display: flex; flex-direction: column; gap: 4px; }
.stats strong {
  font-family: var(--display); font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700;
  color: var(--text); line-height: 1;
}
.stats span { font-size: .88rem; color: var(--muted); }

/* ───────────────────────── sections ───────────────────────── */
.section { padding: clamp(56px, 8vw, 112px) 0; }
.section-alt { background: var(--bg-2); border-block: 1px solid var(--line-soft); }

.kicker {
  font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ble); margin: 0 0 14px;
}
.section-title { font-size: clamp(1.65rem, 3.6vw, 2.5rem); font-weight: 700; max-width: 20ch; }
.section-lede { font-size: clamp(1rem, 1.4vw, 1.1rem); color: var(--text-2); max-width: 62ch; margin-top: 18px; }
.section-foot { color: var(--muted); font-size: .96rem; max-width: 70ch; margin-top: 34px; }

/* ───────────────────────── problem ───────────────────────── */
.problem-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; margin-top: 40px;
}
.pcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px;
}
.pcard-art { width: 120px; height: 80px; display: block; margin-bottom: 10px; }
.pcard h3 { font-size: 1.1rem; margin-bottom: 8px; }
.pcard p { color: var(--muted); font-size: .95rem; margin: 0; }
.pcard-gap { border-color: color-mix(in srgb, var(--warm) 45%, var(--line)); background: var(--surface-2); }

/* ───────────────────────── figures ───────────────────────── */
.figure {
  margin: 40px 0 0; padding: clamp(14px, 2.4vw, 26px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.figure figcaption {
  margin-top: 14px; font-size: .9rem; color: var(--muted); text-align: center; line-height: 1.5;
}
.figure-inset { margin-top: 0; background: var(--surface); }

.how-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px; margin-top: 18px;
}

/* svg typography */
.svg-strong { font-family: var(--display); font-size: 15px; font-weight: 600; fill: var(--text); }
.svg-sub { font-family: var(--sans); font-size: 12.5px; fill: var(--muted); }
.svg-label { font-family: var(--sans); font-size: 11.5px; font-weight: 600; fill: var(--text-2); }
.svg-tier { font-family: var(--display); font-size: 16px; font-weight: 700; fill: var(--text); }
.svg-code { font-family: var(--mono); font-size: 12.5px; fill: var(--text-2); }

/* ───────────────────────── steps ───────────────────────── */
.steps {
  list-style: none; counter-reset: s; margin: 44px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px;
}
.steps li {
  display: flex; gap: 14px; padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.step-n {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-family: var(--display); font-weight: 700;
  background: var(--chip-fill); color: var(--ble); border: 1px solid color-mix(in srgb, var(--ble) 35%, transparent);
}
.steps h3 { font-size: 1rem; margin-bottom: 6px; }
.steps p { color: var(--muted); font-size: .93rem; margin: 0; }

/* ───────────────────────── features ───────────────────────── */
.feat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px; margin-top: 44px;
}
.feat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column;
}
.feat-art {
  width: 100%; max-width: 260px; height: auto; display: block;
  margin-bottom: 18px; border-radius: 12px; background: var(--surface-2); padding: 8px;
}
.feat h3 { font-size: 1.22rem; margin-bottom: 10px; }
.feat p { color: var(--text-2); font-size: .97rem; }
.feat-meta { margin-top: auto; color: var(--muted); font-size: .85rem; padding-top: 6px; }
code {
  /* Some mono faces ligate "--" into an em dash, which would misrender
     `brew install --cask`. Commands must read exactly as typed. */
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0;
  font-family: var(--mono); font-size: .86em;
  background: var(--surface-3); border: 1px solid var(--line-soft);
  padding: 1px 6px; border-radius: 6px; color: var(--text-2);
}

/* ───────────────────────── security ───────────────────────── */
.sec-grid {
  display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 26px; align-items: start; margin-top: 10px;
}
.sec-list { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 2px; }
.sec-list li { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.sec-list li:last-child { border-bottom: 0; }
.sec-list h3 { font-size: 1.05rem; margin-bottom: 6px; }
.sec-list p { color: var(--muted); font-size: .96rem; margin: 0; }

/* ───────────────────────── install ───────────────────────── */
.install-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px; margin-top: 40px;
}
.install-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px;
}
.install-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.install-icon { width: 26px; height: 26px; color: var(--ble); flex: none; }
.install-card h3 { font-size: 1.2rem; }
.install-card p { color: var(--text-2); font-size: .96rem; }

.code {
  display: flex; align-items: stretch; gap: 8px; margin-bottom: 18px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 14px;
}
.code pre {
  margin: 0; overflow-x: auto; flex: 1 1 auto; min-width: 0;
  padding: 9px 0; scrollbar-width: thin;
}
.code code {
  background: none; border: 0; padding: 0;
  font-size: .86rem; color: var(--text); white-space: pre;
}
.copy {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 12px; font: inherit; font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: border-color .15s ease, color .15s ease;
}
.copy svg { width: 15px; height: 15px; }
.copy:hover { border-color: var(--ble); color: var(--text); }
.copy.done { border-color: var(--ok); color: var(--ok); }

.warn {
  background: var(--warm-fill); border: 1px solid color-mix(in srgb, var(--warm) 35%, transparent);
  border-radius: 12px; padding: 16px; font-size: .92rem; color: var(--text-2); margin-bottom: 0;
}

/* ───────────────────────── limitations ───────────────────────── */
.limit-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px; margin-top: 44px;
}
.limit {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.limit-major {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--warm) 40%, var(--line));
  background: linear-gradient(180deg, var(--warm-fill), transparent 55%), var(--surface);
}
.limit-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.limit-art { width: 40px; height: 40px; flex: none; }
.limit h3 { font-size: 1.12rem; }
.limit p { color: var(--text-2); font-size: .96rem; }
.limit p:last-child { margin-bottom: 0; }
.limit-ul { margin: 0 0 1em; padding-left: 20px; color: var(--text-2); font-size: .96rem; }
.limit-ul li { margin-bottom: 6px; }

/* ───────────────────────── faq ───────────────────────── */
.faq { margin-top: 36px; border-top: 1px solid var(--line-soft); }
.faq details { border-bottom: 1px solid var(--line-soft); }
.faq summary {
  cursor: pointer; list-style: none; padding: 20px 40px 20px 0; position: relative;
  font-family: var(--display); font-weight: 600; font-size: 1.08rem; color: var(--text);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 8px; top: 50%; width: 11px; height: 11px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); transition: transform .2s ease;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.faq p { color: var(--text-2); font-size: .98rem; padding-bottom: 20px; margin: 0; max-width: 68ch; }

/* ───────────────────────── footer ───────────────────────── */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--line-soft); padding: clamp(44px, 6vw, 72px) 0 32px; }
.footer-grid {
  display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: 30px;
}
.footer-note { color: var(--muted); font-size: .95rem; margin-top: 14px; max-width: 34ch; }
.footer-links { display: flex; flex-direction: column; gap: 9px; }
.footer-links h2 {
  font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 4px;
}
.footer-links a { color: var(--text-2); text-decoration: none; font-size: .95rem; }
.footer-links a:hover { color: var(--ble); text-decoration: underline; }
.footer-links p { color: var(--muted); font-size: .95rem; margin: 0; }
.footer-base {
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between;
}
.footer-base p { color: var(--muted); font-size: .88rem; margin: 0; }

/* ───────────────────────── motion ───────────────────────── */
.pkt { will-change: transform; }
.pkt-a { animation: runRight 3.4s cubic-bezier(.5,0,.5,1) infinite; }
.pkt-b { animation: runLeft 3.4s cubic-bezier(.5,0,.5,1) infinite 1.7s; }
.pkt-l1 { animation: runL1 4.2s linear infinite; }
.pkt-l1b { animation: runL1Back 4.2s linear infinite 2.1s; }
.pulse-ring { transform-box: view-box; transform-origin: 392px 188px; animation: pulse 3.4s ease-out infinite; }

@keyframes runRight {
  0% { transform: translateX(0); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateX(232px); opacity: 0; }
}
@keyframes runLeft {
  0% { transform: translateX(232px); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateX(0); opacity: 0; }
}
@keyframes runL1 {
  0% { transform: translateX(0); opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { transform: translateX(728px); opacity: 0; }
}
@keyframes runL1Back {
  0% { transform: translateX(728px); opacity: 0; }
  8% { opacity: 1; }
  92% { opacity: 1; }
  100% { transform: translateX(0); opacity: 0; }
}
@keyframes pulse {
  0% { transform: scale(.5); opacity: .7; }
  70%, 100% { transform: scale(2.2); opacity: 0; }
}

/* scroll reveal — the selector list is mirrored in script.js */
.js .kicker,
.js .section-title,
.js .section-lede,
.js .section-foot,
.js .stats li,
.js .pcard,
.js .figure,
.js .steps li,
.js .feat,
.js .sec-list li,
.js .install-card,
.js .limit,
.js .faq details {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
}
.js .is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .kicker, .js .section-title, .js .section-lede, .js .section-foot,
  .js .stats li, .js .pcard, .js .figure, .js .steps li, .js .feat,
  .js .sec-list li, .js .install-card, .js .limit, .js .faq details {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ───────────────────────── responsive ───────────────────────── */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .sec-grid { grid-template-columns: 1fr; }
  .sec-list { margin-top: 10px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  /* keep diagram labels legible: scroll the figure itself, never the page */
  .figure { overflow-x: auto; }
  .art-wide { min-width: 660px; }
  .art-mid { min-width: 400px; }
}

@media (max-width: 760px) {
  .nav { display: none; }
  .btn-sm { margin-left: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .tiny-hide { display: none; }
}

@media (max-width: 520px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .footer-grid { grid-template-columns: 1fr; }
  .section-title { max-width: none; }
  .code { flex-direction: column; align-items: stretch; padding: 10px; }
  .copy { justify-content: center; }
  .limit-head { align-items: flex-start; }
}
