.cast-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 20px;
    max-width: 1080px;
    margin-left: auto;
    margin-right: auto;
}

.cast-item-container {
    background-color: #fff; /* White background for the item container */
    border-radius: 15px; /* Rounded corners for the container */
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
    padding: 15px;
    width: 100%; /* Full width within the grid */
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Smooth transition for hover effect */
}

.cast-item-container:hover {
    transform: scale(1.05); /* Slightly increase the size on hover */
    box-shadow: 0px 8px 12px rgba(0, 0, 0, 0.2); /* Deepen the shadow on hover */
}

.cast-item {
    text-align: center;
}

.cast-item img {
    width: 100%;
    cursor: pointer;
    border-radius: 10px; /* Slightly rounded image corners */
    margin-bottom: 10px;
}

.cast-item h2, .cast-item h3 {
    margin: 10px 0;
    color: #333; /* Darker text for contrast against the white background */
}

.cast-item h2 {
    font-size: 37px;
    margin-bottom: 0px !important;
    padding-bottom: 0px !important;
    margin-top: 4px;
}

.cast-item h3 {
    margin-top: 3px;
}

.cast-item h2, .cast-item h3 {
    cursor: pointer;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.8);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    width: 80%;
    max-width: 800px;
    display: flex;
    flex-wrap: wrap;
    position: relative;
}

.modal-content img {
    width: 100%;
    max-width: 300px;
    margin: auto;
}

.modal-content .bio {
    flex: 1;
    padding: 20px;
}

.modal-content h2, .modal-content h3, .modal-content p {
    margin: 10px 0;
}

#modal-actual-name {
    font-size: 48px;
}

#modal-character-name {
    font-size: 34px;
}

#modal-bio {
    font-size: 20px;
}

.close {
    color: #aaa;
    position: absolute;
    left: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

@media (max-width: 768px) {
    .cast-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .modal-content {
        flex-direction: column;
        align-items: center;
    }
    .modal-content img {
        width: 95%;
    }
    .modal-content .bio {
        padding: 20px 0;
    }
    .close {
        background-color: white;
        color: black;
        height: 26px;
        width: 26px;
    }
}
