/* ==========================================================================
   Commerce Wright — design tokens
   Light theme  = drafting paper (ink on white)
   Dark theme   = cyanotype (white linework on process blue)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Type — self-hosted, no third-party requests.

   Libre Franklin carries display and body both. It's a Franklin Gothic
   revival: the face of American newspapers, ballot papers and government
   notices. One family for everything is the point — the page reads as a
   document that was issued rather than a website that was styled.

   IBM Plex Mono handles the drafting layer: section numbers, schematic
   labels, dimensions, buttons.

   Libre Franklin ships as one variable file per subset (100–900), so every
   weight on the page costs a single 29 KB download.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Libre Franklin';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/librefranklin-var-100-900-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Libre Franklin';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/librefranklin-var-100-900-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibmplexmono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibmplexmono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibmplexmono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibmplexmono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  /* --- surfaces & ink ---------------------------------------------------- */
  --paper: #ffffff;
  --field: #eef2f6;
  --field-deep: #e2e9f0;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #5c6b7f;   /* 4.83:1 on --field, 5.43:1 on --paper — #64748b failed at 4.23 */
  --line: #94a3b8;
  --line-faint: #cbd5e1;
  --line-hair: #dde5ed;

  /* --- accents ----------------------------------------------------------- */
  --accent: #0f766e;
  --accent-deep: #115e56;
  --accent-wash: #e6f2f0;
  --mark: #c2410c;          /* red pen. budget: 4 uses per page */
  --mark-wash: #fdf0e8;

  --on-accent: #ffffff;
  --focus: #0f766e;

  /* --- schematic --------------------------------------------------------- */
  --grid-line: rgba(15, 23, 42, 0.055);
  --grid-line-major: rgba(15, 23, 42, 0.09);
  --schematic-stroke: #64748b;
  --schematic-fill: rgba(255, 255, 255, 0.86);
  --schematic-live: #0f766e;

  /* --- type -------------------------------------------------------------- */
  /* one family, three jobs — separated by weight, size and tracking, not by face */
  --font-display: 'Libre Franklin', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: 'Libre Franklin', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --t-display: clamp(2.5rem, 1.55rem + 4.1vw, 4.5rem);
  --t-h2: clamp(2rem, 1.2rem + 3.1vw, 3.5rem);
  --t-h3: clamp(1.375rem, 1.1rem + 1.1vw, 1.875rem);
  --t-h4: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --t-lead: clamp(1.0625rem, 1rem + 0.5vw, 1.3125rem);
  --t-body: 1rem;
  --t-sm: 0.9375rem;
  --t-mono: 0.75rem;
  --t-mono-sm: 0.6875rem;

  --lh-tight: 1.02;
  --lh-snug: 1.18;
  --lh-body: 1.62;
  --tracking-mono: 0.13em;
  --tracking-display: -0.026em;   /* Libre Franklin sets a touch wider than a grotesk */

  /* --- space (8px base) --------------------------------------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;
  --s-section: clamp(72px, 9vw, 144px);

  --shell: 1240px;
  --gutter: clamp(20px, 5vw, 64px);
  --measure: 68ch;
  --nav-h: 68px;

  /* --- lines & radii ------------------------------------------------------ */
  --hair: 1px;
  --stroke: 1.5px;
  --r-sm: 2px;
  --r-md: 3px;
  --r-pill: 999px;

  /* --- motion ------------------------------------------------------------- */
  --d-fast: 160ms;
  --d-mid: 240ms;
  --d-slow: 400ms;
  --e-out: cubic-bezier(0.22, 1, 0.36, 1);
  --e-in: cubic-bezier(0.55, 0, 1, 0.45);
  --e-inout: cubic-bezier(0.65, 0, 0.35, 1);

  --icon: 24px;
  --icon-sm: 18px;
}

/* ==========================================================================
   Cyanotype
   ========================================================================== */

:root[data-theme='dark'] {
  --paper: #0b1f2a;
  --field: #12303f;
  --field-deep: #164054;
  --ink: #eaf4f8;
  --ink-2: #9fbfce;
  --ink-3: #86a9ba;
  --line: #4e7a8e;
  --line-faint: #2a4f62;
  --line-hair: #1d3d4e;

  --accent: #4fd1c5;
  --accent-deep: #7ee0d7;
  --accent-wash: rgba(79, 209, 197, 0.11);
  --mark: #fb923c;
  --mark-wash: rgba(251, 146, 60, 0.12);

  --on-accent: #04252b;
  --focus: #4fd1c5;

  --grid-line: rgba(158, 214, 235, 0.07);
  --grid-line-major: rgba(158, 214, 235, 0.12);
  --schematic-stroke: #7ba8bd;
  --schematic-fill: rgba(11, 31, 42, 0.72);
  --schematic-live: #4fd1c5;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0b1f2a;
    --field: #12303f;
    --field-deep: #164054;
    --ink: #eaf4f8;
    --ink-2: #9fbfce;
    --ink-3: #86a9ba;
    --line: #4e7a8e;
    --line-faint: #2a4f62;
    --line-hair: #1d3d4e;

    --accent: #4fd1c5;
    --accent-deep: #7ee0d7;
    --accent-wash: rgba(79, 209, 197, 0.11);
    --mark: #fb923c;
    --mark-wash: rgba(251, 146, 60, 0.12);

    --on-accent: #04252b;
    --focus: #4fd1c5;

    --grid-line: rgba(158, 214, 235, 0.07);
    --grid-line-major: rgba(158, 214, 235, 0.12);
    --schematic-stroke: #7ba8bd;
    --schematic-fill: rgba(11, 31, 42, 0.72);
    --schematic-live: #4fd1c5;
  }
}
