@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&family=Heebo:wght@100..900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --theme-color: Green;
    --text-color: Black;
    --text-color-over-theme: White;
}

* {
    margin: 0;
    font-family: "Roboto", sans-serif;
    box-sizing: border-box;
}

/* Page disposition */

body {
    display: grid;
    grid-template-columns: max-content 1fr;
}

body > div {
    height: 100%;
    padding: 1em 2ch;
}

/* Left side */

#left-side {
    background-color: var(--theme-color);
    color: var(--text-color-over-theme);
    print-color-adjust: exact;
}

a {
    color: inherit;
    text-decoration: auto dashed underline var(--text-color-over-theme);
    text-underline-offset: 3px;
}

#left-side h3 {
    margin-block: 1.5em 0.5em;
    font-family: monospace;
    font-size: 1.5em;
}

#left-side h2 {
    margin-block-end: 0.5em;
    font-size: 1.25em;
    font-weight: normal;
}

#all-skills {
    display: grid;
    grid-template-columns: max-content 1fr;
    --row-height: 3em;
}

.skill-group {
    grid-column: span 2;
    display: grid;
    grid-template-columns: subgrid;
    align-items: center;
    row-gap: 0.5em;
    column-gap: 1ch;
    justify-items: center;
}

#all-skills h3 {
    grid-column: span 2;
}

.skill-group img {
    height: var(--row-height);
}

.meter {
    display: inline;
    inline-size: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 2px;
    height: 25%;
    background-color: DarkSlateGray;
    border: 2px solid DarkSlateGray;
    border-radius: var(--row-height);
}

.meter .segment {
    --mix-lime-percentage: calc((100% / (4 - 1)) * (var(--segments, 0) - 1));
    background-color: color-mix(in srgb, Lime var(--mix-lime-percentage, 0%), Orange);
}

.meter .segment:first-child {
    border-radius: var(--row-height) 0 0 var(--row-height);
}

.meter .segment:nth-child(4) {
    border-radius: 0 var(--row-height) var(--row-height) 0;
}

#languages {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1ch;
}

#languages h3 {
    text-align: center;
}

@keyframes pulse {
    from {
        scale: 100%;
    }

    to {
        scale: 110%;
    }
}

.pulse {
    animation: pulse alternate 0.4s ease-in-out infinite;
}

#languages a {
    display: flex;
    justify-content: center;
}
#languages img {
    width: 100%;
    max-width: 8ch;
}

#project {
    margin-block-start: 2em;
}

/* Right side */

#right-side {
    color: var(--text-color);
    display: grid;
    grid-template-columns: max-content 1fr;
    grid-auto-rows: max-content;

    h1, h2 {
        text-align: center;
    }

    h1 {
        margin-block: 0.25em;
    }
    
    header {
        grid-column: 1 / -1;
    }

    h3 {
        color: var(--theme-color);
        border-bottom: 3px solid var(--theme-color);
        text-indent: 1ch;
        font-family: monospace;
        font-size: 1.5em;
        margin-block: 0.75em 0.25em;
        grid-column: 1 / -1;
    }

    .history {
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: subgrid;
        gap: 0.5rem 2rch;
        line-height: 1.25em;

        > div {
            display: grid;
            grid-column: 1 / -1;
            grid-template-columns: subgrid;
            row-gap: 0.25rem;

            > *:first-child {
                text-align: end;
                font-family: monospace;
                font-size: 1.25em;
            }

            > *:nth-child(n + 2) {
                grid-column: 2;
            }
        }

        span:has(sup) {
            margin-top: -0.35em;
        }
    }

    ul {
        grid-column: 1 / -1;
    }
}

/* Printing */

#qr-code {
    display: none;
}

#print-button, #qr-code {
    position: fixed;
    top: 1rem;
    right: 1rem;

    img {
        height: 4.5rem;
    }
}

@media print {
    @page {
        size: A4;
        margin: 0.5in;
    }
    
    body {
        font-size: 0.84em;
    }

    #qr-code {
        display: block;
    }
    #print-button {
        display: none;
    }

    .pulse {
        animation: none;
    }

    #left-side {
        height: 100vh;
    }

    #right-side {
        grid-template-columns: 7ch 1fr;
    }
}

/* Responsive */

#mobile-info {
    display: none;
    flex-wrap: wrap;
    column-gap: 2ch;
    justify-content: space-between;
}

@media (max-width: 500px) {
    body {
        display: flex;
        flex-direction: column-reverse;
    }

    #print-button img {
        height: 2em;
    }

    #right-side {
        padding: 1em 0;
        grid-template-columns: 7ch 1fr;

        >*:not(h3, ul) {
            padding: 0 2ch;
        }
    }

    #desktop-info {
        display: none;
    }

    #mobile-info {
        display: flex;
    }
}