/* Layout and components. Only theme tokens (static/themes/*.css) are used for colours, fonts and corners,
   so a new theme changes the look without touching this file. */

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }
h1, h2, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 18px; }
.display { font-size: 24px; line-height: 1.2; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.ok-text { color: var(--ok-text); }
.warn-text { color: var(--high); }
code.secret { font-family: ui-monospace, monospace; letter-spacing: 0.05em; user-select: all; }

/* ---------------------------------------------------------------- shell */

.shell { min-height: 100dvh; display: flex; }
main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(100px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.icon { width: 22px; height: 22px; flex: none; }

.bottom {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}
.bottom a {
  min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted);
  font-size: 11px; font-weight: 500;
  text-decoration: none;
}
.bottom a[aria-current="page"] { color: var(--text); }

.side { display: none; }

@media (min-width: 900px) {
  .bottom { display: none; }
  main { padding: 40px 32px; }
  .side {
    display: flex; flex-direction: column; gap: 4px;
    width: 232px; flex: none;
    padding: 24px 12px;
    border-right: 1px solid var(--border);
    background: var(--card);
    position: sticky; top: 0; height: 100dvh;
  }
  .side-brand { font-family: var(--font-display); font-weight: 700; font-size: 20px; padding: 0 12px 16px; }
  .side a {
    display: flex; align-items: center; gap: 12px;
    min-height: 44px; padding: 0 12px;
    border-radius: var(--radius-control);
    color: var(--muted); text-decoration: none; font-weight: 500;
  }
  .side a:hover { background: var(--bg); color: var(--text); }
  .side a[aria-current="page"] { background: var(--bg); color: var(--text); }
  .side-foot { margin-top: auto; }
}

/* ---------------------------------------------------------------- building blocks */

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.narrow { max-width: 400px; width: 100%; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; flex-direction: column; gap: 2px; }
.page-head.row { flex-direction: row; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
}
.card.compact { padding: 12px 16px; }

/* A card coloured by kind of training: add class "kind kind-<kracht|roeien|lopen|wandelen|doel|anders>". */
.kind-kracht   { --kind-bg: var(--kracht-bg);   --kind-text: var(--kracht-text);   --kind-sub: var(--kracht-sub);   --kind-dot: var(--kracht-dot); }
.kind-roeien   { --kind-bg: var(--roeien-bg);   --kind-text: var(--roeien-text);   --kind-sub: var(--roeien-sub);   --kind-dot: var(--roeien-dot); }
.kind-lopen    { --kind-bg: var(--lopen-bg);    --kind-text: var(--lopen-text);    --kind-sub: var(--lopen-sub);    --kind-dot: var(--lopen-dot); }
.kind-wandelen { --kind-bg: var(--wandelen-bg); --kind-text: var(--wandelen-text); --kind-sub: var(--wandelen-sub); --kind-dot: var(--wandelen-dot); }
.kind-doel     { --kind-bg: var(--doel-bg);     --kind-text: var(--doel-text);     --kind-sub: var(--doel-sub);     --kind-dot: var(--doel-dot); }
.kind-anders, .kind-fietsen { --kind-bg: var(--anders-bg); --kind-text: var(--anders-text); --kind-sub: var(--anders-sub); --kind-dot: var(--anders-dot); }
.card.kind { background: var(--kind-bg); color: var(--kind-text); border-color: transparent; display: flex; flex-direction: column; gap: 6px; }
.card.kind .kicker, .card.kind .sub { color: var(--kind-sub); }
.kicker { font-size: 12px; font-weight: 600; }
.desc { white-space: pre-line; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text);
  font: inherit; font-weight: 600; font-size: 15px;
  text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.ghost { border-color: transparent; }
.btn.icon-btn { width: 44px; padding: 0; }
.card.kind .btn.ghost { color: var(--kind-text); }

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
input:not([type="radio"]):not([type="checkbox"]) {
  min-height: 44px; padding: 0 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  font: inherit; font-weight: 400;
}
input:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.code-input { font-size: 24px; letter-spacing: 0.3em; text-align: center; }
fieldset.choices { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.choices legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
label.choice {
  flex-direction: row; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 999px;
  font-weight: 500; cursor: pointer;
}
label.choice:has(input:checked) { border-color: var(--text); }

.flash { background: var(--ok-bg); color: var(--ok-text); border-radius: var(--radius-control); padding: 10px 14px; font-size: 14px; }
.qr { color: var(--text); background: var(--card); display: flex; justify-content: center; }
.qr svg { width: 220px; height: auto; }

.list { list-style: none; margin: 0; padding: 4px 16px; }
.list li { min-height: 44px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }

details > summary { cursor: pointer; list-style: none; min-height: 28px; }
details > summary::-webkit-details-marker { display: none; }

/* ---------------------------------------------------------------- pain check */

.pain-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.pain-btn {
  min-height: 44px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer;
}
.pain-btn.is-on { background: var(--good); border-color: var(--good); color: #FFFFFF; }
.pain-btn.is-on.is-high { background: var(--high); border-color: var(--high); }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 80px; }
.bar { flex: 1 1 0; height: var(--h); background: var(--good); border-radius: 3px 3px 0 0; min-height: 3px; }
.bar.is-high { background: var(--high); }

.track { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.track-fill { height: 100%; width: var(--p); background: var(--high); border-radius: 4px; }

/* ---------------------------------------------------------------- week */

.week { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.day {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 12px 14px;
}
.day.is-today { border-color: var(--text); }
.day-date { width: 40px; flex: none; display: flex; flex-direction: column; align-items: center; }
.day-date .display { font-size: 20px; }
.day-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.session summary { display: flex; align-items: center; gap: 8px; }
.session .dot { width: 10px; height: 10px; border-radius: 5px; background: var(--kind-dot); flex: none; }
.session .desc { margin-top: 8px; color: var(--muted); }
