.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: auto;
    gap: 24px;
    margin: 24px auto 0 auto;
    width: 80%;
    overflow: visible;
    align-items: stretch;
}

.projects .card {
    color: #c9d1d9;
    display: flex;
    flex-direction: column;
}

.card.small { grid-column: span 1; }
.card.medium { grid-column: span 2; }
.card.large { grid-column: span 3; }

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.project-title {
    font-size: 1.5rem;
    font-weight: 1000;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    color: #ffffff;
    text-decoration: none;
}

.project-title .subdomain {
    font-size: 0.95rem;
    font-style: italic;
    color: #8b949e;
    font-weight: normal;
}

.project-date {
    font-size: 0.9rem;
    min-width: 120px;
    text-align: end;
    color: #8b949e;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.media {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0d1117;
}

.media-wrapper {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.media-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    background-color: #0d1117;
}

.project-media {
    width: 100%;
    height: 100%;
    max-height: 600px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    border: 1px solid #30363d;
    z-index: 2;
    transition:
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

.card:hover .project-media {
    border: 1px solid #f97316;
}

.project-media.gif {
    max-height: 320px;
}

.tech-tag {
    background-color: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    color: #f97316;
}

.project-description {
    font-size: 1rem;
    margin-bottom: 14px;
    flex-grow: 1;
}

.project-links {
    display: flex;
    gap: 12px;
}

.media-grid-three {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: stretch;
    flex-wrap: nowrap; /* forces horizontal layout */
}

.media-large {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.media-large img,
.media-large video {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.media-stack {
    flex: 0 1 30%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.media-small {
    flex: 1;
    display: flex;
}

.media-small img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

@media (max-width: 1100px) {
    .project-grid {
        grid-template-columns: 1fr;
        width: 100%;
        gap: 16px;
        margin-bottom: 30px;
    }

    .card.small,
    .card.medium,
    .card.large {
        grid-column: span 1 !important;
    }

    .project-title {
        font-size: 1rem;
        font-weight: 1000;
    }

    .project-title .subdomain {
        font-size: 0.5rem;
    }

    .project-date {
        font-size: 0.5rem;
        min-width: 10px;
        text-align: end;
    }

    .project-description {
        font-size: 0.7rem;
        margin-bottom: 10px;
    }
}
