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

/**************************
* MARK: header
**************************/
header {
    display: grid;
    position: relative;
    z-index: 300;

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

    @media (max-width: 500px) {
        background-image: linear-gradient(to top,
                var(--gradient-black-overlay-bg) 50%,
                var(--gradient-darkblueish-overlay-bg));
        opacity: 1;
        place-content: center;
    }
}

header>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;
        height: 5rem;
        grid-template-columns: repeat(3, 1fr);
        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-area: 1/1;
}

header img {
    grid-area: 1/1;
    width: 99.5vw;
    height: 100%;
    object-fit: contain;
    object-position: center 20%;
    mix-blend-mode: overlay;
    opacity: 1;

    @media (max-width: 1000px) {
        height: auto;
        width: 100%;
        object-position: center;
        place-items: center;
    }

    @media (max-width: 500px) {
        display: block;
        height: 70vh;
        width: 100%;
        object-fit: cover;
        object-position: left 75%;
        place-items: center;
    }
}

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: 25rem 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: var(--bg-color);
}

main>section {
    padding: 5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 2fr));
    gap: 1.5rem;
    width: 100%;

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

    @media(max-width: 500px) {
        grid-template-columns: 1fr;
    }
}

main>section>a {
    display: flex;
    flex-direction: column;
    height: 20rem;
    width: 100%;
    max-width: 50rem;
    justify-self: center;
    border-radius: 1rem;
    overflow: hidden;
    text-decoration: none;
    background-color: var(--lightsaber-grey);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;

    &:hover,
    &:focus-visible {
        transform: translateY(-4px);
        box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
    }

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

main>section>a>img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 75%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

main>section>a>h2 {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 25%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'Montserrat', sans-serif;
    font-size: var(--p);
    font-weight: 500;
    color: #f0f0f0;
    background-color: #151619;
}

main>section>a>p {
    color: var(--text-color);
    font-size: var(--p);
}

/**************************
* MARK: load more knop
**************************/
.is-hidden {
    display: none !important;
}

main>section:first-of-type>a {
    animation: card-appear 0.35s ease-out;
}

@keyframes card-appear {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    main>section:first-of-type>a {
        animation: none;
    }
}

main>section:nth-of-type(2) {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 2rem 6rem 2rem;
    background-color: var(--bg-color);
    width: 100%;
}

#loadmore-button {
    background-color: var(--black-color);
    color: var(--starwars-yellow);
    width: 20rem;
    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: 19rem;
        height: 5rem;
    }

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

#loadmore-button::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: 20rem;
        height: 6rem;
        animation: rotate 15s linear infinite;
    }

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

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

#loadmore-button:hover::before,
#loadmore-button:focus::before,
#loadmore-button:active::before {
    opacity: 1;
}

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

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

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

/**************************
* 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;
    }
}

[data-theme="dark"],
html:has(#theme-toggle:checked) {
    body {
        background-color: var(--bg-primairy-color);
        color: var(--text-color);
    }

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

    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>section>a {
        background-color: var(--bg-secundairy-color);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
    }

    main>section>a>h3 {
        color: var(--text-color);
        background-color: var(--black-color);
    }

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