/* 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 — carried from existing viewer ──────────────── */
  --tl-navy:            #0F1E3D;   /* primary dark surface */
  --tl-navy-soft:       #1a2d56;   /* elevated dark panels */
  --tl-gold:            #DAA520;   /* primary accent */
  --tl-gold-soft:       #b8881a;   /* gold for hover states */

  /* ── Palette — new TitrateLab tokens ─────────────────────── */
  --tl-signal-green:    #4ADE80;   /* live / fresh / success */
  --tl-caution-amber:   #F59E0B;   /* stale / flagged / warning */
  --tl-alert-red:       #DC2626;   /* scam / exit-scam / critical */

  /* ── Neutrals ────────────────────────────────────────────── */
  --tl-paper:           #FAFAF7;   /* editorial light surface */
  --tl-ink:             #1A1A1A;   /* editorial dark text */
  --tl-muted:           #6B6B66;   /* secondary text */
  --tl-border:          #d8d8d2;   /* hairline dividers */

  /* ── Typography ──────────────────────────────────────────── */
  --tl-serif:   "Source Serif Pro", Georgia, "Times New Roman", serif;
  --tl-mono:    "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", monospace;
  --tl-sans:    "Inter", 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(15, 30, 61, 0.06);
  --tl-shadow-md: 0 4px 12px rgba(15, 30, 61, 0.12);
}

/* ── 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; }

/* ── Mobile nav burger + drawer (shared) ─────────────────────
 * Injected via /static/js/titratelab_nav.js into any <nav class="tl-nav">.
 * Burger only appears at ≤640px; on larger screens templates render the
 * inline .tl-nav-links list as before. */
.tl-nav-burger {
  display: none;
  background: transparent;
  border: 1px solid rgba(218, 165, 32, 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(15, 30, 61, 0.92);
  backdrop-filter: blur(6px);
  z-index: 9000;
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 90px;
}
.tl-nav-drawer.is-open { opacity: 1; }
.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(218, 165, 32, 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-paper);
  padding: 14px 12px;
  border-radius: 4px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 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(218, 165, 32, 0.08); color: var(--tl-gold); }

@media (max-width: 640px) {
  .tl-nav-burger { display: flex; }
  nav.tl-nav { align-items: center; }
}
@media (min-width: 641px) {
  .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(218, 165, 32, 0.14) 0%, rgba(218, 165, 32, 0.04) 100%);
  border-bottom: 1px solid rgba(218, 165, 32, 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(250, 250, 247, 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(74, 222, 128, 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(74, 222, 128, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 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(250, 250, 247, 0.5);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  flex: 0 0 auto;
}
.tl-scarcity-close:hover { color: var(--tl-paper); }

@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(218, 165, 32, 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-paper);
  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(218, 165, 32, 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-paper);
}
.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(218, 165, 32, 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(255, 255, 255, 0.06);
  vertical-align: top;
}
.tl-data-table tr:last-child td { border-bottom: none; }
.tl-data-table mark {
  background: rgba(218, 165, 32, 0.22);
  color: var(--tl-paper);
  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(255, 255, 255, 0.08);
  font-family: var(--tl-mono);
  font-size: 11px;
  letter-spacing: 0.4px;
  color: rgba(250, 250, 247, 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(218, 165, 32, 0.08);
  border: 1px solid rgba(218, 165, 32, 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-navy); }
.tl-callout mark {
  background: var(--tl-gold);
  color: var(--tl-navy);
  padding: 1px 6px;
  border-radius: 2px;
  font-weight: 700;
}
.tl-callout a { color: var(--tl-navy); text-decoration: underline; text-decoration-color: var(--tl-gold); }
.tl-callout-fda {
  background: rgba(15, 30, 61, 0.04);
  border-color: rgba(15, 30, 61, 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-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(218, 165, 32, 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(218, 165, 32, 0.25);
  color: var(--tl-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(218, 165, 32, 0.04);
}
.tl-pullquote em { font-style: italic; color: var(--tl-gold-soft); }
.tl-pullquote strong { color: var(--tl-navy); }
.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(220, 38, 38, 0.05);
}
.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); }
}

