/* ==========================================================================
   H&H Machine Tools - Design tokens
   Source of truth: DESIGN_SYSTEM.md §2. Do not invent values outside this file.
   ========================================================================== */

:root {
  /* ---- Colour ---- */
  /* Machine red - sample exact value from machine paint / logo before launch [VERIFY] */
  --hh-red:      #D22730;
  --hh-red-dark: #A81C24;
  /* Small red text (index numbers, 11-14px) on the dark grounds: the brand red
     measures about 3.7:1 there, under WCAG AA's 4.5:1. This lighter red gives
     about 5.1:1 on black-1 and 4.8:1 on black-2. Text only; marks stay --hh-red. */
  --hh-red-text: #F0464E;

  /* Engineering neutrals */
  --hh-ink:     #1A1C1E;
  --hh-steel:   #4A4F55;
  --hh-grey:    #8B9096;
  --hh-line:    #D9DCDF;
  --hh-surface: #F4F5F6;
  --hh-paper:   #FFFFFF;

  /* Semantic */
  --hh-link:  var(--hh-red);
  --hh-focus: #1F3864;

  /* Redline dark system - Claude Design handoff, Aug 2026.
     Page grounds, hairlines and text steps for dark surfaces. */
  --hh-black-0:    #0B0C0D;   /* footer ground */
  --hh-black-1:    #101113;   /* page ground */
  --hh-black-2:    #16181a;   /* hover row */
  --hh-panel:      #1A1C1E;   /* raised dark panel (same as ink) */
  --hh-dline-1:    #2a2c2f;   /* primary dark hairline */
  --hh-dline-2:    #2a2c2f;   /* collapsed into dline-1 (hairline budget, 2026-11-13) */
  --hh-dline-3:    #2a2c2f;   /* collapsed into dline-1 (hairline budget, 2026-11-13) */
  --hh-dtext-1:    #F4F5F6;   /* primary text on dark */
  --hh-dtext-2:    #C6CACD;   /* secondary */
  --hh-dtext-3:    #9DA2A7;   /* labels, nav resting */
  --hh-dtext-4:    #8B9096;   /* body muted */
  --hh-dtext-5:    #838a91; /* lifted from #6b7075: 4.5:1+ on all grounds (AUDIT P1-8) */   /* tertiary / large only */

  --font-display: "IBM Plex Sans Condensed", "IBM Plex Sans", -apple-system, sans-serif;

  /* ---- Type ---- */
  --font-ui:   "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;

  --text-xs:   0.8rem;
  --text-sm:   0.9rem;
  --text-base: 1.0625rem;
  --text-lg:   1.33rem;
  --text-xl:   1.66rem;
  --text-2xl:  2.07rem;
  --text-3xl:  2.59rem;
  --text-hero: clamp(2.6rem, 6vw, 4.4rem);

  --leading-tight: 1.15;
  --leading-body:  1.6;

  /* ---- Space (8px grid) ---- */
  --sp-1: 0.5rem;
  --sp-2: 1rem;
  --sp-3: 1.5rem;
  --sp-4: 2rem;
  --sp-6: 3rem;
  --sp-8: 4rem;
  --sp-12: 6rem;
  --sp-16: 8rem;

  /* ---- Structure ---- */
  --measure: 68ch;
  --container: 1200px;
  --rule: 1px solid var(--hh-line);
  --rule-heavy: 2px solid var(--hh-ink);
  --radius: 2px;
}

/* ---- Fonts (self-hosted - drop woff2 files into /fonts, see fonts/README.md) ---- */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("/fonts/IBMPlexSansCondensed-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("/fonts/IBMPlexSansCondensed-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---- Base ---- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-family: var(--font-ui);
  font-size: 100%;
  color: var(--hh-ink);
  background: var(--hh-black-1); /* dark canvas: body alone leaves white overscroll/404 tail */
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--leading-body);
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: var(--leading-tight);
  margin: 0 0 var(--sp-3);
}

p { max-width: var(--measure); }

a {
  color: var(--hh-ink);
  text-decoration: underline;
  text-decoration-color: var(--hh-red);
  text-underline-offset: 0.15em;
}
a:hover { color: var(--hh-red); }

:focus-visible {
  outline: 2px solid var(--hh-focus);
  outline-offset: 2px;
}

/* Data numerals - the system's signature: any numeral that IS data uses this */
.data {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Small-caps eyebrow label */
.eyebrow {
  font-family: var(--font-data);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hh-steel);
}

/* Cross-document view transitions: same-origin navigations crossfade, and
   elements sharing a view-transition-name morph between pages (the machine
   render). Browsers without support simply navigate. */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
