/* Lora, self-hosted: a third-party font request would add a DNS lookup
   and a TLS handshake to every page load, which is the opposite of what we
   just fixed. Latin only.

   One variable file covers every weight.

   swap: text shows immediately in the fallback and reflows when the font
   arrives, rather than leaving a mom looking at a blank page. */
@font-face {
  font-family: 'Lora';
  src: url('/fonts/lora.woff2') format('woff2-variations'),
       url('/fonts/lora.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* momFIT — mobile-first. Moms use this on a phone, in a garage, mid-set:
   big text, big tap targets, no pinch-zooming. */

:root {
  --teal: #46aa9e;
  --teal-dk: #2f8b80;
  --ink: #1c1c1e;
  --muted: #6b7280;
  --line: #e5e0dc;
  --bg: #faf7f5;
  --teal-pale: #eaf6f4;   /* the brand teal, softened — the header band */
  --card: #fff;
  --err: #b91c1c;
  --radius: 12px;
  /* The whole site's typeface. Change this one line to swap it. */
  --font: 'Lora', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.6rem; margin: 0 0 .3rem; }
h3 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; display: flex; align-items: center; gap: .5rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); font-weight: 400; }
.lede { color: var(--muted); margin-bottom: 1.4rem; }
.err { color: var(--err); font-weight: 600; }

/* ---------- chrome ---------- */

/* The logo sits on a soft band of the brand teal. The logo art is
   transparent, so the colour shows through around the letters. */
.site-head {
  padding: 1.25rem 1rem 1rem;
  text-align: center;
  background: var(--teal-pale);
  border-bottom: 1px solid #d5e9e5;
}
.brand img { width: 100%; max-width: 260px; height: auto; display: inline-block; }

.site-foot {
  margin-top: 3rem; padding: 1.5rem 1rem 2.5rem;
  text-align: center; font-size: .8rem; color: var(--muted);
  border-top: 1px solid var(--line);
}
.site-foot p { margin: 0; }

main { max-width: 720px; margin: 0 auto; padding: 0 1rem; }

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

.hero { text-align: center; padding: 1rem 0 0; }
.hero h1 { font-size: clamp(2rem, 8vw, 3rem); margin: .5rem 0 1rem; }

/* Body copy sits narrower than the buttons — long lines are tiring to read,
   and the measure keeps it feeling like a note rather than a page of text. */
/* Left-aligned: a centred multi-line paragraph leaves a ragged last line
   and is harder to read. The block itself still sits centred on the page. */
.hero-copy {
  max-width: 34rem; margin: 0 auto 1rem;
  font-size: 1.05rem; color: #444;
  text-align: left;
}
/* The short reassurance line is display copy, so it stays centred. */
.soft-line { color: var(--muted); text-align: center; }

.rally {
  margin: 1.6rem auto .25rem;
  font-size: clamp(1.15rem, 4.5vw, 1.35rem);
  font-weight: 800;
  color: var(--teal-dk);
  letter-spacing: -.01em;
}

.role-picker { display: grid; gap: .75rem; margin-top: 1.5rem; }
.role {
  display: block; padding: 1.15rem 1rem; border-radius: 999px;
  background: var(--teal); color: #fff; text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.role:active { background: var(--teal-dk); }
.role-alt { background: var(--ink); }
.role-label { display: block; font-size: 1.15rem; font-weight: 700; }
.role-sub { display: block; font-size: .9rem; opacity: .85; }

/* ---------- generic bits ---------- */

.pane { padding-top: .5rem; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
}
.card.soft { background: #fff; }
.card label { display: block; font-weight: 600; font-size: .9rem; margin: .75rem 0 .3rem; }

input[type=text], input[type=password], input[type=number], select, textarea {
  font: inherit; padding: .7rem .75rem; width: 100%;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); min-height: 44px;
}
textarea { resize: vertical; }

.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: .8rem 1.4rem; min-height: 48px;
  border: 0; border-radius: 999px;
  background: var(--teal); color: #fff; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
.btn:active { background: var(--teal-dk); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { min-height: 44px; padding: .55rem 1.05rem; font-size: .9rem; }
.count { font-weight: 400; opacity: .8; }

.link-btn {
  background: none; border: 0; padding: .25rem; cursor: pointer;
  color: var(--muted); text-decoration: underline; font: inherit; font-size: .85rem;
}

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.5rem 0 .5rem; }
.actions .btn { flex: 1 1 auto; }

.row { display: flex; gap: .5rem; align-items: center; }
.row .btn { flex: 0 0 auto; }
.row.tight { justify-content: space-between; margin: .75rem 0; }
.row.tight label { margin: 0; }
.row.tight select { width: auto; min-width: 5.5rem; }

.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.sm { width: 10px; height: 10px; }

/* ---------- steps ---------- */

.steps { display: flex; gap: .35rem; list-style: none; padding: 0; margin: 0 0 1.25rem; font-size: .75rem; }
.steps li { flex: 1; color: var(--muted); text-align: center; }
.steps .n {
  display: block; width: 26px; height: 26px; line-height: 26px; margin: 0 auto .25rem;
  border-radius: 50%; background: #eae4e0; font-weight: 700;
}
.steps li.on .n { background: var(--teal); color: #fff; }
.steps li.done .n { background: var(--ink); color: #fff; }
.steps .l { display: block; }

/* ---------- categories & chips ---------- */

.grid-cards { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.cat {
  font: inherit; cursor: pointer; text-align: left;
  padding: .9rem; min-height: 88px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: .2rem;
}
.cat.on { border-color: var(--teal); background: #f0faf8; }
.cat-name { font-weight: 700; }
.cat-count { font-size: .8rem; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .75rem; }
.chip {
  font: inherit; font-size: .95rem; cursor: pointer;
  padding: .6rem .85rem; min-height: 44px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink);
}
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }

.ex-block { margin-bottom: 1.75rem; }
.add-row { display: flex; gap: .5rem; }

/* ---------- groups ---------- */

.split { display: grid; gap: 1.5rem; }
.group-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem; margin-bottom: .6rem; }
.group-head strong { display: inline-flex; align-items: center; gap: .4rem; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.group-head .muted { font-size: .85rem; }
.group-ex { list-style: none; padding: 0; margin: .5rem 0 0; }
.group-ex li { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; font-size: .95rem; }

.rep-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.rep-field { flex: 1 1 4.5rem; }
.rep-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .2rem; }

/* ---------- saved ---------- */

.saved {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .9rem 1rem; margin-bottom: .5rem; min-height: 56px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.saved .muted { font-size: .85rem; }

/* ---------- the workout (what she reads mid-set) ---------- */

.workout h2 { font-size: 1.8rem; }
.note {
  background: #f0faf8; border-left: 4px solid var(--teal);
  padding: .8rem 1rem; border-radius: 0 10px 10px 0; margin-bottom: 1.5rem;
}
.wgroup {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1.25rem;
}
.wgroup h3 { margin-top: 0; font-size: 1.3rem; }
.wsub { color: var(--muted); font-weight: 600; margin: 0 0 .75rem; }

.table-wrap { overflow-x: auto; }
.workout table { width: 100%; border-collapse: collapse; }
.workout th, .workout td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
.workout thead th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.workout th.ex { font-weight: 700; }
.workout .num { text-align: right; white-space: nowrap; }
.workout tbody tr:last-child th, .workout tbody tr:last-child td { border-bottom: 0; }

.how { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .95rem; }
.how p { margin: .25rem 0 0; color: var(--muted); }

.copied { color: var(--teal-dk); font-weight: 600; }

/* On a phone the sets grid gets cramped, so each exercise becomes its own
   block with the set labels inlined. Easier to read at arm's length. */
@media (max-width: 560px) {
  .workout thead { display: none; }
  .workout table, .workout tbody, .workout tbody tr, .workout tbody th, .workout tbody td { display: block; width: 100%; }
  .workout tbody tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .workout tbody tr:last-child { border-bottom: 0; }
  .workout th.ex { font-size: 1.15rem; padding: 0 0 .4rem; border: 0; }
  .workout .num {
    display: flex; justify-content: space-between; align-items: baseline;
    text-align: left; padding: .3rem 0; border: 0; font-size: 1.05rem; font-weight: 600;
  }
  .workout .num::before {
    content: attr(data-set);
    font-size: .85rem; font-weight: 400; color: var(--muted);
  }
}

@media (min-width: 620px) {
  .grid-cards { grid-template-columns: repeat(4, 1fr); }
  .split { grid-template-columns: 1fr 1fr; }
  .actions .btn { flex: 0 0 auto; }
}

@media print {
  .no-print, .site-foot, .brand { display: none; }
  body { background: #fff; }
  .wgroup { break-inside: avoid; border-color: #ccc; }
}

/* ---------- admin ---------- */

.trainer-tag {
  margin: .4rem 0 0; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted);
}
.trainer-tag a { color: var(--muted); }

.login-pane { max-width: 26rem; margin: 0 auto; }
.login-pane .actions { margin-bottom: 0; }
.small-note { font-size: .85rem; text-align: center; }

.admin-tabs {
  display: flex; gap: .5rem; justify-content: center;
  margin: .9rem 0 0; flex-wrap: wrap;
}
.admin-tabs a {
  padding: .5rem .9rem; border-radius: 999px;
  font-size: .9rem; font-weight: 600; text-decoration: none;
  color: var(--muted); border: 1px solid #cfe4e0; background: #fff;
}
.admin-tabs a.on { background: var(--teal); border-color: var(--teal); color: #fff; }

/* saved workout rows */
.wo-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem; margin-bottom: .6rem;
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
}
.wo-main { display: flex; flex-direction: column; gap: .15rem; min-width: 12rem; flex: 1 1 auto; }
.wo-main .muted { font-size: .85rem; }
.wo-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.btn.danger { background: #b91c1c; }
.btn.danger:active { background: #991b1b; }

.reveal { display: inline-block; margin: .1rem 0 .2rem; }

/* mom's page */
.day-label {
  margin: 0 0 .2rem; font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--teal-dk);
}
#previous-wrap { margin-top: 2rem; }
#previous-wrap h3 { margin-bottom: .6rem; }
input[type=date] {
  font: inherit; padding: .7rem .75rem; width: 100%; min-height: 44px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}

/* exercise descriptions */
.ex-name { display: block; }
.ex-desc {
  display: block; margin-top: .15rem;
  font-size: .85rem; font-weight: 400; color: var(--muted);
  max-width: 34rem;
}
.add-box {
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius);
  padding: .9rem; display: flex; flex-direction: column; gap: .5rem;
}
.add-title { margin: 0; font-weight: 700; font-size: .95rem; }
.add-box .btn { align-self: flex-start; }

/* removable chips */
.chip-wrap { display: inline-flex; align-items: stretch; }
.chip-wrap.is-custom .chip { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.chip-x {
  font: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer;
  min-width: 40px; min-height: 44px; padding: 0 .5rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--muted);
  border: 1px solid var(--line); border-radius: 0 999px 999px 0;
}
.chip-x:hover, .chip-x:active { background: #fdecec; color: var(--err); border-color: #f3c6c6; }

.group-ex li { justify-content: flex-start; }
.ge-name { flex: 1 1 auto; }
.group-ex .chip-x {
  min-width: 34px; min-height: 34px; border-radius: 999px; flex: 0 0 auto;
}

/* ---------- collapsible groups (mom's page) ---------- */

details.wgroup > summary {
  list-style: none;                /* drop the default triangle */
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .1rem 2rem .1rem 0;      /* room for the chevron */
  position: relative;
  min-height: 44px;                 /* a comfortable tap target */
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
}
details.wgroup > summary::-webkit-details-marker { display: none; }

.wgroup-title { flex: 0 0 auto; }

/* the exercise names, shown only once the group is folded away */
.wgroup-hint {
  display: none;
  font-size: .9rem; font-weight: 400; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
details.wgroup:not([open]) .wgroup-hint { display: block; }

/* chevron, pointing down when open */
details.wgroup > summary::after {
  content: '';
  position: absolute; right: .25rem; top: 50%;
  width: 10px; height: 10px;
  border-right: 2.5px solid var(--muted);
  border-bottom: 2.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .15s ease;
}
details.wgroup:not([open]) > summary::after {
  transform: translateY(-50%) rotate(-45deg);
}

/* a folded group reads as done: quieter, and tighter on the page */
details.wgroup:not([open]) {
  background: #f7f5f3;
  padding-top: .65rem;
  padding-bottom: .65rem;
}
details.wgroup:not([open]) .wgroup-title { color: var(--muted); }
details.wgroup:not([open]) .dot { opacity: .45; }

@media print {
  details.wgroup > summary::after { display: none; }
}

/* editing an exercise */
.chip-edit {
  font: inherit; font-size: .95rem; line-height: 1; cursor: pointer;
  min-width: 40px; min-height: 44px; padding: 0 .5rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--muted);
  border: 1px solid var(--line); border-left: 0; border-radius: 0 999px 999px 0;
}
.chip-edit:hover, .chip-edit:active { background: var(--teal-pale); color: var(--teal-dk); }
.chip-wrap .chip { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }

.add-box.editing { border-style: solid; border-color: var(--teal); background: var(--teal-pale); }
.ed-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.danger-link { color: var(--err); align-self: flex-start; }

/* add / edit exercise form */
.field-label {
  display: block; font-size: .85rem; font-weight: 700;
  margin: .35rem 0 .25rem;
}
.field-label .opt {
  font-weight: 400; color: var(--muted); font-size: .8rem;
}
.field-hint { margin: .25rem 0 0; font-size: .8rem; color: var(--teal-dk); }
.field-hint.short { color: var(--muted); }
input.bad, textarea.bad {
  border-color: var(--err);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .12);
}
.add-box .err { margin: .4rem 0 0; }

/* how a group is performed */
.style-choice {
  border: 1px solid var(--line); border-radius: 10px;
  margin: .75rem 0 0; padding: .6rem .8rem .7rem;
}
.style-choice legend { font-size: .85rem; font-weight: 700; padding: 0 .35rem; }
/* `.card label` sets display:block and wins on specificity, so this has to
   out-rank it — otherwise the radio lands above its own wording. */
.style-choice label.style-opt {
  display: flex; align-items: flex-start; gap: .6rem;
  margin: 0; font-size: 1rem; font-weight: 400;
  padding: .5rem .2rem; min-height: 44px; cursor: pointer;
}
.style-choice label.style-opt input {
  width: auto; min-height: 0; margin-top: .25rem; flex: 0 0 auto;
}
.style-text { display: flex; flex-direction: column; }
.style-name { font-weight: 600; }
.style-note { font-size: .82rem; color: var(--muted); }

/* the full list of earlier workouts on a mom's page */
.wo-past { align-items: center; }
.wo-past-main { display: flex; flex-direction: column; gap: .15rem; }
.wo-past-main .muted { font-size: .85rem; }
#previous-wrap .lede { margin-bottom: .9rem; }

/* a workout built ahead of time, not yet visible to anyone */
.badge {
  display: inline-block; margin-left: .5rem;
  padding: .15rem .5rem; border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; vertical-align: middle;
}
.badge.scheduled { background: var(--teal-pale); color: var(--teal-dk); border: 1px solid #cfe4e0; }

/* warm-up and cool-down */
.phase {
  background: var(--teal-pale); border: 1px solid #d5e9e5;
  border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1.25rem;
}
.phase h3 {
  margin: 0 0 .4rem; font-size: 1.05rem; color: var(--teal-dk);
  text-transform: uppercase; letter-spacing: .06em;
}
.phase p { margin: 0 0 .4rem; }
.phase p:last-child { margin-bottom: 0; }

/* warm-up / cool-down items on a mom's page */
.phase-list { list-style: none; padding: 0; margin: 0; }
.phase-list li {
  padding: .45rem 0; border-bottom: 1px solid #d5e9e5;
  display: flex; flex-direction: column; gap: .1rem;
}
.phase-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.phase-name { font-weight: 700; font-size: 1.05rem; }
.phase-desc { font-size: .88rem; color: #4b5f5c; }

/* Black, not teal: teal marks a chosen exercise, so a teal button beside the
   chips reads as part of the selection rather than the action on it. */
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:active { background: #000; }
.btn.dark[disabled] { opacity: .4; }

/* warm-up / cool-down shown in the builder as fixed, not groupable */
.phase-pin {
  background: var(--teal-pale); border: 1px dashed #cfe4e0;
  border-radius: var(--radius); padding: .75rem .9rem; margin-bottom: .6rem;
}
.phase-pin p { margin: .35rem 0 0; font-size: .85rem; }
