/* project cards - brutal minimal | jahrei labs | 2025 */
/* bento-grid layout with smart aspect ratios */

/* ============================================
   BENTO GRID LAYOUT
   ============================================ */

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Override container max-width for full-width bento grid */
.projects .container {
    max-width: 100%;
    width: 95%;
    padding: 0 2.5%;
    overflow: visible;
}

.projects {
    overflow: visible;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(min-content, calc((100vh - 300px) / 2));
    gap: 1.5rem;
    margin-top: 3rem;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    height: auto;
}

/* ============================================
   CARD SIZES (Bento Grid Variants)
   ============================================ */

/* Featured/Large - 2x2 */
.project-card.featured {
    grid-column: span 2;
    grid-row: span 2;
}

/* Tall - 1x2 */
.project-card.tall {
    grid-column: span 1;
    grid-row: span 2;
}

/* Wide - 2x1 */
.project-card.wide {
    grid-column: span 2;
    grid-row: span 1;
}

/* Regular - 1x1 (default) */
.project-card {
    grid-column: span 1;
    grid-row: span 1;
}

/* ============================================
   CARD BASE STYLING (Brutal Minimal)
   ============================================ */

.project-card {
    background-color: #ffffff;
    border: 2px solid #000000;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
}

.project-card:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border-color: #000000;
    z-index: 10;
}

/* Black overlay on hover */
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.project-card:hover::before {
    opacity: 1;
}

/* ============================================
   IMAGE CONTAINER (Smart Aspect Ratios)
   ============================================ */

.project-gallery {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    contain: layout style paint;
    margin: 0;
    padding: 0;
}

.gallery-main {
    width: 100%;
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    min-height: 0;
}

/* Smart aspect ratios based on image orientation - using max-height instead of strict aspect-ratio */
.gallery-main.landscape {
    aspect-ratio: 16 / 9;
    max-height: 100%;
}

.gallery-main.portrait {
    aspect-ratio: 3 / 4;
    max-height: 100%;
}

.gallery-main.square {
    aspect-ratio: 1 / 1;
    max-height: 100%;
}

/* Featured cards get taller images */
.project-card.featured .gallery-main.landscape {
    aspect-ratio: 16 / 10;
    max-height: 100%;
}

.project-card.featured .gallery-main.portrait {
    aspect-ratio: 4 / 5;
    max-height: 100%;
}

/* Tall cards prioritize vertical space */
.project-card.tall .gallery-main {
    aspect-ratio: 3 / 4;
    max-height: 100%;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease, opacity 0.3s ease;
    will-change: transform;
}

.project-card:hover .gallery-main-image {
    transform: scale(1.05);
}

/* Loading state */
.gallery-main-image[data-loading="true"] {
    opacity: 0.5;
}

/* ============================================
   THUMBNAILS
   ============================================ */

.gallery-thumbnails {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #000000 #f5f5f5;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #000000;
}

.gallery-thumbnail {
    min-width: 50px;
    width: 50px;
    height: 50px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease, border-color 0.2s ease;
    border: 2px solid transparent;
}

.gallery-thumbnail.active {
    opacity: 1;
    border-color: #000000;
}

.gallery-thumbnail:hover {
    opacity: 0.8;
}

/* ============================================
   CARD CONTENT
   ============================================ */

.project-content {
    padding: 1rem 1.25rem 1.25rem 1.25rem;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
}

.project-card:hover .project-content {
    color: #ffffff;
}

.project-title {
    font-family: var(--heading-font);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    color: #000000;
    transition: color 0.3s ease;
}

.project-card:hover .project-title {
    color: #ffffff;
}

.project-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333333;
    margin: 0;
    transition: color 0.3s ease;
}

.project-card:hover .project-description {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   TAGS & STATUS
   ============================================ */

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background-color: #000000;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.project-card:hover .tag {
    background-color: #ffffff;
    color: #000000;
}

.project-status {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background-color: #000000;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

.project-status.in-progress {
    background-color: #FFA500;
    color: #000000;
}

.project-status.completed {
    background-color: #000000;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

@media (max-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .project-card.featured {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .project-card.featured,
    .project-card.wide,
    .project-card.tall {
        grid-column: span 1;
        grid-row: span 1;
    }

    .project-content {
        padding: 1rem;
    }

    .project-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   LOADING SKELETON
   ============================================ */

.project-card.loading {
    pointer-events: none;
}

.project-card.loading .gallery-main {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

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

.project-card:focus {
    outline: 3px solid #000000;
    outline-offset: 3px;
}

.project-card:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .project-card,
    .gallery-main-image,
    .tag {
        transition: none;
    }

    .project-card:hover {
        transform: none;
    }
}
