/* A·Lab Conditioning — shared design system (athlete check-in + coach dashboard) */

/* Self-hosted fonts (SIL Open Font License, see /fonts/OFL-*.txt) — no requests to Google. */
@font-face {
  font-family: 'Big Shoulders'; font-style: normal; font-weight: 700 900; font-display: swap;
  src: url('/fonts/big-shoulders-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Big Shoulders'; font-style: normal; font-weight: 700 900; font-display: swap;
  src: url('/fonts/big-shoulders-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/fonts/instrument-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/fonts/instrument-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font-display: 'Big Shoulders', 'Arial Narrow', Impact, sans-serif;
  --font-body: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;

  --bg: #f1f0ea;
  --surface: #ffffff;
  --surface-2: #f6f5f0;
  --ink: #111513;
  --ink-2: #4a524e;
  --ink-3: #7b837f;
  --line: #e1e0d8;
  --line-2: #cfcec5;

  --signal: #0a7a55;        /* brand accent */
  --signal-ink: #ffffff;
  --signal-soft: #dff0e7;
  --volt: #d4f74a;

  --good: #1d9a5f;
  --mid: #e39b17;
  --bad: #de4a3c;

  --pain-1: #f0c02c;
  --pain-2: #ef8423;
  --pain-3: #dc3b2c;

  --effort: #5b4fd0;        /* training difficulty (not good/bad) */
  /* categorical: training load by source (validated light/dark, see coach charts) */
  --cat-1: #2a78d6;  --cat-2: #eb6834;  --cat-3: #1baf7a;

  --body-fill: #c9cfca;
  --body-hover: #aab3ad;
  --body-seam: #eef0ec;
  --body-outline: #a9b1ab;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(17, 21, 19, .04), 0 8px 24px -12px rgba(17, 21, 19, .12);
  --tap: 52px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c100f;
    --surface: #141a18;
    --surface-2: #19211e;
    --ink: #edf2ee;
    --ink-2: #b0bab5;
    --ink-3: #78837e;
    --line: #242d2a;
    --line-2: #33403b;

    --signal: #c8f04a;
    --signal-ink: #0c100f;
    --signal-soft: #26301a;
    --volt: #c8f04a;

    --good: #34c27c;
    --mid: #f2b03a;
    --bad: #f0634f;

    --effort: #9085e9;
    --cat-1: #3987e5;  --cat-2: #d95926;  --cat-3: #199e70;

    --body-fill: #2f3a36;
    --body-hover: #43514b;
    --body-seam: #1b2320;
    --body-outline: #46534d;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
/* no double-tap zoom delay on phones */
a, button, input, select, textarea, label, [role="button"], [role="radio"] { touch-action: manipulation; }
body.is-locked { overflow: hidden; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- typography bits ---------- */
.eyebrow {
  font: 700 12px/1 var(--font-body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--signal);
}
.display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .01em;
  line-height: .9;
  text-transform: uppercase;
}
.muted { color: var(--ink-3); }

.wordmark {
  display: inline-flex; align-items: center; gap: 8px;
  font: 800 20px/1 var(--font-display);
  letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; color: var(--ink);
}
.wordmark__mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--ink); color: var(--volt);
  display: grid; place-items: center;
}
.wordmark__mark svg { width: 14px; height: 14px; }
.wordmark small {
  font: 600 11px/1 var(--font-body); letter-spacing: .12em;
  color: var(--ink-3); text-transform: uppercase; margin-left: 2px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 22px;
  border: 0; border-radius: 14px;
  background: var(--ink); color: var(--bg);
  font-weight: 700; font-size: 17px; letter-spacing: .01em;
  transition: transform .12s ease, background .2s ease, opacity .2s;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn--signal { background: var(--signal); color: var(--signal-ink); }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .arrow { transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(3px); }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid var(--line-2);
  background: var(--surface); color: var(--ink-2);
  font-weight: 600; font-size: 15px;
  transition: background .15s, border-color .15s, color .15s;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 10-segment meter (1–10 answers) ---------- */
.meter {
  --gap: 4px;
  display: grid; grid-template-columns: repeat(10, 1fr); gap: var(--gap);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.meter__seg {
  position: relative;
  height: 58px; min-width: 0; padding: 0;
  border: 0; border-radius: 9px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font: 800 21px/1 var(--font-display);
  color: var(--ink-2);
  transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s;
  overflow: hidden;
}
.meter__seg::after { /* scale direction hint: faint tint of this step's colour */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: var(--seg-color); opacity: .55;
}
.meter__seg:first-child { border-radius: 12px 6px 6px 12px; }
.meter__seg:last-child { border-radius: 6px 12px 12px 6px; }
.meter__seg.is-on {
  background: var(--seg-color); color: #fff; box-shadow: none;
}
.meter__seg.is-on::after { opacity: 0; }
.meter__seg.is-value { transform: translateY(-3px); box-shadow: 0 6px 14px -6px var(--seg-color); }
.meter__ends {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--ink-3);
}
@media (max-width: 380px) {
  .meter { --gap: 3px; }
  .meter__seg { height: 54px; font-size: 18px; border-radius: 7px; }
}
/* tiny phones (≤ 359 px): two rows of five, so every number is a proper thumb target */
@media (max-width: 359px) {
  .meter { grid-template-columns: repeat(5, 1fr); --gap: 5px; }
  .meter__seg { height: 48px; font-size: 19px; }
  .meter__seg:first-child, .meter__seg:last-child { border-radius: 7px; }
}

/* ---------- body map ---------- */
.bm { position: relative; }
.bm__views { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bm__view { position: relative; text-align: center; min-width: 0; }
.bm__view h4 {
  margin: 0 0 6px; font: 800 15px/1 var(--font-display); letter-spacing: .16em; text-transform: uppercase;
}
.bm__sides {
  display: flex; justify-content: space-between; padding: 0 2px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.bm-fig { display: block; width: 100%; height: auto; max-height: 480px; margin: 2px auto 0; overflow: visible; }
.bm-outline path { fill: var(--body-outline); stroke: var(--body-outline); stroke-width: 8; stroke-linejoin: round; }
.bm-sil path { fill: var(--body-seam); stroke: var(--body-seam); stroke-width: 5; stroke-linejoin: round; }
.bm-r {
  fill: var(--body-fill);
  stroke: var(--body-seam); stroke-width: 1.3; stroke-linejoin: round;
  transition: fill .2s ease;
}
.bm--interactive .bm-r { cursor: pointer; }
@media (hover: hover) { .bm--interactive .bm-r:hover { fill: var(--body-hover); } }
.bm--interactive .bm-r.is-sel:hover { opacity: .85; }
.bm-r:focus-visible { outline: none; stroke: var(--ink); stroke-width: 2.5; }
.bm-r.is-pulse { animation: bm-pulse .5s ease; }
@keyframes bm-pulse { 50% { opacity: .55; } }

.legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px;
  font-size: 12px; font-weight: 700; color: var(--ink-3);
}
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------- bottom sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8, 12, 10, .45);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .2s ease;
}
.sheet-backdrop.is-open { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .35);
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .9, .3, 1);
  max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
}
.sheet.is-open { transform: none; }
.sheet__grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line-2); margin: 0 auto 14px; }

/* ---------- phones: comfortable thumb targets ---------- */
@media (pointer: coarse) {
  .btn--sm { min-height: 44px; }
}

/* ---------- "add to home screen" card ---------- */
.install {
  position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: start;
  padding: 16px 44px 16px 16px; margin: 0 0 14px; text-align: left;
}
.install__icon { border-radius: 12px; display: block; }
.install__title { display: block; font-size: 16px; font-weight: 800; }
.install__text { margin: 2px 0 10px; font-size: 14px; color: var(--ink-2); }
.install__how { margin: 0; font-size: 14px; color: var(--ink); line-height: 1.5; }
.install__x {
  position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-3); font-size: 24px; line-height: 1; display: grid; place-items: center;
}

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: 110px; z-index: 60;
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px;
  transition: opacity .2s, transform .2s; pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line-2); border-top-color: var(--signal);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
