/* Servicios · escenario "pro": contenido de las tres caras. Tamaños en cqw para que escale con la pantalla. */

.sp-pro .stage-screen { container-type: inline-size; }
.sp-pro .stage-screen > .plan-ghost,
.sp-pro .stage-screen > .sys,
.sp-pro .stage-screen > .code { display: none; }

.sp {
  position: absolute;
  inset: 0;
  font-size: 2.05cqw;
  line-height: 1.3;
  color: #dfe3ee;
  font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
}

.sp-k {
  margin: 0 0 0.5em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(223, 227, 238, 0.42);
}

.sp-foot {
  position: absolute;
  left: 4.2%;
  right: 4.2%;
  bottom: 3.2%;
  display: flex;
  gap: 0.8em;
  align-items: center;
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.74em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(223, 227, 238, 0.42);
}
.sp-foot span { padding: 0.15em 0.6em; border-radius: 99px; border: 1px solid rgba(139, 123, 255, 0.5); color: #cfc8ff; }
.sp-foot em { margin-left: auto; font-style: normal; color: #b7e4c6; }

/* ---------- Cara 1 · Planificar ---------- */

.sp-plan .sp-over { position: absolute; left: 0; top: 0; width: 69%; height: 100%; overflow: visible; }
.stage-panel.sp-pro.phase-0 .plan-svg { width: 69%; right: auto; }

.sp-sel rect:first-child { fill: rgba(139, 123, 255, 0.06); stroke: #a99dff; stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.sp-sel .h { fill: #0b0e16; stroke: #a99dff; stroke-width: 1; vector-effect: non-scaling-stroke; }
.sp-sel text { font-size: 8px; fill: #a99dff; font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.08em; }
.sp-sel { opacity: 0; }
.stage-panel.is-active .sp-sel { animation: spFade 500ms ease 1.5s forwards; }

.sp-pin { opacity: 0; transform-box: fill-box; transform-origin: center; }
.sp-pin circle { fill: #86d7e8; stroke: #07121a; stroke-width: 1.4; }
.sp-pin text { font-size: 8px; font-weight: 700; fill: #07121a; font-family: "Instrument Sans", Arial, sans-serif; }
.stage-panel.is-active .sp-pin { animation: spPop 520ms cubic-bezier(0.3, 1.5, 0.5, 1) var(--d, 2s) forwards; }

.sp-cur { opacity: 0; }
.sp-cur path { fill: #a99dff; stroke: #0b0e16; stroke-width: 0.8; }
.sp-cur .tag rect { fill: #a99dff; }
.sp-cur .tag text { font-size: 7.6px; font-weight: 700; fill: #0b0e16; font-family: "Instrument Sans", Arial, sans-serif; }
.sp-cur.c2 path, .sp-cur.c2 .tag rect { fill: #d7bd86; }
.stage-panel.is-active .sp-cur.c1 { animation: spCur1 9s ease-in-out 2.2s infinite; }
.stage-panel.is-active .sp-cur.c2 { animation: spCur2 11s ease-in-out 3s infinite; }

@keyframes spCur1 {
  0% { opacity: 0; transform: translate(150px, 170px); }
  8% { opacity: 1; }
  30% { transform: translate(300px, 108px); }
  55% { transform: translate(170px, 128px); }
  80% { opacity: 1; transform: translate(380px, 150px); }
  100% { opacity: 0; transform: translate(400px, 160px); }
}
@keyframes spCur2 {
  0% { opacity: 0; transform: translate(430px, 300px); }
  10% { opacity: 1; }
  35% { transform: translate(250px, 232px); }
  62% { transform: translate(130px, 262px); }
  85% { opacity: 1; transform: translate(330px, 206px); }
  100% { opacity: 0; transform: translate(350px, 200px); }
}
@keyframes spFade { to { opacity: 1; } }
@keyframes spPop { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: scale(1); } }

.sp-col { position: absolute; left: 72%; right: 4%; top: 9%; }
.sp-tree, .sp-goals { list-style: none; margin: 0 0 1.1em; padding: 0; }
.sp-tree li {
  position: relative;
  margin: 0 0 0.35em 1.1em;
  padding: 0.28em 0.6em;
  border: 1px solid rgba(139, 123, 255, 0.35);
  border-radius: 0.4em;
  background: rgba(139, 123, 255, 0.07);
  font-size: 0.82em;
  opacity: 0;
}
.sp-tree li.root { margin-left: 0; border-color: rgba(134, 215, 232, 0.55); background: rgba(134, 215, 232, 0.1); }
.sp-tree li:not(.root)::before { content: ""; position: absolute; left: -0.75em; top: 50%; width: 0.7em; border-top: 1px solid rgba(139, 123, 255, 0.5); }
.sp-tree li:not(.root)::after { content: ""; position: absolute; left: -0.75em; top: -0.5em; bottom: 50%; border-left: 1px solid rgba(139, 123, 255, 0.5); }
.stage-panel.is-active .sp-tree li { animation: spSlide 500ms ease var(--d, 0.6s) forwards; }
@keyframes spSlide { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

.sp-goals li { display: flex; align-items: center; gap: 0.55em; margin: 0 0 0.35em; font-size: 0.84em; opacity: 0; }
.sp-goals i { width: 1.05em; height: 1.05em; border-radius: 0.3em; border: 1px solid rgba(183, 228, 198, 0.6); position: relative; }
.sp-goals i::after { content: ""; position: absolute; left: 0.28em; top: 0.08em; width: 0.28em; height: 0.55em; border: solid #b7e4c6; border-width: 0 2px 2px 0; transform: rotate(40deg) scale(0); transition: transform 300ms ease 0.25s; }
.stage-panel.is-active .sp-goals li { animation: spSlide 500ms ease var(--d, 1.5s) forwards; }
.stage-panel.is-active .sp-goals li i::after { transform: rotate(40deg) scale(1); }

/* ---------- Cara 2 · Diseñar ---------- */

.sp-sys { display: grid; grid-template-columns: 1fr 1.25fr; grid-template-rows: 1.15fr 1fr 0.9fr; gap: 0.75em; padding: 4.4% 4.2% 9.5%; }
.sp-card {
  min-width: 0;
  min-height: 0;
  padding: 0.7em 0.85em;
  border: 1px solid rgba(244, 245, 240, 0.09);
  border-radius: 0.7em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  overflow: hidden;
  opacity: 0;
}
.stage-panel.is-active .sp-card { animation: spRise 600ms cubic-bezier(0.2, 0.8, 0.2, 1) var(--d, 0s) forwards; }
@keyframes spRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.c-type { grid-row: 1 / span 2; }
.c-type .aa { font-size: 4.6em; font-weight: 300; line-height: 0.95; letter-spacing: -0.03em; color: #f4f5f0; }
.c-type .nm { margin: 0.1em 0 0.5em; font-size: 0.86em; font-weight: 600; color: #cfd6ff; }
.c-type .scale { list-style: none; margin: 0; padding: 0; }
.c-type .scale li { display: flex; align-items: baseline; justify-content: space-between; padding: 0.22em 0; border-top: 1px solid rgba(244, 245, 240, 0.07); font-size: 0.86em; }
.c-type .scale b { font: 500 0.78em ui-monospace, Menlo, monospace; color: #d7bd86; }

.c-color { grid-column: 2; }
.sw { list-style: none; margin: 0 0 0.45em; padding: 0; display: flex; gap: 0.5em; }
.sw li { flex: 1; min-width: 0; text-align: center; }
.sw i { display: block; height: 2.1em; border-radius: 0.45em; background: var(--c); box-shadow: 0 0 1em color-mix(in srgb, var(--c) 40%, transparent); }
.sw b { display: block; margin-top: 0.3em; font: 500 0.66em ui-monospace, Menlo, monospace; color: rgba(223, 227, 238, 0.55); }
.aa-chip { margin: 0; font-size: 0.74em; color: rgba(223, 227, 238, 0.6); }
.aa-chip span { margin-right: 0.5em; padding: 0.1em 0.5em; border-radius: 0.4em; background: rgba(183, 228, 198, 0.16); color: #b7e4c6; font-weight: 700; }

.c-comp { grid-column: 2; }
.c-comp .row { display: flex; align-items: center; gap: 0.5em; margin-bottom: 0.45em; }
.c-comp .b { padding: 0.32em 0.8em; border-radius: 99px; font-size: 0.78em; font-weight: 600; white-space: nowrap; }
.c-comp .b.p { background: #f4f5f0; color: #0b0e16; }
.c-comp .b.s { border: 1px solid rgba(244, 245, 240, 0.3); }
.c-comp .b.g { color: #a99dff; }
.c-comp .inp { flex: 1; padding: 0.32em 0.7em; border-radius: 0.5em; border: 1px solid #8b7bff; box-shadow: 0 0 0 0.18em rgba(139, 123, 255, 0.2); font-size: 0.74em; color: rgba(223, 227, 238, 0.7); }
.c-comp .inp u { display: inline-block; width: 1px; height: 1em; margin-left: 0.2em; vertical-align: -0.15em; background: #cfd6ff; }
.c-comp .tg { width: 2.1em; height: 1.2em; border-radius: 99px; background: #8b7bff; position: relative; }
.c-comp .tg i { position: absolute; right: 0.15em; top: 0.15em; width: 0.9em; height: 0.9em; border-radius: 50%; background: #fff; }
.c-comp .chip { padding: 0.18em 0.65em; border-radius: 99px; border: 1px solid rgba(244, 245, 240, 0.18); font-size: 0.72em; }
.c-comp .chip.on { background: rgba(134, 215, 232, 0.16); border-color: rgba(134, 215, 232, 0.6); color: #86d7e8; }
.stage-panel.is-active .c-comp .inp u,
.stage-panel.is-active .term .caret,
.stage-panel.is-active .cl .caret { animation: spBlink 1s steps(2) infinite; }
@keyframes spBlink { 50% { opacity: 0; } }

.c-space { grid-column: 1 / span 2; display: flex; gap: 1.2em; align-items: center; }
.c-space .sc { list-style: none; margin: 0; padding: 0; flex: 1; }
.c-space .sc li { height: 0.5em; margin: 0.3em 0; width: var(--w); border-radius: 99px; background: linear-gradient(90deg, #8b7bff, #86d7e8); position: relative; }
.c-space .sc b { position: absolute; left: calc(100% + 0.5em); top: -0.35em; font: 500 0.74em ui-monospace, Menlo, monospace; color: rgba(223, 227, 238, 0.5); }
.c-space .rd { display: flex; gap: 0.5em; }
.c-space .rd i { width: 1.9em; height: 1.9em; border: 1.5px solid #d7bd86; border-right-color: transparent; border-bottom-color: transparent; }

/* ---------- Cara 3 · Desarrollar ---------- */

.sp-dev { display: grid; grid-template-columns: 22% 1fr 25%; gap: 0; padding: 0 0 9% 0; }
.ftree { list-style: none; margin: 0; padding: 0.9em 0.6em; border-right: 1px solid rgba(244, 245, 240, 0.07); font: 500 0.78em ui-monospace, Menlo, monospace; color: rgba(223, 227, 238, 0.55); }
.ftree li { padding: 0.28em 0.5em; border-radius: 0.35em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftree li.dir { color: #d7bd86; }
.ftree li.on { background: rgba(134, 215, 232, 0.12); color: #86d7e8; }

.ed { min-width: 0; padding: 0; display: flex; flex-direction: column; height: 100%; }
.sp-pro .plan-caption { display: none; }
.term { margin-top: auto; padding: 0.6em 0.9em 0.7em; border-top: 1px solid rgba(244, 245, 240, 0.07); background: rgba(0, 0, 0, 0.22); font: 500 0.78em/1.7 ui-monospace, Menlo, monospace; }
.term p { margin: 0; opacity: 0; }
.term p.sp-k { opacity: 1; margin-bottom: 0.2em; }
.term .p { color: #8b7bff; } .term .cm { color: #b7e4c6; }
.term .caret { display: inline-block; width: 0.5em; height: 1em; margin-left: 0.2em; vertical-align: -0.15em; background: #86d7e8; }
.stage-panel.is-active .term p:not(.sp-k) { animation: spSlide 420ms ease var(--d, 0.8s) forwards; }
.ed .tabs { display: flex; border-bottom: 1px solid rgba(244, 245, 240, 0.07); font: 500 0.74em ui-monospace, Menlo, monospace; color: rgba(223, 227, 238, 0.4); }
.ed .tabs span { padding: 0.7em 1em; }
.ed .tabs .on { color: #f4f5f0; box-shadow: inset 0 -2px #86d7e8; }
.cl { list-style: none; counter-reset: ln; margin: 0; padding: 0.7em 0.8em; flex: 0 0 auto; font: 500 0.82em/1.75 ui-monospace, Menlo, monospace; color: #dfe3ee; }
.cl li { counter-increment: ln; white-space: nowrap; overflow: hidden; opacity: 0; }
.cl li::before { content: counter(ln, decimal-leading-zero); display: inline-block; width: 2.2em; color: rgba(223, 227, 238, 0.25); }
.cl .i1 { padding-left: 1.4em; }
.cl .t { color: #86d7e8; } .cl .a { color: #d7bd86; } .cl .s { color: #b7e4c6; } .cl .p { color: #8b7bff; } .cl .cm { color: rgba(223, 227, 238, 0.4); }
.cl .caret { display: inline-block; width: 0.5em; height: 1em; margin-left: 0.2em; vertical-align: -0.15em; background: #86d7e8; }
.stage-panel.is-active .cl li { animation: spSlide 420ms ease var(--d, 0.2s) forwards; }

.met { padding: 0.9em 0.8em; border-left: 1px solid rgba(244, 245, 240, 0.07); }
.rings { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6em; margin-bottom: 0.9em; }
.sp-ring { position: relative; display: block; text-align: center; opacity: 0; }
.sp-ring svg { width: 100%; display: block; transform: rotate(-90deg); }
.sp-ring .t { fill: none; stroke: rgba(183, 228, 198, 0.15); stroke-width: 3; }
.sp-ring .f { fill: none; stroke: #b7e4c6; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 0 100; }
.sp-ring b { position: absolute; left: 0; right: 0; top: 28%; font-size: 0.95em; color: #b7e4c6; }
.sp-ring i { display: block; margin-top: -0.1em; font: normal 500 0.62em ui-monospace, Menlo, monospace; letter-spacing: 0.1em; color: rgba(223, 227, 238, 0.5); }
.stage-panel.is-active .sp-ring { animation: spFade 400ms ease var(--d, 0.5s) forwards; }
.stage-panel.is-active .sp-ring .f { animation: spRing 1.1s cubic-bezier(0.3, 0.7, 0.2, 1) var(--d, 0.5s) forwards; }
@keyframes spRing { to { stroke-dasharray: var(--v, 100) 100; } }

.met .bar { height: 0.42em; border-radius: 99px; background: rgba(244, 245, 240, 0.08); overflow: hidden; }
.met .bar i { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left; border-radius: inherit; background: linear-gradient(90deg, #8b7bff, #86d7e8); }
.stage-panel.is-active .met .bar i { animation: spBar 2.2s cubic-bezier(0.4, 0, 0.2, 1) 0.9s forwards; }
@keyframes spBar { to { transform: scaleX(1); } }
.met .ok { display: flex; align-items: center; gap: 0.5em; margin: 0.5em 0 0; font: 500 0.74em ui-monospace, Menlo, monospace; color: #b7e4c6; opacity: 0; }
.met .ok u { width: 0.6em; height: 0.6em; border-radius: 50%; background: #b7e4c6; box-shadow: 0 0 0.8em #b7e4c6; }
.stage-panel.is-active .met .ok { animation: spFade 400ms ease 3s forwards; }
.sp-foot.sb { border-top: 1px solid rgba(244, 245, 240, 0.07); padding-top: 0.55em; bottom: 0; left: 0; right: 0; padding-left: 4.2%; padding-right: 4.2%; padding-bottom: 0.7em; }

@media (prefers-reduced-motion: reduce) {
  .sp-card, .sp-tree li, .sp-goals li, .cl li, .term p, .sp-ring, .sp-pin, .sp-sel, .met .ok { opacity: 1; animation: none !important; transform: none; }
  .sp-ring .f { stroke-dasharray: var(--v, 100) 100; animation: none !important; }
  .met .bar i { transform: none; animation: none !important; }
  .sp-cur { display: none; }
  .cl .caret, .term .caret, .c-comp .inp u { animation: none !important; }
}

/* Móvil: las tres notas de fase compartían una sola celda y la más larga dejaba un hueco bajo las cortas.
   Las inactivas salen del flujo (siguen apareciendo en fundido) y el bloque mide lo que mide la activa. */
@media (max-width: 999px) {
  .phase-notes { position: relative; display: block; }
  .phase-note:not(.is-active) { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; }
  .phase-hero { padding-bottom: 28px; }
}
