body {
    margin: 0;
    padding-top: 20vh;
}

#diagram_mosaic{
    display: flex;
    flex-wrap: wrap;
}

.diagram_link {
    flex: 1 1 calc(100% / 4); 
    display: flex;
    justify-content: center;
    align-items: center;
}


.diagram_link img{
    width: 100%;
    transition: 0.25s;
}

.diagram_link img:hover{
    width: 93%;
    transition: 0.1s;
}

#expressions {
    display: flex;
    flex-wrap: wrap;
}

.expression {
    position: relative;
    flex: 1 1 calc(100% / 9); 
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;   
    padding: 10px;
    border: 1px solid #000000;
    height: 100px;
}

.counter {
    font-size: 9pt;
    font-family: sans-serif;
    text-align: left;
    padding-left: 5px;
    position: absolute;
    top: 5px;
    left: 5px;
}

.formula {
    text-align: center;
    font-size: 18pt;
    display: block;
}

#menu-bar {
    position: fixed;
    background-color: rgba(255, 255, 255, 0.9); /* Red with 50% opacity */
    top: 0;                      
    width: 100%;                 
    padding-left: 40px;
    padding-right: 40px;          
    box-sizing: border-box;      
    z-index: 1000;               
    display: flex;               
    justify-content: space-between;
    align-items: center;  
    border-bottom: solid 1px #000000;
    height: 20vh;
}

#menu-bar a {
    text-decoration: none;
    color: black;
    font-family: sans-serif;
}

#menu-bar a:hover {
    text-decoration: underline;
}

#menu-bar .back {
    margin-right: 20px;
}

#diagram {
    display: block;
    margin: 0 auto;
    height: 20vh;
    max-width: 100%;
    object-fit: contain;
}

#about-text{
    margin-top: 100px;
    width: 50%;
    margin-left: 25%;
}

#john{
    margin-top: 40px;
    width: 30%;
}



/* Smartphones (portrait and landscape) */
@media only screen and (max-width: 767px), 
       only screen and (max-device-width: 767px) and (-webkit-min-device-pixel-ratio: 2) {
    .expression {
        flex: 1 1 calc(100% / 2);
        height: 120px;
    }
    #menu-bar {
        flex-direction: column;
        align-items: flex-start;
        height: 15vh;
    }

    body {
        padding-top: 15vh;
    }
    #diagram {
        height: 18vh;
    }
    #right {
        display: flex;
        justify-content: center;
        width: 100%;
        padding-bottom: 20px;
    }
    #menu-bar .title {
        text-align: center;
        width: 100%;
        margin: 0;
        padding-top: 20px;
    }
    #about-text{
        margin-top: 40px;
        width: 90%;
        margin-left: 5%;
    }
    .diagram_link {
        flex: 1 1 calc(100% / 2); 
    }
}

/* Tablets (portrait and landscape) */
@media only screen and (min-width: 768px) and (max-width: 1024px),
       only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) {
    .expression {
        flex: 1 1 calc(100% / 5);
        height: 140px;
    }
    #menu-bar {
        flex-direction: column;
        align-items: flex-start;
        height: 15vh;
    }

    body {
        padding-top: 15vh;
    }
    #diagram {
        height: 18vh;
    }
    #right {
        display: flex;
        justify-content: center;
        width: 100%;
        padding-bottom: 20px;
    }
    #menu-bar .title {
        text-align: center;
        width: 100%;
        margin: 0;
        padding-top: 20px;
    }
    #about-text{
        margin-top: 40px;
        width: 90%;
        margin-left: 5%;
    }
    .diagram_link {
        flex: 1 1 calc(100% / 2); 
    }
    
}
