/* =============================================================================
   SITE 3D — site-wide bright 3D layer (paired with js/site3d.js)
   Everything visual here only activates once JS adds body.s3d-on, so pages
   look exactly as before when 3D is off (reduced motion, no WebGL, checkout).
   ============================================================================= */

/* ---------- Fixed background layers (injected by JS) ---------- */
.s3d-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 78% 18%, rgba(92, 225, 230, 0.20) 0%, transparent 70%),
        radial-gradient(ellipse 50% 45% at 10% 80%, rgba(97, 206, 112, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 40% 35% at 50% 50%, rgba(8, 145, 178, 0.05) 0%, transparent 70%),
        linear-gradient(180deg, #F2FEFF 0%, #FFFFFF 45%, #F7FBFF 100%);
}

.s3d-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.2s ease;
}
body.s3d-on .s3d-canvas { opacity: 1; }

/* Network labels (projected from 3D). z-index 0 + early in the DOM →
   positioned page content painted later stays on top of them. */
.s3d-labels { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.s3d-label {
    position: absolute;
    left: 0; top: 0;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    color: #0F172A;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(8, 145, 178, 0.25);
    border-radius: 22px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
    opacity: 0;
    will-change: transform, opacity;
}
.s3d-label i { color: #0891B2; margin-right: 6px; }
.s3d-label.hub { color: #fff; border-color: transparent; background: linear-gradient(135deg, #0891B2, #16A34A); }
.s3d-label.hub i { color: #fff; }

/* Cleared (see-through) sections keep their stacking above the canvas */
body.s3d-on section.s3d-clear { position: relative; }
body.s3d-on .s3d-hero::before,
body.s3d-on .s3d-hero::after { display: none; }

/* ---------- Inner-page hero: copy left, signature shape right (desktop) ---------- */
@media (min-width: 992px) {
    body.s3d-on .s3d-split {
        min-height: 78vh;
        display: flex;
        align-items: center;
    }
    body.s3d-on .s3d-split > .container {
        text-align: left !important;
        width: 100%;
    }
    body.s3d-on .s3d-split > .container > * {
        max-width: 600px;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    body.s3d-on .s3d-split > .container > div {
        justify-content: flex-start !important;
    }
    body.s3d-on .s3d-split h1 {
        font-size: clamp(2.4rem, 4.2vw, 3.6rem) !important;
        line-height: 1.08 !important;
        letter-spacing: -0.03em;
    }
    body.s3d-on .s3d-split p {
        margin-left: 0 !important;
        max-width: 560px !important;
    }
}

/* Phones & tablets: reserve an open stage under the hero copy for the shape */
@media (max-width: 991px) {
    body.s3d-on .s3d-split {
        padding-bottom: calc(36svh + 20px) !important;
    }
}

/* Light cards placed directly on the field get a touch of glass */
body.s3d-on .s3d-clear .service-card,
body.s3d-on .s3d-clear .feature-card,
body.s3d-on .s3d-clear .step-card,
body.s3d-on .s3d-clear .tool-card {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ---------- 3D scroll reveal (main.js toggles .reveal → .visible) ---------- */
.reveal {
    transform: perspective(1100px) translateY(48px) rotateX(14deg) scale(0.98);
    transform-origin: 50% 100%;
    transition: opacity 0.9s ease, transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible { transform: none; }

/* Card tilt (desktop) */
.s3d-tilting {
    transition: transform 0.15s ease-out, box-shadow 0.3s ease !important;
    will-change: transform;
}

/* ---------- Small screens ---------- */
@media (max-width: 600px) {
    .s3d-label:not(.hub) {
        font-size: 0;
        width: 32px; height: 32px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }
    .s3d-label:not(.hub) i { font-size: 13px; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .reveal { transform: none; transition: opacity 0.4s ease; }
}
