/* ===== RWM Frontend ===== */
.rwm-category-page { padding: 24px 0 48px; }

/* Header */
.rwm-cat-header { margin-bottom: 20px; }
.rwm-cat-subtitle { color: #666; font-size: 15px; margin-top: 6px; }

/* Parent category sub-category cards */
.rwm-subcat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 6px 0 28px;
}
.rwm-subcat-card {
    position: relative;
    min-height: 168px;
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(135deg, #111827, #0f766e);
    color: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 18px;
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 12px 30px rgba(15,23,42,.12);
    isolation: isolate;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.rwm-subcat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 44px rgba(15,23,42,.18);
    border-color: rgba(0,162,255,.35);
}
.rwm-subcat-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s;
}
.rwm-subcat-card:hover img { transform: scale(1.05); }
.rwm-subcat-card-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.76));
}
.rwm-subcat-title,
.rwm-subcat-kicker,
.rwm-subcat-arrow {
    position: relative;
    z-index: 1;
}
.rwm-subcat-kicker {
    width: fit-content;
    margin-bottom: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.22);
    color: rgba(255,255,255,.86);
    font-size: 11px;
    font-weight: 700;
}
.rwm-subcat-title {
    font-size: 30px;
    line-height: 1.05;
    font-weight: 800;
}
.rwm-subcat-arrow {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255,255,255,.88);
}

/* Layout */
.rwm-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}
.rwm-layout-full { grid-template-columns: 1fr; }

/* Sidebar */
.rwm-sidebar { position: sticky; top: 80px; }
.rwm-filter-box {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.rwm-filter-title {
    font-weight: 700; font-size: 12px; color: #374151;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px;
}
.rwm-filter-list { display: flex; flex-direction: column; gap: 2px; }
.rwm-filter-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 7px 10px; border-radius: 8px;
    font-size: 13px; color: #374151; text-decoration: none;
    transition: background .15s;
}
.rwm-filter-item:hover, .rwm-filter-item.active {
    background: var(--primary-light, rgba(0,162,255,.08));
    color: var(--primary, #00A2FF);
}
.rwm-filter-count {
    font-size: 11px; color: #9ca3af;
    background: #f3f4f6; padding: 1px 6px; border-radius: 10px;
}
.rwm-tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.rwm-post-hashtags { margin: 0 0 14px; }
.rwm-tag {
    display: inline-block; padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 500;
    background: #f3f4f6; color: #374151; text-decoration: none;
    transition: background .15s, color .15s;
    cursor: pointer;
}
.rwm-tag:hover {
    background: var(--primary, #00A2FF); color: #fff;
}
.rwm-cat-desc-mini { font-size: 12px; color: #666; line-height: 1.7; }

/* Active filter bar */
.rwm-active-bar {
    display: flex; align-items: center; gap: 10px;
    background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 8px; padding: 8px 14px;
    font-size: 13px; margin-bottom: 16px;
}
.rwm-active-bar a { color: #dc2626; font-size: 12px; }

/* Posts grid */
.rwm-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.rwm-post-card {
    background: #fff; border: 1px solid #e5e7eb;
    border-radius: 12px; overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.rwm-post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.rwm-post-thumb {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f3f4f6;
}
.rwm-post-card.is-portrait .rwm-post-thumb { aspect-ratio: 9/16; }
.rwm-post-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform .3s;
}
.rwm-post-card:hover .rwm-post-thumb img { transform: scale(1.05); }

.rwm-post-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px;
    opacity: 0; transition: opacity .2s;
}
.rwm-post-card:hover .rwm-post-overlay { opacity: 1; }
.rwm-view-all-btn,
.rwm-preview-btn,
.rwm-download-btn {
    background: var(--primary, #00A2FF); color: #fff;
    padding: 8px 18px; border-radius: 8px;
    font-size: 13px; font-weight: 600; text-decoration: none;
}
.rwm-preview-btn { background: rgba(255,255,255,.22); }
.rwm-download-btn { background: rgba(17,24,39,.82); }
.rwm-img-count-badge {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,.65); color: #fff;
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 20px;
}
.rwm-res-badge {
    position: absolute; bottom: 8px; left: 8px;
    background: rgba(0,0,0,.65); color: #fff;
    font-size: 10px; padding: 2px 7px; border-radius: 4px;
}
.rwm-post-info { padding: 10px 12px; }
.rwm-post-name { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.rwm-post-name a { color: var(--text,#1a1a1a); text-decoration: none; }
.rwm-post-name a:hover { color: var(--primary,#00A2FF); }
.rwm-style-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.rwm-image-tags { padding: 8px 2px 0; }
.rwm-stag {
    font-size: 10px; font-weight: 700;
    padding: 2px 6px; border-radius: 4px;
    background: #f3f4f6; color: #6b7280;
}
.rwm-stag-4k     { background: #dbeafe; color: #1d4ed8; }
.rwm-stag-cute   { background: #fce7f3; color: #be185d; }
.rwm-stag-aesthetic { background: #f3e8ff; color: #7c3aed; }
.rwm-stag-fanart { background: #dcfce7; color: #15803d; }
.rwm-stag-blox-fruits { background: #ffedd5; color: #c2410c; }

/* Single post gallery */
.rwm-wallpaper-image-section {
    margin: 36px 0;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}
.rwm-wallpaper-image-title {
    margin: 0 0 16px;
    font-size: 22px;
    line-height: 1.25;
}
.rwm-gallery-wrap { margin: 24px 0; }
.rwm-category-image-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}
.rwm-term-gallery .rwm-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 10px;
}
.rwm-tabs {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
    border-bottom: 2px solid #e5e7eb; padding-bottom: 0;
}
.rwm-tab {
    padding: 9px 16px; background: transparent; border: none;
    border-bottom: 3px solid transparent; margin-bottom: -2px;
    font-size: 13px; font-weight: 600; cursor: pointer; color: #6b7280;
    transition: color .15s, border-color .15s;
}
.rwm-tab.active, .rwm-tab:hover {
    color: var(--primary,#00A2FF);
    border-bottom-color: var(--primary,#00A2FF);
}

.rwm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.rwm-item {
    border-radius: 10px; overflow: hidden;
    background: #fff; border: 1px solid #e5e7eb;
    transition: transform .2s, box-shadow .2s;
}
.rwm-item:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.09); }
.rwm-thumb {
    position: relative; aspect-ratio: 16/9; overflow: hidden; background: #f3f4f6;
}
.rwm-item.is-portrait .rwm-thumb { aspect-ratio: 9/16; }
.rwm-thumb > a,
.rwm-post-thumb > a.rwm-preview { display: block; width: 100%; height: 100%; }
.rwm-thumb img { width:100%;height:100%;object-fit:cover;display:block;transition:transform .3s; }
.rwm-item:hover .rwm-thumb img { transform: scale(1.05); }
.rwm-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,.5);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
    opacity: 0; transition: opacity .2s;
}
.rwm-item:hover .rwm-overlay { opacity: 1; }
.rwm-dl, .rwm-view {
    display: inline-block;
    padding: 6px 14px; border-radius: 6px; font-size: 12px;
    font-weight: 600; text-decoration: none;
}
.rwm-dl { background: var(--primary,#00A2FF); color: #fff; }
.rwm-view { background: rgba(255,255,255,.2); color: #fff; }
.rwm-item-date { font-size: 10px; color: #9ca3af; padding: 4px 8px; }

/* Lightbox */
body.rwm-lightbox-open { overflow: hidden; }
.rwm-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,.88);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.rwm-lightbox.is-open { display: flex; }
.rwm-lightbox-inner {
    position: relative;
    max-width: min(96vw, 3840px);
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.rwm-lightbox-img {
    display: block;
    max-width: 96vw;
    max-height: calc(94vh - 54px);
    width: auto;
    height: auto;
    object-fit: contain;
    background: #111;
}
.rwm-lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #111827;
    font-size: 24px;
    line-height: 34px;
    cursor: pointer;
}
.rwm-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 56px;
    border: 0;
    border-radius: 8px;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
}
.rwm-lightbox-prev { left: -58px; }
.rwm-lightbox-next { right: -58px; }
.rwm-lightbox-nav:hover { background: rgba(255,255,255,.28); }
.rwm-lightbox-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 0;
    color: #fff;
}
.rwm-lightbox-meta { font-size: 13px; color: rgba(255,255,255,.75); }
.rwm-lightbox-download {
    background: var(--primary,#00A2FF);
    color: #fff;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
}

/* Responsive */
@media (max-width: 900px) {
    .rwm-layout { grid-template-columns: 1fr; }
    .rwm-sidebar { position: static; display: flex; flex-wrap: wrap; gap: 12px; }
    .rwm-filter-box { flex: 1; min-width: 200px; }
    .rwm-posts-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (max-width: 480px) {
    .rwm-posts-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .rwm-term-gallery .rwm-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .rwm-lightbox-prev { left: 8px; }
    .rwm-lightbox-next { right: 8px; }
    .rwm-lightbox-nav { width: 36px; height: 48px; font-size: 34px; }
}
