/* Stylesheet of the library pages (/exercises/, /muscles/), written by scripts/build-library.mjs. Like
   legal.css it cannot link to the main site's hashed CSS, so the colour tokens below are a copy of
   src/styles/tokens.css (a test keeps them equal). */
@font-face {
  font-family: 'Albert Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/albert-sans-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Familjen Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/fonts/familjen-grotesk-latin.woff2') format('woff2');
}
:root {
  --bg: #e9e9e5;
  --panel: #f6f6f3;
  --ink: #0f1411;
  --muted: #5b625d;
  --accent: #0b6b5b;
  --on-accent: #f6f6f3;
  --accent-hover: #0a5e50;
  --line: #cbccc6;
  --stage: #0f1513;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1412;
    --panel: #171d1a;
    --ink: #edf1ee;
    --muted: #97a19b;
    --accent: #58cdb4;
    --on-accent: #0f1411;
    --accent-hover: #6fd8c1;
    --line: #27302c;
    --stage: #0f1513;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0f1412;
  --panel: #171d1a;
  --ink: #edf1ee;
  --muted: #97a19b;
  --accent: #58cdb4;
  --on-accent: #0f1411;
  --accent-hover: #6fd8c1;
  --line: #27302c;
  --stage: #0f1513;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Albert Sans', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
.brand {
  font-family: 'Familjen Grotesk', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
}
a {
  color: inherit;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
.wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* Header */
.site {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site .wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: 8px;
  font-size: 20px;
  text-decoration: none;
}
.icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #0f1411;
  color: #58cdb4;
  box-shadow: 0 0 0 1px var(--line);
  font-size: 19px;
  line-height: 1;
}
.nav {
  display: flex;
  gap: 2px;
}
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}
.nav a:hover,
.nav a[aria-current='page'] {
  color: var(--ink);
}
.site .get {
  margin-left: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  background: var(--accent-hover);
}
.btn.small {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 15px;
}

/* Page */
main {
  padding-block: 20px 56px;
}
.crumbs {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
}
.crumbs a {
  color: var(--muted);
}
.hero {
  display: grid;
  gap: 20px;
  align-items: center;
}
.hero h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 54px);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
}
.lead {
  margin: 14px 0 0;
  font-size: 19px;
  max-width: 34em;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.stage {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: 22px;
  background: var(--stage);
}
.stage img {
  width: 100%;
}

/* The athlete player (public/library.js, ADR 0013). The stage is dark in both themes. */
.media {
  display: grid;
  gap: 12px;
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.player .controls {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 14px 8px;
  background: linear-gradient(rgba(8, 12, 10, 0), rgba(8, 12, 10, 0.66));
  color: #edf1ee;
}
.player :focus-visible {
  outline-color: #edf1ee;
}
.play {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(237, 241, 238, 0.16);
  color: inherit;
  cursor: pointer;
}
.play:hover {
  background: rgba(237, 241, 238, 0.28);
}
.play .ico {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}
.play .i-play {
  fill: currentColor;
}
.play .i-pause,
.play.on .i-play {
  display: none;
}
.play.on .i-pause {
  display: block;
}
.track {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  gap: 4px;
  height: 44px;
}
.part {
  flex: 1 1 0;
  min-width: 8px;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(237, 241, 238, 0.3);
}
.part i {
  display: block;
  height: 100%;
  background: #58cdb4;
  transform: scaleX(0);
  transform-origin: left;
}
.track input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.track:has(input:focus-visible) {
  outline: 3px solid #edf1ee;
  outline-offset: 2px;
  border-radius: 8px;
}
.now {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 3.2em;
  margin: 0;
  font-size: 16px;
}
.now strong {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
}
.card {
  margin-top: 16px;
  padding: 20px;
  border-radius: 20px;
  background: var(--panel);
}
.card h2 {
  margin: 0 0 12px;
  font-size: 24px;
}
.card h3 {
  margin: 18px 0 6px;
  font-size: 17px;
}

/* Icons (scripts/lib/icons.mjs): line icons in the text colour, the heading ones in the accent. */
.ico {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card h2,
.section-title,
details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h2 .ico,
.section-title .ico,
details.card > summary .ico {
  color: var(--accent);
}
details > summary {
  list-style: none;
}
details > summary::-webkit-details-marker {
  display: none;
}
details > summary::after {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  margin: -4px 4px 0 auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}
details[open] > summary::after {
  margin-top: 4px;
  transform: rotate(-135deg);
}
.marks {
  margin: 0;
  padding: 0;
  list-style: none;
}
.marks li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.marks li + li {
  margin-top: 8px;
}
.marks .mark {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  stroke-width: 2;
}
.mark.check {
  color: var(--accent);
}
.mark.close {
  color: var(--muted);
}
.card p,
.card li {
  max-width: 44em;
}
.card > :last-child {
  margin-bottom: 0;
}
.muted {
  color: var(--muted);
}
.grid2 {
  display: grid;
  gap: 0 16px;
}
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  position: relative;
  padding: 10px 0 10px 44px;
  border-top: 1px solid var(--line);
  counter-increment: step;
}
.steps li:first-child {
  border-top: 0;
}
.steps li.now::before {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 9px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.dots {
  margin: 0;
  padding-left: 1.2em;
}
.dots li + li {
  margin-top: 6px;
}
.muscles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.muscles a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  text-decoration: none;
  font-weight: 500;
}
.muscles .primary a {
  background: var(--accent);
  box-shadow: none;
  color: var(--on-accent);
}
details.card > summary {
  cursor: pointer;
  font:
    700 20px/1.2 'Familjen Grotesk',
    system-ui,
    sans-serif;
  letter-spacing: -0.02em;
}
details.card[open] > summary {
  margin-bottom: 8px;
}
.cite {
  font-size: 13px;
  vertical-align: super;
  line-height: 0;
  text-decoration: none;
  color: var(--accent);
}
.refs {
  font-size: 15px;
}
dl.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
}
dl.facts dt {
  color: var(--muted);
}
dl.facts dd {
  margin: 0;
}

/* Where you stand */
.stats-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stats-head h2 {
  margin: 0;
}
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg);
}
.seg button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.seg button[aria-pressed='true'] {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line);
}
.readout {
  margin: 14px 0 4px;
  min-height: 2.6em;
}
.readout strong {
  display: block;
  font:
    700 clamp(34px, 7vw, 48px) / 1 'Familjen Grotesk',
    system-ui,
    sans-serif;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  color: var(--muted);
}
.field input {
  width: 6.5em;
  min-height: 44px;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.bell {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  margin-top: 8px;
  touch-action: pan-y;
  cursor: ew-resize;
}
.bell .group {
  display: none;
}
.bell .group.on {
  display: inline;
}
.bell .area {
  fill: var(--line);
  opacity: 0.6;
}
.bell .fill {
  fill: var(--accent);
}
.bell .curve {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}
.bell .axis {
  stroke: var(--muted);
  stroke-width: 1;
}
.bell text {
  fill: var(--muted);
  font-size: 20px;
  text-anchor: middle;
}
.bell .marker line {
  stroke: var(--ink);
  stroke-width: 2;
}
.bell .marker circle {
  fill: var(--ink);
  stroke: var(--panel);
  stroke-width: 2;
}
.source {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.source > summary {
  display: inline-flex;
  min-height: 32px;
  cursor: pointer;
  font-weight: 600;
}
.source p {
  margin: 4px 0 0;
}

/* Sign-in, your sets, comments (public/account.js) */
[hidden] {
  display: none !important;
}
.btn {
  white-space: nowrap;
}
@media (max-width: 440px) {
  /* Signed in or not, the account button takes the place of "Get the app" on a phone. */
  .site .wrap:has([data-account]:not([hidden])) .get {
    display: none;
  }
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.sets,
.comments {
  margin: 0;
  padding: 0;
  list-style: none;
}
.sets li,
.comments li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.comments p {
  margin: 0;
  overflow-wrap: anywhere;
}
.comments .who {
  color: var(--muted);
  font-size: 14px;
}
.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}
.write {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-bottom: 12px;
}
.write textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

/* Grids of exercises */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tiles a {
  display: block;
  height: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: var(--panel);
  text-decoration: none;
}
.tiles .thumb {
  display: block;
  background: var(--stage);
  aspect-ratio: 712 / 596;
}
.tiles .name {
  display: block;
  padding: 10px 12px 12px;
  font-weight: 600;
  line-height: 1.3;
}
.section-title {
  margin: 32px 0 12px;
  font-size: 26px;
}
.names {
  columns: 16em;
  margin: 0;
  padding: 0;
  list-style: none;
}
.names li {
  padding: 4px 0;
  break-inside: avoid;
}

/* Footer */
.foot {
  border-top: 1px solid var(--line);
  padding-block: 24px 48px;
  color: var(--muted);
  font-size: 15px;
}
.foot p {
  margin: 0;
}
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 8px;
}

@media (min-width: 760px) {
  .grid2 {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 900px) {
  main {
    padding-top: 28px;
  }
  .hero {
    grid-template-columns: 1.05fr 1fr;
    gap: 40px;
  }
  .hero .media {
    order: 2;
  }
}
@media (max-width: 520px) {
  .brand .word {
    display: none;
  }
  .nav a {
    padding: 0 10px;
  }
  .tiles {
    grid-template-columns: 1fr 1fr;
  }
}
