/* =========================================================================
   JF — Soluciones informáticas y desarrollo web
   Colores y tipografía se ajustan desde las variables de :root.
   ========================================================================= */

:root {
  /* Colores */
  /* Negro neutro, igual al fondo del logo */
  --bg: #000000;
  --bg-alt: #0a0a0a;
  --surface: #111111;
  --surface-2: #171717;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f3;
  --text-muted: #a8a8a8;
  --text-subtle: #8a8a8a;
  --moon: #f4f5f7;
  --focus: #d4d4d4;
  --error: #f19a9a;
  --success: #9fd8b4;
  --wa: #1f9e55;
  --wa-hover: #22b05f;

  /* Tipografía (fuentes del sistema: carga instantánea) */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;

  /* Espaciado y forma */
  --container: 1160px;
  --gutter: clamp(16px, 4vw, 32px);
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 68px;

  /* Movimiento */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Fondo: cielo nocturno ----------
   Una sola capa fija detrás de toda la página. Se pinta una vez y el navegador la compone
   aparte, así el scroll no la vuelve a dibujar. Sin animación a propósito: es un fondo que
   se ve todo el tiempo y el movimiento constante distraería del contenido.
   Dos capas de estrellas con tamaños de repetición distintos (1100 y 1730 px) para que
   no se note ningún patrón. Para cambiar las estrellas: assets/fondo/*.svg */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    url("../assets/fondo/estrellas-cercanas.svg") 0 0 / 1730px 1730px repeat,
    url("../assets/fondo/estrellas-lejanas.svg") 0 0 / 1100px 1100px repeat,
    linear-gradient(180deg, #05070c 0%, #020306 55%, #000 100%);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--moon);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.975rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 160ms var(--ease-out),
    background-color 200ms ease,
    border-color 200ms ease,
    color 200ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-sm { min-height: 40px; padding: 0 18px; font-size: 0.925rem; }

.btn-primary { background: var(--moon); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-whatsapp { background: var(--wa); color: #fff; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: #ffffff; }
  .btn-ghost:hover { border-color: rgba(255, 255, 255, 0.36); background: rgba(255, 255, 255, 0.04); }
  .btn-whatsapp:hover { background: var(--wa-hover); }
}

/* ---------- Encabezado ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background-color 200ms ease, border-color 200ms ease;
}
.site-header[data-scrolled="true"],
.site-header:has(.nav-menu[data-open="true"]) {
  background: rgba(0, 0, 0, 0.82);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}
.brand-mark { width: auto; height: 36px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-tagline { padding-left: 12px; border-left: 1px solid var(--line-strong); font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-menu a:not(.btn) {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 200ms ease;
}
.nav-menu a[aria-current="true"] { color: var(--text); }
.nav-cta-item { margin-left: 10px; }

@media (hover: hover) and (pointer: fine) {
  .nav-menu a:not(.btn):hover { color: var(--text); }
}

.nav-toggle {
  display: none;
  position: relative;
  width: 44px; height: 44px;
  margin-right: -10px;
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle-lines,
.nav-toggle-lines::before,
.nav-toggle-lines::after {
  position: absolute;
  left: 50%;
  width: 20px; height: 1.5px;
  margin-left: -10px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 200ms var(--ease-out), opacity 150ms ease;
}
.nav-toggle-lines { top: 50%; }
.nav-toggle-lines::before,
.nav-toggle-lines::after { content: ""; left: 0; margin-left: 0; }
.nav-toggle-lines::before { transform: translateY(-6px); }
.nav-toggle-lines::after { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-lines { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-lines::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-lines::after { transform: rotate(-45deg); }

@media (max-width: 880px) {
  .nav-toggle { display: block; }
  .nav-menu {
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px var(--gutter) 20px;
    background: rgba(0, 0, 0, 0.97);
    border-bottom: 1px solid var(--line);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transform-origin: top center;
    transition:
      opacity 180ms var(--ease-out),
      transform 220ms var(--ease-out),
      visibility 0s linear 220ms;
  }
  .nav-menu[data-open="true"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition:
      opacity 180ms var(--ease-out),
      transform 220ms var(--ease-out),
      visibility 0s;
  }
  .nav-menu a:not(.btn) { display: block; padding: 12px 4px; font-size: 1.05rem; border-radius: 0; border-bottom: 1px solid var(--line); }
  .nav-cta-item { margin: 14px 0 0; }
  .nav-cta-item .btn { width: 100%; min-height: 48px; }
}

@media (max-width: 520px) {
  .brand-tagline { display: none; }
}

/* ---------- Inicio ---------- */
.hero {
  position: relative;
  margin-top: calc(var(--header-h) * -1);
  padding: calc(var(--header-h) + clamp(56px, 10vw, 120px)) 0 clamp(72px, 10vw, 128px);
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
}

.hero-title {
  font-size: clamp(2.35rem, 5.4vw, 4.1rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  max-width: 15ch;
}
.hero-title em { color: #fff; }

.hero-lead {
  margin-top: 24px;
  max-width: 54ch;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 1.4vw, 1.175rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

/* Logo original sin recortes ni filtros: el fondo de la página es el mismo negro de la imagen. */
.hero-logo {
  width: auto;
  height: min(72vh, 600px);
  max-width: 100%;
  object-fit: contain;
  /* La imagen trae su propio fondo negro. "lighten" hace que ese negro deje ver el cielo
     de la página; el monograma y la luna quedan intactos (la imagen no se modifica).
     La máscara suaviza además los bordes del rectángulo. */
  mix-blend-mode: lighten;
  /* Entrada única al cargar: emerge de un leve desenfoque, después del titular */
  animation: logo-in 1300ms var(--ease-out) 350ms both;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 66%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 66%, transparent 100%);
}

@keyframes logo-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes logo-in {
  from { opacity: 0; transform: scale(0.97); filter: blur(8px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { order: -1; margin: -24px 0 -8px; }
  .hero-logo { height: min(46vh, 380px); }
}

/* ---------- Secciones ---------- */
.section {
  padding: clamp(72px, 10vw, 128px) 0;
}
.section-alt {
  /* Velo casi transparente: separa la sección sin tapar el cielo */
  background: rgba(255, 255, 255, 0.014);
  border-block: 1px solid var(--line);
}

.section-head {
  max-width: 680px;
  margin-bottom: clamp(40px, 5vw, 64px);
}
.section-title {
  font-size: clamp(1.85rem, 3.4vw, 2.65rem);
  letter-spacing: -0.03em;
}
.section-lead {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 1.075rem;
}

/* ---------- Servicios ----------
   Dos servicios principales en tarjetas grandes, cuatro complementarios en un panel
   liviano y un cierre para quien no sabe cuál necesita. */
.card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px; height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--moon);
}
.card-icon svg,
.mini-icon svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svc-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.svc-card {
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 3.5vw, 44px);
  background:
    radial-gradient(80% 60% at 0% 0%, rgba(255, 255, 255, 0.04), transparent 70%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 200ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .svc-card:hover { border-color: var(--line-strong); }
}
.svc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.svc-head h3 { font-size: clamp(1.3rem, 2vw, 1.55rem); letter-spacing: -0.025em; }
.svc-card > p { color: var(--text-muted); font-size: 1.02rem; max-width: 46ch; }

/* Qué incluye cada servicio principal */
.svc-list {
  display: grid;
  gap: 9px;
  margin: 20px 0 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.93rem;
  line-height: 1.45;
}
.svc-list li { display: flex; gap: 12px; }
.svc-list li::before {
  content: "";
  flex: none;
  width: 10px;
  height: 1px;
  margin-top: 0.72em;
  background: var(--text-subtle);
}

/* Enlace al formulario con el servicio ya elegido */
.svc-link {
  margin-top: auto;
  align-self: flex-start;
  padding: 6px 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: text-decoration-color 200ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .svc-link:hover { text-decoration-color: var(--text); }
}

/* Servicios complementarios: un panel tenue que los agrupa */
.svc-more {
  margin-top: 16px;
  padding: 22px clamp(20px, 3vw, 32px) 18px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.svc-more-title {
  margin-bottom: 4px;
  color: var(--text-subtle);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0;
}
.svc-sub { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.svc-mini { display: flex; flex-direction: column; padding: 16px 24px 4px 0; }
.svc-mini + .svc-mini { padding-left: 24px; border-left: 1px solid var(--line); }
.svc-mini h3 {
  display: flex;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.svc-mini p { margin-bottom: 16px; color: var(--text-muted); font-size: 0.93rem; }
.mini-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 18px; height: 18px;
  margin: 2px 10px 0 0;
  color: var(--text-muted);
}
.mini-icon svg { width: 18px; height: 18px; stroke-width: 1.6; }

/* Cierre de la sección */
.svc-close {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  margin-top: 28px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.svc-close p { color: var(--text-muted); max-width: 56ch; }
.svc-close strong { color: var(--text); font-weight: 600; }

@media (max-width: 980px) {
  .svc-sub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .svc-mini:nth-child(3) { padding-left: 0; border-left: 0; }
  .svc-mini:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .svc-main, .svc-sub { grid-template-columns: 1fr; }
  .svc-more { padding: 18px 20px 10px; }
  .svc-mini, .svc-mini + .svc-mini { padding: 18px 0 6px; border-left: 0; }
  .svc-mini + .svc-mini { border-top: 1px solid var(--line); }
}
@media (max-width: 620px) {
  .svc-close .btn { width: 100%; }
}

/* ---------- Cómo trabajamos ----------
   Línea de tiempo: se dibuja a medida que se scrollea y cada paso "se enciende" al
   alcanzarlo. Después de "Soporte" sigue punteada: el acompañamiento continúa. */
.steps-wrap { position: relative; }
.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
}
.step {
  position: relative;
  padding: 30px 24px 0 0;
  border-top: 1px solid var(--line-strong);
}
/* Punto de cada paso: apagado hasta que la línea lo alcanza */
.step::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -4px; left: 0;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #2b2d33;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
  transition:
    background-color 300ms var(--ease-out),
    box-shadow 400ms var(--ease-out),
    transform 300ms var(--ease-out);
}
.step.is-on::before {
  background: var(--moon);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.07), 0 0 14px rgba(255, 255, 255, 0.55);
  transform: scale(1.15);
}
.step-title { font-size: 1.1rem; margin-bottom: 10px; letter-spacing: -0.01em; color: #cfd1d6; transition: color 300ms ease; }
.step.is-on .step-title { color: var(--text); }
.step p { color: var(--text-muted); font-size: 0.96rem; }

/* Tramo iluminado: el largo lo mide el JS (hasta el punto del último paso) */
.steps-fill {
  position: absolute;
  z-index: 1;
  top: 0; left: 0;
  width: 0; height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), #fff);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

/* Después del último paso, la línea sigue punteada y se desvanece */
.step:last-child { border-top-color: transparent; }
.step:last-child::after {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.4) 0 5px, transparent 5px 11px);
  -webkit-mask-image: linear-gradient(90deg, #000 30%, transparent);
  mask-image: linear-gradient(90deg, #000 30%, transparent);
}

/* Tablet y celular: recorrido vertical y continuo */
@media (max-width: 980px) {
  .steps { grid-template-columns: 1fr; }
  .step {
    max-width: 560px;
    padding: 0 0 36px 32px;
    border-top: 0;
    border-left: 1px solid var(--line-strong);
  }
  .step:last-child { padding-bottom: 0; border-left-color: transparent; }
  .step::before { top: 4px; left: -4px; }
  .step:last-child::after {
    top: 0; left: -1px; right: auto;
    width: 1px; height: calc(100% + 40px);
    background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0 5px, transparent 5px 11px);
    -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent);
    mask-image: linear-gradient(180deg, #000 30%, transparent);
  }
  .steps-fill {
    width: 1px; height: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), #fff);
    transform: scaleY(0);
    transform-origin: center top;
  }
}

/* ---------- Sobre nosotros ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: start;
}
.about-copy .section-title { margin-bottom: 26px; }
/* La idea central, dicha grande: es lo primero que se lee */
.about-copy .about-lead {
  max-width: 28ch;
  margin-bottom: 20px;
  color: var(--text);
  font-size: clamp(1.3rem, 2.1vw, 1.65rem);
  line-height: 1.35;
  letter-spacing: -0.018em;
}
.about-copy p { max-width: 52ch; color: var(--text-muted); }

/* Principios con ícono, en la misma familia visual que Servicios */
.principles { border-top: 1px solid var(--line); }
.principles li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.principles .card-icon { width: 42px; height: 42px; border-radius: 11px; }
.principles .card-icon svg { width: 20px; height: 20px; }
.principles h3 { margin: 2px 0 6px; font-size: 1.08rem; letter-spacing: -0.01em; }
.principles p { color: var(--text-muted); font-size: 0.96rem; }

@media (max-width: 880px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- Proyectos ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.project {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.project-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  margin: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(255,255,255,.018) 12px 24px);
  color: var(--text-subtle);
  font-size: 0.875rem;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-body { padding: 10px 24px 26px; }
.project-title { font-size: 1.1rem; margin: 12px 0 8px; }
.project p { color: var(--text-muted); font-size: 0.96rem; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-real { color: var(--text); border-color: rgba(255, 255, 255, 0.3); }

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}
.project-tags li {
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Invitación mientras hay pocos proyectos: sobria, sin caja vacía */
.project-more {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding: 28px clamp(28px, 4.5vw, 64px);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.project-more p { color: var(--text-muted); max-width: 52ch; }
.project-more strong { display: block; margin-bottom: 4px; color: var(--text); font-weight: 600; }
@media (max-width: 620px) {
  .project-more { padding: 24px 20px; }
  .project-more .btn { width: 100%; }
}

/* Proyecto destacado: ocupa toda la fila, con el iPad a la izquierda */
.project-featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(28px, 4.5vw, 64px);
  padding: clamp(28px, 4.5vw, 64px);
  /* Luz cenital suave: le da al iPad un "escenario" en lugar de un fondo plano */
  background:
    radial-gradient(90% 80% at 32% 0%, rgba(255, 255, 255, 0.055), transparent 62%),
    var(--surface);
}
.project-featured .project-body { padding: 0; }
.project-featured .project-title { font-size: clamp(1.35rem, 2.2vw, 1.75rem); margin: 14px 0 12px; }
.project-featured .project-body p + p { margin-top: 12px; }

.project-media {
  position: relative;
  isolation: isolate;
  padding: 2% 1% 4%;
}
/* Halo detrás del equipo: separa el borde oscuro del fondo oscuro */
.project-media::before {
  content: "";
  position: absolute;
  inset: 4% 8% 10%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.08), transparent);
  filter: blur(24px);
}

/* ===== iPad en horizontal (CSS puro) =====
   Todo se mide en % del ancho del propio iPad (unidades cqw), así las proporciones
   se mantienen idénticas en cualquier tamaño de pantalla. */
.device {
  container-type: inline-size;
  transform-origin: 50% 50%;
}
.device * { box-sizing: border-box; }

.device-frame {
  --rim: max(1.5px, 0.36cqw);   /* canto de aluminio */
  --bezel: 2.25cqw;              /* borde negro de vidrio */
  --radius: 4.4cqw;              /* radio exterior */
  position: relative;
  padding: var(--rim);
  border-radius: var(--radius);
  /* Aluminio gris espacial: brillo en las esquinas, más oscuro en los lados */
  background: linear-gradient(135deg, #7a7c81 0%, #34353a 14%, #1d1e21 50%, #2e2f33 86%, #66686d 100%);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.45),
    0 0 0 0.5px rgba(0, 0, 0, 0.9),
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 22px 44px -14px rgba(0, 0, 0, 0.75),
    0 60px 110px -30px rgba(0, 0, 0, 0.7);
}
/* Botones de volumen sobre el canto superior */
.device-frame::before {
  content: "";
  position: absolute;
  top: -0.32cqw;
  right: 13cqw;
  z-index: -1;
  width: 4.6cqw;
  height: 0.7cqw;
  border-radius: 0.4cqw 0.4cqw 0 0;
  background: linear-gradient(180deg, #5a5c61, #2a2b2e);
  box-shadow: -5.6cqw 0 0 0 #34363a;
}

.device-bezel {
  position: relative;
  padding: var(--bezel);
  /* Radio concéntrico: exterior menos el grosor del canto */
  border-radius: calc(var(--radius) - var(--rim));
  background: #040405;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.045);
}
/* Cámara frontal centrada en el borde superior */
.device-bezel::before {
  content: "";
  position: absolute;
  top: calc((var(--bezel) - 0.62cqw) / 2);
  left: 50%;
  width: 0.62cqw;
  height: 0.62cqw;
  min-width: 3px;
  min-height: 3px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #4a5468 0%, #141821 45%, #07080a 75%);
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.06);
}

.device-screen {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  /* Radio concéntrico: exterior menos canto menos borde */
  border-radius: calc(var(--radius) - var(--rim) - var(--bezel));
  background: #000;
  transform: translateZ(0); /* recorte prolijo de esquinas en Safari */
}
/* La captura es más ancha que la pantalla: se centra y se recortan solo los márgenes laterales vacíos */
.device-screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
}
/* Borde interno del panel: la pantalla queda "dentro" del vidrio, no pegada encima */
.device-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 0 1.2cqw rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
/* Reflejo del vidrio: diagonal y muy tenue; se desplaza apenas al inclinar el iPad */
.device-glare {
  position: absolute;
  inset: -30%;
  background: linear-gradient(118deg,
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.085) 42%,
    rgba(255, 255, 255, 0.02) 52%,
    rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
}

/* ===== Variante vertical =====
   Las medidas se escalan ×4/3 porque ahora el ancho es el lado corto del iPad:
   así el canto, el borde y las esquinas tienen el mismo tamaño físico que en horizontal. */
.device--portrait {
  width: min(100%, 440px);
  margin-inline: auto;
}
.device--portrait .device-frame {
  --rim: max(1.5px, 0.48cqw);
  --bezel: 3cqw;
  --radius: 5.9cqw;
}
.device--portrait .device-screen { aspect-ratio: 3 / 4; }
.device--portrait .device-screen img { object-position: 50% 0; }
/* En los iPad actuales la cámara está en el lado largo: en vertical queda a la izquierda */
.device--portrait .device-bezel::before {
  top: 50%;
  left: calc((var(--bezel) - 0.82cqw) / 2);
  width: 0.82cqw;
  height: 0.82cqw;
  transform: translateY(-50%);
}
/* Botón superior en el canto de arriba y volumen en el lateral derecho */
.device--portrait .device-frame::before {
  top: -0.42cqw;
  right: 16cqw;
  width: 9cqw;
  height: 0.9cqw;
  border-radius: 0.5cqw 0.5cqw 0 0;
  box-shadow: none;
}
.device--portrait .device-frame::after {
  content: "";
  position: absolute;
  top: 14cqw;
  right: -0.42cqw;
  z-index: -1;
  width: 0.9cqw;
  height: 7cqw;
  border-radius: 0 0.5cqw 0.5cqw 0;
  background: linear-gradient(90deg, #2a2b2e, #5a5c61);
  box-shadow: 0 9cqw 0 0 #34363a;
}

/* Con el iPad vertical, la columna del equipo es más angosta */
@media (min-width: 881px) {
  .project-featured:has(.device--portrait) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  }
}

/* Encendido de pantalla: la captura aparece con un leve zoom, una sola vez, al entrar en vista */
.js .project-featured .device-screen picture {
  display: block;
  height: 100%;
  opacity: 0;
  transform: scale(1.035);
  transition:
    opacity 700ms var(--ease-out) 250ms,
    transform 1100ms var(--ease-out) 250ms;
}
.js .project-featured.is-visible .device-screen picture {
  opacity: 1;
  transform: none;
}

@media (max-width: 880px) {
  .project-featured { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .project-featured { padding: 20px 16px 28px; }
  .project-featured .project-body { padding: 0 8px; }
  .project-media { padding: 4px 0 8px; }
}

@media (max-width: 620px) { .projects { grid-template-columns: 1fr; } }

/* ---------- Contacto ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: start;
}
/* Alternativa por WhatsApp: una sola vez, explicada (los datos de contacto están en el pie) */
.contact-alt { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.contact-alt p { margin-bottom: 14px; color: var(--text-muted); font-size: 0.95rem; }

.contact-card {
  padding: clamp(24px, 3.5vw, 36px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
}
.contact-form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field label { font-size: 0.925rem; font-weight: 500; }
.optional { color: var(--text-subtle); font-weight: 400; }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  /* Un tono sobre la tarjeta, en lugar de "agujeros" negros */
  background-color: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  font-size: 1rem; /* 16px evita el zoom automático en iOS */
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.field textarea { resize: vertical; min-height: 132px; line-height: 1.5; }
.field input::placeholder,
.field textarea::placeholder { color: #6f7279; }
@media (hover: hover) and (pointer: fine) {
  .field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(255, 255, 255, 0.22); }
}
.field select {
  appearance: none;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
/* La lista desplegable la dibuja el sistema: se le indica que es tema oscuro
   y se le dan los mismos colores que el resto del formulario. */
.field input, .field select, .field textarea { color-scheme: dark; }
.field select option {
  background-color: #1a1a1c;
  color: var(--text);
}
.field select option:checked { background-color: #2a2a2e; }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}
.field [aria-invalid="true"] { border-color: var(--error); }
/* Al llegar desde "Consultar por este servicio", el selector se ilumina un instante
   para mostrar qué se completó solo, y se apaga despacio */
.field select { transition: border-color 900ms ease, box-shadow 900ms ease; }
.field select.is-prefilled {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
  transition: none;
}
.field-error { color: var(--error); font-size: 0.85rem; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 4px; }
.form-note { color: var(--text-subtle); font-size: 0.85rem; }
.form-send { min-width: 190px; }
.form-send-label { transition: opacity 200ms ease, filter 200ms ease; }
.form-send[data-state="sending"] { cursor: progress; }
.form-send[data-state="sending"] .form-send-label { opacity: 0.7; filter: blur(0.6px); }

/* Confirmación: reemplaza al formulario con un fundido corto */
.form-done { display: none; padding: clamp(8px, 2vw, 20px) 0; }
.form-done svg { width: 40px; height: 40px; margin-bottom: 18px; fill: none; stroke: var(--moon); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.form-done h3 { margin-bottom: 8px; font-size: 1.35rem; letter-spacing: -0.02em; }
.form-done p { max-width: 44ch; color: var(--text-muted); }
.form-done strong { color: var(--text); }
.form-again {
  margin-top: 22px; padding: 6px 0;
  border: 0; background: none; color: var(--text);
  font-size: 0.92rem; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 5px;
}
.contact-card.is-done .contact-form { display: none; }
.contact-card.is-done .form-done { display: block; animation: done-in 320ms var(--ease-out) both; }
@keyframes done-in { from { opacity: 0; transform: translateY(6px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) { .contact-card.is-done .form-done { animation: none; } }
.form-status:empty { display: none; }
.form-status { min-height: 1.5em; color: var(--text-muted); font-size: 0.925rem; }
.form-status[data-state="error"] { color: var(--error); }
.form-status[data-state="ok"] { color: var(--success); }

@media (max-width: 880px) { .contact-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  .form-actions .btn, .contact-alt .btn-whatsapp { width: 100%; }
}

/* ---------- Pie de página ----------
   Una firma: monograma, contacto en una línea y "Volver arriba". */
.site-footer {
  padding: 44px 0 28px;
  background: rgba(255, 255, 255, 0.014);
  border-top: 1px solid var(--line);
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px 40px;
}
.footer-sign { display: flex; align-items: center; gap: 16px; text-decoration: none; }
.footer-sign img { width: auto; height: 44px; }
.footer-sign span { color: var(--text-muted); font-size: 0.95rem; }

.footer-contact { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.footer-contact a,
.footer-contact li > span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 200ms ease;
}
.footer-contact svg,
.footer-top svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.footer-contact svg { width: 16px; height: 16px; stroke-width: 1.6; opacity: 0.8; }

.footer-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--text-subtle);
  font-size: 0.875rem;
}
.footer-top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  color: var(--text-subtle);
  text-decoration: none;
  transition: color 200ms ease;
}
.footer-top svg { width: 14px; height: 14px; stroke-width: 1.8; transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .footer-contact a:hover, .footer-top:hover { color: var(--text); }
  .footer-top:hover svg { transform: translateY(-2px); }
}

@media (max-width: 620px) {
  .site-footer { padding: 36px 0 96px; } /* espacio para el botón flotante de WhatsApp */
  .footer-contact { flex-direction: column; gap: 12px; }
}

/* ---------- Botón flotante de WhatsApp ---------- */
.wa-float {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--wa);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
  transition:
    opacity 200ms var(--ease-out),
    transform 200ms var(--ease-out),
    background-color 200ms ease,
    visibility 0s;
}
.wa-float svg { width: 26px; height: 26px; }
.wa-float:active { transform: scale(0.95); }
/* Se oculta mientras se ve el inicio (ya hay un botón de WhatsApp ahí) */
.wa-float[data-hidden="true"] {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9) translateY(8px);
  pointer-events: none;
  transition:
    opacity 150ms ease,
    transform 150ms ease,
    visibility 0s linear 150ms;
}
@media (hover: hover) and (pointer: fine) { .wa-float:hover { background: var(--wa-hover); } }

/* ---------- Aparición al hacer scroll (solo con JS activo) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 600ms var(--ease-out),
    transform 700ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 60ms);
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { transform: none; transition: opacity 300ms ease; transition-delay: 0ms; }
  .btn:active, .wa-float:active { transform: none; }
  .nav-menu, .nav-menu[data-open="true"], .wa-float, .wa-float[data-hidden="true"] { transform: none; }
  .js .project-featured .device-screen picture { transform: none; transition: opacity 400ms ease; }
  .hero-logo { animation: logo-fade 600ms ease 200ms both; }
}
