/* CSS Styles for JavaScript Matching Game
 * Created by Rebecca Cathey
 * Date: July 2024
 */

 body {
    background: linear-gradient(to bottom, #A4CC9F 60%, #288957);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: 'Roboto', sans-serif;
}

/* Set up wrapper */
.wrapper {
    width: 80%;
    margin: 0 auto;
    text-align: center;
}

/* Header styles */
header {
    margin-top: 2em;
}

.welcome-message {
    font-size: 2em;
    color: #F58B74;
    background-color: #FFFAF3; 
    padding: 1.5em; 
    border-radius: 0.75em 0.75em 0em 0em;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); 
    font-weight: bold;
    transition: background-color 0.3s, transform 0.3s;
    font-family: Georgia, 'Times New Roman', Times, serif;
}

.instructions {
    background-color: #FFFAF3; 
    padding: 1.5em; 
    border-radius: 0em 0em 0.75em 0.75em; 
    text-align: center;
    margin-bottom: 2em; 
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, transform 0.3s;
}

h3 {
    color: #F58B74;
    font-weight: bolder;
}

/* Game container styles */
.game-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr); 
    gap: 2.5em 2.5em; 
    justify-content: center; 
    margin-top: 2em; 
    width: 100%; 
}

/* Card styles */
.card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 97%;
    height: 8em;
    background-color: #FFFAF3;
    border-radius: 0.75em; 
    font-size: 1em;
    font-weight: bold;
    color: #2F9C9F; 
    cursor: pointer;
    background-image: url('../Assets/cover.jpg'); /* Default cover image */
    background-size: cover;
    background-position: center;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
    text-align: center;
    word-wrap: break-word;
    padding: 0.5em;
    box-sizing: border-box;
    position: relative;
}

/* Hide text initially */
.card .card-text {
    display: none;
    transition: opacity 0.3s;
}

/* Styles for flipped and matched cards */
.card.unmatched {
    background-image: url('../Assets/cover.jpg');
    background-size: cover;
    background-position: center;
}

.card.matched {
    background-color: #D4E157;
    border: 0.15em solid #C0D434; 
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); 
}

.card.flipped {
    background-color: #FFF;
    color: #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

/* Hide the background image when card is flipped */
.card.flipped .card-text {
    display: block;
    opacity: 1;
}

/* Hide background image when card is flipped */
.card.flipped {
    background-image: none;
}

/* Button styles */
button {
    margin-top: 2em;
    padding: 0.75em 1.5em;
    border: none;
    border-radius: 0.75em; 
    background-color: #FAB659;
    color: #FFF;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s, transform 0.3s;
}

button:hover {
    background-color: #EC7E31;
    transform: translateY(-3px);
}

/* Form styles for Round 2 and Round 3 */
#round-2-form, #round-3-form {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#definitions-container, #round-3-form div {
    margin-bottom: 2em;
}

#definitions-container input, #round-3-form input, #round-3-form select {
    width: 100%;
    padding: 0.75em; 
    border: 1px solid #DDD;
    border-radius: 0.75em;
    transition: border-color 0.3s;
}

#definitions-container input:focus, #round-3-form input:focus, #round-3-form select:focus {
    border-color: #FF6F61;
}

/* Hide elements with the 'hidden' class */
.hidden {
    display: none;
}

/* Additional styles for Round 2 section and form */
#round-2-section, #round-3-section {
    margin-top: 2em; 
}

/* Result text styles */
#result {
    margin-top: 2em;
    font-size: 1.5em;
    font-weight: 700;
    color: #FF6F61;
}

/* Responsive Design */
@media (min-width: 481px) and (max-width: 768px) {
    .wrapper {
        width: 90%;
    }

    .game-container {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto; 
        gap: 1.5em; 
    }
}

@media (max-width: 480px) {
    .wrapper {
        width: 100%;
    }

    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto; 
        gap: 1em;
    }

    header {
        font-size: 1.4em;
    }

    .welcome-message {
        font-size: 1.5em;
    }

    #result {
        font-size: 1.2em;
    }

    button {
        padding: 0.5em 1em;
        font-size: 1em; 
    }
}

@media (min-width: 769px) {
    .wrapper {
        width: 70%;
    }

    .game-container {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(4, 1fr);
        gap: 1.5em;
    }
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}
@media (max-width: 768px) {
    #round-2-section, #round-3-section {
        display: none;
    }
}

/* Final Results Section Styles */
#final-results {
    margin-top: 2em;
    text-align: center;
}

#result-image {
    max-width: 100%;
    align-items: center;
    margin: 2em;
    border-radius: 0.75em;
}