/* tqx-type_v001.css
 * TEQTONIX type tokens v001 — 2026-11-28
 * Applies Creative's type_system_v001_2026-11-28.md exactly.
 *
 * Verified live (curl), do not guess:
 *   apple.com HTML links /wss/fonts?families=SF+Pro,v3|SF+Pro+Icons,v3
 *   which serves @font-face for "SF Pro Display", "SF Pro Text" and "SF Pro Icons"
 *   at /wss/fonts/SF-Pro-{Display,Text,Icons}/v3/*.woff2
 *   (each face marked "(C) 2019 Apple Inc. All rights reserved.").
 *   Homepage CSS then sets font-family: SF Pro Display (headings) and
 *   SF Pro Text (body), plus SF Pro Icons.
 *   Source: https://www.apple.com/  and
 *           https://www.apple.com/wss/fonts?families=SF+Pro,v3|SF+Pro+Icons,v3
 *
 *   jw.org collector.css @font-face family NotoSans (400/700, roman+italic)
 *   and NotoSerif (400/700, roman+italic), version 2.015 / 2.004, from
 *   https://b.jw-cdn.org/fonts/noto-sans/2.015/hinted/NotoSans-Regular.woff2
 *   English UI stack: NotoSans, Arial, "Arial Unicode MS", sans-serif
 *   Source: https://www.jw.org/en/  and
 *           https://www.jw.org/assets/ct/111f35ab7d/collector.css
 *
 * Licence:
 *   SF Pro must NEVER be bundled or self-hosted. Apple's San Francisco Font
 *   License (developer.apple.com/fonts/) forbids embedding the Apple Font in
 *   software or website content, and forbids redistributing the files.
 *   Apple devices get SF through -apple-system / BlinkMacSystemFont.
 *
 *   Noto Sans / Noto Serif are SIL Open Font License 1.1
 *   (https://scripts.sil.org/OFL). Self-hosted here as official woff2
 *   from notofonts.github.io, Version 2.015, subset to Latin + Latin-ext.
 *   Full OFL text: fonts/OFL.txt
 *
 * Metric overrides (Creative: fallback tuned to Noto, so swap has no CLS):
 *   Noto itself is served at its native metrics (no size-adjust on the
 *   webfont). A local "Noto Sans Fallback" face (Arial, then Liberation
 *   Sans) is size-adjusted to Noto so the layout does not jump while
 *   font-display: swap brings the webfont in. Figures from
 *   @capsizecss/metrics 4.5.0 (MIT):
 *     Noto Sans Regular: UPM 1000, ascent 1069, descent -293, lineGap 0,
 *                        xWidthAvg 474
 *     Arial:             UPM 2048, ascent 1854, descent -434, lineGap 67,
 *                        xWidthAvg 913
 *   size-adjust      = (474/1000) / (913/2048) = 106.33%
 *   ascent-override  = (1069/1000) / 1.0633   = 100.54%
 *   descent-override = ( 293/1000) / 1.0633   =  27.56%
 *   "Noto Sans Fallback" sits after "Noto Sans" and before system-ui,
 *   so Windows does not flash Segoe UI at the wrong size.
 *
 *   SF is never bundled. Apple devices get it through -apple-system.
 *   Hosted Noto files are official Version 2.015 (name table
 *   2.015;GOOG;NotoSans-Regular / NotoSans-Italic / NotoSerif-Italic),
 *   Latin + Latin-ext, SIL OFL 1.1. Confirmed no SF files in fonts/.
 */


/* -------------------------------------------------------------------------- */
/* Self-hosted Noto (OFL). Never add an SF @font-face.                         */
/* -------------------------------------------------------------------------- */

@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSans-latin-ext[wght].woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("fonts/NotoSans-Italic-latin-ext[wght].woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* Local fallback, size-adjusted to Noto, to prevent layout shift on swap. */
@font-face {
  font-family: "Noto Sans Fallback";
  src: local("Arial"), local("Liberation Sans");
  font-weight: 100 900;
  font-style: normal;
  size-adjust: 106.33%;
  ascent-override: 100.54%;
  descent-override: 27.56%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Noto Sans Fallback";
  src: local("Arial Italic"), local("Arial Oblique"), local("Liberation Sans Italic");
  font-weight: 100 900;
  font-style: italic;
  size-adjust: 106.33%;
  ascent-override: 100.54%;
  descent-override: 27.56%;
  line-gap-override: 0%;
}

/* Optional. Off by default. Pull quotes only, 400 italic, at most once a page. */
@font-face {
  font-family: "Noto Serif";
  src: url("fonts/NotoSerif-Italic-latin-ext-400.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* -------------------------------------------------------------------------- */
/* Tokens — Creative type_system_v001, applied exactly                         */
/* -------------------------------------------------------------------------- */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Noto Sans", "Noto Sans Fallback", system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif-quote: "Noto Serif", "Times New Roman", Times, serif;

  --font-weight-display: 800;
  --font-weight-heading: 700;
  --font-weight-label: 600;
  --font-weight-body: 400;

  /* clamp() interpolates mobile → desktop between 360px and 1280px viewports */
  --tqx-display: clamp(40px, calc(40px + 24 * ((100vw - 360px) / 920)), 64px);
  --tqx-h1: clamp(32px, calc(32px + 16 * ((100vw - 360px) / 920)), 48px);
  --tqx-h2: clamp(26px, calc(26px + 10 * ((100vw - 360px) / 920)), 36px);
  --tqx-h3: clamp(21px, calc(21px + 7 * ((100vw - 360px) / 920)), 28px);
  --tqx-h4: clamp(18px, calc(18px + 4 * ((100vw - 360px) / 920)), 22px);
  --tqx-body-lg: clamp(18px, calc(18px + 1 * ((100vw - 360px) / 920)), 19px);
  --tqx-body: clamp(16px, calc(16px + 1 * ((100vw - 360px) / 920)), 17px);
  --tqx-small: clamp(14px, calc(14px + 1 * ((100vw - 360px) / 920)), 15px);
  --tqx-caption: 13px;
  --tqx-overline: clamp(12px, calc(12px + 1 * ((100vw - 360px) / 920)), 13px);

  --tqx-leading-display: 1.05;
  --tqx-leading-h1: 1.10;
  --tqx-leading-h2: 1.15;
  --tqx-leading-h3: 1.20;
  --tqx-leading-h4: 1.30;
  --tqx-leading-body-lg: 1.55;
  --tqx-leading-body: 1.55;
  --tqx-leading-small: 1.45;
  --tqx-leading-caption: 1.40;
  --tqx-leading-overline: 1.30;

  --tqx-track-display: -0.022em;
  --tqx-track-h1: -0.020em;
  --tqx-track-h2: -0.015em;
  --tqx-track-h3: -0.010em;
  --tqx-track-h4: -0.005em;
  --tqx-track-body: 0;
  --tqx-track-small: 0.005em;
  --tqx-track-caption: 0.01em;
  --tqx-track-overline: 0.06em;

  --tqx-measure: 65ch;
  --tqx-paragraph-spacing: 0.75em;

  --tqx-text: #1d1d1f;
  --tqx-text-secondary: #4a4a4f;
  --tqx-bg: #f6f4f0;
  --tqx-panel: #ffffff;
  --tqx-line: rgba(29, 29, 31, 0.12);
  --tqx-teal: #0b7a75; /* TEQTONIX family teal; 5.18:1 on white, 4.71:1 on paper */
  --tqx-on-teal: #ffffff;
}

/* Screenshot / comparison helpers. Default page uses the official stack. */
html[data-stack="noto"] {
  --font-sans: "Noto Sans", "Noto Sans Fallback", sans-serif;
}

html[data-stack="sf"] {
  --font-sans: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* -------------------------------------------------------------------------- */
/* Base                                                                      */
/* -------------------------------------------------------------------------- */

html {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-body);
  font-size: var(--tqx-body);
  line-height: var(--tqx-leading-body);
  letter-spacing: var(--tqx-track-body);
  color: var(--tqx-text);
  background: var(--tqx-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font: inherit;
  color: inherit;
  background: var(--tqx-bg);
}

p {
  margin: 0 0 var(--tqx-paragraph-spacing);
  max-width: var(--tqx-measure);
}

p:last-child {
  margin-bottom: 0;
}

/* -------------------------------------------------------------------------- */
/* Type roles                                                                */
/* -------------------------------------------------------------------------- */

.tqx-display,
.tqx-h1, h1,
.tqx-h2, h2,
.tqx-h3, h3,
.tqx-h4, h4 {
  margin: 0;
  color: var(--tqx-text);
  font-family: var(--font-sans);
}

.tqx-display {
  font-size: var(--tqx-display);
  font-weight: var(--font-weight-display);
  line-height: var(--tqx-leading-display);
  letter-spacing: var(--tqx-track-display);
}

.tqx-h1, h1 {
  font-size: var(--tqx-h1);
  font-weight: var(--font-weight-display);
  line-height: var(--tqx-leading-h1);
  letter-spacing: var(--tqx-track-h1);
}

.tqx-h2, h2 {
  font-size: var(--tqx-h2);
  font-weight: var(--font-weight-heading);
  line-height: var(--tqx-leading-h2);
  letter-spacing: var(--tqx-track-h2);
}

.tqx-h3, h3 {
  font-size: var(--tqx-h3);
  font-weight: var(--font-weight-heading);
  line-height: var(--tqx-leading-h3);
  letter-spacing: var(--tqx-track-h3);
}

.tqx-h4, h4 {
  font-size: var(--tqx-h4);
  font-weight: var(--font-weight-label);
  line-height: var(--tqx-leading-h4);
  letter-spacing: var(--tqx-track-h4);
}

.tqx-body-lg {
  font-size: var(--tqx-body-lg);
  font-weight: var(--font-weight-body);
  line-height: var(--tqx-leading-body-lg);
  letter-spacing: var(--tqx-track-body);
}

.tqx-body {
  font-size: var(--tqx-body);
  font-weight: var(--font-weight-body);
  line-height: var(--tqx-leading-body);
  letter-spacing: var(--tqx-track-body);
}

.tqx-small {
  font-size: var(--tqx-small);
  font-weight: var(--font-weight-body);
  line-height: var(--tqx-leading-small);
  letter-spacing: var(--tqx-track-small);
}

.tqx-caption {
  font-size: var(--tqx-caption);
  font-weight: var(--font-weight-body);
  line-height: var(--tqx-leading-caption);
  letter-spacing: var(--tqx-track-caption);
  color: var(--tqx-text-secondary);
}

.tqx-overline {
  font-size: var(--tqx-overline);
  font-weight: var(--font-weight-label);
  line-height: var(--tqx-leading-overline);
  letter-spacing: var(--tqx-track-overline);
  text-transform: uppercase;
  color: var(--tqx-text-secondary);
}

.tqx-emphasis,
strong {
  font-weight: var(--font-weight-label); /* 600; never 800 inside paragraphs */
}

.tqx-label,
nav {
  font-weight: var(--font-weight-label);
}

/* Numbers in dashboards, tables and prices */
.tqx-nums,
.tqx-dashboard,
.tqx-dashboard table,
.tqx-price {
  font-variant-numeric: tabular-nums;
}

/* Optional pull quote. Do not use Noto Serif in UI, dashboards, headings or nav. */
.tqx-pullquote {
  font-family: var(--font-serif-quote);
  font-weight: 400;
  font-style: italic;
  font-size: var(--tqx-body-lg);
  line-height: var(--tqx-leading-body-lg);
  letter-spacing: 0;
  color: var(--tqx-text);
  max-width: var(--tqx-measure);
}

/* Buttons */
.tqx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0.7em 1.15em;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: var(--tqx-body);
  font-weight: var(--font-weight-label);
  line-height: 1.2;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
  color: var(--tqx-on-teal);
  background: var(--tqx-teal);
}

.tqx-btn:hover,
.tqx-btn:focus-visible {
  filter: brightness(0.96);
}

.tqx-btn-secondary {
  color: var(--tqx-text);
  background: var(--tqx-panel);
  border-color: var(--tqx-line);
}

a.tqx-link,
.tqx-link {
  color: var(--tqx-teal);
  font-weight: var(--font-weight-label);
  text-decoration: none;
}

a.tqx-link:hover,
.tqx-link:hover {
  text-decoration: underline;
}

/* Utility: secondary body colour */
.tqx-muted {
  color: var(--tqx-text-secondary);
}
