/* SPDX-License-Identifier: MIT */
/* dark first; light when the reader's system asks for it, or the theme they picked */
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: optional; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: optional; }
@font-face { font-family: "Geist"; src: url("fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: optional; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: optional; }

:root, :root[data-theme="dark"] {
  --paper: #0b0c0e;
  --panel: #121317;
  --ink: #ecEAE6;
  --ink-2: #c3c0ba;
  --muted: #97948d;
  --line: #212329;
  --line-2: #2e3138;
  --power: #6cc08f;          /* in sync, passed: power flow as TIA Portal's monitoring shows it */
  --power-soft: rgba(108, 192, 143, 0.14);
  --warm: #e3b86a;           /* a change on its way, the pre-release notice */
  --warm-soft: rgba(227, 184, 106, 0.16);
  --bad: #ec7d66;
  --bad-soft: rgba(226, 114, 91, 0.15);
  --code-k: #d9a47a;
  --code-t: #9db4dc;
  --code-n: #e3b86a;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --gutter: clamp(20px, 4vw, 48px);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --paper: #f5f3ef; --panel: #fbfaf8; --ink: #17181b; --ink-2: #3a3b3f; --muted: #66655f; --line: #dfdbd3; --line-2: #cfc9bf;
    --power: #24774d; --power-soft: rgba(46, 138, 91, 0.12); --warm: #8a5d12; --warm-soft: rgba(168, 116, 28, 0.14);
    --bad: #b03f28; --bad-soft: rgba(184, 71, 47, 0.1); --code-k: #7a4b2a; --code-t: #3f5a86; --code-n: #8a5a12;
  }
}
:root[data-theme="light"] {
  --paper: #f5f3ef; --panel: #fbfaf8; --ink: #17181b; --ink-2: #3a3b3f; --muted: #66655f; --line: #dfdbd3; --line-2: #cfc9bf;
  --power: #24774d; --power-soft: rgba(46, 138, 91, 0.12); --warm: #8a5d12; --warm-soft: rgba(168, 116, 28, 0.14);
  --bad: #b03f28; --bad-soft: rgba(184, 71, 47, 0.1); --code-k: #7a4b2a; --code-t: #3f5a86; --code-n: #8a5a12;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 18px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: clamp(52px, 7.6vw, 96px); line-height: 1; }
h1 em { display: block; color: var(--power); }
h2 { font-size: clamp(34px, 4vw, 48px); line-height: 1.08; margin-bottom: 8px; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--power); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 2; padding: 8px 14px; background: var(--ink); color: var(--paper); border-radius: 8px; }

.wrap { max-width: calc(1120px + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
main > section { margin-top: 104px; }
main > section > p:not([class]) { color: var(--ink-2); max-width: 46ch; }
main > section > p + p, main > section > .plans + p { margin-top: 14px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; }
.mark { width: 22px; height: 22px; fill: currentColor; }
.top nav { display: flex; gap: 28px; font-size: 15px; color: var(--ink-2); }
.top nav a { text-decoration: none; }
.top nav a:hover { color: var(--ink); }

/* hero */
.hero { margin-top: 64px; }
.lead { margin-top: 22px; font-size: 21px; color: var(--ink-2); max-width: 46ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.tools { margin-top: 18px; font: 400 13px/1.6 var(--mono); color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line-2); border-radius: 10px; background: transparent; color: var(--ink);
  font: 500 15px/1 var(--sans); text-decoration: none; cursor: pointer; transition: border-color 150ms, background 150ms;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--ink-2); }

/* demonstration frames: one border, no nested boxes */
.frame { margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.hero .frame { margin-top: 56px; }
#play .frame { margin-top: 32px; max-width: 900px; }
.panes { display: grid; grid-template-columns: 1fr 1fr; }
.pane + .pane { border-left: 1px solid var(--line); }
.label { padding: 11px 18px; border-bottom: 1px solid var(--line); font: 400 12px/1.4 var(--mono); color: var(--muted); }
pre { margin: 0; padding: 16px 18px 18px; font: 400 14px/1.75 var(--mono); color: var(--ink-2); overflow-x: auto; }
pre code { font: inherit; }
.v { color: var(--ink); }
.k { color: var(--code-k); }
.n { color: var(--code-n); }
.y { color: var(--code-t); }
.note { font-size: 12px; color: var(--muted); }

/* sync: the changed number lights up where it changes */
.sync pre { font-size: 15px; }
[data-num] { border-radius: 4px; padding: 1px 3px; margin: 0 -3px; transition: background 160ms, color 160ms; }
[data-num].lit { background: var(--warm-soft); color: var(--warm); }
.sync figcaption { display: flex; align-items: center; gap: 16px; padding: 10px 12px 10px 18px; border-top: 1px solid var(--line); min-height: 52px; }
.state { display: inline-flex; align-items: center; gap: 8px; font: 400 13px/1 var(--mono); color: var(--ink-2); }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--power); transition: background 160ms; }
.sync[data-busy] .state::before { background: var(--warm); }
.sync .note { margin-left: auto; }
.pause { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: transparent; color: var(--ink-2); font: 500 13px/1 var(--sans); cursor: pointer; }
.proof { margin-top: 16px; font-size: 14px; color: var(--muted); }
.proof a { color: var(--ink-2); }

/* editor */
.split { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: center; }
.split p { color: var(--ink-2); }
.editor pre { padding-bottom: 6px; }
.ln { color: var(--muted); margin-right: 18px; user-select: none; }
.squiggle { text-decoration: underline wavy var(--bad); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.diag { display: flex; align-items: center; gap: 8px; padding: 0 18px 0 calc(18px + 4ch); font: 400 13px/1.6 var(--mono); color: var(--bad); }
.diag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); }
.editor figcaption { padding: 14px 18px 12px; }

/* test */
.expr { border-radius: 4px; padding: 1px 3px; margin: 0 -3px; transition: background 160ms; }
.test[data-broken="true"] .expr { background: var(--bad-soft); }
.run { display: flex; align-items: center; gap: 18px; padding: 12px 18px; border-top: 1px solid var(--line); min-height: 68px; }
.toggle { min-width: 7.5em; }
.result { font: 400 14px/1.5 var(--mono); color: var(--ink-2); }
.result[data-kind="pass"] { color: var(--power); }
.result[data-kind="fail"] { color: var(--bad); }

/* pricing */
.notice { display: inline-block; margin-top: 22px; padding: 4px 10px; border: 1px solid var(--warm-soft); border-radius: 6px; background: var(--warm-soft); font: 400 13px/1.5 var(--mono); color: var(--warm); }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; margin-top: 36px; border-top: 1px solid var(--line); }
.plan { display: grid; grid-template-rows: auto auto auto 1fr auto; justify-items: start; gap: 6px; padding-top: 24px; }
.plan h3 { margin: 0; font: 500 15px/1.4 var(--sans); color: var(--muted); }
.price { font: 400 52px/1 var(--serif); }
.fine { font-size: 13px; color: var(--muted); }
.plan p:not([class]) { margin: 12px 0 18px; color: var(--ink-2); font-size: 16px; }

/* footer */
.foot { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin-top: 96px; padding-top: 28px; padding-bottom: 40px; font-size: 14px; color: var(--muted); }
.foot::before { content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); height: 1px; background: var(--line); }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot nav a { text-decoration: none; }
.foot nav a:hover { color: var(--ink); }
.foot .brand { color: var(--ink); font-size: 15px; }
.theme { display: inline-flex; align-items: center; gap: 8px; }
.theme select { min-height: 44px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
.foot .fine { margin-left: auto; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  main > section { margin-top: 64px; }
  .hero { margin-top: 36px; }
  .lead { font-size: 18px; }
  .hero .frame { margin-top: 40px; }
  .panes, .split, .plans { grid-template-columns: 1fr; }
  .split { gap: 24px; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--line); }
  pre, .sync pre { font-size: 13px; }
  .plan + .plan { margin-top: 28px; border-top: 1px solid var(--line); }
  .foot { margin-top: 64px; }
  .foot .fine { margin-left: 0; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
