:root {
  --panel: #e6eaec;      /* switchgear grey */
  --plate: #f4f6f7;      /* lighter enamel for raised surfaces */
  --ink: #1b2430;
  --steel: #8e99a3;
  --rule: #c9d0d5;
  --live: #1f6f5c;       /* healthy margin */
  --amber: #b7791f;      /* degraded */
  --trip: #c8102e;       /* breaker red */
  --console: #1b2430;    /* ledger + code surfaces stay dark in both themes */
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --measure: 64ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --panel: #161c23; --plate: #1e252e; --ink: #e3e8ec; --steel: #7d8994; --rule: #2e3741;
    --live: #4fb394; --amber: #e0a646; --trip: #ff4d5e; --console: #0d1319;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--panel); color: var(--ink);
  font: 400 17px/1.6 var(--body); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--trip); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--panel); padding: 8px 12px; }
.skip:focus { left: 8px; z-index: 10; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hp { position: absolute; left: -9999px; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.005em; line-height: 1.02; margin: 0; }
h1 { font-size: clamp(44px, 6.4vw, 84px); font-weight: 700; max-width: 14ch; }
h2 { font-size: clamp(34px, 4.2vw, 52px); max-width: 20ch; }
h3 { font-size: 26px; }
p { margin: 0; }

.top, main > section, .foot { padding-inline: max(16px, calc((100vw - 1180px) / 2)); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 22px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 26px/1 var(--display); text-decoration: none; }
.brand-mark { width: 16px; height: 22px; border-radius: 3px; background: var(--ink); position: relative; }
.brand-mark::after { content: ''; position: absolute; left: 4px; right: 4px; top: 4px; height: 7px; border-radius: 1px; background: var(--trip); }
nav { display: flex; gap: 22px; flex-wrap: wrap; font-size: 15px; }
nav a { text-decoration: none; color: var(--ink); opacity: .8; }
nav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
nav .gh { opacity: 1; font-weight: 600; }

.btn {
  display: inline-block; padding: 13px 20px; border-radius: 6px; border: 2px solid var(--ink);
  font: 600 16px/1.2 var(--body); text-decoration: none; color: var(--ink); background: transparent; cursor: pointer;
}
.btn:hover { background: var(--plate); }
.btn.primary { background: var(--ink); color: var(--panel); }
.btn.primary:hover { background: var(--trip); border-color: var(--trip); color: #fff; }
.fine { font-size: 14px; color: var(--steel); margin-top: 18px; max-width: var(--measure); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; padding-block: 48px 88px; }
.lede { font-size: 20px; margin-top: 26px; max-width: 52ch; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.panel {
  margin: 0; background: var(--console); color: #e3e8ec; border-radius: 10px; border: 1px solid var(--rule); padding: 18px 18px 20px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 30px 60px -30px rgba(27,36,48,.55);
  min-height: 430px; position: relative;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; font: 500 13px/1.3 var(--mono); color: #9fb0bd; padding-bottom: 12px; border-bottom: 1px solid #2f3a47; }
.breaker { width: 34px; height: 46px; border-radius: 5px; background: #0f151c; border: 1px solid #3a4654; position: relative; flex: none; }
.lever { position: absolute; left: 6px; right: 6px; height: 18px; top: 5px; border-radius: 3px; background: #4fb394; transition: top .35s cubic-bezier(.5,1.6,.5,1), background .2s; }
.breaker.tripped .lever { top: 21px; background: var(--trip); }
.ledger { width: 100%; border-collapse: collapse; font: 400 14px/1.2 var(--mono); margin-top: 6px; }
.ledger th { text-align: right; font-weight: 500; color: #7d8d9a; padding: 8px 4px; font-size: 12px; }
.ledger th:first-child, .ledger td:first-child { text-align: left; }
.ledger td { text-align: right; padding: 7px 4px; border-bottom: 1px solid #25303b; }
.ledger td:last-child { color: #fff; font-weight: 500; }
.ledger tr.hot td:last-child { color: #e0a646; }
.ledger tr.blocked td { color: #ff4d5e; border-bottom-color: transparent; }
.trip { margin-top: 14px; padding: 12px 14px; border-radius: 6px; background: rgba(200,16,46,.14); border: 1px solid rgba(255,77,94,.45); color: #ffd7dc; font: 500 14px/1.45 var(--body); }
.replay { position: absolute; right: 18px; bottom: -44px; background: none; border: 0; color: var(--ink); font: 500 14px var(--body); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px; }

/* Sections */
main > section:not(.hero) { padding-block: 88px; border-top: 1px solid var(--rule); }
.section-lede { margin-top: 16px; max-width: var(--measure); font-size: 19px; }

.switches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 44px; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--plate); }
.switch { padding: 26px 24px 28px; display: flex; flex-direction: column; gap: 14px; }
.switch + .switch { border-left: 2px solid var(--ink); }
.switch-top { display: flex; justify-content: space-between; align-items: center; }
.state { font: 600 13px/1 var(--body); padding: 5px 10px; border-radius: 99px; background: var(--live); color: #fff; }
.switch p { font-size: 16px; }
.switch code { margin-top: auto; font: 500 14px var(--mono); color: var(--steel); }

.see { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 48px; align-items: center; }
.see-copy p { margin-top: 18px; max-width: 48ch; }
.see img { width: 100%; height: auto; border-radius: 8px; border: 2px solid var(--ink); display: block; }

.calc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 24px; margin-top: 36px; }
.calc label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 500; position: relative; }
.calc input, .calc select {
  font: 500 18px var(--body); color: var(--ink); background: var(--plate); border: 2px solid var(--rule);
  border-radius: 6px; padding: 10px 12px; width: 100%;
}
.calc input:focus, .calc select:focus { border-color: var(--ink); outline: none; }
.unit { display: none; }
.verdict { margin-top: 32px; display: grid; grid-template-columns: auto 1fr; gap: 12px 28px; align-items: baseline; padding: 26px 28px; border-radius: 8px; background: var(--plate); border-left: 8px solid var(--live); }
.verdict.warn { border-left-color: var(--amber); }
.verdict.bad { border-left-color: var(--trip); }
.verdict .big { font: 700 clamp(48px, 7vw, 76px)/1 var(--display); }
.verdict.bad .big { color: var(--trip); }
.verdict.warn .big { color: var(--amber); }
.verdict .what { font-size: 18px; max-width: 58ch; }

.steps { list-style: none; counter-reset: s; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.steps li { counter-increment: s; }
.steps h3::before { content: counter(s); display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 10px; border-radius: 50%; background: var(--ink); color: var(--panel); font-size: 18px; vertical-align: 3px; }
pre { margin: 16px 0 0; background: var(--console); border: 1px solid var(--rule); color: #dbe3e9; border-radius: 8px; padding: 16px 18px; overflow-x: auto; font: 400 14px/1.6 var(--mono); }

.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 40px; align-items: stretch; }
.tier { background: var(--plate); border: 2px solid var(--rule); border-radius: 8px; padding: 26px 24px; display: flex; flex-direction: column; gap: 14px; }
.tier.feature { border-color: var(--ink); }
.tier .price { font: 700 36px/1 var(--display); }
.tier p:not(.price):not(.form-msg) { font-size: 16px; }
.tier .btn { margin-top: auto; align-self: flex-start; }
.waitlist { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.waitlist input[type=email] { font: 400 16px var(--body); padding: 12px; border-radius: 6px; border: 2px solid var(--rule); background: var(--panel); color: var(--ink); }
.waitlist input[type=email]:focus { border-color: var(--ink); outline: none; }
.waitlist .btn { margin-top: 0; }
.form-msg { font-size: 14px; min-height: 1.4em; }
.form-msg.ok { color: var(--live); }
.form-msg.err { color: var(--trip); }

.foot { border-top: 1px solid var(--rule); padding-block: 36px 48px; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; font-size: 15px; color: var(--steel); }
.foot a { margin-left: 18px; }
.foot a:first-child { margin-left: 0; }

@media (max-width: 960px) {
  .hero, .see { grid-template-columns: 1fr; gap: 40px; }
  .switches, .steps, .tiers { grid-template-columns: 1fr; }
  .switch + .switch { border-left: 0; border-top: 2px solid var(--ink); }
  .calc-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .calc-grid { grid-template-columns: 1fr; }
  .verdict { grid-template-columns: 1fr; }
  .panel { padding: 14px 12px 16px; }
  .ledger { font-size: 12.5px; }
  main > section:not(.hero) { padding-block: 64px; }
}
