/* =====================================================
   SERVICES.CSS
   Nueva página de servicios de ELANGIT.

   Concepto:
   - Una sola experiencia visual.
   - Sin bloques comerciales convencionales.
   - El usuario selecciona su problema.
   - El diagnóstico cambia sin recargar la página.
===================================================== */


/* =====================================================
   VARIABLES LOCALES
===================================================== */

:root {
    --services-bg: #020611;
    --services-blue: #00aeff;
    --services-violet: #7055ff;
    --services-white: #ffffff;
    --services-muted: rgba(255, 255, 255, 0.62);
    --services-border: rgba(255, 255, 255, 0.10);
}


/* =====================================================
   CONTENEDOR GENERAL
===================================================== */

.services-page {
    min-height: 100vh;
    background: var(--services-bg);
}

.services-diagnostic {
    position: relative;
    min-height: 100svh;
    overflow: hidden;
    isolation: isolate;
    background: var(--services-bg);
}


/* =====================================================
   FONDO DE VÍDEO
===================================================== */

.services-video-stage,
.services-video-overlay,
.services-video-grid,
.services-ambient-light {
    position: absolute;
    inset: 0;
}

.services-video-stage {
    z-index: -5;
}

.services-hero-video {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;
    opacity: 0;

    filter:
        saturate(0.70)
        contrast(1.10)
        brightness(0.40);

    transform: scale(1.025);
    transition: opacity 1.1s ease;
}

.services-hero-video.is-active {
    opacity: 1;
}

.services-video-overlay {
    z-index: -4;

    background:
        radial-gradient(
            circle at 72% 28%,
            rgba(0, 174, 255, 0.18),
            transparent 30%
        ),
        radial-gradient(
            circle at 25% 76%,
            rgba(112, 85, 255, 0.12),
            transparent 31%
        ),
        linear-gradient(
            90deg,
            rgba(2, 6, 17, 0.93) 0%,
            rgba(2, 6, 17, 0.78) 45%,
            rgba(2, 6, 17, 0.67) 100%
        ),
        linear-gradient(
            180deg,
            rgba(2, 6, 17, 0.54),
            rgba(2, 6, 17, 0.90)
        );
}

.services-video-grid {
    z-index: -3;

    background:
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.020) 1px,
            transparent 1px
        ),
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.016) 1px,
            transparent 1px
        );

    background-size: 68px 68px;
    opacity: 0.18;
    pointer-events: none;
}

.services-ambient-light {
    z-index: -2;

    background:
        linear-gradient(
            90deg,
            rgba(0, 174, 255, 0.17),
            transparent 8%,
            transparent 92%,
            rgba(112, 85, 255, 0.11)
        );

    box-shadow:
        inset 24px 0 58px rgba(0, 174, 255, 0.08),
        inset -24px 0 58px rgba(112, 85, 255, 0.06);

    pointer-events: none;
}


/* =====================================================
   ESTRUCTURA PRINCIPAL
===================================================== */

.services-shell {
    width: min(1600px, 100%);
    min-height: 100svh;
    margin: 0 auto;

    padding:
        calc(var(--header-height, 136px) + 18px)
        6%
        30px;

    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: clamp(22px, 3vh, 38px);
}


/* =====================================================
   CABECERA DE LA EXPERIENCIA
===================================================== */

.services-intro {
    max-width: 1120px;
}

.services-eyebrow {
    margin-bottom: 15px;

    color: var(--services-blue);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.48em;
    text-transform: uppercase;

    text-shadow: 0 0 16px rgba(0, 174, 255, 0.32);
}

.services-intro h1 {
    margin: 0;

    font-size: clamp(43px, 5.8vw, 92px);
    font-weight: 400;
    line-height: 0.94;
    letter-spacing: -0.055em;
    text-wrap: balance;
}

.services-intro h1 span {
    display: block;
    color: rgba(255, 255, 255, 0.52);
}


/* =====================================================
   CONSOLA DE DIAGNÓSTICO
===================================================== */

.diagnostic-console {
    min-height: 0;

    display: grid;
    grid-template-columns: minmax(310px, 0.72fr) minmax(480px, 1.28fr);

    border: 1px solid var(--services-border);
    background: rgba(2, 6, 17, 0.54);

    box-shadow:
        0 30px 100px rgba(0, 0, 0, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.025);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}


/* =====================================================
   SELECTOR DE PROBLEMAS
===================================================== */

.diagnostic-options {
    padding: clamp(24px, 2.5vw, 38px);

    display: flex;
    flex-direction: column;

    border-right: 1px solid var(--services-border);
    background: rgba(255, 255, 255, 0.018);
}

.diagnostic-label {
    margin-bottom: 18px;

    color: rgba(255, 255, 255, 0.34);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.32em;
}

.diagnostic-option {
    position: relative;

    width: 100%;
    min-height: 62px;
    padding: 16px 18px;

    display: grid;
    grid-template-columns: 38px 1fr;
    align-items: center;
    gap: 8px;

    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.075);

    color: rgba(255, 255, 255, 0.54);
    background: transparent;

    font: inherit;
    font-size: clamp(14px, 1.15vw, 17px);
    text-align: left;

    cursor: pointer;

    transition:
        color 0.25s ease,
        background 0.25s ease,
        padding-left 0.25s ease;
}

.diagnostic-option:last-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.diagnostic-option::after {
    content: "";

    position: absolute;
    left: 0;
    top: 50%;

    width: 2px;
    height: 0;

    background: var(--services-blue);
    box-shadow:
        0 0 10px rgba(0, 174, 255, 0.90),
        0 0 24px rgba(0, 174, 255, 0.42);

    transform: translateY(-50%);
    transition: height 0.25s ease;
}

.diagnostic-option span {
    color: rgba(255, 255, 255, 0.23);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.diagnostic-option:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.025);
}

.diagnostic-option.is-active {
    padding-left: 24px;

    color: #ffffff;
    background:
        linear-gradient(
            90deg,
            rgba(0, 174, 255, 0.10),
            transparent 78%
        );
}

.diagnostic-option.is-active::after {
    height: 58%;
}

.diagnostic-option.is-active span {
    color: var(--services-blue);
}


/* =====================================================
   RESULTADO DEL DIAGNÓSTICO
===================================================== */

.diagnostic-results {
    position: relative;
    min-width: 0;
    overflow: hidden;
}

.diagnostic-results::before {
    content: "";

    position: absolute;
    right: -14%;
    top: -44%;

    width: min(540px, 46vw);
    aspect-ratio: 1;

    border: 1px solid rgba(0, 174, 255, 0.10);
    border-radius: 50%;

    box-shadow:
        0 0 0 60px rgba(0, 174, 255, 0.018),
        0 0 100px rgba(0, 174, 255, 0.08);

    pointer-events: none;
}

.diagnostic-panel {
    position: relative;
    z-index: 1;

    height: 100%;
    min-height: 390px;
    padding: clamp(30px, 4vw, 60px);

    display: flex;
    flex-direction: column;
    justify-content: center;
}

.diagnostic-panel[hidden] {
    display: none;
}

.diagnostic-panel.is-entering {
    animation: diagnosticPanelIn 0.48s ease both;
}

.diagnostic-status {
    margin-bottom: 25px;

    display: flex;
    align-items: center;
    gap: 10px;

    color: var(--services-blue);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.32em;
}

.diagnostic-status > span {
    width: 7px;
    height: 7px;

    border-radius: 50%;
    background: var(--services-blue);

    box-shadow:
        0 0 8px rgba(0, 174, 255, 1),
        0 0 20px rgba(0, 174, 255, 0.60);

    animation: diagnosticPulse 2.2s ease-in-out infinite;
}

.diagnostic-panel h2 {
    max-width: 860px;
    margin: 0;

    font-size: clamp(31px, 4vw, 66px);
    font-weight: 400;
    line-height: 0.98;
    letter-spacing: -0.047em;
    text-wrap: balance;
}

.diagnostic-panel h2 strong {
    display: block;
    color: rgba(255, 255, 255, 0.52);
    font-weight: 400;
}

.diagnostic-panel > p:not(.diagnostic-status) {
    max-width: 690px;
    margin-top: 22px;

    color: var(--services-muted);
    font-size: clamp(15px, 1.25vw, 18px);
    line-height: 1.56;
}

.diagnostic-tags {
    margin-top: 24px;

    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.diagnostic-tags span {
    padding: 8px 12px;

    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 999px;

    color: rgba(255, 255, 255, 0.60);
    background: rgba(255, 255, 255, 0.025);

    font-size: 11px;
    letter-spacing: 0.08em;
}

.diagnostic-cta {
    width: fit-content;
    margin-top: 28px;

    display: inline-flex;
    align-items: center;
    gap: 13px;

    color: #ffffff;
    text-decoration: none;

    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.07em;

    transition: color 0.25s ease;
}

.diagnostic-cta > span {
    color: var(--services-blue);
    font-size: 17px;

    transition: transform 0.25s ease;
}

.diagnostic-cta:hover {
    color: var(--services-blue);
}

.diagnostic-cta:hover > span {
    transform: translate(4px, -4px);
}


/* =====================================================
   CINTA DE PROYECTOS
===================================================== */

.projects-marquee {
    min-width: 0;
    min-height: 82px;

    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 22px;

    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(154, 160, 171, 0.08);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.025),
        0 12px 34px rgba(0, 0, 0, 0.12);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    overflow: hidden;
}

.projects-marquee__label {
    padding-left: 18px;

    color: rgba(255, 255, 255, 0.32);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.30em;
    white-space: nowrap;
}

.projects-marquee__viewport {
    min-width: 0;
    overflow: hidden;

    -webkit-mask-image: linear-gradient(
        90deg,
        transparent 0,
        #000 7%,
        #000 93%,
        transparent 100%
    );

    mask-image: linear-gradient(
        90deg,
        transparent 0,
        #000 7%,
        #000 93%,
        transparent 100%
    );
}

.projects-marquee__track {
    width: max-content;

    display: flex;
    align-items: center;

    animation: projectsMarqueeMove 30s linear infinite;
    will-change: transform;
}

.projects-marquee__group {
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    gap: clamp(30px, 4vw, 60px);

    padding: 12px clamp(30px, 4vw, 60px) 12px 0;
}

.projects-marquee__item {
    flex: 0 0 auto;

    width: clamp(115px, 11vw, 175px);
    height: 54px;

    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 1;
    filter: none;

    transition:
        opacity 0.25s ease,
        filter 0.25s ease,
        transform 0.25s ease;
}

a.projects-marquee__item {
    text-decoration: none;
}

.projects-marquee__item img {
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;

    object-fit: contain;
}

a.projects-marquee__item:hover,
a.projects-marquee__item:focus-visible {
    opacity: 0.78;
    filter: grayscale(1) brightness(1.10);
    transform: translateY(-1px);
}

.projects-marquee:hover .projects-marquee__track,
.projects-marquee:focus-within .projects-marquee__track {
    animation-play-state: paused;
}


/* =====================================================
   ANIMACIONES
===================================================== */

@keyframes diagnosticPanelIn {
    from {
        opacity: 0;
        transform: translateY(14px);
        filter: blur(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes diagnosticPulse {
    0%,
    100% {
        opacity: 0.55;
        transform: scale(0.84);
    }

    50% {
        opacity: 1;
        transform: scale(1.10);
    }
}

@keyframes projectsMarqueeMove {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}


/* =====================================================
   TABLET
===================================================== */

@media (max-width: 1050px) {
    .services-shell {
        padding-left: 28px;
        padding-right: 28px;
    }

    .diagnostic-console {
        grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
    }

    .projects-marquee {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .projects-marquee__label {
        display: none;
    }
}


/* =====================================================
   MÓVIL
===================================================== */

@media (max-width: 760px) {
    .services-diagnostic {
        min-height: auto;
    }

    .services-shell {
        min-height: auto;

        padding:
            calc(var(--header-height, 100px) + 24px)
            18px
            32px;

        gap: 28px;
    }

    .services-eyebrow {
        max-width: 310px;
        margin-bottom: 14px;

        font-size: 9px;
        line-height: 1.6;
        letter-spacing: 0.34em;
    }

    .services-intro h1 {
        font-size: clamp(42px, 12.4vw, 61px);
        line-height: 0.97;
        letter-spacing: -0.050em;
    }

    .diagnostic-console {
        grid-template-columns: 1fr;
    }

    .diagnostic-options {
        padding: 18px;

        border-right: 0;
        border-bottom: 1px solid var(--services-border);
    }

    .diagnostic-label {
        margin-bottom: 12px;
    }

    .diagnostic-option {
        min-height: 54px;
        padding: 13px 12px;

        grid-template-columns: 32px 1fr;

        font-size: 14px;
    }

    .diagnostic-option.is-active {
        padding-left: 18px;
    }

    .diagnostic-panel {
        min-height: 420px;
        padding: 28px 22px 32px;
    }

    .diagnostic-panel h2 {
        font-size: clamp(33px, 9.6vw, 48px);
        line-height: 1;
        letter-spacing: -0.042em;
    }

    .diagnostic-panel > p:not(.diagnostic-status) {
        font-size: 15px;
    }

    .diagnostic-tags {
        margin-top: 22px;
    }

    .diagnostic-tags span {
        padding: 7px 10px;
        font-size: 10px;
    }

    .projects-marquee {
        min-height: 68px;
    }

    .projects-marquee__group {
        gap: 28px;
        padding-right: 28px;
    }

    .projects-marquee__item {
        width: 112px;
        height: 44px;
    }

    .projects-marquee__track {
        animation-duration: 24s;
    }

    .services-video-overlay {
        background:
            radial-gradient(
                circle at 72% 18%,
                rgba(0, 174, 255, 0.18),
                transparent 30%
            ),
            linear-gradient(
                180deg,
                rgba(2, 6, 17, 0.76),
                rgba(2, 6, 17, 0.94)
            );
    }
}


/* =====================================================
   MOVIMIENTO REDUCIDO
===================================================== */

@media (prefers-reduced-motion: reduce) {
    .services-hero-video,
    .diagnostic-option,
    .diagnostic-cta,
    .diagnostic-cta > span,
    .projects-marquee__item {
        transition: none;
    }

    .projects-marquee__track {
        animation: none;
        transform: none;
    }

    .diagnostic-panel.is-entering,
    .diagnostic-status > span {
        animation: none;
    }
}

/* =====================================================
   AJUSTES: SEPARACIÓN DEL HEADER Y VÍDEOS POR DIAGNÓSTICO
===================================================== */

/*
   Se añade margen real respecto al header fijo. El valor
   se suma al alto ya definido por la cabecera del proyecto.
*/
.services-shell {
    padding-top: calc(var(--header-height, 136px) + 72px);
}

/*
   Cada resultado incorpora su propio vídeo. El contenido
   permanece por encima mediante una capa oscura de contraste.
*/
.diagnostic-panel {
    /*
       El panel crea su propio contexto visual y recorta el vídeo.
       No usamos índices negativos porque pueden colocar el vídeo
       por detrás del contenedor completo y hacerlo invisible.
    */
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: rgba(2, 6, 17, 0.34);
}

.diagnostic-panel-video,
.diagnostic-panel-overlay {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    pointer-events: none;
}

.diagnostic-panel-video {
    z-index: 0;

    display: block;
    object-fit: cover;

    opacity: 0.72;

    filter:
        saturate(0.84)
        contrast(1.12)
        brightness(0.70);

    transform: scale(1.035);
}

.diagnostic-panel-overlay {
    z-index: 1;

    background:
        radial-gradient(
            circle at 78% 25%,
            rgba(0, 174, 255, 0.08),
            transparent 42%
        ),
        linear-gradient(
            90deg,
            rgba(2, 6, 17, 0.58) 0%,
            rgba(2, 6, 17, 0.38) 58%,
            rgba(2, 6, 17, 0.20) 100%
        ),
        linear-gradient(
            180deg,
            rgba(2, 6, 17, 0.08),
            rgba(2, 6, 17, 0.30)
        );
}

.diagnostic-panel > *:not(.diagnostic-panel-video):not(.diagnostic-panel-overlay) {
    position: relative;
    z-index: 2;
}

@media (max-width: 760px) {
    .services-shell {
        padding-top: calc(var(--header-height, 100px) + 48px);
    }

    .diagnostic-panel-video {
        opacity: 0.48;
    }

    .diagnostic-panel-overlay {
        background:
            linear-gradient(
                180deg,
                rgba(2, 6, 17, 0.72),
                rgba(2, 6, 17, 0.90)
            );
    }
}


/* =====================================================
   REFUERZO FINAL DE LA CINTA
===================================================== */

.services-page .projects-marquee__item {
    opacity: 1 !important;
    filter: none !important;
}

.services-page .projects-marquee__item img {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    filter: none !important;
}

.services-page a.projects-marquee__item:hover,
.services-page a.projects-marquee__item:focus-visible {
    opacity: 0.78 !important;
    filter: grayscale(1) brightness(1.10) !important;
}


/* =====================================================
   INTERACCIÓN ROBUSTA DE LOS LOGOS
===================================================== */

.services-page .projects-marquee__item {
    position: relative;
    z-index: 2;
    pointer-events: auto !important;
    cursor: pointer;
}

.services-page .projects-marquee__item img {
    pointer-events: none !important;
}

.services-page .projects-marquee__item:hover,
.services-page .projects-marquee__item:focus-visible {
    opacity: 0.78 !important;
    filter: grayscale(1) brightness(1.10) !important;
    transform: translateY(-1px);
}
