:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1f1c1a;
  --muted: #6b645d;
  --line: #e4ddd3;
  --soft: #efe9e0;
  --focus: #1f1c1a;
  --radius: 14px;
  --stage: #2a2724; /* behind the pictures in both themes, so the pale figure and red muscles stand out */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161412;
    --surface: #211e1b;
    --ink: #f3eee7;
    --muted: #a9a097;
    --line: #36312c;
    --soft: #2a2622;
    --focus: #f3eee7;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.logo { font-weight: 800; font-size: 19px; text-decoration: none; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.logo-mark { display: inline-flex; gap: 3px; }
.logo-mark i { width: 6px; height: 20px; border-radius: 3px; display: block; }
.site-nav { display: flex; gap: 16px; margin-left: auto; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px; }
.site-nav a[aria-current="page"], .site-nav a:hover { color: var(--ink); }

/* Hero + filters */
.hero { padding: 36px 0 12px; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.1; margin: 0 0 10px; letter-spacing: -0.03em; }
.hero p { margin: 0; color: var(--muted); max-width: 620px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 18px 0 8px; }
.muscle {
  height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; max-width: 100%;
}
.search {
  flex: 1 1 260px; min-width: 0; height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none;
}
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--band, var(--muted)); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.count { color: var(--muted); font-size: 14px; margin: 6px 0 14px; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding-bottom: 40px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; overflow: hidden; transition: border-color .15s;
}
.card:hover { border-color: var(--band); }
.card .art { background: var(--stage); border-bottom: 1px solid var(--line); }
.card .body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.card h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.card .meta { color: var(--muted); font-size: 14px; }
.label {
  display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--band); background: color-mix(in srgb, var(--band) 13%, transparent);
}
.label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--band); }
.empty { padding: 40px 0; color: var(--muted); }

/* Exercise pictures (transparent renders on the soft background) */
.art img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 7; }
.art-empty { aspect-ratio: 9 / 7; display: grid; place-items: center; align-content: center; gap: 4px; color: var(--muted); font-size: 14px; font-weight: 600; }
.art-empty .band-art { width: 46%; background: none; }
.card .meta b { color: var(--ink); font-weight: 600; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.band-intro { border-left: 4px solid var(--band); background: var(--surface); border-radius: 0 12px 12px 0; padding: 10px 14px; margin: 6px 0 4px; max-width: 760px; }
.band-intro b { color: var(--band); }
.fact small { color: var(--muted); }
.btn[aria-pressed="true"]:not(.primary) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* Detail page */
.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; font-weight: 600; margin-top: 12px; }
.detail { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; padding: 8px 0 40px; align-items: start; }
.detail h1 { font-size: clamp(26px, 4.5vw, 38px); line-height: 1.15; margin: 10px 0 6px; letter-spacing: -0.02em; }
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; position: sticky; top: 12px; }
.stage .art { background: var(--stage); border-radius: 10px; }
.stage-controls { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
}
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fact b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.placement { border-left: 4px solid var(--band); background: var(--surface); border-radius: 0 12px 12px 0; padding: 10px 14px; margin: 14px 0; }
.placement b { color: var(--band); }
.detail h2 { font-size: 18px; margin: 22px 0 8px; }
.steps { padding-left: 22px; margin: 0; display: grid; gap: 8px; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-top: 10px; }
.note b { display: block; }
.more { padding-bottom: 40px; }
.more h2 { font-size: 20px; }

/* Band guide */
.guide { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; padding: 8px 0 40px; }
.guide .card { padding: 0; }
.band-art { display: block; width: 100%; height: auto; background: var(--soft); }
.band-art .ink { fill: none; stroke: var(--band); stroke-linecap: round; stroke-linejoin: round; }
.band-art .grip { fill: var(--surface); stroke: var(--band); stroke-width: 4; }

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

@media (max-width: 760px) {
  .detail { grid-template-columns: 1fr; }
  .stage { position: static; }
  .site-nav { gap: 12px; }
}
@media (max-width: 420px) {
  .logo span.word { display: none; }
}

/* Key for the muscle colours in the pictures */
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.legend .key { width: 14px; height: 14px; border-radius: 4px; margin-left: 10px; }
.legend .key:first-child { margin-left: 0; }
.legend .key.main { background: #c9281c; }
.legend .key.minor { background: #e9998f; }

/* Workout planner */
.planner { display: grid; gap: 14px; padding: 18px 0 6px; }
.planner fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.planner legend { font-weight: 700; font-size: 14px; color: var(--muted); padding: 0 0 6px; }
.pick { cursor: pointer; }
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--band, var(--ink)); }
.pick:has(input:checked) { border-color: var(--band, var(--ink)); box-shadow: inset 0 0 0 1px var(--band, var(--ink)); }
.pick:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.selects { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.selects label { display: grid; gap: 4px; font-weight: 700; font-size: 14px; color: var(--muted); }
.selects select { height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; width: 100%; }
.weekbar { padding: 10px 0 4px; }
.weekbar .count { margin: 8px 0 0; max-width: 760px; }
.weekbar .count b, .cover .count b { color: var(--ink); }
button.chip { cursor: pointer; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0; }
.day summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 14px 16px; cursor: pointer; min-height: 44px; }
.day .when { color: var(--muted); font-weight: 700; font-size: 14px; }
.day .title { font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.day .sum { color: var(--muted); font-size: 14px; margin-left: auto; }
.day .ok { color: #24936a; }
.prows { list-style: none; margin: 0; padding: 0; }
.prow { display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(110px, auto) auto auto; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.prow .thumb { display: block; background: var(--stage); border-radius: 8px; overflow: hidden; aspect-ratio: 9 / 7; border-bottom: 3px solid var(--band); }
.prow .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.prow .what > a { font-weight: 700; text-decoration: none; }
.prow .what > a:hover { text-decoration: underline; }
.prow small { display: block; color: var(--muted); font-size: 13px; }
.prow .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 3px 0; }
.prow .for { font-size: 13px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.prow .dose b { display: block; }
.ticks { display: flex; gap: 6px; }
.tick { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.tick[aria-pressed="true"] { background: #24936a; border-color: #24936a; color: #fff; }
.swap { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.swap:hover { color: var(--ink); border-color: var(--ink); }
.prow.is-done .what > a, .prow.is-done .dose { opacity: .55; }
.bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 24px; padding: 4px 16px 6px; }
.bar { display: grid; grid-template-columns: 120px 1fr 40px; gap: 8px; align-items: center; font-size: 14px; }
.bar i { height: 8px; border-radius: 4px; background: #c9281c; min-width: 2px; }
.bar b { text-align: right; }
.bar.none { color: var(--muted); }
.bar.none b { font-weight: 400; }
.cover .count { padding: 0 16px 12px; margin: 0; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0 40px; }
.rest { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: 0 6px 24px rgb(0 0 0 / .25); }
.rest[hidden] { display: none; }
.rest b { font-size: 20px; font-variant-numeric: tabular-nums; }
.rest .btn { min-height: 36px; }
@media (max-width: 700px) {
  .prow { grid-template-columns: 72px minmax(0, 1fr) auto; }
  .prow .dose { grid-column: 2; }
  .prow .ticks { grid-column: 1 / -1; }
  .prow .swap { grid-column: 3; grid-row: 1 / span 2; }
}
@media print {
  .site-header, .site-footer, .planner, .hero p, .plan-actions, .swap, .rest, .weekbar .chips, .cover { display: none !important; }
  body { background: #fff; color: #000; }
  .day { break-inside: avoid; border-color: #999; }
  .prow .thumb { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Small extra picture from behind, for moves that are shown from the front */
.behind { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.behind img { width: 45%; max-width: 240px; height: auto; aspect-ratio: 9 / 7; background: var(--stage); border-radius: 8px; }

/* Programs */
.card.program .body { padding: 16px; gap: 8px; }
.card.program .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card.program:hover { border-color: var(--ink); }
.day.plain { padding: 4px 16px 14px; }
.day.plain h2 { font-size: 18px; margin: 12px 0 8px; }
.count a { color: var(--ink); font-weight: 600; }
@media (max-width: 480px) { .site-nav { gap: 10px; } .site-nav a { font-size: 14px; } }
