/* Visual theme, loaded after style.css.
   Desktop (style A "Zónová mapa"): light, side navigation, workouts drawn as zone-coloured interval profiles.
   Phone (style C "Do vrecka"): warm cards, big readiness number, today's workout as a card in the sport's colour. */

:root {
  --bg: #f7f9fa;
  --panel: #ffffff;
  --side: #eef2f5;
  --text: #141a21;
  --muted: #66727e;
  --border: #e3e8ed;
  --accent: #1d6fbf;
  --btn: #141a21;
  --btn-text: #ffffff;
  --good: #1f9a5c;
  --warn: #b7791f;
  --bad: #c63a1e;

  /* training zones, also the colour of intensity everywhere */
  --z0: #c9d2da;
  --z1: #8fa3b5;
  --z2: #2f8fd8;
  --z3: #2bb673;
  --z4: #f2b630;
  --z5: #ea5a2f;
  --z6: #b8255f;

  /* sports */
  --swim: #1f9bd1;
  --bike: #e8961f;
  --run: #e2483d;
  --strength: #7b5cc4;
  --other: #6b7166;

  /* charts */
  --ctl: #2f8fd8;
  --atl: #b8255f;
  --tsb: #e0a419;
  --tss: #c9d2da;

  --f-ui: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-display: "Archivo", system-ui, sans-serif;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171d;
    --panel: #192028;
    --side: #0e1318;
    --text: #e7ecf1;
    --muted: #93a1af;
    --border: #2a343f;
    --accent: #6fb0f0;
    --btn: #e7ecf1;
    --btn-text: #12171d;
    --good: #4cc98a;
    --warn: #f0b84a;
    --bad: #f47a5c;
    --z0: #3a4652;
    --z1: #7d93a8;
    --ctl: #5aa9ec;
    --atl: #e0568d;
    --tsb: #f2c14e;
    --tss: #3a4652;
  }
}

body { font-family: var(--f-ui); font-size: 15px; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; }
h1 { font-weight: 800; font-variation-settings: "wdth" 118; letter-spacing: -.01em; }
h2 { font-weight: 700; font-variation-settings: "wdth" 96; font-size: 18px; }
h2 small { font-family: var(--f-ui); font-variation-settings: normal; }

button { background: var(--btn); border-color: var(--btn); color: var(--btn-text); border-radius: 7px; font-weight: 600; }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.secondary:hover { border-color: var(--muted); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel { border-radius: var(--radius); }
.card { border-radius: var(--radius); }
.card .value { font-family: var(--f-display); font-weight: 700; font-variation-settings: "wdth" 90; }
.range button.on, .tabs button.on { border-color: var(--text); }
.seg button.on { background: var(--btn); color: var(--btn-text); }

/* --- Zones ------------------------------------------------------------------- */

.profile { display: block; width: 100%; height: 84px; }
.profile.mini { height: 20px; }
.profile .z0 { fill: var(--z0); }
.profile .z1 { fill: var(--z1); }
.profile .z2 { fill: var(--z2); }
.profile .z3 { fill: var(--z3); }
.profile .z4 { fill: var(--z4); }
.profile .z5 { fill: var(--z5); }
.profile .z6 { fill: var(--z6); }

.workout, .w-chip { --zone: var(--z0); }
.workout.recovery, .w-chip.recovery { --zone: var(--z1); }
.workout.endurance, .w-chip.endurance { --zone: var(--z2); }
.workout.tempo, .w-chip.tempo { --zone: var(--z3); }
.workout.threshold, .w-chip.threshold { --zone: var(--z4); }
.workout.vo2max, .w-chip.vo2max { --zone: var(--z5); }
.workout.strength, .w-chip.strength { --zone: var(--strength); }

.workout.sport-swim, .w-chip.sport-swim { --sport: var(--swim); }
.workout.sport-bike, .w-chip.sport-bike { --sport: var(--bike); }
.workout.sport-run, .w-chip.sport-run { --sport: var(--run); }
.workout.sport-strength, .w-chip.sport-strength { --sport: var(--strength); }
.workout.sport-other, .w-chip.sport-other { --sport: var(--other); }

.workout[class] { border-left-color: var(--zone); }
.workout { border-radius: var(--radius); padding: 10px 14px; }
.workout .sport { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--muted); }
.workout .sport::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--sport, var(--muted));
}
.w-prof { flex-basis: 100%; order: 10; margin-top: 8px; }

#today-workouts .workout { border-left-width: 4px; padding: 14px 18px; }
#today-workouts .workout summary b {
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 800;
  font-variation-settings: "wdth" 72;
  line-height: 1.05;
  flex-basis: 100%;
  order: -1;
}
#today-workouts .workout .sport { order: -2; flex-basis: 100%; }

.w-chip[class] { border-left-color: var(--zone); }
.w-chip .w-mini { display: block; margin: 1px 0 3px; }

/* --- Desktop: side navigation -------------------------------------------------- */

@media (min-width: 1000px) {
  body { padding-left: 216px; }
  header {
    position: fixed;
    inset: 0 auto 0 0;
    width: 216px;
    max-width: none;
    margin: 0;
    z-index: 6;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 18px;
    padding: 24px 14px;
    background: var(--side);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }
  header h1 { font-size: 21px; padding: 0 10px; }
  .tabs { flex-direction: column; gap: 2px; }
  .tabs button {
    text-align: left;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 8px 10px;
    border-radius: 6px;
    font-weight: 500;
  }
  .tabs button:hover { color: var(--text); }
  .tabs button.on { background: var(--panel); color: var(--text); font-weight: 600; }
  .sync { margin-top: auto; flex-direction: column; align-items: stretch; }
  .sync .pill { text-align: center; }
  main { padding-top: 24px; padding-inline: 28px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}

/* --- Phone: style C ----------------------------------------------------------- */

@media (max-width: 700px) {
  :root {
    --bg: #f8f6f0;
    --panel: #ffffff;
    --text: #1c1f1a;
    --muted: #6b7166;
    --border: #e7e4da;
    --accent: #1f6fb2;
    --btn: #1c1f1a;
    --btn-text: #ffffff;
    --good: #2d9b5a;
    --f-display: "Bricolage Grotesque", "Archivo", system-ui, sans-serif;
    --radius: 18px;
  }

  h1 { font-variation-settings: normal; font-weight: 800; letter-spacing: -.02em; }
  h2 { font-variation-settings: normal; font-weight: 750; font-size: 19px; letter-spacing: -.01em; }
  .panel { border: none; }
  .card { border: none; border-radius: 14px; }
  .card .value { font-variation-settings: normal; letter-spacing: -.02em; }

  /* readiness as the first thing you see */
  .cards .card:first-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "value label" "value sub";
    align-items: center;
    column-gap: 14px;
    padding: 14px 16px;
  }
  .cards .card:first-child .value { grid-area: value; font-size: 64px; font-weight: 800; line-height: .9; }
  .cards .card:first-child .label { grid-area: label; align-self: end; font-size: 15px; font-weight: 600; color: var(--text); }
  .cards .card:first-child .sub { grid-area: sub; align-self: start; font-size: 14px; }

  /* today's workout as a card in the sport's colour */
  #today-panel { background: transparent; padding: 0; }
  #today-workouts { display: grid; gap: 10px; }
  #today-workouts .workout {
    background: var(--sport, var(--other));
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 16px;
    margin: 0;
  }
  #today-workouts .workout summary b { font-family: var(--f-display); font-variation-settings: normal; font-size: 25px; letter-spacing: -.02em; }
  #today-workouts .workout .sport,
  #today-workouts .workout .muted { color: rgb(255 255 255 / 85%); }
  #today-workouts .workout .sport::before { background: #fff; }
  #today-workouts .workout .badge { border-color: rgb(255 255 255 / 45%); color: #fff; }
  #today-workouts .workout .profile { height: 46px; }
  #today-workouts .workout .profile rect { fill: #fff; }
  #today-workouts .workout .profile .z0, #today-workouts .workout .profile .z1 { opacity: .45; }
  #today-workouts .workout .profile .z2 { opacity: .6; }
  #today-workouts .workout .profile .z3 { opacity: .75; }
  #today-workouts .workout .profile .z4 { opacity: .9; }
  #today-workouts .workout button.secondary { background: rgb(255 255 255 / 22%); color: #fff; border-color: transparent; border-radius: 99px; }
  #today-workouts .workout .bad { color: #fff; font-weight: 600; }

  /* calendar chips coloured by sport */
  .w-chip { background: var(--sport, var(--other)); color: #fff; border: none; border-radius: 7px; }
  .w-chip .w-mini { display: none; }
  .w-chip.missed { background: var(--border); color: var(--muted); }
  .w-chip.completed::after { color: #fff; }
  .cal-day.today { outline-color: var(--text); }
  .cal-day.today .cal-date { color: var(--text); }

  .tabs { background: var(--panel); }
  .tabs button.on { color: var(--text); font-weight: 700; }
  .tabs button { color: var(--muted); }
  .workout { border-radius: 14px; }
}

@media (max-width: 700px) and (prefers-color-scheme: dark) {
  :root {
    --bg: #141612;
    --panel: #1e211c;
    --text: #ecebe4;
    --muted: #a3a89c;
    --border: #30342c;
    --accent: #7db8ea;
    --btn: #ecebe4;
    --btn-text: #141612;
    --good: #5cc787;
  }
}
