/* Custom Dynamic Grid Layout - Inspired by Modern Card-Based Design */

/* Grid Container */
.custom-grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
    padding: 0;
}

/* Override for blog grid to use 5-column structure */
.custom-grid-container.blog-grid-custom {
    grid-template-columns: repeat(5, 1fr);
    gap: 0px;
    grid-column-gap: 0px;
    grid-row-gap: 0px;
}

/* Base Grid Card Styles */
.grid-card {
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 0;
    text-decoration: none;
    color: white;
    overflow: hidden;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.grid-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 123, 169, 0.05) 0%, rgba(126, 200, 227, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    pointer-events: none;
}

.grid-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 123, 169, 0.3);
}

.grid-card:hover::before {
    opacity: 1;
}

/* Grid Card Image */
.grid-card-image {
    width: 100%;
    height: 0;
    padding-bottom: 60%;
    position: relative;
    overflow: hidden;
    background: #0f0f0f;
}

.grid-card:not(.grid-card-wide) .grid-card-image {
    padding-bottom: 65%;
}

.grid-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.grid-card:hover .grid-img {
    transform: scale(1.1);
}

/* Grid Card Content */
.grid-card-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    z-index: 2;
    background: #1a1a1a;
}

.grid-card-title {
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.grid-card:hover .grid-card-title {
    color: var(--bubblegum);
}

.grid-card-excerpt {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex: 1;
}

.grid-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--bubblegum);
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: auto;
    transition: all 0.3s ease;
}

.grid-card-link i {
    transition: transform 0.3s ease;
    font-size: 0.85rem;
}

.grid-card:hover .grid-card-link {
    color: var(--ice);
}

.grid-card:hover .grid-card-link i {
    transform: translateX(5px);
}

/* PROJECTS GRID - Recent Work Section - Clean 3-Column Layout */
.projects-grid-custom {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto;
    gap: 1.5rem;
}

/* First card spans 2 columns for emphasis */
.projects-grid-custom .grid-card:nth-child(1) {
    grid-column: 1 / 3;
    grid-row: 1;
    min-height: 500px;
}

/* Second and third cards in row 1 */
.projects-grid-custom .grid-card:nth-child(2) {
    grid-column: 3;
    grid-row: 1;
    min-height: 500px;
}

/* Row 2: Three equal cards */
.projects-grid-custom .grid-card:nth-child(3),
.projects-grid-custom .grid-card:nth-child(4),
.projects-grid-custom .grid-card:nth-child(5) {
    grid-row: 2;
    min-height: 400px;
}

.projects-grid-custom .grid-card:nth-child(3) {
    grid-column: 1;
}

.projects-grid-custom .grid-card:nth-child(4) {
    grid-column: 2;
}

.projects-grid-custom .grid-card:nth-child(5) {
    grid-column: 3;
}

/* BLOG GRID - Blog Section - Clean 3-Column Layout */
.custom-grid-container.blog-grid-custom {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto;
    gap: 1.5rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
}

/* All blog cards have equal spacing, no overlapping */
.blog-grid-custom .grid-card {
    min-height: 450px;
}

/* First card spans 2 columns for featured content */
.blog-grid-custom .grid-card:nth-child(1) {
    grid-column: 1 / 3;
    min-height: 500px;
}

/* Remaining cards in standard 3-column layout */
.blog-grid-custom .grid-card:nth-child(2) {
    grid-column: 3;
}

.blog-grid-custom .grid-card:nth-child(3),
.blog-grid-custom .grid-card:nth-child(4),
.blog-grid-custom .grid-card:nth-child(5) {
    grid-row: 2;
}

.blog-grid-custom .grid-card:nth-child(3) {
    grid-column: 1;
}

.blog-grid-custom .grid-card:nth-child(4) {
    grid-column: 2;
}

.blog-grid-custom .grid-card:nth-child(5) {
    grid-column: 3;
}

/* Remove z-index and position since we're not overlapping */
.blog-grid-custom .grid-card {
    position: static;
    z-index: auto;
    margin: 0;
}

/* Cards without images - text only */
.grid-card.no-image .grid-card-content,
.grid-card:not(.has-image) .grid-card-content {
    padding: 3rem 2.5rem;
    justify-content: center;
}

.grid-card.no-image::after,
.grid-card:not(.has-image)::after {
    content: '';
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255, 123, 169, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.grid-card.no-image:hover::after,
.grid-card:not(.has-image):hover::after {
    opacity: 1;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .custom-grid-container {
        grid-template-columns: repeat(6, 1fr);
        gap: 1.25rem;
    }

    /* Projects Grid - Tablet: 2 columns */
    .projects-grid-custom {
        grid-template-columns: repeat(2, 1fr);
    }

    .projects-grid-custom .grid-card:nth-child(1) {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .projects-grid-custom .grid-card:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }

    .projects-grid-custom .grid-card:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
    }

    .projects-grid-custom .grid-card:nth-child(4) {
        grid-column: 1;
        grid-row: 3;
    }

    .projects-grid-custom .grid-card:nth-child(5) {
        grid-column: 2;
        grid-row: 3;
    }

    /* Blog Grid - Tablet: 2 columns */
    .custom-grid-container.blog-grid-custom {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .blog-grid-custom .grid-card:nth-child(1) {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .blog-grid-custom .grid-card:nth-child(2),
    .blog-grid-custom .grid-card:nth-child(3) {
        grid-row: 2;
    }

    .blog-grid-custom .grid-card:nth-child(2) {
        grid-column: 1;
    }

    .blog-grid-custom .grid-card:nth-child(3) {
        grid-column: 2;
    }

    .blog-grid-custom .grid-card:nth-child(4),
    .blog-grid-custom .grid-card:nth-child(5) {
        grid-row: 3;
    }

    .blog-grid-custom .grid-card:nth-child(4) {
        grid-column: 1;
    }

    .blog-grid-custom .grid-card:nth-child(5) {
        grid-column: 2;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .custom-grid-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Projects Grid - Mobile: Single column */
    .projects-grid-custom {
        grid-template-columns: 1fr;
    }

    .projects-grid-custom .grid-card:nth-child(n) {
        grid-column: 1;
        grid-row: auto;
        min-height: auto;
    }

    /* Blog Grid - Mobile: Single column */
    .custom-grid-container.blog-grid-custom {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .blog-grid-custom .grid-card:nth-child(n) {
        grid-column: 1;
        grid-row: auto;
        min-height: auto;
    }

    .grid-card-content {
        padding: 1.5rem;
    }

    .grid-card-title {
        font-size: 1.5rem;
    }

    .grid-card-excerpt {
        font-size: 0.9rem;
    }
}

/* Smooth animations on scroll */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-card {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

.grid-card:nth-child(1) { animation-delay: 0.1s; }
.grid-card:nth-child(2) { animation-delay: 0.2s; }
.grid-card:nth-child(3) { animation-delay: 0.3s; }
.grid-card:nth-child(4) { animation-delay: 0.4s; }
.grid-card:nth-child(5) { animation-delay: 0.5s; }
.grid-card:nth-child(6) { animation-delay: 0.6s; }
.grid-card:nth-child(7) { animation-delay: 0.7s; }
.grid-card:nth-child(8) { animation-delay: 0.8s; }

