/* main.css — design tokens, theme, base typography */
:root {
  --bg-0: #0a0e17;
  --bg-1: #0e1420;
  --bg-2: #131b2b;
  --bg-3: #1a2334;
  --border: #223047;
  --border-soft: #1a2536;
  --text: #e6edf7;
  --text-2: #b3c0d6;
  --muted: #7e8da8;
  --brand: #4f8cff;
  --brand-2: #22d3ee;
  --brand-glow: rgba(79, 140, 255, .25);
  --muted: #7e8da8;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --easy: #34d399;
  --medium: #fbbf24;
  --hard: #fb7185;
  --code-bg: #0c1017;
  --indent-guide: rgba(255, 255, 255, .09);
  /* achievement / progress accent — deliberately distinct from difficulty green */
  --success: #10b981;
  --success-2: #2dd4bf;
  --success-glow: rgba(16, 185, 129, .28);
  /* streak / fire (warm, unmistakably a reward) */
  --flame-1: #fbbf24;
  --flame-2: #fb5a5a;
  /* section left-edge accent stripes (scannable hierarchy) */
  --stripe-neutral: #33455f;
  --stripe-logic: #4f8cff;
  --stripe-code: #22d3ee;
  --stripe-complexity: #fbbf24;
  --stripe-recognize: #a78bfa;
  --stripe-recall: #f472b6;
  --stripe-srs: #10b981;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace;
  --topbar-h: 56px;
  --sidebar-w: 320px;
  /* motion */
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(.2, .8, .2, 1);   /* smooth deceleration for enters */
  --ease-in: cubic-bezier(.4, 0, 1, 1);  /* accelerate for exits */
  --dur-cat: 280ms;                      /* category expand/collapse */
  --ease-cat: cubic-bezier(.33, 0, .2, 1); /* balanced ease-in-out — motion visible across the whole duration */
  --lift: 0 6px 20px rgba(0, 0, 0, .22);
}

html[data-theme="light"] {
  /* warm-neutral paper grounds — softer and more premium than stark blue-white */
  --bg-0: #f3f1ec;
  --bg-1: #ffffff;
  --bg-2: #f7f5f0;
  --bg-3: #edeae2;
  --border: #e2ded4;
  --border-soft: #edeae2;
  --text: #1f2430;
  --text-2: #46505f;
  --muted: #78808e;
  --brand: #2f6bff;
  --brand-2: #0e94a6;
  --brand-glow: rgba(47, 107, 255, .16);
  --green: #059669;
  --amber: #b45309;
  --red: #e11d48;
  --easy: #059669;
  --medium: #b45309;
  --hard: #e11d48;
  --code-bg: #0c1017;                 /* code stays dark — a deliberate, readable panel in light UI */
  --indent-guide: rgba(255, 255, 255, .09);
  --success: #059669;
  --success-2: #0d9488;
  --success-glow: rgba(5, 150, 105, .18);
  --flame-1: #f59e0b;
  --flame-2: #e11d48;
  --stripe-neutral: #d9d4c8;
  --stripe-logic: #2f6bff;
  --stripe-code: #0e94a6;
  --stripe-complexity: #b45309;
  --stripe-recognize: #7c3aed;
  --stripe-recall: #db2777;
  --stripe-srs: #059669;
  --shadow: 0 10px 34px rgba(60, 50, 30, .10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--brand-2);
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 2px solid var(--bg-0); }

/* scrollbar hover fix */
::-webkit-scrollbar-thumb:hover { background: #33455f; }

.muted { color: var(--muted); }

/* Markdown blocks */
.md { color: var(--text-2); }
.md p { margin: 0 0 12px; }
.md p:last-child { margin-bottom: 0; }
.md strong { color: var(--text); font-weight: 650; }
.md h1, .md h2, .md h3, .md h4 { color: var(--text); margin: 16px 0 8px; line-height: 1.3; }
.md h1 { font-size: 20px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16px; } .md h4 { font-size: 15px; }
.md ul, .md ol { margin: 0 0 12px 22px; }
.md li { margin: 4px 0; }
.md blockquote {
  border-left: 3px solid var(--brand);
  padding: 4px 14px; margin: 0 0 12px;
  background: var(--bg-2); border-radius: 0 8px 8px 0; color: var(--text-2);
}
.md a { text-decoration: underline; }
.md .md-pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 12px;
}
.md .md-pre code {
  background: none; border: none; padding: 0;
  color: #cbd5e1; font-size: 13px; line-height: 1.55;
  white-space: pre;
}

/* ============================================================= REDUCED MOTION */
/* Respect the OS "reduce motion" setting — disable all animation/transition. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
