/* ==========================================================================
   Baby Fingers — Material 3 Design System
   ========================================================================== */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: 'Baloo 2', 'Fredoka', system-ui, sans-serif;
  line-height: 1.6;
  color: var(--md-on-surface);
  background: var(--md-surface);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Material 3 Design Tokens ---------- */
:root {
  /* Primary Poppy Palette */
  --md-primary: #FF6B6B;
  --md-on-primary: #FFFFFF;
  --md-primary-container: #FFE0E0;
  --md-on-primary-container: #3B0A0A;

  /* Secondary */
  --md-secondary: #FFD93D;
  --md-on-secondary: #3B3000;
  --md-secondary-container: #FFF3C4;
  --md-on-secondary-container: #3B3000;

  /* Tertiary */
  --md-tertiary: #FF69B4;
  --md-on-tertiary: #FFFFFF;
  --md-tertiary-container: #FFE0F0;
  --md-on-tertiary-container: #3B0020;

  /* Neutral */
  --md-surface: #FFFBFE;
  --md-surface-dim: #F5F0F3;
  --md-surface-bright: #FFFBFE;
  --md-surface-container-lowest: #FFFFFF;
  --md-surface-container-low: #FFF8FA;
  --md-surface-container: #FFF0F5;
  --md-surface-container-high: #FFE8F0;
  --md-surface-container-highest: #FFE0E8;
  --md-on-surface: #2C3E50;
  --md-on-surface-variant: #5A6A7A;
  --md-outline: #C4C8D0;
  --md-outline-variant: #E0E4EC;

  /* Additional Poppies */
  --poppy-lime: #6BCB77;
  --poppy-sky: #4ECDC4;
  --poppy-purple: #9B59B6;
  --poppy-orange: #FF8C42;
  --poppy-coral: #FF6B6B;

  /* Elevation shadows */
  --md-elevation-1: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --md-elevation-2: 0 3px 6px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --md-elevation-3: 0 8px 16px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --md-elevation-4: 0 12px 24px rgba(0,0,0,0.14), 0 6px 12px rgba(0,0,0,0.08);
  --md-elevation-5: 0 20px 40px rgba(0,0,0,0.16), 0 8px 16px rgba(0,0,0,0.10);

  /* Shape */
  --md-shape-xs: 4px;
  --md-shape-sm: 8px;
  --md-shape-md: 12px;
  --md-shape-lg: 16px;
  --md-shape-xl: 28px;
  --md-shape-full: 9999px;

  /* Typography Scale */
  --md-display-large: 700 3.5rem/1.15 'Fredoka', 'Baloo 2', cursive;
  --md-display-medium: 700 2.8rem/1.2 'Fredoka', 'Baloo 2', cursive;
  --md-display-small: 600 2.2rem/1.25 'Fredoka', 'Baloo 2', cursive;
  --md-headline-large: 600 2rem/1.3 'Fredoka', 'Baloo 2', cursive;
  --md-headline-medium: 600 1.75rem/1.35 'Fredoka', 'Baloo 2', cursive;
  --md-headline-small: 600 1.5rem/1.35 'Fredoka', 'Baloo 2', cursive;
  --md-title-large: 600 1.35rem/1.4 'Baloo 2', 'Fredoka', sans-serif;
  --md-title-medium: 600 1.1rem/1.4 'Baloo 2', 'Fredoka', sans-serif;
  --md-body-large: 400 1.1rem/1.6 'Baloo 2', sans-serif;
  --md-body-medium: 400 1rem/1.6 'Baloo 2', sans-serif;
  --md-label-large: 600 0.95rem/1.4 'Baloo 2', sans-serif;

  /* Motion */
  --md-motion-duration-short: 150ms;
  --md-motion-duration-medium: 300ms;
  --md-motion-duration-long: 500ms;
  --md-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-motion-easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Typography ---------- */
.display-large  { font: var(--md-display-large); }
.display-medium { font: var(--md-display-medium); }
.display-small  { font: var(--md-display-small); }
.headline-large { font: var(--md-headline-large); }
.headline-medium{ font: var(--md-headline-medium); }
.headline-small { font: var(--md-headline-small); }
.title-large    { font: var(--md-title-large); }
.title-medium   { font: var(--md-title-medium); }
.body-large     { font: var(--md-body-large); }
.body-medium    { font: var(--md-body-medium); }
.label-large    { font: var(--md-label-large); }

/* ---------- Buttons ---------- */
.md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--md-shape-full);
  font: var(--md-label-large);
  font-size: 1.1rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--md-motion-duration-medium) var(--md-motion-easing-standard);
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.md-btn-filled {
  background: var(--md-primary);
  color: var(--md-on-primary);
  box-shadow: var(--md-elevation-2);
}

.md-btn-filled:hover {
  box-shadow: var(--md-elevation-3);
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.md-btn-filled:active {
  box-shadow: var(--md-elevation-1);
  transform: translateY(0);
}

.md-btn-tonal {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
}

.md-btn-tonal:hover {
  box-shadow: var(--md-elevation-1);
  filter: brightness(0.96);
}

.md-btn-outlined {
  background: transparent;
  color: var(--md-primary);
  border: 2px solid var(--md-outline);
}

.md-btn-outlined:hover {
  background: var(--md-primary-container);
  border-color: var(--md-primary);
}

.md-btn-text {
  background: transparent;
  color: var(--md-primary);
  padding: 10px 16px;
}

.md-btn-text:hover {
  background: rgba(255, 107, 107, 0.08);
}

/* FAB */
.md-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 32px;
  border: none;
  border-radius: var(--md-shape-lg);
  font: var(--md-title-large);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: var(--md-primary);
  color: var(--md-on-primary);
  box-shadow: var(--md-elevation-3);
  transition: all var(--md-motion-duration-medium) var(--md-motion-easing-spring);
  text-decoration: none;
  user-select: none;
}

.md-fab:hover {
  box-shadow: var(--md-elevation-4);
  transform: scale(1.05);
}

.md-fab:active {
  box-shadow: var(--md-elevation-2);
  transform: scale(0.98);
}

.md-fab-large {
  padding: 24px 48px;
  font-size: 1.5rem;
  border-radius: var(--md-shape-xl);
}

/* ---------- Cards ---------- */
.md-card {
  background: var(--md-surface-container-low);
  border-radius: var(--md-shape-lg);
  padding: 24px;
  box-shadow: var(--md-elevation-1);
  transition: all var(--md-motion-duration-medium) var(--md-motion-easing-standard);
  position: relative;
  overflow: hidden;
}

.md-card:hover {
  box-shadow: var(--md-elevation-2);
  transform: translateY(-2px);
}

.md-card-elevated {
  box-shadow: var(--md-elevation-2);
}

.md-card-elevated:hover {
  box-shadow: var(--md-elevation-4);
  transform: translateY(-4px);
}

/* ---------- Material Ripple ---------- */
.md-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: ripple-expand 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes ripple-expand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ---------- Surfaces & Containers ---------- */
.md-surface {
  background: var(--md-surface);
}

.md-surface-container {
  background: var(--md-surface-container);
}

/* ---------- Chip ---------- */
.md-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--md-shape-sm);
  font: var(--md-label-large);
  background: var(--md-surface-container-high);
  color: var(--md-on-surface);
  border: 1px solid var(--md-outline-variant);
  cursor: pointer;
  transition: all var(--md-motion-duration-short) var(--md-motion-easing-standard);
  user-select: none;
}

.md-chip:hover {
  background: var(--md-surface-container-highest);
}

.md-chip.active {
  background: var(--md-primary);
  color: var(--md-on-primary);
  border-color: var(--md-primary);
}

/* ---------- Slider ---------- */
.md-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--md-shape-full);
  background: var(--md-outline-variant);
  outline: none;
  transition: background var(--md-motion-duration-short) var(--md-motion-easing-standard);
}

.md-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--md-primary);
  cursor: pointer;
  box-shadow: var(--md-elevation-2);
  transition: all var(--md-motion-duration-short) var(--md-motion-easing-spring);
}

.md-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--md-elevation-3);
}

.md-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--md-primary);
  cursor: pointer;
  border: none;
  box-shadow: var(--md-elevation-2);
}

/* ---------- Switch ---------- */
.md-switch {
  position: relative;
  width: 52px;
  height: 32px;
  display: inline-block;
}

.md-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.md-switch-track {
  position: absolute;
  inset: 0;
  background: var(--md-outline);
  border-radius: var(--md-shape-full);
  transition: background var(--md-motion-duration-medium) var(--md-motion-easing-standard);
  cursor: pointer;
}

.md-switch input:checked + .md-switch-track {
  background: var(--md-primary);
}

.md-switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--md-elevation-1);
  transition: transform var(--md-motion-duration-medium) var(--md-motion-easing-spring);
  pointer-events: none;
}

.md-switch input:checked ~ .md-switch-thumb {
  transform: translateX(20px);
}

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
