/* Suite design base: the chassis every app in the suite is built on (Workouts, Slipbox, Today).

   One product line, several models. Shared by every app:
   - Archivo at three widths: --w-label (125%) for engraved chassis labels, --w-body (100%) for
     text, --w-readout (68%) for numbers and big titles.
   - Cool aluminium neutrals, square-shouldered shapes (4px keys, 6px panels, 2px chips).
   - Keys with travel (a darker bottom edge that compresses when pressed).
   - The transport bar along the bottom, in the app's body material.
   - ONE orange hotline key per screen: the main action. Orange also marks "now" and done
     states. Nothing else is orange.
   Per app (the model): a body material class on <html> (model-black, model-blue,
   model-silver) for the transport bar, the top band and the icon, plus one signature element
   the app styles itself. Materials are physical: they do not change with the theme.

   Every colour is a token in the blocks below; app stylesheets use the tokens and add their own
   tokens only for their signature element. Components are prefixed ui- so they never collide
   with an app's own class names. Each app serves this file and fonts/ from this folder. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2-variations"), url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  /* neutrals: cool aluminium */
  --ground: #ecedee;
  --surface: #f8f8f9;
  --ink: #15171a;
  --ink-soft: #5a6068;
  --ink-faint: #8e949b;
  --rule: #cdd1d6;
  --fill: rgb(21 23 26 / 0.06);
  --scrim: rgb(15 16 18 / 0.4);
  --shadow: 0 10px 34px rgb(15 16 18 / 0.18);
  --danger: #c8321f;
  --on-danger: #ffffff;

  /* the hotline: the suite's one accent */
  --hotline: #e8501a;
  --hotline-text: #b9400f;   /* the same orange where it is text on the ground */
  --hotline-edge: #a83a12;   /* a hotline key's bottom edge */
  --hotline-soft: rgb(232 80 26 / 0.16);
  --on-hotline: #15171a;     /* ink on orange, like hi-vis gear */

  /* body materials: the same in light and dark */
  --black: #24272b;  --on-black: #e9ebee;  --on-black-soft: #8d939a;
  --blue: #23447f;   --on-blue: #eef2f8;   --on-blue-soft: #a9b8d3;
  --silver: #bfc4c9; --on-silver: #15171a; --on-silver-soft: #464b52;
  --counter: #1b1d20; --counter-hi: #34383d; --on-counter: #e9ebee;   /* tape-counter wheels */

  /* the app's body, set by a model-* class on <html>; black unless an app says otherwise */
  --body: var(--black);
  --on-body: var(--on-black);
  --on-body-soft: var(--on-black-soft);
  --body-key: rgb(255 255 255 / 0.1);       /* a plain key on the body */
  --body-key-edge: rgb(0 0 0 / 0.35);
  --body-key-down: rgb(0 0 0 / 0.28);       /* a latched key (the current screen) */
  --body-grain: none;                        /* silver's brushed finish */

  /* type */
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --w-label: 125%;
  --w-body: 100%;
  --w-readout: 68%;

  /* shape */
  --r-key: 4px;
  --r-panel: 6px;
  --r-sheet: 10px;
  --r-chip: 2px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0f1012;
    --surface: #1a1c1f;
    --ink: #eceded;
    --ink-soft: #9ba1a8;
    --ink-faint: #61676e;
    --rule: #2a2d31;
    --fill: rgb(236 237 237 / 0.07);
    --scrim: rgb(0 0 0 / 0.55);
    --shadow: 0 10px 34px rgb(0 0 0 / 0.6);
    --danger: #ff6450;
    --on-danger: #0f1012;
    --hotline: #ff6b35;
    --hotline-text: #ff8152;
    --hotline-edge: #c24a1c;
    --hotline-soft: rgb(255 107 53 / 0.2);
    --on-hotline: #0f1012;
  }
}
:root[data-theme="dark"] {
  --ground: #0f1012;
  --surface: #1a1c1f;
  --ink: #eceded;
  --ink-soft: #9ba1a8;
  --ink-faint: #61676e;
  --rule: #2a2d31;
  --fill: rgb(236 237 237 / 0.07);
  --scrim: rgb(0 0 0 / 0.55);
  --shadow: 0 10px 34px rgb(0 0 0 / 0.6);
  --danger: #ff6450;
  --on-danger: #0f1012;
  --hotline: #ff6b35;
  --hotline-text: #ff8152;
  --hotline-edge: #c24a1c;
  --hotline-soft: rgb(255 107 53 / 0.2);
  --on-hotline: #0f1012;
}

/* -- models ------------------------------------------------------------------------ */

.model-black {
  --body: var(--black); --on-body: var(--on-black); --on-body-soft: var(--on-black-soft);
}
.model-blue {
  --body: var(--blue); --on-body: var(--on-blue); --on-body-soft: var(--on-blue-soft);
  --body-key: rgb(255 255 255 / 0.12); --body-key-edge: rgb(0 0 0 / 0.32); --body-key-down: rgb(0 0 0 / 0.25);
}
.model-silver {
  --body: var(--silver); --on-body: var(--on-silver); --on-body-soft: var(--on-silver-soft);
  --body-key: rgb(255 255 255 / 0.45); --body-key-edge: rgb(0 0 0 / 0.22); --body-key-down: rgb(0 0 0 / 0.1);
  --body-grain: repeating-linear-gradient(90deg, rgb(255 255 255 / 0.12) 0 1px, transparent 1px 3px);
}

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

/* An engraved chassis label: keys, bar captions, section names on the chassis. Never content. */
.ui-label {
  font-stretch: var(--w-label);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
/* Numbers and big titles. */
.ui-readout {
  font-stretch: var(--w-readout);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* -- the band: a strip of body material across the top of the screen -------------- */

.ui-band {
  height: calc(6px + env(safe-area-inset-top, 0px));
  background: var(--body-grain), var(--body);
}

/* -- the transport bar: the app's body along the bottom ---------------------------- */

.ui-transport {
  background: var(--body-grain), var(--body);
  color: var(--on-body);
  padding: 12px max(14px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
  --key-bg: var(--body-key);
  --key-ink: var(--on-body);
  --key-edge: var(--body-key-edge);
}

/* -- keys -------------------------------------------------------------------------- */

/* A key: rectangular, with travel. On the ground it is a plain outlined key; inside
   .ui-transport it takes the body's key colours; .hot makes it the orange hotline key. */
.ui-key {
  --key-bg: var(--surface);
  --key-ink: var(--ink);
  --key-edge: var(--rule);
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--r-key);
  border-bottom: 3px solid var(--key-edge);
  background: var(--key-bg);
  color: var(--key-ink);
  font-family: var(--font);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.06s, border-bottom-width 0.06s;
}
.ui-transport .ui-key { --key-bg: var(--body-key); --key-ink: var(--on-body); --key-edge: var(--body-key-edge); }
.ui-key.hot { --key-bg: var(--hotline); --key-ink: var(--on-hotline); --key-edge: var(--hotline-edge); }
.ui-key:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 1px; }
/* Latched: a key that stays down, like a Walkman's play key (the screen you are on). */
.ui-key.down, .ui-key[aria-current="page"] {
  transform: translateY(2px); border-bottom-width: 1px;
  background: var(--body-key-down);
}
a.ui-key { text-decoration: none; }
.ui-key:disabled { opacity: 0.4; cursor: default; }
.ui-key svg { width: 14px; height: 14px; fill: currentColor; stroke: none; flex: none; }

/* -- checks, chips, meters, counters ----------------------------------------------- */

.ui-check {
  flex: none;
  width: 22px;
  height: 22px;
  border: 2px solid var(--ink-faint);
  border-radius: 3px;
  display: inline-grid;
  place-items: center;
  transition: border-color 0.15s, background-color 0.15s;
}
.ui-check::after {
  content: "";
  width: 10px; height: 6px;
  border: solid var(--on-hotline); border-width: 0 0 2.5px 2.5px;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform 0.18s ease;
}
.ui-check.done { background: var(--hotline); border-color: var(--hotline); }
.ui-check.done::after { transform: translateY(-1px) rotate(-45deg) scale(1); }

.ui-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: var(--r-chip);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
}

/* A segmented level meter: <div class="ui-segs" style="--n: 12"><i class="on"></i>…</div> */
.ui-segs { display: grid; grid-template-columns: repeat(var(--n, 12), 1fr); gap: 2px; }
.ui-segs i { display: block; height: 6px; background: var(--fill); }
.ui-transport .ui-segs i { background: rgb(255 255 255 / 0.14); }
.ui-segs i.on { background: var(--seg, var(--hotline)); }

/* A tape counter: <span class="ui-counter"><i>0</i><i>0</i><i>4</i></span> */
.ui-counter {
  display: inline-flex; gap: 2px; padding: 3px;
  border-radius: 3px; background: var(--counter);
}
.ui-counter i {
  font-style: normal;
  width: 15px; height: 22px;
  display: grid; place-items: center;
  font-stretch: var(--w-readout); font-weight: 700; font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--on-counter);
  background: linear-gradient(var(--counter-hi), var(--counter) 50%, var(--counter-hi));
  border-radius: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .ui-key, .ui-check, .ui-check::after { transition: none; }
}
