/* Integrations Section */
#integrations {
    position: relative;
    overflow: hidden;
}

/* Animated background grid */
.integrations__bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.integrations__bg-grid {
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(0, 111, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 111, 255, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridDrift 25s linear infinite;
    mask-image: radial-gradient(ellipse at 50% 40%, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, black 30%, transparent 70%);
}

@keyframes gridDrift {
    from { transform: translate(0, 0); }
    to { transform: translate(60px, 60px); }
}

/* Radial energy waves from center */
.integrations__bg-pulse {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    border-radius: 50%;
    pointer-events: none;
}

.integrations__bg-pulse span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(0, 111, 255, 0.08);
    animation: energyWave 4s ease-out infinite;
}

.integrations__bg-pulse span:nth-child(2) { animation-delay: 1s; }
.integrations__bg-pulse span:nth-child(3) { animation-delay: 2s; }
.integrations__bg-pulse span:nth-child(4) { animation-delay: 3s; }

@keyframes energyWave {
    0% { transform: scale(0.3); opacity: 0.6; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Data stream particles - flow from center outward along diagonals */
.integrations__particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.data-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-primary);
    box-shadow: 0 0 8px rgba(0, 111, 255, 0.8), 0 0 20px rgba(0, 111, 255, 0.4);
}

/* Top-left stream (to WordPress) */
.data-particle--tl {
    top: 42%;
    left: 50%;
    animation: streamTL 3s ease-in infinite;
}
.data-particle--tl:nth-child(2) { animation-delay: 0.7s; width: 3px; height: 3px; }
.data-particle--tl:nth-child(3) { animation-delay: 1.4s; width: 5px; height: 5px; box-shadow: 0 0 12px rgba(0, 111, 255, 0.9), 0 0 30px rgba(0, 111, 255, 0.5); }
.data-particle--tl:nth-child(4) { animation-delay: 2.1s; width: 3px; height: 3px; }

@keyframes streamTL {
    0% { transform: translate(0, 0); opacity: 1; }
    80% { opacity: 0.6; }
    100% { transform: translate(-28vw, -22vh); opacity: 0; }
}

/* Top-right stream (to LinkedIn Personal) */
.data-particle--tr {
    top: 42%;
    left: 50%;
    animation: streamTR 3.2s ease-in infinite;
}
.data-particle--tr:nth-child(6) { animation-delay: 0.5s; width: 5px; height: 5px; box-shadow: 0 0 12px rgba(124, 58, 237, 0.9), 0 0 30px rgba(124, 58, 237, 0.5); }
.data-particle--tr:nth-child(7) { animation-delay: 1.2s; width: 3px; height: 3px; }
.data-particle--tr:nth-child(8) { animation-delay: 1.9s; }

@keyframes streamTR {
    0% { transform: translate(0, 0); opacity: 1; }
    80% { opacity: 0.6; }
    100% { transform: translate(28vw, -22vh); opacity: 0; }
}

/* Bottom-left stream (to LinkedIn Company) */
.data-particle--bl {
    top: 42%;
    left: 50%;
    animation: streamBL 2.8s ease-in infinite;
}
.data-particle--bl:nth-child(10) { animation-delay: 0.6s; width: 5px; height: 5px; }
.data-particle--bl:nth-child(11) { animation-delay: 1.3s; width: 3px; height: 3px; }
.data-particle--bl:nth-child(12) { animation-delay: 2s; }

@keyframes streamBL {
    0% { transform: translate(0, 0); opacity: 1; }
    80% { opacity: 0.6; }
    100% { transform: translate(-28vw, 22vh); opacity: 0; }
}

/* Bottom-right stream (to Brevo) */
.data-particle--br {
    top: 42%;
    left: 50%;
    animation: streamBR 3.4s ease-in infinite;
}
.data-particle--br:nth-child(14) { animation-delay: 0.4s; width: 3px; height: 3px; }
.data-particle--br:nth-child(15) { animation-delay: 1.1s; width: 5px; height: 5px; box-shadow: 0 0 12px rgba(236, 72, 153, 0.9), 0 0 30px rgba(236, 72, 153, 0.5); }
.data-particle--br:nth-child(16) { animation-delay: 1.8s; }

@keyframes streamBR {
    0% { transform: translate(0, 0); opacity: 1; }
    80% { opacity: 0.6; }
    100% { transform: translate(28vw, 22vh); opacity: 0; }
}

/* Diagram container */
.integrations__diagram {
    max-width: 640px;
    margin: 0 auto 80px;
    position: relative;
    z-index: 2;
}

.hub-spoke-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Central hub */
@keyframes hubPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.hub-center {
    animation: hubPulse 3s ease-in-out infinite;
    transform-origin: center;
}

/* Hub pulse rings expanding outward */
@keyframes ringExpand1 {
    0% { r: 46; opacity: 0.5; stroke-width: 2; }
    100% { r: 80; opacity: 0; stroke-width: 0.5; }
}
@keyframes ringExpand2 {
    0% { r: 46; opacity: 0.3; stroke-width: 1.5; }
    100% { r: 100; opacity: 0; stroke-width: 0.3; }
}

.hub-ring-1 {
    animation: ringExpand1 2.5s ease-out infinite;
}
.hub-ring-2 {
    animation: ringExpand2 2.5s ease-out infinite 1.25s;
}
.hub-ring-3 {
    animation: ringExpand1 3s ease-out infinite 0.8s;
}

/* Hub glow breathing */
.hub-glow {
    animation: hubGlow 3s ease-in-out infinite;
}

@keyframes hubGlow {
    0% { opacity: 0.4; }
    50% { opacity: 0.15; }
    100% { opacity: 0.4; }
}

/* Spoke lines - direction: outward from center */
.spoke-line {
    stroke: rgba(0, 111, 255, 0.3);
    stroke-width: 1.5;
    stroke-dasharray: 8 6;
    animation: flowLineOut 1.8s linear infinite;
}

.spoke-line-glow {
    stroke: rgba(0, 111, 255, 0.06);
    stroke-width: 8;
    stroke-dasharray: 8 6;
    animation: flowLineOut 1.8s linear infinite;
}

@keyframes flowLineOut {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -100; }
}

/* Travelling dots - flow OUTWARD from hub to nodes */
.spoke-dot {
    fill: var(--color-primary);
    filter: drop-shadow(0 0 6px rgba(0, 111, 255, 0.8)) drop-shadow(0 0 14px rgba(0, 111, 255, 0.4));
}

.spoke-dot--large {
    fill: var(--color-primary);
    filter: drop-shadow(0 0 10px rgba(0, 111, 255, 1)) drop-shadow(0 0 24px rgba(0, 111, 255, 0.6));
}

.spoke-dot--purple {
    fill: var(--color-purple);
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.9)) drop-shadow(0 0 18px rgba(124, 58, 237, 0.5));
}

/* Platform nodes */
.platform-node {
    cursor: pointer;
}

.platform-node .node-bg {
    fill: rgba(20, 24, 40, 0.95);
    stroke: rgba(0, 111, 255, 0.25);
    stroke-width: 1.5;
    transition: all 0.3s ease;
}

/* Node arrival pulse - rings that pulse when data "arrives" */
.platform-node .node-arrival {
    fill: none;
    stroke: rgba(0, 111, 255, 0.15);
    stroke-width: 1;
    animation: arrivalPulse 2.5s ease-out infinite;
}

@keyframes arrivalPulse {
    0% { r: 32; opacity: 0; }
    20% { opacity: 0.5; }
    100% { r: 52; opacity: 0; }
}

/* Stagger arrival pulses per node */
.platform-node--wp .node-arrival { animation-delay: 0s; }
.platform-node--li-personal .node-arrival { animation-delay: 0.6s; }
.platform-node--li-company .node-arrival { animation-delay: 1.2s; }
.platform-node--brevo .node-arrival { animation-delay: 1.8s; }

.platform-node .node-glow-ring {
    fill: none;
    stroke: rgba(0, 111, 255, 0.08);
    stroke-width: 1;
}

.platform-node:hover .node-bg {
    stroke: rgba(0, 111, 255, 0.9);
    fill: rgba(0, 111, 255, 0.12);
    filter: drop-shadow(0 0 20px rgba(0, 111, 255, 0.5));
}

.platform-node .node-icon {
    fill: rgba(255, 255, 255, 0.9);
    font-family: var(--font-family);
    font-size: 15px;
    font-weight: 700;
}

.platform-node .node-label {
    fill: rgba(255, 255, 255, 0.35);
    font-family: var(--font-family);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: fill 0.3s ease;
}

.platform-node:hover .node-label {
    fill: rgba(255, 255, 255, 0.9);
}

/* Connection status indicator on nodes */
.node-status {
    fill: var(--color-success);
    animation: statusBlink 3s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 90%, 100% { opacity: 1; }
    95% { opacity: 0.3; }
}

/* Tooltip */
.integrations__tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    color: var(--color-navy);
    padding: 16px 20px;
    border-radius: var(--radius-card);
    font-size: 13px;
    line-height: 1.5;
    max-width: 260px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 111, 255, 0.15);
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px) scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 10;
}

.integrations__tooltip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.integrations__tooltip strong {
    display: block;
    margin-bottom: 4px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    font-size: 14px;
}

/* Platform cards below diagram */
.integrations__cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 48px;
    position: relative;
    z-index: 1;
}

.integration-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-card);
    padding: 28px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.integration-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.integration-card:hover {
    border-color: rgba(0, 111, 255, 0.25);
    transform: translateY(-4px);
    background: rgba(0, 111, 255, 0.04);
    box-shadow: 0 12px 40px rgba(0, 111, 255, 0.08);
}

.integration-card:hover::before {
    opacity: 1;
}

.integration-card__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    background: rgba(0, 111, 255, 0.08);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.integration-card:hover .integration-card__icon {
    background: rgba(0, 111, 255, 0.15);
    box-shadow: 0 0 20px rgba(0, 111, 255, 0.15);
}

.integration-card h4 {
    font-size: 16px;
    font-weight: var(--font-weight-semibold);
    color: var(--color-white);
    margin-bottom: 8px;
}

.integration-card p {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* Coming Soon Row */
.integrations__coming-soon {
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    z-index: 1;
}

.integrations__coming-soon p {
    font-size: 14px;
    color: var(--color-text-muted);
}

.integrations__coming-soon span {
    color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 1024px) {
    .integrations__cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .integrations__particles {
        display: none;
    }
}

@media (max-width: 768px) {
    .integrations__cards {
        grid-template-columns: 1fr;
    }

    .integrations__diagram {
        max-width: 360px;
    }

    .integrations__bg-pulse {
        width: 300px;
        height: 300px;
    }

    .integrations__particles {
        display: none;
    }
}
