/**
 * Catalog-Style Portfolio System
 * Unified Grid Layout - Uses exhibitions-section and exhibitions-container
 */

/* IBM Plex Mono loaded globally in style.css */

/* ========== Works page — broken grid + dot field ========== */

.exhibitions-section.works-page {
    padding: var(--page-section-padding-top) var(--page-section-padding-inline) var(--page-section-padding-bottom);
    max-width: 100%;
}

.works-page-container {
    max-width: 1600px;
}

.works-page-header.work-title-header {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    overflow: visible;
    padding: 0;
    background: transparent;
    position: relative;
    border-bottom: none;
    margin-bottom: var(--page-heading-margin-bottom);
    padding-bottom: 0;
}

body.dark-mode .works-page-header.work-title-header {
    border-bottom: none;
}

.works-page-title {
    font-family: var(--page-heading-font);
    font-size: var(--page-heading-size);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--text-color);
    text-align: left;
    margin: 0;
    float: none;
    padding: 0;
}

.works-filter-tabs {
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 0;
}

.works-filter-tabs .tab-btn {
    border-color: var(--border-color-light);
    color: var(--text-color);
    background: var(--bg-color);
}

body.dark-mode .works-filter-tabs .tab-btn {
    border-color: var(--border-color);
    color: var(--text-color);
    background: transparent;
}

.works-filter-tabs .tab-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.2);
    color: var(--text-color);
}

body.dark-mode .works-filter-tabs .tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-color-light);
    color: var(--text-color);
}

.works-filter-tabs .tab-btn.active {
    background: var(--text-color);
    border-color: var(--text-color);
    color: var(--bg-color);
}

body.dark-mode .works-filter-tabs .tab-btn.active {
    background: #e8e8e8;
    border-color: #e8e8e8;
    color: #141518;
}

.work-catalog-broken {
    margin-top: 0.25rem;
}

.works-broken-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

.work-row {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: 0 0.65rem;
    align-items: stretch;
    padding: 0.65rem 0 0.95rem;
}

.work-row-label {
    font-family: var(--font-mono-ui, 'IBM Plex Mono', ui-monospace, monospace);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-color-secondary);
    padding-top: 0.45rem;
    text-align: left;
}

.work-row-stage {
    position: relative;
    min-height: clamp(240px, 30vw, 320px);
    background-color: var(--bg-color);
    background-image: radial-gradient(
        circle at center,
        rgba(0, 0, 0, 0.11) 1px,
        transparent 1px
    );
    background-size: 14px 14px;
    border-radius: 2px;
}

body.dark-mode .work-row-stage {
    background-image: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.14) 1px,
        transparent 1px
    );
}

/* Structured editorial grid (reference: alternating weight, column-aligned %) */
.work-row-stage--structured {
    min-height: clamp(280px, 34vw, 400px);
}

.work-row-stage--structured.work-row-stage--layout-0,
.work-row-stage--structured.work-row-stage--layout-3,
.work-row-stage--structured.work-row-stage--layout-4 {
    min-height: clamp(300px, 36vw, 440px);
}

.work-piece--primary {
    position: absolute;
    left: var(--primary-left, 6%);
    top: var(--primary-top, 10%);
    width: min(var(--primary-width, 52%), 580px);
    aspect-ratio: 4 / 3;
    z-index: 2;
    display: block;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    line-height: 0;
    cursor: default;
    text-decoration: none;
    color: inherit;
    background: transparent;
}

.work-piece--primary[href] {
    cursor: pointer;
}

body.dark-mode .work-piece--primary {
    box-shadow: none;
    background: transparent;
}

/* Intrinsic aspect ratio — no fixed frame or letterboxing (see mobile: removed forced 4:3). */
.work-piece--primary img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
}

.work-piece--secondary {
    position: absolute;
    right: var(--secondary-right, 10%);
    top: var(--secondary-top, 7%);
    width: min(var(--secondary-width, 24%), 220px);
    z-index: 1;
    display: block;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
    line-height: 0;
    text-decoration: none;
    color: inherit;
    background: #f0f0f0;
}

.work-piece--secondary[href] {
    cursor: pointer;
}

body.dark-mode .work-piece--secondary {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    background: #1a1a1a;
}

.work-piece--secondary img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    aspect-ratio: 3 / 4;
}

.work-piece--card {
    position: absolute;
    left: var(--card-left, 50%);
    top: var(--card-top, 28%);
    width: min(var(--card-width, 40%), 580px);
    z-index: 4;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--text-color);
    padding: 1.35rem 1.5rem 1.5rem;
    box-shadow: 0 20px 52px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
    border-radius: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.985);
    pointer-events: none;
    transition: opacity 240ms ease, transform 280ms ease, visibility 240ms ease, box-shadow 280ms ease;
}

body.dark-mode .work-piece--card {
    background: #f2f2f2;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-left: 4px solid #3a3a3a;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.work-card-title {
    font-family: var(--font-mono-ui, 'IBM Plex Mono', ui-monospace, monospace);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: none;
    margin: 0 0 0.65rem;
    line-height: 1.3;
    color: var(--text-color);
    text-align: left;
}

.work-card-title-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.work-card-title-link:hover {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

body.dark-mode .work-card-title,
body.dark-mode .work-card-kind,
body.dark-mode .work-card-year,
body.dark-mode .work-card-blurb {
    color: #111111;
}

.work-card-kind {
    font-family: var(--font-mono-ui, 'IBM Plex Mono', ui-monospace, monospace);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: none;
    margin: 0 0 0.35rem;
    line-height: 1.35;
    color: var(--text-color);
    opacity: 0.9;
    text-align: left;
}

.work-card-year {
    font-family: var(--font-mono-ui, 'IBM Plex Mono', ui-monospace, monospace);
    font-size: 0.7rem;
    font-weight: 400;
    margin: 0 0 0.9rem;
    line-height: 1.35;
    color: var(--text-color-secondary);
    text-align: left;
}

.work-card-blurb {
    font-family: var(--font-mono-ui, 'IBM Plex Mono', ui-monospace, monospace);
    font-size: 0.625rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    line-height: 1.7;
    text-transform: none;
    margin: 0;
    color: var(--text-color-secondary);
    text-align: left;
}

.work-row-stage:hover .work-piece--card,
.work-row-stage:focus-within .work-piece--card {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
    pointer-events: auto;
}

@media (max-width: 900px) {
    .works-page-header.work-title-header {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1rem;
        overflow: visible;
        padding: 0;
    }

    .works-page-title {
        text-align: center;
        width: 100%;
        line-height: 1.15;
    }

    .works-page-header .works-filter-tabs {
        display: flex;
        flex-direction: row;
        align-items: center;
        align-self: center;
        justify-content: center !important;
        width: 100%;
        max-width: 100%;
        margin-top: 0.25rem;
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }

    .work-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
        padding: 1.15rem 0;
    }

    .work-row-label {
        padding-top: 0;
        margin-bottom: 0.15rem;
    }

    .work-row-stage {
        min-height: 0;
        padding: 1rem 0.85rem 1.1rem;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        background-size: 12px 12px;
    }

    .work-piece--primary,
    .work-piece--secondary,
    .work-piece--card {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        width: 100%;
        max-width: 100%;
    }

    .work-piece--primary,
    .work-piece--card {
        width: 100%;
    }

    .work-piece--card {
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
    }

    /*
     * Mobile: figure + info card must share one width (stacked column).
     * Desktop uses % widths via CSS variables; without a hard override, min(var(--primary-width), 460px)
     * can still resolve narrower than the card. Lock both to the stage’s content width.
     */
    .catalog-container.works-broken-grid .work-row-stage {
        align-items: stretch;
    }

    .catalog-container.works-broken-grid .work-row-stage .work-piece--primary,
    .catalog-container.works-broken-grid .work-row-stage .work-piece--card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
        box-sizing: border-box;
        align-self: stretch;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

}


@media (prefers-reduced-motion: reduce) {
    .work-piece--primary,
    .work-piece--secondary,
    .work-piece--card {
        transition: none;
    }
}

/* Match standard centered alignment - same as all other pages */
.exhibitions-section:has(.work-title-header) {
    padding-left: 8% !important; /* Match standard margin */
    padding-right: 8% !important; /* Match standard margin */
    padding-bottom: 4rem !important; /* REDUCED from default 12rem - tighter spacing to footer */
}

.exhibitions-section:has(.work-title-header) .exhibitions-container {
    padding-left: 0 !important; /* Remove container padding, use section padding */
    padding-right: 0 !important; /* Remove right padding from container */
}

@media (max-width: 900px) {
    .exhibitions-section:has(.work-title-header) {
        padding-left: 1rem !important; /* Match standard responsive padding */
        padding-right: 1rem !important; /* Match standard responsive padding */
    }
    
    .exhibitions-section:has(.work-title-header) .exhibitions-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/*
 * works-movement.html only (body.works-page--movement-catalog):
 * On mobile, keep the page column, figures, and info cards to one shared width.
 * Removes extra inset on the stage, drops the fixed 4:3 box (which caused letterboxing
 * and made images look narrower than the card), and constrains the exhibitions container
 * so the title + catalog align. Desktop layouts are unchanged (no class on works.html body).
 */
@media (max-width: 900px) {
    body.works-page--movement-catalog .exhibitions-container.works-page-container {
        max-width: min(100%, 26.25rem);
        margin-left: auto;
        margin-right: auto;
        width: 100%;
        box-sizing: border-box;
    }

    body.works-page--movement-catalog .catalog-container.works-broken-grid .work-row-stage {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    body.works-page--movement-catalog .catalog-container.works-broken-grid .work-row-stage .work-piece--primary {
        aspect-ratio: auto !important;
        min-height: 0;
    }

    body.works-page--movement-catalog .catalog-container.works-broken-grid .work-row-stage .work-piece--primary img {
        width: 100%;
        height: auto !important;
        max-height: none;
        object-fit: contain;
        display: block;
    }
}

/* ===========================
   WORK TITLE HEADER
   Aligned with publications/exhibitions title system
   =========================== */

.work-title-header {
    display: flex;
    flex-direction: column;
    padding-bottom: 0.5rem; /* Reduced from 1rem */
    border-bottom: 1px solid var(--border-color-light);
    margin-bottom: 0.5rem; /* Reduced from 1rem */
    position: relative;
}

body.dark-mode .work-title-header {
    border-bottom-color: var(--border-color);
}

/* Title uses .exhibitions-heading from style.css - no override needed */

/* ===========================
   THREE HORIZONTAL TABS
   Pill-style buttons with Times New Roman, below title on right
   =========================== */

.work-tabs {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    margin: 0.5rem 0 0 0; /* Reduced from 1rem */
}

.tab-btn {
    font-family: "Inter", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: 0.75px;
    color: var(--text-color-secondary);
    background: transparent;
    border: 1px solid var(--text-color-light);
    border-radius: 20px;
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
    min-width: fit-content;
    /* Prevent any layout shifts */
    vertical-align: top;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .tab-btn {
    border-color: var(--text-color-light);
    color: var(--text-color-light);
}

.tab-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.25);
    color: var(--text-color);
}

body.dark-mode .tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-color-light);
    color: var(--text-color);
}

.tab-btn:focus {
    outline: 2px solid rgba(0, 0, 0, 0.35);
    outline-offset: 2px;
}

body.dark-mode .tab-btn:focus {
    outline-color: rgba(255, 255, 255, 0.45);
}

.tab-btn:focus:not(:focus-visible) {
    outline: none;
}

.tab-btn.active {
    background: #000;
    border-color: #000;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    letter-spacing: 0.75px; /* Keep consistent font-weight to prevent width change */
}

body.dark-mode .tab-btn.active {
    background: #fff;
    border-color: #fff;
    color: #000;
}

.tab-btn.active::after {
    display: none; /* No underline for pill-style buttons */
}

/* ===========================
   INTRO TEXT BLOCK
   =========================== */

.work-intro-block {
    max-width: 65ch;
    margin-bottom: 4rem;
    margin-top: 3rem; /* Total spacing: 1rem (margin-bottom of header) + 3rem = 4rem matching title margin */
}

.work-intro-text {
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-color);
    line-height: 1.6;
    text-align: left;
    margin: 0;
}

body.dark-mode .work-intro-text {
    color: var(--text-color);
}

/* ===========================
   WORK CATALOG
   =========================== */

.work-catalog {
    width: 100%;
    margin-bottom: 0; /* No bottom margin - tight to footer */
    padding-bottom: 0; /* No bottom padding - tight to footer */
}

.catalog-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: all 0.5s ease;
}

/* ===========================
   GALLERY VIEW (All/Default)
   Apple IWD 2020-inspired parallax layout
   =========================== */

.catalog-container.gallery-view {
    display: block;
    position: relative;
    min-height: calc(100vw * 1.1); /* SQUARE-SHAPED: height ≈ width (10% taller) */
    height: auto; /* Allow content to determine height */
    padding: 0; /* No padding - positioning handled by JS based on header height */
    overflow: visible; /* Allow minimal scrolling - one scroll to see all */
    will-change: transform;
    transform-origin: center center;
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw; /* Ensure doesn't exceed viewport */
    margin-bottom: 0; /* No bottom margin - tight to footer */
    padding-bottom: 0; /* No bottom padding - tight to footer */
}

/* Responsive container height adjustments - SQUARE-SHAPED with minimal scrolling */
@media (max-width: 600px) {
    .catalog-container.gallery-view {
        min-height: calc(100vw * 1.15); /* Square shape on mobile - slightly taller */
    }
}

@media (max-width: 400px) {
    .catalog-container.gallery-view {
        min-height: calc(100vw * 1.2); /* Square shape on small devices - slightly taller */
    }
}

/* Entrance animation */
@keyframes galleryScaleIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Individual gallery images - continuous automatic movement */
.gallery-image {
    position: absolute;
    /* NO DROP SHADOWS - removed entirely */
    animation: galleryScaleIn 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                z-index 0.1s linear;
    pointer-events: auto;
    transform-origin: center center;
    backface-visibility: hidden; /* Optimize rendering */
    -webkit-backface-visibility: hidden;
    will-change: transform, z-index;
    /* Ensure images are never cropped */
    overflow: visible;
    max-width: none;
    /* Base spacing - allows occasional overlap during movement */
    box-sizing: border-box;
}

.gallery-image img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    object-fit: contain; /* Prevent cropping/distortion */
    max-width: 100%;
    /* Ensure images don't overflow on mobile */
    box-sizing: border-box;
}

/* Mobile-specific image adjustments */
@media (max-width: 600px) {
    .gallery-image {
        /* Ensure images are properly sized on mobile */
        max-width: 95vw; /* Prevent horizontal overflow */
    }
    
    .gallery-image img {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 400px) {
    .gallery-image {
        max-width: 90vw; /* Even more conservative on very small screens */
    }
}

/* Hover state: smooth scale up - NO SHADOWS (handled by JS transform) */

/* Gallery image positioning - larger sizes */
.gallery-image[data-index="0"] {
    top: 3%;
    left: 5%;
    width: 26%;
    animation-delay: 0s;
}

.gallery-image[data-index="1"] {
    top: 6%;
    left: 40%;
    width: 22%;
    animation-delay: 0.1s;
}

.gallery-image[data-index="2"] {
    top: 4%;
    right: 8%;
    width: 24%;
    animation-delay: 0.2s;
}

.gallery-image[data-index="3"] {
    top: 26%;
    left: 8%;
    width: 23%;
    animation-delay: 0.3s;
}

.gallery-image[data-index="4"] {
    top: 28%;
    left: 44%;
    width: 27%;
    animation-delay: 0.4s;
}

.gallery-image[data-index="5"] {
    top: 24%;
    right: 10%;
    width: 25%;
    animation-delay: 0.5s;
}

.gallery-image[data-index="6"] {
    top: 51%;
    left: 3%;
    width: 24%;
    animation-delay: 0.6s;
}

.gallery-image[data-index="7"] {
    top: 53%;
    left: 36%;
    width: 21%;
    animation-delay: 0.7s;
}

.gallery-image[data-index="8"] {
    top: 49%;
    right: 9%;
    width: 28%;
    animation-delay: 0.8s;
}

.gallery-image[data-index="9"] {
    top: 74%;
    left: 10%;
    width: 22%;
    animation-delay: 0.9s;
}

.gallery-image[data-index="10"] {
    top: 76%;
    left: 42%;
    width: 26%;
    animation-delay: 1.0s;
}

.gallery-image[data-index="11"] {
    top: 72%;
    right: 8%;
    width: 23%;
    animation-delay: 1.1s;
}

.gallery-image[data-index="12"] {
    top: 97%;
    left: 6%;
    width: 25%;
    animation-delay: 1.2s;
}

.gallery-image[data-index="13"] {
    top: 99%;
    left: 40%;
    width: 22%;
    animation-delay: 1.3s;
}

.gallery-image[data-index="14"] {
    top: 94%;
    right: 11%;
    width: 27%;
    animation-delay: 1.4s;
}

.gallery-image[data-index="15"] {
    top: 120%;
    left: 8%;
    width: 24%;
    animation-delay: 1.5s;
}

.gallery-image[data-index="16"] {
    top: 122%;
    left: 42%;
    width: 23%;
    animation-delay: 1.6s;
}

.gallery-image[data-index="17"] {
    top: 117%;
    right: 10%;
    width: 26%;
    animation-delay: 1.7s;
}

.gallery-image[data-index="18"] {
    top: 144%;
    left: 12%;
    width: 22%;
    animation-delay: 1.8s;
}

.gallery-image[data-index="19"] {
    top: 146%;
    left: 44%;
    width: 25%;
    animation-delay: 1.9s;
}

/* Collage/Mood Board Layout (when no filter is active) */
.catalog-container.collage-layout {
    display: block;
    position: relative;
    min-height: 280vh;
    padding: 4rem 0 8rem 0;
}

/* Entrance animation for collage items */
@keyframes scaleIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.catalog-container.collage-layout .catalog-item {
    position: static;
    width: auto;
    max-width: none;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    display: block;
    gap: 0;
}

/* Individual positioning for collage items - scattered mood board layout */
/* Each image is positioned independently */
.catalog-container.collage-layout .catalog-item {
    position: static;
    display: block;
    width: auto;
    height: auto;
}

.catalog-container.collage-layout .catalog-item .item-image-column {
    position: absolute;
    margin-bottom: 0;
    width: auto;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    animation: scaleIn 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.catalog-container.collage-layout .catalog-item .item-image-column:hover {
    transform: scale(1.35) translateY(-15px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 200 !important;
}

body.dark-mode .catalog-container.collage-layout .catalog-item .item-image-column {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .catalog-container.collage-layout .catalog-item .item-image-column:hover {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Position each individual image independently - scattered across the page */

/* Project 1 - Images 1 & 2 */
.catalog-container.collage-layout .catalog-item:nth-child(1) .item-image-column:nth-child(1) {
    top: 2%;
    left: 3%;
    width: 18%;
    z-index: 8;
    animation-delay: 0s;
}

.catalog-container.collage-layout .catalog-item:nth-child(1) .item-image-column:nth-child(2) {
    top: 6%;
    left: 72%;
    width: 15%;
    z-index: 5;
    animation-delay: 0.1s;
}

/* Project 2 - Images 1 & 2 */
.catalog-container.collage-layout .catalog-item:nth-child(2) .item-image-column:nth-child(1) {
    top: 3%;
    left: 28%;
    width: 14%;
    z-index: 9;
    animation-delay: 0.2s;
}

.catalog-container.collage-layout .catalog-item:nth-child(2) .item-image-column:nth-child(2) {
    top: 25%;
    left: 8%;
    width: 16%;
    z-index: 6;
    animation-delay: 0.3s;
}

/* Project 3 - Images 1 & 2 */
.catalog-container.collage-layout .catalog-item:nth-child(3) .item-image-column:nth-child(1) {
    top: 4%;
    left: 50%;
    width: 17%;
    z-index: 7;
    animation-delay: 0.4s;
}

.catalog-container.collage-layout .catalog-item:nth-child(3) .item-image-column:nth-child(2) {
    top: 28%;
    left: 32%;
    width: 19%;
    z-index: 10;
    animation-delay: 0.5s;
}

/* Project 4 - Images 1 & 2 */
.catalog-container.collage-layout .catalog-item:nth-child(4) .item-image-column:nth-child(1) {
    top: 24%;
    right: 10%;
    width: 20%;
    z-index: 8;
    animation-delay: 0.6s;
}

.catalog-container.collage-layout .catalog-item:nth-child(4) .item-image-column:nth-child(2) {
    top: 48%;
    left: 5%;
    width: 18%;
    z-index: 5;
    animation-delay: 0.7s;
}

/* Project 5 - Images 1 & 2 */
.catalog-container.collage-layout .catalog-item:nth-child(5) .item-image-column:nth-child(1) {
    top: 50%;
    left: 30%;
    width: 22%;
    z-index: 11;
    animation-delay: 0.8s;
}

.catalog-container.collage-layout .catalog-item:nth-child(5) .item-image-column:nth-child(2) {
    top: 52%;
    right: 8%;
    width: 17%;
    z-index: 6;
    animation-delay: 0.9s;
}

/* Project 6 - Images 1 & 2 */
.catalog-container.collage-layout .catalog-item:nth-child(6) .item-image-column:nth-child(1) {
    top: 75%;
    left: 10%;
    width: 16%;
    z-index: 7;
    animation-delay: 1.0s;
}

.catalog-container.collage-layout .catalog-item:nth-child(6) .item-image-column:nth-child(2) {
    top: 78%;
    left: 35%;
    width: 19%;
    z-index: 9;
    animation-delay: 1.1s;
}

/* Project 7 - Images 1 & 2 */
.catalog-container.collage-layout .catalog-item:nth-child(7) .item-image-column:nth-child(1) {
    top: 76%;
    right: 12%;
    width: 21%;
    z-index: 8;
    animation-delay: 1.2s;
}

.catalog-container.collage-layout .catalog-item:nth-child(7) .item-image-column:nth-child(2) {
    top: 102%;
    left: 8%;
    width: 18%;
    z-index: 6;
    animation-delay: 1.3s;
}

/* Project 8 - Images 1 & 2 */
.catalog-container.collage-layout .catalog-item:nth-child(8) .item-image-column:nth-child(1) {
    top: 105%;
    left: 35%;
    width: 17%;
    z-index: 7;
    animation-delay: 1.4s;
}

.catalog-container.collage-layout .catalog-item:nth-child(8) .item-image-column:nth-child(2) {
    top: 104%;
    right: 15%;
    width: 19%;
    z-index: 5;
    animation-delay: 1.5s;
}

/* Project 9 - Images 1 & 2 */
.catalog-container.collage-layout .catalog-item:nth-child(9) .item-image-column:nth-child(1) {
    top: 130%;
    left: 12%;
    width: 20%;
    z-index: 8;
    animation-delay: 1.6s;
}

.catalog-container.collage-layout .catalog-item:nth-child(9) .item-image-column:nth-child(2) {
    top: 132%;
    left: 42%;
    width: 18%;
    z-index: 6;
    animation-delay: 1.7s;
}

/* Hide ALL text info in collage layout */
.catalog-container.collage-layout .project-text-column {
    display: none !important;
}

.catalog-container.collage-layout .item-code,
.catalog-container.collage-layout .item-title,
.catalog-container.collage-layout .item-year,
.catalog-container.collage-layout .item-description,
.catalog-container.collage-layout .item-tags,
.catalog-container.collage-layout .image-label {
    display: none !important;
}

/* Show only images in collage layout */
.catalog-container.collage-layout .project-images-wrapper {
    display: block;
    width: 100%;
}

.catalog-container.collage-layout .item-image-column {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 0;
}

.catalog-container.collage-layout .item-image-column:first-child {
    display: block; /* Show first image */
}

.catalog-container.collage-layout .item-image-column:last-child {
    display: block !important; /* Show ALL images in collage */
}

.catalog-container.collage-layout .item-image-column img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
    transition: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

body.dark-mode .catalog-container.collage-layout .item-image-column img {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Make images clickable in collage mode */
.catalog-container.collage-layout .item-image-column {
    cursor: pointer;
    transition: transform 0.3s ease;
}

/* ===========================
   CATALOG ITEM (3-Column Editorial Grid)
   =========================== */

.catalog-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 6rem;
    padding-bottom: 6rem;
    border-bottom: 1px solid var(--border-color-light);
    align-items: start;
}

body.dark-mode .catalog-item {
    border-bottom-color: var(--border-color);
}

.catalog-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Filter animation states */
.catalog-item {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.catalog-item.filtered-out {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: none;
}

/* Column 1: Text content */
.project-text-column {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 100%;
}

/* Column 2 & 3: Images wrapper */
.project-images-wrapper {
    grid-column: 2 / 4;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ===========================
   COLUMN 1: TEXT CONTENT STYLES
   =========================== */

.item-code {
    font-family: "Neue Haas Grotesk", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-color);
    text-transform: uppercase;
    text-align: left;
    margin: 0;
}

.item-title {
    font-family: "Neue Haas Grotesk", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-color);
    line-height: 1.3;
    text-align: left;
    margin: 0;
}

.item-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.item-title a:hover {
    color: var(--accent-color);
}

.item-year {
    font-family: "Inter", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 300;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--text-color-secondary);
    text-align: left;
    margin: 0;
}

.item-description {
    font-family: "Inter", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.875rem;
    font-weight: 300;
    line-height: 1.6;
    letter-spacing: 0;
    color: var(--text-color-secondary);
    text-align: left;
    margin: 0;
    max-width: 60ch; /* Accessibility: ~60-65 characters per line */
    flex: 1;
}

.item-tags {
    font-family: "Inter", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.8125rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--text-color);
    text-align: left;
    margin: 0;
    margin-top: auto; /* Push to bottom */
}

/* ===========================
   COLUMN 2 & 3: IMAGES
   =========================== */

.item-image-column {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f5f5f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-mode .item-image-column {
    background: #1a1a1a;
}

.item-image-column img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* Image Label */
.image-label {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    font-family: "Inter", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 300;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0.75rem;
    border-radius: 2px;
    text-align: left;
}

body.dark-mode .image-label {
    background: rgba(20, 20, 20, 0.9);
    color: var(--text-color);
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

@media (max-width: 1200px) {
    .work-title-header {
        gap: 3rem;
    }
    
    .catalog-item {
        gap: 2rem;
    }
}

/* Responsive collage layout for mobile */
@media (max-width: 900px) {
    .catalog-container.collage-layout {
        min-height: 250vh;
    }
    
    .catalog-container.collage-layout .catalog-item {
        width: 45% !important;
        max-width: 45% !important;
    }
    
    .catalog-container.collage-layout .catalog-item:nth-child(1) {
        top: 2%;
        left: 5%;
    }
    
    .catalog-container.collage-layout .catalog-item:nth-child(2) {
        top: 5%;
        right: 5%;
    }
    
    .catalog-container.collage-layout .catalog-item:nth-child(3) {
        top: 22%;
        left: 8%;
    }
    
    .catalog-container.collage-layout .catalog-item:nth-child(4) {
        top: 25%;
        right: 8%;
    }
    
    .catalog-container.collage-layout .catalog-item:nth-child(5) {
        top: 42%;
        left: 5%;
    }
    
    .catalog-container.collage-layout .catalog-item:nth-child(6) {
        top: 45%;
        right: 5%;
    }
    
    .catalog-container.collage-layout .catalog-item:nth-child(7) {
        top: 62%;
        left: 8%;
    }
    
    .catalog-container.collage-layout .catalog-item:nth-child(8) {
        top: 65%;
        right: 8%;
    }
    
    .catalog-container.collage-layout .catalog-item:nth-child(9) {
        top: 82%;
        left: 5%;
    }
}

/* Responsive gallery view for mobile */
@media (max-width: 900px) {
    .catalog-container.gallery-view {
        min-height: 500vh;
        padding: 4rem 1.5rem 8rem 1.5rem; /* Reduced padding for more space */
    }
    
    .gallery-image {
        max-width: none; /* Prevent width restrictions */
        /* Ensure spacing is maintained on mobile */
        margin: 0.5rem !important;
    }
    
    .gallery-image:hover {
        transform: scale(1.4) !important; /* Slightly smaller scale on mobile */
    }
}

@media (max-width: 600px) {
    .catalog-container.gallery-view {
        min-height: 600vh; /* More vertical space on small screens */
        padding: 3rem 1rem 7rem 1rem; /* Minimal padding for maximum space */
    }
    
    .gallery-image {
        margin: 0.4rem !important; /* Maintain spacing on very small screens */
    }
}

@media (max-width: 400px) {
    .catalog-container.gallery-view {
        padding: 2rem 0.75rem 6rem 0.75rem; /* Even tighter padding on tiny screens */
    }
    
    .gallery-image {
        margin: 0.3rem !important; /* Compact but visible spacing */
    }
}

@media (max-width: 900px) {
    .work-title-header {
        margin-bottom: 1rem; /* Reduced from 2rem */
    }
    
    .work-tabs {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.5rem; /* Reduced from 0.75rem */
    }
    
    .tab-btn {
        font-size: 0.8125rem;
        padding: 0.4rem 1rem;
    }
    
    .catalog-item {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-bottom: 4rem;
        padding-bottom: 4rem;
    }
    
    /* On mobile: images wrapper becomes its own grid */
    .project-images-wrapper {
        grid-column: 1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
}

/* Responsive Images: Single column on < 400px, 2 columns on ≥ 400px */
@media (max-width: 399px) {
    .project-images-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media (min-width: 400px) and (max-width: 900px) {
    .project-images-wrapper {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .catalog-item {
        gap: 1.5rem;
        margin-bottom: 3rem;
        padding-bottom: 3rem;
    }
    
    .item-title {
        font-size: 1.25rem;
    }
    
    .item-description {
        font-size: 0.8125rem;
    }
    
    .tab-btn {
        font-size: 0.8125rem;
    }
}

/* ===========================
   ACCESSIBILITY
   =========================== */

.item-image-column:focus-visible {
    outline: 3px solid rgba(0, 0, 0, 0.35);
    outline-offset: 4px;
}

body.dark-mode .item-image-column:focus-visible {
    outline-color: rgba(255, 255, 255, 0.45);
}

@media (prefers-reduced-motion: reduce) {
    .catalog-item,
    .work-row,
    .work-row-stage,
    .work-piece--primary,
    .work-piece--card,
    .work-piece--primary img,
    .works-filter-tabs .tab-btn,
    .dot-field__dot {
        transition-duration: 0.01ms !important;
        animation: none !important;
    }

    .work-piece--primary:hover img {
        transform: none !important;
    }
}

/* Smooth rendering */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
