/* READ ME */

.read-me .overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(0, 0, 0);
    opacity: 0.7;
    z-index: 1;
    display: none;
}

.read-me .content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgb(220, 220, 220);
    width: 500px;
    height: fit-content;
    z-index: 2;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    border-radius: 0.8em;
}

.read-me .close-btn {
    position: absolute;
    right: 20px;
    top: 15px;
    width: 30px;
    height: 30px;
}

.read-me.active .overlay {
    display: block;
    /* add fading effect */
}

.read-me.active .content {
    transition: all 300ms ease-in-out;
    transform: translate(-50%, -50%) scale(1);
}

.read-me .title {
    font-size: 1.8em;
}

.read-me .text {
    margin-top: 1em;
    font-size: 1.1em;
}

.read-me-btn-wrapper {
    text-align: center;
    margin-top: 1.5em;
}

.read-me-btn {
    position: relative;
    font-size: 1.2rem;
    width: 8em;
    height: 3.5em;
    border: 1px solid rgb(100, 100, 100);
    background-color: aliceblue;
    z-index: 0;
}

.read-me-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: -1;
    transition: transform 200ms ease-in;
    transform: scaleX(0);
    transform-origin: right;
}

.read-me-btn:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ALG POPUP */

.alg-popup .overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(0, 0, 0);
    opacity: 0.7;
    z-index: 1;
    display: none;
}

.alg-popup .content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgb(220, 220, 220);
    width: 500px;
    height: fit-content;
    z-index: 2;
    text-align: center;
    padding-top: 10px;
    padding-bottom: 20px;
    box-sizing: border-box;
    border-radius: 0.8em;
}

.alg-popup .close-btn {
    position: absolute;
    right: 20px;
    top: 15px;
    width: 30px;
    height: 30px;
}

.alg-popup.active .overlay {
    display: block;
}

.alg-popup.active .content {
    transition: all 300ms ease-in-out;
    transform: translate(-50%, -50%) scale(1);
}

.alg-popup .text {
    margin-top: 1em;
    font-size: 1.1em;
}

/* SHEET */

.table-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr 2fr);
    grid-template-rows: 1fr 3fr 3fr 3fr 3fr 3fr 3fr;
    margin: 2.5em auto;
    max-width: 85%; /* non è un unica tabella, quindi bisogna mettere una larghezza fissa per tutti */
    min-width: fit-content;
}

.table-wrapper .image-container:nth-child(4n+2) {
    border-left: 2px solid black;
}

.even-alg {
    border-bottom: 2px solid black;
}

.set-name {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid black;
    grid-column: 1 / -1;
    font-size: 1.5em;
}

.image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 2px solid black;
    border-right: 2px solid black;
}

.image {
    width: 10em;
    /* border: 1px solid black;
    border-radius: 0.2em; */
    outline: 1px solid black;
    -moz-outline-radius: 0.2em;
    margin: 1em;
    transition-duration: 150ms;
}

.image:hover {
    transform: translateY(-3px);
}

.algorithm {
    display: grid;
    grid-template-rows: 1fr 1fr;
    border-right: 2px solid black;
    border-bottom: 2px solid black;
    font-size: 1.4em;
}

.even-alg {
    display: flex;
    align-items: center;
    justify-content: center;
}

.odd-alg {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* PHONE LAYOUT */

@media only screen and (max-width:1200px) {
    .table-wrapper {
        margin-top: 2em;
        grid-template-columns: 1fr 2fr;
    }

    .table-wrapper div:nth-child(4n+4) {
        border-left: 2px solid black;
    }
}

@media only screen and (max-width: 700px) {
    /* MENU */

    header {
        height: 5em;
    }
    
    .menu {
        height: 5em; /* same as the height of header */
        justify-content: space-between;
    }
    
    .menu ul li {
        line-height: 5em; /* same as the height of header */
        display: none;
    }

    .brand-title {
        display: inline-block;
    }

    .toggle-button {
        display: flex;
    }

    /* READ ME */

    .read-me .content {
        max-width: 80%;
        height: fit-content;
    }

    .read-me .close-btn {
        right: 15px;
        top: 10px;
        width: 20px;
        height: 20px;
    }

    .read-me .title {
        font-size: 1.2em;
    }

    .read-me .text {
        font-size: 0.8em;
    }

    .read-me-btn {
        font-size: 0.8rem;
        width: 7em;
        height: 3em;
    }

    /* ALG-POPUP */

    .alg-popup .content {
        max-width: 80%;
        height: fit-content;
    }

    .alg-popup .close-btn {
        right: 15px;
        top: 10px;
        width: 20px;
        height: 20px;
    }

    .alg-popup .text {
        font-size: 0.8em;
    }

    /* SHEET */

    .table-wrapper {
        grid-template-columns: repeat(1fr 3fr);
    }

    .set-name {
        font-size: 0.8em;
        /* line-height: 1.8em; */
    }

    .image {
        width: 5em;
        margin: 0.5em;
    }

    .algorithm {
        font-size: 0.8em;
    }
}

@media only screen and (max-width:414px) {
    header {
        height: 4em;
    }
    
    .menu {
        height: 4em;
    }
    
    .menu ul li {
        line-height: 4em; /* same as the height of header */
    }

    .table-wrapper {
        grid-template-columns: 2fr 5fr;
    }
    
    .image {
        width: 4em;
    }
}