* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    
    &:focus {
        outline-color: var(--contrast-color);
    }
}

h1, h4 {
    font-family: "Space Mono", monospace;
}

summary, button, a {
    color: inherit;
    background-color: inherit;
    text-decoration: none;
    cursor: pointer;
    border: none;
}

@media (pointer: fine) {
    a {
        text-decoration-color: transparent;
        transition: text-decoration-color 0.5s;

        & > svg {
            transition: translate 0.2s;
        }

        &:hover {
            text-decoration: underline var(--contrast-color) 0.2rem;

            & > svg {
                color: var(--contrast-color);
                translate: 2px -2px;
            }
        } 
    }
}

body {
    --text-color: hsl(0, 0%, 5%);
    --text-color-alt: hsl(0, 0%, 25%);
    --bg-color: hsl(0, 0%, 95%);
    --contrast-color: hsl(351, 100%, 43%);

    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);

    interpolate-size: allow-keywords;
    background-color: var(--bg-color);
    width: 100svw;
    min-height: 100svh;
    overflow-x: hidden;
    padding: 6rem;
    transition: background-color 0.5s, color 0.5s;
    @media screen and (max-width: 768px) {
        padding: 3rem;
    }
}

body:has(.toggle-theme input:checked)  {
    --text-color: hsl(0, 0%, 95%);
    --text-color-alt: hsl(0, 0%, 75%);
    --bg-color: hsl(0, 0%, 10%);
    --contrast-color: hsl(351, 100%, 60%);
}

header {
    display: flex;
    gap: 3rem;
    margin-bottom: 3rem;
    @media screen and (max-width: 768px) {
        flex-direction: column;
        gap: 1rem;
    }

    & .presentation {
        flex: 3;

        & h1 {
            font-size: 2rem;
            font-weight: 600;
            @media screen and (max-width: 768px) {
                line-height: 1;
                margin-bottom: 0.8rem;
            }
        }

        & h2 {
            color: var(--contrast-color);
            font-size: 1.5rem;
            font-weight: 400;
            line-height: 1.5rem;
        }
        
        & p {
            margin-top: 1rem;
        }
    }

    & .contact {
        flex: 2;

        & ul {
            list-style: none;
            display: flex;
            flex-direction: column;
            row-gap: 1rem;

            & li {
                display: flex;
                column-gap: 1rem;

                & > svg {
                    width: 20px;
                    min-width: 20px;
                    height: 20px;
                    fill: var(--text-color)
                }

                & a {
                    display: flex;
                    column-gap: 0.5rem;

                    & p {
                        word-break: break-all;
                    }

                    & svg {
                        width: 10px;
                        min-width: 10px;
                        fill: var(--text-color-alt)
                    }
                }
            }
        }
    }

    & > details {
        position: fixed;
        z-index: 1;
        right: 1%;
        top: 1%;
        overflow: hidden;

        &[open] {
            &::details-content {
                block-size: auto;
            }

            & summary svg {
                rotate: 90deg;
            }
        }

        &::details-content {
            block-size: 0;
            transition: block-size 0.5s, content-visibility 0.5s;
            transition-behavior: allow-discrete;
        }
        
        & summary {
            list-style: none;
            padding: 0.5rem;
            margin: 2px;
            aspect-ratio: 1;
            border-radius: 50%;
            position: relative;

            & svg {
                width: 30px;
                fill: var(--text-color);
                vertical-align: bottom;
                transition: rotate 1s, color 0.2s, scale 0.2s;

                @media (pointer: fine) {
                    &:hover {
                        color: var(--contrast-color);
                        scale: 1.05;
                    }
                }
            }
        }

        & .params {
            display: flex;
            flex-direction: column;
            align-items: center;
            row-gap: 2rem;
            padding-block: 1.5rem 0.2rem;

            & > * {
                padding: 0.5rem;
                border-radius: 20px;
                min-width: 36px;
                aspect-ratio: 1;
                text-align: center;
            }

            & .toggle-theme {
                cursor: pointer;
                position: relative;
                transition: color 0.2s, translate 0.2s;
                @media (pointer: fine) {
                    &:hover {
                        color: var(--contrast-color);
                        translate: 0 -2px;
                    }
                }
                
                & input {
                    position: absolute;
                    cursor: inherit;
                    opacity: 0;

                    &:checked ~ svg:first-of-type {
                        opacity: 0;
                        position: absolute;
                        translate: 0 1px;
                        z-index: 0;
                    }

                    &:checked ~ svg:nth-of-type(2) {
                        opacity: 1;
                        position: relative;
                        translate: 0;
                        vertical-align: bottom;
                    }
                }

                & svg {
                    width: 20px;
                    fill: var(--text-color);
                    transition: opacity 0.5s;

                    &:first-of-type {
                        opacity: 1;
                        position: relative;
                        vertical-align: bottom;
                        z-index: 1;
                    }

                    &:nth-of-type(2) {
                        opacity: 0;
                        position: absolute;
                        translate: -20px 1px;
                    }
                }

                &:has(input:focus-visible) {
                    box-shadow: 0 0 0 2px var(--contrast-color), 0 0 0 3px hsl(0, 0%, 95%);
                }
            }

            & a {
                text-decoration: none;
                transition: color 0.2s, translate 0.2s;
                @media (pointer: fine) {
                    &:hover {
                        color: var(--contrast-color);
                        translate: 0 -2px;

                        & > svg {
                            translate: 0 -2px;
                        }
                    }
                }

                & svg {
                    width: 15px;
                    fill: var(--text-color);
                    vertical-align: bottom;
                    rotate: -45deg;
                }
            }
        }
    }
}

main {
    & > section {
        margin-bottom: 2rem;

        & details {
            overflow: hidden;

            &[open] {
                & summary:after {
                    rotate: 90deg;
                    transition: rotate 0.2s;
                }

                &::details-content {
                    block-size: auto;
                }
            }

            &::details-content {
                block-size: 0;
                transition: block-size 0.3s, content-visibility 0.3s;
                transition-behavior: allow-discrete;
            }
        }

        & summary {
            list-style: none;
            position: relative;

            &::after {
                content: '▶';
                position: absolute;
                right: 0;
                top: 7px;
                transition: rotate 0.2s;
            }

            & h3 {
                text-transform: uppercase;
                letter-spacing: 0.2ch;
                font-size: 1.5rem;
                font-weight: 600;
                box-shadow: 0 0 0 1px var(--text-color);
                padding-bottom: 0.2rem;
                margin-bottom: 1rem;
                transition: box-shadow 0.2s;

                @media (pointer: fine) {
                    &:hover {
                        box-shadow: 0 0 0 2px var(--contrast-color);
                    }
                }
            }
        }

        & article {
            margin-bottom: 1rem;

            & .article-header {
                display: flex;
                flex-flow: column wrap;
                max-height: 3.5rem;
                margin-bottom: 0.5rem;
                @media screen and (max-width: 768px) {
                    flex-wrap: nowrap;
                    max-height: none;
                    row-gap: 0.3rem;
                }

                & h4 {
                    color: var(--contrast-color);
                    font-size: 1.2rem;
                    font-weight: 600;
                    @media screen and (max-width: 768px) {
                        margin-bottom: -0.25rem;
                    }
                }

                & h5 {
                    color: var(--text-color-alt);
                    font-size: 1.1rem;
                    font-weight: 500;
                    transition: color 0.5s;

                    & a {
                        display: flex;
                        column-gap: 0.5rem;
                        max-width: 110px;

                        &:focus-visible {
                            margin-left: 3px;
                        }
                        
                        & svg {
                            width: 10px;
                            fill: var(--text-color-alt);
                        }
                    }

                    &:last-of-type {
                        text-align: end;
                        @media screen and (max-width: 768px) {
                            text-align: start;
                        }
                    }
                }
            }
            
            & .article-content {
                max-width: 90%;
                display: flex;
                flex-direction: column;
                row-gap: 0.5rem;
                @media screen and (max-width: 768px) {
                    max-width: 100%;
                }

                & ul {
                    list-style-position: inside;
                }
            }
        }
    }

    & .skills {
        & .skill-content {
            margin-block: 1rem 2rem;
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 1rem;
            list-style: none;
            @media screen and (max-width: 768px) {
                grid-template-columns: repeat(2, 1fr);
            }

            & li {
                font-weight: 500;
            }
        }

        & .languages {
            & .skill-content {
                & li {
                    & p:last-of-type {
                        font-weight: 400;
                        color: var(--text-color-alt);
                        transition: color 0.5s;
                    }
                }
            }
        } 
    }
}