/* Client side: Ringside as a working tool (spec §6.6). Cream ground, ink text, crimson only for
   things that need action. Bevan for the greeting and page titles only; Archivo for reading;
   Space Mono for every number. Square corners, flat fills, no shadows, no gradients. */

:root {
  --white: #FFFFFF;
  --line: rgba(36, 30, 27, 0.14);       /* ink hairline on cream */
  --line-strong: rgba(36, 30, 27, 0.55);
  --muted: rgba(40, 35, 32, 0.74);      /* secondary copy on cream (≥ 4.5:1) */
  --tap: 48px;
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink-text);
  font: 400 17px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
.num { font-family: var(--font-mono); font-size: 0.94em; letter-spacing: -0.01em; }

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

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.btn--primary:focus-visible, .btn--ink:focus-visible { outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }

/* ---------------------------------------------------------------- frame */

.wrap {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
main.wrap { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }

.top { border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.mark {
  width: 38px; height: 38px; flex: none;
  color: var(--ink);
  background-color: currentColor;
  -webkit-mask: url("/brand/chiron.svg") center / contain no-repeat;
  mask: url("/brand/chiron.svg") center / contain no-repeat;
}
.wordmark {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}

.loading { padding: 40px 0; color: var(--muted); font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------------------------------------------------------------- type */

.greeting, .title {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.02;
  letter-spacing: -0.005em;
}
.greeting { font-size: clamp(38px, 11vw, 52px); margin: 32px 0 10px; }
.title { font-size: clamp(30px, 8.5vw, 40px); margin: 28px 0 12px; }
.title--form { font-size: clamp(26px, 7.4vw, 34px); margin: 12px 0 18px; }
.lede { font-size: 18px; line-height: 1.5; margin-bottom: 20px; }
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker .num { font-size: 1em; }
.foot { margin-top: 28px; color: var(--muted); font-size: 15px; }

/* ---------------------------------------------------------------- home rows */

.rows { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  color: var(--ink-text);
  text-decoration: none;
  background: transparent;
}
.row-main { display: grid; gap: 3px; flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 18px; line-height: 1.25; color: var(--ink); }
.row-detail { font-size: 15px; color: var(--muted); }
.row-go { font-family: var(--font-mono); font-size: 22px; line-height: 1; color: var(--ink); }

.row--due { border: 1.5px solid var(--ink); border-left: 6px solid var(--accent); background: var(--white); }
.row--due .row-detail { color: var(--ink-text); font-weight: 500; }
.row--due .row-go { color: var(--accent); }
.row--done { border-style: dashed; }
.row--done .row-title { color: var(--muted); font-weight: 500; }
a.row:hover { border-color: var(--ink); }
a.row--due:hover { border-left-color: var(--accent); }
a.row--due:hover .row-title { text-decoration: underline; text-underline-offset: 3px; }
a.row:active { background: rgba(36, 30, 27, 0.05); }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 54px;
  padding: 0 22px;
  border: 1.5px solid transparent;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { cursor: default; opacity: 0.45; }
.btn--primary { background: var(--accent); color: var(--white); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover-deep); }
.btn--ink { background: var(--ink); color: var(--cream-text); }
.btn--ink:hover:not(:disabled) { background: #000; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--ghost:hover:not(:disabled) { background: rgba(36, 30, 27, 0.06); }
.btn--text {
  min-height: var(--tap);
  padding: 0 4px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.back {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: var(--tap);
  margin-top: 8px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.back:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------------------------------------------------------------- stepper */

.step-count { margin-bottom: 8px; }
.bar { height: 4px; background: var(--line); margin-bottom: 24px; }
.bar-fill { height: 100%; width: 0; background: var(--ink); }
.step-title { font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--ink); margin-bottom: 14px; }
.intro { font-size: 17px; margin-bottom: 16px; }
.note { font-size: 15px; color: var(--muted); margin-bottom: 16px; padding-left: 12px; border-left: 3px solid var(--line-strong); }
.note--draft { color: var(--ink-text); }
.outro { color: var(--muted); font-size: 15px; margin: 4px 0 18px; }

.step-nav { display: flex; gap: 10px; margin-top: 28px; }
.step-nav .btn { flex: 1; }
.step-nav .btn--ghost { flex: 0 0 auto; min-width: 104px; }

.step-status:empty { display: none; }
.step-status { margin-top: 20px; padding: 14px 16px; border: 1px solid var(--line-strong); display: grid; gap: 12px; }
.step-status--error { border: 1.5px solid var(--accent); border-left-width: 6px; }
.step-status .btn { justify-self: start; min-height: var(--tap); }

/* ---------------------------------------------------------------- fields */

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.field { margin: 0 0 28px; }
.label { display: block; font-weight: 600; font-size: 17px; line-height: 1.35; color: var(--ink); margin-bottom: 6px; }
.req { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.helper { font-size: 14.5px; line-height: 1.45; color: var(--muted); margin: -2px 0 10px; }
.field-error { margin-top: 8px; color: var(--accent); font-size: 15px; font-weight: 600; }
.field-error::before { content: "! "; font-family: var(--font-mono); }

input[type="text"], input[type="email"], input[type="date"], textarea, select {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 0;
  background: var(--white);
  color: var(--ink-text);
  font: 400 17px/1.4 var(--font-body);
  -webkit-appearance: none;
  appearance: none;
}
textarea { min-height: 104px; resize: vertical; }
select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23241E1B' stroke-width='2'/%3E%3C/svg%3E");
  background-position: right 14px center;
  background-size: 12px 8px;
  background-repeat: no-repeat;
}
input:hover, textarea:hover, select:hover { border-color: var(--ink); }
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--ink); }
.is-invalid input[type="text"], .is-invalid input[type="email"], .is-invalid input[type="date"], .is-invalid textarea, .is-invalid select { border-color: var(--accent); }

.num-input, .date-input { font-family: var(--font-mono) !important; letter-spacing: -0.01em; }
.num-input { width: 8.5ch !important; display: inline-block !important; text-align: right; }
.num-input--wide { width: 10ch !important; }
.date-input { width: 12.5rem !important; max-width: 100%; }
.with-unit { display: inline-flex; align-items: center; gap: 10px; }
.unit { font-family: var(--font-mono); font-size: 16px; color: var(--muted); }

/* choice / multi / consent rows */
.opts { display: grid; gap: 8px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  min-height: 52px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  background: var(--white);
  cursor: pointer;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover { border-color: var(--line-strong); }
.opt-input {
  -webkit-appearance: none; appearance: none;
  flex: none;
  width: 22px; height: 22px;
  margin: 0;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--white);
  display: grid; place-content: center;
  cursor: pointer;
}
.opt-input[type="radio"] { width: 17px; height: 17px; margin: 3px 2px; transform: rotate(45deg); } /* a diamond: one choice, still no radius */
.opt-input::before { content: ""; width: 9px; height: 9px; background: var(--ink); transform: scale(0); }
.opt-input[type="checkbox"]::before {
  width: 12px; height: 7px; background: transparent;
  border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
  transform: scale(0) rotate(-45deg); margin-top: -3px;
}
.opt-input:checked::before { transform: scale(1); }
.opt-input[type="checkbox"]:checked::before { transform: scale(1) rotate(-45deg); }
.opt:has(.opt-input:checked) { border-color: var(--ink); background: var(--ink); color: var(--cream-text); }
.opt:has(.opt-input:checked) .opt-input { border-color: var(--cream-text); background: var(--ink); }
.opt:has(.opt-input:checked) .opt-input::before { background: var(--cream-text); }
.opt:has(.opt-input[type="checkbox"]:checked) .opt-input::before { background: transparent; border-color: var(--cream-text); }
.opt:has(.opt-input:checked) .req { color: rgba(241, 236, 228, 0.7); }
.opt:has(.opt-input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.opt-input:focus-visible { outline: none; }
.opt--consent .opt-text { font-size: 15.5px; }
.is-invalid .opt, .is-invalid .seg-opt { border-color: var(--accent); }

/* square tiles: 1–5 scales, 0–7 habit days, intensities */
.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.seg--days { grid-template-columns: repeat(4, 1fr); }
.seg--words { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 440px) { .seg--days { grid-template-columns: repeat(8, 1fr); } }
.seg-opt {
  display: grid; place-items: center;
  min-height: 52px;
  border: 1.5px solid var(--line-strong);
  background: var(--white);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.seg-text { font-family: var(--font-mono); font-size: 19px; font-weight: 700; color: var(--ink); }
.seg--words .seg-text { font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; }
.seg-opt:hover { border-color: var(--ink); }
.seg-opt:has(input:checked) { background: var(--ink); border-color: var(--ink); }
.seg-opt:has(input:checked) .seg-text { color: var(--cream-text); }
.seg-opt:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.seg-scale { margin-top: 6px; font-size: 13px; color: var(--muted); }

.habits { display: grid; gap: 22px; }
.habit-text { font-size: 16.5px; margin-bottom: 8px; color: var(--ink-text); }

/* repeating rows: weights, training sessions */
.rows-edit { display: grid; gap: 12px; }
.row-edit { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); background: var(--white); }
.row-edit--weight { grid-template-columns: 1fr auto; align-items: center; padding: 10px 12px; }
.row-edit-title { font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.row-edit .btn--text { justify-self: start; }
.pair { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.pair .mini { flex: 1 1 8rem; }
.row-edit--weight .date-input { width: 11.5rem !important; }
.mini { display: grid; gap: 4px; }
.mini-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.rows-edit > .btn--text { justify-self: start; }

/* ---------------------------------------------------------------- photos */

.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot-wrap { display: grid; gap: 6px; align-content: start; }
.slot {
  position: relative;
  display: grid; align-content: space-between; justify-items: start;
  aspect-ratio: 3 / 4;
  padding: 10px;
  border: 1.5px dashed var(--line-strong);
  background: var(--white);
  cursor: pointer;
  overflow: hidden;
}
.slot:hover { border-color: var(--ink); }
.slot:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.slot-pose { position: relative; z-index: 1; font-weight: 700; font-size: 16px; color: var(--ink); background: var(--white); padding: 0 4px; }
.slot-hint { position: relative; z-index: 1; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); background: var(--white); padding: 2px 4px; }
.slot-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot.has-photo { border-style: solid; border-color: var(--ink); }

/* ---------------------------------------------------------------- sent / done */

.sent { padding-top: 12px; }
.sent .title { margin-top: 40px; }
.sent .btn { margin-top: 8px; }

/* ---------------------------------------------------------------- enquiry */

.turnstile-wrap { margin: 4px 0 8px; }
.turnstile { min-height: 65px; }

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: no-preference) {
  .btn, .row, .opt, .seg-opt, input, textarea, select { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
  .bar-fill { transition: width 200ms ease; }
  .opt-input::before { transition: transform 100ms ease; }
}
