/* CSS crítico optimizado para máximo rendimiento */

/* Reset mínimo pero efectivo */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

body {
  color: #333;
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout principal - evitar CLS */
#navbar-container {
  height: 68px;
  position: relative;
}

#main-content {
  min-height: 60vh;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease-in-out;
}

#footer-container {
  min-height: 180px;
}

/* Estados de carga optimizados */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  font-size: 14px;
  color: #666;
}

/* Preload de elementos críticos above-the-fold */
.hero-section {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
}

.hero-title {
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  opacity: 0.8;
  margin-bottom: 2rem;
}

/* Botones críticos */
.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  background: #6366f1;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background: #4f46e5;
}

/* Grid responsive básico */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Optimizaciones para Web Vitals */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Reducir layout thrashing */
* {
  will-change: auto;
}

/* Error fallback */
.error-message {
  padding: 1rem;
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 4px;
  color: #c33;
  text-align: center;
}
