/* Gallery Frame Component Styles */
/* Masonry-style layout with random frame sizes */

/* ==================== BASE COMPONENT STYLES ==================== */

.work-items-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* strict 4 equal columns */
    grid-auto-rows: 250px;
    grid-auto-flow: dense;
    gap: 10px;
}

.work-item {
    position: relative;
    box-sizing: border-box;
    /* Enhanced 3D liquid glass gradient with darker, more contrasting hues */
    background: linear-gradient(135deg,
        rgba(240, 235, 210, 0.9) 0%,
        rgba(220, 210, 190, 0.8) 20%,
        rgba(200, 190, 170, 0.9) 45%,
        rgba(180, 170, 150, 0.7) 70%,
        rgba(160, 150, 130, 0.8) 100%);
    /* Stronger glass-like backdrop filter */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 15px;
    overflow: hidden;
    /* Enhanced 3D shadows for depth */
    box-shadow:
        0 15px 35px rgba(0,0,0,0.2),
        0 8px 15px rgba(0,0,0,0.15),
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        inset 0 -2px 4px rgba(0, 0, 0, 0.1);
    /* Subtle animated liquid effect */
    background-size: 200% 200%;
    animation: liquidFlow 8s ease-in-out infinite;
    /* Smooth transitions for all properties including transform */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Ensure base transform is identity */
    transform: translateY(0) scale(1);
    cursor: pointer;
    aspect-ratio: 1; /* Perfect square for Instagram-style */
    justify-self: stretch;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

/* Animated light reflections */
.work-item::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 45%,
        rgba(255, 215, 0, 0.05) 50%,
        rgba(255, 255, 255, 0.1) 55%,
        transparent 70%);
    border-radius: 15px;
    animation: lightReflection 6s linear infinite;
    pointer-events: none;
    z-index: 1;
}

/* Light reflection animation that responds to scroll */
@keyframes lightReflection {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    50% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
        opacity: 0.8;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateX(200%) translateY(200%) rotate(45deg);
        opacity: 0;
    }
}

/* Liquid flow animation for glass effect */
@keyframes liquidFlow {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* ==================== SIZE VARIANTS FOR MASONRY EFFECT ==================== */

.work-item.size-small {
    grid-column: span 1;
    grid-row: span 1;
    width: 100%;
    height: 100%;
}

.work-item.size-medium {
    grid-column: span 2;
    grid-row: span 2;
    width: 100%;
    height: 100%;
}

.work-item.size-large {
    grid-column: span 3;
    grid-row: span 3;
    width: 100%;
    height: 100%;
}

.work-item.size-wide-small {
    grid-column: span 2;
    grid-row: span 1;
    width: 100%;
    height: 100%;
}

.work-item.size-wide-medium {
    grid-column: span 3;
    grid-row: span 1;
    width: 100%;
    height: 100%;
}

.work-item.size-wide-large {
    grid-column: span 3;
    grid-row: span 2;
    width: 100%;
    height: 100%;
}

.work-item.size-tall-small {
    grid-column: span 1;
    grid-row: span 2;
    width: 100%;
    height: 100%;
}

.work-item.size-tall-medium {
    grid-column: span 1;
    grid-row: span 3;
    width: 100%;
    height: 100%;
}

.work-item.size-tall-large {
    grid-column: span 2;
    grid-row: span 3;
    width: 100%;
    height: 100%;
}

.image-container {
    flex: 1;
    width: 100%;
    overflow: hidden;
    border-radius: 15px 15px 0px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.work-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Ensure base transform is identity */
    transform: scale(1);
}

/* ==================== INTERACTIVE STATES ==================== */

.work-item:hover {
    box-shadow:
        0 20px 50px rgba(0,0,0,0.25),
        0 12px 25px rgba(0,0,0,0.2),
        inset 0 3px 6px rgba(255, 255, 255, 0.4),
        inset 0 -3px 6px rgba(0, 0, 0, 0.15);
    /* Enhanced 3D liquid glass effect on hover with darker tones */
    background: linear-gradient(135deg,
        rgba(230, 225, 200, 0.95) 0%,
        rgba(210, 200, 180, 0.9) 20%,
        rgba(190, 180, 160, 0.95) 45%,
        rgba(170, 160, 140, 0.8) 70%,
        rgba(150, 140, 120, 0.9) 100%);
    transform: translateY(-3px) scale(1.06);
    /* Enhanced backdrop filter on hover */
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

/* Enhanced light reflection on hover */
.work-item:hover::before {
    animation: lightReflection 3s linear infinite;
    background: linear-gradient(45deg,
        transparent 20%,
        rgba(255, 255, 255, 0.2) 40%,
        rgba(255, 215, 0, 0.1) 50%,
        rgba(255, 255, 255, 0.2) 60%,
        transparent 80%);
}

.work-item:hover img {
    transform: scale(1.05);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.work-item::before {
    content: '♡';
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--primary-maroon);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    z-index: 10;
}

.work-item:hover::before {
    opacity: 1;
    transform: scale(1.1);
}

/* ==================== CAPTION STYLES ==================== */

.work-item-caption {
    /* Glass-like caption background for light theme */
    background: linear-gradient(135deg,
        rgba(255, 248, 220, 0.9) 0%,
        rgba(245, 230, 211, 0.8) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    padding: 8px;
    opacity: 1;
    transition: opacity 0.3s ease;
    border-radius: 0 0 15px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Subtle glass border */
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.work-item:hover .work-item-caption {
    opacity: 1;
}

.work-item-caption p {
    font-size: 0.9em;
    line-height: 1.3;
    margin: 0;
    text-align: center;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.work-item-caption::after {
    content: attr(data-description);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 0.85em;
    line-height: 1.4;
    white-space: pre-line;
    max-width: 250px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* ==================== LEGACY PORTFOLIO CONTAINER STYLES ==================== */

.work-items-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0;
    padding: 40px 20px;
}

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

/* Large screens */
@media (min-width: 1200px) {
    .work-items-container {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        max-width: 1400px;
    }
    .portfolio-section .work-items-container {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1200px;
    }

}

/* Medium screens */
@media (min-width: 768px) and (max-width: 1199px) {
    .portfolio-section .work-items-container {
        grid-template-columns: repeat(2, 1fr);
        max-width: 900px;
    }

    /* Collapse very large items on tablets */
    .work-item.size-large,
    .work-item.size-wide-large,
    .work-item.size-tall-large {
        grid-column: span 1;
        grid-row: span 1;
        width: 100%;
        height: 100%;
    }
}

/* Small screens */
@media (max-width: 767px) {
    .work-items-container {
        grid-template-columns: repeat(1, 1fr);
        gap: 15px;
        padding: 30px 15px;
        width: 100%;
        height: 100%;
        justify-items: center;
    }

    /* Collapse larger sizes to smaller ones on mobile */
    .work-item.size-medium,
    .work-item.size-large,
    .work-item.size-wide-small,
    .work-item.size-wide-medium,
    .work-item.size-wide-large,
    .work-item.size-tall-medium,
    .work-item.size-tall-large {
        grid-column: span 1;
        grid-row: span 1;
        width: 100%;
        height: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .work-items-container {
        grid-template-columns: repeat(1, 1fr);
        gap: 10px;
        padding: 20px 10px;
        width: 100%;
        height: 100%;
        justify-items: center;
    }

    /* Ensure all larger items become small on very small screens */
    .work-item.size-small,
    .work-item.size-medium,
    .work-item.size-large,
    .work-item.size-wide-small,
    .work-item.size-wide-medium,
    .work-item.size-wide-large,
    .work-item.size-tall-small,
    .work-item.size-tall-medium,
    .work-item.size-tall-large {
        grid-column: span 1;
        grid-row: span 1;
        width: 100%;
        height: 100%;
        max-width: 250px;
        margin: 0 auto;
    }
}

/* ==================== DARK THEME WORK ITEM STYLES ==================== */

[data-theme="dark"] .work-item {
    /* More transparent dark theme liquid glass gradient */
    background: linear-gradient(135deg,
        rgba(33, 38, 45, 0.7) 0%,
        rgba(22, 27, 34, 0.6) 30%,
        rgba(13, 17, 23, 0.7) 60%,
        rgba(255, 215, 0, 0.03) 90%,
        rgba(78, 205, 196, 0.05) 100%);
    /* Stronger glass effect for dark mode */
    backdrop-filter: blur(25px) saturate(1.2);
    -webkit-backdrop-filter: blur(25px) saturate(1.2);
    border: 1px solid rgba(255, 215, 0, 0.15);
    box-shadow:
        0 12px 40px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255, 215, 0, 0.08),
        0 0 20px rgba(255, 215, 0, 0.03);
    /* Dark theme liquid animation */
    background-size: 200% 200%;
    animation: liquidFlowDark 10s ease-in-out infinite;
}

@keyframes liquidFlowDark {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

[data-theme="dark"] .work-item:hover {
    /* More transparent enhanced dark theme liquid glass hover effect */
    background: linear-gradient(135deg,
        rgba(33, 38, 45, 0.8) 0%,
        rgba(22, 27, 34, 0.7) 20%,
        rgba(13, 17, 23, 0.8) 50%,
        rgba(255, 215, 0, 0.05) 80%,
        rgba(78, 205, 196, 0.08) 100%);
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow:
        0 20px 60px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255, 215, 0, 0.15),
        0 0 30px rgba(255, 215, 0, 0.08);
    transform: translateY(-2px) scale(1.06);
    /* Stronger glass effect on hover */
    backdrop-filter: blur(30px) saturate(1.4);
    -webkit-backdrop-filter: blur(30px) saturate(1.4);
}

[data-theme="dark"] .work-item-caption {
    /* Dark theme glass-like caption background */
    background: linear-gradient(135deg,
        rgba(33, 38, 45, 0.9) 0%,
        rgba(22, 27, 34, 0.8) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    /* Subtle dark theme glass border */
    border-top: 1px solid rgba(255, 215, 0, 0.2);
}

[data-theme="dark"] .work-item::before {
    background: rgba(0, 0, 0, 0.8);
    color: var(--gold);
}

[data-theme="dark"] .work-item-caption::after {
    background: rgba(0, 0, 0, 0.95);
    color: var(--text-primary);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* Component responsive sizing */
@media (max-width: 768px) {
    .work-item {
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .work-item {
        max-width: 250px;
        margin: 0 auto;
    }
}
