/* ============================================================
   5D Model Diagram – Plugin Stylesheet
   Mobile-first, fully responsive
   ============================================================ */

:root {
    --fdm-blue:        #2d6da3;
    --fdm-blue-light:  #d6e8f7;
    --fdm-blue-mid:    #a8cce8;
    --fdm-green:       #3a7d52;
    --fdm-green-light: #d4eddf;
    --fdm-green-mid:   #9dcfb3;
    --fdm-grey:        #5c6b7a;
    --fdm-grey-light:  #e8eaec;
    --fdm-grey-mid:    #b0bec8;
    --fdm-text-dark:   #1a2a3a;
    --fdm-text-med:    #3a4e62;
    --fdm-border-r:    10px;
    --fdm-font:        'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

/* ── Wrapper ────────────────────────────────────────────────── */
.fdm-wrapper {
    font-family: var(--fdm-font);
    color: var(--fdm-text-dark);
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 32px;
    box-sizing: border-box;
}

/* ── Header box ─────────────────────────────────────────────── */
.fdm-header {
    border: 2px solid var(--fdm-grey-mid);
    border-radius: var(--fdm-border-r);
    padding: 14px 20px;
    margin-bottom: 36px;
    background: #fff;
}
.fdm-header__text {
    font-size: clamp(15px, 2.2vw, 19px);
    font-weight: 700;
    color: var(--fdm-text-dark);
    line-height: 1.3;
}

/* ── Flow wrap (steps + feedback arrow) ─────────────────────── */
.fdm-flow-wrap {
    margin-bottom: 32px;
}

/* ── Flow row ───────────────────────────────────────────────── */
.fdm-flow {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

/* ── Arrow between steps ────────────────────────────────────── */
.fdm-arrow {
    flex-shrink: 0;
    font-size: 22px;
    color: var(--fdm-grey);
    padding: 0 6px;
    line-height: 1;
}

/* ── Individual step box ────────────────────────────────────── */
.fdm-step {
    flex: 1 1 0;
    min-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px;
    border-radius: var(--fdm-border-r);
    border: 2px solid;
    gap: 6px;
    transition: box-shadow .2s;
}
.fdm-step:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.10);
}

/* Grey variant */
.fdm-step--grey {
    background: var(--fdm-grey-light);
    border-color: var(--fdm-grey-mid);
}
.fdm-step--grey .fdm-step__title { color: var(--fdm-grey); }
.fdm-step--grey .fdm-step__sub   { color: var(--fdm-grey); }

/* Blue variant */
.fdm-step--blue {
    background: var(--fdm-blue-light);
    border-color: var(--fdm-blue-mid);
}
.fdm-step--blue .fdm-step__title { color: var(--fdm-blue); }
.fdm-step--blue .fdm-step__sub   { color: var(--fdm-blue); }

/* Green variant */
.fdm-step--green {
    background: var(--fdm-green-light);
    border-color: var(--fdm-green-mid);
}
.fdm-step--green .fdm-step__title { color: var(--fdm-green); }
.fdm-step--green .fdm-step__sub   { color: var(--fdm-green); }

.fdm-step__title {
    font-size: clamp(13px, 1.6vw, 16px);
    font-weight: 700;
    line-height: 1.25;
}
.fdm-step__sub {
    font-size: clamp(11px, 1.3vw, 13px);
    font-weight: 400;
    line-height: 1.35;
}

/* ── Feedback loop ──────────────────────────────────────────── */
.fdm-feedback {
    margin-top: 6px;
    padding: 0 4px;
}
.fdm-feedback__line {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.fdm-feedback__svg {
    width: 66%;
    height: 40px;
    display: block;
    margin: 0 auto;
}
.fdm-feedback__label {
    font-size: 12px;
    color: var(--fdm-blue);
    margin-top: 2px;
    font-style: italic;
    text-align: center;
}

/* ── Section banner ─────────────────────────────────────────── */
.fdm-banner {
    background: var(--fdm-blue-light);
    border: 2px solid var(--fdm-blue-mid);
    border-radius: 40px;
    padding: 16px 32px;
    text-align: center;
    margin-bottom: 24px;
}
.fdm-banner__text {
    font-size: clamp(15px, 2vw, 18px);
    font-weight: 700;
    color: var(--fdm-blue);
}

/* ── Bottom cards grid ──────────────────────────────────────── */
.fdm-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.fdm-card {
    background: var(--fdm-blue-light);
    border: 2px solid var(--fdm-blue-mid);
    border-radius: var(--fdm-border-r);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: box-shadow .2s;
}
.fdm-card:hover {
    box-shadow: 0 4px 16px rgba(45,109,163,.18);
}
.fdm-card__title {
    font-size: clamp(13px, 1.5vw, 15px);
    font-weight: 700;
    color: var(--fdm-blue);
    line-height: 1.25;
}
.fdm-card__sub {
    font-size: clamp(11px, 1.3vw, 13px);
    color: var(--fdm-blue);
    line-height: 1.4;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Tablet: 2-column cards, flow scrollable */
@media (max-width: 768px) {
    .fdm-wrapper {
        padding: 20px 12px 28px;
    }

    .fdm-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .fdm-flow {
        gap: 0;
    }

    .fdm-step {
        min-width: 90px;
        padding: 12px 8px;
    }

    .fdm-arrow {
        font-size: 18px;
        padding: 0 4px;
    }

    .fdm-feedback__svg {
        width: 85%;
    }
}

/* Mobile: stack cards, stack flow vertically */
@media (max-width: 520px) {
    .fdm-wrapper {
        padding: 16px 10px 24px;
    }

    /* Stack steps vertically on small screens */
    .fdm-flow {
        flex-direction: column;
        align-items: stretch;
        overflow-x: unset;
        gap: 0;
    }

    .fdm-step {
        min-width: unset;
        width: 100%;
        flex-direction: row;
        text-align: left;
        justify-content: flex-start;
        gap: 10px;
        padding: 12px 14px;
    }

    .fdm-step__title {
        min-width: 80px;
    }

    .fdm-arrow {
        transform: rotate(90deg);
        text-align: center;
        padding: 4px 0;
        display: block;
        font-size: 20px;
    }

    /* Feedback loop hidden on tiny screens — layout breaks */
    .fdm-feedback {
        display: none;
    }

    .fdm-banner {
        border-radius: 14px;
        padding: 14px 16px;
    }

    .fdm-cards {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .fdm-card {
        padding: 14px 10px;
    }
}

/* Very small: single column cards */
@media (max-width: 360px) {
    .fdm-cards {
        grid-template-columns: 1fr;
    }
}
