/* POCO — «todo lo que necesitas, nada que no necesites».
   El lema de la marca con la ficha de su primer móvil, el Pocophone F1 (2018): lo que llevaba, mezclado con lo que
   llevaban los móviles caros de entonces y él dejó fuera. --q (0 → 1) es el avance: en escritorio, el de la portada
   fijada (--p); en móvil, una animación que se reproduce sola. Se tacha lo que sobra, la ficha se recoge, se marca
   lo que queda y aparece el precio. */

@property --q {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
}

.cv--poco {
    --q: var(--p);
    /* La ficha se recoge entre 0,5 y 0,62, suave al empezar y al acabar */
    --c0: clamp(0, (var(--q) - 0.5) / 0.12, 1);
    --c: calc(var(--c0) * var(--c0) * (3 - 2 * var(--c0)));
    /* El precio, al final */
    --price: clamp(0, (var(--q) - 0.82) / 0.08, 1);
    --pc-yellow: #ffe100;
    --pc-ink: #111111;
    --pc-muted: #4a4000;
    --cv-bg: var(--pc-yellow);
    --cv-ink: var(--pc-ink);
    --cv-muted: var(--pc-muted);
    --cv-hint: var(--pc-muted);
    --cv-accent: var(--pc-ink);
    --cv-font-display: 'Archivo', system-ui, sans-serif;
    --cv-font-body: 'Archivo', system-ui, sans-serif;
    color: var(--pc-ink);
    background: var(--pc-yellow);
}

.cv--poco ::selection {
    color: var(--pc-yellow);
    background: var(--pc-ink);
}

/* La portada no se desvanece al bajar: la ficha recortada y el precio se leen con todo el texto */
.cv--poco .cv__stage {
    width: min(1180px, 100%);
    justify-items: stretch;
    text-align: left;
}

.cv--poco .cv__copy {
    width: 100%;
    align-items: stretch;
    opacity: 1;
    transform: none;
}

.cv-pc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    align-items: center;
    gap: clamp(32px, 6vw, 110px);
}

/* —— Nombre y lema —— */
.cv-pc-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.cv-pc-kicker {
    margin: 0;
    font-size: clamp(0.78rem, 0.9vw, 0.88rem);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.cv--poco .cv__title {
    margin-top: clamp(4px, 1vh, 10px);
    font-size: clamp(4.4rem, min(12vw, 21vh), 10.5rem);
    font-weight: 900;
    font-stretch: 125%;
    line-height: 0.82;
    letter-spacing: -0.03em;
}

.cv--poco .cv-ch {
    animation: cv-pc-letter 0.7s var(--cv-ease) both;
    animation-delay: calc((var(--d) + var(--i) * var(--step)) * 1ms);
}

@keyframes cv-pc-letter {
    from {
        opacity: 0;
        transform: translate3d(0, 0.18em, 0);
    }
}

.cv-pc-motto {
    margin: clamp(14px, 2.4vh, 26px) 0 0;
    max-width: 16ch;
    font-size: clamp(1.7rem, 3vw, 2.8rem);
    font-weight: 800;
    font-stretch: 87.5%;
    line-height: 1;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.cv--poco .cv__lead {
    max-width: 40ch;
    margin-top: clamp(12px, 2vh, 20px);
    font-size: clamp(1rem, 1.2vw, 1.12rem);
    font-weight: 500;
    line-height: 1.42;
    color: #2a2400;
    text-wrap: pretty;
}

.cv-pc-facts {
    margin-top: clamp(16px, 3vh, 30px);
}

.cv--poco .cv__meta {
    margin: 0;
    font-weight: 700;
    color: var(--pc-muted);
}

.cv--poco .cv__stats {
    color: var(--pc-muted);
}

.cv--poco .cv__stats strong {
    color: var(--pc-ink);
}

/* —— La ficha —— */
.cv-pc-sheet {
    --rh: clamp(40px, 6vh, 54px);
    position: relative;
    margin: 0;
    font-stretch: 87.5%;
}

.cv-pc-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 4px solid var(--pc-ink);
    font-size: clamp(0.8rem, 0.95vw, 0.92rem);
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.cv-pc-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cv-pc-row {
    display: flex;
    align-items: center;
    height: var(--rh);
    /* Sangría del rótulo negro: así su borde izquierdo cae en el de la ficha */
    padding-left: 0.3em;
    border-bottom: 1px solid rgba(17, 17, 17, 0.28);
    font-size: clamp(1.2rem, 1.9vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    /* Al recogerse la ficha, cada fila sube lo que ocupaban las tachadas de encima */
    translate: 0 calc(var(--above) * var(--rh) * var(--c) * -1);
}

/* Lo tachado se va antes de que la fila de debajo suba hasta su sitio */
.cv-pc-row--cut {
    opacity: calc(1 - min(1, var(--c) * 2.5));
}

.cv-pc-item {
    position: relative;
}

/* Lo que sobra: una raya gruesa que cruza el texto de izquierda a derecha */
.cv-pc-strike {
    position: absolute;
    left: -0.12em;
    right: -0.12em;
    top: 50%;
    height: 0.14em;
    margin-top: -0.07em;
    background: var(--pc-ink);
    transform-origin: 0 50%;
    transform: scaleX(clamp(0, (var(--q) - var(--t0)) / 0.06, 1));
}

/* Lo que queda: un rótulo negro con el texto en amarillo que se pinta de izquierda a derecha */
.cv-pc-hl {
    position: absolute;
    inset: -0.12em -0.3em;
    padding: 0.12em 0.3em;
    color: var(--pc-yellow);
    background: var(--pc-ink);
    clip-path: inset(0 calc((1 - clamp(0, (var(--q) - var(--t1)) / 0.04, 1)) * 100%) 0 0);
}

/* El precio ocupa el hueco que dejan las filas tachadas */
.cv-pc-price {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--rh) * 5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    opacity: var(--price);
    transform: scale(calc(1.18 - var(--price) * 0.18));
    transform-origin: 0 50%;
}

.cv-pc-price b {
    font-size: clamp(4rem, 8vw, 7.4rem);
    font-weight: 900;
    font-stretch: 112.5%;
    line-height: 0.9;
    letter-spacing: -0.035em;
    white-space: nowrap;
}

.cv-pc-price span {
    margin-top: 10px;
    font-size: clamp(0.78rem, 0.9vw, 0.88rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--pc-muted);
}

/* —— Móvil: la ficha se recorta sola —— */
@media (max-width: 900px) {
    .cv--poco {
        --q: 0;
        animation: cv-pc-run 8s linear 1.6s both;
    }

    .cv-pc-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .cv--poco .cv__title {
        font-size: clamp(3.6rem, 21vw, 5.6rem);
    }

    .cv-pc-motto {
        max-width: none;
        margin-top: 10px;
        font-size: clamp(1.35rem, 6.4vw, 1.9rem);
    }

    .cv--poco .cv__lead {
        margin-top: 8px;
        font-size: 0.95rem;
    }

    .cv-pc-facts {
        margin-top: 12px;
    }

    .cv-pc-sheet {
        --rh: 28px;
    }

    .cv-pc-head {
        padding-bottom: 6px;
        border-bottom-width: 3px;
    }

    .cv-pc-row {
        font-size: 1.05rem;
    }

    .cv-pc-price b {
        font-size: 3.4rem;
    }

    .cv-pc-price span {
        margin-top: 6px;
    }
}

@keyframes cv-pc-run {
    from { --q: 0; }
    to { --q: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .cv--poco,
    .cv--poco .cv-ch {
        animation: none;
    }

    /* Directamente la ficha recortada y el precio */
    .cv--poco {
        --q: 1;
    }
}
