/* German Mosaic — design system */
/* Source of truth: ../../DESIGN.md (one level up from public/) */

:root {
  /* Palette */
  --gm-burgundy: #7f2e44;
  --gm-burgundy-soft: #9c4761;
  --gm-teal: #2d6769;
  --gm-teal-soft: #3f8285;
  --gm-sand: #cbb098;
  --gm-sand-50: #e5d8c5;
  --gm-cream: #f7eff2;
  --gm-ice: #e8f2f2;
  --gm-ink: #1a1014;
  --gm-error: #a82a3d;
  --gm-warn: #c89030;
  --gm-success: var(--gm-teal);

  /* Backgrounds */
  --gm-bg: #fbfaf7;
  --gm-bg-branded: var(--gm-sand);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  /* Type */
  --font-display: 'Lilita One', 'More Sugar', system-ui, sans-serif;
  --font-body-accent: 'Life Savers', Georgia, serif;
  --font-body: 'Quicksand', -apple-system, system-ui, sans-serif;

  /* Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-body: 1rem;
  --text-h2: 1.25rem;
  --text-h1: 1.5rem;
  --text-display-md: 1.5rem;
  --text-display-lg: 2rem;
  --text-display-xl: 2.5rem;

  --container: 760px;
  --header-h: 64px;
}

@media (min-width: 768px) {
  :root {
    --text-display-lg: 2.5rem;
    --text-display-xl: 3.5rem;
  }
}

/* Base */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--gm-bg);
  color: var(--gm-ink);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gm-burgundy); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--gm-burgundy-soft); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; color: var(--gm-burgundy); margin: 0 0 var(--space-3); }
h1 { font-size: var(--text-display-lg); }
h2 { font-size: var(--text-display-md); }
h3 { font-size: var(--text-h1); }
p { margin: 0 0 var(--space-4); }
img, svg { display: block; max-width: 100%; }

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

/* Layout */
.gm-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.gm-main {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-4);
}
@media (min-width: 768px) { .gm-main { padding: var(--space-8) var(--space-6); } }

.gm-header {
  height: var(--header-h);
  background: var(--gm-cream);
  border-bottom: 1px solid var(--gm-sand-50);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-4);
}
.gm-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--gm-burgundy);
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.gm-header__brand svg,
.gm-header__brand img { height: 40px; width: 40px; }
.gm-header__spacer { flex: 1; }

/* Bottom nav (mobile) */
.gm-bottom-nav {
  position: sticky; bottom: 0; left: 0; right: 0;
  background: var(--gm-cream);
  border-top: 1px solid var(--gm-sand-50);
  display: flex;
  justify-content: space-around;
  padding: var(--space-2) 0;
  z-index: 50;
}
.gm-bottom-nav a {
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: var(--gm-ink);
  font-size: var(--text-xs); padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background-color 150ms ease-out;
}
.gm-bottom-nav a:hover, .gm-bottom-nav a.is-active { background: var(--gm-sand-50); color: var(--gm-burgundy); }
.gm-bottom-nav a svg { width: 22px; height: 22px; margin-bottom: 2px; }
@media (min-width: 768px) { .gm-bottom-nav { display: none; } }

/* The bubble — the brand's UI primitive */
.gm-bubble {
  background: var(--gm-cream);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  position: relative;
}
.gm-bubble--burgundy { background: var(--gm-burgundy); color: var(--gm-cream); }
.gm-bubble--burgundy h1, .gm-bubble--burgundy h2, .gm-bubble--burgundy h3 { color: var(--gm-cream); }
.gm-bubble--teal { background: var(--gm-teal); color: var(--gm-cream); }
.gm-bubble--teal h1, .gm-bubble--teal h2, .gm-bubble--teal h3 { color: var(--gm-cream); }
.gm-bubble--ice { background: var(--gm-ice); }
.gm-bubble--sand { background: var(--gm-sand-50); }
.gm-bubble--tail-bl::before {
  content: '';
  position: absolute;
  left: -8px; bottom: 18px;
  width: 28px; height: 28px;
  background: inherit;
  border-bottom-right-radius: 40%;
  transform: rotate(20deg);
}

/* Tile grid */
.gm-tiles {
  display: grid;
  gap: var(--space-3);
}
.gm-tiles--2 { grid-template-columns: repeat(2, 1fr); }
.gm-tiles--3 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .gm-tiles--3 { grid-template-columns: repeat(3, 1fr); } }

/* Buttons (bubble buttons) */
.gm-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  border: none;
  background: var(--gm-burgundy);
  color: var(--gm-cream);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-body);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 150ms ease-out, transform 150ms ease-out;
}
.gm-btn:hover { background: var(--gm-burgundy-soft); transform: translateY(-1px); }
.gm-btn:active { transform: translateY(0); }
.gm-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.gm-btn--teal { background: var(--gm-teal); }
.gm-btn--teal:hover { background: var(--gm-teal-soft); }
.gm-btn--ghost { background: var(--gm-cream); color: var(--gm-burgundy); border: 2px solid var(--gm-burgundy); }
.gm-btn--ghost:hover { background: var(--gm-sand-50); }
.gm-btn--sm { padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.gm-btn--full { width: 100%; justify-content: center; }

/* Level pills (A1..B2) */
.gm-pill {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  background: var(--gm-sand-50);
  color: var(--gm-burgundy);
}
.gm-pill--A1 { background: var(--gm-sand-50); color: var(--gm-burgundy); }
.gm-pill--A2 { background: var(--gm-cream); color: var(--gm-burgundy); }
.gm-pill--B1 { background: var(--gm-teal); color: var(--gm-cream); }
.gm-pill--B2 { background: var(--gm-burgundy); color: var(--gm-cream); }

/* Callout (the "one spot available" pattern from IG slide 2) */
.gm-callout {
  display: inline-block;
  background: var(--gm-burgundy);
  color: var(--gm-cream);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  transform: rotate(-3deg);
  font-family: var(--font-body-accent);
  font-weight: 700;
}

/* Forms */
.gm-field { display: block; margin-bottom: var(--space-4); }
.gm-field label { display: block; margin-bottom: var(--space-1); font-weight: 600; font-size: var(--text-sm); }
.gm-field input, .gm-field textarea, .gm-field select {
  width: 100%;
  padding: var(--space-3);
  border: 2px solid var(--gm-sand-50);
  border-radius: var(--radius-sm);
  background: white;
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--gm-ink);
  transition: border-color 150ms ease-out;
}
.gm-field input:focus, .gm-field textarea:focus, .gm-field select:focus {
  outline: none;
  border-color: var(--gm-burgundy);
}
.gm-field textarea { min-height: 200px; resize: vertical; font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: var(--text-sm); }
.gm-field__error { color: var(--gm-error); font-size: var(--text-sm); margin-top: var(--space-1); }

/* Card list rows */
.gm-row {
  background: var(--gm-cream);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  text-decoration: none;
  color: inherit;
  transition: transform 150ms ease-out, background-color 150ms ease-out;
}
.gm-row:hover { background: var(--gm-sand-50); transform: translateY(-1px); }
.gm-row__main { flex: 1; min-width: 0; }
.gm-row__title { font-weight: 700; margin-bottom: 2px; }
.gm-row__meta { font-size: var(--text-sm); color: var(--gm-ink); opacity: 0.7; }
.gm-row__quiet { color: var(--gm-warn); }

/* Streak indicator */
.gm-streak {
  display: flex;
  gap: var(--space-1);
}
.gm-streak__dot {
  width: 12px; height: 12px;
  border-radius: var(--radius-pill);
  background: var(--gm-sand-50);
}
.gm-streak__dot.is-active { background: var(--gm-teal); }

/* Locale picker */
.gm-locale {
  display: inline-flex;
  gap: var(--space-1);
  background: var(--gm-bg);
  border: 1px solid var(--gm-sand-50);
  border-radius: var(--radius-pill);
  padding: var(--space-1);
}
.gm-locale button {
  background: none;
  border: none;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--gm-ink);
  transition: background-color 150ms ease-out;
}
.gm-locale button.is-active { background: var(--gm-burgundy); color: var(--gm-cream); }
.gm-locale button:not(.is-active):hover { background: var(--gm-sand-50); }

/* Auth (login) layout */
.gm-auth {
  min-height: 100dvh;
  background: var(--gm-sand);
  display: grid;
  place-items: center;
  padding: var(--space-6);
}
.gm-auth__card {
  background: var(--gm-cream);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 18px 48px rgba(26, 16, 20, 0.18);
}
.gm-auth__card svg { margin-bottom: var(--space-6); }
.gm-auth__title { font-family: var(--font-display); color: var(--gm-burgundy); font-size: var(--text-display-md); margin-bottom: var(--space-2); }
.gm-auth__subtitle { color: var(--gm-ink); opacity: 0.8; margin-bottom: var(--space-6); font-family: var(--font-body-accent); font-size: var(--text-h2); }

/* Study session (flashcards) */
.gm-card-stage {
  background: var(--gm-cream);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.gm-card-stage__front, .gm-card-stage__back {
  font-family: var(--font-display);
  font-size: var(--text-display-lg);
  color: var(--gm-burgundy);
  margin-bottom: var(--space-3);
}
.gm-card-stage__back { color: var(--gm-teal); }
.gm-card-stage__example {
  font-family: var(--font-body-accent);
  font-style: italic;
  color: var(--gm-ink);
  opacity: 0.7;
  margin-top: var(--space-4);
}
.gm-rate {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-6);
}
.gm-rate__btn {
  border: none;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--gm-cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-1);
  transition: transform 150ms ease-out;
}
.gm-rate__btn:hover { transform: translateY(-2px); }
.gm-rate__btn small { font-weight: 400; font-size: var(--text-xs); opacity: 0.85; }
.gm-rate__btn--schlecht { background: var(--gm-error); }
.gm-rate__btn--ok { background: var(--gm-warn); }
.gm-rate__btn--gut { background: var(--gm-teal); }
.gm-rate__btn--perfekt { background: var(--gm-burgundy); }

/* Misc */
.gm-meta { color: var(--gm-ink); opacity: 0.6; font-size: var(--text-sm); }
.gm-tag { display: inline-block; padding: 2px var(--space-2); background: var(--gm-ice); color: var(--gm-teal); border-radius: var(--radius-pill); font-size: var(--text-xs); }
.gm-spacer { height: var(--space-4); }
.gm-spacer--lg { height: var(--space-8); }
.gm-progress { background: var(--gm-sand-50); border-radius: var(--radius-pill); height: 8px; overflow: hidden; }
.gm-progress__fill { background: var(--gm-teal); height: 100%; border-radius: var(--radius-pill); }
.gm-stack > * + * { margin-top: var(--space-4); }

/* Hide on mobile / desktop */
@media (max-width: 767px) { .gm-md-only { display: none !important; } }
@media (min-width: 768px) { .gm-sm-only { display: none !important; } }
