/* ============================================
   EFICARIA v2 — Home scroll-scrub
   ============================================ */

html:has(body.page-v2) {
    scroll-behavior: auto;
    scroll-padding-top: 0;
}

.page-v2 {
    --v2-brand: #2582d1;
    --v2-brand-deep: #146cad;
    --v2-ink: #1a2b3c;
    --v2-muted: #5a6b7c;
    --v2-stage-offset: var(--header-height);
    --font-display: 'Michroma', var(--font-sans);
}

.page-v2 .header {
    background: rgba(255, 255, 255, 0.88);
}

.page-v2 .header.is-scrolled {
    background: rgba(255, 255, 255, 0.96);
}

.page-v2 .nav__badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--v2-brand);
    background: rgba(37, 130, 209, 0.1);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    margin-left: 0.5rem;
}

/* ---------- Scroll sections base ---------- */
.scroll-section {
    position: relative;
}

.scroll-section__stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.scroll-section__stage::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -100%;
    height: 300%;
    z-index: 1;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill='%231a2b3c' fill-opacity='0.04'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.37L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.63V49h-2z'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 80px 140px;
    transform: translate3d(0, var(--pattern-shift, 0px), 0);
    will-change: transform;
}

.scroll-section--services .scroll-section__stage::before,
.scroll-section--clients .scroll-section__stage::before,
.scroll-section--sectors .scroll-section__stage::before,
.scroll-section--contact .scroll-section__stage::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.37L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.63V49h-2z'/%3E%3C/g%3E%3C/svg%3E");
}

.scroll-section__inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: calc(var(--header-height) + 1rem) 1.5rem 2rem;
}

.scroll-hint {
    position: absolute;
    bottom: 4vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #3d4f61;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 5;
}

.scroll-hint svg {
    animation: v2-bob 1.8s ease-in-out infinite;
}

@keyframes v2-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

.scroll-progress {
    position: fixed;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.scroll-progress__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(20, 108, 173, 0.2);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease;
}

.scroll-progress__dot.is-active {
    background: var(--v2-brand);
    transform: scale(1.35);
}

.scroll-progress__dot:hover {
    background: var(--v2-brand-deep);
}

/* ---------- Typewriter titles ---------- */
.typewriter-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.8rem, 4vw, 2.75rem);
    line-height: 1.25;
    min-height: 1.25em;
    letter-spacing: 0.01em;
    text-transform: none;
}

.typewriter-title::after {
    content: '▋';
    display: inline-block;
    margin-left: 3px;
    color: var(--v2-brand);
    animation: v2-cursor-blink 0.85s step-end infinite;
    font-weight: 400;
}

.typewriter-title.is-done::after,
.typewriter-title.is-idle::after {
    opacity: 0;
    animation: none;
}

.typewriter-title--light {
    color: #fff;
}

.typewriter-title--light::after {
    color: rgba(255, 255, 255, 0.85);
}

@keyframes v2-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.section-header-v2 {
    text-align: center;
    max-width: 820px;
    margin: 0 auto 2rem;
    opacity: 0;
    transform: translateY(24px);
    will-change: transform, opacity;
}

.section-header-v2 .eyebrow {
    display: inline-block;
    margin-bottom: 0.85rem;
}

.section-header-v2 p {
    margin-top: 1rem;
    font-size: 1.05rem;
}

.section-header-v2--light .eyebrow {
    color: rgba(255, 255, 255, 0.9);
}

.section-header-v2--light h2,
.section-header-v2--light p {
    color: #fff;
}

.section-header-v2--light p {
    color: rgba(255, 255, 255, 0.82);
}

.scroll-hint--light {
    color: rgba(255, 255, 255, 0.88);
}

/* ---------- Hero / Excel ---------- */
.scroll-section--hero {
    background: var(--color-bg-soft);
}

.scroll-section--hero .scroll-section__stage {
    align-items: stretch;
}

.hero-v2__media {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-v2__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-v2__overlay {
    position: absolute;
    inset: 0;
    background: #ffffffd4;
}

.scroll-section--hero .scroll-section__inner {
    position: relative;
    z-index: 2;
}

.scroll-section--hero .scroll-hint {
    z-index: 6;
}

.hero-v2__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
    min-height: calc(100vh - var(--header-height) - 2rem);
    min-height: calc(100dvh - var(--header-height) - 2rem);
}

.hero-v2__content {
    opacity: 1;
    transform: none;
}

.hero-v2__eyebrow {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--v2-brand);
    margin-bottom: 1rem;
}

.hero-v2__title {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 400;
    color: var(--v2-ink);
    margin-bottom: 0.75rem;
    line-height: 1.15;
    letter-spacing: 0.01em;
}

.hero-v2__subtitle {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--color-dark);
    margin-bottom: 1rem;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.hero-v2__lead {
    font-size: 1.05rem;
    max-width: 42ch;
    margin-bottom: 2rem;
}

.hero-v2__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.hero-v2__reveal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 0 5%;
    opacity: 0;
    transform: translateY(24px);
    will-change: transform, opacity;
}

.hero-v2__reveal-box {
    background: var(--v2-brand);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 3.5vw, 2.5rem) clamp(1.75rem, 4vw, 2.75rem);
    box-shadow: 0 16px 48px rgba(37, 130, 209, 0.35);
    text-align: center;
    max-width: 96%;
    transform: rotate(2.5deg);
}

.hero-v2__reveal h2,
.hero-v2__reveal-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.25rem, 3vw, 2rem);
    color: #fff;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.hero-v2__reveal-highlight {
    display: inline-block;
    margin-top: 0.45rem;
    padding: 0.2em 0.65em;
    background: #111827;
    color: #fff;
    font-size: 0.88em;
    line-height: 1.3;
    border-radius: 6px;
    transform: rotate(-1deg);
}

.hero-v2__reveal p {
    margin-top: 0.85rem;
    font-size: clamp(0.82rem, 1.4vw, 0.95rem);
    color: rgba(255, 255, 255, 0.88);
    max-width: 34ch;
    margin-inline: auto;
}

.hero-v2__canvas-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 920 / 600;
    max-height: min(72vh, 560px);
    margin-inline: auto;
    overflow: visible;
}

.hero-v2__canvas-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ---------- Servicios ---------- */
.scroll-section--services {
    background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-darker) 100%);
    color: #fff;
}

.scroll-section--services .section-header-v2 {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 2rem;
}

.scroll-section--services .section-header-v2 .eyebrow {
    color: rgba(255, 255, 255, 0.9);
}

.scroll-section--services .section-header-v2 h2,
.scroll-section--services .section-header-v2 p {
    color: #fff;
}

.scroll-section--services .section-header-v2 p {
    color: rgba(255, 255, 255, 0.82);
}

.scroll-section--services .typewriter-title::after {
    color: rgba(255, 255, 255, 0.9);
}

.services-v2__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.service-v2 {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    opacity: 0;
    transform: translateY(40px) scale(0.96);
    will-change: transform, opacity;
}

.service-v2 h3 {
    color: #fff;
    font-size: 1.05rem;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.service-v2 h3 i {
    color: var(--v2-brand);
    font-size: 0.95rem;
}

.service-v2 p {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.92rem;
    line-height: 1.55;
}

/* ---------- SaaS ---------- */
.scroll-section--saas {
    background: var(--color-bg-soft);
}

.saas-v2__wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
}

.saas-v2__content {
    opacity: 0;
    transform: translateY(30px);
    will-change: transform, opacity;
}

.saas-v2__content h2 {
    margin: 1rem 0 1.1rem;
}

.saas-v2__content p {
    font-size: 1rem;
    margin-bottom: 1.25rem;
}

.scroll-section--saas-alt {
    background: #fff;
}

.saas-v2__media {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
    will-change: transform, opacity;
    min-height: 320px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-darkest);
    box-shadow: 0 18px 40px rgba(10, 60, 97, 0.12);
}

.saas-v2__media img {
    width: 100%;
    height: 100%;
    min-height: 320px;
    object-fit: cover;
    object-position: center;
    display: block;
}

.saas-v2__media-img--motion {
    object-position: center 18%;
}

/* ---------- Proceso ---------- */
.scroll-section--process {
    background: var(--color-bg-soft);
}

.process-v2__track {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.process-v2__track::before {
    content: '';
    position: absolute;
    top: 2rem;
    left: 10%;
    right: 10%;
    height: 3px;
    background: var(--color-border);
    border-radius: 999px;
    z-index: 0;
}

.process-v2__fill {
    position: absolute;
    top: 2rem;
    left: 10%;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--v2-brand), var(--v2-brand-deep));
    border-radius: 999px;
    z-index: 1;
    transition: none;
}

.process-v2__step {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0.35;
    transform: translateY(16px);
    will-change: transform, opacity;
}

.process-v2__step.is-active {
    opacity: 1;
}

.process-v2__num {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--color-border);
    font-weight: 700;
    font-size: 1rem;
    color: var(--v2-muted);
    transition: border-color 0.3s, color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.process-v2__step.is-active .process-v2__num {
    border-color: var(--v2-brand);
    color: var(--v2-brand-deep);
    box-shadow: 0 8px 24px rgba(37, 130, 209, 0.25);
    transform: scale(1.08);
}

.process-v2__step h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--v2-ink);
}

.process-v2__step p {
    font-size: 0.82rem;
    line-height: 1.45;
    max-width: 18ch;
    margin-inline: auto;
}

/* ---------- Clientes ---------- */
.scroll-section--clients {
    background: var(--color-darkest);
    color: #fff;
}

.trust-logos--v2 {
    margin-top: 0.5rem;
}

.trust-logos--v2 .trust-logo-slide {
    opacity: 0;
    transform: translateY(24px) scale(0.94);
    will-change: transform, opacity;
}

/* ---------- Stack ---------- */
.scroll-section--stack {
    background: #fff;
}

.stack-grid--v2 .stack-item {
    opacity: 0;
    transform: translateY(28px) scale(0.92);
    will-change: transform, opacity;
}

/* ---------- Sectores ---------- */
.scroll-section--sectors {
    background: linear-gradient(135deg, var(--color-light) 0%, var(--color-dark) 100%);
    color: #fff;
}

.sectors-grid--v2 .sector {
    opacity: 0;
    transform: translateY(28px);
    will-change: transform, opacity;
}

.sectors-grid--v2 .sector h3,
.sectors-grid--v2 .sector p {
    color: #fff;
}

.sectors-grid--v2 .sector p {
    color: rgba(255, 255, 255, 0.85);
}

/* ---------- Testimonios ---------- */
.scroll-section--reviews {
    background: var(--color-bg-soft);
}

.carousel--v2 {
    opacity: 0;
    transform: translateY(32px);
    will-change: transform, opacity;
}

.carousel--v2 .review-card {
    min-height: 280px;
}

/* ---------- Contacto ---------- */
.scroll-section--contact {
    background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-darkest) 100%);
    color: #fff;
}

.contact-v2__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: clamp(2rem, 4vw, 3.5rem);
    align-items: center;
    width: 100%;
}

.contact-v2__top {
    text-align: left;
    max-width: none;
    margin: 0;
    opacity: 0;
    transform: translateY(24px);
    will-change: transform, opacity;
}

.contact-v2__top .typewriter-title {
    text-align: left;
}

.contact-v2__top p {
    color: rgba(255, 255, 255, 0.82);
    font-size: 1.05rem;
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(20px);
    will-change: transform, opacity;
}

.contact-form--v2 {
    max-width: none;
    margin: 0;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 3vw, 2.25rem);
    box-shadow: var(--shadow-lg);
    color: var(--color-text);
    text-align: left;
    opacity: 0;
    transform: translateY(24px);
    will-change: transform, opacity;
}

.scroll-section__inner--contact {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - 2rem);
    min-height: calc(100dvh - var(--header-height) - 2rem);
}

.page-v2 .footer {
    position: relative;
    z-index: 2;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .services-v2__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .saas-v2__wrap {
        grid-template-columns: 1fr;
    }

    .saas-v2__media,
    .saas-v2__media img {
        min-height: 280px;
    }

    .process-v2__track {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        max-width: 420px;
        margin-inline: auto;
    }

    .process-v2__track::before,
    .process-v2__fill {
        display: none;
    }

    .process-v2__step {
        text-align: left;
        display: grid;
        grid-template-columns: 4rem 1fr;
        gap: 1rem;
        align-items: start;
    }

    .process-v2__num {
        margin: 0;
    }

    .process-v2__step p {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .scroll-progress {
        display: none;
    }

    .scroll-section__stage {
        align-items: flex-start;
        overflow: hidden;
        overscroll-behavior: contain;
    }

    .scroll-section__stage.is-inner-scroll {
        box-shadow: inset 0 -12px 16px -12px rgba(20, 108, 173, 0.12);
    }

    .scroll-section__inner {
        padding-top: calc(var(--header-height) + 1.5rem);
        padding-bottom: 4rem;
        flex-shrink: 0;
    }

    .scroll-section--hero .scroll-section__inner {
        padding-top: calc(var(--header-height) + 1.25rem);
        padding-bottom: 0.35rem;
    }

    .hero-v2__grid {
        grid-template-columns: 1fr;
        min-height: auto;
        gap: 1rem;
    }

    .hero-v2__canvas-wrap {
        display: none !important;
    }

    .scroll-section--hero,
    .scroll-section--clients {
        height: auto !important;
        min-height: 0;
    }

    .scroll-section--hero .scroll-section__stage,
    .scroll-section--clients .scroll-section__stage {
        position: relative;
        height: auto;
        min-height: 0;
        overflow: visible;
        flex-direction: column;
        align-items: stretch;
    }

    .scroll-section--hero .scroll-hint,
    .scroll-section--clients .scroll-hint {
        position: relative;
        left: auto;
        bottom: auto;
        transform: none;
        margin: 0.15rem auto 1rem;
        align-self: center;
        width: max-content;
        flex: none;
    }

    .hero-v2__title {
        font-size: clamp(1.85rem, 8vw, 2.8rem);
    }

    .hero-v2__subtitle {
        font-size: clamp(1.25rem, 5vw, 1.8rem);
    }

    .hero-v2__lead {
        font-size: 0.98rem;
        margin-bottom: 1.25rem;
    }

    .hero-v2__actions {
        gap: 0.65rem;
    }

    .hero-v2__actions .btn--lg {
        width: 100%;
    }

    .section-header-v2 {
        margin-bottom: 1.25rem;
    }

    .section-header-v2 p {
        font-size: 0.95rem;
    }

    .typewriter-title {
        font-size: clamp(1.35rem, 6vw, 1.85rem);
    }

    .services-v2__grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .service-v2 {
        padding: 1.15rem;
    }

    .service-v2--hide-mobile {
        display: none;
    }

    .saas-v2__content h2 {
        margin-top: 0.5rem;
    }

    .saas-v2__media,
    .saas-v2__media img {
        min-height: 220px;
    }

    .process-v2__step h3 {
        font-size: 0.92rem;
    }

    .trust-logos--v2 {
        gap: 0.75rem;
    }

    .stack-grid--v2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sectors-grid--v2 {
        grid-template-columns: 1fr;
    }

    .carousel--v2 .review-card {
        min-height: auto;
    }

    .contact-v2__layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .contact-v2__top {
        text-align: center;
    }

    .contact-v2__top .typewriter-title {
        text-align: center;
    }

    .contact-form--v2 {
        padding: 1.35rem;
    }

    .contact-form--v2 .form-row {
        grid-template-columns: 1fr;
    }

    .scroll-hint {
        bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
        font-size: 0.75rem;
        z-index: 6;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-section__stage::before {
        transform: none;
        will-change: auto;
    }

    .scroll-hint svg {
        animation: none;
    }

    .hero-v2__content,
    .hero-v2__reveal,
    .service-v2,
    .process-v2__step,
    .contact-v2__top,
    .contact-v2__top p,
    .contact-form--v2,
    .saas-v2__content,
    .saas-v2__media,
    .carousel--v2,
    .trust-logos--v2 .trust-logo-slide,
    .stack-grid--v2 .stack-item,
    .sectors-grid--v2 .sector {
        will-change: auto;
    }
}
