/* TitrateLab design tokens.
 *
 * These custom properties are the single source of truth for palette,
 * typography, and spacing across titratelab.com and the vendor-intel
 * SPA. Import once at the top of any template: navy + gold carry over
 * from the existing viewer palette so the rebrand evolves rather than
 * shocks existing pages.
 */

:root {
  /* ── Palette — GitHub-dark ("dimmed") reskin (2026-06-03) ──────────────
   * The marketing site now shares the same #0d1117 / #161b22 / #58a6ff
   * palette the authenticated dashboard adopted (see customer/_base.html's
   * #tl-github-theme block). This is a PURE color remap that preserves each
   * token's ROLE in the cascade — every consumer keeps its meaning, only the
   * hex moves — so the navy→canvas, gold→accent-blue swap propagates to all
   * ~17 top-level marketing templates that import this stylesheet without any
   * per-template structural change. Prior light-editorial values kept inline
   * in the trailing comments for provenance. */

  /* ── Surfaces (were navy) ─────────────────────────────────── */
  --tl-navy:            #08090A;   /* page / canvas — was #0F1E3D */
  --tl-navy-soft:       #101216;   /* elevated / raised panels — was #1a2d56 */

  /* ── Accent (were gold) ───────────────────────────────────── */
  --tl-gold:            #F0B544;   /* primary accent / links — was #DAA520 */
  --tl-gold-soft:       #F5C869;   /* accent hover — was #b8881a */
  --tl-gold-on-cream:   #F0B544;   /* accent on (now dark) surfaces — was #a37c12 */
  --tl-gold-on-light:   #F5C869;   /* prose-link accent — was #8a6810 */

  /* ── Status (kept as distinct hues, aligned to GitHub palette) ── */
  --tl-signal-green:    #5BD08A;   /* live / fresh / success — was #4ADE80 */
  --tl-caution-amber:   #F0B544;   /* stale / flagged / warning — was #F59E0B */
  --tl-alert-red:       #E4644C;   /* scam / exit-scam / critical — was #DC2626 */

  /* ── Neutrals (paper/ink now resolve to dark-theme text) ──────
   * --tl-paper was the cream editorial surface AND the light text on navy;
   * it now resolves to the GitHub primary body-text color. The handful of
   * places that used it as a *background* are re-pointed to --tl-navy
   * (canvas) by the targeted overrides below + in their templates. */
  --tl-paper:           #c9d1d9;   /* primary body text — was #FAFAF7 (cream surf) */
  --tl-ink:             #e6e6e6;   /* headings / emphasis text — was #1A1A1A */
  --tl-muted:           #8b949e;   /* secondary / muted text — was #5a5a55 */
  --tl-muted-on-dark:   #8b949e;   /* secondary on dark — was #aab1c2 */
  --tl-border:          #30363d;   /* hairline dividers / borders — was #d8d8d2 */
  --tl-control-border:  #646a71;   /* interactive control outline — WCAG AA */
  --tl-border-muted:    #21262d;   /* subtle divider (GitHub) — new */
  --tl-canvas-inset:    #0b0f14;   /* inset surface (form fields) — new */

  /* ── Typography — Assay system (2026-07-02) ────────────────
   * Satoshi (body) + Fraunces (italic serif accents) + JetBrains Mono
   * (data/eyebrows). Space Grotesk carries display/headings via
   * per-template rules. CSS vars don't load font FILES — every template
   * that consumes these tokens must link the fontshare Satoshi CSS +
   * Google Fraunces/Space Grotesk/JetBrains Mono stylesheets. */
  --tl-serif:   'Fraunces', Georgia, serif;
  --tl-mono:    "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", monospace;
  --tl-sans:    'Satoshi', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* ── Spacing (t-shirt scale) ─────────────────────────────── */
  --tl-space-1: 4px;
  --tl-space-2: 8px;
  --tl-space-3: 12px;
  --tl-space-4: 16px;
  --tl-space-5: 20px;
  --tl-space-6: 24px;
  --tl-space-8: 32px;
  --tl-space-10: 40px;
  --tl-space-12: 48px;
  --tl-space-16: 64px;
  --tl-space-24: 96px;

  /* ── Radii + shadows ─────────────────────────────────────── */
  --tl-radius-sm: 3px;
  --tl-radius-md: 6px;
  --tl-radius-lg: 12px;
  --tl-shadow-sm: 0 1px 2px rgba(255,255,255,0.06);
  --tl-shadow-md: 0 4px 12px rgba(255,255,255,0.12);

  /* ── Order-reveal card hierarchy (2026-05-26) ────────────────
   * Tokens for the /dashboard/order/reveal match-card polish pass.
   * Match-card has its own hierarchy contract: BEST MATCH dominates,
   * trust score is a headline number, TOTAL outweighs DELIVERY/COA.
   * Sized in ems so they scale cleanly under user font-size prefs. */
  --og-badge-size-primary:   12px;   /* BEST MATCH — bigger, louder */
  --og-badge-size-secondary: 11px;   /* close_match / alternative */
  --og-trust-size:           15px;   /* trust score numeral — was 12px */
  --og-metric-total-size:    20px;   /* TOTAL value — headline metric */
  --og-metric-aux-size:      13px;   /* DELIVERY / COA values */
  --og-card-glow-best:       0 0 0 1px rgba(88, 166, 255, 0.45),
                             0 12px 28px -8px rgba(88, 166, 255, 0.32),
                             0 4px 12px rgba(13, 17, 23, 0.18);
}

/* ── Global readability cap ─────────────────────────────────
 * Intro paragraphs and hero subtitles read best at ~62ch — the classic
 * long-form measure. Individual templates may override with a narrower
 * max-width (58/60ch) when the surrounding layout calls for it; that's
 * fine because same-specificity rules defined later in the cascade win
 * (template-local <style> blocks load after this shared stylesheet).
 * This ceiling only kicks in where a template forgot to set one. */
.tl-section-intro,
.tl-hero-subtitle,
.tl-hero p { max-width: 62ch; }

/* ── Prose-link a11y baseline (a11y audit 2026-05-09) ────────
 * WCAG 1.4.1 Use of Color: links inside prose must be distinguishable
 * from surrounding text by something other than color. Apply a thin
 * underline to anchors in body-prose contexts. Nav, CTA buttons,
 * footer-link rows, and stylized link components keep their existing
 * treatments by NOT being .tl-prose / p > a / footer a / .tl-auth-footer a.
 * If a specific component wants to opt out (e.g. a styled CTA inside a
 * <p>), it should re-declare text-decoration: none on its own selector. */
.tl-prose a,
p > a,
footer a,
.tl-auth-footer a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* ── Mobile nav burger + drawer (shared) ─────────────────────
 * Injected via /static/js/titratelab_nav.js into any <nav class="tl-nav">.
 * Burger appears at ≤960px; on larger screens templates render the
 * inline .tl-nav-links list as before. */
.tl-nav-burger {
  display: none;
  background: transparent;
  border: 1px solid rgba(29,99,211,0.35);
  border-radius: 4px;
  padding: 8px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  justify-content: center;
  width: 40px;
  height: 36px;
}
.tl-nav-burger span {
  display: block;
  height: 2px;
  background: var(--tl-gold);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: center;
}
.tl-nav-burger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.tl-nav-burger.is-open span:nth-child(2) { opacity: 0; }
.tl-nav-burger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.tl-nav-drawer {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  z-index: 9000;
  opacity: 0;
  pointer-events: none; /* closed/fading drawer must NOT capture taps (opacity:0 still does) */
  transition: opacity 0.2s ease;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 90px;
}
/* titratelab_nav.js hides the closed drawer via the HTML `hidden` attribute, but the
   `display:flex` above overrides the UA `[hidden]{display:none}` rule, leaving a full-
   viewport opacity:0 overlay that steals every tap on mobile. Re-honor `hidden`. */
.tl-nav-drawer[hidden] { display: none !important; }
.tl-nav-drawer.is-open { opacity: 1; pointer-events: auto; }
.tl-nav-drawer-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px 20px;
  width: min(420px, 92vw);
  background: var(--tl-navy);
  border: 1px solid rgba(29,99,211,0.25);
  border-radius: 10px;
}
.tl-nav-drawer-inner a {
  font-family: var(--tl-mono);
  font-size: 16px;
  letter-spacing: 0.6px;
  color: var(--tl-ink);
  padding: 14px 12px;
  border-radius: 4px;
  text-decoration: none;
  border-bottom: 1px solid rgba(11,29,48,0.05);
}
.tl-nav-drawer-inner a:last-child { border-bottom: none; }
.tl-nav-drawer-inner a:hover,
.tl-nav-drawer-inner a:active { background: rgba(29,99,211,0.08); color: var(--tl-gold); }

/* Burger takes over below 960px, NOT the original 640px — at 640px the
 * 641-1030px band had no nav and a horizontally-scrolling page. The trimmed
 * four-link bar measures 887px intrinsic, so 960 clears it with headroom. Must
 * stay in lockstep with the .tl-nav-links/.tl-nav-cta query in
 * templates/_tl_nav.html. */
@media (max-width: 960px) {
  .tl-nav-burger { display: flex; }
  nav.tl-nav { align-items: center; }
}
@media (min-width: 961px) {
  .tl-nav-drawer { display: none !important; }
}

/* ── Scarcity banner (shared, pinned top of body) ────────────
 * Injected by titratelab_nav.js when /api/waitlist/stats reports
 * remaining founding/early spots. Dismissable for 7 days via localStorage. */
.tl-scarcity-banner {
  background: linear-gradient(90deg, rgba(29,99,211,0.14) 0%, rgba(29,99,211,0.04) 100%);
  border-bottom: 1px solid rgba(29,99,211,0.35);
  overflow: hidden;
}
.tl-scarcity-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--tl-mono);
  font-size: 13px;
  color: rgba(11,29,48,0.92);
  letter-spacing: 0.3px;
}
.tl-scarcity-text strong { color: var(--tl-gold); letter-spacing: 1.2px; text-transform: uppercase; font-size: 11px; margin-right: 4px; }
.tl-scarcity-text { flex: 1 1 auto; min-width: 0; }
.tl-scarcity-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tl-signal-green);
  box-shadow: 0 0 0 0 rgba(31,122,77,0.7);
  animation: tl-scarcity-pulse 2s ease-out infinite;
  flex: 0 0 auto;
}
@keyframes tl-scarcity-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(31,122,77,0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(31,122,77,0.0); }
  100% { box-shadow: 0 0 0 0 rgba(31,122,77,0.0); }
}
.tl-scarcity-cta {
  font-family: var(--tl-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--tl-navy);
  background: var(--tl-gold);
  padding: 6px 14px;
  border-radius: 3px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
  flex: 0 0 auto;
}
.tl-scarcity-cta:hover { background: var(--tl-gold-soft); color: var(--tl-navy); }
.tl-scarcity-close {
  background: transparent;
  border: none;
  color: rgba(11,29,48,0.5);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  flex: 0 0 auto;
}
.tl-scarcity-close:hover { color: var(--tl-ink); }

@media (max-width: 640px) {
  .tl-scarcity-inner { padding: 8px 14px; gap: 10px; font-size: 12px; flex-wrap: wrap; }
  .tl-scarcity-text { flex: 1 1 100%; order: 1; }
  .tl-scarcity-pulse { order: 0; }
  .tl-scarcity-cta { order: 2; font-size: 11px; padding: 6px 10px; }
  .tl-scarcity-close { order: 3; margin-left: auto; }
}

/* ── article data-cards ──────────────────────────────────────
 * Editorial components used inside long-form research articles
 * rendered through templates/research_article.html. Built around
 * the same navy / gold / paper palette as the rest of the site
 * but tuned for inline use within markdown body prose.
 */

.tl-data-card {
  background: var(--tl-navy);
  border: 1px solid rgba(29,99,211,0.35);
  border-radius: var(--tl-radius-md);
  padding: var(--tl-space-6) var(--tl-space-6);
  margin: var(--tl-space-8) 0;
  color: var(--tl-ink);
  box-shadow: var(--tl-shadow-md);
}
.tl-data-card-header {
  font-family: var(--tl-mono);
  font-size: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--tl-gold);
  border-bottom: 1px solid rgba(29,99,211,0.25);
  padding-bottom: var(--tl-space-3);
  margin-bottom: var(--tl-space-4);
}
.tl-data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--tl-sans);
  font-size: 14px;
  color: var(--tl-ink);
}
.tl-data-table th {
  font-family: var(--tl-mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--tl-gold);
  text-align: left;
  padding: var(--tl-space-2) var(--tl-space-4) var(--tl-space-2) 0;
  border-bottom: 1px solid rgba(29,99,211,0.4);
  font-weight: 500;
}
.tl-data-table td {
  padding: var(--tl-space-3) var(--tl-space-4) var(--tl-space-3) 0;
  border-bottom: 1px solid rgba(11,29,48,0.06);
  vertical-align: top;
}
.tl-data-table tr:last-child td { border-bottom: none; }
.tl-data-table mark {
  background: rgba(29,99,211,0.22);
  color: var(--tl-ink);
  padding: 1px 4px;
  border-radius: 2px;
}
.tl-data-card-footer {
  margin-top: var(--tl-space-4);
  padding-top: var(--tl-space-3);
  border-top: 1px solid rgba(11,29,48,0.08);
  font-family: var(--tl-mono);
  font-size: 11px;
  letter-spacing: 0.4px;
  color: rgba(11,29,48,0.7);
}
.tl-data-card-footer a { color: var(--tl-gold); text-decoration: none; }
.tl-data-card-footer a:hover { text-decoration: underline; }

.tl-callout {
  background: rgba(29,99,211,0.08);
  border: 1px solid rgba(29,99,211,0.4);
  border-left: 4px solid var(--tl-gold);
  border-radius: var(--tl-radius-sm);
  padding: var(--tl-space-5) var(--tl-space-6);
  margin: var(--tl-space-6) 0;
  font-family: var(--tl-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--tl-ink);
}
.tl-callout strong { color: var(--tl-ink); }
.tl-callout mark {
  background: var(--tl-gold);
  color: var(--tl-navy);   /* dark canvas text on the blue accent (AA) */
  padding: 1px 6px;
  border-radius: 2px;
  font-weight: 700;
}
.tl-callout a { color: var(--tl-gold); text-decoration: underline; text-decoration-color: var(--tl-gold); }
.tl-callout-fda {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.25);
  border-left-color: var(--tl-gold);
}

.tl-event-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: var(--tl-space-5);
  align-items: start;
  background: var(--tl-navy-soft);   /* raised surface — was light --tl-paper */
  border: 1px solid var(--tl-border);
  border-left: 4px solid var(--tl-gold);
  border-radius: var(--tl-radius-sm);
  padding: var(--tl-space-5) var(--tl-space-6);
  margin: var(--tl-space-6) 0;
}
.tl-event-date {
  font-family: var(--tl-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--tl-gold-soft);
  border-right: 1px solid var(--tl-border);
  padding-right: var(--tl-space-4);
  line-height: 1.4;
}
.tl-event-headline {
  font-family: var(--tl-serif);
  font-size: 18px;
  line-height: 1.4;
  color: var(--tl-ink);
  margin-bottom: var(--tl-space-2);
}
.tl-event-headline mark {
  background: rgba(29,99,211,0.28);
  padding: 1px 6px;
  border-radius: 2px;
}
.tl-event-stats {
  font-family: var(--tl-mono);
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--tl-muted);
  line-height: 1.6;
}

.tl-pattern-strip {
  display: flex;
  flex-direction: column;
  gap: var(--tl-space-2);
  margin: var(--tl-space-6) 0;
  border-top: 1px solid var(--tl-border);
  border-bottom: 1px solid var(--tl-border);
  padding: var(--tl-space-4) 0;
}
.tl-pattern-row {
  font-family: var(--tl-mono);
  font-size: 13px;
  letter-spacing: 0.3px;
  color: var(--tl-ink);
  padding: var(--tl-space-2) 0;
  line-height: 1.5;
}
.tl-pattern-row mark {
  background: rgba(29,99,211,0.25);
  color: var(--tl-ink);   /* bright text on the faint blue tint (was navy) */
  padding: 1px 5px;
  border-radius: 2px;
  font-weight: 700;
}
.tl-pattern-name {
  display: inline-block;
  min-width: 170px;
  color: var(--tl-gold-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 12px;
}

.tl-pullquote {
  border-left: 4px solid var(--tl-gold);
  padding: var(--tl-space-4) var(--tl-space-6);
  margin: var(--tl-space-8) 0;
  font-family: var(--tl-serif);
  font-size: 22px;
  line-height: 1.45;
  color: var(--tl-ink);
  background: rgba(29,99,211,0.04);
}
.tl-pullquote em { font-style: italic; color: var(--tl-gold-soft); }
.tl-pullquote strong { color: var(--tl-ink); }
.tl-pullquote small {
  display: block;
  margin-top: var(--tl-space-3);
  font-family: var(--tl-mono);
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--tl-muted);
  line-height: 1.5;
}
.tl-pullquote small a { color: var(--tl-gold-soft); }
.tl-pullquote-warning {
  border-left-color: var(--tl-alert-red);
  background: rgba(191,62,41,0.06);
}
.tl-pullquote-warning strong { color: var(--tl-alert-red); }

@media (max-width: 640px) {
  .tl-event-card { grid-template-columns: 1fr; gap: var(--tl-space-2); }
  .tl-event-date { border-right: none; border-bottom: 1px solid var(--tl-border); padding: 0 0 var(--tl-space-2) 0; }
  .tl-pattern-name { min-width: 0; display: block; margin-bottom: var(--tl-space-1); }
  .tl-data-table { font-size: 13px; }
  .tl-pullquote { font-size: 18px; padding: var(--tl-space-3) var(--tl-space-4); }
}
