﻿:root {
  --mono: 'JetBrains Mono', 'SFMono-Regular', monospace;
  --sans: 'Space Grotesk', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 18px;
  --radius-lg: 24px;
  --speed: 220ms;
}

body {
  margin: 0;
  padding: 48px;
  font-family: var(--sans);
  line-height: 1.65;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.theme-blue {
  --bg: radial-gradient(circle at 20% 20%, rgba(15, 111, 255, 0.08), transparent 40%), radial-gradient(circle at 80% 0, rgba(0, 194, 255, 0.1), transparent 45%), linear-gradient(160deg, #e9f0ff, #f7f9ff);
  --surface: #ffffff;
  --surface-alt: #f2f5ff;
  --text: #0e1930;
  --text-dim: #3f4f6a;
  --muted: #60718c;
  --accent: #0f6fff;
  --accent-2: #0bd0ff;
  --border: rgba(15, 71, 148, 0.18);
  --shadow: 0 26px 70px rgba(23, 54, 112, 0.15);
  --card-veil: rgba(255, 255, 255, 0.8);
  --glow: rgba(15, 111, 255, 0.2);
  --grid-line: rgba(15, 111, 255, 0.18);
}

body.theme-red {
  --bg: radial-gradient(circle at 10% 20%, rgba(255, 57, 95, 0.15), transparent 38%), radial-gradient(circle at 80% 4%, rgba(255, 122, 47, 0.08), transparent 45%), linear-gradient(150deg, #05060c, #0f1320 60%, #090b14);
  --surface: #0d111c;
  --surface-alt: #141a27;
  --text: #f3f6ff;
  --text-dim: #c2c7d2;
  --muted: #99a1b2;
  --accent: #ff395f;
  --accent-2: #ff7a2f;
  --border: rgba(255, 255, 255, 0.09);
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.55);
  --card-veil: rgba(13, 17, 28, 0.8);
  --glow: rgba(255, 57, 95, 0.25);
  --grid-line: rgba(255, 57, 95, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 150px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.35;
  mix-blend-mode: soft-light;
  mask-image: radial-gradient(circle at 20% 20%, transparent 10%, black 40%), radial-gradient(circle at 80% 10%, transparent 16%, black 55%), linear-gradient(180deg, black 15%, transparent 65%, black 100%);
}

.noise {
  position: fixed;
  inset: 0;
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"%3E%3Cfilter id="n" x="0" y="0" width="100%25" height="100%25"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="200" height="200" filter="url(%23n)" opacity="0.18"/%3E%3C/svg%3E');
  mix-blend-mode: soft-light;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: grid;
  gap: 28px;
  padding-top: 80px;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 12;
}
.scroll-progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--glow);
}

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

.top-nav {
  position: sticky;
  top: 16px;
  z-index: 10;
  display: flex;
  justify-content: center;
}

.top-nav__inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--card-veil);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand__logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: transparent;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  overflow: hidden;
}
.brand__img {
  width: 100%;
  height: 100%;
  padding: 6px;
  object-fit: contain;
}

.brand__text strong { display: block; font-size: 1rem; }
.brand__text small { color: var(--muted); }

.top-nav__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition: background var(--speed) ease, color var(--speed) ease, box-shadow var(--speed) ease;
}
.theme-switch__icon { font-size: 1rem; }
.theme-switch:is(:hover,:focus-visible) { box-shadow: 0 10px 24px var(--glow); outline: none; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}
.nav-toggle span { font-size: 0; }
.nav-toggle svg { width: 22px; height: 22px; }

.top-nav__links {
  display: flex;
  gap: 10px;
  font-weight: 600;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.top-nav__links a {
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: background var(--speed) ease, color var(--speed) ease, border-color var(--speed) ease;
}
.top-nav__links a:hover,
.top-nav__links a:focus-visible {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}
.top-nav__links a.is-active {
  color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 10px 20px var(--glow);
}

.card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)) var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  --tiltX: 0deg;
  --tiltY: 0deg;
  --lift: 0px;
  transform: translate3d(0, var(--lift), 0) rotateX(var(--tiltX)) rotateY(var(--tiltY));
  transition: transform 320ms ease, box-shadow 320ms ease, opacity 320ms ease;
}

.card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--radius-lg) - 1px);
  padding: 1px;
  background: linear-gradient(120deg, var(--accent), transparent 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.35;
}

.card.is-hidden { opacity: 0; transform: translate3d(0, 24px, 0); }
.card.is-visible { opacity: 1; }
[data-tilt]:hover { box-shadow: 0 34px 60px var(--glow); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--speed) ease, box-shadow var(--speed) ease, background var(--speed) ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn--accent { background: linear-gradient(140deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; box-shadow: 0 12px 30px var(--glow); }
.btn--accent:hover { transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--text); border-style: dashed; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-dim);
  border: 1px dashed var(--border);
  font-weight: 600;
  font-size: 0.95rem;
}
.chip--blue { background: rgba(15, 111, 255, 0.14); color: #0c2f85; }
.chip--red { background: rgba(255, 57, 95, 0.16); color: #ff2f4e; }
body.theme-red .chip--blue { background: rgba(255, 57, 95, 0.2); color: #ffe7ee; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.8rem;
}
.pill--blue { color: #0f45b6; background: rgba(15, 111, 255, 0.18); }
.pill--red { color: #ff3b64; background: rgba(255, 57, 95, 0.2); }

.hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero__top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.eyebrow { letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-size: 0.82rem; }

.hero__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; align-items: start; }
.hero__intro h1 { margin: 0; font-size: 2.7rem; letter-spacing: -0.02em; }
.hero__value { margin: 12px 0 16px; color: var(--text-dim); font-size: 1.1rem; max-width: 640px; }
.hero__tags { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 14px; }
.hero__logo { width: 190px; margin: 10px auto 0; filter: drop-shadow(0 12px 28px rgba(0,0,0,0.18)); }
.hero__logo img { width: 100%; display: block; }
.hero__logo--badge { margin: 20px auto 0; width: 220px; cursor: pointer; }
.hero__logo--badge.is-easter {
  animation: logo-spin 1.1s ease, logo-glow 1.1s ease;
}

.hero__panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 18px 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.hero__panel ul { margin: 10px 0; padding-left: 18px; color: var(--text-dim); }
.hero__panel li { margin-bottom: 8px; }
.hero__pill { font-weight: 800; letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.hero__pill--red { color: #ff3b64; background: none; }
body.theme-red .hero__pill--red { color: #ffc3d1; background: none; }
body.theme-red .hero__pill:not(.hero__pill--red) {
  background: transparent;
  color: var(--accent-2);
  border: none;
}
body.theme-red .pill--blue {
  color: #ffe7ee;
  background: rgba(255, 57, 95, 0.2);
}
.divider { height: 1px; background: var(--border); margin: 10px 0; }

.hero__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 8px; }
.stat { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-alt); }
.stat .label { display: block; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; color: var(--muted); }
.stat strong { display: block; margin: 8px 0 6px; font-size: 1.2rem; }
.stat small { color: var(--text-dim); }

.layout { display: grid; gap: 26px; }
.panel { scroll-margin-top: 180px; }
.section-header p { margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-size: 0.82rem; }
.section-header h2 { margin: 0; font-size: 1.8rem; line-height: 1.2; }

.profiles__matrix { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 18px; }
.profiles__matrix article { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.profiles__matrix h3 { margin: 10px 0; font-size: 1.2rem; }
.profiles__matrix ul { margin: 0; padding-left: 18px; color: var(--text-dim); }
.profiles__matrix li { margin-bottom: 8px; }

.services__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.services__grid article { border: 1px solid var(--border); border-radius: 14px; padding: 18px; background: var(--surface-alt); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); }
.services__grid h3 { margin-top: 0; margin-bottom: 6px; }
.services__grid p { margin: 0 0 8px; color: var(--text-dim); }
.services__grid ul { margin: 0; padding-left: 18px; color: var(--muted); }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
.info-grid article { background: var(--surface-alt); padding: 16px; border: 1px dashed var(--border); border-radius: 12px; }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.stack__block ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.stack__block li { display: flex; flex-direction: column; gap: 4px; }
.stack__block strong { font-size: 1.05rem; }
.stack__block span { color: var(--text-dim); }
.highlight ul { margin: 12px 0 0 18px; color: var(--text-dim); }
.radar__items { display: flex; flex-direction: column; gap: 12px; }
.radar__items div { padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-alt); }
.radar__items span { font-weight: 700; }
.radar__items small { color: var(--text-dim); }

.cases__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.cases__grid article { border: 1px solid var(--border); border-radius: 14px; padding: 18px; background: var(--surface-alt); }
.cases__grid h3 { margin-top: 0; margin-bottom: 6px; }
.cases__grid p { margin: 0 0 10px; color: var(--text-dim); }
.cases__grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }

.timeline ol { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.timeline li { position: relative; padding-left: 26px; }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px rgba(255,255,255,0.04); }
.timeline li::after { content: ""; position: absolute; left: 11px; top: 18px; width: 2px; height: calc(100% - 18px); background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline__label { text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-size: 0.82rem; }
.timeline h3 { margin: 4px 0 6px; }
.timeline p { margin: 0; color: var(--text-dim); }

.skills__cloud { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.skills__cloud span { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text-dim); font-weight: 600; }

.contact p { color: var(--text-dim); }
.contact-form { display: grid; gap: 12px; margin: 16px 0; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-weight: 700; }
.form-row input, .form-row textarea { border-radius: 12px; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text); padding: 12px; font-family: var(--sans); font-size: 1rem; }
.form-row input:focus-visible, .form-row textarea:focus-visible { outline: 2px solid var(--accent); border-color: var(--accent); }
.error { color: #ff6b6b; font-size: 0.85rem; min-height: 1em; }
.form-feedback { min-height: 1.1em; color: var(--muted); margin: 0; }
.contact__alt { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.contact-form .btn { width: auto !important; align-self: flex-start; }

.site-footer { text-align: center; color: var(--muted); margin: 32px 0 12px; }

@media (max-width: 960px) {
  .top-nav { position: fixed; right: 16px; left: 16px; top: 14px; }
  .top-nav__inner { grid-template-columns: 1fr; }
  .top-nav__links { justify-content: flex-start; }
}

@media (max-width: 820px) {
  body { padding: 28px; }
  .top-nav { top: auto; bottom: 18px; left: auto; right: 16px; width: auto; }
  .top-nav__inner { grid-template-columns: 1fr; gap: 8px; padding: 12px; border-radius: 18px; }
  .top-nav__controls { width: 100%; justify-content: space-between; }
  .nav-toggle { display: inline-flex; }
  .top-nav__links { max-height: 0; overflow: hidden; opacity: 0; pointer-events: none; flex-direction: column; width: 220px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 14px; padding: 0; transition: max-height var(--speed) ease, opacity var(--speed) ease, padding var(--speed) ease; }
  .top-nav.is-open .top-nav__links { max-height: 420px; opacity: 1; pointer-events: auto; padding: 10px; }
  .top-nav__links a { width: 100%; }
}

@media (max-width: 640px) {
  body { padding: 20px; }
  .card { padding: 22px; border-radius: 18px; }
  .hero__top { flex-direction: column; align-items: flex-start; }
  .hero__intro h1 { font-size: 2.1rem; }
  .top-nav__controls { flex-wrap: wrap; }
  .theme-switch { width: auto; min-width: 0; padding: 8px 10px; justify-content: center; }
  .theme-switch__text { display: none; }
}

@media (max-width: 480px) {
  body { padding: 16px; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__stats { grid-template-columns: 1fr; }
.btn { width: 100%; justify-content: center; }
}

/* Mantener el botón de enviar compacto incluso en móviles */
.contact-form .btn,
.contact-form button[type="submit"] {
  width: auto !important;
  min-width: 0;
  align-self: start;
  justify-self: start;
  justify-content: flex-start;
  display: inline-flex;
}

@keyframes logo-spin {
  0% { transform: rotate(0deg) scale(1); }
  35% { transform: rotate(-10deg) scale(1.06); }
  70% { transform: rotate(12deg) scale(1.12); }
  100% { transform: rotate(0deg) scale(1); }
}
@keyframes logo-glow {
  0% { filter: drop-shadow(0 0 0 rgba(15, 111, 255, 0.0)); }
  50% { filter: drop-shadow(0 0 18px rgba(15, 111, 255, 0.8)); }
  100% { filter: drop-shadow(0 0 0 rgba(15, 111, 255, 0.0)); }
}
