/* =========================================================
   NSYArt Infinite Scroll Gallery – Frontend Styles
   Masonry layout via CSS columns
   ========================================================= */

/* ── Gallery wrapper ──────────────────────────────────────── */
.nsyart-gallery-wrap {
    --nsyart-cols-desktop: 3;
    --nsyart-cols-tablet:  2;
    --nsyart-cols-mobile:  1;
    --nsyart-gap:          16px;
    --nsyart-radius:       8px;
    --nsyart-loader-color: #4a90d9;
    width: 100%;
    box-sizing: border-box;
}

/* ── Masonry grid (flexbox columns) ──────────────────────── */
.nsyart-grid {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: var(--nsyart-gap);
    width: 100%;
    box-sizing: border-box;
}

/* Each column is a flex child that stacks cards vertically */
.nsyart-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--nsyart-gap);
}

/* ── Card ─────────────────────────────────────────────────── */
.nsyart-card {
    position: relative;
    border-radius: var(--nsyart-radius);
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    transition: transform .25s ease, box-shadow .25s ease;
    box-sizing: border-box;
    width: 100%;
}

.nsyart-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
}

.nsyart-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ── Image wrapper ────────────────────────────────────────── */
.nsyart-card__img-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #e8e8e8;
}

/* Natural height — the heart of masonry */
.nsyart-card__img-wrap img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform .35s ease;
}

.nsyart-card:hover .nsyart-card__img-wrap img {
    transform: scale(1.04);
}

/* Placeholder when no image */
.nsyart-card__no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 40px 0;
    color: #aaa;
    background: #f0f0f0;
}

/* ── Category badge ───────────────────────────────────────── */
.nsyart-card__badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    line-height: 1.6;
}

/* ── Card body ────────────────────────────────────────────── */
.nsyart-card__body {
    padding: 10px 14px 14px;
}

.nsyart-card__title {
    margin: 0 0 5px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #1a1a1a;
}

.nsyart-card__excerpt {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #555;
}

/* ── Loading spinner ──────────────────────────────────────── */
.nsyart-loader {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 32px 0;
}

.nsyart-loader.is-active {
    display: flex;
}

.nsyart-spinner {
    width:  36px;
    height: 36px;
    border: 3px solid rgba(0,0,0,.12);
    border-top-color: var(--nsyart-loader-color);
    border-radius: 50%;
    animation: nsyart-spin .7s linear infinite;
}

@keyframes nsyart-spin {
    to { transform: rotate(360deg); }
}

/* ── No posts ─────────────────────────────────────────────── */
.nsyart-no-posts {
    text-align: center;
    color: #888;
    padding: 40px 0;
}

/* ── Card entry animation ─────────────────────────────────── */
.nsyart-card.nsyart-entering {
    animation: nsyart-fadein .4s ease both;
}

@keyframes nsyart-fadein {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .nsyart-card,
    .nsyart-card__img-wrap img,
    .nsyart-card.nsyart-entering {
        animation: none;
        transition: none;
    }
}
