/* Global Reset and Utility */
* {
    user-select: none;
}

img {
    pointer-events: none;
    -webkit-user-drag: none;
}

/* Color Variables (Design System) */
:root {
    --primary-color: #1a1a1a;
    --secondary-color: #6b6b6b;
    --background-color: #e9ecf1;
    --card-background: #e9ecf1;
    --text-color: #1a1a1a;
    --subtle-text: #70757a;
    --border-color: #d0d4db;
}

/* Base Body Styling */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header Styling */
#header {
    width: 100%;
    padding: 10px 0;
    text-align: center;
    color: var(--text-color);
    font-size: 25px;
    font-weight: 500;
    letter-spacing: 0.5px;
    background: var(--background-color);
    border-radius: 0 0 20px 20px;
}

/* Gallery Container (Max Width and Centering) */
#gallery-container {
    max-width: 85vw;
    width: 100%;
    padding: 30px 0 70px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Grid for Cards */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    width: 100%;
}

/* Individual Card Styling (Neumorphic Base) */
.card {
    background: var(--card-background);
    border-radius: 10px;
    box-shadow: 
        8px 8px 18px rgba(0, 0, 0, 0.12),
        -8px -8px 20px rgba(255, 255, 255, 0.9);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    padding: 0;
    overflow: hidden;
}

/* Card Hover Effect (Neumorphic Push) */
.card:hover {
    transform: translateY(-6px);
    box-shadow: 
        10px 10px 22px rgba(0, 0, 0, 0.14),
        -10px -10px 24px rgba(255, 255, 255, 0.95);
}

/* Image Section */
.card-img {
    height: 270px;
    display: flex; /* Kept for centering icon, but object-position handles image */
    align-items: center; /* Kept for centering icon */
    justify-content: center; /* Kept for centering icon */
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    background: var(--background-color);
    overflow: hidden; /* Ensure anything overflowing the container is hidden */
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* --- MODIFIED LINE BELOW --- */
    object-position: top; /* This makes the image align to the top, hiding the bottom if it overflows */
}

/* Icon within Image Section */
.card-img .icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: contrast(0.9) brightness(0.95);
}

/* Text Description Section */
.card-description {
    padding: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.project-name {
    font-size: 1.2em;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
    color: var(--text-color);
}

.card-description p {
    font-size: 0.92em;
    color: var(--subtle-text);
    margin: 10px 0 0;
}

.card-description i {
    font-style: normal;
    font-weight: 400;
    color: var(--text-color);
    display: block;
    margin-top: 5px;
}

/* Links (Action Buttons) */
.card-description a {
    display: inline-block;
    margin: 5px 10px;
    color: var(--secondary-color);
    text-decoration: none;
    padding: 4px 0;
    font-size: 0.95em;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.card-description a:hover {
    color: var(--text-color);
    border-color: var(--text-color);
}

/* Media Queries (Responsiveness) */
@media (max-width: 600px) {
    #header {
        font-size: 22px;
    }
    #gallery-container {
        padding: 20px;
    }
}