/* TCL — NXTPAPER, la pantalla que se lee como el papel.
   Una página que primero se ve como en una pantalla brillante (fría y con reflejos) y, al bajar, pasa por los tres
   modos de la tecla NXTPAPER: Color Paper (mate, cálida y de color suave), Ink Paper (blanco y negro) y Max Ink
   (más contraste y solo lo básico). --q (0 → 1) es el avance: en escritorio, el de la portada fijada (--p); en
   móvil, una animación que se reproduce sola. Cada cambio de modo es rápido, como al pulsar la tecla. */

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

.cv--tcl {
    --q: var(--p);
    /* Modos: Color Paper hacia 0,2; Ink Paper hacia 0,44; Max Ink hacia 0,68 */
    --m1: clamp(0, (var(--q) - 0.18) / 0.05, 1);
    --m2: clamp(0, (var(--q) - 0.42) / 0.05, 1);
    --m3: clamp(0, (var(--q) - 0.66) / 0.05, 1);
    --tc-red: #e30613;
    --tc-ink: #1f1e1c;
    --tc-mute: #8a857c;
    --tc-desk: #dedad2;
    --cv-bg: var(--tc-desk);
    --cv-ink: var(--tc-ink);
    --cv-muted: #5e5a54;
    --cv-hint: #5e5a54;
    --cv-accent: var(--tc-red);
    --cv-font-display: 'Schibsted Grotesk', system-ui, sans-serif;
    --cv-font-body: 'Schibsted Grotesk', system-ui, sans-serif;
    color: var(--tc-ink);
    background:
        radial-gradient(60% 70% at 72% 40%, rgba(255, 252, 244, 0.85), rgba(255, 252, 244, 0) 70%),
        var(--tc-desk);
}

.cv--tcl ::selection {
    color: #ffffff;
    background: var(--tc-red);
}

/* La portada no se desvanece al bajar: Max Ink, el último modo, se lee con todo el texto */
.cv--tcl .cv__stage {
    width: min(1180px, 100%);
    justify-items: stretch;
    text-align: left;
}

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

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

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

.cv-tc-kicker {
    margin: 0;
    font-size: clamp(0.78rem, 0.9vw, 0.88rem);
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--tc-red);
}

.cv--tcl .cv__title {
    margin-top: 6px;
    font-size: clamp(4.6rem, min(12vw, 21vh), 10rem);
    font-weight: 800;
    line-height: 0.85;
    letter-spacing: -0.03em;
}

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

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

.cv-tc-line {
    margin: clamp(12px, 2vh, 20px) 0 0;
    max-width: 18ch;
    font-size: clamp(1.5rem, 2.6vw, 2.4rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.cv--tcl .cv__lead {
    max-width: 42ch;
    margin-top: 12px;
    font-size: clamp(0.98rem, 1.15vw, 1.08rem);
    font-weight: 400;
    color: #3b3833;
}

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

.cv--tcl .cv__meta {
    margin: 0;
}

/* —— La página y la tecla —— */
.cv-tc-reader {
    --row: 34px;
    display: flex;
    align-items: flex-end;
    gap: clamp(16px, 2vw, 28px);
    margin: 0;
}

/* Fría y con reflejos en la pantalla brillante; mate, cálida y con grano de papel desde Color Paper;
   sin color en Ink Paper y con más contraste en Max Ink */
.cv-tc-page {
    --page-w: clamp(260px, 25vw, 360px);
    position: relative;
    width: var(--page-w);
    aspect-ratio: 5 / 7;
    padding: calc(var(--page-w) * 0.1) calc(var(--page-w) * 0.09);
    overflow: hidden;
    color: color-mix(in srgb, #000000 calc(var(--m3) * 100%), var(--tc-ink));
    background: color-mix(in srgb, #efe8d9 calc(var(--m1) * 100%), #e9eef5);
    border-radius: 6px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 24px 50px -24px rgba(40, 30, 10, 0.45);
    filter: saturate(calc(1 - var(--m1) * 0.35 - var(--m2) * 0.65)) contrast(calc(1 + var(--m3) * 0.15));
}

.cv-tc-grain,
.cv-tc-glare {
    position: absolute;
    pointer-events: none;
}

.cv-tc-grain {
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.22 0 0 0 0.4 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
    opacity: calc(var(--m1) * 0.55);
}

/* Reflejos de una pantalla brillante: se van al pasar a NXTPAPER */
.cv-tc-glare {
    inset: -10%;
    background:
        linear-gradient(118deg, rgba(255, 255, 255, 0) 20%, rgba(110, 130, 160, 0.16) 24%, rgba(255, 255, 255, 0.95) 27%, rgba(255, 255, 255, 0) 34%),
        linear-gradient(118deg, rgba(255, 255, 255, 0) 52%, rgba(110, 130, 160, 0.12) 55%, rgba(255, 255, 255, 0.7) 57%, rgba(255, 255, 255, 0) 62%),
        linear-gradient(180deg, rgba(160, 180, 210, 0.22), rgba(160, 180, 210, 0) 50%);
    opacity: calc(1 - var(--m1));
}

.cv-tc-ribbon {
    position: absolute;
    top: 0;
    right: 13%;
    width: calc(var(--page-w) * 0.05);
    height: calc(var(--page-w) * 0.15);
    background: var(--tc-red);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}

.cv-tc-chapter {
    position: relative;
    margin: 0 0 1.2em;
    font-size: calc(var(--page-w) * 0.03);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.6;
}

.cv-tc-text {
    position: relative;
    margin: 0;
    font-family: 'Literata', Georgia, serif;
    font-size: calc(var(--page-w) * 0.047);
    font-weight: 400;
    line-height: 1.58;
}

/* Segundo párrafo, con sangría de libro */
.cv-tc-text--more {
    text-indent: 1.4em;
}

/* Capitular en rojo, solo en el primer párrafo: el color que se apaga en Ink Paper */
.cv-tc-text:not(.cv-tc-text--more)::first-letter {
    float: left;
    margin: 0.06em 0.1em 0 0;
    font-size: 3.3em;
    font-weight: 600;
    line-height: 0.8;
    color: var(--tc-red);
}

.cv-tc-maxink {
    position: absolute;
    right: 9%;
    bottom: 7%;
    left: 9%;
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid currentColor;
    font-size: calc(var(--page-w) * 0.033);
    font-weight: 700;
    line-height: 1.3;
    opacity: var(--m3);
}

/* La tecla: el modo activo, marcado en rojo */
.cv-tc-key {
    display: grid;
    gap: 10px;
    width: clamp(150px, 13vw, 190px);
    padding-bottom: 4px;
}

.cv-tc-modes {
    --s: calc(var(--m1) + var(--m2) + var(--m3));
    position: relative;
    margin: 0;
    padding: 0 0 0 18px;
    list-style: none;
    font-size: clamp(0.86rem, 1vw, 0.95rem);
    font-weight: 600;
}

.cv-tc-modes::before {
    content: '';
    position: absolute;
    top: calc(var(--row) / 2 - 8px);
    left: 0;
    width: 6px;
    height: 16px;
    background: var(--tc-red);
    border-radius: 3px;
    transform: translateY(calc(var(--s) * var(--row)));
}

.cv-tc-modes li {
    --on: clamp(0, 1 - max(var(--s) - var(--i), var(--i) - var(--s)), 1);
    display: flex;
    align-items: center;
    height: var(--row);
    color: color-mix(in srgb, var(--tc-ink) calc(var(--on) * 100%), var(--tc-mute));
}

.cv-tc-modes li:nth-child(1) { --i: 0; border-bottom: 1px dashed rgba(31, 30, 28, 0.25); }
.cv-tc-modes li:nth-child(2) { --i: 1; }
.cv-tc-modes li:nth-child(3) { --i: 2; }
.cv-tc-modes li:nth-child(4) { --i: 3; }

.cv-tc-note {
    margin: 0;
    padding-left: 18px;
    font-size: 0.74rem;
    line-height: 1.35;
    color: var(--tc-mute);
}

/* —— Móvil: los modos cambian solos —— */
@media (max-width: 900px) {
    .cv--tcl {
        --q: 0;
        animation: cv-tc-run 7s linear 1.6s both;
    }

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

    .cv--tcl .cv__title {
        font-size: clamp(3.6rem, 20vw, 5.4rem);
    }

    .cv-tc-line {
        max-width: none;
        font-size: clamp(1.3rem, 6vw, 1.7rem);
    }

    .cv--tcl .cv__lead {
        font-size: 0.95rem;
    }

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

    .cv-tc-reader {
        --row: 28px;
        gap: 14px;
    }

    .cv-tc-page {
        --page-w: min(54vw, 220px);
    }

    /* En la página pequeña solo cabe el primer párrafo sin pisar el aviso de Max Ink */
    .cv-tc-text--more {
        display: none;
    }

    .cv-tc-key {
        width: auto;
        flex: 1;
    }

    .cv-tc-modes {
        font-size: 0.8rem;
    }
}

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

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

    /* Directamente en Max Ink */
    .cv--tcl {
        --q: 1;
    }
}
