@font-face {
    font-family: "Marmelad";
    src: url("fonts/marmeladregular.ttf") format("truetype");
}

@font-face {
    font-family: "Varela";
    src: url("fonts/varelaroundregular.ttf") format("truetype");
}

:root {
    --moodikoko: 50px;
    --opipelaakoko: 50px;
    --navikuvakork: 50px;

    /* Tekijät rivin korkeus */
    --tkorkeus: 30px;

    /* Leikkikentän korkeus vähennettynä tekijät-rivin korkeudella */
    --lkkorkeus: calc(100vh - var(--tkorkeus));
    
    --sanankoko: 24px;
    --pointteritop: 0px;
    --pointterileft: 0px;

    --vk: 0;
}

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

html {
    display: grid;
    min-height: 100%;
}

body {
    display: grid;
    grid-template-rows: 1fr 30px;
    background-color: #257cbf;
    grid-template-areas:
        "flex_leikkikentta"
        "alapalkki";
}

.flex_leikkikentta {
    grid-area: flex_leikkikentta;
    display: flex;
    justify-content: center;
    align-items: center;
}

#lb_x_overlay {
    position: fixed;
    display: flex;
    z-index: 2000;
    background-color: rgba(0, 0, 0, .75);
    cursor: pointer;
    width: 100vw;
    height: 100vh;
    justify-content: center;
    align-items: center;
    /* display: none; */
}

#lb_x {
    width: 95%;
    aspect-ratio: 10 / 9.6;
    max-width: 960px;
    max-height: 720px;
    max-height: 95%;
    position: relative;
    z-index: 2001;
}

#lb_x1 {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: calc(100% - 85px);
}

#lb_x_video {
    position: absolute;
    z-index: 3000;
    width: 100%;
    height: 100%;
}

#lb_x2 {
    color: #fff;
    font-family: Marmelad, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    width: 100%;
}

.lb_x2_x {
    position: relative;
    padding: 5px;
}

#lb_x2_texti {
    margin-right: 10px;
}

#lb_x2_kuva img {
    height: 100%;
    /* width: 100%; */
    max-height: 75px;
    vertical-align: middle;
}

#lb_overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    background-color: rgba(0, 0, 0, .75);
    cursor: pointer;
    width: 100vw;
    height: 100vh;
    justify-content: center;
    align-items: center;
}

#lb {
    text-align: center;
    color: #fff;
    font-family: Marmelad, sans-serif;
}

#lb h3 {
    margin-bottom: 1em;
}

#lb a {
    text-decoration: none;
    color: #fff;
}

#lb a:hover {
    text-decoration: underline;
}

.block_leikkikentta {
    width: 100vw;
    height: 100%;
}

.gridi_leikkikentta {
    padding: 5px;
    grid-area: gridi_leikkikentta;
    height: 100%;
    width: 100%;
    display: grid;
    gap: 5px;
}

#pointteri {
    position: absolute;
    display: none;
    opacity: 0;
    width: var(--navikuvakork);
    z-index: 4000;
    top: var(--pointteritop);
    left: var(--pointterileft);
}

#alapalkki {
    grid-area: alapalkki;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-family: Marmelad, serif;
    padding: 5px;
}

#musiikki, #pelintekijat, #appi, #appi_b {
    cursor: pointer;
}

#appi {
    display: none;
}

#appi_b {
    color:#257cbf;
    background-color: #fff;
    border: none;
    border-radius: 5px;
    padding: 3px;
    font-weight: bolder;
}

#leikkikentta {
    position: relative;
    /* Pakko olla että .moodi on oikeassa paikassa */
    grid-area: leikkikentta;
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 10px;
    overflow: hidden;
}

.a_eteinen {
    background-image: url("../kuvat/taustakuvat/eteinen.jpg");
}

.a_abc {
    background-image: url("../kuvat/taustakuvat/abc.jpg");
}

.a_abcvanhat {
    background-image: url("../kuvat/taustakuvat/abcvanhat.jpg");
}

.a_keittio {
    background-image: url("../kuvat/taustakuvat/keittio.jpg");
}

.a_lastenhuone {
    background-image: url("../kuvat/taustakuvat/lastenhuone.jpg");
}

.a_leikkihuone {
    background-image: url("../kuvat/taustakuvat/leikkihuone.jpg");
}

.a_piha {
    background-image: url("../kuvat/taustakuvat/piha.jpg");
}

.a_vaatehuone {
    background-image: url("../kuvat/taustakuvat/vaatehuone.jpg");
}

#leikkikentta #moodi2 {
    display: none;
    background-color: #257cbf;
    border-bottom-left-radius: 10px;
    position: absolute;
    right: 0;
    width: var(--moodikoko);
    height: var(--moodikoko);
    justify-content: center;
    align-items: center;
    padding: 5px;
    cursor: pointer;
}

.leikkikenttakuva {
    z-index: 900;
    cursor: pointer;
    position: absolute;
}

#piha_hiekkalaatikko,
#piha_aurinko,
#piha_aita,
#piha_keinu,
#piha_kolmipyora,
#leikkihuone_ovi,
#leikkihuone_matto,
#leikkihuone_liikennematto,
#leikkihuone_poyta,
#leikkihuone_lipasto,
#leikkihuone_kaappi,
#keittio_kulho,
#keittio_tabletti,
#keittio_servetti,
#keittio_broileri,
#keittio_lautanen,
#keittio_syvalautanen,
#eteinen_sadevaatteet,
#lastenhuone_verhot {
    z-index: 1;
}

#leikkihuone_keinuhevonen,
#keittio_pizza,
#keittio_veitsi,
#keittio_tomaatti {
    z-index: 500;
}

#teema_x {
    grid-area: teema_x;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "teema moodi";
}

#teema {
    grid-area: teema;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 5px;
}

.b_hide {
    display: none;
}

#ve_ruudut {
    overflow: hidden;
    padding: 5px;
    display: flex;
    align-items: center;
    width: 100%;
}

#ve_ruudut #kuvan_nimi {
    width: 100%;
    text-align: center;
    font-family: Varela;
    font-weight: bolder;
    font-size: var(--sanankoko);
    color: #fff;
    white-space: nowrap;
    margin-top: 3px;
}

#teema .navi_kuvat,
#ve_ruudut .ve_kuva {
    height: var(--navikuvakork);
    max-width: 100%;
    cursor: pointer;
}

#teema .splide,
#ve_ruudut .splide {
    padding: 0 45px;
    height: calc(100% + 0px);
}

#ve_ruudut .splide {
    height: unset;
}

#moodi {
    grid-area: moodi;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px;
    cursor: pointer;
}

#moodi #opipelaa {
    height: var(--navikuvakork);
}

#viteo {
    grid-area: viteo;
    background-color: rgb(233, 233, 233);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

#v_moi {
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

#video_play {
    display: none;
    position: absolute;
    bottom: 5px;
    right: 5px;
    cursor: pointer;
}

#video_play_img {
    /* width: 100%; */
    height: 100%;
    max-height: 75px;
}

.kuvat {
    grid-area: kuvat;
    border-radius: 10px;
    background-color: rgb(139, 188, 35);
    border: .2em solid white;
}

.splide__arrow--prev {
    left: 0;
    background-image: url("../kuvat/muut/nuoli_vasen.svg");
}

.splide__arrow--next {
    right: 0;
    background-image: url("../kuvat/muut/nuoli_oikea.svg");
}

.splide__arrow {
    background-size: contain;
    background-repeat: no-repeat;
    width: 40px;
    height: 40px;
    background-color: transparent;
    border: 0;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

/* KÄNNY PYSTY */
@media (max-aspect-ratio: 10/16) {

    .block_leikkikentta {
        max-height: calc((100vw) * 16 / 9);
        max-width: calc(var(--lkkorkeus) * 9 / 16);
        aspect-ratio: 9 / 16;
    }

    .gridi_leikkikentta {
        grid-template-rows: .5fr 2.1fr 1.7fr .65fr;
        grid-template-areas:
            "teema_x"
            "leikkikentta"
            "viteo"
            "kuvat";
    }

    #lb_x1 {
        max-height: calc(100% - 65px);
    }

    #lb_x2 {
        flex-direction: column;
        padding-top: unset;
    }

    #lb_x2_texti {
        margin-right: unset;
        font-size: 40px;
    }

    #lb_x2_kuva img {
        height: 60px;
    }

    #video_play_img {
        max-height: 50px;
    }

}

/* TABLETTI PYSTY */
@media (min-aspect-ratio: 10/16) and (max-aspect-ratio: 1/1) {
    .block_leikkikentta {
        max-height: calc((100vw) * 4 / 3);
        max-width: calc(var(--lkkorkeus) * 3 / 4);
        aspect-ratio: 3 / 4;
    }

    .gridi_leikkikentta {
        grid-template-rows: .8fr 6fr 4.5fr 1.3fr;
        grid-template-areas:
            "teema_x"
            "leikkikentta"
            "viteo"
            "kuvat";
        justify-items: center;
    }

    #leikkikentta {
        height: 100%;
        /* width: 100%; */
        /* max-width: 300px; */
        aspect-ratio: 4 / 3;
    }

    #viteo {
        max-width: calc(var(--vk) * 16 / 9);
        /* aspect-ratio: 16 / 9; */
    }

}

/* TABLETTI VAAKA */
@media (min-aspect-ratio: 1/1) and (max-aspect-ratio: 16/11) {

    .block_leikkikentta {
        max-height: calc((100vw) * 3 / 4);
        max-width: calc(var(--lkkorkeus) * 4 / 3);
        aspect-ratio: 4 / 3;
    }

    .gridi_leikkikentta {
        grid-template-rows: 2.5fr 10fr 3fr;
        grid-template-columns: 3.4fr 6fr;
        grid-template-areas:
            "teema_x teema_x"
            "viteo leikkikentta"
            "kuvat kuvat";
    }
}

/* KÄNNY VAAKA */
@media (min-aspect-ratio: 16/11) {
    .block_leikkikentta {
        max-height: calc((100vw) * 9 / 16);
        max-width: calc(var(--lkkorkeus) * 16 / 9);
        aspect-ratio: 16 / 9;
    }

    .gridi_leikkikentta {
        grid-template-rows: 1.3fr 10fr 2fr;
        grid-template-columns: 8.75fr 15fr;
        grid-template-areas:
            "teema_x leikkikentta"
            "viteo leikkikentta"
            "kuvat kuvat";
    }

    #leikkikentta #moodi2 {
        display: flex;
        width: calc(var(--moodikoko) + 5px);
        height: calc(var(--moodikoko) + 5px);
    }

    #moodi {
        display: none;
    }

}

@media (min-aspect-ratio: 16/11) and (max-height: 500px) {
    #video_play_img {
        max-height: 50px;
    }
}
