/* Typography — Editorial Precision
   Sora: Display headings + body (geometric sans, modern)
   Newsreader: Editorial / report serif (variable, with optical-size axis)
   JetBrains Mono: Data, code, monospace elements
*/

:root {
  /* Font families */
  --font-display: 'Sora', system-ui, -apple-system, sans-serif;
  --font-body-admin: 'Sora', system-ui, -apple-system, sans-serif;
  --font-body-participant: 'Sora', system-ui, -apple-system, sans-serif;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Fluid type scale (clamp: min, preferred, max) */
  --text-xs: clamp(0.6875rem, 0.65rem + 0.1vw, 0.75rem);       /* 11-12px */
  --text-sm: clamp(0.8125rem, 0.78rem + 0.1vw, 0.875rem);      /* 13-14px */
  --text-base: clamp(0.875rem, 0.84rem + 0.15vw, 1rem);        /* 14-16px */
  --text-lg: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);           /* 16-18px */
  --text-xl: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);        /* 18-20px */
  --text-2xl: clamp(1.25rem, 1.15rem + 0.4vw, 1.5rem);         /* 20-24px */
  --text-3xl: clamp(1.5rem, 1.3rem + 0.6vw, 1.875rem);         /* 24-30px */
  --text-4xl: clamp(1.875rem, 1.6rem + 0.9vw, 2.25rem);        /* 30-36px */
  --text-5xl: clamp(2.25rem, 1.8rem + 1.4vw, 3.25rem);         /* 36-52px */

  /* Line heights */
  --leading-none: 1;
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --leading-loose: 1.8;

  /* Letter spacing */
  --tracking-tighter: -0.03em;
  --tracking-tight: -0.015em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  /* Font weights */
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;
}

/* Base body font — set per mode */
[data-mode="admin"] {
  font-family: var(--font-body-admin);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
  font-weight: var(--weight-regular);
}

[data-mode="participant"] {
  font-family: var(--font-body-participant);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  letter-spacing: var(--tracking-normal);
  font-weight: var(--weight-regular);
}

/* Heading styles — always Sora */
h1, h2, h3, h4, h5, h6,
.heading {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1, .text-5xl { font-size: var(--text-5xl); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tighter); }
h2, .text-4xl { font-size: var(--text-4xl); }
h3, .text-3xl { font-size: var(--text-3xl); }
h4, .text-2xl { font-size: var(--text-2xl); }
h5, .text-xl  { font-size: var(--text-xl); font-weight: var(--weight-medium); }
h6, .text-lg  { font-size: var(--text-lg); font-weight: var(--weight-medium); }

/* Body text utilities */
.text-base { font-size: var(--text-base); }
.text-sm   { font-size: var(--text-sm); }
.text-xs   { font-size: var(--text-xs); }

/* Monospace */
code, kbd, samp, pre,
.font-mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
  font-variant-ligatures: none;
}

/* Serif — Newsreader. Use for editorial / report treatments only.
   Newsreader is a variable font with an optical-size axis (6..72) — set
   `font-variation-settings: 'opsz' <size>` to match the rendered px size
   for proper contrast and proportion at display sizes. */
.font-serif {
  font-family: var(--font-serif);
}

/* Prose (rich text content) */
.prose {
  max-width: 65ch;
  line-height: var(--leading-relaxed);
}

.prose p + p { margin-top: var(--space-4); }
.prose h2 { margin-top: var(--space-8); margin-bottom: var(--space-3); }
.prose h3 { margin-top: var(--space-6); margin-bottom: var(--space-2); }
.prose ul, .prose ol { margin-top: var(--space-3); margin-bottom: var(--space-3); padding-left: var(--space-6); }
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li + li { margin-top: var(--space-1); }
.prose blockquote {
  border-left: 3px solid var(--accent-primary);
  padding-left: var(--space-4);
  margin: var(--space-4) 0;
  color: var(--text-secondary);
  font-style: italic;
}
.prose a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prose a:hover {
  color: var(--accent-hover);
}
.prose code {
  background: var(--surface-raised);
  padding: var(--space-0-5) var(--space-1);
  border-radius: var(--radius-sm);
  font-size: 0.875em;
}
.prose pre {
  background: var(--surface-raised);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: var(--space-4) 0;
}
.prose pre code {
  background: none;
  padding: 0;
}
.prose img {
  border-radius: var(--radius-lg);
  margin: var(--space-6) 0;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-8) 0;
}

/* Text truncation */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Data / metrics text */
.data-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-none);
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
}

.data-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-tertiary);
}
