/* =========================================================================
   KWtech Design System — Color & Type Tokens
   Source: Appendix K (UI Color Palette Specification) + Nunito/Fraunces from
   Google Fonts (substitutions — see README.md).
   ========================================================================= */

/* ---------- Fonts ---------------------------------------------------------
   Display + UI: Fraunces + Nunito loaded from Google Fonts.
   ⚠️ Substitution flag: Fraunces + Nunito were chosen because no licensed
   display/UI fonts were provided. If KWtech has its own type system, attach
   the files and we'll swap them in here.
   Mono: Maple Mono NF — provided by KWtech. Used for code, captions, and
   technical labels. */
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Nunito:wght@400;500;600;700;800&display=swap");

@font-face {
  font-family: "Maple Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/MapleMono-NF-Regular.ttf") format("truetype");
}

:root {
  /* ====== Colors — raw palette (Appendix K) ======================== */

  /* Backgrounds & canvas */
  --color-bg-primary: #f8f9fa;
  --color-bg-secondary: #f0f4f7;
  --color-bg-warm: #fdf9f6;

  /* UI element fills (pastel cards) */
  --color-ui-blue: #e0e7eb;
  --color-ui-green: #ebf4f0;
  --color-ui-peach: #f7ebe0;
  --color-ui-lavender: #efe0eb;

  /* Saturated accents — interactive surfaces only */
  --color-accent-blue: #6a99c2;   /* Sky Blue — primary CTAs, progress */
  --color-accent-green: #8bc34a;  /* Lively Green — success / continue */
  --color-accent-coral: #ff8c6b;  /* Warm Coral — start session / new */
  --color-accent-purple: #b388eb; /* Playful Purple — specials */

  /* Text */
  --color-text-primary: #333333;
  --color-text-secondary: #666666;
  --color-text-muted: #aaaaaa;

  /* Semantic / feedback */
  --color-success: #a8d8ad;
  --color-warning: #ffd680;
  --color-error: #ffb0b0;

  /* Character & illustration */
  --color-illus-blush: #ffdcdc;
  --color-illus-base-peach: var(--color-ui-peach);
  --color-illus-base-blue: var(--color-ui-blue);

  /* ====== Semantic aliases — prefer these in component code ====== */
  --bg: var(--color-bg-warm);
  --bg-alt: var(--color-bg-primary);
  --bg-card: var(--color-bg-secondary);
  --surface-1: #ffffff; /* used only when contrast is needed inside a tinted card */
  --surface-overlay: rgba(255, 255, 255, 0.9);

  --fg: var(--color-text-primary);
  --fg-muted: var(--color-text-secondary);
  --fg-subtle: var(--color-text-muted);
  --fg-on-accent: #ffffff;

  --border: rgba(170, 170, 170, 0.3);
  --border-strong: rgba(102, 102, 102, 0.25);

  --accent: var(--color-accent-blue);
  --accent-hover: #5a87b0;
  --accent-press: #4d779e;

  --start: var(--color-accent-coral);
  --start-hover: #f57d5c;

  --success: var(--color-accent-green);
  --success-soft: var(--color-success);
  --warning: var(--color-warning);
  --error: var(--color-error);

  /* ====== Radii ======================================================= */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;   /* default */
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* ====== Spacing scale (4-pt grid) =================================== */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* ====== Shadows ===================================================== */
  --shadow-sm: 0 1px 2px rgba(51, 51, 51, 0.04);
  --shadow-md: 0 4px 12px rgba(51, 51, 51, 0.06);
  --shadow-lg: 0 12px 32px rgba(51, 51, 51, 0.08);
  --shadow-focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--color-accent-blue);

  /* ====== Motion ====================================================== */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-micro: 180ms;
  --dur-base: 280ms;
  --dur-screen: 420ms;

  /* ====== Type tokens ================================================= */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino", Georgia, serif;
  --font-ui: "Nunito", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "Maple Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  /* Type scale (modular ~1.2). Sizes are px to stay predictable on mobile. */
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-md: 18px;
  --fs-lg: 22px;
  --fs-xl: 28px;
  --fs-2xl: 36px;
  --fs-3xl: 48px;
  --fs-4xl: 64px;

  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-normal: 1.5;
  --lh-relaxed: 1.65;

  --tracking-tight: -0.02em;
  --tracking-snug: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.02em;
}

/* ====== Semantic element defaults ===================================== */
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, .h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-3xl);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  font-variation-settings: "opsz" 96, "SOFT" 50;
  color: var(--fg);
}
h2, .h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-2xl);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-snug);
  font-variation-settings: "opsz" 60, "SOFT" 50;
}
h3, .h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-snug);
}
h4, .h4 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
}
h5, .h5 {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--fs-md);
  line-height: var(--lh-snug);
}
p, .body {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: var(--fs-base);
  line-height: var(--lh-relaxed);
  color: var(--fg);
}
.body-sm, small {
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--fg-muted);
}
.caption {
  font-size: var(--fs-xs);
  line-height: var(--lh-normal);
  color: var(--fg-subtle);
  letter-spacing: var(--tracking-wide);
}
.eyebrow {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
code, .mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
