/* The Weigh House: design tokens and the one self-hosted font. Dark only.
 *
 * Font: Barlow Condensed 1.422 (Jeremy Tribby, SIL Open Font License 1.1; ../fonts/OFL.txt),
 * from github.com/jpt/barlow tag 1.422, fonts/ttf/BarlowCondensed-{SemiBold,Bold}.ttf (not committed).
 * Subset (fontTools 4.46, brotli) for each weight:
 *   python3 -m fontTools.subset BarlowCondensed-Bold.ttf \
 *     --unicodes="U+0020-007E,U+00A0-00FF,U+00B7,U+2014,U+2013,U+2018,U+2019,U+201C,U+201D,U+2026,U+2039,U+203A" \
 *     --flavor=woff2 --layout-features='kern,liga,tnum,lnum,ccmp,locl,mark,mkmk' \
 *     --output-file=barlow-condensed-700.woff2          (and SemiBold -> -600.woff2)
 * The files are pinned by SHA-256 in worker/tests/unit/tokens.test.mjs.
 */
@font-face {
  font-family: "WH Condensed"; font-weight: 600; font-style: normal; font-display: swap;
  src: url(/fonts/barlow-condensed-600.woff2) format("woff2");
}
@font-face {
  font-family: "WH Condensed"; font-weight: 700; font-style: normal; font-display: swap;
  src: url(/fonts/barlow-condensed-700.woff2) format("woff2");
}
/* Fallbacks while the plate font is missing or blocked (Task D1): a narrow face of the device when it has one,
   else an ordinary sans face shrunk to about the plate font's width (Barlow Condensed is ~0.64 of Arial's glyph
   width; 60 % leaves room for the widest engine; a narrow face, ~0.82 of Arial, at 76 %), so no plate, button or
   label overflows. Both are bold faces (600-700), so the browser adds no synthetic bold. size-adjust needs no file;
   a browser without it (Safari before 17) shows the face at full size. The cost: the fallback's capitals are smaller. */
@font-face { font-family: "WH Narrow Fallback"; font-weight: 600 700; size-adjust: 76%; src: local("Arial Narrow Bold"), local("ArialNarrow-Bold"), local("Arial Narrow"), local("Roboto Condensed Bold"), local("RobotoCondensed-Bold"), local("Roboto Condensed"), local("DIN Condensed Bold"), local("DINCondensed-Bold"), local("DIN Condensed"); }
@font-face { font-family: "WH Wide Fallback"; font-weight: 600 700; size-adjust: 60%; src: local("Arial Bold"), local("Arial-BoldMT"), local("Arial"), local("Helvetica Neue Bold"), local("Helvetica"), local("Roboto Bold"), local("Roboto-Bold"), local("Roboto"), local("Liberation Sans Bold"), local("LiberationSans-Bold"), local("Liberation Sans"), local("FreeSans"); }

:root {
  color-scheme: dark;

  --wh-ground: #121416;      /* page background */
  --wh-field: #15181a;       /* field rear wall, lower part */
  --wh-wall: #1c2023;        /* rear wall panels, hopper inside */
  --wh-seam: #2b3136;        /* panel seams */
  --wh-iron: #30363b;        /* plates, frame, doors */
  --wh-iron-lt: #454d54;     /* highlights, flanges */
  --wh-web: #3a4148;         /* girder web */
  --wh-edge: #7a848c;        /* edge lines, rivet heads */
  --wh-ink: #08090a;         /* outlines, text on brass */
  --wh-steel: #9aa3aa;       /* bright steel */
  --wh-brass: #a8874a;       /* brass plates, Release plate rim */
  --wh-brass-lt: #d1b273;    /* engraved text on iron, needle, index */
  --wh-enamel: #ebe6da;      /* enamel plates */
  --wh-enamel-ink: #16181a;  /* text on enamel */
  --wh-enamel-mute: #5a554b; /* secondary text on enamel */
  --wh-text: #e9e2d2;        /* body text on dark */
  --wh-mute: #aea795;        /* secondary text on dark */
  --wh-left: #e0703a;        /* left side fill */
  --wh-left-ink: #f08a55;    /* left side text on dark */
  --wh-left-on-enamel: #a63f1f;  /* left side text on enamel: 5.03:1 (--wh-left-ink is 2.6:1 there) */
  --wh-right: #8cc8f0;       /* right side fill and text */
  --wh-right-on-enamel: #1f5f86; /* right side text on enamel: 5.55:1 (--wh-right is 1.45:1 there) */
  --wh-level: #4f9d68;       /* level zone on the dial */
  --wh-danger: #b3261e;      /* trip mark, tally strike, on enamel */
  --wh-focus: #f5d77a;       /* focus ring: on ground, wall or iron, never directly on brass (2.39:1) */
  --wh-rubber: #262626;      /* check-stop pads */
  --wh-oil: #3a3222;         /* oil in the cataract window */

  --wh-font-plate: "WH Condensed", "WH Narrow Fallback", "WH Wide Fallback", sans-serif;
  --wh-font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wh-line-1: 1px;
  --wh-line-2: 2px;
  --wh-line-3: 3px;
  --wh-r-plate: 6px;
  --wh-r-btn: 10px;
  --wh-gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));

  /* set at run time (Task B1): scene.js writes the hopper's haul-out distance on #field inline, from
     NUM.hopper.outM in SVG user units; this default (no haul-out) only names it */
  --wh-hopper-out: 0px;
  --wh-wheel-out: 0deg;   /* the hopper wheels' rotation at the end of the haul-out; hopper.js sets the real value on #field */
}

/* Page scale (Task E1; used in app.css, scale (E1)). */
:root {
  --wh-aspect: 0.5894737;
  --wh-aspect-now: 0.5894737;   /* the same as drawn now: the compact result view makes it larger (scene.compact, Task E4); the page column is sized from it on a phone */
  --wh-vh: 100svh;           /* the height the machine is sized from; viewport.js sets it in px (stable under a phone's collapsing toolbars) */
  --wh-head-h: 40px;
  --wh-bar-h: 60px;          /* control bar on top of the machine: 2 px above the 56 px tally plate, a 2 px flange under it (Task E3) */
  --wh-crown: 0;             /* the box's crown that leaves the screen at the release pan, as a fraction of the machine's width (place.js writes NUM.pan.crownM / view width) */
  --wh-pan: 0px;             /* the release pan in px, written on #place by wh/pan.js (Task E3); its duration is --wh-pan-ms */
  --wh-pan-ms: 0ms;
  --wh-notice-h: 0px;        /* the line a visible build or round notice adds under the band */
  --wh-pad-b: max(16px, env(safe-area-inset-bottom));
  --wh-score-h: 148px;       /* result screen: padding, the compact score plate, the three buttons and their gaps */
  --wh-toolbar: 0px;         /* a phone's floating browser bar at the bottom of the screen, which can cover the last 44 px */
  --wh-fit: 480px;
  --wh-w: min(100vw, var(--wh-fit));
  --wh-u: clamp(1px, calc(var(--wh-w) / 390), 1.35px);
}
