@layer base, typography, component, page, utility;

@import url(./controls.css);
@import url(./components.css);
@import url(./typography.css);

/* $screen-desktop-min: 1024px; */
/* @TODO: SCSS conversion - @import becomes more complex */
/* @import './mixins.scss'; */
/* @import './typography.scss'; */

:root {
    --palette-black: #222;
    --border-large: 4px solid var(--palette-black);

    --header-bg: #fff;

    --footer-bg: #444;
    --footer-fg: #fdfdfd;

    --homepage-principal-bg: #ecffe3;
    --homepage-whatsphc-bg: #e4c5ff;
    --homepage-news-bg: #c2a8eb;
    --homepage-projects-bg: #f5f2cc;
    --homepage-macchinisti-bg: #888;

    --project-card-bg: #a2d4f3;

    --font-primary: 'Open Sans', sans-serif;
    --font-display: 'Iosevka', monospace;
    --font-mono: 'Source Code Pro', monospace;
    --font-secondary: 'Source Sans Pro', sans-serif;
}

:root {
    --guide-base: #a2d4f3;

    --guide-darkest: color-mix(in srgb, var(--guide-base), #000 75%);
    --guide-darker: color-mix(in srgb, var(--guide-base), #000 50%);
    --guide-dark: color-mix(in srgb, var(--guide-base), #000 25%);

    --guide-light: color-mix(in srgb, var(--guide-base), #fff 25%);
    --guide-lighter: color-mix(in srgb, var(--guide-base), #fff 50%);
    --guide-lightest: color-mix(in srgb, var(--guide-base), #fff 75%);

    --news-base: #f8e8b1;
}

@layer base {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
        font: inherit;
        margin: 0;
    }

    html {
        height: 100%;
    }

    html,
    body {
        min-height: 100%;
        margin: 0;

        font-family: var(--font-primary);
        font-size: 18px;
        color: #222;
    }

    /*
    html {
        scroll-snap-type: y mandatory;
        scroll-padding-top: 4rem;
    }
    */

    img {
        display: block;
    }

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

    body {
        /*
        for the header spacing
        padding-top: 6rem;
        */

        display: grid;
        grid-template-rows: auto 1fr auto;

        header {
            z-index: 10;

            height: 6rem;
            border-bottom: var(--border-large);
            background: var(--header-bg);

            grid-column: 1 / -1;

            top: 0;
            position: sticky;
            width: 100%;

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

            .logo {
                padding-left: 1rem;

                img {
                    height: 3.5rem;
                }
            }

            .links {
                display: flex;
                align-items: center;
                gap: 1.5rem;

                padding: 0 1.5rem;

                a {
                    font-family: var(--font-display);
                    font-size: 18px;
                    font-weight: 500;
                    letter-spacing: 1px;
                    color: #333;

                    padding: 0.25rem 1.325rem;
                }

                @media screen and (max-width: 1024px) {
                    flex-direction: column;
                }
            }

            .side-menu {
                position: fixed;

                /*
                top: 0;
                right: 0;
                bottom: 0;
                left: 3rem;
                */

                top: 5rem;
                right: 0;
                bottom: 0;
                left: 0;

                background: #f0f0f0;

                display: grid;
                /*
                grid-template-rows: auto 1fr;
                */
                grid-template-rows: 1fr;

                gap: 1.5rem;
                padding: 1.5rem;

                justify-content: center;

                /*
                & > :first-child {
                    justify-self: end;
                }
                */

                .links {
                    display: grid;
                    grid-template-columns: 1fr;

                    align-content: start;

                    width: calc(100vw - 3rem);
                    max-width: 100%;

                    gap: 1.5rem;

                    padding: 0;
                }
            }

            #header-menu-toggle {
                display: none;

                &:not(:checked) ~ .side-menu {
                    display: none;
                }
            }

            &:has(#header-menu-toggle:checked) #header-menu-toggle-menu {
                display: none;
            }

            &:has(#header-menu-toggle:not(:checked)) #header-menu-toggle-close {
                display: none;
            }

            @media screen and (max-width: 1024px) {
                height: 5rem;
                padding: 0 0.5rem;

                .logo {
                    padding-left: 0;

                    img {
                        height: 3rem;
                    }
                }
            }
        }

        main {
            width: 100%;

            @media screen and (max-width: 1024px) {
                padding: 3rem 1rem;
                gap: 3rem;

                .card {
                    width: 100%;
                }
            }
        }

        footer {
            z-index: 10;
            padding: 1rem 0;
            --paragraph-margin: 0.5rem;
            --zone-color: #aaa;

            min-height: 6rem;
            border-top: var(--border-large);
            background: var(--footer-bg);
            color: var(--footer-fg);

            display: grid;
            place-content: center;

            font-family: var(--font-secondary);
            font-size: 18px;

            scroll-snap-align: end;

            @media screen and (max-width: 1024px) {
                min-height: 5rem;
                font-size: 18px;
            }
        }
    }

    ::-webkit-scrollbar-track:vertical {
        background-color: #f0f0f0;
        border-left: 2px solid #222;
        border-top: 2px solid #222;
        border-bottom: 2px solid #222;
    }

    ::-webkit-scrollbar-track:horizontal {
        background-color: #f0f0f0;
        border-top: 2px solid #222;
        border-left: 2px solid #222;
        border-right: 2px solid #222;
    }

    ::-webkit-scrollbar-thumb {
        background-color: #1e6733;
        border: 2px solid #222;
    }

    ::-webkit-scrollbar-thumb:hover {
        background-color: #2b8b47;
    }

    ::-webkit-scrollbar-corner {
        background-color: #f0f0f0;
        /* border-left: 2px solid #222; */
        /* border-top: 2px solid #222; */
    }

    ::-webkit-scrollbar {
        width: 15px;
    }

    ::selection {
        background: #0002;
    }

    body:has(#header-menu-toggle:checked) {
        overflow: hidden;
    }
}

/*
    Typography
*/

/* @TODO: SCSS conversion - @import becomes more complex */
/* @import './controls.scss'; */
/* @import './components.scss'; */

/*
Custom Page Styles
*/

/* @TODO: SCSS conversion - @import becomes more complex */
/* @import './pages.scss'; */

@layer utility {
    .hide {
        display: none !important;
    }

    .invisible {
        opacity: 0 !important;
    }

    .grid-center {
        display: grid;
        place-content: center;
        place-items: center;
    }

    .h-flex {
        display: flex;
        gap: 0.5rem;
        flex-direction: row;
    }

    .v-flex {
        display: flex;
        gap: 0.5rem;
        flex-direction: column;
    }

    .h-flex,
    .v-flex {
        place-self: stretch;
        align-items: center;

        > * {
            flex-shrink: 0;
        }

        > .spacer {
            flex-grow: 1;
        }
    }

    @media screen and (min-width: 1024px) {
        .mobile-only {
            display: none !important;
        }
    }

    @media screen and (max-width: 1024px) {
        .desktop-only {
            display: none !important;
        }
    }
}
