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

:root {
    --color-primary: rgb(243, 240, 231);
    --color-secondary: rgba(204, 201, 192, 0.749);
    --color-bg-dark-25: rgba(0, 0, 0, 0.25);
    --color-bg-dark-60: rgba(0, 0, 0, 0.6);
    --color-bg-dark-75: rgba(0, 0, 0, 0.75);
    --color-bg-dark-90: rgba(0, 0, 0, 0.9);
    --color-bg-dark-100: rgb(0, 0, 0);
    --spacing-md: 1.5rem;
}

button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.header-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    z-index: 1000; /* Ensure it sits above other content */
}

header {
    position: absolute;
    top: 0;
    width: 95%;
    margin: 1rem 2rem;
    padding: 1rem 3.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 24px;

    /* Glassmorphism */
    background: var(--color-bg-dark-25); /* semi-transparent */
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%); /* Safari iOS/macOS */
    /* border: 1px solid rgba(255, 255, 255, 0.2); subtle frosted edge */
    box-shadow: 0 8px 32px var(--color-bg-dark-60);

    .header-logo {
        display: flex;
        width: 4%;
        height: auto;
        cursor: pointer;
    }

    .header-logo-text {
        display: flex;
        width: 6%;
        height: auto;
        cursor: pointer;
    }

    .menu-button {
        width: 50%;
        height: auto;
        cursor: pointer;
    }
}

.nav-menu {
    position: fixed;
    top: 0%;
    right: 0%;
    height: 100vh;
    width: clamp(250px, 34%, 500px);
    display: flex;
    flex-direction: column;
    align-items: end;
    color: var(--color-secondary);
    gap: var(--spacing-md);
    padding: 2.5rem 4.5rem;
    border-radius: 24px;
    z-index: 1000; /* Ensure it sits above other content */

    opacity: 0;
    transform: translateX(100%); /* start off-screen */
    pointer-events: none; /* prevent clicks when hidden */
    transition: color 0.3s ease-in-out, transform 0.3s ease-in-out,
        font-size 0.3s ease-in-out, opacity 0.3s ease-in-out;

    /* Glassmorphism */
    background: var(--color-bg-dark-75); /* semi-transparent */
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%); /* Safari iOS/macOS */
    /* border: 1px solid rgba(255, 255, 255, 0.2); subtle frosted edge */
    box-shadow: 0 8px 32px var(--color-bg-dark-60);

    &.open {
        opacity: 1;
        transform: translateX(0); /* slide into view */
        pointer-events: auto;
    }

    button {
        display: flex;
        justify-content: end;
        align-items: end;
    }

    img {
        width: 50%;
        height: auto;
        align-self: flex-end;
        cursor: pointer;
    }

    .nav-text {
        text-transform: uppercase;
        font-size: clamp(2rem, 5vw, 4rem);
        letter-spacing: 0.11em; /* slight spacing */
        margin: 0;
        transition: color 0.3s ease-in-out, transform 0.3s ease-in-out;
        cursor: pointer;
        text-align: right;
        transform-origin: right;
        will-change: transform, color;

        &:hover,
        &.active {
            color: var(--color-primary);
            transform: scale(1.25);
        }
    }

    .socials-links-wrapper {
        opacity: 0;
        font-size: clamp(1rem, 2vw, 1.5rem);
        display: flex;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-end;
        text-align: right;
        transition: opacity 0.3s ease-in-out;
        will-change: opacity;

        a {
            color: var(--color-primary);
            text-decoration: none;
            transition: text-decoration 0.3s ease-in-out,
                font-weight 0.3s ease-in-out;
            cursor: pointer;
            text-align: right;
            will-change: text-decoration, font-weight;

            &:hover {
                font-weight: 500;
                text-decoration: dotted underline var(--color-primary);
                -moz-text-decoration-style: dotted;
                -webkit-text-decoration-style: dotted;
            }
        }
    }
}

footer {
    background-color: var(--color-bg-dark-100);
    color: var(--color-primary);

    .footer-hr {
        border: none; /* Reset the default border */
        height: 0.25px; /* Set the overall thickness of the line */
        width: 100%; /* Adjust the overall width of the line */
        margin: 0px auto; /* Add space around the line and center it */
        background-image: repeating-linear-gradient(
            90deg,
            var(--color-primary) /* Dash color */,
            var(--color-primary) 30% /* Dash length */,
            transparent 30% /* Start of transparent space */,
            transparent 32% /* End of transparent space. */
        );
    }

    .footer-logo {
        display: flex;
        margin: 2% 10%;

        img {
            margin: 2% auto;
        }
    }

    .footer-links {
        display: flex;
        justify-content: space-around;
        margin: 2% auto;
        font-size: clamp(1rem, 4vw, 1.25rem);

        div {
            line-height: 1.6;

            a:link,
            a:visited {
                color: var(--color-primary);
                text-decoration: none;
                transition: font-weight 0.5s ease-in-out;
                cursor: pointer;
                text-align: right;
                will-change: font-weight;
            }

            a:hover {
                font-weight: 500;
            }
        }
    }

    .copyright-text {
        text-align: center;
        padding: 1rem;
    }
}

.main-container {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

.main-container[data-page="films"] {
    min-height: 100dvh;
}

.main-content {
    .movies {
        display: flex;
        flex-direction: column;
        gap: 0.5rem; /* space between each movie title */
        color: rgba(204, 201, 192, 0.75); /* #CCC9C0 at 75% */
        align-items: flex-end;
        margin: 5%;

        .movie-name {
            font-size: clamp(2rem, 5vw, 4rem);
            line-height: 1.1;
            letter-spacing: 0.11em; /* slight spacing */
            text-transform: uppercase;
            margin: 0;
            transition: color 0.3s ease-in-out, transform 0.3s ease-in-out;
            text-align: right;
            transform-origin: right;
            will-change: transform, color;

            &.active,
            &:hover {
                color: var(--color-primary);
                transform: scale(1.25);
                cursor: pointer;
            }

            .release-year {
                font-size: clamp(1rem, 4vw, 1.25rem);
                opacity: 0.8;
                vertical-align: middle; /* aligns text to middle */
                margin-right: 0.5rem;
            }

            &.active span {
                color: #ccc9c0;
                font-size: clamp(1.5rem, 5vw, 2.5rem);
            }
        }
    }

    .hero-wrapper {
        position: relative;
        text-align: center;
        color: var(--color-primary);
        background-size: cover;
        background-repeat: no-repeat;
        background-position: center;
        height: 65dvh; /* Full viewport height */
        display: flex;
        justify-content: center;
        align-items: flex-end;

        h1 {
            font-size: clamp(2.5rem, 8vw, 6rem);
            text-transform: uppercase;
            letter-spacing: 0.11em; /* slight spacing */
        }
    }

    .team-members {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2rem;
        padding: 3.5rem 0;
        background: var(--color-bg-dark-100);
        color: var(--color-primary);

        .team-members-wrapper {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 2rem;
            padding: 3rem 5.5rem;
        }

        .team-member {
            box-shadow: 0 4px 12px var(--color-bg-dark-60);
            overflow: hidden;
            width: clamp(200px, 30%, 224px);
            text-align: center;

            img {
                width: 100%;
                height: auto;
                display: block;
                border-radius: 2rem;
            }
            h3 {
                margin: 1rem 0 0.5rem 0;
                font-size: clamp(1.5rem, 4vw, 1.8rem);
                letter-spacing: 0.11em; /* slight spacing */
            }
            p {
                margin: 0 0 1.5rem 0;
                font-size: clamp(1rem, 3vw, 1.2rem);
                color: var(--color-secondary);
            }
        }
    }

    .about {
        background-color: var(--color-bg-dark-100);
        color: var(--color-primary);
        padding: 3.5rem 7rem;
        font-size: clamp(1rem, 2vw, 1.5rem);
        line-height: 1.6;
        display: flex;
        flex-direction: column;
        gap: 2rem;

        .about-content {
            display: flex;
            flex-wrap: wrap;
            gap: 2rem;
            justify-content: space-between;
            align-items: center;

            img {
                width: clamp(200px, 40%, 300px);
                height: auto;
                border-radius: 24px;
                box-shadow: 0 4px 12px var(--color-bg-dark-60);
            }

            p {
                flex: 1;
                min-width: 250px;
            }

            .italic {
                font-style: italic;
            }
        }
    }

    .contact {
        background-color: var(--color-bg-dark-100);
        color: var(--color-primary);
        font-size: clamp(1rem, 2vw, 1.5rem);
        padding: 3.5rem 25%;

        input[type="text"],
        input[type="email"],
        textarea {
            background-color: var(--color-bg-dark-90);
            border: var(--color-primary) 1px solid;
            border-radius: 24px;
            font-size: clamp(1rem, 2vw, 1.5rem);
        }
        .the-form {
            .form-field {
                display: flex;
                flex-direction: column;
                margin-bottom: 1.5rem;

                label {
                    margin-bottom: 0.5rem;
                }

                input,
                textarea {
                    padding: 0.75rem 1rem;
                    color: var(--color-primary);
                    resize: vertical; /* allow vertical resizing for textarea */
                }

                textarea {
                    min-height: 100px;
                    max-height: 300px;
                }
            }
            .tooltiptext {
                margin-top: 1rem;
            }
        }
        #send,
        #back-button {
            background: var(--color-primary);
            color: var(--color-bg-dark-100);
            padding: 0.5rem 1rem;
            gap: 0.5rem;
            border-radius: 24px;
            display: flex;
            justify-content: center;
            align-items: center;

            img {
                width: 25%;
                height: auto;
            }
        }
        #back-button {
            margin-top: 1.5rem;
        }
    }

    .error-page {
        background-color: var(--color-bg-dark-100);
        height: 100dvh;
        color: var(--color-primary);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        font-size: clamp(1rem, 4vw, 1.5rem);
        letter-spacing: 0.11em; /* slight spacing */
        line-height: 1.6;
    }
}

/* ------------------------------ */
/* Responsive adjustments */
/* ------------------------------ */

/* Tablets and smaller desktops */
@media (max-width: 1024px) {
    header {
        padding: 0.75rem 2rem;

        .header-logo {
            width: clamp(30px, 5vw, 50px);
        }

        .header-logo-text {
            width: clamp(40px, 8vw, 80px);
        }

        .menu-button {
            width: clamp(30px, 5vw, 50px);
        }
    }

    .main-content {
        .movies {
            .movie-name {
                font-size: clamp(2.5rem, 4vw, 3.5rem);

                &.active {
                    font-size: clamp(3rem, 5vw, 4.5rem);
                }
            }
        }

        .contact {
            padding: 3.5rem 15%;
            text-align: left;

            input[type="text"],
            input[type="email"],
            textarea {
                font-size: clamp(0.75rem, 1.5vw, 1.25rem);
            }
        }
    }

    .nav-menu {
        width: 100%;
        padding: 2rem;

        .nav-text {
            font-size: clamp(3rem, 6vw, 5rem);

            &.active {
                font-size: clamp(3.5rem, 7vw, 4.5rem);
            }
        }
    }

    footer {
        .footer-logo {
            img {
                margin: 2% auto;
                width: 70%;
            }
        }

        .footer-links {
            flex-direction: column;
            align-items: center;
            gap: 1rem;
            text-align: center;
        }
    }
}

/* Mobile phones */
@media (max-width: 600px) {
    header {
        padding: 0.5rem 1.5rem;

        .header-logo {
            width: 12vw;
        }

        .header-logo-text {
            width: 18vw;
        }

        .menu-button {
            width: 12vw;
        }
    }

    .main-container[data-page="films"] {
        min-height: 65dvh;
    }

    .main-content {
        align-items: center;
        text-align: center;

        .movies {
            align-items: center;
            margin: 2rem 1rem;
        }

        .hero-wrapper {
            height: 20dvh;
        }

        .team-members {
            padding: 2rem 2rem;
            .team-members-wrapper {
                padding: 0;
            }
        }

        .about {
            padding: 2rem 2rem;
            .about-content {
                justify-content: center;
                align-items: center;
            }

            .about-content:nth-child(2) {
                flex-direction: column-reverse;
            }
        }
    }
}
