/* Global Styles */

body {
    font-family: "Raleway", sans-serif;
    min-height: 100vh;
    min-width: 100%;
    color: white;
    background-color: #12181f;
    text-align: center;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Heading */

h1 {
    font-size: 3rem;
    margin: 20px 0;
    font-weight: 700;
    color: #00bcd4;
}

h1 > em {
    color: #ff4081;
    text-transform: uppercase;
}

/* Paragraph */

#play {
    font-size: 1.2rem;
    margin: 10px 0;
    font-weight: 350;
}

#info-panel {
    font-size: 1rem;
    margin: 10px 0;
    font-weight: bold;
}

#score {
    color: #00bcd4
}

#level {
    color: #ff4081
}

/* Buttons */

#start-button {
    background-color: #ff4081;
    border: none;
    color: white;
    padding: 15px 30px;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 5px;
}

.actions {
    display: flex;
    justify-content: center;
}

.actions button {
    background-color: #00bcd4;
    border: none;
    color: white;
    padding: 10px 20px;
    margin: 10px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
}

#reset-button {
    display: none; /* Hidden by default, shown when game starts */
}

#contact-button {
    background-color: #00bcd4;
    border: none;
    color: white;
    padding: 15px 30px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
}

/* Hover effect for buttons */

#start-button:hover {
    background-color: #00bcd4;
}

.actions button:hover {
    background-color: #ff4081;
}   

#contact-button:hover {
    background-color: #ff4081;
}

/* Game Area */

#game-grid {
    display: grid;
    justify-content: center;
    gap: 50px;
    margin: 20px auto;
    grid-template-columns: repeat(6, 140px);
}

.card {
    width: 140px;
    height: calc(140px / 2 * 3);
    background-color: white;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    /* Reference in ReadMe */
    transform-style: preserve-3d;
    transition: all 0.5s ease-in-out;
}

/* will be used to adjust level-3 grid*/ 
.level-3 {
    /* Adjust grid for Level-3*/
    grid-template-columns: repeat(8, 1fr); /* 8 equal columns */
    gap: 8px; /* Slightly smaller gap for better fit */
}

.front-image {
    width:60px;
    height:60px;
}

.card.flipped {
    transform: rotateY(180deg);
}

.front, .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    top: 0;
    left: 0;
}

.card .front {
    display: flex;
    justify-content: center;
    align-items: center;
    transform: rotateY(180deg);
}

.card .back {
    /* background-image: url(assets/images/pattern_waves.png);*/
    background-position: center center;
    background-size: cover;
    backface-visibility: hidden;
}

#game-grid .message {
    font-size: 1.5rem;
    padding: 20px;
    color: #00bcd4;
    justify-content: center;
    /* Center message in grid */
    grid-column: 1 / -1; /* Span all columns */
}

.message h2 {
    color: #ff4081;
}

.message #score {
    color: #00bcd4;
}

.message #replay {
    color: #ff4081;
}

#social-icons {
    margin: 20px;
}

#social-icons a {
    color: white;
    margin: 0 10px;
    font-size: 1.5rem;
    text-decoration: none;
}

#contact-section {
    margin: 20px;
    font-size: 1rem;
    color: #00bcd4;
    text-align: center;
    /* Ensure it doesn't stretch too wide */
    max-width: 400px;
    height: 450px;
    margin-left: auto;
    margin-right: auto;
    padding: 10px;
    background-color: #1e2a36;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    /* stack vertically */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#contact-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80%;
}

#contact-form input, #contact-form textarea {
    padding: 10px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
}

#contact-form button {
    width: 50%;
    align-self: center;
    background-color: #ff4081;
    border: none;
    color: white;
    padding: 10px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
}

#contact-form button:hover {
    background-color: #00bcd4;
}

#error-section h2 {
    color: #ff4081;
    font-size: 2rem;
}

#error-section h3 {
    color: #00bcd4;
    font-size: 1.5rem;
}

#error-section p {
    color: #ff4081;
    font-size: 1.5rem;
}

/* Media queries */

/* Tablet (below 768px) */
@media (max-width: 769px) {
    #instructions-section {
        padding: 10px 40px;
    }

    #game-grid {
        width: 100%; /* full width */
        max-width: 140px; /* optional: limit max width so cards don’t stretch too much */
        margin: 0 auto; /* keep centered */
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .card {
        width: 100%;
        aspect-ratio: 2/3; /* maintains proportions */
    }

    #game-grid .message {
    /* Center message in grid */
    grid-column: 1 / -1; /* Span all columns */
    }
}

/* Mobile (360px) */
@media (max-width: 360px) {
    #instructions-section {
        padding: 10px 20px;
    }

    #game-grid {
        width: 90%;
        grid-template-columns: repeat(2, 1fr); /* 2 card per row */
        gap: 5px;
    }

    #game-grid .message {
    /* Center message in grid */
    grid-column: 1 / -1; /* Span all columns */
    }
}