/* 11+ Math Prep — design tokens */
:root {
  /* Type */
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  /* Neutrals (warm paper) */
  --paper: oklch(0.985 0.003 90);
  --paper-2: oklch(0.965 0.004 90);
  --paper-3: oklch(0.935 0.005 90);
  --line: oklch(0.88 0.006 90);
  --line-2: oklch(0.82 0.008 90);
  --ink-1: oklch(0.22 0.02 260);
  --ink-2: oklch(0.38 0.02 260);
  --ink-3: oklch(0.55 0.015 260);
  --ink-4: oklch(0.70 0.01 260);

  /* Brand */
  --indigo: oklch(0.42 0.14 265);
  --indigo-2: oklch(0.32 0.12 265);
  --indigo-tint: oklch(0.94 0.03 265);

  /* Data accents — equal chroma/lightness family */
  --emerald: oklch(0.62 0.13 155);
  --emerald-tint: oklch(0.94 0.04 155);
  --amber: oklch(0.72 0.14 75);
  --amber-tint: oklch(0.95 0.05 75);
  --rose: oklch(0.62 0.16 25);
  --rose-tint: oklch(0.95 0.04 25);
  --violet: oklch(0.55 0.14 300);

  /* Surfaces */
  --card: #ffffff;
  --shadow-sm: 0 1px 2px rgba(24, 28, 50, 0.04), 0 1px 1px rgba(24, 28, 50, 0.03);
  --shadow-md: 0 4px 14px rgba(24, 28, 50, 0.06), 0 1px 2px rgba(24, 28, 50, 0.04);
  --shadow-lg: 0 18px 48px rgba(24, 28, 50, 0.08), 0 2px 6px rgba(24, 28, 50, 0.04);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink-1);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
button { font-family: inherit; }
a { color: inherit; }

/* Utility */
.mono { font-family: var(--font-mono); font-feature-settings: "zero"; }
.serif { font-family: var(--font-serif); }
.tabular { font-variant-numeric: tabular-nums; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px;
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-2);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  font-size: 14px; font-weight: 500; line-height: 1;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--indigo); color: white; }
.btn-primary:hover { background: var(--indigo-2); }
.btn-ghost { background: transparent; color: var(--ink-1); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-dark { background: var(--ink-1); color: white; }
.btn-dark:hover { background: black; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

/* ===== Natural fraction rendering (used by Sutton math questions) ===== */
.frac {
  display: inline-flex; flex-direction: column; align-items: center;
  vertical-align: middle;
  line-height: 1.05; font-size: 0.82em; margin: 0 2px;
}
.frac .num { padding: 0 5px 1px; border-bottom: 1.4px solid currentColor; }
.frac .den { padding: 1px 5px 0; }
.mixed { display: inline-flex; align-items: center; }
.mixed .whole { margin-right: 1px; }

/* Square-root vinculum: overline that spans the whole expression under √ */
.sqrt-vinc { display: inline-block; border-top: 2.2px solid currentColor;
  padding: 0 3px; margin-left: 1px; }

/* Prevent wrapping between text and an inline-flex (e.g. fraction) phrase */
.nowrap { white-space: nowrap; }

/* Sutton diagram wrapper (inline SVG + occasional HTML tables) */
.sutton-diagram { margin: 18px 0 4px; }
.sutton-diagram svg { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; overflow: visible; }
.sutton-diagram svg .line, .sutton-diagram svg .shape {
  stroke: var(--ink-1); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; fill: none;
}
/* Pie chart slice — fill comes from the SVG `fill` attribute (per-slice colour). */
.sutton-diagram svg .pie-slice { stroke: #fff; stroke-width: 2; }
.sutton-diagram svg .thin { stroke-width: 1.8; }
.sutton-diagram svg .hair { stroke-width: 1; }
.sutton-diagram svg .light-fill { fill: var(--paper-2); }
.sutton-diagram svg .grey-fill { fill: #c9c9c9; }
.sutton-diagram svg .front-fill { fill: #ffffff; }
.sutton-diagram svg .dark-fill { fill: #1f2937; }
.sutton-diagram svg .dash { stroke-dasharray: 8 6; }
.sutton-diagram svg .angle { stroke: var(--ink-1); stroke-width: 1.8; fill: none; }
.sutton-diagram svg .label { fill: var(--ink-1); font-size: 18px; font-weight: 500; font-family: var(--font-serif); }
.sutton-diagram svg .label-large { fill: var(--ink-1); font-size: 26px; font-style: italic; font-family: var(--font-serif); }
.sutton-diagram svg .small-note { fill: var(--ink-3); font-size: 13px; }
.sutton-diagram svg .tick-label { fill: var(--ink-1); font-size: 13px; font-family: var(--font-mono); }
.sutton-diagram svg .axis-title { fill: var(--ink-1); font-size: 13px; font-weight: 600; }
.sutton-diagram table.data-table { border-collapse: collapse; margin: 10px auto; }
.sutton-diagram table.data-table td { border: 1.5px solid var(--ink-1); padding: 9px 18px; font-size: 15px; font-family: var(--font-serif); }

/* Question stem + follow-up */
.q-stem strong { font-weight: 600; }
.q-stem i { font-style: italic; }
.q-stem sup { font-size: 0.7em; vertical-align: super; }
.q-follow { margin-top: 14px; color: var(--ink-2); font-size: 18px; font-family: var(--font-serif); }
