/* ============================================================================
   fitness.css — styles for the Fitness plugin.

   Like journal.css, this ships with its module: nothing here is referenced by
   the core. Layout only where the shared primitives (card, checklist, ring,
   bar, chart) don't already cover it.
   ============================================================================ */

/* ---- Page layout -------------------------------------------------------- */
.fit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
  align-items: start;
}
.fit-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
  align-items: start;
}
.view--fitness .fit-review { margin-top: var(--gap); }
/* Seven tiles: a wider min keeps them at 4 + 3 instead of a lopsided 5 + 2. */
.view--fitness .stat-row { grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }

/* ---- Hero --------------------------------------------------------------- */
.fit-hero .hero__eyebrow { display: inline-flex; align-items: center; gap: 6px; }
.fit-hero .hero__eyebrow .icon { color: rgb(var(--home)); }
.fit-hero__tip {
  flex: none;
  max-width: 34ch;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: rgb(var(--surface-2) / 0.85);
  border: 1px solid rgb(var(--border));
  font-size: 14px;
  line-height: 1.5;
  font-weight: 550;
}
.fit-hero__tip .icon { color: rgb(var(--primary)); flex: none; margin-top: 1px; }

/* ---- Daily tracker ------------------------------------------------------ */
.fit-pct { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: rgb(var(--health)); }
.fit-checklist { margin-top: 14px; }
.fit-hint { font-size: 12.5px; margin-top: 12px; }

/* ---- Number fields ------------------------------------------------------ */
.fit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fit-fields--profile { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.fit-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fit-field--grow { flex: 1; min-width: 140px; }
.fit-field__label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: rgb(var(--text-2));
}
.fit-field__label .icon { color: rgb(var(--text-3)); }
/* Number inputs default to auto width in components.css — fill the field. */
.fit-field .input, .fit-field input[type='number'].input { width: 100%; min-width: 0; }

.fit-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fit-inline .input, .fit-inline input[type='number'].input { flex: 1; min-width: 90px; width: auto; }
.fit-inline__unit { font-size: 13.5px; font-weight: 600; color: rgb(var(--text-2)); }

/* ---- Totals ------------------------------------------------------------- */
.fit-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 16px 0 10px; }
.fit-total__value { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
.fit-total__value span { font-size: 13px; font-weight: 600; color: rgb(var(--text-3)); letter-spacing: 0; }
.fit-total__state { font-size: 12.5px; font-weight: 650; color: rgb(var(--area, var(--primary))); }

/* ---- Water -------------------------------------------------------------- */
.fit-water__row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.fit-water__btns { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 132px; }
.fit-water__btns .btn { justify-content: center; }

/* ---- Sessions (strength + stretch) -------------------------------------- */
.fit-session__foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.fit-session__foot .bar { flex: 1; }
.fit-session__count { font-size: 13px; font-weight: 700; color: rgb(var(--text-3)); font-variant-numeric: tabular-nums; }
.fit-session__count.is-done { color: rgb(var(--area, var(--primary))); }

/* The session picker can hold a long label, so let the header wrap rather
   than squeeze the title. */
.fit-session .section-head { flex-wrap: wrap; }
.fit-session .section-action { flex: 1 1 auto; min-width: 0; display: flex; justify-content: flex-end; }
.fit-picker { max-width: 100%; font-size: 13px; padding: 7px 10px; font-weight: 600; }

/* ---- Running ------------------------------------------------------------ */
/* Distance | duration on the first row, notes across the second, and the
   submit button spanning both — steadier than flex at narrow card widths. */
.fit-runform { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px 10px; align-items: end; }
.fit-runform .fit-field--grow { grid-column: 1 / span 2; }
.fit-runform__go { grid-column: 3; grid-row: 1 / span 2; align-self: stretch; height: auto; }

.fit-routine { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 0; padding-top: 14px; border-top: 1px solid rgb(var(--border)); }
.fit-routine__title { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: rgb(var(--text-3)); }
.fit-legs { display: flex; gap: 8px; flex-wrap: wrap; }
.fit-leg {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--r-full);
  font-size: 12.5px; font-weight: 600; color: rgb(var(--text-2));
  background: rgb(var(--surface-2)); border: 1px solid rgb(var(--border));
}
.fit-leg__kind { color: rgb(var(--area, var(--primary))); }

.fit-runs { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.fit-run { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: var(--r-sm); transition: background var(--dur-1) var(--ease); }
.fit-run:hover { background: rgb(var(--surface-2)); }
.fit-run__dist { font-size: 14.5px; font-weight: 650; min-width: 68px; font-variant-numeric: tabular-nums; }
.fit-run__meta { flex: 1; font-size: 13px; color: rgb(var(--text-2)); min-width: 0; overflow-wrap: anywhere; }
.fit-run__del { opacity: 0; flex: none; }
.fit-run:hover .fit-run__del { opacity: 1; }
@media (hover: none) { .fit-run__del { opacity: 0.55; } }

/* ---- Weight ------------------------------------------------------------- */
.fit-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0 12px; }
.fit-metric { display: flex; flex-direction: column; gap: 3px; }
.fit-metric__value { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fit-metric__label { font-size: 11.5px; color: rgb(var(--text-3)); font-weight: 600; }

/* ---- Weekly review ------------------------------------------------------ */
.fit-review__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 18px; }
.fit-review__row { display: flex; flex-direction: column; gap: 2px; }
.fit-review__value { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; color: rgb(var(--career)); font-variant-numeric: tabular-nums; }
.fit-review__label { font-size: 13.5px; font-weight: 600; }
.fit-review__sub { font-size: 12px; color: rgb(var(--text-3)); }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 560px) {
  /* Seven full-width tiles is a long scroll — read them 2-up instead. */
  .view--fitness .stat-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .view--fitness .stat-row .stat { padding: 14px 13px; gap: 10px; }
  .view--fitness .stat-row .stat__icon { width: 34px; height: 34px; }
  .view--fitness .stat-row .stat__value { font-size: 16px; }

  .fit-fields { grid-template-columns: 1fr; }
  .fit-runform { grid-template-columns: 1fr 1fr; }
  .fit-runform .fit-field--grow { grid-column: 1 / span 2; }
  .fit-runform__go { grid-column: 1 / span 2; grid-row: auto; width: 100%; height: 44px; }
  .fit-metrics { grid-template-columns: 1fr 1fr; }
  .fit-hero__tip { max-width: none; }
  .fit-water__row { gap: 14px; }
}

/* ---- Print: the weekly summary only ------------------------------------- */
@media print {
  body.is-print-week .sidebar,
  body.is-print-week .topbar,
  body.is-print-week .mobilenav,
  body.is-print-week .toast,
  body.is-print-week .view--fitness > *:not(.fit-review):not(.page-head) { display: none !important; }

  body.is-print-week { background: #fff; background-image: none; }
  body.is-print-week .page-head__aside { display: none; }
  body.is-print-week .content { padding: 0; }
  body.is-print-week .fit-review {
    margin-top: 0;
    box-shadow: none;
    break-inside: avoid;
    border-color: rgb(var(--border-strong));
  }
  body.is-print-week .fit-review .section-action { display: none; }
}
