/* ============================================================
   RANKRIX — CONNECT WIDGET
   Four service cards wired into one "Your Business" node.
   Idle: cards check in sequence, a beam travels the wire into
   the hub. Hover / focus / tap a card to route its beam
   immediately. Reduced motion: static checked state.
   Brand: 1px corners, unified blue family, status green.
   ============================================================ */

.rkx-connect {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    padding: clamp(10px, 1.5vw, 24px) 0 0;
    /* width is set to the header pill width by the theme bridge (§5/§10),
       so cards fill the section's header-width area edge to edge */
}

/* ---------------- cards row ---------------- */
.rkx-connect__cards {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(12px, 1.6vw, 22px);
}
.rkx-connect__card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    min-height: 96px;
    padding: 14px 14px 12px;
    background: var(--rkx-bg, rgba(0, 0, 0, 0.45));
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    border: 1px solid var(--rkx-border, rgba(255, 255, 255, 0.10));
    border-radius: 1px;
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
                0 8px 36px rgba(0, 0, 0, 0.55);
    transition: border-color 260ms cubic-bezier(0.4, 0, 0.2, 1),
                background 260ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 260ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 260ms cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}
/* glossy specular sheen — subtle, over the header glass */
.rkx-connect__card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(158deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.02) 26%, transparent 52%);
    pointer-events: none;
    transition: opacity 260ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* notch seam line */
.rkx-connect__card::after {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    width: 29px;
    height: 29px;
    border-left: 1px solid rgba(255, 255, 255, 0.10);
    transform: rotate(45deg) translateX(14.5px);
    pointer-events: none;
}
.rkx-connect__card:hover,
.rkx-connect__card:focus-visible { border-color: rgba(129, 140, 248, 0.45); transform: translateY(-2px); }
.rkx-connect__card:focus-visible { outline: 2px solid #1D24CA; outline-offset: 3px; }
.rkx-connect__card.is-active {
    /* eyebrow-badge treatment while its beam plays */
    border-color: #1D24CA;
    background: #03163E;
    box-shadow: inset 0 0 14px rgba(29, 36, 202, 0.22),
                0 0 18px rgba(29, 36, 202, 0.40);
}
.rkx-connect__card.is-active::before { opacity: 0.5; }

/* badge: ring -> green check */
.rkx-connect__badge {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.02) 60%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: background 220ms cubic-bezier(0.4, 0, 0.2, 1),
                border-color 220ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
.rkx-connect__badge svg {
    width: 12px;
    height: 12px;
    color: #04120a;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 200ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rkx-connect__card.is-done .rkx-connect__badge {
    background: #4ade80;
    border-color: rgba(74, 222, 128, 0.9);
    box-shadow: 0 0 16px rgba(74, 222, 128, 0.5);
}
.rkx-connect__card.is-done .rkx-connect__badge svg { opacity: 1; transform: scale(1); }

.rkx-connect__label {
    position: relative;
    z-index: 1;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.3;
}

/* ---------------- wires ---------------- */
.rkx-connect__wires {
    position: relative;
    z-index: 0;
    height: clamp(96px, 12vw, 150px);
    margin: 0 clamp(6px, 1vw, 14px);
}
.rkx-connect__wires svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.rkx-connect__wire { stroke: rgba(255, 255, 255, 0.10); stroke-width: 1.5; fill: none; }
.rkx-connect__beam {
    stroke: #9fb1ff;
    stroke-width: 2.25;
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: 90 1000;
    stroke-dashoffset: 1090;
    opacity: 0;
    filter: drop-shadow(0 0 6px rgba(29, 36, 202, 0.9));
}
.rkx-connect__beam.is-beaming {
    opacity: 1;
    animation: rkx-connect-beam 1150ms cubic-bezier(0.45, 0, 0.3, 1) forwards;
}
@keyframes rkx-connect-beam {
    from { stroke-dashoffset: 1090; }
    to   { stroke-dashoffset: -90; }
}

/* ---------------- hub pill ---------------- */
.rkx-connect__hub {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
}
.rkx-connect__pill {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 18px 9px 10px;
    background: var(--rkx-bg, rgba(0, 0, 0, 0.45));
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    border: 1px solid var(--rkx-border, rgba(255, 255, 255, 0.10));
    border-radius: 1px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.01em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
                0 8px 36px rgba(0, 0, 0, 0.55);
    transition: border-color 300ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.rkx-connect__pill::before {
    content: '';
    position: absolute;
    inset: 0 0 46% 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), transparent);
    pointer-events: none;
}
.rkx-connect__pill.is-hit {
    border-color: #1D24CA;
    background: #03163E;
    box-shadow: inset 0 0 14px rgba(29, 36, 202, 0.22),
                0 0 22px rgba(29, 36, 202, 0.45);
}
.rkx-connect__logo {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1D24CA, #818cf8);
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 11px;
    color: #fff;
    box-shadow: 0 0 12px rgba(29, 36, 202, 0.55);
}

/* ---------------- responsive ---------------- */
@media (max-width: 700px) {
    .rkx-connect__cards { grid-template-columns: repeat(2, 1fr); }
    .rkx-connect__wires { display: none; }
    .rkx-connect__hub { margin-top: 26px; }
    .rkx-connect__hub::before {
        content: '';
        position: absolute;
        top: -26px;
        left: 50%;
        width: 1.5px;
        height: 26px;
        background: rgba(255, 255, 255, 0.10);
    }
    .rkx-connect__card { min-height: 84px; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
    .rkx-connect__beam { display: none; }
    .rkx-connect__card, .rkx-connect__badge, .rkx-connect__badge svg, .rkx-connect__pill { transition: none !important; }
    .rkx-connect__card .rkx-connect__badge { background: #4ade80; border-color: rgba(74, 222, 128, 0.9); }
    .rkx-connect__card .rkx-connect__badge svg { opacity: 1; transform: none; }
}
