/* ============================================================================
   MOISÉS MOTA · MY DIGITAL WORLD — /portafolio  ·  storytelling V2
   ----------------------------------------------------------------------------
   Hoja propia de una sola página. Todo cuelga de .mm-pf.

   CONTRATO CON EL MOTOR (js/mm-portafolio.js)
   -------------------------------------------
   El JS no anima: sólo escribe `--p` (0 a 1) y `data-pf-paso` en las escenas,
   y agrega .mm-pf--motor a la raíz cuando arranca.

   Por eso el estado por defecto de CADA escena es el ESTADO FINAL. Lo que
   esconde o desplaza algo vive siempre bajo .mm-pf--motor. Consecuencia:

     · sin JS            → no hay .mm-pf--motor → todo visible
     · movimiento reducido → el motor no arranca → todo visible

   No hace falta duplicar estados en un bloque de prefers-reduced-motion.

   Reutiliza: mm-shell.css (paleta, --mm-cta, --mm-shell-ease),
              mm-2026.css (--mm-ease), mm-inner.css (Bootstrap oscuro).
   ========================================================================== */

.mm-pf {
    --pf-max: 1180px;
    --pf-radio: 20px;
    --pf-linea: rgba(148, 163, 184, .14);
    --pf-panel: linear-gradient(180deg, rgba(13, 20, 36, .86) 0%, rgba(3, 7, 18, .92) 100%);
    --pf-nav: 112px;
}

.mm-pf__ancho {
    width: min(100% - 48px, var(--pf-max));
    margin-inline: auto;
}

.mm-pf__cap {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 18px;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--primary);
}

.mm-pf__cap::before {
    content: "";
    width: 22px;
    height: 1px;
    background: currentColor;
}

/* ============================================
   LOOP 1 — APERTURA
   Escena alta: el texto queda fijo mientras la palabra protagonista cambia
   con el avance del scroll. El fondo se desplaza muy poco.
   ============================================ */

.mm-pf-abre {
    position: relative;
    height: 230vh;
    background:
        radial-gradient(900px circle at 22% 10%, rgba(6, 182, 212, .14), transparent 62%),
        linear-gradient(180deg, #07172F 0%, #050B18 70%, var(--background) 100%);
}

.mm-pf-abre__fijo {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    isolation: isolate;
}

/* Reja de profundidad. Se desplaza con el progreso, no con un bucle. */
.mm-pf-abre__fijo::before {
    content: "";
    position: absolute;
    inset: -10% -10% -10% -10%;
    z-index: -1;
    background-image:
        linear-gradient(rgba(148, 163, 184, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .055) 1px, transparent 1px);
    background-size: 78px 78px;
    -webkit-mask-image: radial-gradient(ellipse 85% 65% at 32% 42%, #000 8%, transparent 74%);
    mask-image: radial-gradient(ellipse 85% 65% at 32% 42%, #000 8%, transparent 74%);
    translate: 0 calc(var(--p, 0) * -70px);
}

/* Elemento gráfico que cruza lentamente, atado al progreso */
.mm-pf-abre__haz {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(6, 182, 212, .5), transparent);
    translate: calc(var(--p, 1) * 96vw) 0;
    opacity: .7;
}

.mm-pf-abre__h1 {
    margin: 0 0 30px;
    font-size: clamp(2.2rem, 1rem + 4.6vw, 4.6rem);
    font-weight: 700;
    line-height: 1.03;
    letter-spacing: -.03em;
    color: var(--text-primary);
}

.mm-pf-abre__h1 span { display: block; }
.mm-pf-abre__linea2 { color: var(--text-muted); }

.mm-pf-abre__palabra {
    display: inline-block;
    min-width: 7ch;
    color: var(--primary);
}

.mm-pf-abre__disc {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mm-pf-abre__disc li {
    font-size: .88rem;
    letter-spacing: .03em;
    color: var(--text-muted);
}

.mm-pf-abre__disc li + li::before {
    content: "·";
    margin-right: 14px;
}

/* Entradas de la apertura: sólo existen con motor */
.mm-pf--motor .mm-pf-abre__h1 .mm-pf-abre__linea1 { animation: pf-sube .9s var(--mm-ease) both; }
.mm-pf--motor .mm-pf-abre__h1 .mm-pf-abre__linea2 { animation: pf-sube .9s var(--mm-ease) .14s both; }
.mm-pf--motor .mm-pf-abre__disc { animation: pf-sube .9s var(--mm-ease) .3s both; }

@keyframes pf-sube {
    from { opacity: 0; translate: 0 22px; }
    to   { opacity: 1; translate: 0 0; }
}

/* ============================================
   LOOP 2 — EL PROBLEMA SE VE
   Escena sticky de 220vh. Izquierda: la frase cambia por etapa.
   Derecha: los bloques se separan, aparece el nodo y se trazan las líneas.
   ============================================ */

.mm-pf-caos {
    position: relative;
    height: 220vh;
    background: var(--background);
}

.mm-pf-caos__fijo {
    position: sticky;
    top: var(--pf-nav);
    display: grid;
    grid-template-columns: 40fr 60fr;
    gap: 56px;
    align-items: center;
    min-height: calc(100vh - var(--pf-nav));
    padding-bottom: 40px;
}

/* ---- Izquierda: las frases ---- */
.mm-pf-caos__frases {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
    min-height: 5.6em;
}

.mm-pf-caos__frases li {
    font-size: clamp(1.4rem, .9rem + 1.7vw, 2.4rem);
    font-weight: 600;
    line-height: 1.16;
    letter-spacing: -.02em;
    color: var(--text-primary);
}

/* Con motor, las frases se apilan y sólo se ve la de la etapa activa */
.mm-pf--motor .mm-pf-caos__frases li {
    position: absolute;
    inset: 0;
    opacity: 0;
    translate: 0 14px;
    transition: opacity .5s var(--mm-ease), translate .5s var(--mm-ease);
}

.mm-pf--motor .mm-pf-caos[data-pf-paso="0"] .mm-pf-caos__frases li:nth-child(1),
.mm-pf--motor .mm-pf-caos[data-pf-paso="1"] .mm-pf-caos__frases li:nth-child(2),
.mm-pf--motor .mm-pf-caos[data-pf-paso="2"] .mm-pf-caos__frases li:nth-child(3),
.mm-pf--motor .mm-pf-caos[data-pf-paso="3"] .mm-pf-caos__frases li:nth-child(4) {
    opacity: 1;
    translate: 0 0;
}

/* Sin motor las cuatro frases se leen una debajo de otra */
.mm-pf-caos__frases li + li { margin-top: 14px; }
.mm-pf--motor .mm-pf-caos__frases li + li { margin-top: 0; }

/* ---- Derecha: el mapa del desorden ---- */
.mm-pf-mapa {
    position: relative;
    aspect-ratio: 1 / .82;
    width: 100%;
}

.mm-pf-mapa__svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.mm-pf-mapa__svg path {
    fill: none;
    stroke: var(--primary);
    /* El viewBox se estira con preserveAspectRatio="none", asi que sin esto
       el trazo se escalaba ~7x y las lineas quedaban como tubos. */
    vector-effect: non-scaling-stroke;
    stroke-width: 1.25;
    stroke-linecap: round;
    opacity: .6;
}

/* Las líneas se dibujan recién en la última etapa */
/* Con non-scaling-stroke el guion se mide en pixeles de pantalla, no en
   unidades del viewBox: por eso NO se usa pathLength. 600 cubre de sobra
   la linea mas larga, asi que el trazo se dibuja entero y sin cortes. */
.mm-pf--motor .mm-pf-mapa__svg path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset .75s var(--ease-travel, cubic-bezier(.35,.35,.3,1));
}

.mm-pf--motor .mm-pf-caos[data-pf-paso="3"] .mm-pf-mapa__svg path {
    stroke-dashoffset: 0;
}

.mm-pf--motor .mm-pf-caos[data-pf-paso="3"] .mm-pf-mapa__svg path:nth-child(2) { transition-delay: .1s; }
.mm-pf--motor .mm-pf-caos[data-pf-paso="3"] .mm-pf-mapa__svg path:nth-child(3) { transition-delay: .2s; }
.mm-pf--motor .mm-pf-caos[data-pf-paso="3"] .mm-pf-mapa__svg path:nth-child(4) { transition-delay: .3s; }

/* Bloques */
.mm-pf-bloque {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--pf-linea);
    border-radius: 11px;
    background: var(--pf-panel);
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
}

.mm-pf-bloque::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--text-muted);
}

/* Posiciones base: el estado final, ya ordenado alrededor del nodo */
.mm-pf-bloque--a { left: 2%;  top: 6%; }
.mm-pf-bloque--b { right: 4%; top: 16%; }
.mm-pf-bloque--c { left: 0%;  bottom: 20%; }
.mm-pf-bloque--d { right: 2%; bottom: 10%; }

/* Con motor: en la etapa 1 están juntos, en la 2 se separan */
.mm-pf--motor .mm-pf-bloque {
    transition: translate .8s var(--mm-ease), opacity .6s var(--mm-ease), border-color .6s var(--mm-ease);
    translate: var(--dx, 0) var(--dy, 0);
}

.mm-pf--motor .mm-pf-caos[data-pf-paso="0"] .mm-pf-bloque--a { --dx: 46%;  --dy: 120%; }
.mm-pf--motor .mm-pf-caos[data-pf-paso="0"] .mm-pf-bloque--b { --dx: -36%; --dy: 86%; }
.mm-pf--motor .mm-pf-caos[data-pf-paso="0"] .mm-pf-bloque--c { --dx: 52%;  --dy: -58%; }
.mm-pf--motor .mm-pf-caos[data-pf-paso="0"] .mm-pf-bloque--d { --dx: -30%; --dy: -74%; }

/* Etapa 2: se separan un poco más que su posición final */
.mm-pf--motor .mm-pf-caos[data-pf-paso="1"] .mm-pf-bloque--a { --dx: -5%; --dy: -8%; }
.mm-pf--motor .mm-pf-caos[data-pf-paso="1"] .mm-pf-bloque--b { --dx: 5%;  --dy: -8%; }
.mm-pf--motor .mm-pf-caos[data-pf-paso="1"] .mm-pf-bloque--c { --dx: -5%; --dy: 8%; }
.mm-pf--motor .mm-pf-caos[data-pf-paso="1"] .mm-pf-bloque--d { --dx: 5%;  --dy: 8%; }

/* Etapas 3 y 4: posición final y el borde se enciende al conectar */
.mm-pf--motor .mm-pf-caos[data-pf-paso="3"] .mm-pf-bloque {
    border-color: rgba(6, 182, 212, .34);
    color: var(--text-primary);
}

.mm-pf--motor .mm-pf-caos[data-pf-paso="3"] .mm-pf-bloque::before { background: var(--primary); }

/* Áreas: aparecen en la etapa 2 */
.mm-pf-area {
    position: absolute;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.mm-pf-area--ventas { left: 4%;  top: 44%; }
.mm-pf-area--admin  { right: 6%; top: 50%; }

.mm-pf--motor .mm-pf-area {
    opacity: 0;
    transition: opacity .6s var(--mm-ease);
}

.mm-pf--motor .mm-pf-caos[data-pf-paso="1"] .mm-pf-area,
.mm-pf--motor .mm-pf-caos[data-pf-paso="2"] .mm-pf-area,
.mm-pf--motor .mm-pf-caos[data-pf-paso="3"] .mm-pf-area { opacity: 1; }

/* Nodo central: dirección mirando el conjunto */
.mm-pf-nodo {
    position: absolute;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 128px;
    height: 128px;
    border: 1px solid rgba(6, 182, 212, .38);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6, 182, 212, .14), rgba(3, 7, 18, .9) 72%);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--primary);
    text-align: center;
}

.mm-pf-nodo small {
    font-size: .6rem;
    letter-spacing: .06em;
    text-transform: none;
    color: var(--text-muted);
}

.mm-pf--motor .mm-pf-nodo {
    opacity: 0;
    scale: .82;
    transition: opacity .6s var(--mm-ease), scale .6s var(--mm-ease);
}

.mm-pf--motor .mm-pf-caos[data-pf-paso="2"] .mm-pf-nodo,
.mm-pf--motor .mm-pf-caos[data-pf-paso="3"] .mm-pf-nodo {
    opacity: 1;
    scale: 1;
}

/* ============================================
   LOOP 3 — CONVERGENCIA HACIA EL CASO
   El nodo de la escena anterior se convierte en la entrada al proyecto.
   ============================================ */

.mm-pf-puente {
    position: relative;
    padding: 0 0 20px;
    text-align: center;
    background: linear-gradient(180deg, var(--background) 0%, #060D1C 100%);
}

.mm-pf-puente__hilo {
    display: block;
    width: 1px;
    height: 96px;
    margin: 0 auto 26px;
    background: linear-gradient(180deg, rgba(6, 182, 212, .55), rgba(6, 182, 212, 0));
    transform-origin: top center;
}

.mm-pf--motor .mm-pf-puente__hilo {
    scale: 1 0;
    transition: scale .8s var(--ease-travel, cubic-bezier(.35,.35,.3,1));
}

.mm-pf--motor .mm-pf-puente.is-visible .mm-pf-puente__hilo { scale: 1 1; }

.mm-pf-puente__t {
    margin: 0 auto;
    max-width: 22ch;
    font-size: clamp(1.4rem, 1rem + 1.5vw, 2.2rem);
    font-weight: 700;
    line-height: 1.16;
    letter-spacing: -.022em;
    color: var(--text-primary);
}

/* ============================================
   LOOP 4 — CASO PROTAGONISTA
   Sticky a la izquierda, los siete pasos aparecen de a uno a la derecha.
   ============================================ */

.mm-pf-caso {
    padding: 30px 0 110px;
    background: linear-gradient(180deg, #060D1C 0%, var(--background) 60%);
}

.mm-pf-caso__grid {
    display: grid;
    grid-template-columns: 42fr 58fr;
    gap: 64px;
    align-items: start;
}

.mm-pf-caso__fijo {
    position: sticky;
    top: var(--pf-nav);
}

.mm-pf-caso__titulo {
    margin: 0 0 16px;
    font-size: clamp(1.6rem, 1.1rem + 1.5vw, 2.3rem);
    font-weight: 700;
    line-height: 1.14;
    letter-spacing: -.02em;
    color: var(--text-primary);
}

.mm-pf-caso__cliente {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px;
}

.mm-pf-caso__cliente span {
    padding: 4px 11px;
    border: 1px solid var(--pf-linea);
    border-radius: 999px;
    font-size: .82rem;
    color: var(--text-secondary);
}

.mm-pf-caso__texto {
    margin: 0 0 24px;
    font-size: 1.02rem;
    line-height: 1.62;
    color: var(--text-secondary);
}

/* Indicador de avance del proceso */
.mm-pf-caso__avance {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 24px;
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.mm-pf-caso__barra {
    position: relative;
    flex: 1;
    height: 2px;
    border-radius: 2px;
    background: var(--pf-linea);
    overflow: hidden;
}

.mm-pf-caso__barra::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--primary);
    transform-origin: left center;
    scale: 1 1;
}

.mm-pf--motor .mm-pf-caso__barra::after {
    scale: var(--p, 1) 1;
    transition: scale .25s linear;
}

/* Captura real */
.mm-pf-shot {
    margin: 0 0 24px;
    border: 1px solid var(--pf-linea);
    border-radius: 14px;
    overflow: hidden;
    background: #0b1222;
}

.mm-pf-shot img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    object-fit: cover;
    object-position: center;
}

.mm-pf-shot figcaption {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border-top: 1px solid var(--pf-linea);
    font-size: .74rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.mm-pf-shot figcaption::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
}

/* Pasos */
.mm-pf-pasos {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: pf;
}

.mm-pf-paso {
    position: relative;
    counter-increment: pf;
    padding: 0 0 44px 56px;
}

.mm-pf-paso::before {
    content: counter(pf, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(6, 182, 212, .4);
    border-radius: 50%;
    background: rgba(6, 182, 212, .08);
    font-size: .76rem;
    font-weight: 600;
    color: var(--primary);
    transition: background-color .4s var(--mm-ease), border-color .4s var(--mm-ease), scale .4s var(--mm-ease);
}

.mm-pf-paso:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 17px;
    top: 40px;
    bottom: 6px;
    width: 1px;
    background: linear-gradient(180deg, rgba(6, 182, 212, .5), rgba(6, 182, 212, .08));
    transform-origin: top center;
}

.mm-pf-paso__t {
    display: block;
    margin: 4px 0 6px;
    font-size: 1.04rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mm-pf-paso__d {
    margin: 0;
    font-size: .95rem;
    line-height: 1.58;
    color: var(--text-secondary);
}

/* Con motor los pasos entran de a uno y el activo se destaca */
.mm-pf--motor .mm-pf-paso {
    opacity: .28;
    translate: 0 10px;
    transition: opacity .5s var(--mm-ease), translate .5s var(--mm-ease);
}

/* El paso activo y los ya vistos salen de data-pf-paso, que escribe el
   motor. No hacen falta clases extra puestas desde JS. */
.mm-pf--motor .mm-pf-caso[data-pf-paso="0"] .mm-pf-paso:nth-child(-n+1),
.mm-pf--motor .mm-pf-caso[data-pf-paso="1"] .mm-pf-paso:nth-child(-n+2),
.mm-pf--motor .mm-pf-caso[data-pf-paso="2"] .mm-pf-paso:nth-child(-n+3),
.mm-pf--motor .mm-pf-caso[data-pf-paso="3"] .mm-pf-paso:nth-child(-n+4),
.mm-pf--motor .mm-pf-caso[data-pf-paso="4"] .mm-pf-paso:nth-child(-n+5),
.mm-pf--motor .mm-pf-caso[data-pf-paso="5"] .mm-pf-paso:nth-child(-n+6),
.mm-pf--motor .mm-pf-caso[data-pf-paso="6"] .mm-pf-paso:nth-child(-n+7) {
    opacity: 1;
    translate: 0 0;
}

.mm-pf--motor .mm-pf-caso[data-pf-paso="0"] .mm-pf-paso:nth-child(1)::before,
.mm-pf--motor .mm-pf-caso[data-pf-paso="1"] .mm-pf-paso:nth-child(2)::before,
.mm-pf--motor .mm-pf-caso[data-pf-paso="2"] .mm-pf-paso:nth-child(3)::before,
.mm-pf--motor .mm-pf-caso[data-pf-paso="3"] .mm-pf-paso:nth-child(4)::before,
.mm-pf--motor .mm-pf-caso[data-pf-paso="4"] .mm-pf-paso:nth-child(5)::before,
.mm-pf--motor .mm-pf-caso[data-pf-paso="5"] .mm-pf-paso:nth-child(6)::before,
.mm-pf--motor .mm-pf-caso[data-pf-paso="6"] .mm-pf-paso:nth-child(7)::before {
    background: var(--primary);
    border-color: var(--primary);
    color: #04121c;
    scale: 1.08;
}

.mm-pf--motor .mm-pf-paso:not(:last-child)::after {
    scale: 1 0;
    transition: scale .5s var(--ease-travel, cubic-bezier(.35,.35,.3,1)) .12s;
}

.mm-pf--motor .mm-pf-caso[data-pf-paso="0"] .mm-pf-paso:nth-child(-n+1)::after,
.mm-pf--motor .mm-pf-caso[data-pf-paso="1"] .mm-pf-paso:nth-child(-n+2)::after,
.mm-pf--motor .mm-pf-caso[data-pf-paso="2"] .mm-pf-paso:nth-child(-n+3)::after,
.mm-pf--motor .mm-pf-caso[data-pf-paso="3"] .mm-pf-paso:nth-child(-n+4)::after,
.mm-pf--motor .mm-pf-caso[data-pf-paso="4"] .mm-pf-paso:nth-child(-n+5)::after,
.mm-pf--motor .mm-pf-caso[data-pf-paso="5"] .mm-pf-paso:nth-child(-n+6)::after,
.mm-pf--motor .mm-pf-caso[data-pf-paso="6"] .mm-pf-paso:nth-child(-n+7)::after { scale: 1 1; }

/* UI conceptual: esquema de alambre, nunca una captura */
.mm-pf-ui {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding: 12px 13px;
    border: 1px dashed rgba(148, 163, 184, .22);
    border-radius: 10px;
    background: rgba(8, 13, 25, .5);
}

.mm-pf-ui i {
    display: block;
    height: 6px;
    border-radius: 3px;
    background: rgba(148, 163, 184, .16);
}

.mm-pf-ui i:nth-child(1) { width: 38%; background: rgba(6, 182, 212, .32); }
.mm-pf-ui i:nth-child(2) { width: 88%; }
.mm-pf-ui i:nth-child(3) { width: 64%; }

.mm-pf-ui__pie {
    margin-top: 4px;
    font-size: .66rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #5b6b80;
}

.mm-pf-caso__cierre {
    margin: 46px 0 0;
    padding: 26px 30px;
    border: 1px solid var(--pf-linea);
    border-left: 2px solid var(--primary);
    border-radius: 0 var(--pf-radio) var(--pf-radio) 0;
    background: var(--pf-panel);
    font-size: clamp(1.1rem, .95rem + .6vw, 1.42rem);
    font-weight: 600;
    line-height: 1.38;
    color: var(--text-primary);
}

.mm-pf--motor .mm-pf-caso__cierre {
    opacity: 0;
    translate: 0 14px;
    transition: opacity .6s var(--mm-ease), translate .6s var(--mm-ease);
}

.mm-pf--motor .mm-pf-caso__cierre.is-visible { opacity: 1; translate: 0 0; }

/* ============================================
   LOOPS 5 y 6 — ENTRADA PROPIA DE CADA CAPÍTULO
   ============================================ */

.mm-pf-cap { padding: 0 0 96px; background: var(--background); }
.mm-pf-cap--alt { background: linear-gradient(180deg, var(--background) 0%, #060D1C 50%, var(--background) 100%); }

/* Antesala: pantalla oscura con las dos frases */
.mm-pf-ante {
    display: flex;
    align-items: center;
    min-height: 74vh;
    padding: 70px 0;
}

.mm-pf-ante__t {
    margin: 0;
    max-width: 20ch;
    font-size: clamp(1.5rem, 1rem + 2.1vw, 2.7rem);
    font-weight: 600;
    line-height: 1.16;
    letter-spacing: -.024em;
    color: var(--text-primary);
}

.mm-pf-ante__t em {
    display: block;
    margin-top: .25em;
    font-style: normal;
    color: var(--text-muted);
}

.mm-pf--motor .mm-pf-ante__t span { animation: pf-sube .8s var(--mm-ease) both; }
.mm-pf--motor .mm-pf-ante__t em  { animation: pf-sube .8s var(--mm-ease) .22s both; }

.mm-pf-cap__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: center;
}

.mm-pf-cap--alt .mm-pf-cap__media { order: -1; }

.mm-pf-cap__media {
    margin: 0;
    border: 1px solid var(--pf-linea);
    border-radius: var(--pf-radio);
    overflow: hidden;
    background: #0b1222;
}

.mm-pf-cap__media img {
    display: block;
    width: 100%;
    height: auto;
}

/* La imagen entra con mask + escala, una sola vez */
@keyframes pf-media {
    from { clip-path: inset(8% 10% 12% 10% round var(--pf-radio)); opacity: .35; scale: 1.04; }
    to   { clip-path: inset(0 0 0 0 round var(--pf-radio)); opacity: 1; scale: 1; }
}

.mm-pf--motor .mm-pf-cap__media.is-visible {
    animation: pf-media .95s var(--ease-out-premium, cubic-bezier(.16,1,.3,1)) both;
}

.mm-pf-cap__t {
    margin: 0 0 14px;
    font-size: clamp(1.35rem, 1rem + 1.1vw, 1.9rem);
    font-weight: 700;
    line-height: 1.16;
    letter-spacing: -.02em;
    color: var(--text-primary);
}

.mm-pf-cap__p {
    margin: 0 0 16px;
    font-size: 1rem;
    line-height: 1.62;
    color: var(--text-secondary);
}

.mm-pf-cap__p:last-of-type { margin-bottom: 22px; }

.mm-pf-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 0 0 24px;
    padding: 0;
    list-style: none;
}

.mm-pf-kpis li {
    padding: 14px 15px;
    border: 1px solid var(--pf-linea);
    border-radius: 13px;
    background: var(--pf-panel);
}

.mm-pf-kpis b {
    display: block;
    margin-bottom: 5px;
    font-size: .95rem;
    font-weight: 700;
    color: var(--primary);
}

.mm-pf-kpis span { font-size: .78rem; line-height: 1.4; color: var(--text-muted); }

/* Diagrama de la integración: plataforma ↔ API ↔ sitio */
.mm-pf-puentes {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    margin: 0 0 22px;
    padding: 18px 16px;
    border: 1px solid var(--pf-linea);
    border-radius: 14px;
    background: var(--pf-panel);
}

.mm-pf-puentes b {
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    text-align: center;
    color: var(--text-secondary);
}

.mm-pf-puentes i {
    display: block;
    width: 100%;
    min-width: 26px;
    height: 1px;
    background: var(--primary);
    transform-origin: left center;
}

.mm-pf--motor .mm-pf-puentes i { scale: 0 1; transition: scale .6s var(--ease-travel, cubic-bezier(.35,.35,.3,1)); }
.mm-pf--motor .mm-pf-puentes.is-visible i { scale: 1 1; }
.mm-pf--motor .mm-pf-puentes.is-visible i:nth-of-type(2) { transition-delay: .18s; }

.mm-pf-ver {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: .97rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: gap .25s var(--mm-shell-ease), color .25s var(--mm-shell-ease);
}

.mm-pf-ver::after { content: "→"; color: var(--primary); }
.mm-pf-ver:hover, .mm-pf-ver:focus-visible { gap: 14px; color: var(--primary); }

/* ============================================
   LOOP 8 — INDICADOR DE CAPÍTULOS
   ============================================ */

.mm-pf-indice {
    position: fixed;
    left: 26px;
    top: 50%;
    translate: 0 -50%;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 13px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mm-pf-indice a {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--text-muted);
    text-decoration: none;
    opacity: .5;
    transition: opacity .3s var(--mm-shell-ease), color .3s var(--mm-shell-ease);
}

.mm-pf-indice a::before {
    content: "";
    width: 14px;
    height: 1px;
    background: currentColor;
    transition: width .3s var(--mm-shell-ease);
}

.mm-pf-indice a.es-activo,
.mm-pf-indice a:hover,
.mm-pf-indice a:focus-visible {
    opacity: 1;
    color: var(--primary);
}

.mm-pf-indice a.es-activo::before { width: 26px; }

.mm-pf-indice__txt {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width .3s var(--mm-shell-ease);
}

.mm-pf-indice a.es-activo .mm-pf-indice__txt,
.mm-pf-indice a:hover .mm-pf-indice__txt { max-width: 140px; }

/* Sin motor no aporta nada: se oculta */
.mm-pf:not(.mm-pf--motor) .mm-pf-indice { display: none; }

/* ============================================
   LOOP 9 — ENTRADA AL ARCHIVO
   ============================================ */

.mm-pf-mas { padding: 80px 0 0; background: var(--background); }

.mm-pf-mas__t {
    margin: 0 0 10px;
    font-size: clamp(1.5rem, 1.1rem + 1.3vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text-primary);
}

.mm-pf-mas__p {
    margin: 0;
    max-width: 52ch;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* ============================================
   LOOP 10 — CIERRE
   ============================================ */

.mm-pf-fin {
    padding: 104px 0 110px;
    text-align: center;
    background:
        radial-gradient(760px circle at 50% 112%, rgba(6, 182, 212, .13), transparent 62%),
        var(--background);
    border-top: 1px solid var(--pf-linea);
}

.mm-pf-fin__h2 {
    margin: 0 auto 30px;
    max-width: 17ch;
    font-size: clamp(1.9rem, 1.1rem + 3vw, 3.5rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -.03em;
    color: var(--text-primary);
}

.mm-pf-fin__palabra {
    display: inline-block;
    min-width: 9ch;
    color: var(--primary);
}

.mm-pf-fin__cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    border-radius: 13px;
    font-size: 1.02rem;
    font-weight: 600;
    text-decoration: none;
    background: var(--mm-cta);
    color: var(--mm-cta-texto);
    transition: background-color .22s var(--mm-shell-ease), transform .22s var(--mm-shell-ease);
}

.mm-pf-fin__cta:hover {
    background: var(--mm-cta-hover);
    color: var(--mm-cta-texto);
    transform: translateY(-1px);
}

.mm-pf-fin__cta:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.mm-pf-fin__firma {
    margin: 34px 0 0;
    font-size: .82rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ============================================
   LOOP 11 — MOBILE
   Capítulos verticales. Se apaga el sticky y se bajan las alturas: nada de
   secciones de 220vh en un teléfono.
   ============================================ */

@media (max-width: 1199px) {
    .mm-pf-indice { display: none; }
    .mm-pf-caos__fijo { gap: 40px; }
    .mm-pf-caso__grid { gap: 44px; }
    .mm-pf-cap__grid { gap: 40px; }
}

@media (max-width: 1023px) {
    .mm-pf__ancho { width: min(100% - 40px, var(--pf-max)); }

    /* Apertura: deja de ser alta y sticky */
    .mm-pf-abre { height: auto; }
    .mm-pf-abre__fijo {
        position: static;
        min-height: auto;
        padding: 112px 0 72px;
    }
    .mm-pf-abre__haz { display: none; }

    /* El problema pasa a ser lectura vertical: frases apiladas y mapa fijo
       en su estado final conectado. */
    .mm-pf-caos { height: auto; }
    .mm-pf-caos__fijo {
        position: static;
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 72px 0;
    }
    .mm-pf--motor .mm-pf-caos__frases li {
        position: static;
        opacity: 1;
        translate: none;
    }
    .mm-pf--motor .mm-pf-caos__frases li + li { margin-top: 14px; }
    .mm-pf-caos__frases { min-height: 0; }
    .mm-pf--motor .mm-pf-bloque { translate: none; }
    .mm-pf--motor .mm-pf-area,
    .mm-pf--motor .mm-pf-nodo { opacity: 1; scale: 1; }
    .mm-pf--motor .mm-pf-mapa__svg path { stroke-dashoffset: 0; }

    .mm-pf-caso__fijo { position: static; }
    .mm-pf-caso__grid, .mm-pf-cap__grid { grid-template-columns: 1fr; gap: 36px; }
    .mm-pf-cap--alt .mm-pf-cap__media { order: 0; }

    /* En una columna los pasos no se atenúan: se leen todos */
    .mm-pf--motor .mm-pf-paso { opacity: 1; translate: none; }
    .mm-pf--motor .mm-pf-paso:not(:last-child)::after { scale: 1 1; }

    .mm-pf-ante { min-height: auto; padding: 56px 0; }
    .mm-pf-caso { padding: 20px 0 80px; }
    .mm-pf-cap { padding: 0 0 72px; }
    .mm-pf-mas { padding: 64px 0 0; }
    .mm-pf-fin { padding: 80px 0 86px; }
    .mm-pf-puente__hilo { height: 64px; }
}

@media (max-width: 767px) {
    .mm-pf__ancho { width: min(100% - 32px, var(--pf-max)); }
    .mm-pf-kpis { grid-template-columns: 1fr; }
    .mm-pf-paso { padding-left: 46px; }
    .mm-pf-paso::before { width: 30px; height: 30px; }
    .mm-pf-paso:not(:last-child)::after { left: 15px; top: 36px; }
    .mm-pf-caso__cierre { padding: 20px 22px; }
    .mm-pf-mapa { aspect-ratio: 1 / 1.05; }
    .mm-pf-bloque { font-size: .66rem; padding: 8px 10px; }
    .mm-pf-nodo { width: 104px; height: 104px; }
    .mm-pf-puentes { grid-template-columns: 1fr; gap: 8px; }
    .mm-pf-puentes i { width: 1px; height: 18px; margin: 0 auto; }
    .mm-pf--motor .mm-pf-puentes i,
    .mm-pf--motor .mm-pf-puentes.is-visible i { scale: 1 1; }
}

@media (max-width: 389px) {
    .mm-pf__ancho { width: min(100% - 24px, var(--pf-max)); }
}
