/* Services + Portfolio + About v7 — full-page grid, fixed dock, visible 3D mesh */

:root {
    --p4p-dock-h: 4rem;
}

.p4p-page--grid-full {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--p4p-header, 72px) + var(--p4p-dock-h) + 0.5rem);
}

/* ── Fixed category dock (flush under header) ── */
.p4p-grid-dock {
    position: fixed;
    top: var(--p4p-header, 72px);
    left: 0;
    right: 0;
    z-index: 9000;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.p4p-grid-dock__inner {
    position: relative;
    pointer-events: auto;
    padding: 0.4rem clamp(0.75rem, 2.5vw, 1.35rem);
    background: linear-gradient(180deg, rgba(24, 16, 14, 0.98) 0%, rgba(14, 12, 20, 0.96) 100%);
    border-top: none;
    border-bottom: 2px solid rgba(232, 168, 124, 0.42);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    box-shadow:
        0 14px 48px rgba(0, 0, 0, 0.55),
        0 1px 0 rgba(255, 255, 255, 0.06) inset,
        0 -1px 0 rgba(232, 168, 124, 0.08) inset;
}

.p4p-grid-dock__inner::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(232, 168, 124, 0.06), transparent 30%, transparent 70%, rgba(167, 139, 250, 0.05));
}

.p4p-grid-dock__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-grid-dock__scroll::-webkit-scrollbar {
    display: none;
}

.p4p-grid-dock__filters {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: max-content;
    min-width: 100%;
    margin: 0 auto;
    flex-wrap: nowrap !important;
}

.p4p-grid-dock__glide,
.p4p-grid-dock .p4p-svc-cockpit__filter-glide,
.p4p-grid-dock .p4p-portfolio-filters__glide {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(232, 168, 124, 0.95) 0%, rgba(240, 196, 160, 0.88) 100%);
    box-shadow: 0 4px 22px rgba(232, 168, 124, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
    transition: transform 0.38s cubic-bezier(0.19, 1, 0.22, 1), width 0.38s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 0;
    pointer-events: none;
}

/* Unified dock tabs — services, portfolio, about */
.p4p-grid-dock .p4p-svc-cockpit__filter,
.p4p-grid-dock .p4p-portfolio-filter,
.p4p-grid-dock__tab {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.72rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.82);
    font-family: var(--p4p-font-tech, monospace);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.25s, border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.p4p-grid-dock .p4p-svc-cockpit__filter:hover,
.p4p-grid-dock .p4p-portfolio-filter:hover,
.p4p-grid-dock__tab:hover {
    color: #fff;
    border-color: rgba(232, 168, 124, 0.35);
    background: rgba(232, 168, 124, 0.08);
}

.p4p-grid-dock .p4p-svc-cockpit__filter.is-active,
.p4p-grid-dock .p4p-portfolio-filter.is-active,
.p4p-grid-dock__tab.is-active {
    color: #1a1008 !important;
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none;
}

.p4p-grid-dock .p4p-svc-cockpit__filters {
    box-shadow: none;
    background: transparent;
}

/* ── Full grid page shell ── */
.p4p-page--grid-full {
    background: linear-gradient(180deg, #1c1828 0%, #14121c 42%, #0e0c16 100%);
}

.p4p-page--grid-full .p4p-mesh-readability--lite {
    background:
        linear-gradient(180deg, rgba(12, 10, 18, 0.12) 0%, rgba(8, 8, 14, 0.02) 38%, rgba(8, 8, 14, 0.14) 100%),
        radial-gradient(ellipse 120% 80% at 50% 22%, rgba(232, 168, 124, 0.08), rgba(4, 4, 10, 0.22));
    pointer-events: none;
}

.p4p-page--grid-full .p4p-page-mesh {
    position: fixed !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 0;
    opacity: 1 !important;
    filter: brightness(1.58) contrast(1.14) saturate(1.28) !important;
    mix-blend-mode: screen;
}

.p4p-page--grid-full .p4p-services-main__inner,
.p4p-page--grid-full .p4p-about-main__inner {
    position: relative;
    z-index: 3;
    padding-top: calc(var(--p4p-header, 72px) + var(--p4p-dock-h, 3.35rem));
    max-width: 1320px;
    margin: 0 auto;
}

/* ── Grid hero (title fused with page) ── */
.p4p-grid-hero {
    position: relative;
    padding: clamp(1.25rem, 4vh, 2.5rem) clamp(0.75rem, 3vw, 1.5rem) clamp(0.75rem, 2vh, 1.25rem);
    margin-bottom: 0.5rem;
}

.p4p-grid-hero::before {
    content: '';
    position: absolute;
    inset: 0.5rem clamp(0.5rem, 2vw, 1rem);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(18, 14, 22, 0.62) 0%, rgba(10, 10, 18, 0.42) 100%);
    pointer-events: none;
    z-index: -1;
}

.p4p-grid-hero__kicker {
    margin: 0 0 0.45rem;
    font-family: var(--p4p-font-tech, monospace);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(232, 168, 124, 0.95);
}

.p4p-grid-hero__title {
    margin: 0 0 0.65rem;
    font-family: var(--p4p-font-display);
    font-size: clamp(2rem, 5.5vw, 3.35rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 4px 32px rgba(0, 0, 0, 0.85);
}

.p4p-grid-hero__lead {
    margin: 0 0 1rem;
    max-width: 720px;
    font-size: clamp(0.92rem, 1.8vw, 1.05rem);
    line-height: 1.65;
    color: #d4dce8;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8);
}

.p4p-grid-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

/* ── Services cockpit — full grid stage ── */
.p4p-page--grid-full .p4p-svc-cockpit {
    max-width: none;
    min-height: auto;
    padding: 0 clamp(0.75rem, 3vw, 1.5rem) clamp(2rem, 5vh, 3rem);
}

.p4p-page--grid-full .p4p-svc-cockpit__stage {
    position: relative;
    min-height: min(64svh, 620px);
    border-radius: 22px;
    padding: clamp(0.65rem, 1.5vw, 1rem);
    background: rgba(14, 14, 26, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.13);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.p4p-page--grid-full .p4p-svc-cockpit__panel {
    position: absolute !important;
    inset: 0;
    overflow: visible !important;
    max-height: none !important;
    -webkit-overflow-scrolling: auto;
}

.p4p-page--grid-full .p4p-svc-cockpit__panel.is-active {
    position: absolute !important;
}

.p4p-page--grid-full .p4p-svc-nexus__grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: clamp(0.45rem, 1vw, 0.65rem);
    min-height: min(52svh, 520px);
}

.p4p-page--grid-full .p4p-svc-nexus__cell--featured {
    grid-column: span 6;
    grid-row: span 2;
    min-height: 240px;
}

.p4p-page--grid-full .p4p-svc-nexus__cell--grid-a { grid-column: span 3; }
.p4p-page--grid-full .p4p-svc-nexus__cell--grid-b { grid-column: span 3; }
.p4p-page--grid-full .p4p-svc-nexus__cell--grid-c { grid-column: span 3; }
.p4p-page--grid-full .p4p-svc-nexus__cell--grid-d { grid-column: span 3; }
.p4p-page--grid-full .p4p-svc-nexus__cell--grid-e { grid-column: span 4; }
.p4p-page--grid-full .p4p-svc-nexus__cell--grid-f { grid-column: span 4; }
.p4p-page--grid-full .p4p-svc-nexus__cell--grid-g { grid-column: span 4; }

.p4p-page--grid-full .p4p-svc-nexus__cell {
    min-height: 118px;
    border-radius: 16px;
    background: rgba(16, 18, 30, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.13);
    transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1), border-color 0.3s, box-shadow 0.35s;
}

.p4p-page--grid-full .p4p-svc-nexus__cell:hover {
    transform: translateY(-4px);
    border-color: rgba(232, 168, 124, 0.4);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 28px var(--nx-glow, rgba(232, 168, 124, 0.18));
}

.p4p-page--grid-full .p4p-svc-nexus__head--grid {
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Portfolio dock — unified with grid-dock (legacy fixed rules removed) */
.p4p-page--portfolio.p4p-page--grid-full .p4p-portfolio-filters {
    position: static;
    margin: 0;
    max-width: none;
    border: none;
    border-radius: 0;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    overflow: visible;
}

.p4p-page--portfolio.p4p-page--grid-full .p4p-contact-trust {
    margin-top: 0.5rem;
}

/* About page grid integration */
.p4p-page--about.p4p-page--grid-full .p4p-page--about__content {
    position: relative;
    z-index: 3;
}

.p4p-page--about.p4p-page--grid-full #p4p-about-mesh {
    opacity: 1 !important;
    filter: brightness(1.42) contrast(1.1) saturate(1.2) !important;
}

@media (max-width: 900px) {
    :root {
        --p4p-dock-h: 3.55rem;
    }

    .p4p-grid-dock .p4p-svc-cockpit__filter,
    .p4p-grid-dock .p4p-portfolio-filter,
    .p4p-grid-dock__tab {
        padding: 0.62rem 0.95rem;
        font-size: 0.66rem;
    }

    .p4p-page--grid-full .p4p-svc-nexus__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .p4p-page--grid-full .p4p-svc-nexus__cell--featured,
    .p4p-page--grid-full .p4p-svc-nexus__cell--grid-a,
    .p4p-page--grid-full .p4p-svc-nexus__cell--grid-b,
    .p4p-page--grid-full .p4p-svc-nexus__cell--grid-c,
    .p4p-page--grid-full .p4p-svc-nexus__cell--grid-d,
    .p4p-page--grid-full .p4p-svc-nexus__cell--grid-e,
    .p4p-page--grid-full .p4p-svc-nexus__cell--grid-f,
    .p4p-page--grid-full .p4p-svc-nexus__cell--grid-g {
        grid-column: span 1;
        grid-row: span 1;
    }

    .p4p-page--grid-full .p4p-svc-nexus__cell--featured {
        grid-column: span 2;
    }
}

@media (max-width: 520px) {
    .p4p-page--grid-full .p4p-svc-nexus__grid {
        grid-template-columns: 1fr;
    }

    .p4p-page--grid-full .p4p-svc-nexus__cell--featured {
        grid-column: span 1;
    }
}

html.p4p-perf-tier-2 .p4p-page--grid-full .p4p-page-mesh {
    filter: brightness(1.22) contrast(1.06) saturate(1.1) !important;
}
