/* The ink of a drawn AFM sheet.
 *
 * The companion to graph-draw.js, and loaded by everything that calls it: the
 * Graph Editor and the flight folder. The module sets geometry; these classes set
 * what it looks like. Two copies of them would be two charts that differ in the
 * one place nobody thinks to check.
 *
 * The light values are the printed sheet's own: near-black ink on paper. The dark
 * ones only lift the ink off a dark ground -- the pencil line of a reading and its
 * answer badge keep their colour in both, because the reading is the one thing on
 * the chart that should look the same wherever it is shown.
 */

/* ---------- the printed chart ---------- */
.svgcurve { fill:none; stroke:#1e2428; stroke-width:1.7;
            stroke-linecap:round; stroke-linejoin:round; }
.svgcurve.std { stroke:#5b666e; stroke-dasharray:5 4; stroke-width:1.3; }
.svgtick { font-size:15px; fill:#1e2428; font-weight:600;
           font-family:"SF Mono",Consolas,monospace; }
.svgtickm { font-size:11px; fill:#6b7378; font-weight:500;
            font-family:"SF Mono",Consolas,monospace; }
.svgaxis { font-size:13px; fill:#5b666e; font-weight:700; letter-spacing:.06em;
           font-family:"SF Mono",Consolas,monospace; }

/* ---------- how the manufacturer letters the sheet ----------
 *
 * The rules above are the module's own face and stay the DA 42's: Diamond's
 * plates are not set in anything we have, and a monospace column is at least
 * honestly TFAdmin's rather than a wrong guess at Diamond's.
 *
 * Piper's are Helvetica Bold, all caps, set solid -- established off the
 * I-LDAP AFM scans (Piper PA-28-181, issued 2 July 1979). Those pages are pure
 * raster with only an OCR layer, so there is no embedded font to read and the
 * identification is letterforms plus measurement: cap-height-matched label
 * widths land within ~1% of Helvetica metrics, which rules out any condensed
 * cut, and the R's tight near-vertical leg with the C's horizontal terminals
 * rules out Univers and Arial. Arial IS the match on Windows -- it is metric
 * compatible -- and Arimo is the same metrics for anything with neither.
 *
 * The class is put on the root <svg> by graph-draw.js from `sheetLettering`,
 * which comes off the aircraft in perf-common.js. Scoped rather than made the
 * default because only the Piper sheets have been read; the DA 42 keeps what it
 * had, and nothing changes for a chart whose aeroplane does not ask for this.
 *
 * NOT changed here: fill and font-size. Those are the module's ink treatment,
 * and the printed sheet letters its axis titles in the same near-black as its
 * numbers -- matching that is a separate decision from matching the face. */
/* SIZE, AND WHY THESE NUMBERS ARE PIXELS.
 *
 * A chart is drawn in the coordinate space of the scan it was traced on -- the
 * anchors in fit_chart_*.json are pixels of page_103_rot.png and its siblings,
 * 1786x1259, and the viewBox is computed from that same ink (see perfDrawChart
 * in iff-native.js). One user unit IS one scan pixel, so a size measured off the
 * scan can be written here as px and comes out the size Piper printed it.
 *
 * MEASURED BY ADVANCE AND INK WIDTH, NOT BY CAP HEIGHT. Cap height off a 300dpi
 * photocopy quantises to the nearest ink row, which is +/-3%, and it moves with
 * the threshold: the distance numbers read 13px dark and 15px light, because
 * that edge of the page printed faint. Widths do not do that. So:
 *
 *   scale numbers  digit advance 11.5px, from glyph-start pitch on BOTH the
 *                  bottom scales and the distance column -- same pitch, so
 *                  Piper sets them the same size, and the "13" was the scan
 *                  going thin. Helvetica sets a digit at 0.556em: 21px gives
 *                  11.68 (+1.6%) and a 15px cap, which is what the dark
 *                  threshold reads. 20px would be -3.3%.
 *   axis titles    ink widths of "WIND - KNOTS" 173px, "WEIGHT - LBS." 168px,
 *                  "OUTSIDE AIR TEMP. - degC" 277px. 22px lands at
 *                  -1.6 / +2.5 / -2.1%, mean -0.4%. 23px is +4.3% across all
 *                  three, 21px -4.8%.
 *
 * TRACKING IS ZERO, and that is measured too: the same strings set solid come
 * out within a sixth of a pixel per gap, and of both signs between samples. The
 * sheet is set solid. The .06em above is the module's own face needing air, and
 * it goes.
 *
 * A chart that CARRIES a size wins over all of this: applyTextStyle() in
 * graph-draw.js writes scaleStyle sizes as an inline style, which beats a class
 * rule. That is the right way round -- the chart data is the record and these
 * are the default for one that says nothing -- but it does mean a sheet stamped
 * with the old sizes in the Graph Editor keeps them until it is re-stamped. */
.gd-lettering-helvetica .svgtick,
.gd-lettering-helvetica .svgtickm,
.gd-lettering-helvetica .svgaxis {
  font-family:"Helvetica Neue",Helvetica,Arimo,Arial,sans-serif; }
.gd-lettering-helvetica .svgtick { font-size:21px; font-weight:700; letter-spacing:0; }
.gd-lettering-helvetica .svgaxis { font-size:22px; font-weight:700; letter-spacing:0; }
/* The second unit beside the distance scale is NOT on the printed page -- it is
   TFAdmin's own annotation (see altUnits in perf-common.js). It takes the
   sheet's face so it belongs to the same chart, and keeps the size and weight it
   had RELATIVE to the number above it -- 11/15 of the tick, so 15/21 now --
   because being smaller and lighter than the printed figure is what tells a
   reader it is not one. */
.gd-lettering-helvetica .svgtickm { font-size:15px; font-weight:500; letter-spacing:0; }
/* NO font-size here: a CSS rule beats the font-size presentation attribute, so
   setting one locked every tag to 14px -- l.size was stored, the selection
   outline grew with it, and the glyphs never changed. The per-tag size is set as
   an attribute at draw time. */
.svgtag { font-weight:700; }

/* ---------- the reading ---------- */
.pencil-solid { stroke:#c8501f; stroke-width:2.6; fill:none; stroke-linecap:round; }
.pencil-dash { stroke:#c8501f; stroke-width:2.4; fill:none; stroke-dasharray:7 6;
               stroke-linecap:round; opacity:.85; }

/* ---------- dark ----------
   The grid, the panel boxes and the frame are drawn with a `style` attribute, so
   these have to be !important to reach them. Two different things are lines in
   the grid layer: the fine ruled grid of a graph-paper sheet, which is nearly
   white and inverts to nearly black, and the DOTTED rules of a boxed DA 42 sheet,
   which are already mid-grey and would vanish if treated the same way. The dashes
   tell them apart. */
[data-theme="dark"] .gd-grid line { stroke:#2b3136 !important; }
[data-theme="dark"] .gd-grid line[style*="dasharray"] { stroke:#6d767b !important; }
[data-theme="dark"] .gd-grid rect { stroke:#9aa4a9 !important; }
[data-theme="dark"] .gd-curves line { stroke:#8e989d !important; }
[data-theme="dark"] .svgcurve { stroke:#ccd5d9 !important; }
[data-theme="dark"] .svgcurve.std { stroke:#7d868b !important; }
[data-theme="dark"] .svgtick,
[data-theme="dark"] .svgaxis,
[data-theme="dark"] .svgtickm,
[data-theme="dark"] .svgtag { fill:#9ca6ab !important; }
[data-theme="dark"] .pencil-dot { stroke:#15181b !important; }
