/* Services hub v6 — readability, 3D mesh sync, mobile mastery */

.p4p-page--services .p4p-services-main {
    position: relative;
}

.p4p-page--services .p4p-mesh-readability,
.p4p-services-main .p4p-mesh-readability {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(4, 4, 10, 0.55) 0%, rgba(4, 4, 10, 0.25) 28%, rgba(4, 4, 10, 0.35) 100%),
        radial-gradient(ellipse 90% 60% at 50% 40%, rgba(4, 4, 10, 0.15), rgba(4, 4, 10, 0.65));
}

.p4p-mesh-readability--lite {
    background:
        linear-gradient(180deg, rgba(4, 4, 10, 0.32) 0%, rgba(4, 4, 10, 0.06) 38%, rgba(4, 4, 10, 0.22) 100%),
        radial-gradient(ellipse 100% 70% at 50% 30%, rgba(4, 4, 10, 0.04), rgba(4, 4, 10, 0.38)) !important;
}

.p4p-page--services .p4p-services-main__inner,
.p4p-services-main .p4p-services-main__inner {
    position: relative;
    z-index: 3;
}

.p4p-services-main .p4p-page-mesh[data-mesh-bright="1"] {
    position: fixed !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    opacity: 1 !important;
    filter: brightness(1.22) contrast(1.06) saturate(1.12) !important;
    mix-blend-mode: screen;
    z-index: 0;
}

.p4p-page--services .p4p-hero-v5__title,
.p4p-page--services .p4p-hero-v5__lead,
.p4p-page--services .p4p-hero-v5__kicker,
.p4p-services-main .p4p-service-single-hero__title,
.p4p-services-main .p4p-service-single-hero__lead,
.p4p-services-main .p4p-service-web-hero__title,
.p4p-services-main .p4p-service-web-hero__lead,
.p4p-services-main .p4p-section-title,
.p4p-services-main .p4p-section-intro {
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.85), 0 0 1px rgba(0, 0, 0, 0.9);
}

/* Sticky sorted filter bar — superseded by fixed dock on grid-full pages */
.p4p-page--grid-full .p4p-svc-cockpit__head {
    display: none;
}

.p4p-svc-cockpit__head {
    position: sticky;
    top: calc(var(--p4p-header) + 0.35rem);
    z-index: 40;
    padding: 0.35rem 0 0.65rem;
    margin: 0 -0.25rem;
}

.p4p-svc-cockpit__filters-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}

.p4p-svc-cockpit__filters-scroll::-webkit-scrollbar {
    display: none;
}

.p4p-svc-cockpit__filters {
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: max-content;
    min-width: 100%;
    max-width: none;
    margin: 0 auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.p4p-svc-cockpit__filter {
    flex-shrink: 0;
    white-space: nowrap;
}

.p4p-svc-cockpit__filter.is-active {
    color: #0a0a0f !important;
}

/* Stage glass shell — text always readable */
.p4p-svc-cockpit__stage {
    position: relative;
    border-radius: 22px;
    padding: clamp(0.85rem, 2.5vw, 1.35rem);
    background: rgba(6, 6, 14, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.09);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.p4p-svc-cockpit__stage::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, transparent 45%);
}

/* Nexus strip — compact, no duplicate hero wall */
.p4p-svc-nexus__head {
    position: relative;
    z-index: 2;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.p4p-svc-nexus__eyebrow {
    margin: 0 0 0.35rem;
    font-family: var(--p4p-font-tech, monospace);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(232, 168, 124, 0.85);
}

.p4p-svc-nexus__title {
    display: none;
}

.p4p-svc-nexus__lead {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #f1f5f9;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

/* Nexus cells — always-visible copy + stronger SVG */
.p4p-svc-nexus__cell {
    background: rgba(8, 8, 18, 0.82) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 12px 32px rgba(0, 0, 0, 0.35);
}

.p4p-svc-nexus__name,
.p4p-svc-nexus__kicker,
.p4p-svc-nexus__meta,
.p4p-svc-nexus__tag,
.p4p-svc-nexus__desc {
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.75);
}

.p4p-svc-nexus__name {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.p4p-svc-nexus__kicker {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.35;
    max-width: 92%;
}

.p4p-svc-nexus__desc {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.68rem;
    line-height: 1.45;
    color: rgba(226, 232, 240, 0.88);
    max-width: 95%;
}

.p4p-svc-nexus__open {
    opacity: 1 !important;
    transform: none !important;
    margin-top: 0.5rem;
}

.p4p-svc-nexus__art {
    opacity: 0.55 !important;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
    transition: opacity 0.35s, transform 0.35s;
}

.p4p-svc-nexus__cell:hover .p4p-svc-nexus__art,
.p4p-svc-nexus__cell:focus-visible .p4p-svc-nexus__art {
    opacity: 0.85 !important;
    transform: scale(1.04) translateZ(0);
}

.p4p-svc-nexus__art svg.p4p-svc-nexus-svg {
    width: 100%;
    height: auto;
}

.p4p-svc-nexus__art svg.p4p-svc-nexus-svg .p4p-svg-float,
.p4p-svc-nexus__art svg.p4p-svc-nexus-svg .p4p-svg-pulse {
    animation-duration: 5s;
}

.p4p-svc-cockpit__visual-art svg.p4p-svc-nexus-svg {
    width: min(92%, 320px);
    filter: drop-shadow(0 20px 48px rgba(0, 0, 0, 0.55));
}

/* Back button — prominent */
.p4p-svc-detail__toolbar {
    position: sticky;
    top: calc(var(--p4p-header, 72px) + var(--p4p-dock-h, 4rem) + 0.35rem);
    z-index: 35;
    margin: -0.35rem -0.35rem 1rem;
    padding: 0.65rem 0.75rem;
    border-radius: 14px;
    background: rgba(4, 4, 10, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.p4p-svc-detail__back {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 44px;
    padding: 0.55rem 1rem 0.55rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: linear-gradient(135deg, rgba(232, 168, 124, 0.18), rgba(167, 139, 250, 0.12));
    border: 1px solid rgba(232, 168, 124, 0.45);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.p4p-svc-detail__back-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(232, 168, 124, 0.2);
    font-size: 1rem;
    line-height: 1;
}

.p4p-svc-detail__back:hover {
    background: linear-gradient(135deg, rgba(232, 168, 124, 0.28), rgba(167, 139, 250, 0.18));
    border-color: rgba(232, 168, 124, 0.65);
    transform: translateY(-1px);
}

.p4p-svc-detail__stepper {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 0.25rem 0.45rem;
}

.p4p-svc-cockpit__body {
    padding: 0.35rem 0;
}

.p4p-svc-cockpit__body .p4p-section-title,
.p4p-svc-cockpit__lead,
.p4p-svc-cockpit__features li {
    color: #f8fafc;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.65);
}

/* Mobile — single column clarity */
@media (max-width: 768px) {
    .p4p-page--services .p4p-hero-v5 {
        padding-top: calc(var(--p4p-header) + 1.25rem);
        padding-bottom: 0.75rem;
    }

    .p4p-page--services .p4p-hero-v5__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .p4p-page--services .p4p-hero-v5__actions .p4p-btn-glow {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }

    .p4p-svc-cockpit {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
        min-height: auto;
    }

    .p4p-svc-cockpit__head {
        top: calc(var(--p4p-header) + env(safe-area-inset-top, 0px));
    }

    .p4p-svc-cockpit__stage {
        padding: 0.75rem;
        border-radius: 18px;
    }

    .p4p-svc-nexus__grid {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .p4p-svc-nexus__cell--featured,
    .p4p-svc-nexus__cell--east-top,
    .p4p-svc-nexus__cell--east-mid,
    .p4p-svc-nexus__cell--west-bot,
    .p4p-svc-nexus__cell--wide-bot {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: auto;
        padding: 1rem 1rem 1.1rem;
    }

    .p4p-svc-nexus__cell--featured {
        min-height: 0;
    }

    .p4p-svc-nexus__art {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        max-width: none;
        opacity: 0.7 !important;
        margin-bottom: 0.35rem;
        order: -1;
        align-self: center;
        max-height: 100px;
        overflow: hidden;
    }

    .p4p-svc-nexus__cell {
        align-items: flex-start;
    }

    .p4p-svc-cockpit__grid {
        gap: 1.25rem;
    }

    .p4p-svc-cockpit__visual {
        min-height: 200px;
        height: auto;
        width: 100%;
    }

    .p4p-svc-cockpit__rail {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0.35rem;
        width: 100%;
    }

    .p4p-svc-cockpit__rail-btn {
        min-width: 0;
        padding: 0.5rem 0.35rem;
    }

    .p4p-svc-cockpit__rail-label {
        font-size: 0.5rem;
    }

    .p4p-svc-detail__toolbar {
        flex-wrap: wrap;
        top: calc(var(--p4p-header) + env(safe-area-inset-top, 0px));
    }

    .p4p-svc-detail__back {
        flex: 1 1 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .p4p-svc-cockpit__filter {
        font-size: 0.58rem;
        padding: 0.55rem 0.75rem;
    }

    .p4p-svc-cockpit__hot {
        display: none;
    }
}

html.p4p-touch-device .p4p-svc-nexus__open {
    opacity: 1 !important;
}

html.p4p-touch-device .p4p-svc-nexus__cell:active {
    transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
    .p4p-svc-nexus__art svg.p4p-svc-nexus-svg .p4p-svg-float,
    .p4p-svc-nexus__art svg.p4p-svc-nexus-svg .p4p-svg-pulse {
        animation: none;
    }
}
