/**
 * Purpose Hub Styles
 *
 * Radial layout: center circle with 4 feature boxes around it.
 * Desktop: CSS Grid 3-column layout, items placed via nth-child.
 * Mobile: 2-column grid for boxes, circle in center row.
 * L-shaped dashed connector lines link boxes to the circle.
 *
 * HTML structure per item:
 *   .purpose-hub__item
 *     .purpose-hub__box (title)
 *     .purpose-hub__link (wrapper for L-shape)
 *       .purpose-hub__connector (L-shaped dashed border)
 *       .purpose-hub__check (checkmark SVG)
 *
 * @package SmytecBuilder
 * @since 1.0.0
 */

/* ==========================================================
   Container
   ========================================================== */

.purpose-hub {
    position: relative;
    width: 100%;
}

/* ==========================================================
   Grid Layout — Desktop
   ========================================================== */

.purpose-hub__layout {
    display: grid;
    grid-template-columns: 1fr var(--ph-circle, 530px) 1fr;
    grid-template-rows: 1fr 1fr;
    align-items: center;
    column-gap: 0;
    row-gap: 0;
}

/* ==========================================================
   Center Circle
   ========================================================== */

.purpose-hub__center {
    grid-column: 2;
    grid-row: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.purpose-hub__circle-outer {
    width: var(--ph-circle, 530px);
    height: var(--ph-circle, 530px);
    border-radius: 50%;
    background: rgba(4, 43, 124, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.purpose-hub__circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(4, 43, 124, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px;
    text-align: center;
    color: #fff;
}

/* ==========================================================
   Center Circle — Typography
   ========================================================== */

.purpose-hub__main-title {
    font-size: 32px;
    font-weight: 300;
    color: #fff;
    line-height: 1.3;
    margin: 0 0 16px;
    padding-bottom: 0;
}

.purpose-hub__main-text {
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.purpose-hub__main-text p {
    margin: 0 0 12px;
}

.purpose-hub__main-text p:last-child {
    margin-bottom: 0;
}

/* ==========================================================
   Item — Feature Box + Link (connector + check)
   ========================================================== */

.purpose-hub__item {
    display: flex;
    gap: 0;
    position: relative;
    z-index: 1;
    margin-bottom: 0 !important;
}

/* Left items (1, 2): box on the left, link on the right */
.purpose-hub__item:nth-child(1),
.purpose-hub__item:nth-child(2) {
    grid-column: 1;
    flex-direction: row;
}

.purpose-hub__item:nth-child(1) {
    grid-row: 1;
    align-items: flex-start;
}

.purpose-hub__item:nth-child(2) {
    grid-row: 2;
    align-items: flex-end;
}

/* Right items (3, 4): link on the left, box on the right */
.purpose-hub__item:nth-child(3),
.purpose-hub__item:nth-child(4) {
    grid-column: 3;
    flex-direction: row-reverse;
}

.purpose-hub__item:nth-child(3) {
    grid-row: 1;
    align-items: flex-start;
}

.purpose-hub__item:nth-child(4) {
    grid-row: 2;
    align-items: flex-end;
}

/* ==========================================================
   Feature Box
   ========================================================== */

.purpose-hub__box {
    background: rgba(4, 108, 188, 0.15);
    border-radius: 30px;
    padding: clamp(24px, 3vw, 48px);
    width: clamp(180px, 18vw, 300px);
    text-align: center;
    flex-shrink: 0;
}

.purpose-hub__box-title {
    font-size: 24px;
    font-weight: 300;
    color: #000;
    line-height: 1.3;
    margin: 0;
    padding-bottom: 0;
}

/* ==========================================================
   Link Wrapper — Contains connector + check
   Laid out vertically so connector is L-shaped
   ========================================================== */

.purpose-hub__link {
    display: flex;
    flex-shrink: 1;
    min-width: 0;
}

/* --- Left items: link flows column (connector top → check bottom) --- */

/* Item 1 (top-left): connector curves down, check at bottom */
.purpose-hub__item:nth-child(1) .purpose-hub__link {
    flex-direction: column;
    padding-top: clamp(20px, 3vw, 48px);
    padding-left: clamp(8px, 1.5vw, 24px);
}

/* Item 2 (bottom-left): connector curves up, check at top */
.purpose-hub__item:nth-child(2) .purpose-hub__link {
    flex-direction: column-reverse;
    padding-left: clamp(8px, 1.5vw, 24px);
    padding-bottom: clamp(20px, 3vw, 48px);
}

/* --- Right items: link flows column (mirrored) --- */

/* Item 3 (top-right): connector curves down, check at bottom */
.purpose-hub__item:nth-child(3) .purpose-hub__link {
    flex-direction: column;
    align-items: flex-end;
    padding-right: clamp(8px, 1.5vw, 24px);
    padding-top: clamp(20px, 3vw, 48px);
}

/* Item 4 (bottom-right): connector curves up, check at top */
.purpose-hub__item:nth-child(4) .purpose-hub__link {
    flex-direction: column-reverse;
    align-items: flex-end;
    padding-right: clamp(8px, 1.5vw, 24px);
    padding-bottom: clamp(20px, 3vw, 48px);
}

/* ==========================================================
   Connector — L-shaped dashed border
   Each item gets specific borders to form the L-shape
   ========================================================== */

.purpose-hub__connector {
    flex-shrink: 0;
}

/* Item 1 (top-left): horizontal top + vertical right → curves at top-right */
.purpose-hub__item:nth-child(1) .purpose-hub__connector {
    width: clamp(60px, 10vw, 173px);
    height: clamp(60px, 7vw, 120px);
    border-bottom: 1px dashed rgb(188, 188, 188);
    border-left: 1px dashed rgb(188, 188, 188);
    border-bottom-left-radius: 30px;
    margin-left: clamp(10px, 2vw, 34px);
    margin-top: clamp(8px, 1vw, 18px);
}

/* Item 2 (bottom-left): horizontal bottom + vertical right → curves at bottom-right */
.purpose-hub__item:nth-child(2) .purpose-hub__connector {
    width: clamp(60px, 10vw, 173px);
    height: clamp(60px, 7vw, 120px);
    border-top: 1px dashed rgba(188, 188, 188, 1);
    border-left: 1px dashed rgba(188, 188, 188, 1);
    border-top-left-radius: 30px;
    margin-left: clamp(10px, 2vw, 34px);
    margin-bottom: clamp(8px, 1vw, 18px);
}

/* Item 3 (top-right): horizontal top + vertical left → curves at top-left */
.purpose-hub__item:nth-child(3) .purpose-hub__connector {
    width: clamp(60px, 10vw, 173px);
    height: clamp(60px, 7vw, 120px);
    border-bottom: 1px dashed rgba(188, 188, 188, 1);
    border-right: 1px dashed rgba(188, 188, 188, 1);
    border-bottom-right-radius: 30px;
    margin-right: clamp(10px, 2vw, 34px);
    margin-top: clamp(8px, 1vw, 18px);
}

/* Item 4 (bottom-right): horizontal bottom + vertical left → curves at bottom-left */
.purpose-hub__item:nth-child(4) .purpose-hub__connector {
    width: clamp(60px, 10vw, 173px);
    height: clamp(60px, 7vw, 120px);
    border-top: 1px dashed rgba(188, 188, 188, 1);
    border-right: 1px dashed rgba(188, 188, 188, 1);
    border-top-right-radius: 30px;
    margin-right: clamp(10px, 2vw, 34px);
    margin-bottom: clamp(8px, 1vw, 18px);
}

/* ==========================================================
   Checkmark Icon
   ========================================================== */

.purpose-hub__check {
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14.5px;
    background: rgba(4, 108, 188, 0.15);
    border-radius: 50%;
}

.purpose-hub__check img {
    width: 39px;
    height: 39px;
    display: block;
}

/* ==========================================================
   Responsive — Small Desktop (max-width: 1440px)
   ========================================================== */

@media (max-width: 1580px) {
    .purpose-hub__layout {
        grid-template-columns: 1fr clamp(380px, 30vw, 530px) 1fr;
        gap: 20px;
    }

    .purpose-hub__circle-outer {
        width: clamp(380px, 30vw, 530px);
        height: clamp(380px, 30vw, 530px);
        padding: 20px;
    }

    .purpose-hub__circle {
        padding: clamp(36px, 4vw, 64px);
    }

    .purpose-hub__main-title {
        font-size: clamp(24px, 2vw, 32px);
    }

    .purpose-hub__main-text {
        font-size: clamp(13px, 1vw, 16px);
    }

    .purpose-hub__box-title {
        font-size: clamp(18px, 1.5vw, 24px);
    }
}

/* ==========================================================
   Responsive — Small Laptop (max-width: 1200px)
   ========================================================== */

@media (max-width: 1200px) {
    .purpose-hub__layout {
        grid-template-columns: 1fr 420px 1fr;
        gap: 0;
    }

    .purpose-hub__circle-outer {
        width: 420px;
        height: 420px;
        padding: 18px;
    }

    .purpose-hub__circle {
        padding: 42px;
    }

    .purpose-hub__main-title {
        font-size: 24px;
    }

    .purpose-hub__main-text {
        font-size: 13px;
    }

    .purpose-hub__box {
        width: clamp(140px, 14vw, 220px);
        padding: clamp(16px, 2vw, 32px);
    }

    .purpose-hub__box-title {
        font-size: 18px;
    }

    .purpose-hub__check {
        width: 56px;
        height: 56px;
        padding: 10px;
    }

    .purpose-hub__check img {
        width: 32px;
        height: 32px;
    }
}

/* ==========================================================
   Responsive — Mobile Layout (max-width: 1024px)
   ========================================================== */

@media (max-width: 1024px) {

    /* Mobile: 2-col grid with circle spanning full width in center row */
    .purpose-hub__layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        justify-items: center;
        max-width: 600px;
        margin: 0 auto;
        column-gap: 10px;
    }

    .purpose-hub__item:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
        align-items: center;
    }

    .purpose-hub__item:nth-child(3) {
        grid-column: 2;
        grid-row: 1;
        align-items: center;
    }

    .purpose-hub__center {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .purpose-hub__item:nth-child(2) {
        grid-column: 1;
        grid-row: 3;
        align-items: center;
    }

    .purpose-hub__item:nth-child(4) {
        grid-column: 2;
        grid-row: 3;
        align-items: center;
    }

    /* All items vertical on mobile */
    .purpose-hub__item {
        flex-direction: column !important;
        text-align: center;
        gap: 24px;
        width: 100%;
    }

    /* Top items: box → link (connector down → check) */
    .purpose-hub__item:nth-child(1) .purpose-hub__link,
    .purpose-hub__item:nth-child(3) .purpose-hub__link {
        flex-direction: column !important;
        align-items: center !important;
        padding: 0 !important;
    }

    /* Bottom items: link (check → connector up) → box */
    .purpose-hub__item:nth-child(2),
    .purpose-hub__item:nth-child(4) {
        flex-direction: column-reverse !important;
    }

    .purpose-hub__item:nth-child(2) .purpose-hub__link,
    .purpose-hub__item:nth-child(4) .purpose-hub__link {
        flex-direction: column-reverse !important;
        align-items: center !important;
        padding: 0 !important;
    }

    /* Mobile connectors: vertical dashed lines */
    .purpose-hub__item:nth-child(1) .purpose-hub__connector,
    .purpose-hub__item:nth-child(2) .purpose-hub__connector,
    .purpose-hub__item:nth-child(3) .purpose-hub__connector,
    .purpose-hub__item:nth-child(4) .purpose-hub__connector {
        width: 0;
        height: 30px;
        border-top: none;
        border-bottom: none;
        border-right: none;
        border-left: 1px dashed rgba(188, 188, 188, 1);
        border-radius: 0;
        margin: 0;
        position: relative;
    }

    .purpose-hub__connector::after {
        content: '';
        position: absolute;
        left: -1px;
        top: 100%;
        width: 1px;
        height: 200px;
        border-left: 1px dashed rgba(188, 188, 188, 1);
        z-index: 1;
    }

    .purpose-hub__item:nth-child(2) .purpose-hub__connector::after,
    .purpose-hub__item:nth-child(4) .purpose-hub__connector::after {
        top: auto;
        bottom: 100%;
    }

    .purpose-hub__link {
        gap: 18px;
    }

    .purpose-hub__circle-outer {
        width: 400px;
        height: 400px;
        padding: 15px;
    }

    .purpose-hub__circle {
        padding: 28px;
    }

    .purpose-hub__box {
        width: 100%;
        min-width: 120px;
        max-width: 162px;
        padding: 24px;
        min-height: 102px;
    }

    .purpose-hub__check {
        width: 56px;
        height: 56px;
        padding: 10px;
    }

    .purpose-hub__check img {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 767px) {
    .purpose-hub__main-title {
        font-size: 15px;
    }

    .purpose-hub__main-text {
        font-size: 9px;
    }

    .purpose-hub__circle-outer {
        width: 336px;
        height: 336px;
    }

}