body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #7D7D7D;
    color: #f0f0f0;
}

header {
    background: #222;
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 2.5em;
}

header p {
    margin: 5px 0 0 0;
    font-size: 1.2em;
}

section {
    max-width: 900px;
    margin: 80px auto;
    padding: 40px 20px;
    background: #5C5C5C;
    border-radius: 8px;
}

section h2 {
    font-size: 2em;
    margin-bottom: 20px;
    border-bottom: 2px solid #ccc;
    padding-bottom: 10px;
    background: #5C5C5C;
    border-radius: 8px;
}

.projects {
    display: flex;
    flex-direction: column;
    gap: 60px;
}

.card {
    background: #6A6A6A;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

/* Grid for images */
.card-images {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: center
}

/* All images by default */
.card-images img {
    width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Rotated images */
.card-images img.rotated {
    transform: rotate(-90deg) scale(0.84);
    transform-origin: center center;
    max-width: 90%;
    height: auto;
    margin: auto;
    display: block;
    border-radius: 6px;
    justify-self: center;
    align-self: center;
}

/* Single image → full width */
.card-images img.hero {
    grid-column: 1 / -1;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

/* First image hero for odd number >1 images (3,5,7…) */
.card-images img:first-child:nth-last-child(odd):not(:only-child) {
    grid-column: span 2;
}

/* Portrait wrapper spans both columns */
.portrait-wrapper {
    grid-column: 1 / -1;
    /* occupy the full row */
    text-align: center;
    /* center its contents */
}

/* All other images → span 1 column */
.card-images img:not(.hero) {
    grid-column: span 1;
}

/* Portrait image inside wrapper */
.portrait-wrapper img.portrait {
    display: inline-block;
    /* needed for text-align centering */
    max-width: 50%;
    /* adjust width */
    height: auto;
    border-radius: 6px;
}

.rotate-wrapper {
    text-align: center;
}

/* Rotated/scaled images inside wrapper */
.rotate-wrapper img.rotated {
    display: inline-block;
    transform: rotate(-90deg) scale(0.8);
    max-width: 90%;
    height: auto;
    border-radius: 6px;
}

.card h3 {
    margin-top: 10px;
    margin-bottom: 5px;
}

.card p {
    font-size: 0.95em;
    line-height: 1.4em;
    text-align: center;
    margin-top: 15px;
    margin-bottom: 0;
}
.card a {
    display: inline-block;
    margin-top: 10px;
    text-decoration: none;
    color: #0066cc;
    font-weight: bold;
}

.card a:hover {
    color: #004999;
}

.links {
    text-align: center;
}

.links a {
    text-decoration: none;
    color: #fd8802;
    margin: 0 10px;
}

.links a:hover {
    color: #ff3e04;
}

footer {
    text-align: center;
    padding: 20px;
    background: #222;
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 2em;
    }

    section {
        padding: 30px 15px;
    }

    .card-images {
        grid-template-columns: 1fr;
        /* single column on mobile */
    }

    .card-images img:only-child,
    .card-images img:first-child:nth-last-child(odd):not(:only-child),
    .card-images img:not(:first-child) {
        grid-column: span 1;
    }
}