/* sparky landing page. Design tokens mirror the app (app_palette.dart). */

@font-face { font-family: "Space Grotesk"; src: url("../assets/fonts/SpaceGrotesk.woff") format("woff"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url("../assets/fonts/SpaceMono-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Mono"; src: url("../assets/fonts/SpaceMono-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --raised: #ebebe8;
  --high: #ddddd9;
  --dot: #e2e2de;
  --border: #d6d6d2;
  --border-strong: #a8a8a3;
  --text: #0a0a0a;
  --text-2: #5e5e5a;
  --text-3: #8e8e89;
  --inverse: #ffffff;
  --accent: #d71921;
  --accent-text: #c4151c;
  --glass: rgba(244, 244, 242, 0.78);
  --shadow: 0 24px 60px -24px rgba(10, 10, 10, 0.35);
  --bezel: #15151a;
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Space Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-card: 28px;
  --r-pill: 999px;
  --wrap: 1160px;
  --gutter: 20px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000; --surface: #0a0a0a; --raised: #141414; --high: #1f1f1f; --dot: #1c1c1c;
    --border: #2a2a2a; --border-strong: #3d3d3d; --text: #ffffff; --text-2: #999999; --text-3: #5c5c5c;
    --inverse: #000000; --accent-text: #ff6b6b; --glass: rgba(20, 20, 20, 0.7);
    --shadow: 0 24px 60px -24px rgba(215, 25, 33, 0.35); --bezel: #1c1c20;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --surface: #0a0a0a; --raised: #141414; --high: #1f1f1f; --dot: #1c1c1c;
  --border: #2a2a2a; --border-strong: #3d3d3d; --text: #ffffff; --text-2: #999999; --text-3: #5c5c5c;
  --inverse: #000000; --accent-text: #ff6b6b; --glass: rgba(20, 20, 20, 0.7);
  --shadow: 0 24px 60px -24px rgba(215, 25, 33, 0.35); --bezel: #1c1c20;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; line-height: 1.06; letter-spacing: -0.02em; font-weight: 700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--text); color: var(--inverse); padding: 10px 18px; border-radius: var(--r-pill); font-family: var(--mono); font-size: 13px; text-decoration: none; transition: top .15s; }
.skip:focus { top: 12px; }

/* Theme-aware images */
.t-dark { display: none; }
:root[data-theme="dark"] .t-light { display: none; }
:root[data-theme="dark"] .t-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .t-light { display: none; }
  :root:not([data-theme="light"]) .t-dark { display: block; }
}

/* Type */
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 18px; display: flex; align-items: center; gap: 10px; }
.kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
h2 { font-size: clamp(32px, 5vw, 52px); }
.lead { font-size: clamp(18px, 2vw, 21px); color: var(--text-2); max-width: 34em; }
.mono { font-family: var(--mono); }

/* Wordmark */
.wordmark { display: inline-flex; align-items: baseline; font-weight: 700; letter-spacing: -0.04em; text-decoration: none; line-height: 1; }
.wordmark .dot { display: inline-block; width: .17em; height: .17em; border-radius: 50%; background: var(--accent); margin-left: .05em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px; border-radius: var(--r-pill); font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; border: 1.5px solid transparent; cursor: pointer; transition: transform .15s, background .15s, border-color .15s; white-space: nowrap; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--text); color: var(--inverse); }
.btn-primary:hover { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--text); }
.btn svg { width: 18px; height: 18px; }
.btn-sm { min-height: 40px; padding: 0 18px; font-size: 12px; }

/* Header */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 50; background: var(--glass); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header.scrolled { border-bottom-color: var(--border); }
.bar { display: flex; align-items: center; gap: 20px; height: 64px; }
.bar .wordmark { font-size: 26px; }
.nav { display: none; margin-left: auto; gap: 26px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.nav a { text-decoration: none; color: var(--text-2); padding: 8px 0; }
.nav a:hover { color: var(--text); }
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav + .bar-actions { margin-left: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: transparent; color: var(--text); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { border-color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: block; }
:root[data-theme="dark"] .icon-btn .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .sun { display: block; }
  :root:not([data-theme="light"]) .icon-btn .moon { display: none; }
}
@media (min-width: 860px) { .nav { display: flex; } }
@media (max-width: 420px) { .bar-actions .btn-sm { padding: 0 14px; } .bar .wordmark { font-size: 23px; } }

/* Hero */
.hero { position: relative; padding: 112px 0 0; overflow: hidden; border-bottom: 1px solid var(--border); isolation: isolate; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.hero-grid { display: grid; gap: 40px; align-items: center; }
.hero .wordmark { font-size: clamp(64px, 12vw, 120px); margin-bottom: 22px; }
.hero h1 { font-size: clamp(34px, 5.4vw, 60px); max-width: 12em; margin-bottom: 20px; }
.hero .lead { margin-bottom: 30px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.fine { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--text-2); margin: 20px 0 0; }
.hero-phone { height: 520px; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; padding-top: 6px; }
@media (min-width: 900px) {
  .hero { padding-top: 120px; }
  .hero-grid { grid-template-columns: 1.15fr 0.85fr; gap: 56px; }
  .hero-phone { height: 640px; justify-content: flex-end; }
  .hero-phone .phone { --w: 300px; }
}
.wave-note { display: none; }

/* Phone frame (CSS only) */
.phone { --w: 270px; position: relative; width: var(--w); max-width: 100%; flex: none; padding: 9px; background: var(--bezel); border-radius: 42px; box-shadow: 0 0 0 1.5px var(--border-strong), var(--shadow); }
.phone::after { content: ""; position: absolute; right: -3px; top: 22%; width: 3px; height: 54px; border-radius: 2px; background: var(--border-strong); }
.phone img { width: 100%; height: auto; border-radius: 33px; background: var(--bg); }
.phones { display: flex; gap: 22px; justify-content: center; align-items: flex-start; }
.phones .phone { --w: 232px; }
.phones .phone:nth-child(2) { margin-top: 56px; }
@media (max-width: 560px) { .phones .phone { --w: calc(50% - 7px); padding: 6px; border-radius: 28px; } .phones .phone img { border-radius: 22px; } .phones { gap: 14px; } .phones .phone:nth-child(2) { margin-top: 32px; } }

/* Sections */
section { position: relative; }
.section { padding: clamp(72px, 10vw, 128px) 0; }
.dotted { background-image: radial-gradient(circle, var(--dot) 1.4px, transparent 1.6px); background-size: 14px 14px; }
.feature { display: grid; gap: 48px; align-items: center; }
.feature .copy { max-width: 560px; }
@media (min-width: 900px) {
  .feature { grid-template-columns: 1fr 1fr; gap: 80px; }
  .feature.reverse .copy { order: 2; }
}
.points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 14px; }
.points li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; }
.points .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--raised); display: grid; place-items: center; color: var(--text); }
.points .ico svg { width: 20px; height: 20px; }
.points b { display: block; font-weight: 600; margin-bottom: 2px; }
.points span { color: var(--text-2); font-size: 15.5px; line-height: 1.45; display: block; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 28px; }
.visual-card { display: grid; place-items: center; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 36px; }
.visual-card img.ill { width: min(100%, 420px); height: auto; }

/* Card images (no phone) */
.shot { border-radius: 24px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow); background: var(--bg); }
.shot img { width: 100%; height: auto; }
.card-stack { display: grid; gap: 28px; justify-items: center; }
.card-stack .shot { width: min(100%, 400px); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.chip { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; padding: 8px 14px; border-radius: var(--r-pill); border: 1.5px solid var(--border-strong); color: var(--text); background: var(--surface); }
.chip.hot { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Routing diagram */
.route { display: grid; gap: 14px; justify-items: center; padding: 8px 0; }
.route .src { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.route .hub { display: inline-flex; align-items: center; gap: 12px; padding: 14px 26px; border-radius: var(--r-pill); background: var(--text); color: var(--inverse); font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.route .hub i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(215,25,33,.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(215,25,33,0); } 100% { box-shadow: 0 0 0 0 rgba(215,25,33,0); } }
.route .stem { width: 1.5px; height: 28px; background: repeating-linear-gradient(var(--border-strong) 0 4px, transparent 4px 8px); }
.route .row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.route .row .chip { background: var(--bg); }
@media (prefers-reduced-motion: reduce) { .route .hub i { animation: none; } }

/* Grids of cards */
.grid { display: grid; gap: 16px; margin-top: 48px; }
@media (min-width: 700px) { .grid.c2 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid.c4 { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 26px; }
.tile .ico { width: 44px; height: 44px; border-radius: 14px; background: var(--raised); display: grid; place-items: center; margin-bottom: 22px; }
.tile .ico svg { width: 22px; height: 22px; }
.tile h3 { font-size: 21px; margin-bottom: 8px; letter-spacing: -0.01em; }
.tile p { color: var(--text-2); font-size: 15.5px; line-height: 1.5; margin: 0; }
.head { max-width: 720px; }
.head.center { margin: 0 auto; text-align: center; }
.head.center .kicker { justify-content: center; }
.head.center .lead { margin-left: auto; margin-right: auto; }

/* Updates strip */
.updates { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .updates { grid-template-columns: 1.1fr .9fr; gap: 80px; } }

/* Releases */
.releases { display: grid; gap: 16px; margin-top: 48px; }
@media (min-width: 900px) { .releases { grid-template-columns: 1.3fr 1fr 1fr; } }
.release { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.release.latest { border-color: var(--accent); }
.release .meta { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.release .meta .tag { color: var(--accent-text); }
.release .ver { font-size: clamp(46px, 6vw, 68px); font-weight: 700; letter-spacing: -0.05em; line-height: 1; }
.release h3 { font-size: 22px; letter-spacing: -0.01em; }
.release ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.release li b { font-weight: 600; display: block; }
.release li span { color: var(--text-2); font-size: 15px; line-height: 1.45; display: block; }
.release li em { font-style: normal; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; color: var(--accent-text); border: 1px solid currentColor; border-radius: var(--r-pill); padding: 1px 8px; margin-right: 8px; vertical-align: 2px; }

/* FAQ */
.faq { max-width: 820px; margin: 48px auto 0; display: grid; gap: 10px; }
details { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; transition: border-color .2s; }
details[open] { border-color: var(--border-strong); }
summary { list-style: none; cursor: pointer; padding: 22px 26px; font-weight: 600; font-size: 18px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-radius: 22px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-family: var(--mono); font-size: 22px; color: var(--accent-text); flex: none; transition: transform .2s; }
details[open] summary::after { transform: rotate(45deg); }
details .a { padding: 0 26px 24px; color: var(--text-2); font-size: 16.5px; }
details .a p:last-child { margin-bottom: 0; }
details .a a { color: var(--text); text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* Final CTA */
.cta { text-align: center; }
.cta-card { position: relative; overflow: hidden; border-radius: 40px; background: var(--text); color: var(--inverse); padding: clamp(48px, 8vw, 96px) 24px; isolation: isolate; }
.cta-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(circle, rgba(215,25,33,.55) 1.6px, transparent 1.9px); background-size: 14px 14px; -webkit-mask-image: linear-gradient(to top, #000, transparent 70%); mask-image: linear-gradient(to top, #000, transparent 70%); }
.cta-card h2 { font-size: clamp(34px, 6vw, 64px); max-width: 11em; margin: 0 auto 18px; }
.cta-card p { color: inherit; opacity: .72; max-width: 30em; margin: 0 auto 30px; }
.cta-card .btn-primary { background: var(--inverse); color: var(--text); }
.cta-card .btn-primary:hover { background: var(--accent); color: #fff; }
.cta-card .btn-ghost { color: var(--inverse); border-color: rgba(128,128,128,.6); }
.cta-card .btn-ghost:hover { border-color: var(--inverse); }
.cta-card .cta-row { justify-content: center; }
.cta-card :focus-visible { outline-color: #ff6b6b; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 56px 0 40px; font-size: 15px; }
.foot { display: grid; gap: 36px; }
@media (min-width: 800px) { .foot { grid-template-columns: 1.4fr 1fr 1fr 1.4fr; } }
.foot .wordmark { font-size: 34px; margin-bottom: 12px; }
.foot p { color: var(--text-2); margin: 0 0 8px; max-width: 26em; }
.foot h3 { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); font-weight: 400; margin-bottom: 14px; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.foot a { text-decoration: none; }
.foot ul a:hover, .foot p a:hover { text-decoration: underline; text-underline-offset: 3px; }
.credits { color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.credits a { color: var(--text); }
.legal { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--text-2); letter-spacing: .04em; }

/* 404 */
.nf { min-height: 100svh; display: grid; place-items: center; text-align: center; padding: 40px var(--gutter); }
.nf .num { font-size: clamp(96px, 22vw, 220px); font-weight: 700; letter-spacing: -0.06em; line-height: .9; }
.nf .num i { display: inline-block; width: .16em; height: .16em; border-radius: 50%; background: var(--accent); margin-left: .02em; }
.nf p { color: var(--text-2); margin: 18px 0 30px; }
figure { margin: 0; }
h1, h2, .lead { text-wrap: balance; }
@media (min-width: 900px) { .hero-copy { padding-bottom: 90px; } }
.feature, .hero-grid, .updates, .grid, .releases, .foot { grid-template-columns: minmax(0, 1fr); }
.feature > *, .hero-grid > *, .updates > * { min-width: 0; }
@media (min-width: 900px) {
  .feature { grid-template-columns: 1fr 1fr; }
  .hero-grid { grid-template-columns: 1.15fr 0.85fr; }
  .updates { grid-template-columns: 1.1fr .9fr; }
  .releases { grid-template-columns: 1.3fr 1fr 1fr; }
}
@media (min-width: 800px) { .foot { grid-template-columns: 1.4fr 1fr 1fr 1.4fr; } }
@media (min-width: 700px) { .grid.c2 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid.c4 { grid-template-columns: repeat(4, 1fr); } }
