/* HelloReps design tokens - lifted from the app's Palette.swift (BRIEF.md section 6).
   Light palette on :root; dark redefines only the tokens. */
:root {
  color-scheme: light dark;

  --background: #F2EEE9;
  --card: #FFFFFF;
  --card-sunken: #E9E4DD;
  --card-raised: #FFFFFF;
  --card-muted: #EDE7DF;
  --accent: #C2571F;
  --accent-soft: #F7E3D6;
  --success: #1F6B45;
  --warning: #8A5A22;
  --danger: #B03A28;
  --text-primary: #171412;
  --text-secondary: #4A443F;
  --text-muted: #6F6862;
  --text-meta: #7C736C;
  --separator: #DCD5CC;
  --track: #E4DED6;
  --border-dashed: #C4BCB2;

  /* Objects, not surfaces - fixed in both appearances. */
  --set-card-face: #FFFFFF;
  --focal-control: #E6E0D9;
  --keypad-sheet: #E9E3DB;
  --keypad-key: #FDFBF8;
  --mark-ground: #1F1B17;

  /* In light mode the focal element is the most saturated thing, and white on off-white
     lifts off nothing, so it gets a ring and a soft shadow instead. */
  --focal-shadow: 0 10px 30px -12px rgba(23, 20, 18, 0.25);

  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter Tight", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-s: 14px;
  --radius-m: 16px;
  --radius-l: 20px;
  --radius-xl: 24px;

  --measure: 62ch;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #100F0E;
    --card: #1A1817;
    --card-sunken: #151413;
    --card-raised: #1D1B19;
    --card-muted: #242220;
    --accent: #E2662B;
    --accent-soft: #2A1A11;
    --success: #7FC49A;
    --warning: #D9A05B;
    --danger: #D4544A;
    --text-primary: #F5F1ED;
    --text-secondary: #B9B1AA;
    --text-muted: #9C948C;
    --text-meta: #8C8580;
    --separator: #242220;
    --track: #2A2725;
    --border-dashed: #4A4643;
    --focal-shadow: none;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.005em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.75rem, 7vw, 5.25rem); }
h2 { font-size: clamp(2rem, 4.5vw, 3.25rem); }
h3 { font-size: clamp(1.375rem, 2.5vw, 1.75rem); }
h1:focus { outline: none; }

p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--text-meta); text-underline-offset: 0.15em; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

img { max-width: 100%; height: auto; display: block; }

hr { border: 0; border-top: 1px solid var(--separator); margin: 0; }

code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

table { border-collapse: collapse; width: 100%; max-width: 48rem; }
th, td { text-align: left; padding: 0.6rem 0.75rem 0.6rem 0; border-bottom: 1px solid var(--separator); vertical-align: top; }
th { font-family: var(--font-display); font-weight: 600; font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
td.num { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Type helpers ---------- */
.eyebrow {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.numeral {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.numeral .unit {
  font-size: 0.4em;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.15em;
}

.lede { font-size: 1.25rem; color: var(--text-secondary); }
.muted { color: var(--text-muted); }
.meta { color: var(--text-meta); font-size: 0.9375rem; }

/* ---------- Layout ---------- */
.container { width: min(100% - 2 * var(--gutter), 76rem); margin-inline: auto; }
.narrow { width: min(100% - 2 * var(--gutter), 44rem); margin-inline: auto; }
.section { padding-block: clamp(3.5rem, 9vw, 7.5rem); border-top: 1px solid var(--separator); }
.section--first { border-top: 0; }
.split {
  display: grid;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
@media (min-width: 52rem) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .split--flip > :first-child { order: 2; }
}
.copy-list { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1rem; }
.copy-list li { padding-left: 1.25rem; position: relative; max-width: var(--measure); }
.copy-list li::before {
  content: ""; position: absolute; left: 0; top: 0.65em; width: 0.5rem; height: 2px; background: var(--text-meta);
}
.copy-list strong { color: var(--text-primary); }

.stat-row { display: flex; flex-wrap: wrap; gap: 2rem 3rem; margin-top: 2rem; }
.stat-row .numeral { font-size: 3rem; }
.stat-row .label { display: block; color: var(--text-muted); font-size: 0.9375rem; margin-top: 0.25rem; }

/* ---------- Surfaces ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius-l);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.card--sunken { background: var(--card-sunken); }
.card--muted { background: var(--card-muted); }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; padding: 0.75rem 1.5rem;
  border-radius: 999px; border: 0;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  background: var(--card-muted); color: var(--text-primary);
}
.button--primary { background: var(--accent); color: #FFFFFF; }
.button--primary:hover { filter: brightness(1.06); }
.button--quiet { background: transparent; color: var(--text-secondary); }
.button:disabled { opacity: 0.55; cursor: default; }
/* Sign in with Apple: black on light, white on dark, as Apple asks; the logo rides on currentColor. */
.button--apple { background: #000000; color: #FFFFFF; width: 100%; max-width: 26rem; }
.button--apple svg { width: 1.1em; height: 1.1em; fill: currentColor; }
@media (prefers-color-scheme: dark) { .button--apple { background: #FFFFFF; color: #000000; } }
.form-divider { margin: 1rem 0 1.25rem; font-size: 0.9375rem; }

/* ---------- Forms ---------- */
.form { max-width: 26rem; }
.field { display: grid; gap: 0.4rem; margin-bottom: 1.1rem; }
.field label { font-weight: 600; font-size: 0.9375rem; }
.field input, .field select {
  font: inherit; color: var(--text-primary);
  background: var(--card); border: 1px solid var(--separator);
  border-radius: var(--radius-s); padding: 0.8rem 1rem; min-height: 3rem; width: 100%;
}
.field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field .hint { color: var(--text-meta); font-size: 0.875rem; }
.form-error {
  background: var(--accent-soft); color: var(--text-primary);
  border-radius: var(--radius-s); padding: 0.85rem 1rem; margin-bottom: 1.1rem;
}
.form-success { background: var(--card-sunken); border-radius: var(--radius-s); padding: 0.85rem 1rem; margin-bottom: 1.1rem; }
.validation-message { color: var(--danger); font-size: 0.875rem; }
.invalid { border-color: var(--danger) !important; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; max-width: 30rem; }
.inline-form input { flex: 1 1 14rem; font: inherit; color: var(--text-primary); background: var(--card); border: 1px solid var(--separator); border-radius: 999px; padding: 0.75rem 1.25rem; min-height: 3rem; }
.inline-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

/* ---------- Phone frame for screenshots ---------- */
.phone {
  --bezel: 10px;
  width: min(100%, 21rem);
  margin-inline: auto;
  background: var(--mark-ground);
  padding: var(--bezel);
  border-radius: calc(var(--radius-xl) + var(--bezel) + 18px);
  box-shadow: var(--focal-shadow);
}
.phone img { border-radius: calc(var(--radius-xl) + 18px); width: 100%; aspect-ratio: 1206 / 2622; object-fit: cover; }
.phone-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(0.75rem, 2vw, 2rem); align-items: start; }
.phone-pair .phone { width: 100%; }
figure { margin: 0; }
figcaption { text-align: center; margin-top: 0.75rem; color: var(--text-meta); font-size: 0.9375rem; }

/* ---------- The rest clock (the one thing that moves) ---------- */
.rest-clock {
  background: var(--card);
  border-radius: var(--radius-l);
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  box-shadow: var(--focal-shadow);
  max-width: 26rem;
}
.rest-clock .numeral { font-size: 3.25rem; }
.rest-clock .eyebrow { margin: 0; }

/* ---------- Site chrome ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-block: 1.1rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.65rem; text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.375rem;
  letter-spacing: 0.08em; text-transform: uppercase; line-height: 1;
}
.site-nav { display: flex; gap: 1.25rem; align-items: center; font-size: 0.9375rem; }
.site-nav a { text-decoration: none; color: var(--text-secondary); }
.site-nav a:hover { color: var(--text-primary); }
.site-footer { border-top: 1px solid var(--separator); padding-block: 2.5rem; color: var(--text-muted); font-size: 0.9375rem; }
.site-footer .container { display: grid; gap: 1.25rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.site-footer a { color: var(--text-secondary); }
/* ---------- Administration ---------- */
/* A sidebar down the left with the content beside it. Below 52rem the two stack, and the navigation
   becomes a row that scrolls sideways rather than a column that pushes the page down. */
.admin-shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
.admin-side {
  display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--separator);
}
.admin-side .wordmark .muted { font-weight: 400; }
.admin-nav { display: flex; gap: 0.25rem; overflow-x: auto; font-size: 0.9375rem; }
.admin-nav a {
  text-decoration: none; color: var(--text-secondary); white-space: nowrap;
  padding: 0.5rem 0.75rem; border-radius: 8px;
}
.admin-nav a:hover { color: var(--text-primary); background: var(--card); }
.admin-nav a.active { color: var(--text-primary); background: var(--accent-soft); font-weight: 600; }
.admin-side__account { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.admin-side__account .button { padding-inline: 0; }
.admin-side .version { margin: 0; font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.admin-main { min-width: 0; padding-inline: var(--gutter); }
@media (min-width: 52rem) {
  .admin-shell { grid-template-columns: 15rem minmax(0, 1fr); }
  .admin-side { border-bottom: 0; border-right: 1px solid var(--separator); padding-block: 1.5rem 2rem; }
  .admin-nav { flex-direction: column; overflow-x: visible; gap: 0.125rem; }
  /* The sign-out and the version sink to the bottom, clear of the sections. */
  .admin-side__account { margin-top: auto; }
  .admin-nav__away { margin-top: 0.75rem; border-top: 1px solid var(--separator); border-radius: 0; padding-top: 0.9rem; }
}
.admin-page h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.table-scroll { overflow-x: auto; }
.admin-table, .data-table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
.admin-table th, .admin-table td,
.data-table th, .data-table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--separator); white-space: nowrap; }
.admin-table th, .data-table th { color: var(--text-muted); font-weight: 500; }
.data-table td { font-variant-numeric: tabular-nums; }
/* A row of counts: the figure large, its name quiet under it. Wraps to as many columns as fit. */
.admin-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem 1.5rem; margin: 1rem 0; }
.admin-figures dt { color: var(--text-muted); font-size: 0.875rem; }
.admin-figures dd { margin: 0.15rem 0 0; font-size: 1.75rem; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* ---------- Your training ---------- */
.history { list-style: none; padding-left: 0; max-width: var(--measure); }
/* A super set on the history page: its exercises held together by a rule down the side, no accent. */
.superset { border-left: 3px solid var(--separator); padding-left: 1rem; margin: 1.5rem 0; }
.superset > .eyebrow { margin-bottom: 0; }
.history li { padding-block: 1rem; border-bottom: 1px solid var(--separator); margin-bottom: 0; }
.history li a { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: baseline; text-decoration: none; }
.history li a:hover .history-title { text-decoration: underline; }
.history-title { font-weight: 600; color: var(--text-primary); }
.history li time { color: var(--text-muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.history li p { margin: 0.25rem 0 0; font-size: 0.9375rem; }
.pager { display: flex; gap: 1.25rem; align-items: baseline; margin-top: 1.5rem; }
.site-footer .version { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.page { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.page h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
.page h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-top: 2.5rem; }
.page ul { padding-left: 1.25rem; max-width: var(--measure); }
.page li { margin-bottom: 0.4rem; }

/* ---------- Blazor chrome ---------- */
#blazor-error-ui {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  background: var(--card-raised); color: var(--text-primary);
  border-top: 1px solid var(--separator); padding: 0.75rem var(--gutter);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: var(--gutter); top: 0.75rem; }
