/* =========================================================================
   Estudio Valiant — capa de detalles
   Las cosas pequeñas: guiones que se extienden, líneas que se dibujan,
   el reloj del estudio, el contador del formulario, el aviso de copiado
   y el indicador de sección del carril.

   Ninguna es imprescindible: sin JavaScript el sitio queda como antes.
   ========================================================================= */

/* ====================== El guion de los antetítulos ======================
   Cada «Servicios», «Proceso», «Proyectos»… estrena una rayita que se
   extiende cuando el bloque entra en pantalla. */

.has-js .eyebrow::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 1px;
  margin-right: 0;
  vertical-align: middle;
  background: currentColor;
  transition: width 0.9s var(--ease-out-expo) 0.15s, margin-right 0.9s var(--ease-out-expo) 0.15s;
}

.has-js .eyebrow.is-drawn::before {
  width: 1.5rem;
  margin-right: 0.7rem;
}

/* ====================== Las líneas de sección se dibujan ======================
   El filete que separa las secciones ya no aparece de golpe: se traza de
   izquierda a derecha al llegar. */

.has-js .section--bordered {
  border-top-color: transparent;
}

.has-js .section--bordered::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line-soft);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 1.3s var(--ease-out-expo);
}

.has-js .section--bordered.is-lined::before {
  transform: scaleX(1);
}

/* ====================== Las listas de ventajas entran en fila ====================== */

.has-js .tick-list li {
  opacity: 0;
  transform: translate3d(-0.6rem, 0, 0);
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
  transition-delay: calc(var(--i, 0) * 0.07s);
}

.has-js .tick-list.is-in li {
  opacity: 1;
  transform: none;
}

.tick-list li::before {
  transition: transform 0.4s var(--ease-out-expo), background-color 0.3s;
}

.tick-list li:hover::before {
  transform: rotate(45deg) scale(1.6);
}

/* ====================== Indicador de sección en el carril ======================
   Texto vertical que va cantando en qué parte de la página estás. */

.railsection {
  display: none;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--accent);
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  opacity: 0;
  transition: opacity 0.35s;
}

.railsection.is-on {
  opacity: 1;
}

@media (min-width: 768px) {
  .railsection {
    display: block;
    max-height: 12rem;
    overflow: hidden;
  }
}

/* ====================== Reloj del estudio, en el pie ====================== */

.clock {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.clock__dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 0.5rem;
  vertical-align: middle;
  border-radius: 999px;
  background: var(--accent);
  animation: clock-beat 2s ease-in-out infinite;
}

@keyframes clock-beat {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

/* ====================== Copiar el correo ====================== */

.copybtn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.75rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  cursor: pointer;
  vertical-align: middle;
  opacity: 0;
  transform: translate3d(-0.35rem, 0, 0);
  transition: opacity 0.3s, transform 0.3s var(--ease-out-expo), color 0.25s, border-color 0.25s;
}

/* Aparece al acercarse al bloque del correo, y siempre con el teclado */
li:hover > .copybtn,
p:hover > .copybtn,
div:hover > .copybtn,
.copybtn:focus-visible {
  opacity: 1;
  transform: none;
}

.copybtn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Sin ratón no hay hover: se deja siempre visible, y con altura de dedo */
@media (hover: none), (max-width: 47.9375em) {
  .copybtn {
    min-height: 44px;
    padding-inline: 0.85rem;
    opacity: 1;
    transform: none;
  }
}

.toast {
  position: fixed;
  left: 50%;
  /* En movil la barra inferior de navegacion ocupa la parte de abajo: el
     aviso tiene que quedar por encima de ella, no detras. */
  bottom: 5rem;
  z-index: 1350;
  padding: 0.65rem 1.1rem;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50%, 1rem, 0);
  transition: opacity 0.4s var(--ease-out-expo), transform 0.4s var(--ease-out-expo);
}

.toast.is-on {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

@media (min-width: 768px) {
  .toast {
    bottom: 2rem;
  }
}

/* ====================== Detalles del formulario ====================== */

.field {
  position: relative;
}

.field label {
  transition: color 0.25s;
}

.field.is-focus label,
.field.is-filled label {
  color: var(--accent);
}

/* La línea del campo se dibuja desde la izquierda al enfocar */
.field input,
.field select,
.field textarea {
  position: relative;
  z-index: 1;
  background: transparent;
}

.field::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.5s var(--ease-out-expo);
}

.field.is-focus::after {
  transform: scaleX(1);
}

.field__count {
  position: absolute;
  right: 0;
  bottom: -1.35rem;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.3s, color 0.3s;
}

.field.is-focus .field__count,
.field.is-filled .field__count {
  opacity: 1;
}

.field__count.is-near {
  color: var(--accent);
}

/* ====================== El cursor respira cuando no te mueves ====================== */

.cursor.is-idle .cursor__ring-in {
  animation: cursor-breathe 2.4s ease-in-out infinite;
}

@keyframes cursor-breathe {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.22);
  }
}

/* ====================== Si se pide reducir el movimiento ====================== */

@media (prefers-reduced-motion: reduce) {
  .has-js .eyebrow::before {
    width: 1.5rem;
    margin-right: 0.7rem;
  }

  .has-js .section--bordered::before {
    transform: scaleX(1);
  }

  .has-js .tick-list li {
    opacity: 1;
    transform: none;
  }

  .clock__dot,
  .cursor.is-idle .cursor__ring-in {
    animation: none;
  }
}

/* ====================== Onda al hacer clic ======================
   En cualquier punto de la página, no solo en los botones. */

.ripple {
  position: fixed;
  z-index: 1290;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  pointer-events: none;
  animation: ripple 0.8s var(--ease-out-expo) forwards;
}

@keyframes ripple {
  from {
    transform: scale(1);
    opacity: 0.7;
  }
  to {
    transform: scale(14);
    opacity: 0;
  }
}

/* ====================== Titulares que siguen al ratón ======================
   Cada palabra del titular se inclina hacia el cursor. Se mueve la palabra
   entera, no letra a letra, para no tocar el interletrado de Bebas. */

.kin.is-in .kin__word {
  transition: transform 0.4s var(--ease-out-expo);
}

/* ====================== Rejillas elásticas ======================
   Al soltar la rueda, las rejillas se enderezan con un punto de retardo. */

.projects,
.features,
.techs,
.services {
  will-change: transform;
}

/* ====================== Número fantasma de las tarjetas ====================== */

.ghostnum {
  position: absolute;
  right: -0.06em;
  bottom: -0.22em;
  z-index: 0;
  font-family: var(--font-display);
  font-size: clamp(9rem, 18vw, 16rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--line);
  pointer-events: none;
  user-select: none;
  transform: translate3d(0, 0, 0);
  transition: transform 0.8s var(--ease-out-expo), -webkit-text-stroke-color 0.5s;
}

.service-card:hover .ghostnum {
  transform: translate3d(-1.5rem, -1rem, 0);
  -webkit-text-stroke-color: var(--accent-line);
}

/* ====================== Barra de avance del formulario ====================== */

.formbar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.formbar__track {
  position: relative;
  flex: 1;
  height: 1px;
  background: var(--line);
  overflow: hidden;
}

.formbar__track i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.6s var(--ease-out-expo);
}

.formbar__label {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

.formbar.is-full .formbar__label {
  color: var(--accent);
}

/* Al enviar, un pulso azul recorre el formulario entero */
.form.is-sent {
  animation: form-sent 0.9s var(--ease-out-expo);
}

@keyframes form-sent {
  0% {
    box-shadow: 0 0 0 0 var(--accent-soft);
  }
  100% {
    box-shadow: 0 0 0 1.5rem rgba(0, 0, 0, 0);
  }
}

/* ====================== Si se pide reducir el movimiento ====================== */

@media (prefers-reduced-motion: reduce) {
  .ripple {
    display: none;
  }

  .kin.is-in .kin__word,
  .ghostnum {
    transition: none;
  }

  .form.is-sent {
    animation: none;
  }
}

/* Mismo suelo de legibilidad que en styles.css para los rotulos que
   viven en este archivo */
@media (max-width: 47.9375em) {
  .copybtn,
  .field__count,
  .formbar__label {
    font-size: 11px;
  }
}
