/* ============================================================
   RapidEdge Solutions — Foundations
   colors_and_type.css
   ------------------------------------------------------------
   "Drafting" palette — wet pen ink (the same deep blue as the
   wet-ink palette) on a brighter, cooler-tinted paper that
   reads as engineering drafting stock instead of warm parchment.
   Surfaces shift from FAFAF7 (warm cream) toward FBFCFE
   (whiter, with a barely-perceptible cool cast that resonates
   with the blue accent). Ink cool, hairlines steel.

   Seven sibling backups live alongside this file:
     - colors_and_type.cream.css   : original (cream + oxblood)
     - colors_and_type.oxblood.css : near-white + oxblood
     - colors_and_type.wetink.css  : warm-near-white + wet pen ink
     - colors_and_type.forest.css  : near-white + forest green
     - colors_and_type.mustard.css : near-white + dark mustard
     - colors_and_type.plum.css    : near-white + deep plum
     - colors_and_type.tikka.css   : near-white + tikka orange
   `cp` the desired sibling over this file to revert.
   ============================================================ */

/* Webfonts — see /fonts/README.md for self-host swap.
   Source Serif 4 = editorial body + display
   IBM Plex Sans  = UI, navigation, spec tables
   JetBrains Mono = item numbers, lot codes, code
   Inter is BANNED.                                            */
@import url("https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,300;8..60,400;8..60,500;8..60,600;8..60,700&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

:root {
  /* ---------- Surfaces ----------
     Drafting paper. Brighter and cooler than the cream-tinted
     near-whites — the slight cool cast resonates with the wet
     pen ink accent without leaning fully clinical white.       */
  --paper:        #FBFCFE;   /* default page background  */
  --paper-pulp:   #F3F5F8;   /* cards, sheets, insets    */
  --paper-aged:   #E5E9EE;   /* hover / tonal blocks     */
  --paper-shade:  #EEF1F5;   /* between paper & aged     */

  /* ---------- Ink ----------
     Cool near-black. Never pure #000.                          */
  --ink:          #14171F;   /* primary text            */
  --ink-2:        #2E333D;   /* secondary text          */
  --ink-3:        #5A6170;   /* tertiary, captions      */
  --ink-4:        #8C92A0;   /* disabled, watermarks    */

  /* ---------- Brand ink ----------
     Wet fountain-pen ink — a deep, slightly green-shifted
     blue-black. Same value as the original wet-ink palette;
     reads stronger here because the cooler paper sits in the
     same temperature family.                                    */
  --oxblood:      #182D5E;   /* wet pen ink              */
  --oxblood-deep: #0E1F45;   /* pressed                  */
  --oxblood-ink:  #08152F;   /* stamp on dark surface    */

  --forest:       #3D4858;   /* slate, eyebrow + status  */
  --forest-deep:  #28323E;
  --forest-soft:  #5A6478;

  /* ---------- Decorative ----------
     Steel hairline.                                              */
  --brass:        #B6BAC0;
  --brass-soft:   #D1D5DB;
  --brass-deep:   #757B85;

  /* ---------- Semantic / errata ----------
     Rust-red is reserved for warnings, recalls, errata.
     Do not use as a brand accent.                              */
  --rust:         #B8412E;
  --rust-deep:    #8C2F20;

  /* ---------- Type families ---------- */
  --serif:  "Source Serif 4", "Source Serif Pro", "Iowan Old Style", Georgia, serif;
  --sans:   "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono:   "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ---------- Type scale ----------
     Editorial / catalog scale, not webapp scale. Smallest body
     is 15px — anything below that is for legal & lot codes.    */
  --fs-xs:   12px;
  --fs-sm:   14px;
  --fs-base: 16px;
  --fs-md:   18px;
  --fs-lg:   22px;
  --fs-xl:   28px;
  --fs-2xl:  36px;
  --fs-3xl:  48px;
  --fs-4xl:  64px;
  --fs-display: 88px;

  /* Line heights — tight on display, generous on body. */
  --lh-tight:   1.05;
  --lh-snug:    1.2;
  --lh-body:    1.55;
  --lh-loose:   1.7;

  /* Tracking — sans uses tight tracking, mono runs loose for
     stamped item numbers.                                      */
  --tr-tight:    -0.01em;
  --tr-base:     0;
  --tr-loose:    0.04em;
  --tr-stamp:    0.12em;   /* mono item-numbers, stamps */
  --tr-eyebrow:  0.18em;   /* small-caps eyebrows       */

  /* ---------- 8-column editorial grid ----------
     Real 8-col baseline grid with asymmetric splits.
     Default gutter 24, baseline 8. Tailwind 12-col is BANNED.  */
  --grid-cols:    8;
  --grid-gutter:  24px;
  --grid-baseline: 8px;
  --grid-max-w:   1240px;
  --grid-margin:  48px;

  /* ---------- Spacing scale (multiples of 4) ---------- */
  --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;

  /* ---------- Borders ----------
     Components are stamped/pinned, not floating. Hairlines are
     brass on cream; ink rules are pulled at 1.5px so they read
     like printed plates.                                       */
  --hair:   1px solid var(--brass);
  --hair-soft: 1px solid color-mix(in oklab, var(--brass) 50%, var(--paper));
  --rule:   1.5px solid var(--ink);
  --rule-thick: 3px solid var(--ink);
  --rule-double: 1.5px solid var(--ink);  /* paired with ::after */

  /* ---------- Radii ----------
     Catalog UI is square. Soft 2px is the ceiling on most things;
     pills (4px) are reserved for status tags. No 16px+ blobs.   */
  --r-0: 0px;
  --r-1: 2px;
  --r-2: 4px;     /* status tags, item-number chips */
  --r-pill: 999px; /* RARELY — only for true pills  */

  /* ---------- Shadow / elevation ----------
     We do not float. Components are stamped onto paper. The only
     "shadow" allowed is the printed-plate shadow: a tight,
     low-opacity warm shadow that simulates a sheet on a desk.   */
  --plate:        0 1px 0 color-mix(in oklab, var(--ink) 10%, transparent), 0 0 0 1px color-mix(in oklab, var(--brass) 32%, transparent);
  --plate-deep:   0 2px 0 color-mix(in oklab, var(--ink) 12%, transparent), 0 0 0 1px color-mix(in oklab, var(--brass) 50%, transparent);
  --press:        inset 0 1px 0 color-mix(in oklab, var(--ink) 18%, transparent);

  /* Stacked tinted shadows are BANNED. */
}

/* ============================================================
   SEMANTIC ELEMENTS
   These map raw tokens onto every common HTML element so an
   unstyled page reads as RapidEdge by default.
   ============================================================ */

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

/* Display + headings — Source Serif 4, weight 600/700,
   tight leading. Used for editorial titles & catalog plate
   headers. UI-grade headings (in spec tables, dialogs) use
   .h-ui- classes and IBM Plex Sans.                            */
h1, .h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--fs-3xl);
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
  margin: 0;
}
h2, .h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--fs-2xl);
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-tight);
  margin: 0;
}
h3, .h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  margin: 0;
}
h4, .h4 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--fs-md);
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-base);
  margin: 0;
}

/* Display (hero, section opener) — Source Serif 4 at large
   optical size. Always paired with a small-caps eyebrow above.  */
.display {
  font-family: var(--serif);
  font-variation-settings: "opsz" 60;
  font-weight: 500;
  font-size: var(--fs-display);
  line-height: 0.98;
  letter-spacing: -0.015em;
}

/* Editorial body — serif, 18px default, loose leading. */
p, .body {
  font-family: var(--serif);
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  color: var(--ink);
  margin: 0 0 var(--s-4);
  text-wrap: pretty;
  hanging-punctuation: first last;
}

/* UI body — IBM Plex Sans, 15px. Used in nav, spec tables,
   form fields, sidebar, status. Never inside editorial copy.    */
.ui, .ui-body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--ink);
}

/* Eyebrow — small-caps, brass, wide tracking. Used above titles
   and at the top of section headers like a printed catalog
   department label. ("MICROCONTROLLERS · 02") */
.eyebrow {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  color: var(--forest);
}

/* Item number — JetBrains Mono, stamped. Always uppercase.
   Format RE-XXYY-Z. Default color is oxblood when used as a
   stamp; ink when used inline.                                  */
.item-no {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: var(--tr-stamp);
  text-transform: uppercase;
  color: var(--oxblood);
}

/* Caption — sans, 13px, ink-3. For figure captions, signoffs,
   datelines.                                                    */
figcaption, .caption {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}

/* Code & lot codes */
code, pre, kbd, samp, .mono {
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0;
}
pre {
  background: var(--paper-pulp);
  border: var(--hair);
  padding: var(--s-4) var(--s-5);
  overflow: auto;
}

/* Links — oxblood, single underline at 2px offset. No hover-fade
   to lighter color; instead, hover swaps to a brass underline.   */
a {
  color: var(--oxblood);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklab, var(--oxblood) 60%, transparent);
}
a:hover {
  text-decoration-color: var(--brass);
}

/* Rules — printed plate hairlines */
hr {
  border: 0;
  border-top: var(--hair);
  margin: var(--s-7) 0;
}

/* Spec table — sans, tight, ruled. For pinout tables, BOMs. */
table.spec {
  font-family: var(--sans);
  font-size: 14px;
  border-collapse: collapse;
  width: 100%;
}
table.spec th,
table.spec td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: var(--hair-soft);
  vertical-align: baseline;
}
table.spec th {
  font-weight: 600;
  color: var(--forest);
  text-transform: uppercase;
  letter-spacing: var(--tr-eyebrow);
  font-size: 11.5px;
  border-bottom: 1.5px solid var(--ink);
}
table.spec td.num,
table.spec th.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* Selection — oxblood wash on cream */
::selection {
  background: var(--oxblood);
  color: var(--paper);
}
