/* ─── Base CSS: Variables, Reset, Typography ─────────────────────────────── */

:root {
  /* Colors */
  --color-bg: #FFF9F1;
  --color-surface: #ffffff;
  --color-surface-alt: #f5ede3;
  --color-border: #D4C7B4;
  --color-text: #2D2D23;
  --color-text-muted: #7C7458;
  --color-text-faint: #a09478;

  /* Brand / accent */
  --color-primary: #854628;
  --color-primary-light: #9d5530;
  --color-primary-subtle: #F2E0CF;
  --color-accent: #7C7458;
  --color-accent-subtle: #ede5d5;

  /* Semantic */
  --color-correct: #2d6e45;
  --color-correct-bg: #e6f5ec;
  --color-close: #a0700a;
  --color-close-bg: #fef8e6;
  --color-wrong: #b83232;
  --color-wrong-bg: #fdeaea;

  /* Gender colors (standard German learning convention) */
  --color-der: #2a5fa8;
  --color-der-bg: #e8eefa;
  --color-die: #c0304a;
  --color-die-bg: #fdeaee;
  --color-das: #2d8a50;
  --color-das-bg: #e6f6ec;

  /* Word type badge colors */
  --color-verb: #5a3580;
  --color-verb-bg: #f0eafc;
  --color-noun: #1a5c8c;
  --color-noun-bg: #e6f0fa;
  --color-adjective: #7a4010;
  --color-adjective-bg: #fdf0e6;
  --color-phrase: #1a6e5a;
  --color-phrase-bg: #e6f6f2;

  /* Spacing */
  --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: 48px;

  /* Typography */
  --font-sans: 'Cabin', system-ui, -apple-system, sans-serif;
  --font-serif: 'Cabin', Georgia, serif;
  --font-mono: 'Courier New', monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 17px;
  --text-lg: 20px;
  --text-xl: 24px;
  --text-2xl: 30px;
  --text-3xl: 38px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Sidebar */
  --sidebar-width: 240px;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ─── Typography Utilities ───────────────────────────────────────────────── */

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }

.font-serif { font-family: var(--font-serif); }
.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ─── Layout Utilities ───────────────────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.grid { display: grid; }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ─── Scrollbar Styling ──────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-faint); }

/* ─── Focus Styles ───────────────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
