/* Trueread Noir: brand tokens.
   Dark ("Noir") is the default everywhere. "Daylight" is a reading mode for product screens and print only; the
   marketing site, decks and the homepage are always dark. brand/noir/README.md is the spec; specimen.html shows it.

   Use: link the three Google Fonts (see FONTS below), then this file. Components read the role tokens
   (--tr-bg, --tr-text, --tr-reading ...), never the raw palette. Every theme block re-declares the role tokens
   with values, so a theme can be set on any element, not only on :root.

   Contrast ratios are WCAG 2.1, measured from these hex values on 17 Nov 2026; README.md has the full table. */

/* FONTS (all SIL Open Font Licence, from Google Fonts):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Mona+Sans:wdth,wght@75..125,200..900&family=Newsreader:ital,opsz,wght@0,6..72,200..800;1,6..72,200..800&family=Red+Hat+Mono:wght@300..700&display=swap" rel="stylesheet">
   Self-host the same files (woff2) for the products, as the repo does today with /fonts. */

/* ---------------------------------------------------------------- Raw palette: Noir (dark) */
:root {
  --tr-void:     #050505; /* the ground: near-black, never pure #000 so grain and glow can sit on it */
  --tr-carbon:   #0D0D0E; /* raised: cards, panels, the side panel sheet */
  --tr-gunmetal: #161718; /* wells: hover, selected rows, inside a field */
  --tr-rule:     #242526; /* hairlines between groups; decorative */
  --tr-seam:     #343537; /* list tops, axes, HUD brackets; decorative */
  --tr-edge:     #68696B; /* the edge of a field, select or checkbox: 3.7:1 on Void, 3.3:1 on Gunmetal */
  --tr-ash:      #737578; /* the reference: bars, ticks, "about usual" data. Graphics only, never text */
  --tr-smoke:    #9FA1A3; /* secondary text: labels, meta, source lines. 7.9:1 on Void */
  --tr-silver:   #CDCECF; /* body copy. 12.9:1 on Void */
  --tr-white:    #F2F2F0; /* headlines, figures, the primary button. 18.2:1 on Void */
  --tr-sodium:   #E3832E; /* a reading: the live point, the reading dot, a reading above its reference. 7.3:1 */
  --tr-mercury:  #8FB3CF; /* a reading below its reference. 9.2:1 */
}

/* ---------------------------------------------------------------- Raw palette: Daylight (light reading mode) */
:root {
  --tr-day-paper:   #ECECEA;
  --tr-day-sheet:   #F7F7F5;
  --tr-day-well:    #E1E2E0;
  --tr-day-rule:    #CDCECC;
  --tr-day-seam:    #B4B6B5;
  --tr-day-edge:    #727477;
  --tr-day-ash:     #76797B;
  --tr-day-ink-3:   #55585B;
  --tr-day-ink-2:   #2E3032;
  --tr-day-ink:     #0B0B0C;
  --tr-day-sodium:  #9E4A0D;
  --tr-day-mercury: #2A6290;
}

/* ---------------------------------------------------------------- Roles: Noir (default) */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --tr-bg:          #050505; /* Void */
  --tr-surface:     #0D0D0E; /* Carbon */
  --tr-well:        #161718; /* Gunmetal */
  --tr-line:        #242526; /* Rule */
  --tr-line-strong: #343537; /* Seam */
  --tr-field-edge:  #68696B; /* Edge */
  --tr-ref:         #737578; /* Ash: reference marks; never text */
  --tr-text:        #F2F2F0; /* White: headlines, figures */
  --tr-text-body:   #CDCECF; /* Silver: sentences */
  --tr-text-2:      #9FA1A3; /* Smoke: labels, meta, sources */
  --tr-reading:     #E3832E; /* Sodium */
  --tr-above:       #E3832E; /* Sodium: a reading above its reference (busier, higher) */
  --tr-below:       #8FB3CF; /* Mercury: a reading below its reference (quieter, lower) */
  --tr-about:       #737578; /* Ash: within the reference band ("about usual") */
  --tr-primary:     #F2F2F0; /* the primary button's fill */
  --tr-primary-hover:#CDCECF;
  --tr-on-primary:  #050505;
  --tr-focus:       #F2F2F0;
  --tr-bracket:     #4A4B4D; /* HUD corner brackets; decorative */
  --tr-glow:        242, 242, 240; /* RGB for rgba(); white glow only, see --tr-glow-max */
}

/* ---------------------------------------------------------------- Roles: Daylight
   Opt in per surface: <html data-theme="light">, or data-tr-surface="product" to follow the OS setting.
   Print always uses Daylight. */
[data-theme="light"] {
  color-scheme: light;
  --tr-bg:          #ECECEA;
  --tr-surface:     #F7F7F5;
  --tr-well:        #E1E2E0;
  --tr-line:        #CDCECC;
  --tr-line-strong: #B4B6B5;
  --tr-field-edge:  #727477;
  --tr-ref:         #76797B;
  --tr-text:        #0B0B0C;
  --tr-text-body:   #2E3032;
  --tr-text-2:      #55585B;
  --tr-reading:     #9E4A0D;
  --tr-above:       #9E4A0D;
  --tr-below:       #2A6290;
  --tr-about:       #76797B;
  --tr-primary:     #0B0B0C;
  --tr-primary-hover:#2E3032;
  --tr-on-primary:  #F7F7F5;
  --tr-focus:       #0B0B0C;
  --tr-bracket:     #B4B6B5;
  --tr-glow:        11, 11, 12;
}
@media (prefers-color-scheme: light) {
  [data-tr-surface="product"]:not([data-theme="dark"]) {
    color-scheme: light;
    --tr-bg: #ECECEA; --tr-surface: #F7F7F5; --tr-well: #E1E2E0; --tr-line: #CDCECC; --tr-line-strong: #B4B6B5;
    --tr-field-edge: #727477; --tr-ref: #76797B; --tr-text: #0B0B0C; --tr-text-body: #2E3032; --tr-text-2: #55585B;
    --tr-reading: #9E4A0D; --tr-above: #9E4A0D; --tr-below: #2A6290; --tr-about: #76797B;
    --tr-primary: #0B0B0C; --tr-primary-hover: #2E3032; --tr-on-primary: #F7F7F5; --tr-focus: #0B0B0C;
    --tr-bracket: #B4B6B5; --tr-glow: 11, 11, 12;
  }
}
@media print {
  :root, [data-theme] {
    --tr-bg: #FFFFFF; --tr-surface: #FFFFFF; --tr-well: #F2F2F0; --tr-line: #CDCECC; --tr-line-strong: #B4B6B5;
    --tr-field-edge: #727477; --tr-ref: #76797B; --tr-text: #0B0B0C; --tr-text-body: #2E3032; --tr-text-2: #55585B;
    --tr-reading: #9E4A0D; --tr-above: #9E4A0D; --tr-below: #2A6290; --tr-about: #76797B;
    --tr-primary: #0B0B0C; --tr-on-primary: #FFFFFF; --tr-focus: #0B0B0C; --tr-bracket: #B4B6B5;
    --tr-grain-opacity: 0; --tr-scan-opacity: 0; --tr-vignette: none;
  }
}

/* ---------------------------------------------------------------- Type */
:root {
  --tr-font-sans:  'Mona Sans', 'Helvetica Neue', Arial, system-ui, sans-serif;   /* display and text */
  --tr-font-serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;                /* one word over a visual, captions */
  --tr-font-mono:  'Red Hat Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; /* labels, small figures */

  /* Display: light and wide. Weights under 400 only at 32px and up. */
  --tr-display-xl: 200 clamp(3rem, 7.2vw, 6rem)/1 var(--tr-font-sans);        /* 48–96, wdth 125, -3% */
  --tr-display-l:  300 clamp(2.5rem, 5vw, 4rem)/1.06 var(--tr-font-sans);     /* 40–64, wdth 112.5, -2.5% */
  --tr-display-m:  300 clamp(1.75rem, 3.2vw, 2.5rem)/1.15 var(--tr-font-sans);/* 28–40, wdth 112.5, -2% */
  --tr-title:      500 1.375rem/1.27 var(--tr-font-sans);                     /* 22/28, wdth 100, -1% */
  --tr-lead:       400 1.1875rem/1.58 var(--tr-font-sans);                    /* 19/30 */
  --tr-body:       400 1rem/1.625 var(--tr-font-sans);                        /* 16/26 */
  --tr-small:      400 0.875rem/1.57 var(--tr-font-sans);                     /* 14/22 */
  --tr-serif-word: 300 clamp(2.5rem, 5vw, 4.5rem)/1 var(--tr-font-serif);    /* 40–72, opsz 72, -1% */
  --tr-serif-cap:  italic 300 1.125rem/1.45 var(--tr-font-serif);             /* 18/26, captions */
  --tr-label:      400 0.75rem/1.33 var(--tr-font-mono);                      /* 12/16, +2%: § and () labels */
  --tr-value:      400 0.875rem/1.43 var(--tr-font-mono);                     /* 14/20, tabular: figures in rows */
  --tr-axis:       400 0.6875rem/1.27 var(--tr-font-mono);                    /* 11/14: axis ticks, the only size under 12 */
  --tr-figure-xl:  200 clamp(2.5rem, 7vw, 5.5rem)/1 var(--tr-font-sans);      /* 40–88, wdth 125, tabular: the reading */
  --tr-figure-l:   300 clamp(2.25rem, 4vw, 3.5rem)/1.05 var(--tr-font-sans);  /* 36–56, wdth 112.5, tabular */
  --tr-wdth-wide: 125%;
  --tr-wdth-semi: 112.5%;
  --tr-wdth-text: 100%;
}

/* ---------------------------------------------------------------- Space, shape, lines */
:root {
  --tr-space-1: 4px;  --tr-space-2: 8px;  --tr-space-3: 12px; --tr-space-4: 16px;
  --tr-space-5: 24px; --tr-space-6: 32px; --tr-space-7: 48px; --tr-space-8: 72px; --tr-space-9: 120px;
  --tr-gutter: clamp(16px, 4vw, 40px);
  --tr-measure: 64ch;          /* longest line of body copy */
  --tr-radius: 2px;            /* buttons and fields; panels and cards are square */
  --tr-hairline: 1px;
  --tr-bracket-arm: 12px;      /* HUD corner brackets */
  /* The mark's proportions on a scale (unchanged from Ledger): bar 6, dot 9 (1.44 bars), gap 4 (0.68 bars). */
  --tr-bar: 6px; --tr-dot: 9px; --tr-dot-gap: 4px;
}

/* ---------------------------------------------------------------- Texture and light (see README, "Texture") */
:root {
  --tr-grain-opacity: 0.05;    /* 0.04–0.06 on Void; never above 0.08. Hero and photographs only */
  --tr-grain-size: 160px;      /* tile size of the noise */
  --tr-scan-opacity: 0.035;    /* scanlines: 1px light line every 3px. The globe and HUD frames only */
  --tr-scan-pitch: 3px;
  --tr-vignette: radial-gradient(ellipse 120% 90% at 50% 45%, rgba(5,5,5,0) 55%, rgba(5,5,5,0.6) 100%);
  --tr-glow-max: 0.12;         /* a light source inside a visual: white, never coloured, never behind text */
  --tr-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 2.2 -1.0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
@media (prefers-contrast: more) {
  :root { --tr-grain-opacity: 0; --tr-scan-opacity: 0; --tr-glow-max: 0; }
}

/* ---------------------------------------------------------------- Motion */
:root {
  --tr-ease: cubic-bezier(0.16, 1, 0.3, 1); /* ease-out for everything that moves */
  --tr-dur-1: 120ms;   /* hover and press colour */
  --tr-dur-2: 240ms;   /* a toast, a figure fading in */
  --tr-dur-3: 480ms;   /* a section opening, a panel's visual settling */
  --tr-globe-turn: 120s;   /* one revolution of the globe: 3 degrees a second */
  --tr-pulse: 4s;          /* the ring around a live reading */
  --tr-arc-pass: 6s;       /* one pass of an arc's head */
}
@media (prefers-reduced-motion: reduce) {
  :root { --tr-dur-1: 0ms; --tr-dur-2: 0ms; --tr-dur-3: 0ms; }
}

/* ---------------------------------------------------------------- The globe (homepage centrepiece). See README, "The globe". */
:root {
  --tr-globe-ocean-centre: #0B0B0C;
  --tr-globe-ocean-limb:   #060606;
  --tr-globe-land-lit:     #B4B6B8; /* a land dot facing the viewer, in daylight */
  --tr-globe-land-limb:    #3A3B3D; /* a land dot at the edge of the disc */
  --tr-globe-night:        0.45;    /* land dots on the night side, as a share of their day brightness */
  --tr-globe-graticule:    rgba(242, 242, 240, 0.10); /* dotted lines every 30 degrees */
  --tr-globe-limb:         rgba(242, 242, 240, 0.20); /* 1px edge of the disc */
  --tr-globe-haze:         rgba(242, 242, 240, 0.07); /* outer atmosphere, fades to 0 over 8% of the radius */
  --tr-globe-reading:      #E3832E; /* Sodium: live readings only */
  --tr-globe-arc:          rgba(227, 131, 46, 0.35);  /* arcs between two real places one reading joins */
  --tr-globe-arc-head:     rgba(227, 131, 46, 0.90);
}

/* ---------------------------------------------------------------- Data */
:root,
[data-theme="dark"] {
  --tr-data-above: #E3832E; /* solid, grows up from the reference line */
  --tr-data-below: #8FB3CF; /* solid, grows down from the reference line */
  --tr-data-about: #737578; /* within the band: short, grey */
  --tr-data-ref-line: #9FA1A3; /* the reference line itself, dashed 2/3 */
  --tr-data-grid: #1C1D1E;  /* gridlines; decorative */
}
[data-theme="light"] {
  --tr-data-above: #9E4A0D;
  --tr-data-below: #2A6290;
  --tr-data-about: #76797B;
  --tr-data-ref-line: #55585B;
  --tr-data-grid: #DADBD9;
}
