/* Membrane Template — Works Page (Acid Grid + Duotone + Chromatic Aberration) */

/* ==============================
   SCATTERED GRID — Mixed sizes, dense packing
   ============================== */
.works-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-flow: dense;
    gap: 16px;
    margin-top: var(--spacing-2xl);
}

/* Default card: 1 column */
.work-item {
    position: relative;
    overflow: hidden;
    background: var(--placeholder-bg);
    /* Chromatic aberration — RGB split shadows */
    box-shadow:
        -3px 0 0 rgba(139, 92, 246, 0.25),
        3px 0 0 rgba(236, 72, 153, 0.2),
        0 0 0 1px rgba(139, 92, 246, 0.12);
    transition: transform 0.5s cubic-bezier(0.215, 0.61, 0.355, 1), box-shadow 0.4s ease;
}

.work-item:hover {
    z-index: 10;
    box-shadow:
        -5px 0 0 rgba(139, 92, 246, 0.4),
        5px 0 0 rgba(236, 72, 153, 0.35),
        0 -3px 0 rgba(245, 158, 11, 0.2),
        0 0 30px rgba(139, 92, 246, 0.2),
        0 0 0 1px rgba(139, 92, 246, 0.3);
}

/* ==============================
   SIZE VARIATION — Dramatic mixed layout
   ============================== */

/* Hero cards: 2 columns wide, tall */
.work-item:nth-child(7n+1) {
    grid-column: span 2;
    grid-row: span 2;
}

/* Wide cards */
.work-item:nth-child(7n+4) {
    grid-column: span 2;
}

/* Everything else: 1 column (default) */

/* ==============================
   ROTATIONS — Visual disorder
   ============================== */
.work-item:nth-child(6n+2) { transform: rotate(-0.8deg); }
.work-item:nth-child(6n+4) { transform: rotate(0.6deg); }
.work-item:nth-child(6n+6) { transform: rotate(-0.4deg); }

.work-item:nth-child(6n+2):hover { transform: rotate(0deg) scale(1.02); }
.work-item:nth-child(6n+4):hover { transform: rotate(0deg) scale(1.02); }
.work-item:nth-child(6n+6):hover { transform: rotate(0deg) scale(1.02); }
.work-item:hover { transform: scale(1.02); }

.work-item a {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    height: 100%;
}

/* ==============================
   CARD IMAGE — Full bleed
   ============================== */
.work-image {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 200px;
    overflow: hidden;
    background: var(--placeholder-bg);
}

.work-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.8s cubic-bezier(0.215, 0.61, 0.355, 1), filter 0.6s ease;
    filter: contrast(1.1) brightness(0.9);
}

.work-item:hover .work-image img {
    transform: scale(1.08);
    filter: saturate(1.2) contrast(1.05) brightness(1.0);
}

/* ==============================
   DUOTONE COLOR OVERLAY — Violet/magenta wash
   ============================== */
.work-image::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(
        135deg,
        rgba(139, 92, 246, 0.35) 0%,
        rgba(236, 72, 153, 0.25) 50%,
        rgba(245, 158, 11, 0.1) 100%
    );
    mix-blend-mode: color;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.work-item:hover .work-image::before {
    opacity: 0;
}

/* Scanline overlay — CRT texture */
.work-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 3;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 3px
    );
    transition: opacity 0.4s ease;
}

.work-item:hover .work-scanlines {
    opacity: 0.3;
}

.work-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 80px;
    color: rgba(139, 92, 246, 0.15);
    text-shadow: 0 0 60px rgba(139, 92, 246, 0.2);
    min-height: 280px;
}

/* ==============================
   TEXT OVERLAY — Blackletter titles on gradient scrim
   ============================== */
.work-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4;
    padding: var(--spacing-2xl) var(--spacing-md) var(--spacing-md);
    background: linear-gradient(
        to top,
        rgba(10, 10, 15, 0.95) 0%,
        rgba(10, 10, 18, 0.7) 40%,
        rgba(18, 10, 30, 0.15) 70%,
        transparent 100%
    );
    transition: transform 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
    transform: translateY(4px);
}

.work-item:hover .work-overlay {
    transform: translateY(0);
}

/* Blackletter card titles — the medieval element */
.work-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 6px;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

/* Smaller titles on small cards */
.work-item:not(:nth-child(7n+1)) .work-title {
    font-size: 16px;
}

/* Larger titles on hero cards */
.work-item:nth-child(7n+1) .work-title {
    font-size: 24px;
}

.work-meta {
    font-size: 11px;
    color: var(--muted-color);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.work-meta .work-client {
    color: var(--secondary-color);
}

/* Glowing bottom accent — prismatic edge */
.work-glow-edge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 5;
    background: var(--glow-gradient);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5), 0 0 40px rgba(236, 72, 153, 0.25);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.work-item:hover .work-glow-edge {
    opacity: 1;
}

/* Availability Status */
.work-meta .availability-status.for_sale { color: #4ADE80; }
.work-meta .availability-status.sold { color: #F87171; }
.work-meta .availability-status.on_loan { color: #FBBF24; }
.work-meta .availability-status.nfs { color: var(--muted-color); }

/* ==============================
   PAGE HEADER — Dramatic blackletter
   ============================== */
.page-header {
    margin-bottom: var(--spacing-2xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 200px;
    height: 2px;
    background: var(--glow-gradient);
    box-shadow: var(--glow-md);
}

.page-intro {
    font-size: 17px;
    color: var(--secondary-color);
    line-height: 1.7;
    max-width: 640px;
}

/* ==============================
   FILTER CONTROLS — Acid pill style
   ============================== */
.filter-controls {
    margin-bottom: var(--spacing-lg);
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-btn {
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.15);
    padding: 6px 16px;
    font-size: 11px;
    font-family: inherit;
    color: var(--muted-color);
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.filter-btn:hover {
    color: var(--primary-color);
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.15);
}

.filter-btn.active {
    color: var(--primary-color);
    font-weight: 500;
    border-color: rgba(139, 92, 246, 0.6);
    background: rgba(139, 92, 246, 0.12);
    box-shadow: var(--glow-sm),
        -2px 0 0 rgba(139, 92, 246, 0.2),
        2px 0 0 rgba(236, 72, 153, 0.15);
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 1200px) {
    .works-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .work-item:nth-child(7n+1) {
        grid-column: span 2;
        grid-row: span 1;
    }
}

@media (max-width: 768px) {
    .works-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .work-item:nth-child(7n+1) {
        grid-column: span 2;
    }
    .work-item:nth-child(7n+4) {
        grid-column: span 1;
    }
    .work-item:nth-child(n) {
        transform: none !important;
    }
    .work-item:hover {
        transform: none !important;
    }
    .work-title {
        font-size: 14px !important;
    }
}

@media (max-width: 480px) {
    .works-grid {
        grid-template-columns: 1fr;
    }
    .work-item:nth-child(n) {
        grid-column: span 1;
    }
    .work-image {
        min-height: 250px;
    }
}
