/* $SHERIFF: type system.
   Families locked by AD1 (working/visual-direction.md §3). TY1 verified them on the
   binaries, built the subsets, and added the layers AD1 left open: leading, feature
   settings, CLS overrides, loading order. Every number below was measured with
   _tools/type_audit.py + fontTools: see working/type-stack.md for what was run.
   Register: medieval exchequer ledger rendered as a terminal. */

/* ═══ 1. FACES: self-hosted woff2, OFL-1.1, subset by us (OFL permits subsetting) ═══ */

/* DISPLAY: Libre Caslon Display, static 400, ASCII+punct subset · 19.7 KB
   There is exactly one weight. font-synthesis:none: a bold Caslon Display does not exist. */
@font-face{
  font-family:"Libre Caslon Display";
  src:url("/assets/fonts/libre-caslon-display-latin.woff2") format("woff2");
  font-weight:400; font-style:normal; font-display:swap;
  unicode-range:U+0020-007E,U+00A0,U+00A3,U+00B7,U+2010-2014,U+2018-201D,U+2026,U+2020;
}

/* PROSE: Libre Caslon Text, VARIABLE wght 400-700 · 42.2 KB
   Google ships this as a VF; @fontsource has no variable package (npm 404, checked),
   so self-hosting is the only route to the axis. One file replaces 400 + 700. */
@font-face{
  font-family:"Libre Caslon Text";
  src:url("/assets/fonts/libre-caslon-text-var-latin.woff2") format("woff2-variations"),
      url("/assets/fonts/libre-caslon-text-var-latin.woff2") format("woff2");
  font-weight:400 700; font-style:normal; font-display:optional;
}

/* ACCENT: Libre Caslon Text Italic, wght PINNED 400 · 26.3 KB
   The accent role is filled by a cut, not a fourth family: AD1 locked "two families,
   not three". There is no bold italic. Never nest <strong> inside <em>. */
@font-face{
  font-family:"Libre Caslon Text";
  src:url("/assets/fonts/libre-caslon-text-italic-latin.woff2") format("woff2");
  font-weight:400; font-style:italic; font-display:swap;
}

/* MONO: IBM Plex Mono, static 400/500/600 + 400i · 14.3+14.6+15.1+15.7 KB
   No variable cut exists anywhere upstream (Google ships statics only; npm
   @fontsource-variable/ibm-plex-mono is 404). Do not write a wght axis for it.
   The shipped subset carries NO liga and NO calt: != and => can never fuse. */
@font-face{font-family:"IBM Plex Mono";src:url("/assets/fonts/ibm-plex-mono-400-latin.woff2") format("woff2");font-weight:400;font-style:normal;font-display:swap;}
@font-face{font-family:"IBM Plex Mono";src:url("/assets/fonts/ibm-plex-mono-500-latin.woff2") format("woff2");font-weight:500;font-style:normal;font-display:swap;}
@font-face{font-family:"IBM Plex Mono";src:url("/assets/fonts/ibm-plex-mono-600-latin.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap;}
@font-face{font-family:"IBM Plex Mono";src:url("/assets/fonts/ibm-plex-mono-400i-latin.woff2") format("woff2");font-weight:400;font-style:italic;font-display:swap;}

/* ═══ 2. CLS OVERRIDES: size-adjust from the average advance width of
   [a-zA-Z0-9 space . , : ; -] in BOTH faces; ascent/descent = the webfont's own hhea
   divided by size-adjust. Target CLS < 0.05 with zero swap reflow. ═══ */
@font-face{font-family:"Display Fallback";src:local("Georgia");
  size-adjust:89.56%;ascent-override:108.30%;descent-override:29.70%;line-gap-override:0%;}
@font-face{font-family:"Prose Fallback";src:local("Georgia");
  size-adjust:106.99%;ascent-override:90.67%;descent-override:24.30%;line-gap-override:0%;}
@font-face{font-family:"Prose Fallback";src:local("Georgia Italic"),local("Georgia");font-style:italic;
  size-adjust:104.12%;ascent-override:93.16%;descent-override:24.97%;line-gap-override:0%;}
@font-face{font-family:"Mono Fallback";src:local("Menlo"),local("Consolas"),local("DejaVu Sans Mono");
  size-adjust:99.66%;ascent-override:102.85%;descent-override:27.59%;line-gap-override:0%;}

/* ═══ 3. TOKENS ═══ */
:root{
  /* Families. AD1's chain put "Libre Caslon Text" second in --font-display; measured,
     Text is 19.5% wider with a 24% larger x-height than Display, so that substitution
     reflows a 116px wordmark. The metric-matched face goes there instead.
     No banned family appears in any slot, primary or fallback. */
  --font-display:"Libre Caslon Display","Display Fallback",Georgia,"Times New Roman",serif;
  --font-prose:"Libre Caslon Text","Prose Fallback",Georgia,"Times New Roman",serif;
  --font-mono:"IBM Plex Mono","Mono Fallback",ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  --font-accent:var(--font-prose); /* accent = Caslon Text Italic, a cut not a family */

  /* Size ladder: AD1 §3.1, adopted verbatim. 360px -> 1440px. */
  --t-display-1:clamp(2.75rem,1.25rem + 6.667vw,7.25rem);        /*  44 -> 116  hero wordmark   */
  --t-display-2:clamp(2rem,1.333rem + 2.963vw,4rem);             /*  32 ->  64  section openers  */
  --t-title:clamp(1.375rem,1.208rem + 0.741vw,1.875rem);         /*  22 ->  30  verdict title    */
  --t-lede:clamp(1.125rem,1.0625rem + 0.278vw,1.3125rem);        /*  18 ->  21  lede, 48ch       */
  --t-body:clamp(1rem,0.969rem + 0.139vw,1.094rem);              /*  16 -> 17.5 prose, 62ch      */
  --t-data:clamp(0.8125rem,0.771rem + 0.185vw,0.9375rem);        /*  13 ->  15  tabular rows     */
  --t-stamp:clamp(0.6875rem,0.656rem + 0.139vw,0.781rem);        /*  11 -> 12.5 block pin        */

  /* Leading: AD1 left this open. Seven values, one per step. */
  --lh-display-1:0.95;  --lh-display-2:1.06;  --lh-title:1.2;   --lh-lede:1.45;
  --lh-body:1.6;        --lh-data:1.6;        --lh-mono-block:1.65;  --lh-stamp:1.25;

  /* Tracking: AD1 §3.2, five values, adopted verbatim + two neutrals. */
  --tr-display-1:0.055em;  /* Caslon caps need air but not a gap        */
  --tr-display-2:-0.012em; /* large Caslon sets loose by default        */
  --tr-stamp:0.06em;       /* tabular numerals stay tight to stay countable */
  --tr-eyebrow:0.14em;     /* the one place wide tracking is earned     */
  --tr-control:0.02em;     /* a control is not a label                  */
  --tr-prose:0em;
  --tr-data:0em;           /* never track mono data: the column IS the alignment */
}

/* ═══ 4. ROLES ═══ */
html{-webkit-text-size-adjust:100%;}

body{
  font-family:var(--font-prose);
  font-size:var(--t-body);
  line-height:var(--lh-body);
  letter-spacing:var(--tr-prose);
  font-weight:400;
  font-synthesis:none;                        /* no faux bold, italic or small-caps, ever */
  font-feature-settings:"kern" 1,"liga" 1;    /* the only two the shipped subset needs   */
  text-wrap:pretty;
  text-rendering:optimizeLegibility;          /* never geometricPrecision */
}
p{max-width:62ch;}
.t-lede{font-size:var(--t-lede);line-height:var(--lh-lede);max-width:48ch;text-wrap:pretty;}

/* DISPLAY. Libre Caslon Display has NO tnum and NO zero: it physically cannot set a
   tabular column or disambiguate 0/O. AD1 §3.3 (every numeral is mono) is therefore a
   build requirement, not a style preference. Never put a figure in this face. */
.t-display-1,.t-display-2,h1,h2{
  font-family:var(--font-display);
  font-weight:400;                            /* the only weight that exists */
  font-synthesis:none;
  font-feature-settings:"kern" 1,"liga" 1;
  text-wrap:balance;
}
.t-display-1,h1{font-size:var(--t-display-1);line-height:var(--lh-display-1);letter-spacing:var(--tr-display-1);text-transform:uppercase;}
.t-display-2,h2{font-size:var(--t-display-2);line-height:var(--lh-display-2);letter-spacing:var(--tr-display-2);}
h3,.t-title{font-family:var(--font-display);font-weight:400;font-size:var(--t-title);
  line-height:var(--lh-title);letter-spacing:-0.006em;text-wrap:balance;font-synthesis:none;}

/* PROSE emphasis. Italic exists at 400 only. */
em,i,.t-marginal{font-style:italic;font-weight:400;}
.t-marginal{font-family:var(--font-accent);font-size:var(--t-body);line-height:1.45;letter-spacing:0.004em;}
.t-legend{font-family:var(--font-accent);font-style:italic;font-size:var(--t-stamp);
  text-transform:uppercase;letter-spacing:var(--tr-eyebrow);}
strong,b{font-weight:700;font-style:normal;}  /* 700 exists in the roman VF only */

/* MONO: every numeral, address, block height, byte count, label and stamp. */
.t-mono,.num,code,kbd,samp,pre,table{
  font-family:var(--font-mono);
  font-variant-numeric:tabular-nums slashed-zero; /* zero -> zero.alt01, verified */
  font-variant-ligatures:none;                    /* belt: the subset has no liga/calt at all */
  font-synthesis:none;
  letter-spacing:var(--tr-data);
}
.t-mono,code,samp{font-size:var(--t-data);line-height:var(--lh-data);}
pre{font-size:var(--t-data);line-height:var(--lh-mono-block);}
td,td.num{font-size:var(--t-data);line-height:var(--lh-data);}
th{font-size:var(--t-stamp);line-height:var(--lh-stamp);text-transform:uppercase;
   font-weight:600;letter-spacing:var(--tr-stamp);}

/* The stamp chip: one line inside a border, so it takes --lh-stamp, not a block leading. */
.t-stamp{font-family:var(--font-mono);font-size:var(--t-stamp);line-height:var(--lh-stamp);
  font-weight:600;letter-spacing:var(--tr-stamp);text-transform:uppercase;
  font-variant-numeric:tabular-nums slashed-zero;font-variant-ligatures:none;}
.t-eyebrow{font-family:var(--font-mono);font-size:var(--t-stamp);line-height:var(--lh-stamp);
  font-weight:500;letter-spacing:var(--tr-eyebrow);text-transform:uppercase;}
.t-control{font-family:var(--font-mono);font-size:var(--t-data);line-height:1.3;
  font-weight:500;letter-spacing:var(--tr-control);text-transform:uppercase;}
.t-annot{font-family:var(--font-mono);font-style:italic;font-weight:400;
  font-size:var(--t-stamp);line-height:var(--lh-data);} /* annotation inside a data block */

/* Never justified: rivers inside a ruled column read as a broken ledger. */
p,li,blockquote,td,th{text-align:start;}
