/* ============================================================
   servicio-ia.css — capa de las páginas de servicio de ingeniería
   (agente telefónico, automatización, visión, chatbots)
   Se apoya en styles.css (tokens :root). Prefijo .svc-
   OJO: cache-busting manual ?v= en las referencias (deploy.sh
   no versiona este fichero).
   ============================================================ */

/* ── Hero de servicio ── */
.svc-hero {
  position: relative;
  padding: calc(80px + 6rem) 0 5rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 50% at 80% 10%, var(--accent-subtle), transparent 70%),
    var(--bg-primary);
}
.svc-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 4rem;
  align-items: center;
}
.svc-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 1.2rem;
}
.svc-hero__eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--accent-light);
}
.svc-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 4.6vw, 3.4rem);
  line-height: 1.08;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 1.2rem;
}
.svc-hero h1 em {
  font-style: normal;
  color: var(--accent-light);
}
.svc-hero__sub {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 54ch;
  margin-bottom: 2rem;
}
.svc-hero__ctas { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.svc-hero__tel {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-light);
  padding-bottom: 2px;
  transition: color .25s, border-color .25s;
}
.svc-hero__tel:hover { color: var(--accent-light); border-color: var(--accent-light); }

/* ── Secciones ── */
.svc-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: .9rem;
}
.svc-h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  margin: 0 0 1rem;
  max-width: 26ch;
}
.svc-intro { color: var(--text-secondary); max-width: 62ch; line-height: 1.7; margin-bottom: 2.5rem; }

/* ── Cards de capacidades ── */
.svc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.svc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.6rem 1.5rem;
  transition: transform .35s cubic-bezier(.22,1,.36,1), border-color .35s;
}
.svc-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.svc-card__icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--accent-subtle);
  color: var(--accent-light);
  display: grid; place-items: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}
.svc-card h3 {
  font-family: var(--font-heading);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 .5rem;
}
.svc-card p { color: var(--text-secondary); font-size: var(--fs-sm); line-height: 1.6; margin: 0; }

/* ── Pasos (cómo funciona) ── */
.svc-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; counter-reset: paso; }
.svc-step {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.9rem 1.5rem 1.5rem;
  counter-increment: paso;
}
.svc-step::before {
  content: counter(paso, decimal-leading-zero);
  position: absolute;
  top: -0.85rem; left: 1.25rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--accent-light);
  background: var(--bg-primary);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: .2rem .65rem;
}
.svc-step h3 { font-family: var(--font-heading); font-size: var(--fs-base); font-weight: 600; color: var(--text-primary); margin: 0 0 .45rem; }
.svc-step p { color: var(--text-secondary); font-size: var(--fs-sm); line-height: 1.6; margin: 0; }

/* ── Chips de sectores / casos de uso ── */
.svc-chips { display: flex; flex-wrap: wrap; gap: .6rem; }
.svc-chip {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: .45rem 1rem;
  background: var(--bg-card);
}
.svc-chip strong { color: var(--text-primary); font-weight: 600; }

/* ── Métricas honestas (sin humo) ── */
.svc-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.25rem; margin-top: 2.5rem; }
.svc-fact { border-left: 2px solid var(--accent); padding-left: 1.1rem; }
.svc-fact__num {
  font-family: var(--font-heading);
  font-size: var(--fs-3xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.svc-fact__label { color: var(--text-muted); font-size: var(--fs-sm); margin-top: .4rem; line-height: 1.45; }

/* ── FAQ ── */
.svc-faq { max-width: 760px; }
.svc-faq details {
  border-bottom: 1px solid var(--border-color);
  padding: 1.1rem 0;
}
.svc-faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--fs-base);
}
.svc-faq summary::-webkit-details-marker { display: none; }
.svc-faq summary::after {
  content: "+";
  color: var(--accent-light);
  font-size: 1.3rem;
  transition: transform .25s;
  flex-shrink: 0;
}
.svc-faq details[open] summary::after { transform: rotate(45deg); }
.svc-faq details p { color: var(--text-secondary); line-height: 1.65; margin: .8rem 0 0; font-size: var(--fs-sm); max-width: 68ch; }

/* ── CTA final ── */
.svc-cta {
  text-align: center;
  padding: 4.5rem 0;
  background:
    radial-gradient(ellipse 50% 60% at 50% 100%, var(--accent-subtle), transparent 70%),
    var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}
.svc-cta h2 { font-family: var(--font-heading); font-size: clamp(1.8rem, 3.4vw, 2.6rem); color: var(--text-primary); margin: 0 0 .9rem; }
.svc-cta p { color: var(--text-secondary); max-width: 52ch; margin: 0 auto 2rem; line-height: 1.65; }

/* ============================================================
   WIDGETS FIRMA (dibujados en CSS, activados por JS al entrar
   en viewport; respetan prefers-reduced-motion)
   ============================================================ */

/* ── Marco común de panel ── */
.svc-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  overflow: hidden;
}
.svc-panel__bar {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}
.svc-panel__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-light); }
.svc-panel__dot:first-child { background: #e0655a; }
.svc-panel__dot:nth-child(2) { background: #e0b25a; }
.svc-panel__dot:nth-child(3) { background: #6cbf6c; }
.svc-panel__title { margin-left: .5rem; font-size: var(--fs-xs); color: var(--text-muted); letter-spacing: .06em; }

/* ── 1. Transcripción telefónica (agente) ── */
.svc-call { padding: 1.4rem 1.2rem 1.6rem; min-height: 340px; display: flex; flex-direction: column; gap: .8rem; }
.svc-call__row { display: flex; }
.svc-call__row--agent { justify-content: flex-start; }
.svc-call__row--caller { justify-content: flex-end; }
.svc-bubble {
  max-width: 82%;
  padding: .7rem 1rem;
  border-radius: 14px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  opacity: 0;
  transform: translateY(10px);
}
.svc-call.is-live .svc-bubble,
.svc-chat.is-live .svc-bubble { animation: svcBubble .5s cubic-bezier(.22,1,.36,1) forwards; animation-delay: var(--d, 0s); }
.svc-call__row--agent .svc-bubble { background: var(--accent-subtle); color: var(--text-primary); border: 1px solid rgba(108,215,236,.25); border-bottom-left-radius: 4px; }
.svc-call__row--caller .svc-bubble { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border-color); border-bottom-right-radius: 4px; }
.svc-bubble__who { display: block; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-light); margin-bottom: .25rem; }
.svc-call__row--caller .svc-bubble__who { color: var(--text-muted); }
@keyframes svcBubble { to { opacity: 1; transform: translateY(0); } }

/* onda de voz */
.svc-wave { display: inline-flex; align-items: flex-end; gap: 3px; height: 16px; margin-left: .4rem; vertical-align: middle; }
.svc-wave i { width: 3px; border-radius: 2px; background: var(--accent-light); height: 30%; }
.svc-call.is-live .svc-wave i { animation: svcWave 1s ease-in-out infinite; }
.svc-wave i:nth-child(2) { animation-delay: .15s; }
.svc-wave i:nth-child(3) { animation-delay: .3s; }
.svc-wave i:nth-child(4) { animation-delay: .45s; }
@keyframes svcWave { 0%,100% { height: 25%; } 50% { height: 100%; } }

/* ── 2. Pipeline de automatización ── */
.svc-flow { padding: 2.2rem 1.4rem; display: grid; gap: .9rem; }
.svc-flow__node {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: .95rem 1.1rem;
  opacity: .35;
  transition: opacity .5s, border-color .5s, transform .5s;
}
.svc-flow__node.is-on { opacity: 1; border-color: var(--accent); transform: translateX(4px); }
.svc-flow__badge {
  width: 34px; height: 34px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent-subtle);
  color: var(--accent-light);
  font-size: 1rem;
}
.svc-flow__node h4 { margin: 0; font-family: var(--font-heading); font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); }
.svc-flow__node p { margin: .15rem 0 0; font-size: var(--fs-xs); color: var(--text-muted); }
.svc-flow__link { display: flex; justify-content: center; height: 18px; }
.svc-flow__link i { width: 1px; background: linear-gradient(var(--accent), transparent); display: block; height: 0; transition: height .4s ease .1s; }
.svc-flow__link.is-on i { height: 100%; }

/* ── 3. Escáner de visión por computador ── */
.svc-vision { position: relative; }
.svc-vision img { display: block; width: 100%; height: auto; }
.svc-vision__scan {
  position: absolute; left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
  box-shadow: 0 0 18px var(--accent-light);
  opacity: 0;
}
.svc-vision.is-live .svc-vision__scan { opacity: 1; animation: svcScan 3.2s ease-in-out infinite; }
@keyframes svcScan { 0% { top: 2%; } 50% { top: 96%; } 100% { top: 2%; } }
.svc-vision__box {
  position: absolute;
  border: 1.5px solid var(--accent-light);
  border-radius: 4px;
  box-shadow: 0 0 0 2000px rgba(0,0,0,0);
  opacity: 0;
  transform: scale(.85);
}
.svc-vision.is-live .svc-vision__box { animation: svcBox .45s cubic-bezier(.22,1,.36,1) forwards; animation-delay: var(--d, .5s); }
@keyframes svcBox { to { opacity: 1; transform: scale(1); } }
.svc-vision__tag {
  position: absolute;
  top: -1.55rem; left: -1.5px;
  font-size: .66rem;
  letter-spacing: .08em;
  font-weight: 600;
  color: #0c1214;
  background: var(--accent-light);
  border-radius: 4px 4px 4px 0;
  padding: .18rem .5rem;
  white-space: nowrap;
}

/* ── 4. Ventana de chatbot ── */
.svc-chat { padding: 1.3rem 1.1rem; min-height: 330px; display: flex; flex-direction: column; gap: .75rem; }
.svc-chat .svc-bubble { max-width: 86%; }
.svc-chat__typing {
  display: inline-flex; gap: 4px; align-items: center;
  padding: .7rem 1rem;
  background: var(--accent-subtle);
  border: 1px solid rgba(108,215,236,.25);
  border-radius: 14px 14px 14px 4px;
  width: max-content;
  opacity: 0;
}
.svc-chat__typing { max-height: 44px; }
.svc-chat.is-live .svc-chat__typing {
  animation: svcBubble .4s forwards, svcTypingHide .3s forwards;
  animation-delay: var(--d, 0s), calc(var(--d, 0s) + 1.05s);
}
@keyframes svcTypingHide { to { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; border-width: 0; } }
.svc-chat__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-light); animation: svcTyping 1.1s infinite; }
.svc-chat__typing i:nth-child(2) { animation-delay: .18s; }
.svc-chat__typing i:nth-child(3) { animation-delay: .36s; }
@keyframes svcTyping { 0%,100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* ── Reveals genéricos ── */
.svc-rv { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .7s cubic-bezier(.22,1,.36,1); }
.svc-rv.is-in { opacity: 1; transform: none; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .svc-hero__grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .svc-hero { padding-top: calc(80px + 3.5rem); }
}

/* ── Reduced motion: todo visible, nada animado ── */
@media (prefers-reduced-motion: reduce) {
  .svc-rv { opacity: 1; transform: none; transition: none; }
  .svc-call .svc-bubble, .svc-call.is-live .svc-bubble,
  .svc-chat .svc-bubble, .svc-chat.is-live .svc-bubble,
  .svc-vision.is-live .svc-vision__box { animation: none; opacity: 1; transform: none; }
  .svc-chat.is-live .svc-chat__typing { animation: none; opacity: 0; max-height: 0; padding: 0; margin: 0; border-width: 0; }
  .svc-call.is-live .svc-wave i, .svc-vision.is-live .svc-vision__scan { animation: none; }
  .svc-vision__scan { opacity: 0; }
  .svc-flow__node { opacity: 1; }
  .svc-flow__link i { height: 100%; }
}

/* ── Reproductor de demo de llamada ── */
.svc-audio {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-top: 1rem;
  padding: .8rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
}
.svc-audio__btn {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .25s, transform .2s;
}
.svc-audio__btn:hover { background: var(--accent-hover); transform: scale(1.05); }
.svc-audio__ico {
  width: 0; height: 0;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
}
.svc-audio.is-playing .svc-audio__ico {
  width: 12px; height: 15px;
  border: none; margin-left: 0;
  background: linear-gradient(90deg, #fff 0 4px, transparent 4px 8px, #fff 8px 12px);
}
.svc-audio__meta { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.svc-audio__title { font-family: var(--font-heading); font-weight: 600; font-size: var(--fs-sm); color: var(--text-primary); }
.svc-audio__hint { font-size: var(--fs-xs); color: var(--text-muted); }
.svc-audio__bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--bg-elevated);
  overflow: hidden;
  cursor: pointer;
  min-width: 60px;
}
.svc-audio__bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 3px; }
.svc-audio__time { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
@media (max-width: 560px) { .svc-audio__bar { display: none; } }
