/* StablePlus — stableplus.com
   Tokens (light / dark) + components (prefix sp-) + site shell. */
:root {
  --surface-000: #fbfaf5;
  --surface-100: #f3f1e8;
  --surface-200: #e8e5d7;
  --canopy: #12301f;
  --on-canopy: #eef3e6;
  --on-canopy-muted: #b5c6b4;
  --ink: #070d0a;
  --ink-muted: #27332d;
  --line: #d8d4c3;
  --line-strong: #737c73;
  --brand: #2d6a46;
  --on-brand: #ffffff;
  --brand-tint: #dcebdf;
  --lime: #b9de4c;
  --on-lime: #13201a;
  --signal: #4b6f00;
  --water: #1d6680;
  --water-tint: #d9ebf1;
  --solar: #f0a81c;
  --on-solar: #13201a;
  --solar-text: #875700;
  --soil: #8a4b26;
  --danger: #b42318;
  --on-danger: #ffffff;
  --ember: #c4570c;
  --ember-bright: #ff8a3d;
  --focus: #0d5a75;
  --hud-ground: #071009;
  --hud-ink: #d8f5c4;
  --hud-grid: #1e3a26;
  --shadow-1: 0 1px 2px rgba(19,32,26,0.08);
  --shadow-2: 0 8px 24px rgba(19,32,26,0.12);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --surface-000: #0b120e;
  --surface-100: #111b15;
  --surface-200: #18251d;
  --canopy: #0f2619;
  --on-canopy: #e6eedf;
  --on-canopy-muted: #a9bba8;
  --ink: #e9efe6;
  --ink-muted: #a2b1a7;
  --line: #26352c;
  --line-strong: #62756a;
  --brand: #5fbf86;
  --on-brand: #07140c;
  --brand-tint: #173826;
  --lime: #b9de4c;
  --on-lime: #13201a;
  --signal: #b9de4c;
  --water: #6cc3dd;
  --water-tint: #12303a;
  --solar: #f3b43a;
  --on-solar: #13201a;
  --solar-text: #f6c453;
  --soil: #d6a07a;
  --danger: #ff7b6b;
  --on-danger: #200603;
  --ember: #ff8a3d;
  --ember-bright: #ff8a3d;
  --focus: #93daf0;
  --hud-ground: #071009;
  --hud-ink: #d8f5c4;
  --hud-grid: #1e3a26;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.5);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.55);
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --surface-000: #0b120e;
  --surface-100: #111b15;
  --surface-200: #18251d;
  --canopy: #0f2619;
  --on-canopy: #e6eedf;
  --on-canopy-muted: #a9bba8;
  --ink: #e9efe6;
  --ink-muted: #a2b1a7;
  --line: #26352c;
  --line-strong: #62756a;
  --brand: #5fbf86;
  --on-brand: #07140c;
  --brand-tint: #173826;
  --lime: #b9de4c;
  --on-lime: #13201a;
  --signal: #b9de4c;
  --water: #6cc3dd;
  --water-tint: #12303a;
  --solar: #f3b43a;
  --on-solar: #13201a;
  --solar-text: #f6c453;
  --soil: #d6a07a;
  --danger: #ff7b6b;
  --on-danger: #200603;
  --ember: #ff8a3d;
  --ember-bright: #ff8a3d;
  --focus: #93daf0;
  --hud-ground: #071009;
  --hud-ink: #d8f5c4;
  --hud-grid: #1e3a26;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.5);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.55);
  color-scheme: dark; }
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --container: 1200px;
  --measure: 68ch;
  --nav-height: 64px;
  --font-display: "Bai Jamjuree", "IBM Plex Sans Thai", system-ui, sans-serif;
  --font-sans: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
}
.display-xl { font-family: var(--font-display); font-size: 64px; line-height: 72px; font-weight: 700; letter-spacing: -0.01em; }
.display-l { font-family: var(--font-display); font-size: 44px; line-height: 54px; font-weight: 700; }
.h1 { font-family: var(--font-display); font-size: 32px; line-height: 42px; font-weight: 600; }
.h2 { font-family: var(--font-display); font-size: 24px; line-height: 34px; font-weight: 600; }
.h3 { font-family: var(--font-display); font-size: 19px; line-height: 28px; font-weight: 600; }
.body-l { font-family: var(--font-sans); font-size: 18px; line-height: 30px; font-weight: 400; }
.prose { font-family: var(--font-sans); font-size: 18px; line-height: 32px; font-weight: 400; }
.body { font-family: var(--font-sans); font-size: 16px; line-height: 27px; font-weight: 400; }
.small { font-family: var(--font-sans); font-size: 14px; line-height: 22px; font-weight: 400; }
.label { font-family: var(--font-sans); font-size: 14px; line-height: 20px; font-weight: 600; }
.data-xl { font-family: var(--font-mono); font-size: 40px; line-height: 44px; font-weight: 500; }
.data { font-family: var(--font-mono); font-size: 14px; line-height: 20px; font-weight: 500; }
.overline { font-family: var(--font-mono); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; }
.caption { font-family: var(--font-mono); font-size: 12px; line-height: 18px; font-weight: 400; }


/* StablePlus component stylesheet — every value comes from tokens.css (var(--…)). Prefix: sp- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface-000); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 27px; }
img, svg { display: block; max-width: 100%; }
a { color: var(--water); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-on-canopy :focus-visible, .sp-hud :focus-visible { outline-color: var(--lime); }

/* ---------- layout ---------- */
.sp-container { max-width: var(--container); margin: 0 auto; padding: 0 var(--space-6); }
.sp-section { padding: var(--space-16) 0; }
.sp-section.alt { background: var(--surface-100); }
.sp-grid { display: grid; gap: var(--space-6); }
.sp-grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sp-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sp-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sp-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.sp-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.sp-muted { color: var(--ink-muted); }
p.sp-muted { color: var(--ink); }
@media (max-width: 860px) {
  .sp-container { padding: 0 var(--space-4); }
  .sp-section { padding: var(--space-12) 0; }
  .sp-grid.c2, .sp-grid.c3, .sp-grid.c4 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- type helpers ---------- */
.sp-eyebrow { font-family: var(--font-mono); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); margin: 0 0 var(--space-3); }
.sp-eyebrow.it { color: var(--water); }
.sp-eyebrow.solar { color: var(--solar-text); }
.sp-eyebrow.soil { color: var(--soil); }
.sp-h-display { font-family: var(--font-display); font-size: 64px; line-height: 72px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.sp-h-l { font-family: var(--font-display); font-size: 44px; line-height: 54px; font-weight: 700; margin: 0; }
.sp-h1 { font-family: var(--font-display); font-size: 32px; line-height: 42px; font-weight: 600; margin: 0; }
.sp-h2 { font-family: var(--font-display); font-size: 24px; line-height: 34px; font-weight: 600; margin: 0; }
.sp-h3 { font-family: var(--font-display); font-size: 19px; line-height: 28px; font-weight: 600; margin: 0; }
.sp-lead { font-size: 18px; line-height: 30px; color: var(--ink); margin: 0; max-width: 60ch; }
.sp-data-xl { font-family: var(--font-mono); font-size: 40px; line-height: 44px; font-weight: 500; font-variant-numeric: tabular-nums; }
.sp-data { font-family: var(--font-mono); font-size: 14px; line-height: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
.sp-caption { font-family: var(--font-mono); font-size: 12px; line-height: 18px; color: var(--ink-muted); }
@media (max-width: 860px) {
  .sp-h-display { font-size: 40px; line-height: 50px; }
  .sp-h-l { font-size: 32px; line-height: 42px; }
  .sp-h1 { font-size: 26px; line-height: 36px; }
}

/* ---------- Button ---------- */
.sp-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: var(--space-3) var(--space-6); border-radius: var(--radius-sm); border: 1px solid transparent; font-family: var(--font-sans); font-size: 14px; line-height: 20px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, transform .15s; }
.sp-btn:active { transform: translateY(1px); }
.sp-btn.primary { background: var(--brand); color: var(--on-brand); }
.sp-btn.primary:hover { background: var(--ink); color: var(--surface-000); }
.sp-btn.secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.sp-btn.secondary:hover { background: var(--surface-200); }
.sp-btn.ghost { background: transparent; color: var(--brand); padding-left: var(--space-2); padding-right: var(--space-2); }
.sp-btn.ghost:hover { text-decoration: underline; }
.sp-btn.lime { background: var(--lime); color: var(--on-lime); }
.sp-btn.danger { background: var(--danger); color: var(--on-danger); }
.sp-btn[disabled] { opacity: .45; cursor: not-allowed; }
.sp-on-canopy .sp-btn.secondary { color: var(--on-canopy); border-color: var(--on-canopy-muted); }
.sp-on-canopy .sp-btn.secondary:hover { background: rgba(255,255,255,.08); }
.sp-btn svg { width: 16px; height: 16px; }

/* ---------- Badge / Tag ---------- */
.sp-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px var(--space-2); border-radius: var(--radius-xs); font-family: var(--font-mono); font-size: 12px; line-height: 18px; font-weight: 500; background: var(--surface-200); color: var(--ink); border: 1px solid var(--line); white-space: nowrap; }
.sp-badge.ag { background: var(--brand-tint); color: var(--brand); border-color: transparent; }
.sp-badge.it { background: var(--water-tint); color: var(--water); border-color: transparent; }
.sp-badge.solar { background: var(--solar); color: var(--on-solar); border-color: transparent; }
.sp-badge.live::before, .sp-badge.off::before, .sp-badge.warn::before { content: ""; width: 8px; height: 8px; border-radius: var(--radius-pill); }
.sp-badge.live { color: var(--signal); }
.sp-badge.live::before { background: var(--lime); box-shadow: 0 0 0 3px rgba(185,222,76,.25); animation: sp-pulse 1.6s infinite; }
.sp-badge.off { color: var(--danger); }
.sp-badge.off::before { background: var(--danger); }
.sp-badge.warn { color: var(--solar-text); }
.sp-badge.warn::before { background: var(--solar); }
@keyframes sp-pulse { 50% { box-shadow: 0 0 0 6px rgba(185,222,76,0); } }
@media (prefers-reduced-motion: reduce) { .sp-badge.live::before { animation: none; } }

/* ---------- NavBar ---------- */
.sp-nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface-000) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.sp-nav-inner { display: flex; align-items: center; gap: var(--space-6); height: var(--nav-height); }
.sp-logo { display: flex; align-items: baseline; gap: 2px; font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.sp-logo b { color: var(--ember); font-weight: 700; }
.sp-logo small { font-size: inherit; font-weight: 500; color: var(--ink-muted); margin-left: 0; }
.sp-nav-links { display: flex; gap: var(--space-1); margin-left: auto; list-style: none; padding: 0; margin-top: 0; margin-bottom: 0; }
.sp-nav-links a { display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-muted); text-decoration: none; white-space: nowrap; }
.sp-nav-links a:hover { color: var(--ink); background: var(--surface-200); }
.sp-nav-links a[aria-current="page"] { color: var(--brand); background: var(--brand-tint); font-weight: 600; }
.sp-nav-inner > nav { margin-left: auto; }
.sp-nav-toggle { display: none; margin-left: auto; }
@media (max-width: 1080px) {
  .sp-nav-links { display: none; }
  .sp-nav-toggle { display: inline-flex; }
}

/* ---------- Hero (canopy) ---------- */
.sp-hero { position: relative; overflow: hidden; background: var(--canopy); color: var(--on-canopy); padding: var(--space-24) 0 var(--space-16); }
.sp-hero .sp-lead { color: var(--on-canopy); }
.sp-hero .sp-eyebrow { color: var(--lime); }
.sp-hero-grid { position: absolute; inset: 0; opacity: .5; pointer-events: none; background-image: radial-gradient(var(--hud-grid) 1.5px, transparent 1.5px); background-size: 24px 24px; }
.sp-hero > .sp-container { position: relative; }
.sp-hero-split { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--space-12); align-items: end; }
.sp-hero-stats { display: flex; gap: var(--space-8); margin-top: var(--space-8); flex-wrap: wrap; }
.sp-hero-stats div { border-top: 1px solid var(--on-canopy-muted); padding-top: var(--space-3); min-width: 120px; }
.sp-hero-stats strong { display: block; font-family: var(--font-mono); font-size: 28px; line-height: 32px; font-weight: 500; color: var(--on-canopy); }
.sp-hero-stats span { font-size: 14px; color: var(--on-canopy-muted); }
@media (max-width: 860px) { .sp-hero { padding: var(--space-12) 0; } .sp-hero-split { grid-template-columns: 1fr; } }

/* ---------- Section header ---------- */
.sp-sechead { display: flex; align-items: end; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-8); flex-wrap: wrap; }
.sp-sechead > div { max-width: 640px; }
.sp-sechead p { margin: var(--space-2) 0 0; color: var(--ink); }

/* ---------- Card (base) ---------- */
.sp-card { background: var(--surface-000); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); box-shadow: var(--shadow-1); }
.sp-section.alt .sp-card { background: var(--surface-000); }
.sp-card.inset { background: var(--surface-200); box-shadow: none; border-color: transparent; }
a.sp-card { display: block; color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s; }
a.sp-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }

/* ---------- Dual-core pillar ---------- */
.sp-core { position: relative; padding: var(--space-8); border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-000); }
.sp-core .sp-core-mark { width: 48px; height: 48px; border-radius: var(--radius-md); display: grid; place-items: center; margin-bottom: var(--space-6); }
.sp-core.it .sp-core-mark { background: var(--water-tint); color: var(--water); }
.sp-core.ag .sp-core-mark { background: var(--brand-tint); color: var(--brand); }
.sp-core ul { margin: var(--space-4) 0 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); }
.sp-core li { display: flex; gap: var(--space-2); font-size: 15px; }
.sp-core li::before { content: "→"; font-family: var(--font-mono); color: var(--ink-muted); }

/* ---------- Telemetry ---------- */
.sp-telemetry { background: var(--surface-000); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.sp-telemetry-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--line); }
.sp-telemetry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sp-metric { padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--line); }
.sp-metric:nth-child(odd) { border-right: 1px solid var(--line); }
.sp-metric .k { font-family: var(--font-mono); font-size: 12px; line-height: 16px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.sp-metric .v { font-family: var(--font-mono); font-size: 28px; line-height: 36px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); }
.sp-metric .v small { font-size: 14px; color: var(--ink-muted); margin-left: 2px; }
.sp-metric .bar { height: 4px; border-radius: var(--radius-pill); background: var(--surface-200); margin-top: var(--space-2); overflow: hidden; }
.sp-metric .bar i { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .6s; }
.sp-metric .bar i.solar { background: var(--solar); }
.sp-metric .bar i.water { background: var(--water); }
.sp-telemetry-foot { display: flex; justify-content: space-between; padding: var(--space-3) var(--space-6); background: var(--surface-100); }
.sp-spark { width: 100%; height: 40px; }
.sp-spark path { fill: none; stroke: var(--signal); stroke-width: 2; }

/* ---------- Project card ---------- */
.sp-project { display: flex; flex-direction: column; gap: var(--space-4); height: 100%; }
.sp-project-media { aspect-ratio: 16 / 10; border-radius: var(--radius-sm); background: var(--surface-200); overflow: hidden; display: grid; place-items: center; color: var(--ink-muted); }
.sp-project-media svg { width: 100%; height: 100%; }
.sp-project p { margin: 0; color: var(--ink); font-size: 15px; line-height: 25px; }
.sp-project .sp-row { margin-top: auto; }

/* ---------- Quote ---------- */
.sp-quote { margin: 0; padding: var(--space-12) 0; text-align: left; }
.sp-quote p { font-family: var(--font-display); font-size: 32px; line-height: 46px; font-weight: 500; margin: 0; max-width: 24ch; }
.sp-quote p::before { content: "“"; color: var(--brand); }
.sp-quote p::after { content: "”"; color: var(--brand); }
.sp-quote cite { display: block; margin-top: var(--space-4); font-style: normal; font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); }

/* ---------- Skill board ---------- */
.sp-skill { display: grid; grid-template-columns: 140px 1fr auto; align-items: center; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.sp-skill:last-child { border-bottom: 0; }
.sp-skill .name { font-weight: 600; }
.sp-skill .meter { display: flex; gap: 3px; }
.sp-skill .meter i { flex: 1; height: 8px; border-radius: 2px; background: var(--surface-200); }
.sp-skill .meter i.on { background: var(--water); }
.sp-skill .meter.ag i.on { background: var(--brand); }

/* ---------- Spec table ---------- */
.sp-spec { width: 100%; border-collapse: collapse; font-size: 14px; }
.sp-spec th, .sp-spec td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; }
.sp-spec th { font-family: var(--font-mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); width: 38%; }
.sp-spec td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Feature (IoT deep dive) ---------- */
.sp-feature { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-12); align-items: start; }
.sp-feature.flip > :first-child { order: 2; }
.sp-figure { background: var(--surface-100); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); }
.sp-checks { list-style: none; padding: 0; margin: var(--space-6) 0; display: grid; gap: var(--space-3); }
.sp-checks li { display: grid; grid-template-columns: 24px 1fr; gap: var(--space-2); }
.sp-checks li::before { content: ""; width: 18px; height: 18px; margin-top: 5px; border-radius: var(--radius-xs); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
@media (max-width: 860px) { .sp-feature { grid-template-columns: 1fr; } .sp-feature.flip > :first-child { order: 0; } }

/* ---------- Diagram (SVG classes) ---------- */
.d-node { fill: var(--surface-000); stroke: var(--line-strong); stroke-width: 1.5; }
.d-node.it { fill: var(--water-tint); stroke: var(--water); }
.d-node.ag { fill: var(--brand-tint); stroke: var(--brand); }
.d-node.solar { fill: var(--solar); stroke: var(--solar); }
.d-link { stroke: var(--line-strong); stroke-width: 1.5; fill: none; }
.d-link.it { stroke: var(--water); stroke-dasharray: 6 5; }
.d-link.ag { stroke: var(--brand); }
.d-link.power { stroke: var(--solar-text); stroke-width: 2.5; }
.d-text { fill: var(--ink); font-family: var(--font-mono); font-size: 12px; }
.d-text.b { font-family: var(--font-sans); font-weight: 600; font-size: 13px; }
.d-text.m { fill: var(--ink-muted); font-size: 11px; }
.d-text.on-solar { fill: var(--on-solar); }

/* ---------- Article card / Blog ---------- */
.sp-article { display: grid; gap: var(--space-2); padding: var(--space-6) 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.sp-article:hover h3 { color: var(--brand); }
.sp-article .meta { display: flex; gap: var(--space-3); font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.sp-article .cat { color: var(--soil); font-weight: 600; }
.sp-article p { margin: 0; color: var(--ink); }
.sp-prose { max-width: var(--measure); font-size: 18px; line-height: 32px; }
.sp-prose p { margin: 0 0 1.2em; }
.sp-prose h2 { font-family: var(--font-display); font-size: 24px; line-height: 34px; margin: 1.6em 0 .5em; }
.sp-prose blockquote { margin: 1.4em 0; padding: 0 0 0 var(--space-6); border-left: 2px solid var(--soil); color: var(--ink-muted); font-style: italic; }
.sp-prose code { font-family: var(--font-mono); font-size: .85em; background: var(--surface-200); padding: 1px 6px; border-radius: var(--radius-xs); }

/* ---------- Download ---------- */
.sp-download { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: var(--space-4); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-000); }
.sp-download .file { width: 48px; height: 56px; border-radius: var(--radius-xs); background: var(--surface-200); display: grid; place-items: end center; padding-bottom: 6px; font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--soil); border: 1px solid var(--line); }
.sp-download .t { font-weight: 600; }

/* ---------- Energy flow ---------- */
.sp-energy { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: var(--space-4); }
.sp-energy .cell { padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-000); border: 1px solid var(--line); }
.sp-energy .cell.hot { background: var(--solar); color: var(--on-solar); border-color: transparent; }
.sp-energy .cell.hot .k, .sp-energy .cell.hot .v, .sp-energy .cell.hot .v small { color: var(--on-solar); }
@media (max-width: 860px) { .sp-energy { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* ---------- HUD (tele-op cockpit; dark in every theme) ---------- */
.sp-hud { background: var(--hud-ground); color: var(--hud-ink); border-radius: var(--radius-lg); padding: var(--space-4); font-family: var(--font-mono); }
.sp-hud-top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: 0 var(--space-2) var(--space-3); border-bottom: 1px solid var(--hud-grid); font-size: 12px; letter-spacing: .06em; }
.sp-hud-body { display: grid; grid-template-columns: 220px 1fr 220px; gap: var(--space-4); padding-top: var(--space-4); }
.sp-hud-panel { border: 1px solid var(--hud-grid); border-radius: var(--radius-md); padding: var(--space-4); }
.sp-hud-panel .k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.sp-hud-panel .v { font-size: 28px; line-height: 36px; font-weight: 500; font-variant-numeric: tabular-nums; }
.sp-hud .ok { color: var(--lime); }
.sp-hud svg .grid { stroke: var(--hud-grid); stroke-width: 1; }
.sp-hud svg .path { stroke: var(--lime); stroke-width: 2; fill: none; }
.sp-hud svg .plan { stroke: var(--hud-ink); stroke-width: 1.5; stroke-dasharray: 4 4; fill: none; opacity: .7; }
.sp-hud svg .wp { fill: var(--hud-ground); stroke: var(--hud-ink); stroke-width: 1.5; }
.sp-hud svg .wp.done { fill: var(--lime); stroke: var(--lime); }
.sp-hud svg .me { fill: var(--solar); }
.sp-hud svg text { fill: var(--hud-ink); font-family: var(--font-mono); font-size: 10px; }
.sp-gauge .track { stroke: var(--hud-grid); stroke-width: 10; fill: none; stroke-linecap: round; }
.sp-gauge .val { stroke: var(--lime); stroke-width: 10; fill: none; stroke-linecap: round; transition: stroke-dashoffset .4s; }
.sp-estop { width: 100%; aspect-ratio: 1; max-width: 140px; margin: var(--space-3) auto 0; border-radius: var(--radius-pill); border: 6px solid var(--solar); background: var(--danger); color: var(--on-danger); font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 20px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 0 0 4px var(--hud-ground), 0 0 0 6px var(--solar); }
.sp-estop[aria-pressed="true"] { transform: scale(.96); filter: brightness(.85); }
@media (max-width: 960px) { .sp-hud-body { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.sp-footer { background: var(--canopy); color: var(--on-canopy-muted); padding: var(--space-12) 0 var(--space-8); font-size: 14px; }
.sp-footer a { color: var(--on-canopy); text-decoration: none; }
.sp-footer a:hover { text-decoration: underline; }
.sp-footer .sp-logo { color: var(--on-canopy); }
.sp-footer .sp-logo b { color: var(--ember-bright); }
.sp-footer .sp-logo small { color: var(--on-canopy-muted); }
.sp-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--space-8); }
.sp-footer ul { list-style: none; padding: 0; margin: var(--space-3) 0 0; display: grid; gap: var(--space-2); }
.sp-footer h4 { margin: 0; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--on-canopy); font-weight: 600; }
.sp-footer .base { margin-top: var(--space-12); padding-top: var(--space-4); border-top: 1px solid rgba(255,255,255,.14); display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); font-family: var(--font-mono); font-size: 12px; }
@media (max-width: 860px) { .sp-footer .cols { grid-template-columns: 1fr 1fr; } }


/* ---- site shell ---- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface-000); }
.sp-container { padding-left: max(var(--space-6), env(safe-area-inset-left, 0px)); padding-right: max(var(--space-6), env(safe-area-inset-right, 0px)); }
@media (max-width: 860px) { .sp-container { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); } }
.sp-nav { top: env(safe-area-inset-top, 0px); }
.sp-nav-links { margin-left: auto; }
.sp-nav-tools { display: flex; gap: var(--space-2); margin-left: var(--space-2); }
.sp-icon-btn { padding: 0; width: 44px; }
.sp-nav-toggle { margin-left: 0; }
.sp-drawer { border-top: 1px solid var(--line); background: var(--surface-000); padding: var(--space-2) max(16px, env(safe-area-inset-right, 0px)) var(--space-4) max(16px, env(safe-area-inset-left, 0px)); }
.sp-drawer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sp-drawer a { display: block; padding: var(--space-3); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 500; }
.sp-drawer a[aria-current="page"] { background: var(--brand-tint); color: var(--brand); }
@media (min-width: 1081px) { .sp-drawer { display: none !important; } }
h1, h2, h3, .sp-h1, .sp-h2, .sp-h3 { text-wrap: balance; }
main { min-height: 60vh; }
main { animation: sp-in .35s ease-out; }
@keyframes sp-in { from { opacity: .4; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { main { animation: none; } }
.sp-figure svg, .sp-hud svg { max-width: 100%; height: auto; }
.sp-pipe { overflow-x: auto; }
.sp-pipe svg { min-width: 760px; }
.sp-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--surface-000); padding: var(--space-3) var(--space-6); border-radius: var(--radius-sm); font-size: 14px; box-shadow: var(--shadow-2); z-index: 30; max-width: calc(100vw - 32px); }
.sp-grid > *, .sp-feature > *, .sp-hud-body > * { min-width: 0; }
@media (max-width: 860px) {
  .sp-hero-split { grid-template-columns: 1fr; }
  [style*="grid-template-columns:1fr 1fr 1.1fr"], [style*="grid-template-columns:1fr 2fr"], [style*="grid-template-columns:1.3fr 1fr"], [style*="grid-template-columns:1fr 1.2fr"], [style*="grid-template-columns:minmax(0,1fr) 300px"] { grid-template-columns: minmax(0,1fr) !important; gap: 32px !important; }
  .sp-skill { grid-template-columns: 96px 1fr; }
  .sp-skill .sp-caption { grid-column: 1 / -1; }
  .sp-quote p { font-size: 24px; line-height: 36px; }
  .sp-download { grid-template-columns: 40px 1fr; }
  .sp-download .sp-btn { grid-column: 1 / -1; }
  .sp-hud-top { flex-wrap: wrap; }
}


/* ---------- Blog post ---------- */
.sp-post-head { padding-bottom: var(--space-8); border-bottom: 1px solid var(--line); }
.sp-post-wrap { max-width: 800px; }
.sp-post-head .sp-h-l { margin-top: var(--space-4); }
.sp-post-head .sp-lead { margin-top: var(--space-4); }
.sp-crumbs { display: flex; gap: var(--space-2); font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); }
.sp-crumbs a { color: var(--soil); text-decoration: none; font-weight: 600; }
.sp-crumbs a:hover { text-decoration: underline; }
.sp-post-meta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); font-family: var(--font-mono); font-size: 13px; color: var(--ink-muted); }
.sp-post-meta .cat { color: var(--soil); font-weight: 600; }
.sp-post .sp-prose { padding-top: var(--space-12); }
.sp-prose ul { margin: 0 0 1.2em; padding-left: 1.2em; display: grid; gap: .5em; }
.sp-prose li::marker { color: var(--brand); }
.sp-prose a { color: var(--brand); font-weight: 600; }
.sp-prose strong { font-weight: 600; }
.sp-formula { margin: 1.4em 0; padding: var(--space-6); border-radius: var(--radius-md); background: var(--surface-100); border: 1px solid var(--line); font-family: var(--font-mono); font-size: 17px; line-height: 30px; display: grid; gap: var(--space-2); overflow-x: auto; }
.sp-formula .k { color: var(--brand); font-weight: 600; }
.sp-formula sup { font-size: .72em; }
.sp-table-wrap { overflow-x: auto; margin: 1.2em 0 1.6em; }
.sp-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 24px; }
.sp-table th { text-align: left; font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.sp-table td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sp-table td:not(:first-child) { font-family: var(--font-mono); font-size: 14px; }
.sp-code { margin: 1.4em 0; border-radius: var(--radius-md); overflow: hidden; background: var(--hud-ground); }
.sp-code-head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--hud-grid); font-family: var(--font-mono); font-size: 12px; color: var(--hud-ink); }
.sp-copy { font: inherit; color: var(--hud-ink); background: transparent; border: 1px solid var(--hud-grid); border-radius: var(--radius-xs); padding: 4px 10px; min-height: 32px; cursor: pointer; }
.sp-copy:hover { border-color: var(--lime); color: var(--lime); }
.sp-code pre { margin: 0; padding: var(--space-4); overflow-x: auto; font-size: 13px; line-height: 21px; }
.sp-prose .sp-code code { background: none; padding: 0; border-radius: 0; color: var(--hud-ink); font-size: 13px; line-height: 21px; tab-size: 2; }
.sp-post-foot { padding: var(--space-8) 0 var(--space-16); border-top: 1px solid var(--line); margin-top: var(--space-8); display: grid; gap: var(--space-6); }
.sp-post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.sp-post-nav .sp-card { display: grid; gap: var(--space-1); }
.sp-post-nav .sp-card:last-child { text-align: right; }
@media (max-width: 860px) { .sp-post-nav { grid-template-columns: 1fr; } .sp-post-nav .sp-card:last-child { text-align: left; } .sp-formula { font-size: 15px; } }
