/* ═══════════════════════════════════════════════════════════════
   SHAPETOTAL HHFM — CAPA DE SISTEMA
   Tokens visuales sincronizados con la produccion reciente.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── Radiologia ── */
  --st-radius-sm: 0.5rem;
  --st-radius-md: 0.75rem;
  --st-radius-lg: 1rem;
  --st-radius-xl: 1.25rem;
  --st-radius-2xl: 1.5rem;
  --st-radius-full: 9999px;

  /* ── Cursor spotlight (seteado via JS) ── */
  --cursor-x: 50%;
  --cursor-y: 50%;

  /* ── Paleta DARK-MATRIX-TECH (shapetotal.com canonical) ── */
  --st-void: #12314f;
  --st-void-soft: #1d4a73;
  --st-void-panel: #163e63;
  --st-surface: #1d4a73;
  --st-surface-raised: #255985;

  --st-primary-bright: #b8ecfa;
  --st-primary: #5fd4f0;
  --st-primary-soft: #5fd4f0;
  --st-primary-pale: #b8ecfa;
  --st-primary-glow: rgba(0, 194, 255, 0.15);
  --st-primary-glow-strong: rgba(0, 194, 255, 0.3);

  --st-cyan-bright: #5fd4f0;
  --st-cyan: #00c2ff;
  --st-cyan-soft: #5fd4f0;
  --st-cyan-pale: #b8ecfa;
  --st-cyan-glow: rgba(0, 194, 255, 0.15);
  --st-cyan-glow-strong: rgba(0, 194, 255, 0.3);

  --st-lime: #aef73e;
  --st-yellow: #f7c600;
  --st-orange: #ff5a1f;

  --st-ink: #eaf2ff;
  --st-ink-soft: #d9e8fa;
  --st-ink-muted: rgba(234, 242, 255, 0.68);
  --st-ink-faint: rgba(234, 242, 255, 0.4);

  --st-green: #00e676;
  --st-green-soft: #69f0ae;
  --st-red: #ff6b6b;
  --st-red-soft: #ff8a80;
  --st-amber: #ffd740;
  --st-violet: #b388ff;

  /* ── Glass premium (mas profundo que el original) ── */
  --st-glass-bg: rgba(10, 10, 18, 0.7);
  --st-glass-bg-light: rgba(10, 10, 18, 0.58);
  --st-glass-border: rgba(255, 255, 255, 0.06);
  --st-glass-border-hover: rgba(0, 194, 255, 0.2);
  --st-glass-blur: blur(40px) saturate(1.4);
  --st-glass-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.06),
    0 20px 60px 0 rgba(2, 2, 6, 0.75);

  /* ── Tarjeta glass ── */
  --st-card-bg: rgba(10, 10, 18, 0.7);
  --st-card-border: rgba(255, 255, 255, 0.06);
  --st-card-shadow: 0 20px 60px 0 rgba(0, 0, 0, 0.5),
  0 0 40px 0 rgba(0, 194, 255, 0.06);
  --st-card-shadow-hover: 0 28px 80px 0 rgba(0, 0, 0, 0.6),
  0 0 60px 0 rgba(0, 194, 255, 0.12);

  /* ── Tipografia ── */
  --st-font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --st-font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --st-font-mono: 'JetBrains Mono', monospace;

  /* ── Escala fluida ── */
  --st-text-hero: clamp(2.5rem, 7vw, 5rem);
  --st-text-h1: clamp(1.75rem, 4.5vw, 3.5rem);
  --st-text-h2: clamp(1.5rem, 3.5vw, 2.5rem);
  --st-text-h3: clamp(1.25rem, 2.5vw, 1.75rem);
  --st-text-h4: clamp(1rem, 2vw, 1.35rem);
  --st-text-body: clamp(0.875rem, 1.2vw, 1rem);
  --st-text-small: clamp(0.75rem, 0.9vw, 0.8125rem);
  --st-text-tiny: clamp(0.625rem, 0.7vw, 0.6875rem);

  /* ── Easing premium ── */
  --st-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --st-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --st-ease-in: cubic-bezier(0.4, 0, 1, 1);
  --st-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Espaciado ── */
  --st-gap-xs: 0.25rem;
  --st-gap-sm: 0.5rem;
  --st-gap-md: 0.75rem;
  --st-gap-lg: 1rem;
  --st-gap-xl: 1.5rem;
  --st-gap-2xl: 2rem;
  --st-gap-3xl: 3rem;
}

/* ── Reset y base ── */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  padding: 0;
  background: var(--st-void);
  color: var(--st-ink);
  font-family: var(--st-font-body);
  font-size: var(--st-text-body);
  line-height: 1.6;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 194, 255, 0.25);
  border-radius: var(--st-radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 194, 255, 0.45); }

/* ═══════════════════════════════════════════════════════════════
   OVERLAYS — 3 capas fijas que dan profundidad cinematografica
   ═══════════════════════════════════════════════════════════════ */

/* ── Noise (granulado sutil) ── */
.st-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

/* ── Spotlight (reflejo que sigue el cursor) ── */
.st-spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    600px circle at var(--cursor-x, 50%) var(--cursor-y, 50%),
    rgba(0, 194, 255, 0.05),
    transparent 40%
  );
  transition: background 0.1s ease-out;
}

/* ── Vignette (oscurecimiento periferico) ── */
.st-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(
    ellipse at center,
    transparent 45%,
    rgba(2, 2, 6, 0.75) 100%
  );
}

/* ═══════════════════════════════════════════════════════════════
   GLASS — vidrio premium con reflections
   ═══════════════════════════════════════════════════════════════ */
.st-glass {
  background: var(--st-glass-bg);
  backdrop-filter: var(--st-glass-blur);
  -webkit-backdrop-filter: var(--st-glass-blur);
  border: 1px solid var(--st-glass-border);
  box-shadow: var(--st-glass-shadow);
}

.st-glass-light {
  background: var(--st-glass-bg-light);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 1px solid var(--st-glass-border);
}

.st-reflection {
  position: relative;
  overflow: hidden;
}
.st-reflection::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06) 0%,
    transparent 40%,
    transparent 70%,
    rgba(0, 194, 255, 0.02) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════
   TEXTO CON GRADIENTE
   ═══════════════════════════════════════════════════════════════ */
.st-text-gradient {
  background: linear-gradient(
    135deg,
    var(--st-cyan-soft),
    var(--st-cyan),
    var(--st-cyan-pale)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.st-text-gradient-vivid {
  background: linear-gradient(
    135deg,
    var(--st-cyan-bright),
    var(--st-cyan),
    var(--st-violet)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   ETIQUETA DE SECCION (label con linea)
   ═══════════════════════════════════════════════════════════════ */
.st-label {
  font-family: var(--st-font-mono);
  font-size: var(--st-text-tiny);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--st-primary-soft);
  display: inline-flex;
  align-items: center;
  gap: var(--st-gap-md);
}
.st-label::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--st-primary-soft);
}

/* ═══════════════════════════════════════════════════════════════
   BOTONES
   ═══════════════════════════════════════════════════════════════ */
.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--st-gap-sm);
  border-radius: calc(var(--st-radius-md) + 4px);
  font-weight: 500;
  min-height: clamp(44px, 6vw, 52px);
  padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(1.25rem, 3vw, 2rem);
  font-size: clamp(0.8125rem, 1.2vw, 0.9375rem);
  letter-spacing: 0.01em;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.35s var(--st-ease-out);
  position: relative;
  user-select: none;
}

.st-btn--primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--st-primary), var(--st-cyan));
  color: var(--st-void);
  font-weight: 600;
  box-shadow:
    0 4px 24px var(--st-primary-glow-strong),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.st-btn--primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.6s var(--st-ease-out);
}
.st-btn--primary:hover::before { transform: translateX(100%); }
.st-btn--primary:hover {
  box-shadow:
    0 6px 32px var(--st-primary-glow-strong),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}
.st-btn--primary:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

.st-btn--secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--st-ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.st-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 194, 255, 0.3);
  box-shadow: 0 4px 24px rgba(0, 194, 255, 0.12);
  transform: translateY(-2px);
}
.st-btn--secondary:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

/* ═══════════════════════════════════════════════════════════════
   ESCALA TIPOGRAFICA
   ═══════════════════════════════════════════════════════════════ */
.st-t-hero {
  font-family: var(--st-font-display);
  font-size: var(--st-text-hero);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.st-t-h1 {
  font-family: var(--st-font-display);
  font-size: var(--st-text-h1);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.st-t-h2 {
  font-family: var(--st-font-display);
  font-size: var(--st-text-h2);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 600;
}
.st-t-h3 {
  font-family: var(--st-font-display);
  font-size: var(--st-text-h3);
  line-height: 1.2;
  font-weight: 600;
}
.st-t-h4 {
  font-family: var(--st-font-display);
  font-size: var(--st-text-h4);
  line-height: 1.3;
  font-weight: 500;
}
.st-t-hud {
  font-family: var(--st-font-mono);
  font-size: var(--st-text-tiny);
  line-height: 1.3;
  letter-spacing: 0.12em;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   GRILLAS FLUIDAS
   ═══════════════════════════════════════════════════════════════ */
.st-grid-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(160px, 40vw, 260px), 1fr));
  gap: clamp(0.75rem, 2vw, 1.5rem);
}
.st-grid-community {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(280px, 85vw, 380px), 1fr));
  gap: clamp(1rem, 2.5vw, 1.5rem);
}
.st-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(280px, 85vw, 400px), 1fr));
  gap: clamp(1rem, 3vw, 2rem);
}
.st-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(240px, 28vw, 320px), 1fr));
  gap: clamp(1rem, 3vw, 2rem);
}
.st-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 22vw, 260px), 1fr));
  gap: clamp(0.75rem, 2vw, 1.5rem);
}

@media (max-width: 640px) {
  .st-grid-products { grid-template-columns: repeat(2, 1fr); gap: 0.625rem; }
  .st-grid-3, .st-grid-4 { grid-template-columns: 1fr; gap: 0.875rem; }
}
@media (min-width: 641px) and (max-width: 1024px) {
  .st-grid-products { grid-template-columns: repeat(3, 1fr); }
  .st-grid-3, .st-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   LINE-CLAMP
   ═══════════════════════════════════════════════════════════════ */
.st-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}
.st-clamp-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.st-clamp-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* ═══════════════════════════════════════════════════════════════
   ANIMACIONES
   ═══════════════════════════════════════════════════════════════ */
@keyframes st-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes st-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes st-fade-down {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes st-scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes st-shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes st-breath {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.06); opacity: 0.7; }
}
@keyframes st-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes st-pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 194, 255, 0.1); }
  50% { box-shadow: 0 0 40px rgba(0, 194, 255, 0.25); }
}

.st-fade-in { animation: st-fade-in 0.6s var(--st-ease-out) both; }
.st-fade-up { animation: st-fade-up 0.7s var(--st-ease-out) both; }
.st-scale-in { animation: st-scale-in 0.5s var(--st-ease-out) both; }
.st-breath { animation: st-breath 5s ease-in-out infinite; }
.st-float { animation: st-float 6s ease-in-out infinite; }
.st-pulse-glow { animation: st-pulse-glow 3s ease-in-out infinite; }

/* ── Reveal on scroll (activado via IntersectionObserver en fx-system) ── */
.st-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.8s var(--st-ease-out),
    transform 0.8s var(--st-ease-out);
}
.st-reveal.st-reveal--in {
  opacity: 1;
  transform: translateY(0);
}

/* ── Skeleton shimmer ── */
.st-skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: st-shimmer 1.8s ease-in-out infinite;
  border-radius: var(--st-radius-md);
}

/* ═══════════════════════════════════════════════════════════════
   ACCESIBILIDAD / MOTION REDUCE
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .st-reveal { opacity: 1; transform: none; transition: none; }
  .st-breath { animation: none; }
  .st-float { animation: none; }
}
