/* =============================================================================
   agDrawing.css
   The ONE visual language for every drawing in this repository - the static
   SVG diagrams in diagrams/ and the interactive demos in teaching-demos/.

   Full rendered reference: agDiagramsAndDemosGuide.html (open in a browser).

   -----------------------------------------------------------------------------
   THREE FILES, ONE LANGUAGE

       agDrawing.css          THIS FILE. Everything a drawing is made of:
                              colours, line weights, text, arrows, materials,
                              particles, graphs. Shared by both media.
       agDiagrams.css         The diagram layer. Imports this file, then adds
                              what only a standalone .svg needs: the ground
                              (the card a diagram sits on) and document-level
                              defaults for svg and text.
       agTeachingDemos.css    The demo layer. Imports this file, then adds what
                              only an interactive HTML demo needs: the demo
                              type sizes, slider/meter controls and motion.

   Nothing links this file directly. A diagram links agDiagrams.css, a demo
   links agTeachingDemos.css, and both arrive here. So a colour changed here
   changes every diagram AND every demo the next time they are opened - there
   is no build step, because nothing is copied, only linked.

   The test for what belongs here rather than in a layer: if it changed in
   one medium, should it change in the other too? Heat colour, ink, line
   weights, arrowheads: yes, so they live here. Slider styling, the diagram
   ground: no, so they live in a layer.

   -----------------------------------------------------------------------------
   HOW IT WORKS

   SVG elements carry NO paint of their own. A shape gets semantic classes
   saying what it IS, and this file decides what that looks like:

       <rect class="ag-box ag-blue" .../>         a role, plus a hue
       <rect class="ag-metal ag-outline" .../>    a material, plus an outline

   An inline style or a fill="" attribute beats a stylesheet, so a shape that
   carries one ignores this file for ever - including the day everything else
   is restyled. Inkscape adds style="fill:#000000" to everything it draws
   without being asked; use the "?" (unset) button in Fill & Stroke.

   All class and variable names carry the ag- prefix, so a demo embedded in
   someone else's page (a VLE, a slide framework) cannot collide with it.

   -----------------------------------------------------------------------------
   TWO LAYERS OF COLOUR TOKENS

   Raw colours are named once, as --ag-c-* variables in each section's :root
   block. Roles then POINT at them (--ag-c-axis: var(--ag-c-muted)) rather
   than repeating a hex value, so a near-duplicate grey can never creep back
   in. The slide stylesheet uses the same two-layer model.

   Two palettes coexist and must be kept apart, because they mean different
   things:
       SCHEMATIC  the neutrals and hues. A box is blue because it is not the
                  green one - the colour distinguishes, it does not depict.
       PHYSICS    materials, heat, hot/cold, particles. A shape is grey
                  because it is steel - the colour IS the meaning. These hold
                  their own values and never alias a schematic colour, so
                  restyling the schematic palette cannot recolour the physics.
   A drawing that mixes "blue means category A" with "copper means copper"
   teaches the reader that colour means nothing.

   -----------------------------------------------------------------------------
   FOR WHOEVER EDITS THIS FILE: SOURCE ORDER IS PART OF THE API

   Classes are designed to be stacked (class="ag-line ag-fine ag-faint"), and
   when two single-class rules set the same property, the one LATER IN THE
   FILE wins. Two real bugs came from that (see CLAUDE.md, 2026-09-28). The
   file is therefore ordered so stacking always works:

       1  foundations        tokens only
       2  neutrals           set variables only - order-proof
       3  hues               set variables only - order-proof
       4  physics palette    material fills, heat, temperature
       5  particles
       6  roles              how a shape is painted (box, line, connector...)
       7  graphs             axis, gridline - roles too
       8  text               sizes first, then colour modifiers, then maths
       9  modifiers          fine, heavy, dashed, translucent - MUST BE LAST

   The safest kind of modifier sets a VARIABLE that a role reads (as the hues
   and neutrals do) instead of a property the role also sets. Where that is
   not possible, the modifier goes in section 9.
   ========================================================================== */


/* -----------------------------------------------------------------------------
   1. FOUNDATIONS
   -----------------------------------------------------------------------------
   Fonts, line weights and type sizes.

   LINE WEIGHTS: three, and they are not equal citizens. Regular should carry
   something like nine tenths of every drawing. Heavy is for the one thing
   being emphasised; fine is for hatching, ticks, dimension lines and
   construction.

   TYPE SIZES are in SVG user units, so what they look like depends on how
   wide the canvas is. The values here are for the house diagram canvas,
   1200 units wide (see agDiagrams.css). The demo layer re-points these three
   variables inside .ag-demo for the narrower demo canvas. That is the one
   thing about drawing that genuinely differs between the two media.
----------------------------------------------------------------------------- */

:root {
  --ag-font-ui:   "Segoe UI", system-ui, sans-serif;
  --ag-font-mono: Consolas, "Cascadia Mono", monospace;
  --ag-font-math: Georgia, "Times New Roman", serif;

  --ag-sw-fine:    1px;
  --ag-sw-regular: 2px;
  --ag-sw-heavy:   3.5px;

  --ag-fs-label: 22px;   /* the default - almost everything */
  --ag-fs-small: 17px;   /* annotations, ticks, asides */
  --ag-fs-title: 28px;   /* a heading INSIDE a drawing; usually unnecessary */

  /* Corner radius for boxes drawn inside a drawing. Softer than a sharp
     corner, nowhere near a pill. */
  --ag-box-radius: 10px;
}


/* -----------------------------------------------------------------------------
   2. NEUTRALS - THE HIERARCHY
   -----------------------------------------------------------------------------
   The most used part of this file. What separates a designed set of drawings
   from an amateur one is not the palette, it is HIERARCHY: most of a good
   drawing is quiet and only the subject is at full strength. Draw everything
   at one weight and the eye has nowhere to land.

   Named for the job, not the lightness, because the name is the instruction:

       ink       the subject. What the drawing is ABOUT.
       muted     supporting structure that still needs reading.
       faint     context. Present, not competing.
       ghost     scaffolding, repetition, "there is more of this".
       hairline  separators, light borders, gridlines (no class: a token).

   If in doubt, draw it faint and promote only what the sentence you are
   saying out loud refers to.

   A neutral is used EXACTLY LIKE A HUE: stack it on a role.
       <path class="ag-line ag-faint" .../>
       <rect class="ag-box ag-ghost" .../>
   On its own it does nothing, because it only sets variables. That is
   deliberate - it is what makes it immune to source order (before
   2026-10-09 the neutrals also set stroke directly, and the "quiet" boxes
   silently drew in ink). Each also resets tint and shade, so a ghost box
   inside a blue group is a ghost box, not a blue one.
----------------------------------------------------------------------------- */

:root {
  --ag-c-ink:      #1c2733;
  --ag-c-muted:    #45535f;
  --ag-c-faint:    #93a0ab;
  --ag-c-ghost:    #c9d1d8;
  --ag-c-hairline: #e4e8eb;
}

.ag-ink   { --ag-h-tint: var(--ag-c-hairline); --ag-h-base: var(--ag-c-ink);   --ag-h-shade: var(--ag-c-ink); }
.ag-muted { --ag-h-tint: var(--ag-c-hairline); --ag-h-base: var(--ag-c-muted); --ag-h-shade: var(--ag-c-ink); }
.ag-faint { --ag-h-tint: var(--ag-c-hairline); --ag-h-base: var(--ag-c-faint); --ag-h-shade: var(--ag-c-ink); }
.ag-ghost { --ag-h-tint: var(--ag-c-hairline); --ag-h-base: var(--ag-c-ghost); --ag-h-shade: var(--ag-c-ink); }


/* -----------------------------------------------------------------------------
   3. HUES - colour is TWO classes, a role and a hue
   -----------------------------------------------------------------------------
   A shape takes a ROLE class saying how it is painted (section 6) and a HUE
   class saying which colour to paint it:

       <rect class="ag-box ag-blue" .../>
       <path class="ag-line ag-terracotta" .../>
       <text class="ag-label ag-label-hue ag-blue">policy</text>

   16 short classes instead of one long one per combination, and all easy to
   type into Inkscape's XML editor. Leave the hue off and the role paints in
   ink. A hue on a <g> colours everything inside it.

   Each hue sets three variables, and the roles decide which to use:

       --ag-h-tint    pale, for large fills
       --ag-h-base    the colour itself, for strokes and solid shapes
       --ag-h-shade   dark, for text sitting on the tint

   Tint fill, base outline, shade text is a combination that never needs a
   contrast check.

   THREE TIERS, kept apart on purpose:
     - three CORE colours, reused constantly - reuse is what creates identity;
     - one HIGHLIGHT;
     - twelve SPECIFIC hues, for depiction rather than distinction.
----------------------------------------------------------------------------- */

/* -- The three core colours ------------------------------------------------
   Reach for these first and leave them only when the drawing genuinely needs
   more. Deliberately muted - nothing here is a pure hue, which is most of
   what separates a designed palette from a default one.

   Violet is deliberately NOT one of the three: it belongs to the slide chrome
   (headings, keypoints), and drawings competing with it would muddy both.
   Swapping one of these for the Sheffield violet is three lines if that
   judgement is ever reversed.
-------------------------------------------------------------------------- */

:root {
  --ag-c-blue-tint:        #dce7f3;
  --ag-c-blue:             #4a7ebb;
  --ag-c-blue-shade:       #2b4d78;

  --ag-c-terracotta-tint:  #f6e2d8;
  --ag-c-terracotta:       #c4653c;
  --ag-c-terracotta-shade: #8a4527;

  --ag-c-green-tint:       #dcebdf;
  --ag-c-green:            #5a8f63;
  --ag-c-green-shade:      #35603d;
}

.ag-blue       { --ag-h-tint: var(--ag-c-blue-tint);       --ag-h-base: var(--ag-c-blue);       --ag-h-shade: var(--ag-c-blue-shade); }
.ag-terracotta { --ag-h-tint: var(--ag-c-terracotta-tint); --ag-h-base: var(--ag-c-terracotta); --ag-h-shade: var(--ag-c-terracotta-shade); }
.ag-green      { --ag-h-tint: var(--ag-c-green-tint);      --ag-h-base: var(--ag-c-green);      --ag-h-shade: var(--ag-c-green-shade); }

/* -- Highlight --------------------------------------------------------------
   ONE per drawing, and it is the only thing wearing it. Its entire power is
   scarcity: the moment two things are pink, neither is emphasised. A vivid
   colour in an otherwise muted palette for exactly that reason, and used
   nowhere else, so it can never be mistaken for a category.
-------------------------------------------------------------------------- */

:root {
  --ag-c-highlight-tint:  #fbdcec;
  --ag-c-highlight:       #dc2a7f;
  --ag-c-highlight-shade: #961854;
}

.ag-highlight { --ag-h-tint: var(--ag-c-highlight-tint); --ag-h-base: var(--ag-c-highlight); --ag-h-shade: var(--ag-c-highlight-shade); }

/* -- The twelve specific hues -----------------------------------------------
   For DEPICTION rather than distinction: when you draw a Ferrari it has to be
   red, and a lemon has to be yellow. Accuracy beats consistency here, which is
   exactly why these are kept separate from the core three.

   Do not use these to tell parts of a schematic apart. That is what the core
   three are for, and a schematic wearing eight hues has no identity. The
   recorded exceptions are data plots with many series, where each series
   needs its own colour (cfd-residuals-convergence.svg, by request).
-------------------------------------------------------------------------- */

:root {
  --ag-c-red-tint:     #f7dcdc;  --ag-c-red:     #b83d3d;  --ag-c-red-shade:     #7d2626;
  --ag-c-orange-tint:  #fce3d0;  --ag-c-orange:  #d97a2b;  --ag-c-orange-shade:  #94501a;
  --ag-c-amber-tint:   #fbeecd;  --ag-c-amber:   #c99a28;  --ag-c-amber-shade:   #8a6817;
  --ag-c-olive-tint:   #eaecd2;  --ag-c-olive:   #8a9440;  --ag-c-olive-shade:   #5b632a;
  --ag-c-lime-tint:    #e2efd2;  --ag-c-lime:    #6f9e42;  --ag-c-lime-shade:    #47692a;
  --ag-c-teal-tint:    #d5eae8;  --ag-c-teal:    #3f8c85;  --ag-c-teal-shade:    #265c57;
  --ag-c-cyan-tint:    #d6e9f0;  --ag-c-cyan:    #3d87a6;  --ag-c-cyan-shade:    #255a70;
  --ag-c-indigo-tint:  #dcdff0;  --ag-c-indigo:  #4f5aa8;  --ag-c-indigo-shade:  #313a73;
  --ag-c-violet-tint:  #e4dcf0;  --ag-c-violet:  #6b4f9e;  --ag-c-violet-shade:  #432f68;
  --ag-c-magenta-tint: #f2daea;  --ag-c-magenta: #a2458a;  --ag-c-magenta-shade: #6d2a5c;
  --ag-c-brown-tint:   #ece0d4;  --ag-c-brown:   #8a6244;  --ag-c-brown-shade:   #5c3f2b;
  --ag-c-slate-tint:   #e2e6ea;  --ag-c-slate:   #5f7183;  --ag-c-slate-shade:   #3c4854;
}

.ag-red     { --ag-h-tint: var(--ag-c-red-tint);     --ag-h-base: var(--ag-c-red);     --ag-h-shade: var(--ag-c-red-shade); }
.ag-orange  { --ag-h-tint: var(--ag-c-orange-tint);  --ag-h-base: var(--ag-c-orange);  --ag-h-shade: var(--ag-c-orange-shade); }
.ag-amber   { --ag-h-tint: var(--ag-c-amber-tint);   --ag-h-base: var(--ag-c-amber);   --ag-h-shade: var(--ag-c-amber-shade); }
.ag-olive   { --ag-h-tint: var(--ag-c-olive-tint);   --ag-h-base: var(--ag-c-olive);   --ag-h-shade: var(--ag-c-olive-shade); }
.ag-lime    { --ag-h-tint: var(--ag-c-lime-tint);    --ag-h-base: var(--ag-c-lime);    --ag-h-shade: var(--ag-c-lime-shade); }
.ag-teal    { --ag-h-tint: var(--ag-c-teal-tint);    --ag-h-base: var(--ag-c-teal);    --ag-h-shade: var(--ag-c-teal-shade); }
.ag-cyan    { --ag-h-tint: var(--ag-c-cyan-tint);    --ag-h-base: var(--ag-c-cyan);    --ag-h-shade: var(--ag-c-cyan-shade); }
.ag-indigo  { --ag-h-tint: var(--ag-c-indigo-tint);  --ag-h-base: var(--ag-c-indigo);  --ag-h-shade: var(--ag-c-indigo-shade); }
.ag-violet  { --ag-h-tint: var(--ag-c-violet-tint);  --ag-h-base: var(--ag-c-violet);  --ag-h-shade: var(--ag-c-violet-shade); }
.ag-magenta { --ag-h-tint: var(--ag-c-magenta-tint); --ag-h-base: var(--ag-c-magenta); --ag-h-shade: var(--ag-c-magenta-shade); }
.ag-brown   { --ag-h-tint: var(--ag-c-brown-tint);   --ag-h-base: var(--ag-c-brown);   --ag-h-shade: var(--ag-c-brown-shade); }
.ag-slate   { --ag-h-tint: var(--ag-c-slate-tint);   --ag-h-base: var(--ag-c-slate);   --ag-h-shade: var(--ag-c-slate-shade); }


/* -----------------------------------------------------------------------------
   4. PHYSICS PALETTE - colours that ARE their meaning
   -----------------------------------------------------------------------------
   MATERIALS are pure fills - no stroke. To outline a material region, add
   .ag-outline alongside it:

       <rect class="ag-metal ag-outline" .../>

   .ag-metal is "shiny" when the standard agMetalGradient defs block (in the
   guide) is in the SVG; otherwise it falls back to the flat --ag-c-metal grey
   automatically. Gotcha: SVG gradient references resolve DOCUMENT-WIDE, so a
   page containing the defs block anywhere makes every .ag-metal on it shiny.

   NAMED TINTS: a FLAT material fill can be recoloured per element by
   overriding its variable. These keep the override colours consistent across
   drawings - use them rather than inventing local colours:

       <rect class="ag-metal" style="--ag-c-metal: var(--ag-c-metal-copper)"/>

   This only works on flat fills: a gradient is shared per document and
   ignores per-element overrides, so a drawing that needs distinguishable
   metals leaves the metal-gradient defs block out. New tints are added only
   when a drawing needs them. Iron is dark enough that a label on it needs
   .ag-label-inverse.
----------------------------------------------------------------------------- */

:root {
  --ag-c-metal:      #b9c2cb;
  --ag-c-water:      #8fc4ea;
  --ag-c-air:        #e3f1fb;
  --ag-c-insulation: #e8d9a0;
  --ag-c-brick:      #d69c7e;
  --ag-c-wood:       #c99a5b;
  --ag-c-plastic:    #ecefe6;
  --ag-c-stone:      #a9a294;

  --ag-c-metal-iron:      #6e7780;
  --ag-c-metal-titanium:  #8f979f;
  --ag-c-metal-aluminium: #aeb9c2;
  --ag-c-metal-gold:      #d9b83f;
  --ag-c-metal-copper:    #b96a45;

  /* The material outline is a drawing line, so it points at ink and the
     regular weight. It keeps its own variables so a drawing can thin or
     recolour outlines without touching anything else. */
  --ag-c-outline:  var(--ag-c-ink);
  --ag-sw-outline: var(--ag-sw-regular);
}

.ag-metal      { fill: url(#agMetalGradient) var(--ag-c-metal); }
.ag-water      { fill: var(--ag-c-water); }
.ag-air        { fill: var(--ag-c-air); }
.ag-insulation { fill: var(--ag-c-insulation); }
.ag-brick      { fill: var(--ag-c-brick); }
.ag-wood       { fill: var(--ag-c-wood); }
.ag-plastic    { fill: var(--ag-c-plastic); }
.ag-stone      { fill: var(--ag-c-stone); }

/* -- Heat -------------------------------------------------------------------
   Heat is a hue, used like any other: on a role, or on a group.

       <g class="ag-heat">
         <path class="ag-connector" .../>
         <polygon class="ag-arrowhead" .../>
       </g>

   Chosen 2026-10-09: the dark orange the diagrams were already using for heat
   rates. These are the SAME VALUES as terracotta but deliberately separate
   tokens - heat is physics, terracotta is a schematic category (it means
   "engineering" in the CFD diagrams), and recolouring one must not recolour
   the other. In a demo, add .ag-marching (agTeachingDemos.css) to make the
   dashes march.
-------------------------------------------------------------------------- */

:root {
  --ag-c-heat-tint:  #f6e2d8;
  --ag-c-heat:       #c4653c;
  --ag-c-heat-shade: #8a4527;
}

.ag-heat { --ag-h-tint: var(--ag-c-heat-tint); --ag-h-base: var(--ag-c-heat); --ag-h-shade: var(--ag-c-heat-shade); }

/* -- Temperature ------------------------------------------------------------
   The two ends of a cold-to-hot colour scale. There is no class: anything
   coloured by temperature computes its colour, so it mixes these in CSS
   rather than holding colours in JavaScript, which keeps it restylable here:

       el.style.setProperty("--ag-c-particle",
         `color-mix(in srgb, var(--ag-c-hot) ${pct}%, var(--ag-c-cold))`);

   (color-mix needs a 2023-or-newer browser - already a dependency of the
   shiny particle gradient.)
-------------------------------------------------------------------------- */

:root {
  --ag-c-cold: #2b6cb0;
  --ag-c-hot:  #c0392b;
}


/* -----------------------------------------------------------------------------
   5. PARTICLES
   -----------------------------------------------------------------------------
   Small dots for atoms and molecules (conduction lattices, gas models). Motion
   is the demo's JavaScript; this styles the dot. Size, body colour and outline
   are all variables, overridable on the svg, a group or a single particle:

       <circle class="ag-particle" cx="..." cy="..."/>
       <g style="--ag-c-particle: var(--ag-c-cold)"> ... </g>

   The radius comes from the STYLESHEET: the CSS r property overrides any
   r="" attribute, so resize with --ag-particle-r, never the attribute.

   Like metal, particles are "shiny" (a 3-D ball) when the standard
   agParticleGradient defs block (in the guide) is in the SVG. The gradient
   derives highlight and shade from --ag-c-particle with color-mix(), so one
   override retints the whole ball. With the gradient active, colour is
   per-SVG (one shared gradient); flat particles (no defs block) can be
   recoloured individually. Browsers without color-mix() get flat particles.
----------------------------------------------------------------------------- */

:root {
  --ag-c-particle:         #4a5560;
  --ag-c-particle-outline: #2c343c;
  --ag-sw-particle:        var(--ag-sw-fine);
  --ag-particle-r:         3.5px;
}

.ag-particle {
  fill: url(#agParticleGradient) var(--ag-c-particle);
  stroke: var(--ag-c-particle-outline);
  stroke-width: var(--ag-sw-particle);
  r: var(--ag-particle-r);
}


/* -----------------------------------------------------------------------------
   6. ROLES - how a shape is painted
   -----------------------------------------------------------------------------
   Every role reads the hue variables and falls back to ink when no hue is
   set, so a role on its own draws in ink.

   ARROWS are a stroked path plus a SEPARATE filled head, never an SVG
   <marker>: browsers cannot reliably recolour marker content from CSS, which
   would defeat the whole system. One head shape, one size, everywhere -
   copy the polygon and rotate it. Consistent arrowheads are a surprisingly
   large part of looking deliberate.

       <path    class="ag-connector" d="M 100 100 H 280"/>
       <polygon class="ag-arrowhead" points="292,100 276,92 276,108"/>
----------------------------------------------------------------------------- */

/* A filled, outlined, rounded box - the workhorse of any schematic. rx is a
   CSS geometry property in SVG 2, so the corner radius really is set here. */
.ag-box {
  fill: var(--ag-h-tint, var(--ag-c-hairline));
  stroke: var(--ag-h-base, var(--ag-c-ink));
  stroke-width: var(--ag-sw-regular);
  rx: var(--ag-box-radius);
}

/* The same paint for anything that is not a rounded rectangle - circles,
   ellipses, polygons, free paths. Kept separate from .ag-box because a
   rounded box is the commonest shape and should not have to ask for its
   corners. */
.ag-shape {
  fill: var(--ag-h-tint, var(--ag-c-hairline));
  stroke: var(--ag-h-base, var(--ag-c-ink));
  stroke-width: var(--ag-sw-regular);
}

/* Solid, no outline. Also the way to give one shape a computed colour from
   script: set --ag-h-base on it. */
.ag-solid {
  fill: var(--ag-h-base, var(--ag-c-ink));
  stroke: none;
}

/* Stroke only - lines, rules, outlines, data curves. */
.ag-line {
  fill: none;
  stroke: var(--ag-h-base, var(--ag-c-ink));
  stroke-width: var(--ag-sw-regular);
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The shaft of an arrow. */
.ag-connector {
  fill: none;
  stroke: var(--ag-h-base, var(--ag-c-ink));
  stroke-width: var(--ag-sw-regular);
  stroke-linecap: round;
}

/* The head of an arrow. */
.ag-arrowhead {
  fill: var(--ag-h-base, var(--ag-c-ink));
  stroke: none;
}

/* Outline for a material region (section 4). */
.ag-outline {
  stroke: var(--ag-c-outline);
  stroke-width: var(--ag-sw-outline);
}


/* -----------------------------------------------------------------------------
   7. GRAPHS
   -----------------------------------------------------------------------------
   Axes, axis labels and gridlines ("gridline" is the standard charting term
   for light reference lines, even irregularly spaced ones - they are as
   useful outside graphs, e.g. projecting a layer boundary down onto a
   temperature profile). Draw gridlines first, so they sit under the data.

   DATA CURVES are ordinary lines with a hue: class="ag-line ag-red". With
   one or two curves, use red then blue (the long-standing convention); a plot
   with many series may use the specific hues, one per series, labelled in
   the series colour at the end of each curve so no legend is needed.

   Axis titles and tick labels use .ag-axis-label (section 8). Use one
   <polyline> for an L-shaped pair of axes.
----------------------------------------------------------------------------- */

:root {
  --ag-c-axis:      var(--ag-c-muted);
  --ag-sw-axis:     1.5px;
  --ag-c-gridline:  var(--ag-c-hairline);
  --ag-sw-gridline: var(--ag-sw-fine);
}

.ag-axis {
  fill: none;
  stroke: var(--ag-c-axis);
  stroke-width: var(--ag-sw-axis);
}

.ag-gridline {
  fill: none;
  stroke: var(--ag-c-gridline);
  stroke-width: var(--ag-sw-gridline);
}


/* -----------------------------------------------------------------------------
   8. TEXT
   -----------------------------------------------------------------------------
   One size for nearly everything. Labels should be quiet and small with air
   around them - text set large is the fastest way to make a drawing look like
   a poster. Label a thing in the colour of the thing it names and you will
   rarely need a legend.

   No font-family is set on these classes ON PURPOSE: each layer sets it on
   the svg, and labels inherit it. That is what lets a maths <text> pass its
   serif italic down to a subscript <tspan>.

   ORDER IS LOAD-BEARING in this section. Size classes come first; the colour
   modifiers (faint, inverse, hue, shade) must come AFTER them so that
   class="ag-label-small ag-label-hue ag-blue" gets the hue, not the small
   label's grey; .ag-math must come after anything that could set a font.
   The hue modifier used to sit above .ag-label and every hue label silently
   rendered in ink (found 2026-09-28).
----------------------------------------------------------------------------- */

:root {
  /* Text on a dark fill (iron, a solid muted block). */
  --ag-c-inverse: #ffffff;
}

/* Size classes. */
.ag-label       { font-size: var(--ag-fs-label); fill: var(--ag-c-ink);   stroke: none; }
.ag-label-small { font-size: var(--ag-fs-small); fill: var(--ag-c-muted); stroke: none; }
.ag-label-title { font-size: var(--ag-fs-title); fill: var(--ag-c-ink);   stroke: none; }

/* Axis titles and tick labels: label size, axis colour. */
.ag-axis-label  { font-size: var(--ag-fs-label); fill: var(--ag-c-axis);  stroke: none; }

/* Colour modifiers - stack on a size class. */
.ag-label-faint   { fill: var(--ag-c-faint); }      /* must not compete */
.ag-label-inverse { fill: var(--ag-c-inverse); }    /* on a dark fill */
.ag-label-hue     { fill: var(--ag-h-base, var(--ag-c-ink)); }    /* in the hue */
.ag-label-shade   { fill: var(--ag-h-shade, var(--ag-c-ink)); }   /* on the hue's tint */

/* Maths variables in italic serif, the way they appear in print. */
.ag-math { font-family: var(--ag-font-math); font-style: italic; }

/* Run a y-axis title vertically: rotated 90 degrees anticlockwise about the
   text's own centre. Position the text at its desired centre point. Prefer
   this to a per-element transform="rotate(...)" attribute.
       <text class="ag-axis-label ag-axis-label-vertical" x="56" y="375">T</text> */
.ag-axis-label-vertical {
  text-anchor: middle;
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(-90deg);
}


/* -----------------------------------------------------------------------------
   9. MODIFIERS - stack on any role.  KEEP THIS SECTION LAST.
   -----------------------------------------------------------------------------
   These set properties the roles also set (stroke-width, fill), so they win
   only by coming later in the file. Anything added below them, or any role
   moved below them, breaks stacking silently.
----------------------------------------------------------------------------- */

:root {
  --ag-translucent-opacity: 0.26;
}

.ag-fine   { stroke-width: var(--ag-sw-fine); }
.ag-heavy  { stroke-width: var(--ag-sw-heavy); }
.ag-dashed { stroke-dasharray: 7 5; }

/* Translucent schematic volume: the hue's base colour at reduced fill
   opacity, so the whole volume reads while geometry behind it stays visible.
   Stroke opacity is unchanged. Paint each volume ONCE rather than stacking
   translucent faces, which would create arbitrary dark seams. */
.ag-translucent {
  fill: var(--ag-h-base, var(--ag-c-ink));
  fill-opacity: var(--ag-translucent-opacity);
}
