/* Asterx Studios — estilos */

:root {
  --bg: #1b1b1b;
  --white: #ffffff;
  --gray: #8c8c8c;
  --edge: #ffffff;
  --trace: #ffffff;
  --radius: 12px;
  --gutter: 16px;
  --pad-l: max(var(--gutter), env(safe-area-inset-left));
  --pad-r: max(var(--gutter), env(safe-area-inset-right));
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
img, svg, canvas { display: block; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 4px;
}

/* ---------- Hero ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(20px, 5vh, 64px) var(--pad-r) 0 var(--pad-l);
}

/* --wm: ancho del wordmark; el resto del lockup se deriva de él
   con las proporciones de 03_Lockup. */
.brand {
  --wm: clamp(132px, 22vh, 168px);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.iso {
  position: relative;
  width: min(100%, 560px);
  height: calc(var(--wm) * 1.45);
}

.iso-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.iso-static {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 53.8%;
  aspect-ratio: 139 / 123;
  transform: translate(-50%, -50%);
}

.js .iso-static { display: none; }
.js.no-canvas .iso-static { display: block; }

.wordmark {
  position: relative; /* queda sobre el borde inferior del canvas */
  width: var(--wm);
  height: auto;
  /* separación isotipo–wordmark ≈ 0.29 × ancho del wordmark */
  margin-top: calc(var(--wm) * -.045);
}

.studios {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.studios-rule {
  width: calc(var(--wm) * .72);
  height: 1px;
  margin-top: calc(var(--wm) * .105);
  background: var(--white);
}

.studios-text {
  margin-top: calc(var(--wm) * .105);
  /* el espaciado final de la última letra se compensa a la izquierda */
  padding-left: .3em;
  font-size: calc(var(--wm) * .105);
  line-height: 1;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gray);
}

.hero h1 {
  margin-top: clamp(36px, 6vh, 56px);
  max-width: 20ch;
  font-size: clamp(1.625rem, 1.15rem + 1.9vw, 2.5rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.015em;
  text-wrap: balance;
}

.tagline {
  margin-top: 14px;
  max-width: 34ch;
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.55;
  color: var(--gray);
}
/* corta entre oraciones, nunca a mitad de una */
.tagline span { display: inline-block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 32px;
  padding: 12px 30px;
  border: 1px solid var(--white);
  border-radius: 999px;
  font-size: 1rem;
  letter-spacing: .02em;
  text-decoration: none;
  color: var(--white);
  background: transparent;
  transition: background-color .2s ease, color .2s ease;
}

/* hover solo con puntero real: en pantallas táctiles quedaba "pegado" */
@media (hover: hover) {
  .btn:hover { background: var(--white); color: var(--bg); }
  .contact-links a:hover { color: var(--white); }
}
.btn:active { background: #d9d9d9; color: var(--bg); }

/* ---------- Flujo central (servicios) ---------- */

.flow {
  position: relative;
  display: block;
  padding: clamp(80px, 12vh, 128px) var(--pad-r) clamp(96px, 14vh, 144px) var(--pad-l);
}

/* Pista de circuito: baja desde el botón hasta el contacto */
.trace {
  position: absolute;
  left: 50%;
  top: 28px;
  bottom: 0;
  width: 1px;
  margin-left: -.5px;
  /* nace suave bajo el botón */
  background: linear-gradient(to bottom, transparent, var(--trace) 56px);
}

/* Punta difuminada mientras la pista se va dibujando (solo con JS) */
.trace-tip {
  display: none;
  position: absolute;
  left: 50%;
  top: 28px;
  width: 1px;
  height: 180px;
  margin-left: -.5px;
  background: linear-gradient(to bottom, var(--trace), transparent);
  transform-origin: 50% 0;
  opacity: 0;
  transition: opacity .45s ease;
  pointer-events: none;
}
.js .trace-tip { display: block; }

.cards {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 960px;
  margin: 0 auto;
}

.card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 16px;
  width: 80%;
  max-width: 460px;
  padding: 22px 20px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--bg);
}

/* teléfono en horizontal / tablet chica: el título cabe en una línea */
@media (min-width: 560px) {
  .hero h1, .tagline { max-width: none; }
}

/* teléfonos muy angostos: un poco más de ancho para el texto */
@media (max-width: 359px) {
  .card { width: 90%; padding: 20px 16px; column-gap: 12px; }
}

/* Escalones: las impares a la izquierda, las pares a la derecha.
   El ícono siempre mira al centro de la página. */
.card:nth-child(even) {
  margin-left: auto;
  grid-template-columns: auto 1fr;
}
.card:nth-child(even) .card-icon { order: -1; }

.card h3 {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -.005em;
}

.card p {
  margin-top: 6px;
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--gray);
  text-wrap: pretty;
}

.card-icon {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--white);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Borde dibujable (solo con JS): dos trazos que parten del lado interior */
.card-edge {
  display: none;
  position: absolute;
  top: -1px;
  left: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  overflow: visible;
  pointer-events: none;
}
.card-edge path {
  --len: 9999px;
  fill: none;
  stroke: var(--edge);
  stroke-width: 1;
  stroke-dasharray: var(--len) var(--len);
  stroke-dashoffset: var(--len);
}
.js .card-edge { display: block; }
.js .card { border-color: transparent; }

/* Conector horizontal hacia la pista (solo escritorio) */
.card-link { display: none; }

/* ---------- Rótulos de sección: se apoyan sobre la pista ---------- */

.label {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0 0 36px;
  font-size: .8125rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gray);
}
.label span {
  padding: 10px 14px 10px calc(14px + .3em);
  background: var(--bg);
}

.focus,
.process { margin-top: clamp(96px, 14vh, 144px); }

.focus-list,
.steps {
  margin: 0 auto;
  padding: 0;
  max-width: 960px;
  list-style: none;
}

.focus-list h3,
.step h3 {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.3;
}

.focus-list p,
.step p {
  margin-top: 4px;
  font-size: .9375rem;
  color: var(--gray);
  text-wrap: balance;
}

/* Enfoque: cuatro ideas sobre la pista */
.focus-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}
.focus-list li {
  position: relative; /* tapa la pista */
  width: min(100%, 320px);
  padding: 12px 16px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* en móvil el ícono va arriba del título */
.focus-icon {
  order: -1;
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  fill: none;
  stroke: var(--white);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Cómo trabajamos: pasos numerados; el número es un nodo de la pista */
.steps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  text-align: center;
}
.step {
  position: relative;
  width: min(100%, 320px);
  padding: 12px 16px;
  background: var(--bg);
}
.step-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border: 1px solid var(--white);
  border-radius: 50%;
  background: var(--bg);
  font-size: .75rem;
  line-height: 1;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}
.step-link { display: none; }

/* ---------- Contacto ---------- */

.contact {
  position: relative;
  padding: 22px var(--pad-r) max(40px, env(safe-area-inset-bottom)) var(--pad-l);
  text-align: center;
}

/* terminal de la pista */
.contact::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--trace);
}

.contact-links {
  display: flex;
  flex-wrap: wrap; /* 5 íconos: en pantallas mínimas pasan a una segunda fila */
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-links a {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--gray);
  transition: color .2s ease;
}
.contact-links a:focus-visible { color: var(--white); outline-offset: 2px; }

.contact-links svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-title {
  margin: 22px auto 14px;
  font-size: clamp(1.125rem, 1rem + .5vw, 1.375rem);
  font-weight: 500;
  line-height: 1.3;
  text-wrap: balance;
}

.copy {
  margin-top: 18px;
  font-size: .8125rem;
  color: var(--gray);
}

/* ---------- Opciones de correo ---------- */

.mail-dialog {
  width: min(calc(100% - 32px), 380px);
  max-width: none;
  padding: 0;
  border: 1px solid var(--white);
  border-radius: 16px;
  background: var(--bg);
  color: var(--white);
}
/* Fondo desenfocado. El radio del blur es fijo (solo se anima la opacidad),
   así el filtro se calcula una vez y no en cada fotograma. */
.mail-dialog::backdrop {
  background: rgba(12, 12, 12, .45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
/* sin soporte de backdrop-filter: fondo más oscuro para mantener el foco */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mail-dialog::backdrop { background: rgba(0, 0, 0, .78); }
}
.mail-dialog[open] { animation: mail-in .28s var(--ease-out); }
.mail-dialog[open]::backdrop { animation: backdrop-in .28s ease; }
@keyframes backdrop-in {
  from { opacity: 0; }
}

/* scroll bloqueado mientras el cuadro está abierto; el JS compensa el ancho
   de la barra de scroll para que el contenido no se mueva */
html.is-modal-open { overflow: hidden; }
@keyframes mail-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
}

.mail-box {
  position: relative;
  padding: 28px 24px 24px;
}

.mail-title {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.3;
}

.mail-address {
  margin-top: 4px;
  font-size: .9375rem;
  color: var(--gray);
  overflow-wrap: anywhere;
}

.mail-options {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.mail-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  background: transparent;
  color: var(--white);
  font: inherit;
  font-size: .9375rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s ease;
}
.mail-option span { flex: 1; }
.mail-option:focus-visible { outline-offset: 2px; }
@media (hover: hover) {
  .mail-option:hover { border-color: var(--white); }
}

.mail-ico,
.mail-ext,
.mail-close svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mail-ico { width: 20px; height: 20px; }
.mail-ext { width: 16px; height: 16px; color: var(--gray); }

.ico-check { display: none; }
.is-copied .ico-copy { display: none; }
.is-copied .ico-check { display: block; }

.mail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gray);
  cursor: pointer;
}
.mail-close svg { width: 20px; height: 20px; }
@media (hover: hover) {
  .mail-close:hover { color: var(--white); }
}

/* ---------- Escritorio ---------- */

@media (min-width: 768px) {
  :root { --gutter: 32px; }

  .flow { --col-gap: clamp(72px, 10vw, 128px); }

  .brand { --wm: clamp(150px, 26vh, 210px); }
  .hero h1 { max-width: none; }
  .tagline { max-width: none; }

  .cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(76px, auto);
    column-gap: var(--col-gap);
    row-gap: 40px;
  }

  /* Cada tarjeta ocupa dos filas; la columna derecha empieza una fila
     más abajo, así ninguna tarjeta queda a la altura de otra. */
  .card,
  .card:nth-child(even) { width: auto; max-width: none; margin: 0; padding: 28px; column-gap: 20px; }
  .card:nth-child(1) { grid-area: 1 / 1 / span 2 / auto; }
  .card:nth-child(2) { grid-area: 2 / 2 / span 2 / auto; }
  .card:nth-child(3) { grid-area: 3 / 1 / span 2 / auto; }
  .card:nth-child(4) { grid-area: 4 / 2 / span 2 / auto; }

  .card h3 { font-size: 1.25rem; }
  .card p { font-size: 1rem; }
  .card-icon { width: 34px; height: 34px; }

  .focus-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    column-gap: var(--col-gap);
    row-gap: 40px;
  }
  .focus-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    column-gap: 18px;
    width: auto;
    padding: 0;
    background: none;
  }
  /* el ícono mira a la pista, igual que en las tarjetas */
  .focus-list li:nth-child(odd) { text-align: right; }
  .focus-list li:nth-child(odd) .focus-icon { order: 0; }
  .focus-list li:nth-child(even) { grid-template-columns: auto 1fr; text-align: left; }
  .focus-icon { margin: 0; width: 30px; height: 30px; }
  .focus-list h3 { font-size: 1.25rem; }
  .focus-list p { font-size: 1rem; }

  .steps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(56px, auto);
    column-gap: var(--col-gap);
    row-gap: 32px;
    text-align: left;
  }
  .step {
    width: auto;
    padding: 0;
    background: none;
  }
  .step:nth-child(1) { grid-area: 1 / 1 / span 2 / auto; }
  .step:nth-child(2) { grid-area: 2 / 2 / span 2 / auto; }
  .step:nth-child(3) { grid-area: 3 / 1 / span 2 / auto; }
  .step:nth-child(4) { grid-area: 4 / 2 / span 2 / auto; }
  .step:nth-child(odd) { text-align: right; }
  .step h3 { padding-top: 6px; font-size: 1.25rem; }
  .step p { font-size: 1rem; }

  /* el número se centra sobre la pista */
  .step-num {
    position: absolute;
    top: 0;
    right: calc(var(--col-gap) / -2 - 18px);
    margin: 0;
  }
  .step:nth-child(even) .step-num { right: auto; left: calc(var(--col-gap) / -2 - 18px); }

  .step-link {
    display: block;
    position: absolute;
    top: 18px;
    left: calc(100% + 12px);
    width: calc(var(--col-gap) / 2 - 30px);
    height: 1px;
    background: var(--trace);
    transform-origin: 100% 50%;
  }
  .step:nth-child(even) .step-link { left: auto; right: calc(100% + 12px); transform-origin: 0 50%; }

  .card-link {
    display: block;
    position: absolute;
    top: 50%;
    left: calc(100% + 1px);
    width: calc(var(--col-gap) / 2 - 1px);
    height: 1px;
  }
  .card:nth-child(even) .card-link { left: auto; right: calc(100% + 1px); }

  .card-link::before,
  .card-link::after {
    content: "";
    position: absolute;
    background: var(--trace);
  }
  .card-link::before { top: 0; left: 0; width: 100%; height: 100%; transform-origin: 100% 50%; }
  .card:nth-child(even) .card-link::before { transform-origin: 0 50%; }
  /* nodo sobre la pista */
  .card-link::after {
    top: -2.5px;
    right: -3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
  }
  .card:nth-child(even) .card-link::after { right: auto; left: -3px; }
}

/* ---------- Pantallas grandes (2K / 4K) ---------- */

@media (min-width: 1800px) and (min-height: 900px) {
  html { font-size: 112.5%; }
  .brand { --wm: clamp(150px, 24vh, 250px); }
  .iso { width: min(100%, 640px); }
  .flow { --col-gap: 144px; }
  .cards, .focus-list, .steps { max-width: 1100px; }
}

@media (min-width: 2400px) and (min-height: 1200px) {
  html { font-size: 131.25%; }
  .brand { --wm: clamp(150px, 24vh, 300px); }
  .iso { width: min(100%, 760px); }
  .flow { --col-gap: 176px; }
  .cards, .focus-list, .steps { max-width: 1320px; }
}

/* 4K sin escalado del sistema */
@media (min-width: 3200px) and (min-height: 1700px) {
  html { font-size: 162.5%; }
  .brand { --wm: clamp(150px, 22vh, 380px); }
  .iso { width: min(100%, 960px); }
  .flow { --col-gap: 220px; }
  .cards, .focus-list, .steps { max-width: 1680px; }
}

/* ---------- Estados animados (solo con JS) ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(12px);
}
.js .btn.reveal {
  transition:
    opacity .45s ease calc(var(--i) * 100ms),
    transform .55s var(--ease-out) calc(var(--i) * 100ms),
    background-color .2s ease,
    color .2s ease;
}
.js .hero .reveal:not(.btn) {
  transition:
    opacity .45s ease calc(var(--i) * 100ms),
    transform .55s var(--ease-out) calc(var(--i) * 100ms);
}
.js .hero.is-ready .reveal {
  opacity: 1;
  transform: none;
}

/* Visita repetida en la misma sesión: fade rápido del logo armado */
.js.intro-quick .iso-canvas { opacity: 0; transition: opacity .35s ease; }
.js.intro-quick .hero.is-ready .iso-canvas { opacity: 1; }
.js.intro-quick .hero .reveal:not(.btn),
.js.intro-quick .btn.reveal {
  transform: none;
  transition: opacity .35s ease, background-color .2s ease, color .2s ease;
}

/* Tarjetas: conector → borde → ícono → texto */
.js .card-link::before { transform: scaleX(0); transition: transform .3s var(--ease-out); }
.js .card-link::after { opacity: 0; transition: opacity .2s ease; }
/* La transición vive solo en el estado final: así el ajuste inicial del
   largo del borde (que hace el JS al medir) es instantáneo y no parpadea. */
.js .card-icon {
  opacity: 0;
  transform: scale(.6) rotate(-30deg);
  transition: opacity .35s ease .6s, transform .55s cubic-bezier(.34, 1.56, .64, 1) .6s;
}
.js .card:nth-child(even) .card-icon { transform: scale(.6) rotate(30deg); }
.js .card-text { opacity: 0; transition: opacity .5s ease .85s; }

.js .card.is-in .card-link::before { transform: none; }
.js .card.is-in .card-link::after { opacity: 1; }
.js .card.is-in .card-edge path { stroke-dashoffset: 0; transition: stroke-dashoffset .7s var(--ease-in-out) .15s; }
.js .card.is-in .card-icon { opacity: 1; transform: none; }
.js .card.is-in .card-text { opacity: 1; }

.js .fx {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s ease, transform .7s var(--ease-out);
}
.js .step.fx { transform: none; }
.js .step .step-link { transform: scaleX(0); transition: transform .45s var(--ease-out) .25s; }
.js .focus-icon {
  opacity: 0;
  transform: scale(.6) rotate(-30deg);
  transition: opacity .35s ease .25s, transform .55s cubic-bezier(.34, 1.56, .64, 1) .25s;
}
.js .fx.is-in { opacity: 1; transform: none; }
.js .fx.is-in .focus-icon { opacity: 1; transform: none; }
.js .step.is-in .step-link { transform: none; }

.js .contact { opacity: 0; transition: opacity .8s ease; }
.js .contact.is-in { opacity: 1; }

.js .trace { -webkit-clip-path: inset(0 0 100% 0); clip-path: inset(0 0 100% 0); }

/* ---------- Movimiento reducido: todo armado de inmediato ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after,
  .mail-dialog::backdrop {
    transition: none !important;
    animation: none !important;
  }
  .js .fx,
  .js .focus-icon,
  .js .step .step-link,
  .js .reveal,
  .js .card-icon,
  .js .card-text,
  .js .contact,
  .js .card-link::after { opacity: 1; transform: none; }
  .js .card-link::before { transform: none; }
  .js .trace { -webkit-clip-path: none; clip-path: none; }
  .js .trace-tip { display: none; }
  .js .card-edge path { stroke-dashoffset: 0; }
}

/* ---------- Impresión: todo visible ---------- */

@media print {
  .js .reveal, .js .fx, .js .card-icon, .js .card-text, .js .focus-icon,
  .js .contact, .js .card-link::after { opacity: 1 !important; transform: none !important; }
  .js .card-link::before, .js .step .step-link { transform: none !important; }
  .js .trace { -webkit-clip-path: none !important; clip-path: none !important; }
  .js .trace-tip { display: none !important; }
  .js .card-edge path { stroke-dashoffset: 0 !important; }
}
