/**
 * Paper Mario UI Kit - CSS Library
 * Inspired by Paper Mario (GameCube/NDS) menus from early 2000s
 * A reusable CSS library similar to mvp.css
 *
 * CORRECCIÓN 2026-03-19: Simplificar gradientes, mejorar contraste, asegurar mobile-first
 */

/* ============================================ FONTS - Cartoon/Retro Style ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&family=Nunito:wght@400;600;700;800;900&display=swap');

/* ============================================ CSS VARIABLES - Paper Mario Palette ============================================ */
:root {
  /* Primary Colors - Mario Red Theme */
  --pm-primary: #E74C3C;
  --pm-primary-light: #FF6B6B;
  --pm-primary-dark: #C0392B;
  --pm-primary-shadow: #922B21;

  /* Secondary Colors */
  --pm-secondary: #3498DB;
  --pm-secondary-light: #5DADE2;
  --pm-secondary-dark: #2980B9;
  --pm-secondary-shadow: #1A5276;

  /* Accent Colors */
  --pm-accent-yellow: #F1C40F;
  --pm-accent-green: #2ECC71;
  --pm-accent-orange: #E67E22;
  --pm-accent-purple: #9B59B6;
  --pm-accent-pink: #FF69B4;

  /* Paper/Cream Backgrounds - SIMPLIFICADOS */
  --pm-paper: #FAF0E6; /* Más cálido para mejor contraste */
  --pm-paper-dark: #F5F5DC;
  --pm-parchment: #F0E8D2; /* Más cálido aún */

  /* Text Colors - Mejor contraste */
  --pm-text: #0D1117; /* Más oscuro para WCAG AA/AAA */
  --pm-text-light: #4A5568;
  --pm-text-muted: #5C6B7F; /* Más oscuro para legibilidad */

  /* Special Effects */
  --pm-shadow: rgba(0, 0, 0, 0.15);
  --pm-shadow-heavy: rgba(0, 0, 0, 0.25);
  --pm-glow: rgba(255, 255, 255, 0.4);

  /* Border Radius - Rounded like Paper Mario */
  --pm-radius-sm: 8px;
  --pm-radius: 16px;
  --pm-radius-lg: 24px;
  --pm-radius-xl: 32px;
  --pm-radius-full: 9999px;

  /* Spacing */
  --pm-space-xs: 4px;
  --pm-space-sm: 8px;
  --pm-space: 16px;
  --pm-space-md: 24px;
  --pm-space-lg: 32px;
  --pm-space-xl: 48px;

  /* Mobile-specific spacing */
  --pm-mobile-padding-x: 12px; /* Márgenes laterales en móvil */
  --pm-mobile-padding-y: 16px; /* Márgenes verticales en móvil */

  /* Transitions */
  --pm-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --pm-transition-bounce: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Dark Mode (opcional) */
@media (prefers-color-scheme: dark) {
  :root {
    --pm-paper: #1A202C;
    --pm-paper-dark: #2D3748;
    --pm-text: #FFFEF7;
    --pm-text-light: #E2E8F0;
    --pm-text-muted: #B8C5CE;
    --pm-shadow: rgba(0, 0, 0, 0.4);
  }
}

/* ============================================ BASE STYLES ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Nunito', 'Fredoka', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--pm-paper);
  min-height: 100vh;
  margin: 0;
  padding: var(--pm-space);
  color: var(--pm-text);
  line-height: 1.6;
}

/* SIMPLIFICACIÓN: Nubes sutiles */
body.pm-clouds {
  background: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.3) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.2) 0%, transparent 40%);
  background-color: var(--pm-paper);
  background-attachment: fixed;
}

/* ============================================ TYPOGRAPHY ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Fredoka', sans-serif;
  color: var(--pm-primary-dark);
  margin: var(--pm-space-md) 0 var(--pm-space-sm);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

h2 {
  font-size: 2rem;
  font-weight: 600;
}

h3 {
  font-size: 1.5rem;
  font-weight: 500;
}

p {
  margin: var(--pm-space-sm) 0 var(--pm-space-md);
  max-width: 70ch;
}

/* ============================================ MOBILE-FIRST ============================================ */
/* Media queries para asegurar mobile-first */
@media (min-width: 768px) {
  /* Desktop: ajustes específicos */
  .container {
        max-width: 1200px;
        margin: 0 auto;
  }
}

/* ============================================ MOBILE OPTIMIZATION (max-width: 767px) ============================================ */
@media (max-width: 767px) {
  /* Mobile: ajustes para mejor legibilidad */
  body {
    padding: 0; /* Sin padding lateral, lo manejan los contenedores */
    font-size: 16px; /* Base fontSize legible */
    line-height: 1.7; /* Mejor line-height para lectura */
  }

  /* Contenedores con márgenes optimizados */
  .pm-container,
  .container {
    padding: 0 12px; /* 12px márgenes laterales en móvil */
    max-width: 100%;
  }

  /* Encabezados optimizados para móvil */
  h1 {
    font-size: 1.6rem; /* Reducido de 1.8rem */
    line-height: 1.3;
    margin-bottom: 0.75rem;
  }

  h2 {
    font-size: 1.35rem; /* Reducido de 1.5rem */
    line-height: 1.4;
    margin-bottom: 0.6rem;
  }

  h3 {
    font-size: 1.15rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
  }

  /* Párrafos optimizados */
  p {
    font-size: 1rem;
    line-height: 1.8; /* Más line-height para mejor lectura */
    margin-bottom: 1rem;
  }

  /* Grid optimizado para móvil */
  .posts-grid {
    grid-template-columns: 1fr; /* Solo 1 columna en móvil */
    gap: 12px;
  }

  /* Cards con padding reducido */
  .pm-card,
  .post-card {
    padding: 12px;
    margin: 8px 0;
  }

  /* Botones optimizados */
  .pm-btn,
  .feedback-button {
    width: 100%;
    padding: 10px 12px; /* Padding ajustado */
    font-size: 0.95rem;
  }

  /* Hero section optimizada */
  .hero {
    padding: 16px 12px;
    margin-bottom: 12px;
  }

  /* Feedback optimizado */
  .feedback-container {
    padding: 12px;
    margin: 12px 0;
  }

  /* About preview optimizado */
  .about-preview {
    padding: 12px;
    margin: 8px 0;
  }
}

/* ============================================ SMALL MOBILE OPTIMIZATION (max-width: 374px) ============================================ */
@media (max-width: 374px) {
  /* Pantallas muy pequeñas (iPhone SE, etc.) */
  body {
    font-size: 15px; /* Slightly smaller for tiny screens */
  }

  .pm-container,
  .container {
    padding: 0 8px; /* Even narrower margins */
  }

  h1 {
    font-size: 1.4rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  /* Cards con padding aún más reducido */
  .pm-card,
  .post-card {
    padding: 8px;
    margin: 6px 0;
  }
}

/* ============================================ COMPONENTS ============================================ */
.container {
  max-width: 100%;
  padding: 0 var(--pm-space);
}

/* Sistema de Feedback */
.feedback-container {
  background: var(--pm-paper-dark);
  border: 3px solid var(--pm-primary);
  border-radius: var(--pm-radius);
  padding: var(--pm-space-md);
  margin: var(--pm-space-lg) 0;
  box-shadow: var(--pm-shadow); /* Mejorado: Paper Mario depth shadow */
}

.feedback-button {
  background: var(--pm-primary);
  color: var(--pm-paper);
  border: none;
  border-radius: var(--pm-radius-sm);
  padding: var(--pm-space-sm) var(--pm-space);
  font-weight: 600;
  cursor: pointer;
  transition: var(--pm-transition);
}

.feedback-button:hover {
  background: var(--pm-primary-light);
  box-shadow: var(--pm-shadow-heavy); /* Más pronunciado al hover */
}

.rating-display {
  background: var(--pm-secondary);
  color: var(--pm-paper);
  padding: var(--pm-space-sm);
  border-radius: var(--pm-radius-sm);
  margin-top: var(--pm-space-sm);
}

/* CSS Grid - Mobile First */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--pm-space);
  padding: 0; /* Quitado margen para grid funcione */
}

@media (min-width: 768px) {
  .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Más grande en desktop */
  }
}

/* ============================================ UTILITY CLASSES ============================================ */
.text-center { text-align: center; }
.text-muted { color: var(--pm-text-muted); }
.mt-1 { margin-top: var(--pm-space); }
.mb-1 { margin-bottom: var(--pm-space); }
.p-1 { padding: var(--pm-space); }
