/* Knees, in the look of the board: off-white ground, charcoal and white triangles, and one flat pastel per
   step, stacked as wide diamonds. No shadows, no gradients. Condensed capitals for names, mono for figures. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("fonts/martian-mono.woff2") format("woff2");
  font-weight: 400 600; font-stretch: 87.5%; font-style: normal; font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f5f3ee; --board: #ffffff; --row: #ebe8e1; --line: #dedad2; --line-2: #b9b5ad;
  --ink: #2c2c30; --muted: #63636a; --faint: #77777e; --dim: #a9a7a2;
  --accent: #f2a98b; --on-accent: #2c2c30;
  --paper: #2c2c30; --paper-2: #ebe8e1; --pink: #ffffff; --pmuted: #63636a; --perf: #dedad2;
  --band: #2c2c30; --c: #cfdde2;
  --font: "Archivo", system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, monospace;
  --tabs-h: 60px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  font: 400 16px/1.5 var(--font);
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* condensed capitals: names, headings, buttons */
h1, h2, .cap { font-weight: 800; font-stretch: 70%; text-transform: uppercase; }
h1 { font-size: 52px; line-height: 0.92; font-stretch: 64%; }
h2 { font-size: 22px; line-height: 1; letter-spacing: 0.06em; }
/* mono: dates, doses, counts of things */
.meta { font: 500 12px/1.4 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

#app {
  max-width: 520px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px);
}

.iconbtn {
  width: 44px; height: 44px; border-radius: 6px;
  display: inline-grid; place-items: center;
  color: var(--ink); opacity: 0.7;
}
.iconbtn:hover, .iconbtn:active { opacity: 1; }
.iconbtn:disabled { opacity: 0.2; cursor: default; }
.iconbtn svg, .tabs svg, .tick svg, .day svg, .wd svg, .info svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* buttons: paper fill is the one thing to press, the outline is the other way out */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 28px; border-radius: 0;
  font: 800 19px/1 var(--font); font-stretch: 70%; text-transform: uppercase; letter-spacing: 0.08em;
  transition: transform 0.15s var(--ease-out);
}
.btn:active { transform: scale(0.98); }
.btn-paper { background: var(--ink); color: #fff; }
.btn-line { height: 48px; font-size: 15px; box-shadow: inset 0 0 0 1.5px var(--ink); color: var(--ink); } /* taste-skill-ignore: 1.5px outline, as on run */
.btn-wide { display: flex; width: 100%; margin-top: 16px; }

/* figure: charcoal on the step's colour, the working segment in white */
.f-body, .f-far, .f-hl { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.f-body { stroke: var(--ink); }
.f-far { stroke: rgb(44 44 48 / 0.38); }
.f-hl { stroke: #fff; }
.f-head { fill: var(--ink); }
.p-solid { fill: rgb(44 44 48 / 0.2); }
.p-floor { fill: none; stroke: rgb(44 44 48 / 0.2); stroke-linecap: round; stroke-width: 3; }

/* home */
.top { margin-bottom: 18px; }
.top h1 { margin-top: 10px; }
.sum { margin-top: 10px; color: var(--muted); }

/* days are small diamonds: charcoal when done, the coral for today */
.week { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 22px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.wd i { font: 500 11px var(--mono); font-style: normal; color: var(--faint); }
.wd b, .day b {
  width: 42px; height: 42px; display: grid; place-items: center;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  font: 500 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink);
}
.wd b { background: var(--row); }
.wd.is-today b, .day.is-today b { background: var(--accent); }
.wd.is-ticked b, .day.is-ticked b { background: var(--ink); color: #fff; }
.wd svg { width: 16px; height: 16px; stroke-width: 2.6; }

/* the steps: one wide diamond per step, straight on the page ground */
.rows { margin: 0 -16px; }
.row { --cut: 34px; height: 78px; }
.hex {
  height: 100%; display: flex; align-items: center; background: var(--c);
  padding: 0 calc(var(--cut) - 4px) 0 var(--cut);
  clip-path: polygon(0 50%, var(--cut) 0, calc(100% - var(--cut)) 0, 100% 50%, calc(100% - var(--cut)) 100%, var(--cut) 100%);
}
.row-link { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; gap: 12px; }
.step { flex: none; width: 30px; text-align: center; font: 600 13px var(--mono); }
.row-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-text strong { font-weight: 800; font-stretch: 70%; font-size: 20px; line-height: 1.02; text-transform: uppercase; letter-spacing: 0.02em; }
.row-text .meta { font-size: 11px; color: var(--ink); opacity: 0.72; }
.info { flex: none; width: 40px; height: 100%; display: grid; place-items: center; color: var(--ink); opacity: 0.6; }
.info svg { width: 20px; height: 20px; }
.tick { position: relative; flex: none; width: 46px; height: 100%; display: grid; place-items: center; }
.tick::before { content: ""; position: absolute; width: 30px; height: 30px; background: #fff; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.tick svg { position: relative; width: 14px; height: 14px; stroke-width: 3; color: transparent; }
.tick[aria-pressed="true"]::before { background: var(--ink); }
.tick[aria-pressed="true"] svg { color: #fff; }
.row.is-done .row-link { opacity: 0.5; }
.note { margin-top: 18px; font-size: 14px; color: var(--muted); }

/* calendar */
.month { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 10px; }
.month-nav { display: flex; gap: 2px; margin-right: -8px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head span { text-align: center; font: 500 11px var(--mono); color: var(--faint); padding-bottom: 8px; }
.cal-grid { row-gap: 4px; }
.day { position: relative; min-height: 46px; display: grid; place-items: center; }
.day:disabled { cursor: default; }
.day:disabled b { color: var(--dim); }
.day.is-ticked b { color: transparent; }
.day.is-ticked svg { position: absolute; width: 16px; height: 16px; stroke-width: 2.8; color: #fff; }
.cal-sum { margin-top: 16px; }

/* info page: a white card, the figure on the step's colour */
.bar { display: flex; margin: -10px 0 8px -10px; }
.pass { background: var(--board); }
.ph { display: flex; justify-content: space-between; gap: 12px; padding: 13px 20px; background: var(--ink); }
.ph .meta { color: #fff; }
.pbody { padding: 20px 20px 22px; }
.pass h1 { font-size: 46px; }
.fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 20px; border-top: 1.5px solid var(--ink); }
.fields > div { min-width: 0; padding: 10px 0 0; }
.fields > div + div { padding-left: 11px; border-left: 1px solid var(--line); }
.fields dt { font: 500 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.fields dd { margin-top: 3px; font: 600 17px var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; }
.fields small { font-size: 11px; font-weight: 500; }
.stage { margin: 20px -20px 0; background: var(--c); }
.stage svg { display: block; width: 100%; height: auto; max-height: 34dvh; }
.desc li { padding: 10px 0; border-top: 1px solid var(--line); line-height: 1.45; }
.desc li:first-child { border-top: 0; padding-top: 16px; }
.later { padding-top: 12px; border-top: 1px solid var(--line); line-height: 1.45; }
.later b { display: block; margin-bottom: 4px; font: 500 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* workout: the screen is a level. app.js moves .tide (transform only): up on "Up", down on "Lower",
   draining through holds, rests and countdowns. */
#app.view-workout { padding: 0; }
.flow {
  position: fixed; inset: 0; overflow: hidden; overflow: clip; /* clip: focus or scrollIntoView cannot scroll it */
  background: var(--bg); color: var(--ink);
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.tide { position: absolute; left: 0; right: 0; top: 0; height: 100%; transform: translateY(80%); will-change: transform; }
.water { position: absolute; inset: 0 0 -14% 0; transition: opacity 0.6s ease; }
/* flat fills under a charcoal surface line: the step's colour for work and done, grey for waiting */
.water { border-top: 4px solid var(--ink); }
.water.work { background: var(--c); }
.water.calm { opacity: 0; background: var(--row); }
.flow:is([data-kind="ready"], [data-kind="rest"]) .water.calm { opacity: 1; }
.flow:is([data-kind="ready"], [data-kind="rest"]) .water.work { opacity: 0; }

.flow-icon { position: absolute; top: calc(env(safe-area-inset-top) + 10px); }
.flow-back { left: 6px; }
.flow-sound { right: 6px; }
.flow-sets {
  position: absolute; top: calc(env(safe-area-inset-top) + 30px); left: 58px;
  display: flex; gap: 3px;
  transition: transform 0.45s var(--ease-out);
}
.flow[data-state="running"] .flow-sets { transform: translateX(-42px); }
.flow-sets i { width: 28px; height: 4px; background: rgb(44 44 48 / 0.22); overflow: hidden; }
.flow-sets b { display: block; height: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; }

.flow-mid { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 24px; pointer-events: none; }
.flow-mid > * { grid-area: 1 / 1; }
.ctl { display: flex; flex-direction: column; align-items: center; width: min(100%, 340px); text-align: center; }
.ctl h1 { font-size: 50px; }
.ctl .meta { margin-top: 14px; }
.ctl .btn { width: 100%; }
.ctl .btn-paper { margin-top: 32px; }
.ctl .btn-line { margin-top: 10px; }
.done-word { font: 800 112px/0.86 var(--font); font-stretch: 64%; text-transform: uppercase; }
.flow-next { flex-direction: column; gap: 6px; height: auto; min-height: 64px; padding: 12px 20px; }
.flow-next .meta { color: #fff; opacity: 0.7; font-size: 11px; }
.count { display: flex; flex-direction: column; align-items: center; }
.count b {
  font: 800 clamp(200px, 62vw, 340px)/0.8 var(--font); font-stretch: 62%;
  font-variant-numeric: tabular-nums;
}
.count span { margin-top: 20px; font: 800 20px var(--font); font-stretch: 70%; text-transform: uppercase; letter-spacing: 0.08em; }
.flow-hint {
  position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 28px);
  text-align: center; color: var(--ink);
  opacity: 0; transition: opacity 0.4s ease;
}
.flow-hint.is-on { opacity: 1; }

/* which pieces each state shows */
.flow :is(.ctl, .count, .flow-back, .flow-skip) {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s, transform 0.4s var(--ease-out);
}
.flow :is(.ctl, .count) { transform: scale(0.97); }
.flow[data-state="idle"] :is(.ctl:not(.done), .flow-back),
.flow[data-state="paused"] :is(.ctl:not(.done), .flow-back, .flow-skip),
.flow[data-state="running"] .count,
.flow[data-state="done"] :is(.done, .flow-back) {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity 0.3s ease, visibility 0s, transform 0.5s var(--ease-out);
}
.flow[data-state="idle"] .flow-skip { display: none; }
.flow[data-state="done"] .done { transition-delay: 0.3s; }

/* tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg); border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; max-width: 240px; height: var(--tabs-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  font: 800 12px var(--font); font-stretch: 70%; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint);
}
.tabs svg { width: 20px; height: 20px; }
.tabs a[aria-current="page"] { color: var(--ink); }

@media (min-width: 700px) {
  #app { padding-top: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
  .flow-sets, .flow :is(.ctl, .count) { transition-property: opacity, visibility; }
}
