/* ---------- Tokens ---------- */
:root {
  --bg: #0A0E1C;
  --bg-elevated: #131A2E;
  --bg-elevated-2: #161F38;
  --ink: #F2F4F8;
  --ink-muted: #8D97B0;
  --cyan: #22D3EE;
  --magenta: #E838C4;
  --violet: #9D6BF5;
  --blob: #3A1246;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --font-sans: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; }

.section-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
}

.section {
  position: relative;
  padding: 64px 0;
  overflow: hidden;
}
.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.22), rgba(232, 56, 196, 0.22), transparent);
  pointer-events: none;
}

.section-title {
  font-size: clamp(1.4rem, 1.15rem + 1.1vw, 2.1rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.25;
  margin-bottom: 24px;
  text-wrap: balance;
}

.body-text {
  color: var(--ink-muted);
  max-width: 62ch;
  font-size: 1rem;
}

/* ---------- Particle canvas containers ---------- */
[data-particles] { position: relative; }

/* ---------- Decorative blobs ---------- */
.blob {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, rgba(58, 18, 70, 0.55) 0%, rgba(58, 18, 70, 0.22) 45%, rgba(58, 18, 70, 0) 72%);
  pointer-events: none;
  z-index: 0;
  animation: blobPulse 5.5s ease-in-out infinite;
  transform: translateY(var(--parallax-y, 0px));
}
.blob--hero { width: 640px; height: 640px; top: -260px; right: -220px; }
.blob--about { width: 520px; height: 520px; top: -120px; left: -240px; }
.blob--method { width: 560px; height: 560px; bottom: -280px; right: -200px; }
.blob--contact { width: 620px; height: 620px; top: -260px; left: 50%; transform: translateX(-50%) translateY(var(--parallax-y, 0px)); }

@keyframes blobPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; opacity: 0.65; --parallax-y: 0px; }
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

.stagger > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
}
.stagger.is-visible > * { opacity: 1; transform: translateY(0); }
.stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.stagger.is-visible > *:nth-child(2) { transition-delay: 60ms; }
.stagger.is-visible > *:nth-child(3) { transition-delay: 120ms; }
.stagger.is-visible > *:nth-child(4) { transition-delay: 180ms; }
.stagger.is-visible > *:nth-child(5) { transition-delay: 240ms; }
.stagger.is-visible > *:nth-child(6) { transition-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-visible, .stagger > *, .stagger.is-visible > * {
    transition: opacity 200ms linear;
    transform: none;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: background-color 200ms ease, transform 150ms ease, border-color 200ms ease, box-shadow 200ms ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--magenta);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: #F04FD1;
  transform: scale(1.03);
  box-shadow: 0 8px 28px rgba(232, 56, 196, 0.35);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
  padding: 10px 18px;
  font-size: 0.9rem;
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }

/* ---------- Badge ---------- */
.badge {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
}
.badge-outline {
  border-color: var(--border);
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 14, 28, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { height: 28px; width: auto; }
.brand-wordmark {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: 1.05rem;
  line-height: 1;
  white-space: nowrap;
}
.brand-wordmark .w-tech { color: var(--magenta); margin-left: 0.2em; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 56px; }
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 680px;
  text-align: center;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-title {
  font-size: clamp(2.75rem, 2.1rem + 6vw, 6rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 0.98;
  margin-bottom: 24px;
}
.hero-title .line-tech { color: var(--magenta); display: block; }
.hero-subtitle {
  color: var(--ink-muted);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  max-width: 48ch;
  margin-bottom: 32px;
}

/* ---------- About / Stats ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; position: relative; z-index: 1; }
.about-text .body-text {
  text-align: justify;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto;
}
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--cyan);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.25),
    0 16px 40px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(34, 211, 238, 0.14);
}
.stat-card:has(.stat-number.c-magenta):hover {
  border-color: var(--magenta);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.25),
    0 16px 40px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(232, 56, 196, 0.14);
}
.stat-card:has(.stat-number.c-violet):hover {
  border-color: var(--violet);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.25),
    0 16px 40px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(157, 107, 245, 0.14);
}
.stat-number {
  font-size: clamp(2rem, 1.6rem + 1.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.stat-number.c-cyan { color: var(--cyan); }
.stat-number.c-magenta { color: var(--magenta); }
.stat-number.c-violet { color: var(--violet); }
.stat-label {
  color: var(--ink-muted);
  font-size: clamp(0.9rem, 0.87rem + 0.15vw, 0.95rem);
  line-height: 1.35;
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto;
}

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.service-card {
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 28px;
  border: 1px solid transparent;
  background-image: linear-gradient(var(--bg-elevated), var(--bg-elevated)), linear-gradient(135deg, transparent, transparent);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  transition: transform 200ms ease, background-image 200ms ease, box-shadow 200ms ease;
}
.service-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.28),
    0 20px 48px rgba(0, 0, 0, 0.32),
    0 0 32px rgba(232, 56, 196, 0.10);
  background-image: linear-gradient(var(--bg-elevated), var(--bg-elevated)), linear-gradient(135deg, var(--cyan), var(--magenta));
}
.service-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  margin-bottom: 16px;
}
.service-icon svg { width: 22px; height: 22px; }
.service-icon.c-cyan { color: var(--cyan); }
.service-icon.c-magenta { color: var(--magenta); }
.service-icon svg * { stroke-dasharray: 100; stroke-dashoffset: 0; }
@keyframes iconDraw {
  0% { stroke-dashoffset: 100; }
  100% { stroke-dashoffset: 0; }
}
.service-card:hover .service-icon svg * {
  animation: iconDraw 550ms var(--ease-out) 1;
}
@media (prefers-reduced-motion: reduce) {
  .service-card:hover .service-icon svg * { animation: none; }
}
.service-title {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin-bottom: 8px;
}
.service-title.c-cyan { color: var(--cyan); }
.service-title.c-magenta { color: var(--magenta); }
.service-text { color: var(--ink-muted); font-size: 0.9rem; }

/* ---------- Methodology ---------- */
.method-wrap { position: relative; }
.method-line {
  display: none;
  position: absolute;
  top: 26px;
  left: 0;
  width: 100%;
  height: 8px;
  pointer-events: none;
  z-index: 0;
}
.method-line line {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1100ms var(--ease-out);
}
.method-line.is-visible line { stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) {
  .method-line line { transition: none; stroke-dashoffset: 0; }
}
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  position: relative;
  z-index: 1;
}
.method-step { text-align: left; position: relative; z-index: 1; }
.method-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: var(--bg);
  margin-bottom: 16px;
}
.method-icon svg { width: 26px; height: 26px; }
.method-icon.c-cyan { color: var(--cyan); }
.method-icon.c-magenta { color: var(--magenta); }
.method-index {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.method-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.method-text { color: var(--ink-muted); font-size: 0.88rem; }

/* ---------- Case study table ---------- */
/* Mobile-first: stacked cards (no horizontal scroll needed to see "Con el sistema") */
.table-wrap { position: relative; z-index: 1; }
.compare-table { width: 100%; }
.compare-table thead { display: none; }
.compare-table tbody tr {
  display: block;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
}
.compare-table tbody tr:last-child { margin-bottom: 0; }
.compare-table th,
.compare-table td {
  display: block;
  text-align: left;
  padding: 14px 18px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
.compare-table tbody th {
  color: var(--ink);
  font-weight: 700;
  background: var(--bg-elevated-2);
}
.compare-table tbody td:first-of-type { color: var(--ink-muted); }
.compare-table tbody td:last-of-type { color: var(--ink); border-bottom: none; }
.compare-table tbody td::before {
  content: "Antes";
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.compare-table tbody td:last-of-type::before { content: "Con el sistema"; color: var(--cyan); }

@media (min-width: 640px) {
  .table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }
  .compare-table { min-width: 640px; }
  .compare-table thead { display: table-header-group; }
  .compare-table tbody tr {
    display: table-row;
    margin-bottom: 0;
    border: none;
    border-radius: 0;
    background: none;
  }
  .compare-table th,
  .compare-table td {
    display: table-cell;
    padding: 16px 20px;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
  }
  .compare-table thead th {
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-elevated);
  }
  .compare-table thead th.th-before { color: var(--ink-muted); }
  .compare-table thead th.th-after { color: var(--cyan); }
  .compare-table tbody th { width: 22%; background: var(--bg-elevated); }
  .compare-table tbody td:last-of-type { border-bottom: 1px solid var(--border); }
  .compare-table tbody td::before,
  .compare-table tbody td:last-of-type::before { content: none; margin-bottom: 0; }
  .compare-table tbody tr:last-child th,
  .compare-table tbody tr:last-child td { border-bottom: none; }
}

/* ---------- Why us ---------- */
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.why-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.why-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  flex-shrink: 0;
}
.why-icon svg { width: 20px; height: 20px; }
.why-icon.c-cyan { color: var(--cyan); }
.why-icon.c-magenta { color: var(--magenta); }
.why-label { font-size: 0.92rem; font-weight: 600; }

/* ---------- Contact ---------- */
.contact-box {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.contact-box .body-text { margin-bottom: 28px; }
.contact-details { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 0.92rem;
  transition: color 200ms ease;
}
.contact-item svg { width: 18px; height: 18px; color: var(--cyan); }
.contact-item:hover { color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; }
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.footer-icon { height: 20px; width: auto; opacity: 0.6; }
.footer-wordmark {
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  .section { padding: 96px 0; }
  .hero { padding: 100px 0 80px; }

  .brand-icon { height: 40px; }
  .brand-wordmark { font-size: 1.4rem; }

  .about-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: 64px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { flex-direction: row; align-items: baseline; justify-content: space-between; text-align: left; padding: 18px 24px; }
}

@media (min-width: 1024px) {
  .method-grid { grid-template-columns: repeat(5, 1fr); }
  .method-line { display: block; }
}
