/* Muscle groups (/muscle-groups, templates/muscle_group.html) in the planner's layout (base.html,
   app.css): cards on the left, the 3D model in a card pinned on the right. On a phone the model is
   pinned at the top and the cards scroll under it. Muscle colours: the roles in group.js. */
:root {
  --primary: #f39a1e;
  --trained: #3f7fe0;
  --secondary: #a83a3a;
  --rest: #93a1ad;
  --stretch: #8f63d6;
}

main.mg {
  /* the model a side column, like the library's animation: the width stays the planner's (main) */
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  grid-template-areas: "tabs tabs" "text model"; column-gap: 16px; align-items: start;
}
main.mg > .subnav { grid-area: tabs; }
.mg-text { grid-area: text; }
.mg-model { grid-area: model; }
/* app.css has no rule for [hidden], and the blocks below set their own display */
#loading[hidden], #tip[hidden], #tip-gen[hidden], #legend-reset[hidden] { display: none; }
.mg-text { min-width: 0; }
.mg-model { position: sticky; top: 12px; min-width: 0; }
.model-card { padding: 0; margin: 0; overflow: hidden; height: min(calc(100vh - 24px), 640px); height: min(calc(100dvh - 24px), 640px); }
#stage {
  position: relative; width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 38%, #fdfdfc 0%, #eef3f6 60%, #dfe8ee 100%);
}
#stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.model-hint { position: absolute; left: 14px; bottom: 10px; margin: 0; font-size: .8rem; color: var(--muted); pointer-events: none; }

/* The legend over the model: what is shown and what the colours mean. */
.legend {
  position: absolute; left: 12px; top: 12px; max-width: min(320px, calc(100% - 24px)); padding: 10px 12px;
  border-radius: 10px; background: rgba(255, 255, 255, .86); box-shadow: 0 1px 3px rgba(30, 50, 70, .12);
  display: grid; gap: 6px; backdrop-filter: blur(6px);
}
#legend-title { margin: 0; font-weight: 600; font-size: .92rem; line-height: 1.3; }
#legend-roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: .82rem; color: var(--muted); }
#legend-roles li { display: flex; align-items: center; gap: 7px; }
#legend-roles li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--swatch); flex: none; }
#legend-reset {
  justify-self: start; font: inherit; font-size: .82rem; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); background: #fff; color: var(--accent); font-weight: 600;
}
#legend-reset:hover { background: var(--accent); color: #fff; }

/* The tooltip over a muscle under the pointer. */
#tip {
  position: absolute; pointer-events: none; max-width: 280px; padding: 9px 11px; border-radius: 8px;
  background: rgba(26, 32, 38, .92); color: #f1f5f5; box-shadow: 0 6px 24px rgba(0, 0, 0, .22); display: grid; gap: 2px;
}
#tip-name { font-weight: 600; font-size: .9rem; line-height: 1.3; }
#tip-latin { font-style: italic; font-size: .82rem; opacity: .8; }
#tip-side { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; opacity: .65; }
#tip-fn { font-size: .82rem; line-height: 1.4; margin-top: 3px; }
#tip-gen { font-size: .76rem; opacity: .75; font-style: italic; }

/* Cards on the left */
.mg-head h1 { margin-bottom: 6px; }
.mg-head .crumbs { margin-bottom: 8px; }
.crumbs .back { font-size: 1.4rem; line-height: 1; text-decoration: none; }
.crumbs .back:hover { opacity: .7; }
.lead { font-size: 1.05rem; max-width: 62ch; }
.mg-text h2 { font-size: 1.1rem; }
.mg-text h3 { font-size: 1rem; margin: 0; text-wrap: balance; }
.mg-text .card p { max-width: 68ch; }
.text-block + .text-block { margin-top: 14px; }
.hint-text { color: var(--muted); font-size: .9rem; }
.overview { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.overview h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
/* an outlined pill on white, like the top bar's login link: legible over any sky (the cards let it
   through, pink at sunset) */
.link {
  display: inline-block; margin-top: 12px; padding: 5px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); background: #fff; color: var(--accent); font: inherit; font-size: .9rem; font-weight: 600;
}
.link:hover { background: var(--accent); color: #fff; }
.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Muscle chips, coloured like the muscle on the model */
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: .82rem; line-height: 1.2; padding: 4px 10px 4px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink); display: inline-flex; align-items: center; gap: 6px;
}
.chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--secondary); flex: none; }
.chip.primary::before { background: var(--primary); }
.chip.trained::before { background: var(--trained); }
.chip.stretch::before { background: var(--stretch); }
.chip:hover, .chip.pinned { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* Selectable blocks: the two balance cards and the exercises */
.balance-cards { display: grid; gap: 10px; margin-top: 10px; }
.balance-card, .ex {
  display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; transition: border-color 120ms, box-shadow 120ms, background 120ms; scroll-margin-top: 16px;
}
.balance-card:hover, .ex:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.balance-card:focus-visible, .ex:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.balance-card.active, .ex.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.balance-card p, .ex p { margin: 0; }
.balance-card.trained h3 { color: var(--trained); }
.balance-card.primary h3 { color: #b8650a; }

.exercises { display: grid; gap: 10px; }
.exercises > h2, .exercises > p { margin: 0; }
.ex header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.badge { font-size: .76rem; padding: 2px 8px; border-radius: 999px; background: rgba(63, 127, 134, .12); color: var(--accent); white-space: nowrap; }
.ex-body { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: start; }
.ex-body:not(:has(canvas)) { grid-template-columns: 1fr; }
.ex .exercise-3d { width: 112px; max-width: none; margin: 0; }
.ex-text { display: grid; gap: 4px; min-width: 0; }
.dose { font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dose a { white-space: nowrap; }
.variants { display: flex; gap: 6px; }
.variant {
  font: inherit; font-weight: 600; min-width: 40px; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.variant[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.roles { display: grid; gap: 6px; }
.role-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.role-label { font-size: .82rem; color: var(--muted); min-width: 72px; }
.note { font-size: .88rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }

.sources ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: .85rem; color: var(--muted); line-height: 1.45; }
.mg-text > .credit { font-size: .8rem; color: var(--muted); margin: 4px 4px 0; }
body.night .mg-text > .credit { color: #b4c0cd; }
body.night .mg-text > .credit a { color: #eef2f7; }

/* Links to the groups: the list page and "Inne grupy" under each group */
.group-cards { display: grid; gap: 10px; margin-top: 10px; }
.groups-list .group-cards { margin-top: 0; }
.group-card {
  display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  color: inherit; text-decoration: none; transition: border-color 120ms, box-shadow 120ms, background 120ms;
}
.group-card:hover, .group-card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; outline: none; }
.group-card strong { font-size: 1rem; font-weight: 600; }
.group-card span { font-size: .88rem; color: var(--muted); line-height: 1.45; }
.group-card small { font-size: .8rem; color: var(--accent); font-weight: 600; }

@media (max-width: 860px) {
  main.mg { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tabs" "model" "text"; }
  .mg-model { top: 0; z-index: 5; margin-bottom: 16px; }
  .model-card { height: 42vh; height: 42dvh; box-shadow: 0 6px 18px rgba(30, 50, 70, .18); }
  .model-hint { display: none; }
  .legend { left: 8px; top: 8px; padding: 7px 9px; gap: 4px; }
  #legend-roles { font-size: .76rem; }
  .ex-body { grid-template-columns: 88px minmax(0, 1fr); }
  .ex .exercise-3d { width: 88px; }
}

/* Injuries (/injuries, injuries.js): the places, warnings and rehabilitation stages */
.mg-head .updated { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.disclaimer {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: .9rem;
  background: #fbeee0; border: 1px solid #e8b04a;
}
.places { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.place {
  font: inherit; font-size: .88rem; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.place:hover { border-color: #e0457b; }
.place[aria-pressed="true"] { background: #e0457b; border-color: #e0457b; color: #fff; font-weight: 600; }
.chip.pain::before { background: #e0457b; }
.card.red { border-left: 4px solid #c4553f; }
.card.red h2 { color: #a3412f; }
.flags { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.what .text-block + .text-block { margin-top: 10px; }
.what .hint-text { margin: 12px 0 6px; }
.phase-head { display: flex; align-items: center; gap: 10px; }
.phase-head h2 { margin: 0; }
.phase-no {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff; font-weight: 600; font-size: .9rem;
}
.when { font-size: .9rem; color: var(--muted); }
.phase.exercises { gap: 10px; }
.phase.exercises > p { margin: 0; }
.eyebrow { margin: 0 0 4px; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: #a3412f; }
.card.footnote { font-size: .85rem; color: var(--muted); }

/* Techniques (/techniques, technique.js): the English name under the title, mobility and risk cards,
   drills on the wall, the card linking to the library's basics */
.aka { margin: -4px 0 6px; font-style: italic; color: var(--muted); }
.group-card .aka { margin: 0; font-size: .85rem; }
.balance-card.stretch h3 { color: #6b45b0; }
.balance-card.risk { border-left: 3px solid #e0457b; }
.balance-card.risk h3 { color: #b8335f; }
.risks .hint-text { margin: 10px 0 0; }
.ex.drill .badge { background: color-mix(in srgb, var(--accent) 14%, #fff); }
.basics { margin: 0; }
.groups-list h2 { margin-bottom: 10px; }
