/* --- PERUSASETUKSET --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: 'Lato', sans-serif;
    color: #fff;
    overflow-x: hidden;
}

/* --- TAUSTAKUVA --- */
.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2; 
    
    background-image: url('tausta.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Hidas zoom */
    animation: slowZoom 30s ease-in-out infinite alternate;
}

@keyframes slowZoom {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

/* --- LEVEYS --- */
.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.content-wrapper-wide {
    /* Sallitaan leveys jotta kaikki mahtuu alkuperäisessä koossa */
    width: 100%;
    max-width: 100%;
    padding: 20px;
}

/* --- HERO-OSIO --- */
.hero-section {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: 80px;
    padding-bottom: 40px;
    text-shadow: 0 4px 8px rgba(0,0,0,0.5);
    animation: contentEntrance 1.5s ease-out;
}

.image-container { margin-bottom: 30px; }

.profile-img {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 5px 25px rgba(0,0,0, 0.5);
    transition: transform 0.3s ease;
}

.profile-img:hover { transform: scale(1.05); }

.degrees {
    font-family: 'Lato', sans-serif;
    font-weight: 500;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 10px;
}

.roles {
    font-family: 'Playfair Display', serif;
    
    /* Tyylikkyys: Ohuempi paino (400) ja kursiivi (italic) */
    font-weight: 400;
    font-style: italic;
    
    /* Pienennetty koko (oli 3.2rem) */
    font-size: 2.2rem;
    
    /* Pakotetaan yhdelle riville */
    white-space: nowrap;
    
    line-height: 1.2;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.7);
}

@keyframes contentEntrance {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- VIIMEISIN TUOTANTO --- */
.production-section {
    padding: 20px 20px 80px 20px;
    text-align: center;
    animation: contentEntrance 1.5s ease-out 0.3s backwards;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 15px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.gradient-line {
    height: 4px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 50px auto;
    border-radius: 2px;
    background: linear-gradient(90deg, 
        rgba(75, 0, 130, 0) 0%,      
        rgba(75, 0, 130, 1) 15%,     
        rgba(255, 69, 0, 1) 35%,     
        rgba(255, 255, 0, 1) 50%,
        rgba(255, 69, 0, 1) 65%,     
        rgba(75, 0, 130, 1) 85%,     
        rgba(75, 0, 130, 0) 100%     
    );
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.5);
}

/* --- KIRJAGRID: KUVAT ALKUPERÄISESSÄ KOOSSA --- */
.book-grid {
    display: grid;
    
    /* auto = Sarake on juuri niin leveä kuin sisältö (kuva) vaatii.
       350px = Keskellä kiinteä tila auringolle.
    */
    grid-template-columns: auto auto 250px auto auto;
    
    justify-content: center;
    align-items: start;
    
    /* Väli kirjojen välissä (esim. kirja 1 ja 2) */
    gap: 50px; 
}

.spacer-col {
    width: 250px; 
    grid-column: 3;
}

/* Asemointi: Rivi 1 */
.book-1 { grid-column: 1; }
.book-2 { grid-column: 2; }
.book-3 { grid-column: 4; }
.book-4 { grid-column: 5; }

/* Asemointi: Rivi 2 */
.book-5 { grid-column: 1; }
.book-6 { grid-column: 2; }
.book-7 { grid-column: 4; }
.book-8 { grid-column: 5; }

.book-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    
    /* Poistettu kiinteät leveydet -> kortti on kuvan levyinen */
    width: max-content; 
}

.book-title {
    font-family: 'Lato', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    color: #fff;
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9);
}

.book-cover-container {
    /* Ei pakotettua leveyttä */
    display: flex;
    justify-content: center;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.5));
}

.book-cover {
    /* TÄRKEÄ: Nämä asetukset säilyttävät kuvan alkuperäisen koon */
    width: auto; 
    height: auto;
    display: block;
}

.book-cover-container:hover {
    transform: translateY(-10px);
}

/* --- RESPONSIIVISUUS --- */

/* Läppärit (alle 1450px) - Pienennetään vain keskiaukkoa */
@media (max-width: 1450px) {
    .book-grid {
        grid-template-columns: auto auto 150px auto auto;
    }
    .spacer-col { width: 150px; }
}

/* Tabletit (alle 1150px) - Muutetaan 2 riviin */
@media (max-width: 1150px) {
    .book-grid {
        /* Kaksi saraketta vierekkäin */
        grid-template-columns: 1fr 1fr; 
        gap: 40px;
        max-width: 600px;
        margin: 0 auto;
    }
    
    .spacer-col { display: none; }
    
    /* Nollataan sijainnit mobiilissa */
    .book-1, .book-2, .book-3, .book-4,
    .book-5, .book-6, .book-7, .book-8 { 
        grid-column: auto; 
    }
    
    .book-card { width: 100%; }
    .book-cover { width: auto; max-width: 100%; } /* Mobiilissa varmistetaan ettei mene yli */
}

/* Mobiili (alle 600px) */
@media (max-width: 600px) {
    .book-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .roles { 
        /* Pienennetty fonttikokoa (oli 1.4rem -> nyt 1.0rem), 
           jotta pitkä teksti mahtuu yhdelle riville. */
        font-size: 1.0rem; 
        
        /* Jos haluat, että teksti saa katketa kahdelle riville, 
           poista alla olevat kommenttimerkit (/* ja *\/): */
        
        /* white-space: normal; */
        /* line-height: 1.4; */
    }
}

/* --- JOUTSEN ANIMAATIO --- */
.swan-container {
    position: fixed;
    /* Lähtökohta: ruudun ulkopuolella vasemmalla */
    left: -400px; 
    /* Korkeus määritellään JS:ssä satunnaisesti */
    top: 15%; 
    
    width: 300px; 
    height: auto;
    
    z-index: 9999; 
    pointer-events: none;
    will-change: transform;
}

#swan-video {
    width: 100%;
    display: block;
    background: transparent;
    
    /* MIKROLIIKE: Kelluu pehmeästi ylös ja alas samalla kun JS liikuttaa konttia */
    animation: flightBob 3s ease-in-out infinite;
}

/* Avainkehykset joutsenen "kellumiselle" ilmassa */
@keyframes flightBob {
    0% { transform: translateY(0); }
    50% { transform: translateY(-40px); } /* Nousee vähän */
    100% { transform: translateY(0); }
}


/* --- MODAALI IKKUNA --- */
.modal-overlay {
    display: none; /* Oletuksena piilotettu */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000; /* Kaiken muun päällä */
    
    /* Taustan tummennus ja sumennus */
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px); /* Tämä sumentaa taustalla olevan sivun */
    -webkit-backdrop-filter: blur(8px); /* Safari-tuki */
    
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: #fff;
    color: #333;
    width: 90%;
    max-width: 500px;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0, 0.5);
    position: relative;
    
    /* Pieni nousu-efekti kun aukeaa */
    animation: slideUp 0.3s ease-out;
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #222;
}

.modal-text {
    font-family: 'Lato', sans-serif;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
    color: #444;
}

.modal-text a {
    color: #4b0082; /* Sama violetti kuin teemassa */
    font-weight: 700;
    text-decoration: underline;
}

.modal-close-btn {
    background-color: #4b0082;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-family: 'Lato', sans-serif;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-close-btn:hover {
    background-color: #6a0dad;
    transform: scale(1.05);
}

/* Animaatiot */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}