/* Home v12 — cap nexus 3D box, adaptive capabilities stack, careers popout, finale fix */

/* ── Capabilities adaptive stack ── */
body.p4p-home .p4p-section--capabilities .p4p-section__shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow: visible !important;
    max-height: 100svh;
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom));
}

.p4p-capabilities-stack {
    width: min(100%, 980px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.35rem, 1vh, 0.65rem);
    transform-origin: center center;
    will-change: transform;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
}

.p4p-cap-nexus {
    width: 100%;
    flex: 0 0 auto;
    perspective: 1400px;
}

.p4p-cap-nexus__frame {
    position: relative;
    margin: 0 auto;
    padding: clamp(0.75rem, 1.8vh, 1.1rem) clamp(0.85rem, 2vw, 1.25rem);
    border-radius: 18px;
    border: 1px solid rgba(167, 139, 250, 0.32);
    background: linear-gradient(145deg, rgba(22, 16, 32, 0.92) 0%, rgba(10, 10, 18, 0.82) 55%, rgba(14, 12, 22, 0.88) 100%);
    box-shadow:
        0 22px 54px rgba(0, 0, 0, 0.52),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 0 48px rgba(167, 139, 250, 0.1);
    transform: rotateX(4deg) translateZ(0);
    transform-style: preserve-3d;
    text-align: center;
    overflow: hidden;
}

.p4p-cap-nexus__frame--compact {
    text-align: left;
    transform: rotateX(2deg) rotateY(-3deg);
    padding: 1rem 1.15rem;
}

.p4p-cap-nexus__corner-fade {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 3;
    background:
        radial-gradient(circle at 0% 0%, rgba(0, 0, 0, 0.55) 0%, transparent 52%),
        radial-gradient(circle at 100% 0%, rgba(0, 0, 0, 0.55) 0%, transparent 52%),
        radial-gradient(circle at 0% 100%, rgba(0, 0, 0, 0.55) 0%, transparent 52%),
        radial-gradient(circle at 100% 100%, rgba(0, 0, 0, 0.55) 0%, transparent 52%);
    opacity: 0.85;
}

.p4p-cap-nexus__shine {
    position: absolute;
    inset: -40% -20%;
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(115deg, transparent 40%, rgba(232, 168, 124, 0.08) 50%, transparent 60%);
    animation: p4p-nexus-shine 8s ease-in-out infinite;
}

@keyframes p4p-nexus-shine {
    0%, 100% { transform: translateX(-8%) rotate(0deg); opacity: 0.4; }
    50% { transform: translateX(8%) rotate(0deg); opacity: 0.85; }
}

.p4p-cap-nexus__head,
.p4p-cap-nexus__lead,
.p4p-cap-nexus__duo {
    position: relative;
    z-index: 4;
}

.p4p-cap-nexus__title {
    margin: 0.15rem 0 0.45rem;
    font-family: var(--p4p-font-display);
    font-size: clamp(1.15rem, 2.2vw, 1.65rem);
    font-weight: 800;
    line-height: 1.06;
    color: #fff;
    text-shadow: 0 4px 28px rgba(0, 0, 0, 0.75);
}

.p4p-cap-nexus__lead {
    margin: 0 0 0.55rem;
    font-size: clamp(0.72rem, 1.2vw, 0.88rem);
    line-height: 1.55;
    color: #dce4ef;
}

.p4p-cap-nexus__duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.p4p-cap-nexus__chip {
    text-align: left;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.32);
    padding: 0.5rem 0.65rem;
    transition: border-color 0.3s, background 0.3s, transform 0.3s, box-shadow 0.3s;
}

.p4p-cap-nexus__chip.is-active,
.p4p-cap-nexus__chip:hover,
.p4p-cap-nexus__chip:focus-visible {
    border-color: rgba(232, 168, 124, 0.5);
    background: linear-gradient(135deg, rgba(134, 239, 172, 0.14), rgba(167, 139, 250, 0.12));
    box-shadow: 0 10px 28px rgba(134, 239, 172, 0.14);
    transform: translateY(-2px) translateZ(8px);
    outline: none;
}

/* Carousel — room for 3D cards + rail */
.p4p-section--capabilities .p4p-carousel-scene {
    flex: 1 1 auto;
    min-height: clamp(280px, 32vh, 380px);
    max-height: none;
    width: 100%;
    overflow: visible;
    margin: 0;
    padding: 0 clamp(0.75rem, 4vw, 2.5rem);
    perspective: 1600px;
    perspective-origin: 50% 42%;
}

.p4p-section--capabilities .p4p-carousel-rotor {
    width: min(280px, 58vw) !important;
    height: min(380px, 36vh) !important;
    max-height: 420px;
}

.p4p-carousel-card .p4p-service-card__visual {
    max-height: 64px;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0.35rem;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.22));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 20px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.p4p-carousel-card .p4p-service-card__visual svg {
    max-height: 56px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(232, 168, 124, 0.25));
}

.p4p-cap-rail {
    flex: 0 0 auto;
    width: 100%;
    max-width: 760px;
    margin-top: 0.15rem;
    z-index: var(--p4p-z-interact);
}

/* ── Careers — green hover + nexus preview panel (geometry from v11/polish/3d) ── */
.p4p-section--careers .p4p-csgo-side-preview {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    width: min(320px, 38vw);
}

.p4p-section--careers .p4p-csgo-side-preview__panel {
    position: relative;
    height: 100%;
    transform: none;
}

.p4p-section--careers .p4p-csgo-side-preview.is-visible .p4p-csgo-side-preview__panel {
    transform: rotateX(2deg) rotateY(-3deg);
}

.p4p-section--careers .p4p-csgo-core {
    background: linear-gradient(145deg, rgba(14, 12, 22, 0.96), rgba(8, 10, 18, 0.9)) !important;
    border: 1px solid rgba(134, 239, 172, 0.35) !important;
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.58), 0 0 40px rgba(134, 239, 172, 0.15) !important;
}

.p4p-section--careers .p4p-csgo-node.is-active .p4p-csgo-node__content,
.p4p-section--careers .p4p-csgo-node:hover .p4p-csgo-node__content,
.p4p-section--careers .p4p-csgo-node.is-clickable .p4p-csgo-node__content {
    background: linear-gradient(145deg, rgba(134, 239, 172, 0.32), rgba(16, 185, 129, 0.18)) !important;
    border-color: rgba(134, 239, 172, 0.65) !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55), 0 0 36px rgba(134, 239, 172, 0.28) !important;
}

.p4p-csgo-side-preview h4 {
    font-size: 1.05rem;
    margin-bottom: 0.55rem;
}

.p4p-csgo-side-preview p {
    font-size: 0.8rem;
    line-height: 1.55;
}

.p4p-section--capabilities .p4p-service-card__desc,
.p4p-section--capabilities .p4p-service-card__quote {
    -webkit-line-clamp: unset !important;
    display: block !important;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
}

/* ── Contact / finale — no inner scroll ── */
body.p4p-home .p4p-section--finale .p4p-section__shell {
    overflow: hidden !important;
    justify-content: center;
}

body.p4p-home .p4p-section--finale .p4p-command-center {
    max-height: none !important;
    overflow: visible !important;
    align-items: stretch;
    grid-template-columns: 1fr 1fr;
}

body.p4p-home .p4p-command-center__form,
body.p4p-home .p4p-command-center__hud {
    max-height: none !important;
    overflow: visible !important;
}

body.p4p-home .p4p-command-center__intro {
    -webkit-line-clamp: unset !important;
    display: block !important;
    overflow: visible !important;
}

@media (max-height: 760px) {
    .p4p-cap-nexus__frame { padding: 0.55rem 0.75rem; }
    .p4p-cap-nexus__duo { grid-template-columns: 1fr; }
    .p4p-section--capabilities .p4p-carousel-scene {
        min-height: clamp(240px, 28vh, 320px);
    }
}

@media (max-width: 768px) {
    .p4p-cap-nexus__duo { grid-template-columns: 1fr; }
    .p4p-capabilities-stack { gap: 0.75rem; transform: none !important; }
    .p4p-cap-nexus__frame { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .p4p-cap-nexus__shine { animation: none; }
    .p4p-cap-nexus__frame { transform: none; }
}
