/*
 * /exercise/* pages: page-specific styles on top of /site.css.
 * Generated pages come from scripts/build-exercise-pages.py.
 *
 * .motion holds the app's <ExerciseMotion> demo: a server-rendered still frame,
 * swapped for the live animation by /assets/motion-embed.js. The component is
 * styled with Tailwind utility classes in the app; the few it uses are mirrored
 * here (scoped to .motion) together with the app's colour tokens.
 */

/* ---- demo colour tokens (mirror src/index.css) ---- */
.motion {
  --foreground: #17132b;
  --background: #fdfdf7;
  --surface-hi: #ebe9f5;
  --destructive: #d6264b;
  --primary: #6d3bff;
  --primary-foreground: #ffffff;
  --muted-foreground: #5f5b78;
  color: var(--foreground);
}
@media (prefers-color-scheme: dark) {
  .motion {
    --foreground: #f2f0f8;
    --background: #0b0a12;
    --surface-hi: #201c30;
    --destructive: #ff4d6d;
    --primary: #eaff2f;
    --primary-foreground: #141400;
    --muted-foreground: #aaa4c0;
  }
}

/* ---- the Tailwind utilities <ExerciseMotion> uses ---- */
.motion .flex { display: flex; }
.motion .flex-col { flex-direction: column; }
.motion .items-center { align-items: center; }
.motion .justify-center { justify-content: center; }
.motion .gap-1 { gap: .25rem; }
.motion .gap-3 { gap: .75rem; }
.motion .relative { position: relative; }
.motion .absolute { position: absolute; }
.motion .w-full { width: 100%; }
.motion .overflow-hidden { overflow: hidden; }
.motion .rounded-2xl { border-radius: 1rem; }
.motion .rounded-full { border-radius: 999px; }
.motion .bg-surface-hi { background: var(--surface-hi); }
.motion .aspect-\[16\/10\] { aspect-ratio: 16 / 10; }
.motion .size-full { width: 100%; height: 100%; }
.motion .size-2 { width: .5rem; height: .5rem; flex: none; }
.motion .size-11 { width: 2.75rem; height: 2.75rem; }
.motion .top-2\.5 { top: .625rem; }
.motion .right-2\.5 { right: .625rem; }
.motion .bottom-2 { bottom: .5rem; }
.motion .left-2\.5 { left: .625rem; }
.motion .pointer-events-none { pointer-events: none; }
.motion .text-\[11px\] { font-size: 11px; line-height: 1.2; }
.motion .font-medium { font-weight: 500; }
.motion .text-muted-foreground { color: var(--muted-foreground); }
.motion .text-foreground { color: var(--foreground); }
.motion .bg-destructive { background: var(--destructive); }
.motion .bg-destructive\/45 { background: color-mix(in srgb, var(--destructive) 45%, transparent); }
.motion .h-0 { height: 0; }
.motion .w-3 { width: .75rem; }
.motion .border-t-2 { border-top: 2px dashed var(--primary); }
.motion .bg-background\/70 { background: color-mix(in srgb, var(--background) 70%, transparent); }
.motion .backdrop-blur-sm { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* the demo svg (site.css styles every .figure svg; undo what doesn't fit) */
.figure .motion svg.size-full { width: 100%; height: 100%; overflow: hidden; }
.figure .motion svg text { fill: var(--primary-foreground); font-family: var(--font); }
.motion button {
  border: 0; padding: 0; cursor: pointer; font: inherit;
  transition: background-color .15s ease;
}
.motion button:hover { background: color-mix(in srgb, var(--background) 90%, transparent); }
.motion button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.figure .motion button svg { width: 18px; height: 18px; overflow: visible; }
/* the still frame has no working play button until the script takes over */
.motion:not(.is-live) button { display: none; }
.ex-demo { padding: .75rem; }
.ex-demo .motion { min-height: 120px; }

/* ---- muscles table ---- */
.ex-muscles td:first-child { white-space: nowrap; font-weight: 600; }
.dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 999px; margin-right: .5rem; vertical-align: .05em; }
.dot.p { background: var(--danger); }
.dot.s { background: color-mix(in srgb, var(--danger) 45%, transparent); }
.ex-muscles { min-width: 0; }
@media (max-width: 480px) {
  .ex-muscles th:nth-child(3), .ex-muscles td:nth-child(3) { display: none; }
}

/* ---- steps, cues, mistakes ---- */
.ex-steps { counter-reset: step; list-style: none; padding: 0; }
.ex-steps li { counter-increment: step; position: relative; padding: .1rem 0 .1rem 2.6rem; margin: .7rem 0; min-height: 1.9rem; }
.ex-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 1.9rem; height: 1.9rem; border-radius: 999px; display: grid; place-items: center;
  background: var(--cta); color: var(--cta-fg); font-weight: 800; font-stretch: 87.5%; font-size: .95rem;
}
.ex-cues { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ex-cues li { margin: 0; padding: .6rem .8rem .6rem 2.1rem; border-radius: 12px; position: relative; background: color-mix(in oklab, var(--primary) 9%, var(--card)); border: 1px solid var(--border); }
.ex-cues li::before { content: "✓"; position: absolute; left: .8rem; top: .58rem; color: var(--link); font-weight: 800; }
.ex-mistakes li { margin: .6rem 0; }

/* ---- related + index cards ---- */
.card-grid > li { margin: 0; }
.ex-related { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.ex-related .card, .ex-index .card { padding: .85rem 1rem; gap: .25rem; box-shadow: none; }
.ex-related .card h3, .ex-index .card h3 { font-size: 1.05rem; }
.ex-related .card p, .ex-index .card p { font-size: .88rem; }
.ex-index .card-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 1rem 0 0; }
.ex-index .card-tag { color: var(--muted-fg); letter-spacing: .06em; }
.ex-group { scroll-margin-top: 5rem; }
.ex-group h2 { margin-bottom: .3rem; }
.ex-group > p.muted { margin: 0; }
.ex-jump ul { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ex-jump li { margin: 0; }
.ex-jump a {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: 0 .85rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--card);
  color: var(--fg); text-decoration: none; font-weight: 600; font-size: .92rem;
}
.ex-jump a:hover { border-color: var(--primary); }
.ex-jump span { color: var(--muted-fg); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---- CTA buttons wrap on narrow phones ---- */
.cta { display: block; }
.cta .btn { margin: 0 .5rem .5rem 0; }
.cta .btn + .btn { margin-left: 0; }

@media print {
  .ex-demo .motion button { display: none; }
}

/* stat tiles carry words here ("Intermediate", "Upper back +2"), not numbers */
.ex-page .facts b { font-size: 1.25rem; overflow-wrap: anywhere; }
@media (max-width: 400px) { .ex-page .facts { grid-template-columns: 1fr 1fr; } }
