@charset "UTF-8";

@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

/* ================= KEYFRAMES ================= */
@keyframes show-up {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}



/* ================= GLOBAIS ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ================= PALETA ================= */
    --board-line-color: rgb(40, 40, 40);
    --bg-color: #ccecff;
    --transparent-bg-color: rgba(255, 255, 255, 0.95);
    --hover-color: #edf8fe;

    --light-primary-color: #97d9ff;
    --primary-color: #2AADFA;
    --primary-dark-color: #416478;

    --light-secondary-color: #f06f74;
    --secondary-color: #FA0A12;
    --secondary-dark-color: #7B4143;

    --circle-color: var(--primary-color);
    --circle-hover-color: var(--primary-dark-color);

    --cross-color: var(--secondary-color);
    --cross-hover-color: var(--secondary-dark-color);

    /* ================= FONTES ================= */
    --comic-font: 'Comic Neue', cursive;
    --text-font: 'Open Sans', Arial, Helvetica, sans-serif;
}

body {
    display: grid;
    grid-template-rows: auto 1fr auto;

    background-color: var(--bg-color);
    font-family: var(--comic-font);

    min-height: 100vh;
}



/* ================= HEADER ================= */
header {
    padding: 1em;
}

header h1 {
    font: normal bold 2.2em var(--comic-font);
    text-align: center;
    text-decoration: underline;
}



/* ================= MAIN ================= */
main {
    display: grid;
    place-items: center;
    padding: 2em clamp(1em, 5vw, 8em);
}

/* ======== JOGO ======== */
#gameBoard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: clamp(0.5em, 2%, 1.5em);

    aspect-ratio: 1 / 1;
    width: clamp(10em, 100%, 24em);
    height: auto;

    background-color: var(--board-line-color);
}

/* Cada célula do grid */
.boardSpace {
    display: grid;
    place-items: center;


    background-color: var(--bg-color);
    border: none;

    width: calc(100% + 1px);
    height: calc(100% + 1px);

    cursor: pointer;

    transition: 0.2s ease-in-out;
}

.boardSpace:hover {
    background-color: var(--hover-color);
}

/* Todo SVG do cross e do circle */
svg {
    width: 99%;
    height: 99%;
    transition: all 0.5s ease-in-out;
}

/* ======== CIRCLE ======== */
.circleItem {
    display: none;
    stroke: var(--circle-color);
}

/* Quando adicionar a classe markedCircle, mostre o círculo */
.markedCircle .circleItem {
    display: block;
    animation: show-up 0.3s ease-in-out;  /* Animação de aparecer */
} 

.markedCircle .circleItem:hover {
    stroke: var(--circle-hover-color);
    transform: scale(1.3);
}


/* ======== CROSS ======== */
.crossItem {
    display: none;
    fill: var(--cross-color);
}

/* Quando adicionar a classe markedCircle, mostre o X */
.markedCross .crossItem {
    display: block;
    animation: show-up 0.3s ease-in-out;  /* Animação de aparecer */
}

.markedCross .crossItem:hover {
    fill: var(--cross-hover-color);
    transform: rotate(90deg);
}


/* ======== BOTÃO RESET ======== */
#resetBtn {
    margin-top: 2.5em;
    padding: 0.75em;

    color: white;
    font: normal bold 1em var(--comic-font);

    background-color: var(--light-secondary-color);

    border-radius: 2em;
    border: none;

    transition: background-color 0.1s ease-in-out;
}

#resetBtn:hover {
    background-color: var(--secondary-dark-color);
}

#resetBtn:active {
    background-color: var(--primary-dark-color);
}

/* ======== MENSAGEM ======== */
.winMessageWrapper {
    position: fixed;

    display: grid;
    place-items: center;
    grid-template-rows: 1fr auto;
    
    background-color: var(--transparent-bg-color);
    backdrop-filter: blur(0.2em);

    padding: clamp(0.25em, 5%, 2em);
    box-shadow: 4px 4px 8px 5px rgba(0, 0, 0, 0.125);
    
    border-radius: 3em;
    border: 0.1em solid var(--primary-dark-color);

    aspect-ratio: 3/2;
    width: clamp(250px, 80%, 500px);
    height: auto;
    
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    
    transition: 0.5s ease-in-out;
    transform: scale(0);
}

.activeMessage {
    transform: scale(1);
}


/* Texto da mensagem */
#winMessage {
    font-size: 1.5em;
    font-weight: bold;
    text-align: center;
}

/* Botão de fechar da mensagem */
#closeBtn {
    padding: 0.75em;

    color: white;
    font: normal bold 1em var(--comic-font);
    text-shadow: 2px 2px 1px rgba(0, 0, 0, 0.3);

    background-color: var(--light-primary-color);

    border-radius: 2em;
    border: none;

    transition: background-color 0.1s ease-in-out;

    cursor: pointer;
}

#closeBtn:hover {
    background-color: var(--primary-dark-color);
}

#closeBtn:active {
    background-color: var(--secondary-dark-color);
}

/* ================= FOOTER ================= */
footer {
    padding: 1em;
}

footer p {
    font-size: 1em;
    font-family: var(--text-font);
    text-align: center;
    margin: 0.25em 0;
}

footer a {
    font-weight: bold;
    color: var(--secondary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}