.kps-sidebar-container {
    --kps-gap: 15px;
    --kps-img-width: 30%;
    
    /* Typography defaults */
    --kps-title-size: 1.1em;
    --kps-title-color: inherit;
    --kps-meta-size: 0.85em;
    --kps-meta-color: #888;
    --kps-excerpt-size: 0.95em;
    --kps-excerpt-color: inherit;

    margin-bottom: 20px;
    font-size: 14px; /* Default reset */
}

.kps-sidebar-item {
    display: flex;
    flex-direction: column; /* Default: Card mode (Image Top) */
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.kps-sidebar-item:last-child {
    border-bottom: none;
}

/* Image Wrapper */
.kps-sidebar-img {
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
    flex-shrink: 0;
}

.kps-sidebar-img img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.kps-sidebar-img:hover img {
    transform: scale(1.05);
}

/* Content Wrapper */
.kps-sidebar-content {
    flex-grow: 1;
    min-width: 0; /* Fix flex overflow */
}

/* Layout Variations */

/* LEFT */
.kps-layout-left {
    flex-direction: row;
    align-items: flex-start;
}

.kps-layout-left .kps-sidebar-img {
    width: var(--kps-img-width);
}

/* RIGHT */
.kps-layout-right {
    flex-direction: row-reverse;
    align-items: flex-start;
}

.kps-layout-right .kps-sidebar-img {
    width: var(--kps-img-width);
}

/* BOTTOM */
.kps-layout-bottom {
    flex-direction: column-reverse;
}

/* TOP (Default, re-enforced) */
.kps-layout-top {
    flex-direction: column;
}

/* Typography elements */
.kps-sidebar-title {
    margin: 0 0 5px 0;
    font-size: var(--kps-title-size, 1.1em);
    line-height: 1.3;
    color: var(--kps-title-color, inherit);
}

.kps-sidebar-title a {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
}

.kps-sidebar-meta {
    font-size: var(--kps-meta-size, 0.85em);
    color: var(--kps-meta-color, #888);
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kps-sidebar-excerpt {
    font-size: var(--kps-excerpt-size, 0.95em);
    color: var(--kps-excerpt-color, inherit);
    line-height: 1.5;
}

.kps-sidebar-excerpt p {
    margin: 0;
    font-size: inherit; /* Inherit from .kps-sidebar-excerpt */
    color: inherit;     /* Inherit from .kps-sidebar-excerpt */
    line-height: inherit;
}

/* Alignment Utilities */
.kps-align-left { text-align: left; }
.kps-align-center { text-align: center; }
.kps-align-right { text-align: right; }
.kps-align-justify { text-align: justify; }

/* Responsive Mobile Fix: Always stack on very small screens? */
@media (max-width: 480px) {
    .kps-layout-left, 
    .kps-layout-right {
        flex-direction: column;
    }
    .kps-layout-left .kps-sidebar-img, 
    .kps-layout-right .kps-sidebar-img {
        width: 100%;
    }
}
