:root {
    --gap: 16px;
    --bg: #f5f7fb;
    --card-bg: #fff;
    --accent: #000;
    --muted: #7b8794;
    --radius: 8px;
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.btn {
    background: white;
    border: 1px solid #e6e9ef;
    padding: 0 12px;
    border-radius: 8px;
    cursor: pointer;
    color: #111827;
    font-weight: 600;
    height: auto;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}


/* Masonry container */

.masonry {
    position: relative;
    width: 100%;
}


/* Columns wrapper: we will create N .m-column children via JS */

.m-column {
    float: left;
    padding-left: var(--gap);
    box-sizing: border-box;
}


/* Items */

.m-item {
    background: var(--card-bg);
    margin-bottom: var(--gap);
    border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.06);
    overflow: hidden;
    transition: transform .18s ease, opacity .18s ease;
}

.m-item.hidden {
    opacity: 0;
    transform: scale(.98);
    pointer-events: none;
    height: 0 !important;
    margin: 0 0 0 0;
    padding: 0;
}

.m-item img {
    display: block;
    width: 100%;
    height: auto;
}

.card-body {
    padding: 12px 14px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 6px;
}

.card-sub {
    color: var(--muted);
    font-size: 13px;
}


/* Clear floats */

.masonry:after {
    content: "";
    display: table;
    clear: both;
}


/* responsive column widths (JS will override widths but keep fallback) */

@media (min-width: 1100px) {
    .m-column {
        width: calc(100% / 4);
    }
    /* fallback */
}

@media (min-width: 800px) and (max-width:1099px) {
    .m-column {
        width: calc(100% / 3);
    }
}

@media (min-width: 600px) and (max-width:799px) {
    .m-column {
        width: calc(100% / 2);
    }
}

@media (max-width:599px) {
    .m-column {
        width: 100%;
    }
}


/* small helper */

.note {
    color: var(--muted);
    font-size: 13px;
    margin-top: 8px;
}