:root {
  --bg: #ffffff;
  --bg-alt: #f5f6fb;
  --text: #16182a;
  --muted: #5b6078;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --accent: #22d3ee;
  --border: #e4e6f0;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(35, 38, 80, .08);
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f1c;
    --bg-alt: #131629;
    --text: #eef0fb;
    --muted: #9ba0bd;
    --border: #23263d;
    --card: #171a2e;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); }

/* Botones */
.btn {
  display: inline-block;
  padding: 14px 26px;
  border-radius: 999px;
  border: 2px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99, 102, 241, .35); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); border-color: var(--primary); box-shadow: none; }
.btn-small { padding: 8px 18px; font-size: .95rem; }

/* Cabecera */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.logo span { color: var(--muted); font-size: .95rem; font-weight: 500; letter-spacing: 0; margin-left: 6px; }
.menu { display: flex; align-items: center; gap: 28px; font-weight: 500; }
.menu a:not(.btn):hover { color: var(--primary); }
.nav-toggle { display: none; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; position: relative; }
.nav-toggle span { position: absolute; left: 9px; right: 9px; height: 2px; background: var(--text); transition: .25s; }
.nav-toggle span:first-child { top: 14px; }
.nav-toggle span:last-child { top: 24px; }
.nav-toggle[aria-expanded="true"] span:first-child { top: 19px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { top: 19px; transform: rotate(-45deg); }

/* Tipografía común */
.eyebrow { color: var(--primary); font-weight: 700; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 12px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: clamp(2.3rem, 5vw, 3.8rem); font-weight: 800; }
h1 em { font-style: normal; background: linear-gradient(120deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.5rem); font-weight: 800; margin-bottom: 14px; }
h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.lead { font-size: 1.2rem; color: var(--muted); margin: 20px 0 30px; max-width: 520px; }

/* Secciones */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head p:last-child { color: var(--muted); }

/* Hero */
.hero { padding: 72px 0 96px; background: radial-gradient(900px 400px at 85% -10%, rgba(99, 102, 241, .18), transparent), radial-gradient(600px 300px at 0% 100%, rgba(34, 211, 238, .12), transparent); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 32px; color: var(--muted); font-size: .95rem; }
.hero-points li::before { content: '✓'; color: var(--primary); font-weight: 700; margin-right: 8px; }

.hero-visual { position: relative; }
.browser { background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.browser-bar i { width: 10px; height: 10px; border-radius: 50%; background: #f87171; }
.browser-bar i:nth-child(2) { background: #fbbf24; }
.browser-bar i:nth-child(3) { background: #4ade80; }
.browser-bar span { margin-left: 12px; font-size: .78rem; color: var(--muted); background: var(--card); padding: 3px 14px; border-radius: 999px; }
.browser-body { padding: 18px; display: grid; gap: 14px; }
.mock-hero { height: 130px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.mock-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mock-row div { height: 60px; border-radius: 8px; background: var(--bg-alt); border: 1px solid var(--border); }
.mock-line { height: 10px; border-radius: 6px; background: var(--border); }
.w80 { width: 80%; } .w60 { width: 60%; }
.float-card { position: absolute; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.float-card strong { font-size: 1.4rem; color: var(--primary); line-height: 1.1; }
.float-card span { font-size: .78rem; color: var(--muted); }
.card-a { left: -28px; bottom: 36px; animation: float 5s ease-in-out infinite; }
.card-b { right: -16px; top: -18px; animation: float 6s ease-in-out infinite reverse; }
@keyframes float { 50% { transform: translateY(-8px); } }

/* Grids y tarjetas */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; transition: transform .2s, box-shadow .2s, border-color .2s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--primary); }
.card p { color: var(--muted); }
.icon { font-size: 1.8rem; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--primary) 12%, transparent); margin-bottom: 18px; }

/* Proceso */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; counter-reset: s; }
.steps li p { color: var(--muted); }
.step-n { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; margin-bottom: 16px; }

/* Precios */
.pricing { align-items: stretch; }
.plan { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--primary); box-shadow: var(--shadow); transform: translateY(-8px); }
.badge { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-size: .78rem; font-weight: 700; padding: 4px 14px; border-radius: 999px; white-space: nowrap; }
.price { font-size: 2.2rem; font-weight: 800; margin: 8px 0 20px; letter-spacing: -.02em; }
.price small { font-size: .85rem; font-weight: 500; color: var(--muted); }
.plan ul { flex: 1; display: grid; gap: 10px; margin-bottom: 28px; color: var(--muted); }
.plan li::before { content: '✓'; color: var(--primary); font-weight: 700; margin-right: 10px; }
.plan .btn { text-align: center; }

/* Proyectos: tarjetas tipo "cliente", con logo y enlace al caso completo.
   auto-fit + minmax evita que, con pocos proyectos, la tarjeta quede
   estirada o pegada a la izquierda; a medida que sumes más, se acomodan solas. */
.clients { grid-template-columns: repeat(auto-fit, minmax(180px, 240px)); justify-content: center; }
.client-card { text-align: center; display: flex; flex-direction: column; align-items: center; }
.client-logo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin-bottom: 18px; box-shadow: var(--shadow); border: 3px solid var(--card); }
.client-card h3 { margin-bottom: 4px; }
.client-sub { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }
.client-link { color: var(--primary); font-weight: 700; font-size: .92rem; }
.client-card:hover .client-link { text-decoration: underline; }

/* Sobre mí */
.about { display: grid; grid-template-columns: 240px 1fr; gap: 56px; align-items: center; }
.avatar { width: 240px; height: 240px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); border: 4px solid var(--card); }
.about p { color: var(--muted); margin-bottom: 14px; max-width: 620px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tags li { font-size: .85rem; font-weight: 600; padding: 5px 14px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary-dark); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
@media (prefers-color-scheme: dark) { .tags li { color: #c7c9ff; } }
.stats { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 24px; }
.stats strong { display: block; font-size: 1.9rem; color: var(--primary); line-height: 1.1; }
.stats span { font-size: .9rem; color: var(--muted); }

/* FAQ */
details { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; margin-bottom: 12px; }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; color: var(--primary); font-size: 1.4rem; line-height: 1; transition: transform .2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { margin-top: 12px; color: var(--muted); }

/* Contacto */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.contact-grid > div > p:not(.eyebrow) { color: var(--muted); }
.contact-grid > div > p.contact-choice { color: var(--text); font-weight: 600; margin-top: 20px; }
.contact-list { margin-top: 16px; display: flex; gap: 14px; }
.contact-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); transition: transform .15s, box-shadow .15s, border-color .15s; }
.contact-icon:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); }
.contact-icon:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.form { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.form label small { font-weight: 500; color: var(--muted); }
.form input, .form select, .form textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
.form .invalid { border-color: #ef4444; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-note { font-size: .9rem; color: var(--muted); min-height: 1.4em; }
.form-note.error { color: #ef4444; }

/* Caso de estudio (proyectos/) */
.back-link { display: inline-block; color: var(--primary); font-weight: 600; font-size: .9rem; margin-bottom: 24px; }
.back-link:hover { text-decoration: underline; }
.case-shot { border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.case-caption { color: var(--muted); font-size: .92rem; margin-top: 12px; }
.arch-steps { display: grid; gap: 14px; margin-top: 24px; counter-reset: a; }
.arch-steps li { display: flex; gap: 14px; color: var(--muted); }
.arch-steps li::before { counter-increment: a; content: counter(a); flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: .85rem; }
.arch-steps li strong { color: var(--text); }
.stack-list { display: grid; gap: 0; margin-top: 20px; }
.stack-list li { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); color: var(--muted); }
.stack-list li:first-child { border-top: none; }
.stack-list li span { font-weight: 700; color: var(--text); font-size: .9rem; }
.note-box { background: color-mix(in srgb, var(--primary) 8%, var(--bg-alt)); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); border-radius: var(--radius); padding: 20px 22px; margin-top: 24px; color: var(--muted); font-size: .95rem; }
.note-box strong { color: var(--text); display: block; margin-bottom: 6px; }
@media (max-width: 760px) {
  .stack-list li { grid-template-columns: 1fr; gap: 4px; }
}

/* Pie */
.site-footer { background: #14162b; color: #b9bdd8; font-size: .95rem; padding-top: 56px; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.3fr; gap: 40px; padding-bottom: 40px; }
.footer-brand .logo { color: #fff; display: inline-block; }
.footer-brand .logo span { color: #b9bdd8; }
.footer-brand p { margin-top: 12px; max-width: 320px; }
.site-footer h4 { color: #fff; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 14px; }
.site-footer ul { display: grid; gap: 10px; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 20px 0; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .88rem; }

/* Animación de entrada */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s, transform .6s; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* Responsive */
@media (max-width: 900px) {
  .hero-grid, .contact-grid, .about { grid-template-columns: 1fr; }
  .hero-visual { max-width: 480px; margin-inline: auto; width: 100%; }
  .card-a { left: -8px; } .card-b { right: -8px; }
  .grid-3 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .plan.featured { transform: none; }
  .about { text-align: center; justify-items: center; }
  .avatar { width: 160px; height: 160px; }
  .stats, .tags { justify-content: center; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .section { padding: 72px 0; }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .menu {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px; display: none;
  }
  .menu.open { display: flex; }
  .menu a { padding: 12px 4px; }
  .menu .btn { text-align: center; margin-top: 8px; }
}
@media (max-width: 520px) {
  .logo span { display: block; margin-left: 0; font-size: .78rem; }
  .steps { grid-template-columns: 1fr; }
}
