/* ==========================================================================
   Tinker Shed / Bridge Learning — Typography tokens
   Extracted from tinkershed.bridgelearn.org (2026-11-16), with fixes:
     1. No faux bold: Handycasual ships one weight (400) → display weight is 400,
        and font-synthesis is off so browsers can't fake it.
     2. No unloaded weights: Open Sans 500 removed; text that asked for 500
        (and rendered as 400) now uses 400 explicitly.
     3. Only fonts/weights in use are loaded: Open Sans 400/600/700;
        Gagalin, Chewy, Handyman and Open Sans 300/800 dropped.
     4. One scale, one line-height per role.
   ========================================================================== */

/* --- Font loading -------------------------------------------------------- */
/* Load in <head> (faster than @import):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap">
   <link rel="preload" href="/fonts/HandyCasual.ttf" as="font" type="font/ttf" crossorigin>
*/

@font-face {
  font-family: "Handycasual";
  src: url("/fonts/HandyCasual.ttf") format("truetype"); /* convert to .woff2 for ~60% smaller files */
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* --- Families ---------------------------------------------------------- */
  --font-display: "Handycasual", "Comic Neue", "Trebuchet MS", sans-serif;
  --font-body: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* --- Weights (only what is actually loaded) ---------------------------- */
  --weight-display: 400;   /* Handycasual has no bold — never go above 400 */
  --weight-regular: 400;   /* Open Sans */
  --weight-semibold: 600;  /* Open Sans */
  --weight-bold: 700;      /* Open Sans */

  /* --- Size scale -------------------------------------------------------- */
  --text-60: 3.75rem;   /* 60px */
  --text-40: 2.5rem;    /* 40px */
  --text-24: 1.5rem;    /* 24px */
  --text-20: 1.25rem;   /* 20px */
  --text-18: 1.125rem;  /* 18px */
  --text-16: 1rem;      /* 16px */
  --text-14: 0.875rem;  /* 14px */

  /* --- Line heights ------------------------------------------------------ */
  --leading-display: 1.1;  /* 60, 40 */
  --leading-heading: 1.2;  /* 24, 20 */
  --leading-ui: 1.3;       /* buttons, labels, short titles */
  --leading-body: 1.6;     /* paragraphs, lists */

  /* --- Letter spacing ---------------------------------------------------- */
  --tracking-display: 0.04em;  /* ≈ the site's 1px at 24px; scales with size */
  --tracking-normal: 0;

  /* --- Colour ------------------------------------------------------------ */
  --color-heading: #150438;
  --color-body: #6d6d6d;

  /* --- Semantic roles ---------------------------------------------------- */
  /* Display (Handycasual) */
  --type-h1-size: clamp(2.5rem, 1.75rem + 3.2vw, var(--text-60)); /* 40 → 60px */
  --type-h2-size: clamp(1.75rem, 1.4rem + 1.6vw, var(--text-40)); /* 28 → 40px */
  --type-h3-size: var(--text-24);
  --type-h4-size: var(--text-20);
  --type-nav-size: var(--text-18);
  --type-link-size: var(--text-16);

  /* Body (Open Sans) */
  --type-lead-size: var(--text-18);
  --type-body-size: var(--text-16);
  --type-small-size: var(--text-14);
}

/* --- Base ------------------------------------------------------------------ */
html {
  font-synthesis: none;            /* fix #1: never fake bold/italic */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--type-body-size);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  color: var(--color-body);
}

/* --- Display roles (Handycasual) ----------------------------------------- */
h1, .t-h1, h2, .t-h2, h3, .t-h3, h4, .t-h4, .t-nav, .t-link-display {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  letter-spacing: var(--tracking-display);
  color: var(--color-heading);
}
h1, .t-h1 { font-size: var(--type-h1-size); line-height: var(--leading-display); }
h2, .t-h2 { font-size: var(--type-h2-size); line-height: var(--leading-display); }
h3, .t-h3 { font-size: var(--type-h3-size); line-height: var(--leading-heading); }
h4, .t-h4 { font-size: var(--type-h4-size); line-height: var(--leading-heading); }
.t-nav          { font-size: var(--type-nav-size);  line-height: var(--leading-ui); }
.t-link-display { font-size: var(--type-link-size); line-height: var(--leading-ui); }

/* --- Body roles (Open Sans) ---------------------------------------------- */
h5, .t-title {   /* card titles, H5, the old Open Sans 22px H3 */
  font-family: var(--font-body);
  font-size: var(--text-18);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-ui);
  letter-spacing: var(--tracking-normal);
  color: var(--color-heading);
}
.t-lead  { font-size: var(--type-lead-size);  line-height: var(--leading-body); }
.t-body  { font-size: var(--type-body-size);  line-height: var(--leading-body); }
.t-small { font-size: var(--type-small-size); line-height: var(--leading-body); font-weight: var(--weight-regular); } /* fix #2: was 500 */

.t-button, button {
  font-family: var(--font-body);
  font-size: var(--text-16);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-ui);
}
.t-button-sm { font-size: var(--text-14); font-weight: var(--weight-semibold); line-height: var(--leading-ui); }

strong, b { font-weight: var(--weight-bold); }
