:root {
    --ink: #23194A;
    --card-bg: #f3efe3;
    --radius: 22px;
    --accent-color: #6d5edc;
}

body {
    margin: 0;
    background: #251544;
    color: var(--ink);
    font-family: 'Roboto', system-ui, Segoe UI, Helvetica, Arial, sans-serif;
}

.wrap {
    max-width: 1200px;
    margin: auto;
    padding: 32px 16px 64px;
}

/* Section */
.section {
    margin-bottom: 80px;
}

.section__title {
    /* font-family: "Playfair Display", serif; */
    font-family: "Roboto";
    color: #fff;
    margin: 0 0 40px;
    font-size: clamp(1.75rem, 1.2rem + 1.5vw, 2.5rem);
    font-weight: 700;
    text-align: center;
    letter-spacing: .3px;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    /* card gap */
}

@media (min-width: 600px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Card Flip Styling */
.card-container {
    perspective: 1000px;
    width: 100%;
    aspect-ratio: 1 / 1.25;
}

.card-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    /* CORRECTED: Fixed typo from preserve-d to preserve-3d */
    transform-style: preserve-3d;
}

.card-container:hover .card-flipper,
.card-container.is-flipped .card-flipper {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(20, 7, 63, .18);
    box-sizing: border-box;
}

.card-front {
    background: var(--card-bg);
}

.card-back {
    background: var(--card-bg);
    transform: rotateY(180deg);
    padding: 20px;
    justify-content: space-between;
}

/* Front Card Content */
.card__media {
    width: 100%;
    height: 75%;
}

.card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card__body {
    padding: 0px 22px;
    text-align: left;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card__name {
    margin: 0 0 4px;
    font-weight: 700;
    font-size: clamp(1.05rem, 0.9rem + 0.8vw, 1.2rem);
}

.card__role {
    margin: 0;
    font-weight: 500;
    opacity: .8;
    font-size: clamp(.9rem, 0.88rem + 0.2vw, 1rem);
}

/* Back Card Content & Layout */
.card-back-header {
    display: flex;
    align-items: flex-start;
    /* Aligns items to the top */
    gap: 15px;
}

.card-back-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    border: 3px solid var(--ink);
}

.card-back-info {
    text-align: left;
}

.card-back .card__name,
.card-back .card__role,
.card-back .card-bio,
.card-back .profile-button {
    opacity: 0;
    transition: opacity 0.3s ease-out 0.25s;
}

.card-container:hover .card-flipper .card__name,
.card-container.is-flipped .card-flipper .card__name,
.card-container:hover .card-flipper .card__role,
.card-container.is-flipped .card-flipper .card__role,
.card-container:hover .card-flipper .card-bio,
.card-container.is-flipped .card-flipper .card-bio,
.card-container:hover .card-flipper .profile-button,
.card-container.is-flipped .card-flipper .profile-button {
    opacity: 1;
}

.card-bio {
    font-size: clamp(0.85rem, 0.8rem + 0.2vw, 0.95rem);
    line-height: 1.5;
    flex-grow: 1;
    margin-top: 15px;
    text-align: left;
    overflow-y: auto;
    /* Add scroll for long bios */
}

.profile-button {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    padding: 10px 15px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    margin-top: auto;
    /* Pushes button to the bottom */
    transition: background-color 0.2s ease;
}

.profile-button:hover {
    background: #5648b1;
}

/* Funder Section */
.funder-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px;
    margin-top: 60px;
}

.funder-section .section__title {
    color: var(--ink);
    /* Dark title on light background */
}

.funder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    text-align: center;
}

.funder-logo {
    flex-shrink: 0;
    width: 150px;
}

.funder-logo img {
    max-width: 80%;
    height: auto;
    border-radius: 20px;
    padding-left: 20%;

}

.funder-text {
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: left;
    text-align: justify;
}

@media (min-width: 768px) {
    .funder-content {
        flex-direction: row;
        text-align: left;
        gap: 40px;
    }

    .funder-logo {
        width: 20%;
    }

    .funder-text {
        width: 80%;
    }
}