/* ==========================================================
   Connected Stack Widget
   Standalone responsive card
   Uses variables.css tokens only
   ========================================================== */

.connected-stack-widget {
    position: relative;
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 600px;
    margin: 0px auto;
    flex-direction: column;
    padding: 28px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    container-type: inline-size;
}

.connected-stack-widget--compact {
    padding: 22px;
}

/* ==========================================================
   Header
   ========================================================== */

.connected-stack-widget__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.connected-stack-widget__title-group {
    min-width: 0;
}

.connected-stack-widget__heading {
    max-width: 330px;
    margin: 0;
    color: var(--color-black);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-lightbold);
    line-height: 1.3;
    letter-spacing: var(--letter-spacing-tight);
}

.connected-stack-widget__heading span {
    display: block;
    margin-top: 6px;
    color: var(--color-gray);
    font-size: var(--font-size-lg);
    font-weight: normal;
    line-height: var(--line-height-body);
}

.connected-stack-widget__product {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    color: var(--green-dark);
    font-size: var(--base-font-size);
    text-decoration: none;
    transition: color 180ms ease;
}

.connected-stack-widget__product:hover {
    color: var(--green);
}

.connected-stack-widget__product:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 3px;
}

.connected-stack-widget__product i {
    width: 5px;
    height: 5px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--green);
}

.connected-stack-widget__open {
    display: inline-flex;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--light-dim-green);
    color: var(--green-dark);
    text-decoration: none;
    transition:
        background-color 180ms ease,
        color 180ms ease,
        transform 180ms ease;
}

.connected-stack-widget__open:hover {
    background: var(--green);
    color: var(--white);
    transform: translate(2px, -2px);
}

.connected-stack-widget__open:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 3px;
}

.connected-stack-widget__open i,
.connected-stack-widget__open svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}


/* ==========================================================
   Tools grid
   ========================================================== */

.connected-stack-widget__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin-top: 28px;
}

.connected-stack-tool {
    position: relative;
    display: flex;
    width: 100%;
    min-width: 0;
    aspect-ratio: 1.08;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--off-white);
    transition:
        border-color 180ms ease,
        background 180ms ease,
        transform 180ms ease,
        box-shadow 180ms ease;
}

.connected-stack-tool:hover {
    border-color: var(--light-green-border);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.connected-stack-tool__icon {
    display: block;
    width: 27px;
    height: 27px;
    color: var(--green-dark);
    transition: transform 180ms ease;
}

.connected-stack-tool:hover
.connected-stack-tool__icon {
    transform: scale(1.08);
}

.connected-stack-tool__name {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    margin: -1px;
    white-space: nowrap;
}

/* ==========================================================
   Footer
   ========================================================== */

.connected-stack-widget__footer {
    max-width: 310px;
    margin: 22px 0 0;
    color: var(--color-gray);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-body);
}

/* ==========================================================
   Medium container
   ========================================================== */

@container (max-width: 500px) {
    .connected-stack-widget {
        padding: 24px;
    }

    .connected-stack-widget__grid {
        gap: 8px;
        margin-top: 24px;
    }

    .connected-stack-tool__icon {
        width: 25px;
        height: 25px;
    }
}

/* ==========================================================
   Narrow container
   ========================================================== */

@container (max-width: 360px) {
    .connected-stack-widget {
        padding: 20px;
    }

    .connected-stack-widget__header {
        gap: 12px;
    }

    .connected-stack-widget__heading {
        font-size: var(--font-size-xl);
    }

    .connected-stack-tool {
        aspect-ratio: 1.15;
    }

    .connected-stack-tool__icon {
        width: 23px;
        height: 23px;
    }

    .connected-stack-widget__footer {
        margin-top: 18px;
        font-size: var(--font-size-md);
    }
}

/* ==========================================================
   Viewport fallback
   ========================================================== */

@media (max-width: 520px) {
    .connected-stack-widget__open {
        width: 26px;
        height: 26px;
    }
}

/* ==========================================================
   Reduced motion
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
    .connected-stack-widget__product,
    .connected-stack-tool,
    .connected-stack-tool__icon {
        transition: none;
    }

    .connected-stack-tool:hover {
        transform: none;
    }

    .connected-stack-tool:hover
    .connected-stack-tool__icon {
        transform: none;
    }
}