/* =============================================
   MAIN.CSS — Reset, base styles, utilities
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import './variables.css';

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

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

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: clip;
}

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

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

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

/* === Layout Utilities === */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--space-20);
}

.section--lg {
  padding-block: var(--space-24);
}

.section--sm {
  padding-block: var(--space-12);
}

/* === Grid Utilities === */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

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

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* === Flexbox Utilities === */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* === Typography Utilities === */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.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); }
.text-4xl { font-size: var(--text-4xl); }

.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-primary { color: var(--color-primary); }
.text-white { color: var(--color-text-inverse); }

.text-center { text-align: center; }
.text-right { text-align: right; }

/* === Section Headers === */
.section-header {
  text-align: center;
  max-width: 600px;
  margin-inline: auto;
  margin-bottom: var(--space-12);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}

.section-label::before,
.section-label::after {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
}

.section-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  color: var(--color-text);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-4);
}

.section-desc {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

/* === Badge === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
}

.badge--primary { background: var(--color-primary-ghost); color: var(--color-primary); }
.badge--success { background: var(--color-success-bg); color: var(--color-success); }
.badge--warning { background: var(--color-warning-bg); color: var(--color-accent-dark); }
.badge--error { background: var(--color-error-bg); color: var(--color-error); }
.badge--dark { background: var(--color-bg-dark); color: var(--color-text-inverse); }
.badge--sale { background: #fef2f2; color: #ef4444; }
.badge--new { background: #ecfdf5; color: #059669; }
.badge--used { background: #fef9ec; color: #b45309; }
.badge--service { background: #f5f0ff; color: #7c3aed; }

/* === Watermark === */
.has-watermark {
  position: relative;
  isolation: isolate;
}
.has-watermark::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../img/logo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 360px;
  opacity: 0.045;
  pointer-events: none;
  z-index: -1;
}

/* === Divider === */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-8);
}

/* === Breadcrumb === */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding-block: var(--space-5);
}

.breadcrumb a {
  color: var(--color-text-secondary);
  transition: color var(--ease-fast);
}

.breadcrumb a:hover {
  color: var(--color-primary);
}

.breadcrumb i {
  font-size: 0.75rem;
  color: var(--color-border-strong);
}

.breadcrumb span:last-child {
  color: var(--color-text);
  font-weight: var(--font-medium);
}

/* === Page Header === */
.page-header {
  background: linear-gradient(160deg, #080e1a 0%, #0f1e35 100%);
  padding-block: var(--space-16) var(--space-12);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}

.page-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 80% at 80% 50%, rgba(37,99,235,0.20) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 10% 50%, rgba(14,165,233,0.12) 0%, transparent 55%);
  pointer-events: none;
}

.page-header__title {
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  color: white;
  margin-bottom: var(--space-3);
  position: relative;
}

.page-header__desc {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.82);
  max-width: 560px;
  margin-inline: auto;
  position: relative;
}

/* === Spinner === */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* === Smooth fade-in for page load === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.4s ease both;
}

.animate-in--delay-1 { animation-delay: 0.1s; }
.animate-in--delay-2 { animation-delay: 0.2s; }
.animate-in--delay-3 { animation-delay: 0.3s; }

/* === Scroll reveal === */
.js-loaded .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.js-loaded .reveal.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.js-loaded .reveal:nth-child(2) { transition-delay: 0.08s; }
.js-loaded .reveal:nth-child(3) { transition-delay: 0.16s; }
.js-loaded .reveal:nth-child(4) { transition-delay: 0.24s; }
.js-loaded .reveal:nth-child(5) { transition-delay: 0.32s; }

/* === Variantes de reveal ===
   Dan variedad al scroll: en vez de que todo entre siempre "hacia arriba",
   algunos bloques pueden entrar desde un lado o con un leve zoom. Heredan
   la transición de .reveal; solo cambian el punto de partida. */
.js-loaded .reveal--left  { transform: translateX(-42px); }
.js-loaded .reveal--right { transform: translateX(42px); }
.js-loaded .reveal--zoom  { transform: scale(0.94); }

.js-loaded .reveal--left.animate-in,
.js-loaded .reveal--right.animate-in,
.js-loaded .reveal--zoom.animate-in {
  transform: none;
}

/* === Scroll suave al navegar por anclas (#servicios, #ofertas, …) ===
   scroll-padding-top deja lugar al header fijo para que el título de la
   sección no quede tapado al saltar. */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h, 68px) + 12px);
}

/* === Accesibilidad: respeta "reducir movimiento" del sistema ===
   Apaga animaciones y transiciones en todo el sitio, pero deja el
   contenido visible (los .reveal nunca deben quedar ocultos). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  html { scroll-behavior: auto; }

  .js-loaded .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

