/* ============================================================
   X9Z7 MEMES PAGE
   ============================================================ */

/* ── Banner ── */
.memes-banner {
    background: linear-gradient(135deg, #000 0%, #0a0a0a 50%, #000 100%);
    border-bottom: 1px solid rgba(0,255,65,0.2);
    padding: 3rem 1rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.memes-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(0,255,65,0.07) 0%, transparent 65%);
    pointer-events: none;
}
.memes-banner-inner { position: relative; z-index: 1; }
.memes-banner-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.memes-banner-icon {
    font-size: 2rem;
    color: var(--matrix-green);
    text-shadow: var(--glow-text);
}
.memes-banner-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 900;
    color: var(--matrix-green);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: var(--glow-text);
}
.memes-banner-sub {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: rgba(0,255,65,0.5);
    margin: 0;
}

/* ── Controls / Search ── */
.memes-controls-wrap {
    background: rgba(0,0,0,0.8);
    border-bottom: 1px solid rgba(0,255,65,0.1);
    padding: 1rem;
    position: sticky;
    top: 64px;
    z-index: 100;
    backdrop-filter: blur(10px);
}
.memes-controls-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.memes-search-box {
    display: flex;
    align-items: center;
    background: rgba(0,255,65,0.04);
    border: 1px solid rgba(0,255,65,0.25);
    border-radius: 3px;
    padding: 0 0.75rem;
    flex: 0 0 260px;
    min-width: 200px;
    transition: border-color 0.2s;
}
.memes-search-box:focus-within {
    border-color: var(--matrix-green);
    box-shadow: 0 0 0 2px rgba(0,255,65,0.08);
}
.memes-search-icon {
    color: rgba(0,255,65,0.4);
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-right: 0.5rem;
}
.memes-search-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--matrix-green);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 0.45rem 0;
    width: 100%;
}
.memes-search-input::placeholder { color: rgba(0,255,65,0.3); }
.memes-search-clear {
    background: none;
    border: none;
    color: rgba(0,255,65,0.4);
    cursor: pointer;
    padding: 0;
    font-size: 0.75rem;
    flex-shrink: 0;
    line-height: 1;
}
.memes-search-clear:hover { color: var(--matrix-green); }

.memes-tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex: 1;
}
.meme-tag-btn {
    background: transparent;
    border: 1px solid rgba(0,255,65,0.2);
    color: rgba(0,255,65,0.6);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.25rem 0.65rem;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: lowercase;
}
.meme-tag-btn:hover,
.meme-tag-btn.active {
    background: var(--matrix-green);
    color: #000;
    border-color: var(--matrix-green);
    font-weight: 700;
}
.memes-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: rgba(0,255,65,0.4);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Grid ── */
.memes-grid-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
}
.memes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
@media (min-width: 576px)  { .memes-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }
@media (min-width: 992px)  { .memes-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }
@media (min-width: 1200px) { .memes-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }

.memes-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: rgba(0,255,65,0.5);
    font-family: var(--font-mono);
    font-size: 0.82rem;
}
.memes-loading p { margin-top: 1rem; }

.memes-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 1rem;
    color: rgba(0,255,65,0.35);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ── Meme Card ── */
.meme-card {
    position: relative;
    background: #090909;
    border: 1px solid rgba(0,255,65,0.15);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
}
.meme-card:hover {
    border-color: var(--matrix-green);
    box-shadow: 0 0 16px rgba(0,255,65,0.15);
    transform: translateY(-3px);
}
.meme-card-img-wrap {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #000;
}
.meme-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.35s ease;
}
.meme-card:hover .meme-card-img-wrap img {
    transform: scale(1.03);
}
.meme-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 55%);
    opacity: 0;
    transition: opacity 0.25s;
    display: flex;
    align-items: flex-end;
    padding: 0.75rem;
}
.meme-card:hover .meme-card-overlay { opacity: 1; }
.meme-card-overlay-actions {
    display: flex;
    gap: 0.4rem;
}
.meme-card-action {
    background: rgba(0,0,0,0.8);
    border: 1px solid rgba(0,255,65,0.4);
    color: var(--matrix-green);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    border-radius: 2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.meme-card-action:hover {
    background: var(--matrix-green);
    color: #000;
}
.meme-card-footer {
    padding: 0.5rem 0.65rem;
    background: #000;
    border-top: 1px solid rgba(0,255,65,0.08);
    min-height: 0;
}
.meme-card-caption {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: rgba(255,255,255,0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.meme-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.3rem;
}
.meme-card-tag {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: rgba(0,255,65,0.6);
    background: rgba(0,255,65,0.06);
    border: 1px solid rgba(0,255,65,0.15);
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
}

/* ── Modal / Lightbox ── */
.meme-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(6px);
}
.meme-modal-overlay.open { display: flex; }

.meme-modal-box {
    position: relative;
    background: #000;
    border: 1px solid rgba(0,255,65,0.3);
    border-radius: 4px;
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(0,255,65,0.1);
    overflow: hidden;
}

.meme-modal-close {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.6rem;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    transition: color 0.2s;
}
.meme-modal-close:hover { color: var(--matrix-green); }

.meme-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(0,255,65,0.3);
    color: var(--matrix-green);
    font-size: 2rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s, border-color 0.2s;
}
.meme-modal-nav:hover {
    background: rgba(0,255,65,0.15);
    border-color: var(--matrix-green);
}
.meme-modal-prev { left: 0.6rem; }
.meme-modal-next { right: 0.6rem; }

.meme-modal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
@media (min-width: 640px) {
    .meme-modal-content { flex-direction: row; }
}

.meme-modal-img-wrap {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 260px;
    max-height: 70vh;
}
.meme-modal-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.meme-modal-meta {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #060606;
    border-top: 1px solid rgba(0,255,65,0.1);
    min-width: 0;
}
@media (min-width: 640px) {
    .meme-modal-meta {
        width: 220px;
        flex-shrink: 0;
        border-top: none;
        border-left: 1px solid rgba(0,255,65,0.1);
        overflow-y: auto;
    }
}

.meme-modal-caption {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    line-height: 1.5;
    word-break: break-word;
}
.meme-modal-caption:empty { display: none; }

.meme-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.meme-modal-tag {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: rgba(0,255,65,0.7);
    background: rgba(0,255,65,0.07);
    border: 1px solid rgba(0,255,65,0.2);
    padding: 0.15rem 0.45rem;
    border-radius: 2px;
}
.meme-modal-date {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: rgba(0,255,65,0.4);
    margin-top: auto;
}
.meme-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.meme-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 2px;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    letter-spacing: 0.04em;
    width: 100%;
}
.meme-action-download {
    background: var(--matrix-green);
    color: #000;
}
.meme-action-download:hover {
    background: #afffbf;
    box-shadow: 0 0 12px rgba(0,255,65,0.4);
}
.meme-action-share {
    background: transparent;
    border: 1px solid rgba(0,255,65,0.35);
    color: var(--matrix-green);
}
.meme-action-share:hover {
    background: rgba(0,255,65,0.1);
    border-color: var(--matrix-green);
}
.meme-action-view {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 2px;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(0,255,65,0.2);
    background: transparent;
    color: rgba(0,255,65,0.6);
    text-decoration: none;
    width: 100%;
}
.meme-action-view:hover {
    background: rgba(0,255,65,0.08);
    border-color: var(--matrix-green);
    color: var(--matrix-green);
}

.meme-modal-wm-note {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(0,255,65,0.35);
    text-align: center;
}
