/* =========================================================
   CHICHI SERVICES — DESIGN SYSTEM
   Tokens, typography, base components
   ========================================================= */

:root {
  /* Surfaces */
  --bg-royal: #060310;
  --bg-deep: #0F0B1E;
  --bg-card: #1A1530;
  --bg-line: #2D2550;

  /* Brand — Purple */
  --purple: #9B5FFF;
  --purple-deep: #7B3FDF;
  --purple-soft: #C4A0FF;
  --purple-15: rgba(155, 95, 255, 0.15);
  --purple-20: rgba(155, 95, 255, 0.20);
  --purple-30: rgba(155, 95, 255, 0.30);
  --purple-glow: rgba(155, 95, 255, 0.45);

  /* Warm latin accent */
  --orange: #FF6B35;
  --orange-deep: #E85A25;
  --orange-soft: rgba(255, 107, 53, 0.18);
  --gold: #FFB347;

  /* Text */
  --white: #FFFFFF;
  --text: #E8E0FF;
  --text-dim: #A89BC8;

  /* Status */
  --success: #22C55E;
  --warn: #F59E0B;
  --error: #EF4444;

  /* Shadows */
  --shadow-card: 0 8px 32px rgba(155, 95, 255, 0.10);
  --shadow-glow: 0 0 40px rgba(155, 95, 255, 0.35);
  --shadow-orange: 0 8px 28px rgba(255, 107, 53, 0.35);

  /* Radii */
  --r-pill: 999px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;

  /* Type */
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg-royal);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

/* ---------- Typography ---------- */
.h-display, h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 6.5vw, 4rem); }       /* 32 → 64 */
h2 { font-size: clamp(1.5rem, 4.4vw, 2.5rem); }   /* 24 → 40 */
h3 { font-size: clamp(1.15rem, 2.4vw, 1.5rem); }
p  { margin: 0; text-wrap: pretty; }

.eyebrow {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--purple-soft);
}

.lead {
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  color: var(--text);
  max-width: 56ch;
}

.mono { font-family: var(--font-mono); }

/* Gradient title — animated purple → orange → purple */
.grad-title {
  background: linear-gradient(
    100deg,
    var(--purple) 0%,
    var(--purple-soft) 25%,
    var(--orange) 55%,
    var(--purple-soft) 80%,
    var(--purple) 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: gradFlow 9s ease-in-out infinite;
}
@keyframes gradFlow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (min-width: 768px) { .wrap { padding: 0 40px; } }

section { position: relative; padding: 88px 0; }
@media (min-width: 768px) { section { padding: 128px 0; } }

.section-divider {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--purple-30) 50%,
    transparent 100%
  );
}

/* ---------- Background atmosphere ---------- */
.bg-atmosphere {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(123, 63, 223, 0.18), transparent 60%),
    radial-gradient(ellipse 100% 60% at 50% 100%, rgba(255, 107, 53, 0.08), transparent 60%),
    var(--bg-royal);
}
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(155, 95, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 95, 255, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 80%);
}

/* Orbs — purple + orange blurred circles */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}
.orb-purple-1 {
  width: 520px; height: 520px;
  background: var(--purple);
  top: -120px; left: -80px;
  animation: orbDrift1 22s ease-in-out infinite alternate;
}
.orb-purple-2 {
  width: 460px; height: 460px;
  background: var(--purple-deep);
  top: 40%; right: -160px;
  animation: orbDrift2 28s ease-in-out infinite alternate;
  opacity: 0.45;
}
.orb-orange {
  width: 420px; height: 420px;
  background: var(--orange);
  bottom: -120px; left: 30%;
  animation: orbDrift3 26s ease-in-out infinite alternate;
  opacity: 0.30;
}
@keyframes orbDrift1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(180px, 120px) scale(1.15); }
}
@keyframes orbDrift2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-160px, -80px) scale(0.9); }
}
@keyframes orbDrift3 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(120px, -180px) scale(1.2); }
}

/* Particles canvas */
#particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
}

/* Reduce motion + perf on mobile */
@media (max-width: 640px) {
  .orb { filter: blur(70px); opacity: 0.4; }
  .orb-purple-1 { width: 360px; height: 360px; }
  .orb-purple-2 { width: 320px; height: 320px; }
  .orb-orange   { width: 300px; height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .orb { animation: none; }
}

/* ---------- Glass card ---------- */
.glass {
  background: rgba(26, 21, 48, 0.55);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--purple-20);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* Animated gradient border (for featured cards) */
.glass-feature {
  position: relative;
  background: rgba(26, 21, 48, 0.65);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.glass-feature::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--purple) 0%, var(--orange) 50%, var(--purple) 100%);
  background-size: 200% 200%;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: borderFlow 6s linear infinite;
  pointer-events: none;
}
@keyframes borderFlow {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--purple-15);
  border: 1px solid var(--purple-30);
  border-radius: var(--r-pill);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple-soft);
  font-weight: 500;
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 10px var(--purple);
  animation: badgePulse 2.4s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.5; }
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease, color .25s ease;
  white-space: nowrap;
  isolation: isolate;
}
@media (min-width: 768px) {
  .btn { height: 56px; font-size: 17px; padding: 0 30px; }
}

/* Primary — orange CTA with shimmer on hover */
.btn-primary {
  background: var(--orange);
  color: #fff;
  box-shadow: var(--shadow-orange);
}
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255,255,255,0.55) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform .8s ease;
  z-index: 1;
}
.btn-primary > * { position: relative; z-index: 2; }
.btn-primary:hover {
  background: var(--orange-deep);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(255, 107, 53, 0.45);
}
.btn-primary:hover::before { transform: translateX(100%); }

/* Secondary — purple */
.btn-secondary {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 8px 28px rgba(155, 95, 255, 0.30);
}
.btn-secondary:hover {
  background: var(--purple-deep);
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(155, 95, 255, 0.45);
}

/* Ghost / tertiary */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--bg-line);
  color: var(--purple-soft);
}
.btn-ghost:hover {
  border-color: var(--purple);
  color: #fff;
  background: var(--purple-15);
}

.btn .arrow { transition: transform .25s ease; }
.btn:hover .arrow { transform: translateX(4px); }

/* WhatsApp icon */
.icon-wa {
  width: 20px; height: 20px;
  fill: currentColor;
}

/* ---------- Sticky mobile WhatsApp FAB ---------- */
.wa-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 22px 0 18px;
  background: var(--orange);
  color: #fff;
  border-radius: 50px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(255, 107, 53, 0.45);
  transition: transform .25s ease, box-shadow .25s ease;
}
.wa-fab::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px solid var(--orange);
  opacity: 0.6;
  animation: waPulse 2.2s ease-out infinite;
  pointer-events: none;
}
.wa-fab:hover { transform: translateY(-2px) scale(1.02); }
@keyframes waPulse {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(1.45); opacity: 0; }
}
@media (max-width: 640px) {
  .wa-fab {
    left: 20px;
    right: 20px;
    bottom: 16px;
    justify-content: center;
    padding: 0 22px;
  }
  .wa-fab .wa-text-full { display: inline; }
}

/* ---------- Stat counter ---------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat .num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--white);
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat .num .accent { color: var(--purple); }
.stat .label {
  font-size: 13px;
  color: var(--purple-soft);
  letter-spacing: 0.04em;
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s cubic-bezier(.16,1,.3,1), transform .9s cubic-bezier(.16,1,.3,1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* Cascade helper — 3D entrance (transition-based so hover/tilt can take over after) */
.stagger { perspective: 1100px; }
.stagger > * {
  opacity: 0;
  transform: translateY(46px) scale(0.92) rotateX(12deg);
  transform-origin: 50% 100%;
  transition: opacity .8s cubic-bezier(.16,1,.3,1), transform .85s cubic-bezier(.16,1,.3,1);
  will-change: opacity, transform;
}
.stagger.in > * { opacity: 1; transform: translateY(0) scale(1) rotateX(0deg); }
.stagger.in > *:nth-child(1) { transition-delay: 0.00s; }
.stagger.in > *:nth-child(2) { transition-delay: 0.08s; }
.stagger.in > *:nth-child(3) { transition-delay: 0.16s; }
.stagger.in > *:nth-child(4) { transition-delay: 0.24s; }
.stagger.in > *:nth-child(5) { transition-delay: 0.32s; }
.stagger.in > *:nth-child(6) { transition-delay: 0.40s; }
.stagger.in > *:nth-child(7) { transition-delay: 0.48s; }
.stagger.in > *:nth-child(8) { transition-delay: 0.56s; }

/* When GSAP drives the reveals, it owns the timing — kill the CSS transitions
   so they don't double-animate the inline values GSAP writes each frame. */
html.gsap-on .reveal,
html.gsap-on .stagger > * { transition: none !important; }

/* ---------- 3D-ish hover for cards ---------- */
.tilt {
  transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
  will-change: transform;
}
.tilt:hover {
  transform: translateY(-4px) rotateX(2deg) rotateY(-2deg);
  box-shadow: 0 18px 48px rgba(155, 95, 255, 0.20);
  border-color: var(--purple-30);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 0;
  transition: background .3s ease, backdrop-filter .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(6, 3, 16, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom-color: var(--purple-20);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--white);
  letter-spacing: 0.02em;
}
.logo-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), var(--purple-deep));
  display: grid; place-items: center;
  box-shadow: 0 4px 16px rgba(155, 95, 255, 0.4);
}
.logo-mark svg { width: 22px; height: 22px; }
.logo small {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--purple-soft);
  text-transform: uppercase;
}
.nav-cta { display: inline-flex; }
/* En móvil muy pequeño, ocultar subtítulo del logo para que no apriete */
@media (max-width: 480px) { .logo small { display: none; } }

/* ---------- Footer ---------- */
.footer {
  padding: 64px 0 120px;
  border-top: 1px solid var(--purple-20);
  background: linear-gradient(180deg, transparent, rgba(15, 11, 30, 0.6));
}
.footer-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
.footer h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--white);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.footer a { color: var(--text); transition: color .2s ease; display: inline-block; padding: 4px 0; }
.footer a:hover { color: var(--purple-soft); }
.footer .slogan {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--purple-soft);
  max-width: 38ch;
  line-height: 1.5;
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mt-12 { margin-top: 48px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mb-12 { margin-bottom: 48px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
@media (min-width: 480px) { .cta-row { gap: 16px; } }

/* Selection */
::selection { background: var(--purple); color: #fff; }
