html, body {
    margin: 0;
    min-height: 100vh;
}

body {
    display: flex;
    flex-direction: column;
}

.page {
    flex: 1;
}

.content1 {
    margin: auto;
    display: flex;
    justify-content: center;  
    align-items: center;
    text-align: center;       
    gap: 0.7rem;        
    flex-wrap: wrap; 
    position: relative;
    z-index: 1;
    max-height: 30rem;
    margin-top: 2rem;
}

.main-column {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    
}

.main-txt-container {
    width: 90%;
    max-width: 1300px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.main-txt-container h1 {
    font-size: 1.7rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.1rem;
}   

.main-txt-container h2 {
    font-size: 1.4rem;
}   

.main-txt-container p {
    font-size: 1.1rem;
    line-height: 1.3;
}

.content2 {
    margin: auto 5rem auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5em;
    position: relative;
    z-index: 1;
    height: auto;
    width: 90%;
}

.column {
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.txt-container {
    width: 95%;
}

.txt-container h1 {
    font-size: 1.2rem;
}

.txt-container h2 {
    font-size: 1.6rem;
}

.txt-container p {
    font-size: 1rem;
}

.content3 {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 1rem;
    max-width: 1300px;
    width: 90%;
    margin: 2rem auto 5rem auto;
}

.content6 {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 1rem;
    max-width: 1300px;
    width: 90%;
    margin: 2rem auto 5rem auto;
}


.img-card {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 1 / 1;
}

.img-card img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    transition: transform 0.3s ease;
}

.img-card:hover img {
    transform: scale(1.05); 
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
}

.lightbox img {
    max-width: 90%;
    max-height: 80%;
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.content4 {
    display: grid;
    grid-template-columns: 0.7fr 1.3fr; 
    gap: 4rem;
    max-width: 1300px;
    width: 90%;
    margin: 4rem auto;
    align-items: start;
}

.side-image {
    position: sticky; 
    top: 2rem;
}

.side-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.side-text-stack {
    display: flex;
    flex-direction: column;
}

.side-text-stack h1 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
    color: #333;
}

.side-text-stack p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.content5 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1300px;
    width: 90%;
    margin: 4rem auto; 
    position: relative;
    z-index: 1;
}

.content5 .column:first-child {
    grid-column: 1 / -1; 
    text-align: center;  
    display: flex;
    flex-direction: column;
    align-items: center;  
}

.content5 .column:first-child .txt-container {
    max-width: 1000px; 
}

.content5 .column {
    text-align: left;
}

.content7 {
    margin: auto 5rem auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5em;
    position: relative;
    z-index: 1;
    height: auto;
    width: 90%;
    margin-bottom: 3rem;
}

.content7 h1 {
    font-size: 1.4rem;
}

.separator {
    border: none;              
    height: 2px;               
    background-color: #ccc;    
    margin: 2rem 0;            
    width: 90%;                
    margin-left: auto;         
    margin-right: auto;
}

#toTop {
    display: none; 
    position: fixed; 
    bottom: 30px;
    right: 30px;
    z-index: 99;
    
    /* Kiinteä koko takaa pyöreän muodon */
    width: 50px;
    height: 50px;
    border-radius: 50%; 
    
    /* Keskitys */
    display: flex; /* Muutetaan flexiksi, jotta nuoli on keskellä */
    justify-content: center;
    align-items: center;
    
    border: none;
    outline: none;
    background-color: #301304; 
    color: white;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    padding: 0; 
}

#toTop:hover {
    background-color: #555;
}

.secondary-nav {
    position: sticky;
    top: 60px; 
    background-color: #ffffff;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    z-index: 800;
    padding: 15px 0;
    width: 100%;
}

.sec-nav-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    max-width: 1300px;
    margin: 0 auto;
    width: 90%;
}

.sec-nav-link {
    text-decoration: none;
    color: #301304; /* Ruskea teemaväri */
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    padding: 5px 0;
}

.sec-nav-link:hover {
    color: #8b5e3c;
    border-bottom: 2px solid #8b5e3c;
}

@media (max-width: 1024px) {
    .content2 {
        margin: auto 2rem auto; 
        gap: 1.5rem;
    }

    .content3 {
        grid-template-columns: repeat(3, 1fr); 
    }

    .content5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .content6 {
        grid-template-columns: repeat(2, 1fr); 
    }

    .content4 {
        gap: 2rem;
        grid-template-columns: 1fr 1fr; 
    }
}

@media (max-width: 768px) {
    .content2, 
    .content3, 
    .content5, 
    .content6, 
    .content4,
    .content7 {
        grid-template-columns: 1fr;
        margin-left: auto;
        margin-right: auto;
        width: 95%;
        gap: 2rem;
    }

    .content3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .side-image {
        position: static;
        max-width: 100%;
        display: flex;
        justify-content: center;
    }

    .side-image img {
        max-width: 500px; 
    }

    .main-txt-container, 
    .column, 
    .side-text-stack {
        align-items: center;
        text-align: center;
    }

    .txt-container {
        width: 100%;
    }

    .main-txt-container h1 {
        font-size: 1.5rem;
    }
    
    .content5 .column:first-child {
        grid-column: auto;
    }

    .secondary-nav {
        display: none;
    }

}

@media screen and (min-width: 1800px) {

    /* Keskityksen hallinta: pidetään sisältö max 1600px leveänä */
    .main-txt-container, 
    .content2, 
    .content3, 
    .content4, 
    .content5, 
    .content6, 
    .content7, 
    .sec-nav-container,
    .separator {
        max-width: 1600px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Kasvatetaan fonttikokoja, jotta ne vastaavat näytön kokoa */
    .main-txt-container h1 {
        font-size: 2.5rem; /* Alun perin 1.7rem */
    }

    .main-txt-container p {
        font-size: 1.4rem; /* Alun perin 1.1rem */
        line-height: 1.6;
    }

    .txt-container h1, 
    .side-text-stack h1, 
    .content7 h1 {
        font-size: 1.8rem;
    }

    .txt-container p, 
    .side-text-stack p {
        font-size: 1.2rem;
        line-height: 1.6;
    }

    /* Ankkurivalikon fontin ja välien kasvatus */
    .sec-nav-link {
        font-size: 1.1rem;
        letter-spacing: 2px;
    }

    .sec-nav-container {
        gap: 4rem;
    }

    /* Kuvakorttien hienosäätö */
    .img-card {
        border-radius: 12px; /* Hieman pehmeämpi kulma isolla ruudulla */
    }

    /* Sivupalkki-kuvan (Content 4) säädöt */
    .side-image img {
        box-shadow: 0 15px 45px rgba(0,0,0,0.15);
    }
}