/* Shared styles. Colors are tokens so light/dark both work. */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1d1f23;
  --muted: #5b616b;
  --border: #d9dbdf;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --code-bg: #f1f2f4;
  --note-bg: #eef4ff;
  --warn-bg: #fff6e0;
  --warn-text: #6b4e00;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1d2024;
    --text: #e6e7e9;
    --muted: #a0a6b0;
    --border: #343840;
    --accent: #4c8dff;
    --accent-text: #0b0d10;
    --code-bg: #22262b;
    --note-bg: #1b2433;
    --warn-bg: #2e2714;
    --warn-text: #f0d48a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
}
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
code, pre, textarea, .mono { font-family: var(--mono); font-size: 14px; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* Header and nav */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 15px; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); text-decoration: underline; }

main { padding: 24px 0 40px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 21px; margin: 32px 0 8px; }
h3 { font-size: 17px; margin: 20px 0 6px; }
.lede { color: var(--muted); margin: 0 0 20px; max-width: 70ch; }
.prose { max-width: 72ch; }

/* Tool cards on the home page */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 0; list-style: none; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card h2 { font-size: 18px; margin: 0 0 6px; }
.card p { margin: 0; color: var(--muted); }

/* Tool layout */
.tool { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tool.stack { grid-template-columns: 1fr; }
@media (max-width: 760px) { .tool { grid-template-columns: 1fr; } }
.panel { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.panel label { font-weight: 600; font-size: 14px; }
textarea {
  width: 100%;
  min-height: 300px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
}
textarea[readonly] { background: var(--code-bg); }

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 16px;
  font-size: 14px;
}
.options label { display: inline-flex; align-items: center; gap: 6px; }
.options input[type="text"], .options input[type="number"], .options select {
  font: inherit;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.options input[type="text"] { width: 140px; }
.options input[type="number"] { width: 80px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button {
  font: inherit;
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.status { font-size: 14px; color: var(--muted); min-height: 1.4em; }
.status.warn { color: var(--warn-text); background: var(--warn-bg); padding: 6px 10px; border-radius: 6px; }

/* Notes and the workbook promo box */
.note { background: var(--note-bg); border-radius: var(--radius); padding: 14px 16px; margin: 24px 0; }
.note p { margin: 0 0 6px; }
.note p:last-child { margin-bottom: 0; }
.promo { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 16px; margin: 32px 0 8px; }
.promo h2 { margin-top: 0; font-size: 18px; }
.promo p { margin: 0 0 10px; max-width: 72ch; }
.promo .links { display: flex; flex-wrap: wrap; gap: 8px 20px; font-weight: 600; }

details { border-top: 1px solid var(--border); padding: 10px 0; max-width: 72ch; }
details summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 0; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; padding: 20px 0 32px; }
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt { margin-top: 12px; }
.options label { flex-wrap: wrap; max-width: 100%; }
.options select, .options input[type="text"] { max-width: 100%; }
