/* =========================================================
   CMC — Landing de servicios educativos
   Temas: [data-theme="dark"] (por defecto) y [data-theme="light"]
   ========================================================= */

:root,
[data-theme="dark"] {
  --bg: #0A0912;
  --bg-alt: #0E0C18;
  --footer: #06050B;
  --surface: rgba(24, 20, 40, 0.72);
  --surface-solid: #15121F;
  --border: #241E36;
  --border-strong: #3B2F63;
  --text: #F3F0FA;
  --muted: #B9B2CC;
  --soft: #D4CEE4;
  --accent: #7C3AED;
  --accent-2: #A78BFA;
  --teal: #2DD4BF;
  --highlight: #DDD6FE;
  --pill-bg: rgba(18, 15, 30, 0.8);
  --pill-text: #C4B5FD;
  --node: 167, 139, 250;
  --node-2: 45, 212, 191;
  --glow-a: rgba(124, 58, 237, 0.35);
  --glow-b: rgba(45, 212, 191, 0.18);
  --shadow: 0 20px 60px -20px rgba(124, 58, 237, 0.45);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-alt: #F8F5FF;
  --footer: #F3EFFC;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #FFFFFF;
  --border: #E7E0F7;
  --border-strong: #CDBBF7;
  --text: #1C1630;
  --muted: #4A4163;
  --soft: #3F3656;
  --accent: #6D28D9;
  --accent-2: #7C3AED;
  --teal: #0F766E;
  --highlight: #5B21B6;
  --pill-bg: #FFFFFF;
  --pill-text: #5B21B6;
  --node: 109, 40, 217;
  --node-2: 15, 118, 110;
  --glow-a: rgba(124, 58, 237, 0.18);
  --glow-b: rgba(20, 184, 166, 0.12);
  --shadow: 0 20px 50px -24px rgba(109, 40, 217, 0.35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .4s ease;
}

a { color: var(--accent-2); }
img, svg { display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
p { margin: 0; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 16px; }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 6px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 14px 24px; border-radius: 12px;
  font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; position: relative; isolation: isolate;
  transition: transform .2s ease, box-shadow .3s ease, background-color .3s ease, border-color .3s ease;
}
.btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn--sm { min-height: 44px; padding: 10px 18px; font-size: 14px; }
.btn--lg { min-height: 58px; padding: 18px 32px; font-size: 17px; }
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn--primary::after {
  content: ""; position: absolute; inset: -2px; border-radius: 14px; z-index: -1;
  background: conic-gradient(from var(--angle, 0deg), var(--accent), var(--teal), var(--accent-2), var(--accent));
  opacity: 0; transition: opacity .3s ease; animation: spin 4s linear infinite;
}
.btn--primary:hover { transform: translateY(-2px); color: #fff; }
.btn--primary:hover::after { opacity: 1; }
.btn--ghost { border-color: var(--border-strong); color: var(--text); background: var(--surface); }
.btn--ghost:hover { border-color: var(--accent-2); transform: translateY(-2px); color: var(--text); }

@property --angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --angle: 360deg; } }

.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  transition: border-color .3s ease, transform .2s ease;
}
.icon-btn:hover { border-color: var(--accent-2); transform: rotate(-8deg); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .i-moon, [data-theme="light"] .i-sun { display: none; }

/* ---------- Navegación ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand__mark { width: 38px; height: 38px; fill: none; stroke: var(--text); stroke-width: 1.6; }
.brand__ring { transform-origin: 20px 20px; animation: rotate 24s linear infinite; }
.brand__name { font-weight: 800; font-size: 28px; letter-spacing: -1px; }
@keyframes rotate { to { transform: rotate(360deg); } }

.nav__links { display: flex; align-items: center; gap: 26px; font-size: 14px; font-weight: 600; }
.nav__links a:not(.btn) { color: var(--soft); text-decoration: none; position: relative; padding: 6px 0; }
.nav__links a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--teal)); transform: scaleX(0); transform-origin: left;
  transition: transform .3s ease;
}
.nav__links a:not(.btn):hover::after { transform: scaleX(1); }
.nav__actions { display: flex; gap: 10px; }
.nav__burger { display: none; }

@media (max-width: 860px) {
  .nav__burger { display: inline-flex; }
  .nav__links {
    position: absolute; top: 72px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 4px; padding: 16px 24px 24px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  }
  .nav__links.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav__links a:not(.btn) { padding: 12px 0; font-size: 16px; }
  .nav__links .btn { margin-top: 8px; }
  .nav__inner { flex-wrap: nowrap; }
  .nav__actions { order: 2; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: min(92vh, 860px); display: flex; flex-direction: column; justify-content: center;
  border-bottom: 1px solid var(--border);
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero__glow { position: absolute; border-radius: 50%; filter: blur(80px); z-index: -2; animation: float 14s ease-in-out infinite; }
.hero__glow--a { width: 520px; height: 520px; background: var(--glow-a); top: -160px; left: -120px; }
.hero__glow--b { width: 460px; height: 460px; background: var(--glow-b); bottom: -180px; right: -100px; animation-delay: -7s; }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(40px, 30px); } }

.hero__content { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 24px; padding-top: 96px; padding-bottom: 72px; }
.pill {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--border-strong); background: var(--pill-bg); color: var(--pill-text);
  font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  padding: 8px 16px; border-radius: 999px; backdrop-filter: blur(8px);
}
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 var(--teal); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--node-2), .6); } 70% { box-shadow: 0 0 0 10px rgba(var(--node-2), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--node-2), 0); } }

.hero__title { font-size: clamp(36px, 6vw, 64px); font-weight: 800; letter-spacing: -1.5px; max-width: 940px; }
.grad {
  background: linear-gradient(90deg, var(--accent-2), var(--teal), var(--accent-2));
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }
.hero__lead { font-size: clamp(16px, 2vw, 19px); color: var(--muted); max-width: 700px; }
.hero__rotator { font-size: 15px; color: var(--teal); font-family: "JetBrains Mono", monospace; min-height: 24px; }
.caret { display: inline-block; width: 8px; height: 18px; margin-left: 4px; vertical-align: -3px; background: var(--teal); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.marquee { border-top: 1px solid var(--border); overflow: hidden; padding: 16px 0; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.marquee__track { display: flex; gap: 48px; width: max-content; animation: marquee 32s linear infinite; }
.marquee__track span { font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 48px; }
.marquee__track span::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Secciones ---------- */
.section { padding: 112px 0; position: relative; }
.section--alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); isolation: isolate; overflow: hidden; }
/* Malla de puntos suave que se desvanece hacia los bordes */
.section--alt::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(var(--node), .22) 1px, transparent 1.4px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}
.section__head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; margin-bottom: 56px; }
.eyebrow { font-family: "JetBrains Mono", monospace; font-size: 13px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; color: var(--teal); }
.section__title { font-size: clamp(30px, 4.2vw, 44px); font-weight: 800; letter-spacing: -0.5px; text-transform: uppercase; max-width: 820px; }
.section__title .thin { font-weight: 500; color: var(--muted); }
.section__lead { font-size: 17px; color: var(--muted); max-width: 680px; }
.section__lead--accent { font-style: italic; font-weight: 600; font-size: 18px; color: var(--highlight); }

.grid { display: grid; gap: 20px; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

/* ---------- Tarjetas con brillo que sigue al cursor ---------- */
.card, .project, .tile {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  backdrop-filter: blur(6px);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .35s ease, box-shadow .35s ease;
}
.card::before, .project::before, .tile::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .35s ease;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--node), .16), transparent 45%);
}
.card:hover, .project:hover, .tile:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card:hover::before, .project:hover::before, .tile:hover::before { opacity: 1; }

.card { padding: 30px; display: flex; flex-direction: column; gap: 14px; }
.card h3 { font-size: 18px; font-weight: 700; }
.card p { font-size: 15px; color: var(--muted); }
.card__icon {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(var(--node), .18), rgba(var(--node-2), .12));
  border: 1px solid var(--border-strong);
}
.card__icon svg { width: 26px; height: 26px; fill: none; stroke: var(--teal); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card--row { flex-direction: row; align-items: flex-start; gap: 18px; padding: 24px; }
.card--row .card__icon { flex: 0 0 52px; }
.card--row > div:last-child { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Hub de integraciones ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; align-items: center; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }

.hub { position: relative; width: 100%; max-width: 440px; aspect-ratio: 1; margin: 0 auto; }
.hub__lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.hub__lines line { stroke: rgba(var(--node), .45); stroke-width: 1.2; stroke-dasharray: 4 6; animation: dash 1.6s linear infinite; }
.hub__orbit { fill: none; stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 2 8; transform-origin: 200px 200px; animation: rotate 40s linear infinite; }
.hub__orbit--in { animation-direction: reverse; animation-duration: 26s; }
@keyframes dash { to { stroke-dashoffset: -20; } }
.hub__core {
  position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle, var(--accent) 0%, color-mix(in srgb, var(--accent) 60%, var(--bg)) 70%);
  color: #fff; font-weight: 800; font-size: clamp(14px, 2.2vw, 18px);
  box-shadow: 0 0 0 10px rgba(var(--node), .12), 0 0 60px rgba(var(--node), .55);
  animation: breathe 4s ease-in-out infinite;
}
@keyframes breathe { 50% { box-shadow: 0 0 0 18px rgba(var(--node), .06), 0 0 90px rgba(var(--node), .7); } }
.hub__node {
  position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%);
  padding: 8px 12px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 700; color: var(--text);
  background: var(--surface-solid); border: 1px solid var(--border-strong);
  box-shadow: 0 6px 20px -8px rgba(var(--node), .6);
  animation: bob 5s ease-in-out infinite;
}
.hub__node:nth-of-type(2n) { animation-delay: -2.5s; }
@keyframes bob { 50% { transform: translate(-50%, calc(-50% - 6px)); } }

/* ---------- Virtualización ---------- */
.tile { padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.tile__num { font-family: "JetBrains Mono", monospace; font-size: 26px; font-weight: 500; color: var(--teal); }
.tile p { font-size: 16px; font-weight: 600; }

.subhead { margin: 72px 0 32px; font-size: 24px; font-weight: 800; text-transform: uppercase; text-align: center; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; position: relative; }
.timeline::before {
  content: ""; position: absolute; top: 9px; left: 10px; right: 10px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  transform: scaleX(var(--progress, 0)); transform-origin: left; transition: transform 1.4s cubic-bezier(.2,.7,.2,1);
}
.timeline.is-in::before { --progress: 1; }
.timeline__step { position: relative; padding-top: 36px; display: flex; flex-direction: column; gap: 8px; }
.timeline__dot {
  position: absolute; top: 0; left: 0; width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent-2); box-shadow: 0 0 16px rgba(var(--node), .6);
}
.timeline__step h4 { font-size: 17px; font-weight: 700; }
.timeline__step p { font-size: 15px; color: var(--muted); }
@media (max-width: 860px) {
  .timeline { grid-template-columns: 1fr; gap: 28px; padding-left: 36px; }
  .timeline::before { top: 10px; bottom: 10px; left: 9px; right: auto; width: 2px; height: auto; transform: scaleY(var(--progress, 0)); transform-origin: top; background: linear-gradient(180deg, var(--accent), var(--teal)); }
  .timeline__step { padding-top: 0; }
  .timeline__dot { left: -36px; }
}

.banner {
  margin-top: 64px; padding: 34px; border-radius: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
  background: linear-gradient(135deg, rgba(var(--node), .14), rgba(var(--node-2), .08)); border: 1px solid var(--border-strong);
}
.banner > div { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.banner h3 { font-size: 22px; font-weight: 800; }
.banner p { color: var(--muted); font-size: 15px; }

/* ---------- Portafolio ---------- */
.project { padding: 28px; display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: var(--text); }
.project h3 { font-size: 20px; font-weight: 800; }
.project p { font-size: 15px; color: var(--muted); flex: 1; }
.project__tag {
  align-self: flex-start; font-family: "JetBrains Mono", monospace; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--pill-text); border: 1px solid var(--border-strong); padding: 4px 10px; border-radius: 999px;
}
.project__link { font-size: 13px; font-weight: 700; color: var(--teal); display: inline-flex; gap: 6px; }
.project__link span { transition: transform .3s ease; }
.project:hover .project__link span { transform: translateX(5px); }
.project:hover { color: var(--text); }

/* ---------- Contacto ---------- */
.contact { overflow: hidden; isolation: isolate; text-align: center; }
.contact__glow {
  position: absolute; left: 50%; top: 50%; width: 760px; height: 420px; transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, var(--glow-a), transparent 65%); z-index: -1; filter: blur(40px);
}
.contact__inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.contact__note { font-family: "JetBrains Mono", monospace; font-size: 14px; color: var(--muted); }

/* ---------- Footer ---------- */
.footer { background: var(--footer); border-top: 1px solid var(--border); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 28px; padding-bottom: 28px; font-size: 13px; color: var(--muted); }
.footer strong { color: var(--text); font-weight: 800; }

/* ---------- Aparición al hacer scroll ---------- */
.reveal { opacity: 0; transform: translateY(28px); filter: blur(4px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1), filter .8s ease; transition-delay: var(--delay, 0s); }
.reveal.is-in { opacity: 1; transform: none; filter: none; }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; filter: none; }
  .timeline::before { --progress: 1; }
}
