/* Knowledgebase responsive stories */
.kb-story {
    max-width: 1200px;
    margin: 0 auto 2rem auto;
    padding: 1rem 5%;
}

.kb-story__title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #f5f5f5;
    border-radius: 4px;
}

.kb-story__content {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
}

.kb-story__images,
.kb-story__text {
    flex: 1 1 45%;
    min-width: 280px;
}

.kb-story__text {
    line-height: 1.6;
}

/* Alternate row: reverse the order (image on right) */
.kb-story--alt .kb-story__content {
    flex-direction: row-reverse;
}

/* Image grid */
.kb-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.kb-images__img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* 1 image: full width */
.kb-images--count-1 .kb-images__img {
    width: 100%;
}

/* 2 images: side by side */
.kb-images--count-2 .kb-images__img {
    width: calc(50% - 0.25rem);
}

/* 3 images: first full width, next two at 50% */
.kb-images--count-3 .kb-images__img:first-child {
    width: 100%;
}
.kb-images--count-3 .kb-images__img:nth-child(2),
.kb-images--count-3 .kb-images__img:nth-child(3) {
    width: calc(50% - 0.25rem);
}

/* 4 images: 2x2 grid */
.kb-images--count-4 .kb-images__img {
    width: calc(50% - 0.25rem);
}

/* Mobile: stack all images vertically */
@media (max-width: 600px) {
    .kb-images--count-2 .kb-images__img,
    .kb-images--count-3 .kb-images__img,
    .kb-images--count-4 .kb-images__img {
        width: 100%;
    }
}

/* Mobile: stack text/images but keep image grid */
@media (max-width: 600px) {
    .kb-story__content {
        flex-direction: column !important;
    }

    .kb-story__images,
    .kb-story__text {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .kb-story__images {
        order: 1; /* images always first on mobile */
    }

    .kb-story__text {
        order: 2;
    }

    /* 1 image: full width */
    .kb-images--count-1 .kb-images__img {
        width: 100%;
    }

    /* 2 images: side by side */
    .kb-images--count-2 .kb-images__img {
        width: calc(50% - 0.25rem);
    }

    /* 3 images: first full width, next two at 50% */
    .kb-images--count-3 .kb-images__img:first-child {
        width: 100%;
    }
    .kb-images--count-3 .kb-images__img:nth-child(2),
    .kb-images--count-3 .kb-images__img:nth-child(3) {
        width: calc(50% - 0.25rem);
    }

    /* 4 images: 2x2 grid */
    .kb-images--count-4 .kb-images__img {
        width: calc(50% - 0.25rem);
    }
}

/* Tablet: keep side by side but smaller gap */
@media (min-width: 601px) and (max-width: 900px) {
    .kb-story__content {
        gap: 1rem;
    }

    .kb-story__images,
    .kb-story__text {
        flex: 1 1 48%;
    }
}

.kb-search-strip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 auto 1rem auto;
    max-width: 100%;
    justify-content: center;
}

.kb-search-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.kb-search-controls input[type='text'] {
    min-width: 170px;
    width: min(320px, 65vw);
    margin: 0;
}

.kb-search-controls button[type='submit'].searchButtonThin {
    width: 36px;
    min-width: 36px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    margin: 0;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.kb-search-controls button[type='submit'].searchButtonThin .searchButtonThinIcon {
    width: 16px;
    height: 16px;
    line-height: 1;
}

.kb-clear-button {
    height: 30px;
    min-height: 30px;
    margin: 0;
}

.kb-search-summary {
    text-align: center;
    margin: 0.25rem auto 1rem auto;
    font-size: 0.95rem;
}

@media (max-width: 640px) {
    .kb-search-strip {
        gap: 6px;
    }

    .kb-search-label {
        width: 100%;
        text-align: center;
    }

    .kb-search-controls {
        gap: 6px;
    }

    .kb-search-controls input[type='text'] {
        min-width: 0;
        width: min(170px, 48vw);
        font-size: 0.9rem;
        padding: 2px 4px;
    }

    .kb-search-controls button[type='submit'].searchButtonThin {
        width: 30px;
        min-width: 30px;
        height: 28px;
        min-height: 28px;
    }

    .kb-search-controls button[type='submit'].searchButtonThin .searchButtonThinIcon {
        width: 14px;
        height: 14px;
    }

    .kb-clear-button {
        height: 28px;
        min-height: 28px;
    }

    .kb-search-summary {
        font-size: 0.9rem;
    }
}