/* Container */
.projects-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px; padding: 10px;
}

/* The Lego Brick Card */
.lego-card {
    position: relative;
    background-color: #fff;
    border-radius: 8px;
    /* 3D height effect */
    border-bottom: 8px solid #ddd; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    overflow: visible; /* Allow studs to stick out */
    transition: transform 0.2s, border-bottom-width 0.2s, margin-top 0.2s;
    cursor: pointer;
    margin-top: 10px; /* Space for studs */
}

/* Hover Effect: "Press" the brick */
.lego-card:hover {
    transform: translateY(4px);
    border-bottom-width: 4px;
    margin-top: 14px;
}

/* Lego Studs on Top */
.lego-card::before {
    content: ''; position: absolute; top: -12px; left: 10px;
    width: 30px; height: 12px;
    background: inherit; /* Matches card color */
    border-radius: 4px 4px 0 0;
    box-shadow: 40px 0 0 inherit, 80px 0 0 inherit, 120px 0 0 inherit; 
    /* The shadow creates the other studs easily */
}

/* Colors for the cards (Rotating colors) */
.lego-card:nth-child(4n+1) { background: #e53935; border-bottom-color: #b71c1c; color: white; } /* Red */
.lego-card:nth-child(4n+2) { background: #1e88e5; border-bottom-color: #0d47a1; color: white; } /* Blue */
.lego-card:nth-child(4n+3) { background: #fdd835; border-bottom-color: #fbc02d; color: black; } /* Yellow */
.lego-card:nth-child(4n+4) { background: #43a047; border-bottom-color: #1b5e20; color: white; } /* Green */

/* Fix stud colors using inheritance in ::before */
.lego-card:nth-child(4n+1)::before { background: #e53935; box-shadow: 40px 0 0 #e53935, 80px 0 0 #e53935, 120px 0 0 #e53935; }
.lego-card:nth-child(4n+2)::before { background: #1e88e5; box-shadow: 40px 0 0 #1e88e5, 80px 0 0 #1e88e5, 120px 0 0 #1e88e5; }
.lego-card:nth-child(4n+3)::before { background: #fdd835; box-shadow: 40px 0 0 #fdd835, 80px 0 0 #fdd835, 120px 0 0 #fdd835; }
.lego-card:nth-child(4n+4)::before { background: #43a047; box-shadow: 40px 0 0 #43a047, 80px 0 0 #43a047, 120px 0 0 #43a047; }

/* Internal Content */
.lego-card-content {
    padding: 20px; text-align: center; display: flex; flex-direction: column; align-items: center;
    height: 100%; aspect-ratio: 1/1;
}
.lego-card img { height: 50px; margin-bottom: 10px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.lego-card h3 { font-size: 1.1rem; margin-bottom: 8px; font-weight: 800; text-transform: uppercase; }
.lego-card p { font-size: 0.85rem; line-height: 1.2; opacity: 0.9; }

/* Hover Banner Image */
.lego-banner {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; border-radius: 8px; z-index: 2;
    opacity: 0; transition: opacity 0.3s;
}
.lego-card:hover .lego-banner { opacity: 0; } /* Hide info, show banner? Or vice versa. Logic from original code: show info on hover. */

/* Logic Swap: Show Banner by default, hide on hover to reveal info */
.lego-banner.default-visible { opacity: 1; }
.lego-card:hover .lego-banner.default-visible { opacity: 0; }

.lego-btn {
    background: #d32f2f; 
    color: white; 
    border: none; 
    padding: 12px 24px;
    border-radius: 4px; 
    border-bottom: 4px solid #b71c1c;
    font-weight: bold; 
    cursor: pointer; 
    margin-top: 20px;
    
    /* === NEW PROPERTIES FOR ANCHOR TAG === */
    text-decoration: none; /* Removes the blue underline */
    display: inline-block; /* Allows padding to work on a link */
    font-size: 1rem; /* Ensures text size is consistent */
}

.lego-btn:active { 
    transform: translateY(2px); 
    border-bottom-width: 2px; 
}
.center-btn { width: 100%; text-align: center; }