/* Shared by every page. Colors are tokens on :root, with a dark theme. */

:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --text: #1d1d1b;
  --muted: #57574f;
  --line: #e2e1dc;
  --accent: #2f6fd6;
  --good: #1f8a4c;
  --warn: #b26b00;
  --bad: #c0392b;
  --dot: #9aa3b2;
  --fast: #2f6fd6;
  --fast2: #c2410c;
  --hl: #eef3fc;
  --on-accent: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413;
    --panel: #1e1e1c;
    --text: #ecebe6;
    --muted: #b3b2aa;
    --line: #34332f;
    --accent: #6ea0f0;
    --good: #4cc47f;
    --warn: #e0a040;
    --bad: #ef6b5b;
    --dot: #5d6470;
    --fast: #6ea0f0;
    --fast2: #f08a4b;
    --hl: #232a36;
    --on-accent: #141413;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.55 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
h1 {
  font-size: 24px;
  margin: 0 0 4px;
}
.sub {
  color: var(--muted);
  margin: 0 0 20px;
}
section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
h2 {
  font-size: 17px;
  margin: 0 0 12px;
}
h3 {
  font-size: 15px;
  margin: 14px 0 4px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}
label {
  color: var(--muted);
  font-size: 14px;
  display: flex;
  gap: 6px;
  align-items: center;
}
select,
input {
  font: inherit;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
input[type="number"] {
  width: 90px;
}
button {
  font: inherit;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat .k {
  color: var(--muted);
  font-size: 13px;
}
.stat .v {
  font-variant-numeric: tabular-nums;
  font-size: 18px;
}
.big {
  font-size: 34px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.note {
  color: var(--muted);
  font-size: 14px;
}
.ok {
  color: var(--good);
}
.warn {
  color: var(--warn);
}
.bad {
  color: var(--bad);
}
canvas {
  width: 100%;
  height: 220px;
  display: block;
}
pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font:
    13px/1.5 ui-monospace,
    Menlo,
    monospace;
  color: var(--muted);
  white-space: pre-wrap;
}
pre.cmd {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  max-height: none;
  /* long commands wrap; Copy still copies them as typed */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
code {
  font:
    14px ui-monospace,
    Menlo,
    monospace;
}
ul,
ol {
  margin: 6px 0 0;
  padding-left: 20px;
}
a {
  color: var(--accent);
}
a.back {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 14px;
  text-decoration: none;
}

/* stepped pages (Flipper crystal): main[data-state] shows the parts of the flow for that step */
.steps {
  display: flex;
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
}
.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.steps span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.steps .current {
  color: var(--text);
}
.steps .current span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.steps .done span {
  background: var(--good);
  border-color: var(--good);
  color: var(--on-accent);
}
.only-connect,
.only-ready,
.only-run,
.only-done,
.run-done {
  display: none;
}
main[data-state="connect"] .only-connect,
main[data-state="ready"] .only-ready,
main[data-state="run"] .only-run,
main[data-state="done"] .only-done {
  display: block;
}
main[data-state="run"] .run-done,
main[data-state="done"] .run-done {
  display: grid;
}
main:not([data-state="run"]) .not-run {
  display: block;
}
.not-run {
  display: none;
}
main[data-state="run"] .row.only-run,
main[data-state="done"] .row.only-done {
  display: flex;
}
.flow h2 {
  margin-bottom: 6px;
}
.flow .phase::first-letter {
  text-transform: uppercase;
}
.flow .note {
  margin: 0 0 4px;
}
.flow .gap-top {
  margin-top: 14px;
}
.flow .aside {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.row.spread {
  justify-content: space-between;
  align-items: flex-start;
}
.gap-top {
  margin-top: 14px;
}
.title {
  font-size: 16px;
  font-weight: 600;
}
.small {
  font-size: 14px;
}
.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
  margin: 10px 0 14px;
}
.bar div {
  height: 100%;
  width: 0;
  background: var(--accent);
}
details.options {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}
details.options summary {
  cursor: pointer;
}
details.options label {
  margin-top: 8px;
}
details.fold {
  border-top: 1px solid var(--line);
  padding: 4px 0;
}
details.fold:last-of-type {
  border-bottom: 1px solid var(--line);
}
details.fold > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 2px;
}
details.fold > summary::-webkit-details-marker {
  display: none;
}
details.fold > summary::after {
  content: "›";
  color: var(--muted);
  font-size: 18px;
  transform: rotate(90deg);
  transition: transform 0.15s;
}
details.fold[open] > summary::after {
  transform: rotate(-90deg);
}
details.fold > summary h2 {
  margin: 0;
}
details.fold > :not(summary) {
  margin-bottom: 14px;
}
.plots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 16px;
  margin-top: 14px;
}
figure {
  margin: 0;
}
figure h3 {
  margin-top: 0;
}
.plothead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.plothead h3 {
  margin: 0;
}
button.iconbtn {
  padding: 4px;
  line-height: 0;
  border-color: transparent;
  background: none;
  color: var(--muted);
}
button.iconbtn:hover {
  color: var(--text);
  border-color: var(--line);
}
/* an enlarged plot fills the window */
dialog.plotzoom {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 12px 16px 16px;
  border: 0;
  background: var(--panel);
  color: var(--text);
}
dialog.plotzoom canvas {
  height: calc(100dvh - 72px);
}
html:has(dialog.plotzoom[open]) {
  overflow: hidden;
}
details.about {
  margin-top: 6px;
  font-size: 14px;
}
details.about summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 13px;
}
details.about p {
  margin: 6px 0 0;
}
/* a "What is this?" toggle on the same line as other controls; the page shows and hides the text it names */
button.disclose {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 14px;
}
button.disclose::before {
  content: "▶";
  display: inline-block;
  width: 1.1em;
  font-size: 0.75em;
}
button.disclose[aria-expanded="true"]::before {
  content: "▼";
}
.disclosed,
.flow .disclosed {
  margin: 6px 0 0;
}

/* tables (self-trim) */
.tablewrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
th,
td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
}
tr.active td {
  background: var(--hl);
}
td.dim {
  color: var(--muted);
}
li {
  margin: 2px 0;
}

/* home page */
.home main {
  max-width: 720px;
}
.home h2 {
  font-size: 16px;
  margin: 28px 0 0;
}
.home p {
  color: var(--muted);
}
.tool {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
  text-decoration: none;
  color: var(--text);
}
.tool b {
  color: var(--accent);
}
.tool span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* command line tabs, copyable commands and the options list */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 12px 0 10px;
}
.tabs button {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  padding: 6px 12px;
  margin-bottom: -1px;
}
.tabs button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.cmdbox {
  position: relative;
}
.cmdbox pre.cmd {
  padding-right: 76px;
}
.cmdbox button.copy {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 3px 10px;
  font-size: 13px;
}
dl.options-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 6px 0 0;
}
dl.options-list dt {
  margin: 0;
}
dl.options-list dd {
  margin: 0;
  color: var(--muted);
}
@media (max-width: 520px) {
  dl.options-list {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  dl.options-list dd {
    margin-bottom: 8px;
  }
}

/* callouts: a short notice above or inside a section */
.callout {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 14px;
}
.callout.caution {
  border-left-color: var(--bad);
}
.callout p {
  margin: 0 0 6px;
}
.callout p:last-child {
  margin-bottom: 0;
}
