/* ===== Scroll Dashboard Assembly Section ===== */

/* The wrapper takes up extra height to create a scroll timeline */
.sd-wrapper {
    position: relative;
    height: 300vh; /* 3 screens high to allow scrolling */
    background: #fafafa;
    --scroll-p: 0; /* Updated via JS */
    --inv-p: calc(1 - var(--scroll-p));
}

/* The sticky container holds everything in view while scrolling the 300vh */
.sd-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- Header Area --- */
.sd-header {
    position: absolute;
    top: 15vh;
    text-align: center;
    /* Fades out and moves up as user scrolls (scroll-p goes to 1) */
    opacity: var(--inv-p);
    transform: translateY(calc(var(--scroll-p) * -10vh));
    z-index: 10;
    pointer-events: none; /* So it doesn't block interactions when invisible */
}

.sd-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: #18181b;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

/* Teal rounded highlight behind "deploy" */
.sd-highlight {
    background: #00A896;
    color: #ffffff;
    padding: 0.2rem 1rem;
    border-radius: 12px;
    display: inline-block;
}

.sd-subtitle {
    font-size: 1.1rem;
    color: #71717a;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.sd-btn {
    background: #18181b;
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    pointer-events: auto; /* Re-enable clicks */
    border: none;
    cursor: pointer;
}

/* --- Tablet / Dashboard Frame --- */
.sd-tablet {
    position: relative;
    width: 1080px;
    height: 650px;
    background: #f4f4f5;
    border: 18px solid #18181b;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.15);
    display: flex;
    overflow: visible;
    z-index: 5;

    /* Push laptop down completely off-screen at the start */
    transform: translateY(calc(var(--inv-p) * 120vh));
}

/* Tablet Sidebar */
.sdt-sidebar {
    width: 65px;
    background: #18181b;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    gap: 30px;
}

.sdt-sidebar .sdt-icon {
    width: 24px; height: 24px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
}

/* Tablet Main Content Area */
.sdt-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sdt-topbar {
    height: 65px;
    background: #fff;
    border-bottom: 1px solid #e4e4e7;
    display: flex;
    align-items: center;
    padding: 0 30px;
    justify-content: space-between;
}

.sdt-topbar h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.sdt-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
    padding: 16px;
}

/* --- Floating Dashboard Cards --- */
/* The magic here: they belong in the grid, but we apply an inverse transform using 
   our scroll variables. When scroll-p is 0, they are wildly transformed away.
   When scroll-p is 1, the transform becomes 0, snapping them perfectly into the grid! */
.sdc-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    padding: 18px;
    display: flex;
    flex-direction: column;
}

/* Card 1 (Top Left) */
.sdc-1 {
    transform:
        translate(calc(var(--inv-p) * -5vw), calc(var(--inv-p) * -75vh))
        rotate(calc(var(--inv-p) * -8deg))
        scale(calc(1 - var(--inv-p) * 0.35));
    box-shadow: 0 15px 35px rgba(0,0,0,calc(var(--inv-p) * 0.15));
}

/* Card 2 (Top Right) */
.sdc-2 {
    transform:
        translate(calc(var(--inv-p) * 5vw), calc(var(--inv-p) * -72vh))
        rotate(calc(var(--inv-p) * 6deg))
        scale(calc(1 - var(--inv-p) * 0.35));
    box-shadow: 0 15px 35px rgba(0,0,0,calc(var(--inv-p) * 0.15));
}

/* Card 3 (Bottom Left) */
.sdc-3 {
    transform:
        translate(calc(var(--inv-p) * -8vw), calc(var(--inv-p) * -58vh))
        rotate(calc(var(--inv-p) * -4deg))
        scale(calc(1 - var(--inv-p) * 0.35));
    box-shadow: 0 15px 35px rgba(0,0,0,calc(var(--inv-p) * 0.15));
}

/* Card 4 (Bottom Right) */
.sdc-4 {
    transform:
        translate(calc(var(--inv-p) * 8vw), calc(var(--inv-p) * -55vh))
        rotate(calc(var(--inv-p) * 5deg))
        scale(calc(1 - var(--inv-p) * 0.35));
    box-shadow: 0 15px 35px rgba(0,0,0,calc(var(--inv-p) * 0.15));
}

/* --- Agent Card Layout (left text + right image) --- */
.sdc-card {
    flex-direction: row;
    padding: 0;
    overflow: hidden;
}

.sdc-body {
    flex: 1;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.sdc-img {
    width: 160px;
    flex-shrink: 0;
    background-size: cover;
    background-position: center top;
    border-radius: 0 12px 12px 0;
}

.sdc-num {
    font-size: 0.65rem;
    font-weight: 700;
    color: #a1a1aa;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.sdc-body h4 {
    font-size: 0.9rem;
    font-weight: 800;
    color: #18181b;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.sdc-role {
    font-size: 0.65rem;
    font-weight: 600;
    color: #a78bfa;
    background: #f5f3ff;
    padding: 2px 7px;
    border-radius: 999px;
}

.sdc-email {
    font-size: 0.68rem;
    color: #a1a1aa;
    margin-bottom: 5px;
}

.sdc-tagline {
    font-size: 0.72rem;
    font-style: italic;
    color: #71717a;
    margin-bottom: 8px;
    line-height: 1.3;
}

.sdc-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sdc-list li {
    font-size: 0.68rem;
    color: #52525b;
    padding-left: 12px;
    position: relative;
    line-height: 1.3;
}

.sdc-list li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: #a78bfa;
    font-weight: 700;
}

.sdc-cta {
    display: inline-block;
    background: #18181b;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    text-decoration: none;
    align-self: flex-start;
    letter-spacing: 0.02em;
}

/* ===== Mobile / Tablet: static cards, no scroll animation ===== */
@media (max-width: 1100px) {
    /* Reset wrapper to normal flow */
    .sd-wrapper {
        height: auto;
        background: #fafafa;
        padding: 4rem 1.25rem;
    }

    /* Unstick the container */
    .sd-sticky {
        position: static;
        height: auto;
        overflow: visible;
        justify-content: flex-start;
        align-items: stretch;
    }

    /* Show header normally, no fade */
    .sd-header {
        position: static;
        opacity: 1;
        transform: none;
        text-align: center;
        margin-bottom: 2.5rem;
        pointer-events: auto;
    }

    .sd-title {
        font-size: clamp(1.8rem, 5vw, 2.8rem);
    }

    /* Hide the tablet chrome entirely */
    .sd-tablet {
        transform: none;
        width: 100%;
        height: auto;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        display: block;
    }

    .sdt-sidebar,
    .sdt-topbar {
        display: none;
    }

    .sdt-main {
        display: block;
    }

    /* Cards in a simple responsive grid */
    .sdt-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        padding: 0;
    }

    /* Reset all card transforms — no scatter animation */
    .sdc-1, .sdc-2, .sdc-3, .sdc-4 {
        transform: none !important;
        box-shadow: 0 8px 20px rgba(0,0,0,0.06) !important;
    }

    .sdc-card {
        border-radius: 16px;
        overflow: hidden;
    }

    .sdc-img {
        width: 110px;
    }

    .sdc-body {
        padding: 14px;
    }

}

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

    .sdc-img {
        width: 100px;
    }
}