:root {
  --bg: #05070d;
  --bg-alt: #090c16;
  --card: #0d111d;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef1f8;
  --text-dim: #9aa3b8;
  --blue: #4f8dff;
  --blue-light: #a9c8ff;
  --grad: linear-gradient(120deg, #dfe8ff 0%, #7fa8ff 45%, #2e5be0 100%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.5;
}

h1, h2, h3, .brand {
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue-light);
  margin: 0 0 12px;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(26px) scale(0.96);
  transition: opacity 0.75s cubic-bezier(.2,.7,.3,1), transform 0.75s cubic-bezier(.2,.7,.3,1);
}
.reveal.in-view { opacity: 1; transform: translateY(0) scale(1); }
.cards .reveal.in-view,
.steps .reveal.in-view,
.features .reveal.in-view,
.team .reveal.in-view {
  transition-delay: calc(var(--i, 0) * 90ms);
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(5, 7, 13, 0.7);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-weight: 700;
  font-size: 1.35rem;
  background: var(--grad);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.01em;
  transition: background-position 0.6s ease;
}
.brand:hover { background-position: right center; }
.brand.small { font-size: 1.05rem; }
.nav-links {
  display: flex;
  gap: 28px;
  font-size: 0.94rem;
  color: var(--text-dim);
}
.nav-links a {
  position: relative;
  padding-bottom: 4px;
}
.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--grad);
  transition: right 0.25s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { right: 0; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.btn.nav-cta-mobile { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.94rem;
  transition: transform 0.18s cubic-bezier(.2,.8,.3,1.3), box-shadow 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--grad);
  color: #05070d;
  box-shadow: 0 8px 24px rgba(79, 141, 255, 0.35);
}
.btn-primary:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 32px rgba(79, 141, 255, 0.5); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.3); transform: translateY(-2px); }
.btn-small { padding: 9px 18px; font-size: 0.88rem; }
.btn-large { padding: 15px 34px; font-size: 1.02rem; }

/* Hero */
.hero {
  position: relative;
  padding: 130px 24px 40px;
  overflow: hidden;
  text-align: center;
}
.hero-glow {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 560px;
  background: radial-gradient(closest-side, rgba(79,141,255,0.25), transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: drift 12s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate(-3%, 0) scale(1); }
  to { transform: translate(3%, 2%) scale(1.06); }
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
}
.hero-logo-bg {
  position: relative;
  z-index: 1;
  margin: 60px auto -40px;
  max-width: 900px;
  -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 96%);
  mask-image: linear-gradient(to bottom, black 55%, transparent 96%);
  will-change: opacity, transform;
}
.hero-logo-bg img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 50px rgba(79,141,255,0.2));
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.12;
  margin: 0 0 20px;
  background: var(--grad);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s ease-in-out infinite;
}
@keyframes shine {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}
.hero-sub {
  color: var(--text-dim);
  font-size: 1.08rem;
  max-width: 560px;
  margin: 0 auto 36px;
}
.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
/* Sections */
.section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 90px 24px;
}
.section.alt { max-width: none; background: var(--bg-alt); }
.section.alt > * { max-width: 1120px; margin-left: auto; margin-right: auto; }
.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 48px;
}
.section-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  margin: 0 0 12px;
}
.section-sub { color: var(--text-dim); margin: 0; }
.section-sub + .section-sub { margin-top: 14px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  transition: transform 0.25s cubic-bezier(.2,.8,.3,1), border-color 0.25s ease, box-shadow 0.25s ease;
}
.card:hover {
  transform: translateY(-6px);
  border-color: rgba(79,141,255,0.45);
  box-shadow: 0 18px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(79,141,255,0.08);
}
.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79,141,255,0.12);
  color: var(--blue-light);
  margin-bottom: 18px;
  transition: transform 0.3s cubic-bezier(.2,.8,.3,1.4), background 0.3s ease;
}
.card:hover .card-icon { transform: scale(1.12) rotate(-4deg); background: rgba(79,141,255,0.22); }
.card-icon svg { width: 22px; height: 22px; }
.card h3 { margin: 0 0 8px; font-size: 1.08rem; }
.card p { margin: 0; color: var(--text-dim); font-size: 0.94rem; }
.card-example {
  margin-top: 14px !important;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 0.87rem !important;
}
.card-example span { color: var(--blue-light); font-weight: 600; }

.card-clickable { cursor: pointer; }
.card-cta {
  margin: 14px 0 0 !important;
  font-size: 0.87rem !important;
  color: var(--blue-light) !important;
  font-weight: 600;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.card-clickable:hover .card-cta,
.card-clickable:focus-visible .card-cta { opacity: 1; transform: translateX(0); }
.card-clickable:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* Modal: ejemplo de base de datos animado */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 4, 10, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.is-open { opacity: 1; }

.desc-window {
  width: min(560px, 100%);
  max-height: 80vh;
  background: #0a0d16;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.6), 0 0 0 1px rgba(79,141,255,0.08);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s ease;
}
.modal-overlay.is-open .desc-window { transform: translateY(0) scale(1); }

.desc-window-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: #0d111d;
  border-bottom: 1px solid var(--border);
}
.desc-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  flex: 1;
}
.code-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.code-close:hover { color: var(--text); }

.desc-body {
  margin: 0;
  padding: 24px 26px 28px;
  max-height: calc(80vh - 60px);
  overflow: auto;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-line;
}
.code-cursor {
  display: inline-block;
  width: 3px;
  height: 1.1em;
  background: var(--blue-light);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.9s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Process steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.step {
  padding: 8px;
}
.step-num {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}
.step h3 { margin: 0 0 8px; font-size: 1.05rem; }
.step p { margin: 0; color: var(--text-dim); font-size: 0.92rem; }

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.feature {
  border-left: 2px solid rgba(79,141,255,0.35);
  padding: 4px 0 4px 18px;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.feature:hover { border-color: var(--blue); transform: translateX(4px); }
.feature h3 { margin: 0 0 8px; font-size: 1.02rem; }
.feature p { margin: 0; color: var(--text-dim); font-size: 0.92rem; }

.team {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 760px;
  margin: 0 auto;
}
.team-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 26px;
  text-align: center;
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.team-card:hover { transform: translateY(-6px); border-color: rgba(79,141,255,0.4); }
.avatar {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--grad);
  color: #05070d;
  font-weight: 700;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}
.team-card:hover .avatar { transform: scale(1.1); }
.team-card h3 { margin: 0 0 8px; }
.team-card p { margin: 0; color: var(--text-dim); font-size: 0.94rem; }

.contact { text-align: center; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
}
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* Los hovers no existen en touch: mostramos siempre lo que dependía de :hover */
@media (hover: none) {
  .card-cta { opacity: 1; transform: none; }
}

@media (max-width: 860px) {
  .cards, .team { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

@media (max-width: 640px) {
  .nav-inner { padding: 14px 20px; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(5, 7, 13, 0.98);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .nav-links.is-open { max-height: 400px; }
  .nav-links a {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
  }
  .nav-links a::after { display: none; }
  .nav-cta-mobile {
    display: inline-flex;
    margin: 16px 20px 20px;
    justify-content: center;
  }
  .nav-cta-desktop { display: none; }
  .nav-toggle { display: flex; }

  .hero { padding: 100px 20px 24px; }
  .hero-content { padding: 0 4px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .hero-logo-bg { margin-top: 40px; }

  .section { padding: 64px 20px; }
  .section-head { margin-bottom: 32px; }

  .cards, .team, .steps, .features { grid-template-columns: 1fr; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .desc-window {
    width: 100%;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
  }
  .desc-body { padding: 20px; font-size: 0.96rem; }

  .footer-inner { flex-direction: column; text-align: center; gap: 8px; }
}

@media (max-width: 380px) {
  .btn-small { padding: 8px 14px; font-size: 0.82rem; }
  .brand { font-size: 1.2rem; }
  .hero h1 { font-size: 1.9rem; }
}

/* Proyectos terminados */
.project {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 32px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(.2,.8,.3,1), border-color 0.25s ease, box-shadow 0.25s ease;
}
.project + .project { margin-top: 28px; }
.project:hover { transform: translateY(-6px); border-color: rgba(79,141,255,0.4); box-shadow: 0 24px 60px rgba(0,0,0,0.45); }
.project:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.project-img { border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }
.project-img img { display: block; width: 100%; height: auto; transition: transform 0.4s ease; }
.project:hover .project-img img { transform: scale(1.03); }
.project-info h3 { margin: 14px 0 10px; font-size: 1.5rem; }
.project-info > p { margin: 0; color: var(--text-dim); font-size: 0.97rem; }
.project-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: #6ee7b7; background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.45);
}
.project-status i { width: 8px; height: 8px; border-radius: 50%; background: #10b981; animation: live 1.8s ease-out infinite; }
.project-status.small { font-size: 0.7rem; padding: 3px 10px; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); } 70%, 100% { box-shadow: 0 0 0 8px rgba(16,185,129,0); } }
.project-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; }
.project-tags li { font-size: 0.82rem; color: var(--blue-light); border: 1px solid rgba(79,141,255,0.35); border-radius: 999px; padding: 4px 12px; }
.project-cta { margin-top: 18px; }
.project:hover .project-cta, .project:focus-visible .project-cta { opacity: 1; transform: translateX(0); }

.proj-window { width: min(1000px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.proj-body { padding: 18px; overflow: auto; }
.proj-main { display: block; max-width: 100%; max-height: 62vh; margin: 0 auto; border-radius: 10px; }
.proj-thumbs { display: flex; gap: 10px; justify-content: center; margin-top: 14px; overflow-x: auto; padding-bottom: 4px; }
.proj-thumbs button { flex: none; height: 74px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: none; cursor: pointer; opacity: 0.6; transition: opacity 0.2s, border-color 0.2s; }
.proj-thumbs button img { height: 100%; display: block; }
.proj-thumbs button:hover { opacity: 1; }
.proj-thumbs button.is-active { opacity: 1; border-color: var(--blue); }
.proj-note { margin: 10px 0 0; text-align: center; color: var(--text-dim); font-size: 0.8rem; }

@media (max-width: 860px) {
  .project { grid-template-columns: 1fr; gap: 20px; padding: 16px; }
  .project-cta { opacity: 1; transform: none; }
  .proj-thumbs { justify-content: flex-start; }
}
