@import './reset.css';
@import './variables.css';
@import './kit.css';

@font-face {
    font-family: "DMSans";
    src: url("./assets/fonts/dm-sans.woff2") format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "DMSerif";
    src: url("./assets/fonts/dm-serif-text.woff2") format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

body {
    --color-brand-primary: rgb(0, 38, 141);
    --color-brand-primary-light: hsl(from var(--color-brand-primary) h s calc(l + 10));
    --color-brand-primary-trans: rgba(from var(--color-brand-primary) r g b / 0.1);
    --color-text-over-primary: var(--mdf-color-grey-900);

    --color-brand-secondary: rgb(249, 206, 255);
    --color-brand-secondary-dark: hsl(from var(--color-brand-secondary) calc(h - 20) calc(s - 20) calc(l - 20));
    --color-brand-secondary-trans: rgba(from var(--color-brand-secondary) r g b / 0.1);
    --color-text-over-secondary: var(--mdf-color-text-default);

    font-family: "DMSans", system-ui, Arial, sans-serif;
    line-height: 1.5;
    background-color: var(--mdf-color-background-default);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--mdf-color-text-default);
}

.container {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(-45deg, var(--color-brand-primary-trans), var(--color-brand-secondary-trans));
}

main {
    flex: 1;
}

/* HEADER */
.header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    gap: 2rem;
    min-height: 100px;

    .navigation ul {
        display: flex;
        align-items: center;
        border-radius: 10rem;
        gap: 0.5rem;

        a {
            padding: 0.5rem 1.5rem;
            display: block;
            text-decoration: none;
            color: inherit;
            border-radius: 10rem;

            &[aria-current="page"] {
                background-color: var(--color-brand-primary-trans);
            }

            &:hover {
                background-color: var(--color-brand-primary-trans);
            }
        }
    }
}

.logo>a {
    display: block;
    color: var(--color-brand-primary);

    &:hover {
        color: var(--color-brand-secondary-dark);
    }

    svg {
        width: 130px;
        stroke-width: 15px;
    }
}


/* FRONT PAGE */

.home-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    min-width: 0;
    padding: 0 2rem;
    align-items: center;

    .main-image {
        flex: 1;
        display: flex;
        align-items: center;
        padding: 4rem;
        animation: fade-in 0.3s 0.1s ease-in-out both;

        >img {
            width: 100%;
            max-height: min(60vh, 600px);
            object-fit: contain;
        }
    }

    .right {
        flex: 1.5;
        min-width: 0;
        position: relative;

        .title {
            animation: fade-in 0.3s ease-in-out both;
        }

        .description {
            margin-top: 1rem;
            animation: fade-in 0.3s 0.1s ease-in-out both;
        }

        .home-content {
            display: flex;
            gap: 2rem;
        }
    }
}

.title {
    font-size: 3.3rem;
    font-family: "DMSerif", Georgia, "Times New Roman", serif;
    font-weight: 500;
}

/* FOOTER */

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

    ul {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 1rem;

        li>a {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            text-decoration: none;
        }
    }

    p {
        color: var(--mdf-color-text-muted);
    }

    .icon {
        width: 1.2rem;
        height: 1.2rem;
    }
}

/* TEXT */
strong {
    font-weight: 500;
}

a {
    text-decoration-color: var(--color-brand-primary);
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
    color: var(--color-brand-primary);

    &:hover {
        color: var(--color-brand-secondary-dark);
        text-decoration-color: var(--color-brand-secondary-dark);
    }
}

/* WORK */

.work-page-container {

    .title {
        font-size: 3rem;
        font-weight: 500;
        padding: 1rem 2rem;
        animation: fade-in 0.3s ease-in-out both;

        margin-top: 5vh;
    }

    .articles {
        display: flex;
        flex-direction: column;
        animation: fade-in 0.3s 0.2s ease-in-out both;


        .article:nth-child(even) {
            background-color: var(--color-brand-primary);
            color: var(--color-text-over-primary);

            .article-date {
                color: var(--color-text-over-primary);
            }
        }

        .article:nth-child(odd) {
            background-color: var(--color-brand-secondary);
            color: var(--color-text-over-secondary);

            .article-date {
                color: var(--color-text-over-secondary);
            }
        }

        .article:nth-child(odd) .article-content {
            flex-direction: row-reverse;
        }

        .article-content {
            display: flex;

            a:hover img {
                opacity: 0.95;
            }
        }

        .article-date {
            color: var(--mdf-color-text-muted);
            display: block;
            text-transform: capitalize;
        }

        .article-media-name {
            display: block;
            margin-bottom: 1rem;
            font-weight: 600;
        }

        .article-details {
            flex: 1;
            padding: 2rem;
            display: flex;
            flex-direction: column;

            .article-title {
                font-weight: 500;
                font-size: 1.7rem;
                line-height: 1.2;
                margin-bottom: 1rem;

                a {
                    color: inherit;
                    text-decoration: none;
                }
            }

            .article-details-bottom {
                flex: 1;
                display: flex;
                justify-content: flex-end;
                align-items: flex-end;
                margin-top: 1rem;
            }
        }

        .article-link {
            color: inherit;
            text-decoration: none;
            display: inline-block;
            padding: 5px 10px;
            background: var(--mdf-color-background-default);
            border-radius: 5px;
            color: var(--mdf-color-text-default);

            svg {
                width: 1rem;
                vertical-align: sub;
                margin-bottom: 1px;
            }

            &:hover {
                background: var(--mdf-color-background-muted);
            }
        }

        .article-description {
            overflow: hidden;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 7;
            line-clamp: 7;
        }
    }

    .article-image-wrapper {
        width: 40vw;
        max-height: 100%;
        height: 100%;

        img {
            height: 100%;
            width: 100%;
            object-fit: cover;
        }
    }

    .other-work {
        margin: 0 0 4rem 0;
        padding: 0 2rem;
        display: flex;
        flex-direction: column;
        gap: 2rem;

        .item {
            display: flex;
            gap: 5px;
            flex-direction: column;
        }

        .item-media-name {
            white-space: nowrap;
            font-weight: 500;
            margin-right: 10px;
        }

        .item-date {
            display: block;
            white-space: nowrap;
            text-transform: capitalize;
            color: var(--mdf-color-text-muted);
        }
    }
}


@media (max-width: 900px) {
    .header {
        padding: 0 1rem;
    }

    .footer {
        margin-top: 2rem;
        padding: 1rem;
    }

    .home-container {
        padding: 0 1rem;

        .right .title {
            font-size: 2rem;
        }

        .main-image {
            padding: 0 1rem 0 0;
        }
    }

    .work-page-container {

        .articles .article-details {
            padding: 1rem;
        }

        .other-work-title {
            padding: 1rem;
        }

        .other-work {
            padding: 0 1rem;
        }
    }
}

@media (max-width: 650px) {
    .work-page-container .title {
        font-size: 2.5rem;
    }

    .home-container {
        flex-direction: column;

        .main-image {
            flex: auto;
            padding: 1rem 0 2rem 0;

            img {
                width: 40vw;
                max-height: unset;
                height: fit-content;
            }
        }
    }

    .title {
        text-align: center;
    }

    .header {
        margin: 1rem 0;
        gap: 1rem;
        flex-direction: column;
    }

    .work-page-container {
        .article-image-wrapper {
            display: none;
        }
    }

    .item-media-name {
        display: block;
    }
}

@media (max-width: 450px) {
    .home-container {
        align-items: center;
    }

    .header .navigation ul a {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .header .navigation ul {
        gap: 0;
    }
}

@keyframes fade-in {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        --color-brand-primary: rgb(179, 199, 255);
        --color-brand-secondary: rgb(72, 0, 126);
        --color-text-over-primary: var(--mdf-color-grey-200);
        --color-text-over-secondary: var(--mdf-color-text-default);
    }
}