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

body {
    background-image: linear-gradient(180deg,rgba(42, 123, 155, 1) 0%, rgba(87, 199, 133, 1) 50%, rgba(237, 221, 83, 1) 100%);
    background-size: 100% 100vh;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;


    perspective: 1000px;
    transform-style:preserve-3d;
    pointer-events: none;

    --theme: theme1;
    container-type: normal;
}

body * {
    transform-style:preserve-3d;
}

header div:nth-of-type(1) {
    border: dotted 10px black;
    width: 100%;
    position: relative;
}


/* bron: gradiend op de tekst: https://stackoverflow.com/questions/8384751/css-text-gradient */
/* bron: tekst shadow: https://css-tricks.com/creating-playful-effects-with-css-text-shadows/ */
header div:nth-of-type(1) h1 {
    font-family: "oi", sans-serif;
    font-weight: 700;
    font-size: 4vw;
    line-height: 1.2em;
    text-align: center;
    background-image: linear-gradient(180deg,rgb(255, 0, 0) 20%, rgb(255, 255, 255) 50%, rgb(255, 0, 0) 70%);
    background-clip: text;
    -webkit-text-fill-color: transparent;

    animation: glow .5s ease-in-out infinite alternate;
}

@keyframes glow {
  0% {
    text-shadow:
      10px 10px 0px #ff6b6b,
      10px 10px 0px #fff36b,
      10px 10px 0px #ff9b42;
  }
  100% {
    text-shadow:
      0 0 0px #fff36b,
      0 0 0px #fff36b,
      0 0 0px #ff9b42;
  }
}

header div:nth-of-type(1) p {
    font-family: "Pacifico", sans-serif;
    font-size: 2.3vw;
    color: red;
    position: absolute;
    top: 0%;
    right: 68%;
    transform: rotate(-40deg);
}

main{
    /* display: flex;
    align-items: center; */
    display: grid;
    grid-template-columns: min(90vw, 800px);
    grid-template-rows: auto;

    justify-content: center;
    height: 60vh;
    width: fit-content;
    position: relative;

    rotate: y -20deg;
    pointer-events: none;
}

/* section met de draai wielen */
main section:nth-child(3) {
    grid-column: 1;
    align-self: center;
    grid-row: 1 / 3;

    display: flex;
    align-items: center;
    justify-content: center;

    /* perspective: 1000px; */
}

main section:nth-child(3) svg {
    width: 8vw;
    height: 8vh;
}

main section:nth-child(3) div > div {
    background-color: white;

    /* width: 200px;
    height: 200px; */

    width: min(25vw, 200px);
    height: min(25vw, 200px);

    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Cube maken */
main section:nth-child(3) > div{
    margin: 10px;

    /* width: 200px;
    height: 200px; */

    width: min(25vw, 200px);
    height: min(25vw, 200px);

    /* transform-style: preserve-3d; */
}


main section:nth-child(3) div div{
    margin: 0px;

    position: absolute;
    top: 0;
    left: 0;
    transform-origin: center center;
}

/* Oude versie :
main section:nth-child(3) div div:nth-child(1) {
    transform: translateZ(100px);
}

main section:nth-child(3) div div:nth-child(2) {
    transform: rotateY(180deg) translateZ(100px);
}

main section:nth-child(3) div div:nth-child(3) {
    transform: rotateX(90deg) translateZ(100px);
}

main section:nth-child(3) div div:nth-child(4) {
    transform: rotateX(-90deg) translateZ(100px);
}
*/


main section:nth-child(3) div div:nth-child(1) {
    transform: translateZ(calc(min(25vw, 200px) / 2));
}

main section:nth-child(3) div div:nth-child(2) {
    transform: rotateY(180deg) translateZ(calc(min(25vw, 200px) / 2));
}

main section:nth-child(3) div div:nth-child(3) {
    transform: rotateX(90deg) translateZ(calc(min(25vw, 200px) / 2));
}

main section:nth-child(3) div div:nth-child(4) {
    transform: rotateX(-90deg) translateZ(calc(min(25vw, 200px) / 2));
}

/* random met @function */
/* bron: https://codepen.io/enbee81/pen/wvOVypZ?editors=1100 */
/* bron: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@property */
@property --spin-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes spin-wheel {
  0% {
    --spin-angle: 0deg;
  }
  25% {
    --spin-angle: 90deg;
  }
  50% {
    --spin-angle: 180deg;
  }
  75% {
    --spin-angle: 270deg;
  }
  100% {
    --spin-angle: 360deg;
  }
}

/* draai annimatie */
body:has(input[name="spin"][value="spin"]:checked) main section:nth-child(3) > div:nth-child(1) {
  transform: rotateX(var(--spin-angle));
  animation: spin-wheel .1s linear infinite;
  transition: transform .6s cubic-bezier(.2,.9,.2,1);
}

body:has(input[name="spin"][value="spin"]:checked) main section:nth-child(3) > div:nth-child(2) {
  transform: rotateX(var(--spin-angle));
  animation: spin-wheel .05s linear infinite reverse;
  transition: transform .6s cubic-bezier(.2,.9,.2,1);
}

body:has(input[name="spin"][value="spin"]:checked) main section:nth-child(3) > div:nth-child(3) {
  transform: rotateX(var(--spin-angle));
  animation: spin-wheel .01s linear infinite;
  transition: transform .6s cubic-bezier(.2,.9,.2,1);
}

/* stop wielen */
body:has(footer #wheel1:checked) main section:nth-child(3) > div:nth-child(1) {
  animation-play-state: paused;
  transform: rotateX(round(var(--spin-angle), 90deg));
}

body:has(footer #wheel2:checked) main section:nth-child(3) > div:nth-child(2) {
  animation-play-state: paused;
  transform: rotateX(round(var(--spin-angle), 90deg));
}

body:has(footer #wheel3:checked) main section:nth-child(3) > div:nth-child(3) {
  animation-play-state: paused;
  transform: rotateX(round(var(--spin-angle), 90deg));
}

/* annimatie voor de hendel */
@keyframes hendel-spin {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(-45deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

body:has(input[name="spin"][value="spin"]:checked) main > section:nth-child(4) > div:nth-child(1){
    animation: hendel-spin .6s linear;
    
}


/* test annimatie */
    /* main section:nth-child(3) > div {
    animation: spin 5s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotateX(360deg) ;
    }
    100% {
        transform: rotateX(0deg);
    }
}   */


/* wheel 1 */
/* main section:nth-child(3) {
    container-type: inline-size;

    --rol1: 0;
    --rol2: 0;
    --rol3: 0;
} */

/* body:has(#spin-button:checked) main section:nth-child(3) { */
    /* wheels */
        /* --rol1: random(--rol1 element-shared, 8, 14, 1);
        --rol2: random(--rol2 element-shared, 8, 14, 1);
        --rol3: random(--rol3 element-shared, 8, 14, 1); */

        /* --rol1: 8;
        --rol2: 8;
        --rol3: 8; */
/* } */

/* main section:nth-child(3) > div:nth-child(1) {
    transform: rotateX(calc(var(--rol1) * 90deg));
    transition: transform 1.6s cubic-bezier(.2,.9,.2,1);
}

main section:nth-child(3) > div:nth-child(2) {
    transform: rotateX(calc(var(--rol2) * 90deg));
    transition: transform 1.6s cubic-bezier(.2,.9,.2,1);
}

main section:nth-child(3) > div:nth-child(3) {
    transform: rotateX(calc(var(--rol3) * 90deg));
    transition: transform 1.6s cubic-bezier(.2,.9,.2,1);
} */

/* style queries */
/* bron: https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Containment/Container_size_and_style_queries */
.jackpot {
    display: none;
}

/* @container style(--rol1: 8) and style(--rol2: 8) and style(--rol3: 8) {
  .jackpot {
        display: block;
    }
}

@container style(--rol1: 9) and style(--rol2: 9) and style(--rol3: 9) {
  .jackpot {
        display: block;
    }
}

@container style(--rol1: 10) and style(--rol2: 10) and style(--rol3: 10) {
  .jackpot {
        display: block;
    }
}

@container style(--rol1: 11) and style(--rol2: 11) and style(--rol3: 11) {
  .jackpot {
        display: block;
    }
}

@container style(--rol1: 12) and style(--rol2: 12) and style(--rol3: 12) {
  .jackpot {
        display: block;
    }
}

@container style(--rol1: 13) and style(--rol2: 13) and style(--rol3: 13) {
  .jackpot {
        display: block;
    }
}

@container style(--rol1: 14) and style(--rol2: 14) and style(--rol3: 14) {
  .jackpot {
        display: block;
    }
} */

/* random */
/* bron: https://webkit.org/blog/17285/rolling-the-dice-with-css-random/ */
/* @keyframes spin {
  from { transform: rotateX(0deg); }
  to {
    transform: rotateX(
      calc(
        random(8turn, 14turn, 1turn)
        + random(0deg, 270deg, 90deg)
      )
    );
  }
} */


/* section voor de kast */
/* scene */
main section:nth-child(1) {
    --w:min(90vw, 800px);
    --h:calc( var(--w) * .6 );
    --d:calc( var(--w) * .6 );

    /* perspective: 1000px; */
    position: absolute;
    
    /* width: 100%; */
    /* height: 100%; */
    width:var(--w);
    height:var(--h);

    grid-column: 1;
    align-self: center;
    grid-row: 1 / 3;

    display: flex;
    justify-content: center;
    align-items: center;
}

/* cube */
main section:nth-child(1) > div {
    /* transform-style: preserve-3d; */
    position: relative;

    /* width: 90%;
    max-width: 800px;
    height: 100%; */

    width:100%;
    height:100%;

    display:grid;

}

/* faces */
main section:nth-child(1) > div div {
    /* transform-style: preserve-3d; */
    /* position: absolute; */

    /* width: 100%; */
    /* height: 100%; */
    background-color: #0006;

    grid-area:1/1;
    
}

/* voor */
main section:nth-child(1) > div div:nth-child(1) {
    width:var(--w);
    height:var(--h);
}

/* acher */

/* bottom */
main section:nth-child(1) > div div:nth-child(3) {
    transform-origin: bottom;
    transform: rotateX(90deg);

    width:var(--w);
    height:var(--d);
}

/* top */
main section:nth-child(1) > div div:nth-child(4) {
    transform-origin: top;
    transform: rotateX(-90deg);

    width:var(--w);
    height:var(--d);
}

/* links */
main section:nth-child(1) > div div:nth-child(5) {
    transform-origin: left;
    transform: rotateY(90deg);

    width:var(--d);
    height:var(--h);
}

/* rechts */
main section:nth-child(1) > div div:nth-child(6) {
    transform-origin: right;
    transform: rotateY(-90deg);

    justify-self: end;

    width:var(--d);
    height:var(--h);

    /* anchor werkt niet goed met safari */
    /* anchor-name: --anchor-el; */
}


/* section voor de header */
header{
    width: 100vw;
    height: 20vh;
}

/* Section voor de knoppen */
footer {
    width: 100vw;
    height: 20vh;
}

/* section voor de hendel */

/* draai mechanisme */
main > section:nth-child(4) {
    /* background-color: black; */
    grid-area: 1 / 2;
    grid-column: 2;
    align-self: center;

    width: fit-content;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: start;

    /* anchor werkt niet goed met safari */
    /* position-anchor: --anchor-el;
    position: absolute;
    left: anchor(center);
    top: anchor(center);
    transform: translateY(-50%); */
}

main > section:nth-child(4) > div:nth-child(1) {
    width: min(6vw, 72px);
    height: 100%;

    display: flex;
    justify-content: center;
    align-items: end;
    align-self: end;

    transform-origin: bottom;
}

main > section:nth-child(4) > div:nth-child(1) > div:nth-of-type(-n + 6) {
    background-color: blue;
    width: min(6vw, 72px);
    height: min(6vw, 72px);

    position: absolute;

    /* voor en achter */
    /* &:nth-child(1) {
        
    }

    &:nth-child(2) {
        
    } */

    &:nth-child(3) {
        transform-origin: left;
        transform: rotateY(90deg);
    }

    &:nth-child(4) {
        transform-origin: right;
        transform: rotateY(-90deg);
        background-color: black;
    }

    &:nth-child(5) {
        transform-origin: top;
        transform: rotateX(-90deg);
        background-color: black;
    }

    &:nth-child(6) {
        transform-origin: bottom;
        transform: rotateX(90deg);
        background-color: black;
    }
}



/* Staaf */
main > section:nth-child(4) > div:nth-child(1) > div{
    display: flex;
    align-items: end;
    justify-content: center;

    height: var(--height);
    --width: min(2.5vw, 50px);
    --height: calc(var(--width) * 6);

    transform: translateZ(-2vw);
}

main > section:nth-child(4) > div:nth-child(1) > div > div:nth-of-type(-n + 6) {
    background-color: blue;
    /* width: 2.5vw;
    height: 25vh; */

    width: var(--width);
    height: var(--height);

    --width:min(2.5vw, 50px);
    --height:calc( var(--width) * 6 );
    --diep:calc( var(--width) * 1 );

    position: absolute;

    /* voor en achter */
    /* &:nth-child(1) {
        
    }

    &:nth-child(2) {
        
    } */

    &:nth-child(3) {
        transform-origin: left;
        transform: rotateY(90deg);


    }

    &:nth-child(4) {
        transform-origin: right;
        transform: rotateY(-90deg);
        background-color: black;


    }

    &:nth-child(5) {
        transform-origin: bottom;
        transform: rotateX(90deg) translateZ(calc(var(--height)* 1));
        
        background-color: black;
        height: var(--diep);
    }

    &:nth-child(6) {
        transform-origin: bottom;
        transform: rotateX(90deg);
        background-color: black;

        height: var(--diep);
    }
}

/* hendel knop */
main > section:nth-child(4) div:last-of-type > div:last-of-type > div:last-of-type {
    width: 3vw;
    height: 3vh;
    align-self: start;

    display: flex;
    justify-content: center;
    align-items: center;
}

main > section:nth-child(4) input {
    display: none;

}

main > section:nth-child(4) label {
    position: absolute;
    width: 3vw;
    height: 3vh;
    background-color: blueviolet;
    pointer-events: auto;
}

main > section:nth-child(4) {

    label:nth-of-type(1) {
        transform: rotateY(90deg);
        transform-origin: left;
    }

    label:nth-of-type(2) {
        transform: rotateY(-90deg);
        transform-origin: right;
    }

    label:nth-of-type(3) {
        transform: rotateX(-90deg);
        transform-origin: top;
    }

    label:nth-of-type(3) {
        transform: rotateX(90deg);
        transform-origin: bottom;
    }

}

/* win conditie */
/* body:has(input[name="wheel-1"][value="0"]:checked)
    :has(input[name="wheel-2"][value="0"]:checked)
    :has(input[name="wheel-3"][value="0"]:checked) {
    
    background-color: red;
  
} */

/* buttons om de annimatie te stoppen */
/* bron: https://www.bestcssbuttongenerator.com/#/18 */
footer{
    pointer-events: none;
    width: min(90vw, 800px);
    rotate: y -20deg;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

form div {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    width: 100%;

    &label:nth-of-type(1) {
        grid-column: 1;
        grid-row: 1;
    }

    &label:nth-of-type(1) {
        grid-column: 1;
        grid-row: 2;
    }

    &label:nth-of-type(1) {
        grid-column: 1;
        grid-row: 3;
    }
}



form input {
    display: none;
}

form label {
    box-shadow: 3px 4px 0px 0px #8a2a21;
	background:linear-gradient(to bottom, #c62d1f 5%, #f24437 100%);
	background-color:#c62d1f;
	border-radius:18px;
	border:1px solid #d02718;
	display:inline-block;
	cursor:pointer;
	color:#ffffff;
	font-family:Arial;
	font-size:16px;
	padding:7px 25px;
	text-decoration:none;
	text-shadow:0px 1px 0px #810e05;

    pointer-events: auto;

    &:hover {
        background: linear-gradient(to bottom, #f24437 5%, #c62d1f 100%);
	    background-color:#f24437;
    }

    &:active {
        position:relative;
	    top:1px;
        transform: scale(0.9);
    }

    &::selection {
        opacity: 0;
    }
}

form label {
    display: none;
}

body:has(input[name="spin"][value="spin"]:checked) form div label{
    display: block;
    width: 15vw;
}

body:has(input[name="stop1"][value="stop1"]:checked) form div label:nth-of-type(1),
body:has(input[name="stop2"][value="stop2"]:checked) form div label:nth-of-type(2),
body:has(input[name="stop3"][value="stop3"]:checked) form div label:nth-of-type(3) {
    opacity: 0%;
}

body:has(input[name="stop1"][value="stop1"]:checked):has(input[name="stop2"][value="stop2"]:checked):has(input[name="stop3"][value="stop3"]:checked) form > label {
    display: block;
    width: 15vw;
    align-self: center;
}

/* thema */
@container style(--theme: theme2) {

    svg {
        display: none;
    }

    main section:nth-child(3) div div:nth-child(1) {
        background-image: url('Image/lambo.gif');
        background-position: center;
        background-size: cover;
    }

    main section:nth-child(3) div div:nth-child(2) {
        background-image: url('Image/win.gif');
        background-position: center;
        background-size: cover;
    }

    main section:nth-child(3) div div:nth-child(3) {
        background-image: url('Image/stack.gif');
        background-position: center;
        background-size: cover;
    }

    main section:nth-child(3) div div:nth-child(4) {
        background-image: url('Image/pepsi.gif');
        background-position: center;
        background-size: cover;
    }
}

header input {
    pointer-events: auto;
}

body:has(input[name="thema-wijzigen"]:checked) {
    --theme: theme2;
    background-image: url('Image/geld.gif');
}
