/* ═══════════════════════════════════════════════════════════════════════════════
   LANDING PAGE UTILITIES — Kcafé Ancestral
   Utilidades CSS avanzadas, animaciones y mejoras de UX
═══════════════════════════════════════════════════════════════════════════════ */

/* ── VARIABLES DE ANIMACIÓN ──────────────────────────────────────────────── */
:root {
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --timing-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --timing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --timing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ── ANIMACIONES AVANZADAS ─────────────────────────────────────────────── */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(232, 93, 4, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(232, 93, 4, 0.8);
  }
}

@keyframes wobble {
  0% { transform: translateX(0); }
  15% { transform: translateX(-5px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-5px); }
  60% { transform: translateX(5px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rotate-360 {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── UTILIDADES DE VISIBILIDAD ───────────────────────────────────────── */
.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.opacity-0 {
  opacity: 0;
}

.opacity-50 {
  opacity: 0.5;
}

.opacity-100 {
  opacity: 1;
}

/* ── UTILIDADES DE ESPACIADO ──────────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.px-1 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2 { padding-left: 1rem; padding-right: 1rem; }
.px-3 { padding-left: 1.5rem; padding-right: 1.5rem; }

.py-1 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2 { padding-top: 1rem; padding-bottom: 1rem; }
.py-3 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

/* ── UTILIDADES DE TEXTO ────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-muted { color: var(--mist); }
.text-primary { color: var(--bark); }
.text-accent { color: var(--fire); }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── UTILIDADES DE FLEXBOX ────────────────────────────────────────────– */
.flex { display: flex; }
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-grow { flex-grow: 1; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* ── UTILIDADES DE GRID ──────────────────────────────────────────────── */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.col-span-1 { grid-column: span 1; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ── UTILIDADES DE BORDES ────────────────────────────────────────────– */
.rounded { border-radius: var(--r-md); }
.rounded-sm { border-radius: var(--r-sm); }
.rounded-lg { border-radius: var(--r-lg); }
.rounded-xl { border-radius: var(--r-xl); }
.rounded-full { border-radius: var(--r-pill); }

.border-1 { border: 1px solid var(--sand); }
.border-2 { border: 2px solid var(--sand); }
.border-t { border-top: 1px solid var(--sand); }
.border-b { border-bottom: 1px solid var(--sand); }
.border-l { border-left: 1px solid var(--sand); }
.border-r { border-right: 1px solid var(--sand); }

/* ── UTILIDADES DE SHADOW ───────────────────────────────────────────── */
.shadow-sm { box-shadow: var(--sh-sm); }
.shadow-md { box-shadow: var(--sh-md); }
.shadow-lg { box-shadow: var(--sh-lg); }
.shadow-fire { box-shadow: var(--sh-fire); }

.shadow-hover {
  transition: box-shadow 0.3s var(--timing-ease);
}

.shadow-hover:hover {
  box-shadow: var(--sh-lg);
}

/* ── UTILIDADES DE BACKGROUND ───────────────────────────────────────── */
.bg-white { background: white; }
.bg-bone { background: var(--bone); }
.bg-cream { background: var(--cream); }
.bg-fire { background: var(--fire); }
.bg-fire-soft { background: var(--fire-soft); }

.bg-gradient-fire {
  background: linear-gradient(135deg, var(--fire), var(--amber));
}

.bg-gradient-earth {
  background: linear-gradient(135deg, var(--earth), var(--terra));
}

/* ── UTILIDADES DE CURSOR ────────────────────────────────────────────– */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }
.cursor-grab { cursor: grab; }
.cursor-grabbing { cursor: grabbing; }

/* ── ESTADOS DE BOTONES ──────────────────────────────────────────────– */
.btn-hover {
  transition: all 0.3s var(--timing-ease);
}

.btn-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-lg);
}

.btn-press:active {
  transform: scale(0.98);
}

/* ── UTILIDADES DE POSICIÓN ──────────────────────────────────────────– */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.inset-0 { inset: 0; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

/* ── UTILIDADES DE TRANSFORM ────────────────────────────────────────── */
.scale-75 { transform: scale(0.75); }
.scale-90 { transform: scale(0.9); }
.scale-95 { transform: scale(0.95); }
.scale-100 { transform: scale(1); }
.scale-110 { transform: scale(1.1); }

.rotate-45 { transform: rotate(45deg); }
.rotate-90 { transform: rotate(90deg); }

.translate-y-1 { transform: translateY(0.25rem); }
.translate-y-2 { transform: translateY(0.5rem); }
.translate-y-4 { transform: translateY(1rem); }

/* ── UTILIDADES DE TRANSICIÓN ───────────────────────────────────────── */
.transition-fast { transition: all var(--duration-fast) var(--timing-ease); }
.transition-normal { transition: all var(--duration-normal) var(--timing-ease); }
.transition-slow { transition: all var(--duration-slow) var(--timing-ease); }

.transition-colors { transition: color var(--duration-normal) var(--timing-ease), background-color var(--duration-normal) var(--timing-ease); }
.transition-transform { transition: transform var(--duration-normal) var(--timing-ease); }

/* ── UTILIDADES DE OVERFLOW ──────────────────────────────────────────– */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-visible { overflow: visible; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── UTILIDADES DE ASPECT RATIO ──────────────────────────────────────– */
.aspect-square { aspect-ratio: 1; }
.aspect-video { aspect-ratio: 16 / 9; }
.aspect-4-3 { aspect-ratio: 4 / 3; }
.aspect-golden { aspect-ratio: 1.618 / 1; }

/* ── UTILIDADES DE WIDTH/HEIGHT ──────────────────────────────────────– */
.w-full { width: 100%; }
.h-full { height: 100%; }
.w-screen { width: 100vw; }
.h-screen { height: 100vh; }

.w-auto { width: auto; }
.h-auto { height: auto; }

.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-full { max-width: 100%; }

/* ── UTILIDADES DE POINTER EVENTS ───────────────────────────────────── */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* ── UTILIDADES DE Z-INDEX ──────────────────────────────────────────– */
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.z-auto { z-index: auto; }

/* ── PLACEHOLDERS ────────────────────────────────────────────────────– */
.loading-skeleton {
  background: linear-gradient(
    90deg,
    var(--sand) 25%,
    var(--sand-mid) 50%,
    var(--sand) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.loading-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ── UTILIDADES DE LINK ──────────────────────────────────────────────– */
.link-underline {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.link-hover {
  transition: color var(--duration-normal) var(--timing-ease);
}

.link-hover:hover {
  color: var(--fire);
}

/* ── UTILIDADES ESPECÍFICAS DE LANDING ───────────────────────────────– */
.card-hover {
  transition: all var(--duration-normal) var(--timing-ease);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-lg);
}

.price-tag {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fire);
}

.badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  background: var(--fire-soft);
  color: var(--fire);
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: var(--fire-soft);
  color: var(--fire);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

/* ── PRINT STYLES ───────────────────────────────────────────────────– */
@media print {
  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  body {
    font-size: 12pt;
    color: black;
    background: white;
  }

  a {
    text-decoration: underline;
  }

  img {
    max-width: 100%;
  }
}

/* ── REDUCED MOTION ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ── DARK MODE OVERRIDES ─────────────────────────────────────────────– */
@media (prefers-color-scheme: dark) {
  .bg-white {
    background: var(--dark-card);
  }

  .bg-bone {
    background: var(--dark-card2);
  }

  .text-primary {
    color: white;
  }

  .border-1, .border-2, .border-t, .border-b, .border-l, .border-r {
    border-color: var(--dark-border);
  }

  .shadow-sm, .shadow-md, .shadow-lg {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  }
}

/* ── ACCESSIBILITY ──────────────────────────────────────────────────– */
.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;
}

/* Focus visible para navegación por teclado */
:focus-visible {
  outline: 2px solid var(--fire);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--fire);
  outline-offset: 2px;
}
