/* ═══════════════════════════════════════════════════════════════
   PRAXY — Design tokens v2 (tightened Meadow + Calm dark)
   Drop-in replacement for the token block in frontend/src/index.css.
   Meadow light is the default (:root); Calm dark applies via
   [data-theme="calm-dark"] on <html> or <body>.

   Changes vs shipped are marked  ★ NEW  or  ★ CHANGED.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ---- Meadow light (default) — palette unchanged ---- */
  --bg:        #F5F3EB;
  --bg-2:      #E9E7DA;
  --surface:   #FDFCF6;
  --ink:       #1E2230;
  --ink-2:     #555A6E;
  --ink-3:     #8E93A6;
  --line:      #E1DECF;
  --line-2:    #CFCBB9;

  --primary:       #5F8168;
  --primary-ink:   #FFFFFF;
  --primary-soft:  #D9E4DB;
  --accent:        #B95443;   /* brick — secondary */
  --accent-soft:   #F1D8D1;
  --accent-2:      #D14A3C;   /* Praxy red — recording / streak / loader mark */
  --accent-2-soft: #F5D7D1;
  --warn:          #C68842;
  --warn-soft:     #F1E2C9;
  --success:       #5F8168;
  --success-soft:  #D9E4DB;
  --praxy-red:     #E04637;   /* logo red — reference only, never a fill */

  /* ---- Type ---- */
  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-hand:    "Patrick Hand", cursive;   /* annotations only, never data */
  --font-mono:    "JetBrains Mono", monospace;

  /* ★ CHANGED — type ramp floor raised for phone legibility.
     11px/10px/9px meta is retired. --fs-xs is the absolute floor. */
  --fs-xs:  12px;   /* was 11 — captions, timestamps, chips        */
  --fs-sm:  13px;   /* was 12 — secondary body, receipt quotes     */
  --fs-md:  15px;   /* was 14 — body, list titles, bubbles         */
  --fs-lg:  16px;   /* header timer, session titles                */
  --fs-xl:  20px;   /* card headlines (resume card)                */
  --fs-2xl: 26px;   /* page titles (greeting)                      */
  --fs-3xl: 34px;   /* stat numerals                               */
  --fs-display: 62px; /* results band letter                       */

  /* ---- Space (unchanged) ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;

  /* ---- Radii (unchanged) ---- */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px;
  --r-2xl: 28px; --r-full: 9999px;

  /* ---- Shadows / motion (unchanged) ---- */
  --sh-1: 0 1px 2px rgba(20, 24, 28, 0.06);
  --sh-2: 0 2px 8px rgba(20, 24, 28, 0.08);
  --sh-3: 0 8px 24px rgba(20, 24, 28, 0.10);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* ★ NEW — interaction + layout contract tokens */
  --hit-min: 44px;         /* min hit area for ANY tappable target; pad
                              invisibly (::after inset) if visual is smaller */
  --chip-h: 24px;          /* chip visual height (was 22) */
  --chip-h-filter: 32px;   /* filter chips (History) — 44px hit via padding */
  --seg-h: 44px;           /* segmented control (was 40) */
  --btn-h: 44px;
  --btn-h-lg: 52px;
  --exam-footer-h: 208px;  /* FIXED in all exam states — mic never moves */
  --mic-d: 76px;           /* exam mic diameter (all states)   */
  --nav-label: 11px;       /* bottom-nav labels (was 10)       */
}

/* ═══════════════════════════════════════════════════════════════
   CALM DARK — secondary theme.
   Ships with: grading loader, exam "focus" option, system pref.
   Same structure; only paint changes.
   ═══════════════════════════════════════════════════════════════ */
[data-theme="calm-dark"] {
  --bg:        #14171C;
  --bg-2:      #1B1F25;
  --surface:   #1F242C;
  --ink:       #EFEADF;
  --ink-2:     #B8B2A2;
  --ink-3:     #787368;
  --line:      #2A2F38;
  --line-2:    #383D46;

  --primary:       #8AB690;
  --primary-ink:   #14171C;
  --primary-soft:  #253027;
  --accent:        #D97963;
  --accent-soft:   #3A2622;
  --accent-2:      #E86650;   /* Praxy red, brightened for dark */
  --accent-2-soft: #3A1E1A;
  --warn:          #D4A574;
  --warn-soft:     #332A1E;
  --success:       #8AB690;
  --success-soft:  #253027;

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --sh-2: 0 2px 8px rgba(0, 0, 0, 0.40);
  --sh-3: 0 8px 24px rgba(0, 0, 0, 0.50);
}

/* ═══════════════════════════════════════════════════════════════
   ★ NEW — Red-job components (the only places --accent-2 appears)
   ═══════════════════════════════════════════════════════════════ */

/* 1 · Recording waves — replaces the RECORDING chip as the loud signal */
.mic-rec::after, .mic-rec::before {
  content: ""; position: absolute; border-radius: 50%;
  border: 2px solid var(--accent-2);
  animation: mic-pulse 1.3s ease-in-out infinite;
}
.mic-rec::after  { inset: -8px; }
.mic-rec::before { inset: -16px; animation-delay: 0.35s; }
@keyframes mic-pulse {
  0%   { transform: scale(1);    opacity: 0.8; }
  100% { transform: scale(1.25); opacity: 0;   }
}
.rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2); display: inline-block;
  animation: rec-blink 1.2s ease-in-out infinite;
}
@keyframes rec-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* 2 · Streak chip (Home header) */
.chip-streak {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 2px 12px; border-radius: var(--r-full);
  background: var(--accent-2-soft); color: var(--accent-2);
  font-size: var(--fs-xs); font-weight: 600;
}

/* 3 · Grading loader mark — see grading-loader/loaders.jsx (Variation A).
   Praxy mark fill: var(--accent-2). Wash: --accent-2-soft (light),
   rgba(232,102,80,0.12) + 1px inset ring rgba(232,102,80,0.18) (dark). */

/* ★ NEW — receipt error highlight (Results fixes): soft red wash +
   wavy underline. Marked, not shouted — mistakes stay findable. */
.err-mark {
  text-decoration: underline wavy var(--accent-2) 1.5px;
  text-underline-offset: 3px; font-weight: 600; font-style: normal;
  background: var(--accent-2-soft); padding: 1px 4px; border-radius: 4px;
}
