/*
 * One stylesheet, no framework. The palette is a quiet treatment room: warm
 * paper, a deep teal for anything you can press, and the three tissue colours
 * the body model uses — muscle red, tendon ochre, ligament blue — reused
 * everywhere those words appear, so a chip on a drill card and a shape on the
 * model read as the same thing without a legend.
 */
:root {
  color-scheme: light dark;
  --ink: #1c2430;
  --bg: #f7f5f0;
  --panel: #edf1ee;
  --line: #d9ded8;
  --muted: #5d6874;
  --accent: #0f6f63;
  --accent-ink: #ffffff;
  --muscle: #b9473b;
  --tendon: #b39a5b;
  --ligament: #3f78ad;
  --bone: #8a8577;
  --good: #1d7a4c;
  --warn: #9a6a00;
  --bad: #b3372b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9ece8; --bg: #12171c; --panel: #1b2229; --line: #2c353e; --muted: #9aa5ae;
    --accent: #4cc2ae; --accent-ink: #062520; --muscle: #e0786b; --tendon: #d9c48e;
    --ligament: #7fb0dd; --bone: #b8b2a3; --good: #5dcf92; --warn: #e2b44b; --bad: #ff8d80;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main { max-width: 860px; margin: 0 auto; padding: 30px 22px 72px; }
main.wide { max-width: 1180px; }
h1 { font-size: clamp(30px, 6vw, 46px); letter-spacing: -0.03em; line-height: 1.08; margin: 0 0 14px; }
h2 { font-size: clamp(21px, 3.4vw, 27px); letter-spacing: -0.015em; margin: 40px 0 10px; }
h3 { font-size: 17px; margin: 22px 0 6px; }
a { color: var(--accent); }
p { margin: 0 0 14px; }
ul, ol { padding-left: 22px; margin: 0 0 14px; }
li { margin-bottom: 4px; }

.lede { font-size: clamp(17px, 2.4vw, 20px); color: var(--muted); margin-bottom: 24px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
[hidden] { display: none !important; }

/* ── Header and footer, on every page via BaseLayout ─────────────────────── */
.masthead {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  max-width: 1180px; margin: 0 auto; padding: 16px 22px 0;
}
.wordmark { font-weight: 800; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; font-size: 22px; }
.wordmark span { color: var(--accent); }
.masthead nav { display: flex; gap: 4px; flex-wrap: wrap; }
.masthead nav.tabs a {
  padding: 5px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 650;
}
.masthead nav.tabs a:hover { background: var(--panel); }
.masthead nav.tabs a[aria-current] { background: var(--ink); color: var(--bg); }
.masthead nav.more { font-size: 14px; gap: 14px; margin-left: auto; }
.masthead nav.more a { color: var(--muted); }
.masthead nav.more a[aria-current] { color: var(--ink); font-weight: 700; }

.siteftr {
  max-width: 1180px; margin: 0 auto; padding: 24px 22px 44px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 14px;
}
.siteftr .feedback-line { font-size: 15px; color: var(--ink); }
.siteftr .feedback-line a { font-weight: 700; }

/* ── Blocks ──────────────────────────────────────────────────────────────── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin: 18px 0; }
.panel > :last-child { margin-bottom: 0; }
.panel.warning { border-color: var(--warn); }
.panel.warning h2, .panel.warning h3 { margin-top: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; align-items: start; margin: 16px 0; }
@media (max-width: 600px) { .split { grid-template-columns: 1fr; } .split canvas.figure { max-width: 200px; margin: 0 auto; } }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 16px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.card h3 { margin: 0; }
.card p { margin: 0; }
a.card { color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--accent); }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 24px 0; }
.pillars .card .n { font-size: 13px; font-weight: 800; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); text-decoration: none; margin: 0;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--bone); }
.chip.muscle::before { background: var(--muscle); }
.chip.tendon::before { background: var(--tendon); }
.chip.ligament::before { background: var(--ligament); }
.chip.plain::before { display: none; }
a.chip:hover { border-color: var(--accent); }

.tag { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.dose { font-weight: 750; font-variant-numeric: tabular-nums; }

.steps li { margin-bottom: 8px; }

/* ── Forms and buttons ───────────────────────────────────────────────────── */
label { display: block; font-weight: 650; margin: 14px 0 4px; }
label .hint { font-weight: 400; color: var(--muted); font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
textarea { min-height: 130px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
button, .button {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 10px 16px;
  text-decoration: none;
}
button.quiet, .button.quiet { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: .55; cursor: not-allowed; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.error { color: var(--bad); }
.success { color: var(--good); }

/* The 0–10 pain scale: eleven buttons that read as one control. */
.scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; margin: 6px 0 2px; }
.scale button {
  padding: 8px 0; justify-content: center; background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums; border-radius: 8px;
}
.scale button[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.scale-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

/* ── Figures, video and the 3D body ─────────────────────────────────────── */
canvas.figure { width: 100%; aspect-ratio: 3 / 4; max-width: 240px; display: block; background: var(--bg); border-radius: 12px; border: 1px solid var(--line); }
.stage { position: relative; background: #000; border-radius: 14px; overflow: hidden; }
.stage video { width: 100%; display: block; max-height: 70vh; object-fit: contain; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
progress { width: 100%; height: 10px; }

.body-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 860px) { .body-layout { grid-template-columns: 1fr; } }
.viewport { position: relative; width: 100%; height: min(72vh, 680px); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); touch-action: none; }
.viewport canvas { display: block; width: 100%; height: 100%; }
.viewport .overlay { position: absolute; left: 12px; bottom: 10px; right: 12px; font-size: 13px; color: var(--muted); pointer-events: none; }
.structure-list { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: var(--bg); }
.structure-list button {
  width: 100%; justify-content: flex-start; background: transparent; color: var(--ink); font-weight: 500; padding: 6px 8px; border-radius: 8px;
}
.structure-list button[aria-pressed=true] { background: var(--panel); font-weight: 750; }
.structure-list h4 { margin: 10px 8px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.slider { width: 100%; }

table.log { width: 100%; border-collapse: collapse; font-size: 15px; }
table.log th, table.log td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.status { font-weight: 750; }
.status.passed { color: var(--good); }
.status.open { color: var(--muted); }
