/* Meducative — Clinical & Calm design tokens */
:root {
  /* Neutrals — cool, slightly blue-leaning whites */
  --ink-900: #0b1420;
  --ink-800: #162033;
  --ink-700: #2a3648;
  --ink-600: #47536a;
  --ink-500: #6b7688;
  --ink-400: #9aa3b2;
  --ink-300: #c4cad4;
  --ink-200: #e3e6ec;
  --ink-150: #eef0f4;
  --ink-100: #f5f6f9;
  --ink-50:  #fafbfd;
  --paper:   #ffffff;

  /* Single accent — medical teal-leaning blue */
  --accent: #0b6b7a;
  --accent-ink: #07444e;
  --accent-tint: #e6f1f3;
  --accent-tint-2: #d3e6ea;

  /* Semantic */
  --ok:   #1f7a4c;
  --ok-tint: #e4f2eb;
  --warn: #a6650b;
  --warn-tint: #faf0dd;
  --err:  #b4232c;
  --err-tint: #f9e6e7;
  --flag: #9a5b00;

  /* Chart/subject hues — all share chroma/lightness in oklch */
  --sub-1: oklch(0.70 0.08 220); /* cool blue */
  --sub-2: oklch(0.70 0.08 160); /* teal */
  --sub-3: oklch(0.70 0.08 100); /* olive */
  --sub-4: oklch(0.70 0.08 60);  /* warm sand */
  --sub-5: oklch(0.70 0.08 20);  /* clay */
  --sub-6: oklch(0.70 0.08 320); /* mauve */

  /* Type */
  --ui: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Radii */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Shadows (very restrained) */
  --shadow-sm: 0 1px 2px rgba(11, 20, 32, 0.04);
  --shadow-md: 0 4px 16px rgba(11, 20, 32, 0.06);
  --shadow-lg: 0 12px 40px rgba(11, 20, 32, 0.10);

  /* Type scale — editorial, lifted floor */
  --text-xs:      11px;   /* mono labels, fine print */
  --text-sm:      13px;   /* secondary meta, captions */
  --text-base:    15px;   /* body floor — was 13px */
  --text-md:      17px;   /* emphasized body, card titles */
  --text-lg:      20px;   /* sub-headings, quiz stems */
  --text-xl:      24px;   /* section headings */
  --text-2xl:     28px;   /* page eyebrows, modal titles */
  --text-3xl:     32px;   /* mono stat values, small page titles */
  --text-4xl:     40px;   /* primary page titles (serif) */
  --text-5xl:     56px;   /* hero greeting, score reports */
  --text-display: 68px;   /* landing-page hero only */

  /* Line-height */
  --lh-tight:   1.05;
  --lh-snug:    1.25;
  --lh-normal:  1.5;
  --lh-relaxed: 1.65;

  /* Letter-spacing */
  --track-tight:  -0.025em;
  --track-snug:   -0.015em;
  --track-normal: -0.005em;
  --track-wide:    0.05em;
  --track-mono:    0.08em;

  /* Spacing scale (4px base) */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 56px;
  --space-16: 80px;

  /* Control heights */
  --h-input-sm: 32px;
  --h-input-md: 40px;
  --h-input-lg: 48px;
  --h-btn-sm:   32px;
  --h-btn-md:   40px;
  --h-btn-lg:   48px;

  /* Focus ring */
  --focus-ring:     0 0 0 3px var(--accent-tint);
  --focus-ring-err: 0 0 0 3px var(--err-tint);

  /* Motion */
  --ease-out:  cubic-bezier(.2,.7,.3,1);
  --dur-fast:  120ms;
  --dur-base:  180ms;
  --dur-slow:  280ms;

  /* Z-index scale */
  --z-sticky:  10;
  --z-overlay: 100;
  --z-modal:   1000;
  --z-toast:   2000;
}

/* Dark theme overrides */
.theme-dark {
  --ink-900: #f5f6f9;
  --ink-800: #e3e6ec;
  --ink-700: #c4cad4;
  --ink-600: #9aa3b2;
  --ink-500: #6b7688;
  --ink-400: #47536a;
  --ink-300: #2e3a4d;
  --ink-200: #1f2838;
  --ink-150: #18202e;
  --ink-100: #121925;
  --ink-50:  #0e141e;
  --paper:   #0b1420;

  --accent: #4cc4d4;
  --accent-ink: #9ddce6;
  --accent-tint: #0f2a2f;
  --accent-tint-2: #163238;

  --ok-tint: #0f2a1e;
  --warn-tint: #2a1f0e;
  --err-tint: #2a1418;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

/* Reset within artboards */
.mv * { box-sizing: border-box; }
.mv {
  font-family: var(--ui);
  color: var(--ink-900);
  background: var(--paper);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
.mv button { font-family: inherit; letter-spacing: inherit; }

/* Utility (scoped under .mv to preserve original artboard contracts) */
.mv .mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.mv .serif { font-family: var(--serif); }
.mv .tnum { font-variant-numeric: tabular-nums; }
.mv .hairline { border: 1px solid var(--ink-200); }
.mv .hair-t { border-top: 1px solid var(--ink-200); }
.mv .hair-b { border-bottom: 1px solid var(--ink-200); }
.mv .hair-l { border-left: 1px solid var(--ink-200); }
.mv .hair-r { border-right: 1px solid var(--ink-200); }

/* ──────────────────────────────────────────────────────────────
   Global baseline + utility classes (unscoped)
   These apply to every layout. Component styles in candidate.css /
   admin.css / diagnostic.css / theme/_*.scss override as needed.
   ────────────────────────────────────────────────────────────── */

html {
  font-size: 16px;
}

body {
  font-family: var(--ui);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  letter-spacing: var(--track-normal);
  color: var(--ink-900);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

/* Heading defaults — Source Serif 4 for editorial gravity.
   Component styles override where they need to. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: var(--track-snug);
  line-height: var(--lh-snug);
  color: var(--ink-900);
  margin: 0;
}

h1 { font-size: var(--text-4xl); letter-spacing: var(--track-tight); line-height: var(--lh-tight); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); font-family: var(--ui); font-weight: 600; }
h5 { font-size: var(--text-base); font-family: var(--ui); font-weight: 600; }
h6 { font-size: var(--text-sm); font-family: var(--ui); font-weight: 600; letter-spacing: var(--track-wide); text-transform: uppercase; }

/* Type-scale utility classes (work anywhere, including inside .mv) */
.text-xs   { font-size: var(--text-xs)   !important; }
.text-sm   { font-size: var(--text-sm)   !important; }
.text-base { font-size: var(--text-base) !important; }
.text-md   { font-size: var(--text-md)   !important; }
.text-lg   { font-size: var(--text-lg)   !important; }
.text-xl   { font-size: var(--text-xl)   !important; }
.text-2xl  { font-size: var(--text-2xl)  !important; }
.text-3xl  { font-size: var(--text-3xl)  !important; }
.text-4xl  { font-size: var(--text-4xl)  !important; }
.text-5xl  { font-size: var(--text-5xl)  !important; }
.text-display { font-size: var(--text-display) !important; }

/* Font-family utilities */
.font-serif { font-family: var(--serif) !important; }
.font-sans  { font-family: var(--ui) !important; }
.font-mono  { font-family: var(--mono) !important; font-variant-numeric: tabular-nums; }
.tnum       { font-variant-numeric: tabular-nums; }

/* Text-color utilities (ink scale + accent + semantic) */
.text-ink-900 { color: var(--ink-900); }
.text-ink-800 { color: var(--ink-800); }
.text-ink-700 { color: var(--ink-700); }
.text-ink-600 { color: var(--ink-600); }
.text-ink-500 { color: var(--ink-500); }
.text-ink-400 { color: var(--ink-400); }
.text-accent     { color: var(--accent); }
.text-accent-ink { color: var(--accent-ink); }
.text-ok         { color: var(--ok); }
.text-warn       { color: var(--warn); }
.text-err        { color: var(--err); }

/* Editorial eyebrow — uppercase mono label seen across screens */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  color: var(--ink-500);
  line-height: 1;
}
.eyebrow--accent { color: var(--accent-ink); }
.eyebrow--invert { color: rgba(255, 255, 255, 0.7); }
.eyebrow::before {
  content: "";
  display: none;
}
.eyebrow.has-dot::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

/* Editorial display (Source Serif 4) — used for hero greetings, score reports */
.display {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: var(--track-tight);
  line-height: var(--lh-tight);
  color: var(--ink-900);
  margin: 0;
  text-wrap: balance;
}
.display em { font-style: italic; color: var(--accent-ink); font-weight: 400; }

/* Hairlines — useful as section separators */
.hairline-b { border-bottom: 1px solid var(--ink-200); }
.hairline-t { border-top: 1px solid var(--ink-200); }

/* Skip-link — used on every layout */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-link:focus {
  position: fixed;
  top: var(--space-4);
  left: var(--space-4);
  z-index: var(--z-toast);
  display: inline-block;
  padding: var(--space-3) var(--space-5);
  background: var(--ink-900);
  color: var(--paper);
  border-radius: var(--r-md);
  font-family: var(--ui);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
}

/* ──────────────────────────────────────────────────────────────
   Flash banners — styled globally so they look the same on every
   layout (admin, candidate, public, auth), even those that don't
   compile Bootstrap. The markup keeps the .alert / .alert-*
   classes so Bootstrap-compiled pages stay backwards-compatible.
   ────────────────────────────────────────────────────────────── */

.mv-flashes {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-4) var(--space-6) 0;
}

.mv-flash {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--ink-200);
  border-left-width: 4px;
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink-900);
  font-family: var(--ui);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.mv-flash--ok {
  background: var(--ok-tint);
  border-color: rgba(31, 122, 76, 0.2);
  border-left-color: var(--ok);
  color: var(--ink-900);
}
.mv-flash--ok .mv-flash__icon { color: var(--ok); }

.mv-flash--err {
  background: var(--err-tint);
  border-color: rgba(180, 35, 44, 0.2);
  border-left-color: var(--err);
  color: var(--ink-900);
}
.mv-flash--err .mv-flash__icon { color: var(--err); }

.mv-flash--info {
  background: var(--accent-tint);
  border-color: rgba(11, 107, 122, 0.2);
  border-left-color: var(--accent);
  color: var(--ink-900);
}
.mv-flash--info .mv-flash__icon { color: var(--accent-ink); }

.mv-flash__icon {
  font-size: 18px;
  line-height: 1.4;
  flex-shrink: 0;
}

.mv-flash__body {
  flex: 1;
  min-width: 0;
}

.mv-flash__close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--ink-500);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.mv-flash__close:hover {
  background: rgba(11, 20, 32, 0.06);
  color: var(--ink-900);
}
.mv-flash__close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Responsive lift of editorial display on small screens */
@media (max-width: 640px) {
  h1 { font-size: var(--text-3xl); }
  .display { font-size: var(--text-3xl); }
}
