/*
 * One stylesheet, no framework. A fitting-room palette: warm paper, a near-black
 * ink, and one track orange for anything you can press. Flags use one colour
 * each and always sit beside a word, never on their own. Headings are heavy and
 * tight; everything else is the system sans, big enough to read on a phone
 * propped beside a treadmill.
 */
:root {
  color-scheme: light dark;
  --bg: #f7f5f1;
  --surface: #ffffff;
  --panel: #eeebe4;
  --line: #dcd7cc;
  --ink: #1c1a16;
  --muted: #625d53;
  --accent: #b9481a;
  --accent-soft: #f8e4d8;
  --accent-ink: #ffffff;
  --green: #1f7f45;
  --green-soft: #e0f1e6;
  --amber: #a86f00;
  --amber-soft: #fbefd5;
  --red: #bf3227;
  --red-soft: #f8e1de;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f; --surface: #1d1b17; --panel: #27241e; --line: #3a362d; --ink: #f1ede5;
    --muted: #b2aa9b; --accent: #f08a5d; --accent-soft: #3e2416; --accent-ink: #1c0e06;
    --green: #6fd394; --green-soft: #15301f; --amber: #f0bf4c; --amber-soft: #3a2e10;
    --red: #f2877c; --red-soft: #3d1d1a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

main { max-width: 960px; margin: 0 auto; padding: 28px 20px 80px; }
main.wide { max-width: 1240px; }
h1, h2, h3 { font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; }
h1 { font-size: clamp(32px, 6vw, 54px); margin: 0 0 14px; }
h2 { font-size: clamp(22px, 3.4vw, 30px); margin: 42px 0 12px; }
h3 { font-size: 19px; margin: 22px 0 6px; }
a { color: var(--accent); text-underline-offset: 3px; }
p { margin: 0 0 14px; }
.lede { font-size: 20px; color: var(--muted); max-width: 44em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
[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: 1240px; margin: 0 auto; padding: 16px 20px 0;
}
.wordmark { font-weight: 900; font-size: 26px; letter-spacing: -0.04em; color: var(--ink); text-decoration: none; }
.wordmark span { color: var(--accent); }
.masthead nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.masthead nav.tabs a { padding: 6px 14px; border-radius: 99px; 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(--accent-soft); color: var(--ink); }
.masthead nav.more { margin-left: auto; font-size: 15px; gap: 14px; }
.masthead nav.more a { color: var(--muted); text-decoration: none; }
.masthead nav.more a[aria-current] { color: var(--ink); font-weight: 700; }

.siteftr {
  max-width: 1240px; margin: 0 auto; padding: 24px 20px 46px;
  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: 750; }

/* ── Buttons, forms, panels ──────────────────────────────────────────────── */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 16px/1.2 var(--sans); padding: 13px 22px; border-radius: 99px; border: 0;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; text-align: center;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
button:hover, .button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }
button.quiet, .button.quiet { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
button.small, .button.small { padding: 8px 14px; font-size: 14px; }
button.big, .button.big { padding: 17px 28px; font-size: 18px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }

label { display: block; font-weight: 700; margin: 14px 0 6px; }
label .hint { font-weight: 400; color: var(--muted); font-size: 14px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; align-items: end; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.error { color: var(--red); }
.ok { color: var(--green); }
.note { background: var(--accent-soft); border-radius: 12px; padding: 13px 16px; font-size: 15px; }
.warning { background: var(--amber-soft); border-radius: 12px; padding: 13px 16px; font-size: 15px; }
.refusal { background: var(--red-soft); border-radius: 12px; padding: 13px 16px; font-size: 15px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .two { grid-template-columns: 1fr; } }

/* ── The front page ──────────────────────────────────────────────────────── */
.hero { margin: 12px 0 30px; }
.hero h1 { max-width: 15em; }
.hero .controls { margin-top: 22px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 16px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin-top: 0; }
.card .meta { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 16px 0; counter-reset: step; }
.steps > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.steps > div::before { counter-increment: step; content: counter(step); font-weight: 900; font-size: 30px; color: var(--accent); display: block; line-height: 1; margin-bottom: 6px; }
.steps strong { display: block; margin-bottom: 4px; }
.callout { border-left: 4px solid var(--accent); padding: 4px 0 4px 18px; margin: 18px 0; }

table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
table.data tbody th { font-weight: 700; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* ── Flags: a word or a value, a symbol and a colour ─────────────────────── */
.flag { display: inline-flex; gap: 5px; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: 14px; font-weight: 750; border: 1px solid currentColor; white-space: nowrap; font-variant-numeric: tabular-nums; }
.flag.green { color: var(--green); background: var(--green-soft); }
.flag.amber { color: var(--amber); background: var(--amber-soft); }
.flag.red { color: var(--red); background: var(--red-soft); }
.flag.none { color: var(--muted); font-weight: 600; }
.sources { padding-left: 18px; }
.sources li { margin-bottom: 6px; }

/* ── Runners and sessions ──────────────────────────────────────────────── */
.list { list-style: none; padding: 0; margin: 0; }
.list > li { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list .name { font-weight: 800; font-size: 19px; text-decoration: none; color: var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 13px; padding: 2px 10px; border-radius: 99px; background: var(--panel); color: var(--muted); font-weight: 650; }
.chip.done { background: var(--green-soft); color: var(--green); }
.chip.flagged { background: var(--amber-soft); color: var(--amber); }
.logo-preview { max-height: 56px; max-width: 200px; display: block; margin: 8px 0; }
.swatch { width: 54px; height: 42px; padding: 2px; }

/* ── Capture ─────────────────────────────────────────────────────────────── */
.view-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.view-tabs button { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.view-tabs button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .stage { grid-template-columns: 1fr; } }
.camera { position: relative; background: #0e0d0b; border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 9; max-height: 74vh; margin: 0 auto; width: 100%; }
.camera.portrait { aspect-ratio: 9 / 16; max-width: 420px; }
.camera video, .camera canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.camera video { object-fit: contain; }
.camera .state {
  position: absolute; left: 12px; top: 12px; max-width: calc(100% - 24px);
  padding: 6px 12px; border-radius: 99px; font-size: 14px; font-weight: 700;
  background: rgba(14, 13, 11, 0.7); color: #f7f5f1; backdrop-filter: blur(6px);
}
.camera .state.rec { background: rgba(185, 40, 30, 0.9); }
.camera .idle { position: absolute; inset: 0; display: grid; place-items: center; color: #cfc8ba; text-align: center; padding: 24px; }
.bar { height: 8px; border-radius: 99px; background: var(--panel); overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }
.setup { padding-left: 20px; margin: 6px 0; }
.setup li { margin-bottom: 4px; }

/* ── The report ──────────────────────────────────────────────────────────── */
.report { --brand: var(--accent); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.report > header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 28px; flex-wrap: wrap; border-bottom: 4px solid var(--brand); padding-bottom: 12px; margin-bottom: 8px; }
.report .brand { display: flex; align-items: center; gap: 12px; }
.report .brand img { max-height: 48px; max-width: 160px; }
.report .shop-name { font-weight: 850; font-size: 20px; letter-spacing: -0.02em; }
.report .shop-contact { font-size: 14px; color: var(--muted); }
.report .who { text-align: right; }
.report .who p { margin: 0; color: var(--muted); font-size: 15px; }
.report h1 { font-size: 28px; margin: 0; }
.report h2 { font-size: 18px; margin: 18px 0 6px; color: var(--brand); text-transform: uppercase; letter-spacing: 0.06em; }
.report .what { font-size: 13px; color: var(--muted); font-weight: 400; }
.report td.value { font-weight: 800; font-size: 18px; }
.report .flags { margin: 10px 0; padding-left: 20px; }
.report .flags li { margin-bottom: 4px; }
.report .flags.none { color: var(--muted); padding: 0; }
.report .quality { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.report .disclaimer { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 18px; }
.report .disclaimer p { margin: 0 0 4px; }
.figures { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0; }
.figures figure { margin: 0; width: 170px; }
.figures figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
svg.figure { width: 100%; height: 190px; background: var(--panel); border-radius: 10px; display: block; }
svg.figure .bones line { stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
svg.figure .joints circle { fill: var(--ink); }
svg.figure .mark line, svg.figure .mark polyline { stroke: var(--brand, var(--accent)); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
svg.figure .mark line.guide { stroke-width: 1.2; }
svg.figure .mark circle.ring { fill: none; stroke: var(--brand, var(--accent)); stroke-width: 1.4; }

/* ── Before and after ────────────────────────────────────────────────────── */
.compare-head { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .compare-head { grid-template-columns: 1fr; } }
td.up { color: var(--ink); font-weight: 750; }

@media print {
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --panel: #f1f1f1; --line: #c8c8c8; --ink: #000; --muted: #444;
    --accent: #8a3410; --green: #17602f; --green-soft: #fff; --amber: #7a5100; --amber-soft: #fff; --red: #9b2219; --red-soft: #fff; }
  @page { size: A4; margin: 13mm; }
  body { font-size: 10.5pt; }
  .masthead, .siteftr, .no-print { display: none !important; }
  main { max-width: none; padding: 0; }
  .report { border: 0; padding: 0; }
  table.data { font-size: 9.5pt; }
  table.data th, table.data td { padding: 4px 6px; }
  /* One A4 page: the two views side by side, the header and the small print
     across both. */
  body { font-size: 9pt; }
  .report { display: grid; grid-template-columns: 1fr 1fr; column-gap: 7mm; align-items: start; }
  .report > header, .report > footer, .report > .note { grid-column: 1 / -1; }
  .report > header { margin-bottom: 0; padding-bottom: 6px; }
  .report .view { break-inside: avoid; }
  .report h2 { font-size: 10.5pt; margin: 8px 0 2px; }
  .report table.data { font-size: 8.5pt; }
  .report table.data th, .report table.data td { padding: 3px 4px; }
  .report table.measures { table-layout: fixed; }
  .report table.measures th:nth-child(1) { width: 52%; }
  .report table.measures th:nth-child(2) { width: 25%; }
  .report table.measures td.num { white-space: normal; }
  .report .what { font-size: 7pt; line-height: 1.3; }
  .report td.value { font-size: 10.5pt; }
  .report h1 { font-size: 16pt; }
  .report .shop-name { font-size: 13pt; }
  .report .brand img { max-height: 36px; }
  .report .flags { margin: 5px 0; padding-left: 14px; font-size: 8.5pt; }
  .report .quality { font-size: 7pt; }
  .report .disclaimer { font-size: 7pt; margin-top: 8px; padding-top: 6px; }
  .figures { gap: 6px; margin: 4px 0; }
  .figures figure { width: calc(50% - 3px); }
  .figures figcaption { font-size: 7pt; }
  svg.figure { height: 130px; background: #f3f3f3; }
  .report { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}
