@import url(./colors.css);
@import url(./fonts.css);
@import url(./algemenestyling.css);
@import url(./cookiepopup.css);

/* ==================================================
   MARK: Heading
   ================================================== */
header {
    display: grid;
    background: url(../images/starwarsthemebg.jpeg);
    background-repeat: no-repeat;
    background-size: cover;
    min-height: 50rem;
    position: relative;
    z-index: 300;

    @media (max-width: 1000px) {}

    @media (max-width: 500px) {
        opacity: 0.9;
        place-content: center;
        min-height: 20rem;
    }

    &>a:nth-of-type(1) {
        position: absolute;
        top: 1rem;
        left: -9999px;
        z-index: 100;
        padding: .5em;
        margin: .5em;
        font-weight: bold;
        background-color: var(--starwars-yellow);
        color: var(--text-color);
        outline-color: var(--gradient-black-overlay);

        &:focus-visible {
            left: 1rem;
        }
    }

    nav {
        position: relative;
        top: 2.5rem;
        display: flex;
        justify-content: space-around;
        align-self: start;
        width: 100%;
        grid-area: 1/1;
        z-index: 200;

        @media (max-width: 500px) {
            position: fixed;
            top: auto;
            bottom: 0;
            left: 0;
            width: 100%;
            z-index: 200;
        }
    }

    /* Lightsaber navigatiebalk */
    ul {
        margin: 0;
        padding: 0;
        background: linear-gradient(to right,
                var(--lightsaber-lightgrey) 0% 30%,
                var(--lightsaber-light-blue) 30% 100%);
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        align-items: center;
        justify-content: center;
        place-content: center;

        list-style: none;
        width: 80%;
        height: 6rem;
        text-align: center;

        border-radius: 5rem 10rem 10rem 5rem;
        color: var(--text-color);

        box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px;

        @media (max-width: 500px) {
            position: fixed;
            bottom: 2%;
            width: 95%;
            border-radius: 3rem;
            grid-template-columns: repeat(3, 1fr);
            height: 5rem;
            background: linear-gradient(to right,
                    var(--lightsaber-grey) 0% 30%,
                    var(--lightsaber-light-blue) 30% 100%);
        }
    }

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

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

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

    li a {
        font-size: var(--h3);
        color: var(--text-color);
        text-decoration: none;
        font-family: "Montserrat";

        @media (max-width: 500px) {
            display: grid;
            font-size: var(--p-disappear);
            justify-content: center;
            place-content: center;
            align-content: center;
            gap: 0.2rem;
        }
    }

    nav li:nth-of-type(1) a img,
    nav li:nth-of-type(2) a img,
    nav li:nth-of-type(3) a img {
        display: none;

        @media (max-width: 500px) {
            display: block;
            width: 5rem;
            height: 5rem;
            object-fit: contain;
            mix-blend-mode: normal;
            opacity: 1;
        }
    }

    a:focus-visible {
        outline: 3px solid var(--starwars-yellow);
        outline-offset: 5px;
    }

    /* ==================================================
   MARK: Smooth Dark/Light Mode Switch (Dev.to techniek)
   ================================================== */

    #theme-toggle {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
        pointer-events: none;
    }

    li>label[for="theme-toggle"] {
        position: relative;
        display: inline-block;
        width: 3.2rem;
        height: 1.6rem;
        background-color: var(--lightsaber-grey);
        border: 2px solid var(--starwars-yellow);
        border-radius: 2rem;
        cursor: pointer;
        transition: background-color 0.3s ease, border-color 0.3s ease;

        @media (max-width: 500px) {
            display: none;
        }
    }

    li>label[for="theme-toggle"]::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 2px;
        transform: translateY(-50%);
        width: 1.1rem;
        height: 1.1rem;
        background-color: var(--starwars-yellow);
        border-radius: 50%;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;

        @media (max-width: 500px) {
            width: 0.9rem;
            height: 0.9rem;
            left: 2px;
        }
    }

    #theme-toggle:checked+label[for="theme-toggle"] {
        background-color: var(--black-color);
        border-color: var(--lightsaber-red);
    }

    #theme-toggle:checked+label[for="theme-toggle"]::before {
        transform: translateY(-50%) translateX(1.5rem);
        background-color: var(--lightsaber-red);

        @media (max-width: 500px) {
            transform: translateY(-50%) translateX(1.2rem);
        }
    }

    #theme-toggle:focus-visible+label[for="theme-toggle"] {
        outline: 2px solid var(--starwars-yellow);
        outline-offset: 4px;
    }

    &>picture {
        grid-column: 1;
        grid-row: 1;
        display: block;
        width: 85%;
        max-width: 32rem;
        justify-self: start;
        align-self: end;
        rotate: 5deg;
        z-index: 2;
        padding-top: 15%;

        img {
            width: 100%;
            height: auto;
            display: block;
            object-fit: contain;
        }

        @media (max-width: 1000px) {
            width: 70%;
            rotate: 3deg;
        }

        @media (max-width: 500px) {
            margin-top: -10rem;
            grid-column: 1;
            grid-row: 2;
            width: 75%;
            max-width: 250px;
            justify-self: flex-start;
            rotate: 25deg;
        }
    }

    &>section {
        grid-column: 2;
        grid-row: 1;
        z-index: 2;
        justify-self: center;
        align-self: center;
        max-width: 38rem;
        text-align: left;
        background-color: var(--black-color) 0.9;

        h1 {
            font-family: 'Deathstar', sans-serif;
            font-size: var(--h1);
            letter-spacing: 0.3rem;
            margin-bottom: 1.5rem;
            line-height: 1.2;
            opacity: 1;

            @media (max-width: 1000px) {
                font-size: var(--h2);
                letter-spacing: 0.2rem;
            }
        }

        p {
            font-family: 'Montserrat', sans-serif;
            font-size: var(--p);
            line-height: 1.6;
            opacity: 1;
        }

        @media (max-width: 500px) {
            grid-column: 1;
            grid-row: 1;
            text-align: center;
            margin-top: 2rem;
            background-color: var(--black-color) 0.9;

            h1,
            p {
                text-align: center;
            }
        }
    }

    &>div {
        position: absolute;
        z-index: 1;
        width: clamp(2.5rem, 5vw, 4.5rem);
        pointer-events: none;
        transform-origin: top center;

        img {
            width: 100%;
            height: auto;
            display: block;
            transform: translateY(0px);
            animation: float 6s ease-in-out infinite;

            @media (prefers-reduced-motion: reduce) {
                animation: none;
            }
        }

        @media (max-width: 1000px) {
            width: clamp(2rem, 4vw, 3rem);
        }

        @media (max-width: 500px) {
            width: 2.2rem;
            opacity: 0.75;
        }
    }

    /* 1. Zwart */
    &>div:nth-of-type(1) {
        top: 20%;
        left: 3%;
        width: 12.3rem;
        height: 22.3rem;
        transform: rotate(277deg);

        img {
            filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.8));
        }

        @media (max-width: 1000px) {
            scale: 0.7;

        }

        @media (max-width: 500px) {
            scale: 0.45;
            top: 5%;
            left: 2%;
        }
    }

    /* 2. Rood */
    &>div:nth-of-type(2) {
        top: 48%;
        right: 10%;
        width: 17.1rem;
        height: 31rem;
        transform: rotate(-25deg);

        img {
            filter: drop-shadow(0 0 5px var(--lightsaber-red));
        }

        @media (max-width: 1000px) {
            scale: 0.7;
            top: 5%;
            right: 3%;
        }

        @media (max-width: 500px) {
            scale: 0.45;
        }
    }

    /* 3. Wit */
    &>div:nth-of-type(3) {
        top: 85%;
        left: 75%;
        width: 9rem;
        height: 16.3rem;
        transform: rotate(40deg);

        img {
            filter: drop-shadow(0 0 5px rgba(53, 51, 51, 0.9));
        }

        @media (max-width: 1000px) {
            scale: 0.7;
            top: 50%;
            left: 58%;
        }

        @media (max-width: 500px) {
            scale: 0.45;
            left: 5%;
            top: 20%;
        }
    }

    /* 4. Paars */
    &>div:nth-of-type(4) {
        top: 1%;
        left: 55%;
        width: 25rem;
        height: 29rem;
        transform: rotate(31deg);

        img {
            filter: drop-shadow(0 0 5px #b026ff);
        }

        @media (max-width: 1000px) {
            scale: 0.7;
            top: 1%;
            left: 50%;
            display:none;
        }

        @media (max-width: 500px) {
            scale: 0.45;
            left: 62%;
            top: 2%;
            display:none;
        }
    }

    /* 5. Geel */
    &>div:nth-of-type(5) {
        top: 65%;
        left: 30%;
        width: 10.5rem;
        height: 19rem;
        transform: rotate(24deg);

        img {
            filter: drop-shadow(0 0 5px var(--starwars-yellow, #FFE81F));
        }

        @media (max-width: 1000px) {
            scale: 0.7;
            top: 56%;
            left: 28%;
        }

        @media (max-width: 500px) {
            scale: 0.45;
            left: 12%;
            top: 56%;
        }
    }

    /* 6. Oranje */
    &>div:nth-of-type(6) {
        top: 25%;
        left: 35%;
        width: 6.5rem;
        height: 11.8rem;
        transform: rotate(-46deg);

        img {
            filter: drop-shadow(0 0 5px #ff7700);
        }

        @media (max-width: 1000px) {
            scale: 0.7;
            top: 18%;
            left: 36%;
        }

        @media (max-width: 500px) {
            scale: 0.45;
            left: 8%;
            top: 12%;
        }
    }

    /* 7. Groen */
    &>div:nth-of-type(7) {
        top: 10%;
        right: 8%;
        width: 12.4rem;
        height: 22.3rem;

        img {
            filter: drop-shadow(0 0 5px #22c55e);
        }

        @media (max-width: 1000px) {
            scale: 0.7;
            top: 2%;
            right: 4%;
        }

        @media (max-width: 500px) {
            scale: 0.45;
            top: 10%;
            left: 5%;
        }
    }

    /* 8. Blauw */
    &>div:nth-of-type(8) {
        top: 75%;
        left: 40%;
        width: 9rem;
        height: 16.3rem;
        transform: rotate(-117deg);

        img {
            filter: drop-shadow(0 0 5px var(--lightsaber-light-blue, #15F2FD));
        }

        @media (max-width: 1000px) {
            scale: 0.7;
            top: 36%;
            left: 44%;
        }

        @media (max-width: 500px) {
            scale: 0.45;
            top: 42%;
            left: 70%;
            display: none;
        }
    }
}



header>section {
    grid-area: 1 / 1;
    justify-self: end;
    align-self: center;
    width: 40%;
    margin-right: 5%;
    margin-top: 5rem;

    @media (max-width: 1000px) {
        width: 70%;
        margin-right: 5%;
    }

    @media (max-width: 500px) {
        justify-self: center;
        position: relative;
        align-self: end;
        width: 90%;
        margin: 10rem auto 4rem auto;
        text-align: left;
    }
}

section section {
    display: grid;
    gap: 1rem;
}

section h1::before,
section h1 {
    font-family: 'Deathstar';
    letter-spacing: 0.5rem;
    font-size: var(--h1);
}

section p::before,
section p {
    font-family: "Montserrat";
    font-size: var(--p);
}

/**************************
* MARK: main
**************************/
main {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    padding: 4rem 2rem;

    @media(max-width:500px) {
        padding: 2rem 3rem;
        gap: 3rem;
    }
}

main>section:first-of-type {
    background-color: var(--grey-color);
    border: 5px solid var(--starwars-yellow);
    border-radius: 1.5rem;
    padding: 3rem;
    width: min(90%, 80rem);
    color: var(--bg-color);

    @media (max-width: 500px) {
        padding: 2rem 1.5rem;
        width: 120%;
        border-radius: 1rem;
    }
}

main>section:first-of-type>h2 {
    font-family: 'Deathstar', sans-serif;
    font-size: var(--h2);
    letter-spacing: 0.5rem;
    color: var(--bg-color);
}

main>section:first-of-type>p {
    padding-top: 2.5rem;
    font-family: 'Montserrat', sans-serif;
    font-size: var(--p);
    color: var(--bg-color);
    line-height: 1.7;
}

#history-extra[hidden] {
    display: none;
}

#history-extra>p {
    font-family: 'Montserrat', sans-serif;
    font-size: var(--p);
    line-height: 1.7;
    color: var(--bg-color);
    margin-top: 1.5rem;
}

#history-knop {
    background-color: var(--black-color);
    color: var(--starwars-yellow);
    width: 30rem;
    height: 5rem;
    border: none;
    cursor: pointer;

    position: relative;
    z-index: 1;

    display: grid;
    place-items: center;
    border-radius: 2.5rem;

    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: var(--p);
    text-align: center;
    text-transform: uppercase;

    &:focus-visible {
        outline: 3px solid var(--starwars-yellow);
        outline-offset: 5px;
    }

    @media (max-width: 500px) {
        width: 15rem;
        height: 5rem;
    }

    @media (max-width: 1000px) {
        width: 15rem;
        height: 5rem;
    }
}

#history-knop::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
    background: linear-gradient(to right,
            var(--lightsaber-red) 25%,
            var(--lightsaber-light-blue),
            var(--lightsaber-blue),
            var(--lightsaber-red));
    background-size: 400%;
    border-radius: inherit;
    z-index: -2;
    filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    animation: rotate 15s linear infinite;

    @media (prefers-reduced-motion: reduce) {
        animation: none;
        transition: none;
    }

    @media (max-width: 500px) {
        content: '';
        position: absolute;
        width: 16rem;
        height: 6rem;
        animation: rotate 15s linear infinite;
    }

    @media (max-width: 1000px) {
        content: '';
        position: absolute;
        width: 16rem;
        height: 6rem;
        animation: rotate 15s linear infinite;
    }
}

#history-knop::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--black-color);
    border-radius: inherit;
    z-index: -1;
}

#history-knop:hover::before,
#history-knop:focus::before,
#history-knop:active::before {
    opacity: 1;
}

@keyframes rotate {
    0% {
        background-position: 0 0;
    }

    50% {
        background-position: 400% 0;
    }

    100% {
        background-position: 0 0;
    }
}

/**************************
* MARK: main section2
**************************/
main>section:nth-of-type(2) {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    padding: 2rem;
    overflow-x: clip;

    @media(max-width:500px) {
        padding: 1rem;
    }
}

main>section:nth-of-type(2)>h2 {
    font-family: 'Deathstar', sans-serif;
    font-size: var(--h1);
    letter-spacing: 0.5rem;
    text-align: center;
    color: var(--text-color);

    @media (max-width: 500px) {
        font-size: var(--h2);
        letter-spacing: 0.3rem;
    }
}

main>section:nth-of-type(2)>p {
    font-family: 'Montserrat', sans-serif;
    font-size: var(--p);
    text-align: center;
    max-width: 30rem;
    line-height: 1.6;
}

main>section:nth-of-type(2)>section:first-of-type {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 3rem 0;
    position: relative;
}

#lightsaber-toggle {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    width: 20rem;
    padding: 0;

    @media (max-width: 500px) {
        width: 14rem;
    }

    &:focus-visible {
        outline: 3px solid var(--starwars-yellow);
        outline-offset: 6px;
        border-radius: 0.5rem;
    }
}

#lightsaber-toggle>img {
    width: 100%;
    height: auto;
    display: block;
}

#lightsaber-toggle::after {
    content: '';
    position: absolute;
    left: 99%;
    top: 50%;
    width: 50rem;
    height: 1.8rem;
    background: var(--blade-core);
    border-radius: 0 30px 30px 0;
    box-shadow:
        0 0 4px var(--blade-core),
        0 0 10px var(--blade-color),
        0 0 25px var(--blade-color),
        0 0 45px var(--blade-glow);
    transform: translateY(-50%) scaleX(0);
    transform-origin: left center;
    transition: transform 0.4s cubic-bezier(0.1, 0.8, 0.2, 1);
    pointer-events: none;

    @media (max-width: 500px) {
        width: 30rem;
        height: 1.2rem;
    }
}

#lightsaber-toggle[aria-pressed="true"]::after {
    transform: translateY(-50%) scaleX(1);
    animation: blade-pulse 1.5s infinite alternate ease-in-out;
}

@keyframes blade-pulse {
    0% {
        box-shadow:
            0 0 4px var(--blade-core),
            0 0 10px var(--blade-color),
            0 0 25px var(--blade-color),
            0 0 40px var(--blade-glow);
    }

    100% {
        box-shadow:
            0 0 6px var(--blade-core),
            0 0 16px var(--blade-color),
            0 0 35px var(--blade-color),
            0 0 60px var(--blade-glow);
    }
}

main>section:nth-of-type(2)>section:nth-of-type(2) {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

main>section:nth-of-type(2)>section:nth-of-type(2)>section {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1.5rem;
    justify-items: center;

    @media (max-width: 1000px) {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    @media (max-width: 500px) {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
}

button[data-color] {
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease;

    &:hover {
        transform: scale(1.15);
    }

    &:focus-visible {
        outline: 3px solid var(--starwars-yellow);
        outline-offset: 4px;
        border-radius: 0.5rem;
    }
}

button[data-color]>img {
    width: 5rem;
    height: auto;
    display: block;
    object-fit: contain;
    transition: filter 0.3s ease, transform 0.3s ease;

    @media (max-width: 500px) {
        width: 4rem;
    }
}

button[data-color][aria-pressed="true"]>img {
    transform: scale(1.1);
    filter: brightness(1.3) drop-shadow(0 0 8px currentColor);
}

@media (prefers-reduced-motion: reduce) {
    #lightsaber-toggle::after {
        transition: none;
        animation: none;
    }

    button[data-color] {
        transition: none;
    }

    button[data-color]>img {
        transition: none;
    }
}

/**************************
* MARK: footer
**************************/

footer {
    background-color: var(--black-color);
    color: #f0f0f0;
    border-top: 3px solid var(--starwars-yellow);
    padding: 4rem 2rem 3rem 2rem;

    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2.5rem;
    width: 100%;
    position: relative;
    z-index: 1;

    @media (max-width: 500px) {
        padding-bottom: 9rem;
        gap: 2rem;
    }

    h2 {
        font-family: 'Deathstar', sans-serif;
        font-size: var(--h3);
        color: var(--starwars-yellow);
        letter-spacing: 0.2rem;
        margin-bottom: 0.5rem;
    }

    p {
        font-family: 'Montserrat', sans-serif;
        font-size: 0.95rem;
        max-width: 40rem;
        line-height: 1.6;
        color: #cccccc;
    }

    nav ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
        list-style: none;
        background: none;
        box-shadow: none;
        height: auto;
        width: auto;
        border-radius: 0;

        @media (max-width: 500px) {
            flex-direction: column;
            gap: 1rem;
            position: static;
            background: none;
            height: auto;
        }
    }

    nav li a {
        font-family: 'Montserrat', sans-serif;
        font-size: 0.95rem;
        color: var(--starwars-yellow);
        text-decoration: none;
        transition: opacity 0.2s ease, text-shadow 0.2s ease;

        &:hover {
            text-decoration: underline;
            text-shadow: 0 0 8px var(--starwars-yellow);
        }

        &:focus-visible {
            outline: 2px solid var(--starwars-yellow);
            outline-offset: 4px;
        }
    }

    /* Copyright en disclaimer */
    section:last-of-type small {
        font-family: 'Montserrat', sans-serif;
        font-size: 0.8rem;
        color: #888888;
        line-height: 1.4;
    }
}

/*
Bronnen:
https://codepen.io/Sixclones/pen/MJrEgz
https://codepen.io/creme/pen/XXdZjM
https://codepen.io/Aleix/pen/oWwoza
https://codepen.io/jh3y/pen/gOmObQj
*/

/**************************
* MARK: Dark side
**************************/
[data-theme="dark"],
html:has(#theme-toggle:checked) {
    body {
        background-color: var(--bg-primairy-color);
        color: var(--text-color);
        padding: 0;
        margin: 0;
    }

    main {
        background-color: var(--bg-primairy-color);
        color: var(--text-color);
    }
    header>section{
        color:var(--text-color);
    }

    header picture img {
        @media (max-width: 500px) {
            object-position: center;
        }
    }

    ul {
        background-image: linear-gradient(to right,
                var(--lightsaber-grey) 0% 30%,
                var(--lightsaber-darkred) 30% 100%);

        @media (max-width: 500px) {
            background-image: linear-gradient(to right,
                    var(--lightsaber-grey) 0% 30%,
                    var(--lightsaber-red) 30% 100%);
        }
    }

    main {
        background-color: var(--bg-primairy-color);
        color: var(--text-color);
    }

    main section img {
        justify-content: right;
        justify-items: end;
        width: 90%;

        @media (max-width: 500px) {
            width: 100%;
            justify-content: center;
        }
    }

    main>section:nth-of-type(2)>div {
        @media (max-width: 500px) {
            background-color: var(--bg-primairy-color);
        }
    }

    main>section:nth-of-type(2)>div>section>a {
        background-color: var(--bg-secundairy-color);
    }

    main>section:nth-of-type(2)>div>section>a>h3 {
        color: var(--text-color);
        background-color: var(--black-color);
    }
}