/* Global styles + styles for elements in the home page */

@import url('https://fonts.googleapis.com/css2?family=Mona+Sans:ital,wght@0,200..900;1,200..900&display=swap');
@import url(./color-palette.css);

* {
    box-sizing: inherit;
    margin: 0;
    padding: 0;
    font-family: "Mona Sans", sans-serif;

    &:focus-visible {
        outline: var(--focus-outline);
        outline-offset: var(--focus-outline-offset);
    }
}

:root {
    color-scheme: light dark;

    --bg-main: var(--gray-0);
    --bg-secondary: var(--gray-100);
    --text-color: var(--gray-800);
    --text-color-secondary: var(--gray-600);
    --text-color-inverted: var(--gray-0);

    --shadow: 
        0 8px 12px hsl(from var(--gray-800) h s l / 0.05);
    --shadow-images:
        0 8px 20px hsl(from var(--gray-800) h s l / 0.05),
        0 0px 2px hsl(from var(--gray-800) h s l / 0.15);

    font-size: clamp(1rem, 1.25vw, 1.25rem);
    box-sizing: border-box;
    line-height: 1.5;
    word-wrap: break-word;

    --focus-outline: light-dark(var(--primary-100), var(--text-color)) 3px solid;
    --focus-outline-offset: 4px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: var(--gray-800);
        --bg-secondary: var(--gray-750);
        --text-color: var(--gray-0);
        --text-color-secondary: var(--gray-300);
        --text-color-inverted: var(--gray-800);
    }

}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-color);
}


/* Content area */

.content-area {
    --content-max-width: 70ch;
    --padding-inline: max(2em, 5vw);

    display: grid;
    grid-template-columns: minmax(var(--padding-inline), 1fr) [breakout-start] 2fr [content-start] min(var(--content-max-width), 100% - var(--padding-inline)*2) [content-end] 2fr [breakout-end] minmax(var(--padding-inline), 1fr);
    justify-self: center;
}

.page-area {
    /* Vertical division of the page */
    /* making the footer always stick to the bottom */
    min-height: 100dvh;
    grid-template-rows: auto 1fr auto;
}

.content-area > * {
    grid-column: content; /* shorthand for content-start / content-end */
}

.content-area > .breakout {
    grid-column: breakout; /* shorthand for breakout-start / breakout-end */
    max-width: 120ch;
}


/* Main styles */

h1 {
    font-size: 3em;
    line-height: 1.2em;
}

h2 {
    font-size: 2rem;
    margin-block-start: 2em;
}

h3 {
    font-size: 1.25rem;
    margin-block-start: 3em;
}

p {
    margin-bottom: 1em;
}

h1 + p {
    margin-top: 0.5em;
}

h2 + p {
    margin-top: 1.5em;
}

h3 + p {
    margin-top: 1em;
}

p + p,
a + p {
    margin-top: 1em;
}

img {
    max-width: 100%;
    height: auto;
    display: block;

    &.illustration {
        border-radius: 0.5em;
        width: 100%;
        height: auto;
        object-fit: cover;
        box-shadow: var(--shadow-images);

        &.border-radius-big {
            border-radius: 1em;
        }
    }
}

p + figure,
ul + figure,
ol + figure {
    margin-top: 2em;
}

p + ul,
p + ol {
    margin-top: 0;
}

abbr {
    text-decoration: none;
}

.visually-hidden {
    display: none;
}

section {
    padding-block-start: 6em;

    h2 {
        margin-top: 0;
    }
}

main ul, 
main ol {
    margin-block: 1.5em;

    li {
        margin-block-end: 0.5em;
        margin-inline-start: 1em;
    }
}


main a:is(:not(.link-block)) {
    color: light-dark(var(--primary-500), var(--primary-100));
    text-decoration-thickness: 0.125em;
    text-decoration-skip-ink: none;
    text-underline-offset: 0.125em;

    /* &[target="_blank"]::after {
        content: "↗";
        display: inline-block;
        margin-inline: 0.125em;
        position: relative;
        top: 0.15em;
        transition: transform 0.3s ease;
    }

    &[target="_blank"]:hover::after {
        transform: rotate(45deg);
    } */
}



/* Main nav */

nav {
    z-index: 1000;
    font-size: 0.875em;
    padding: 0.25em;
    background-color: var(--bg-main);
    border-radius: 4em;
    outline: 1px solid light-dark(var(--gray-200), var(--gray-600));
    box-shadow: var(--shadow);
    position: fixed;
    top: -10em;
    left: 50%;
    transform: translateX(-50%);
    animation: nav-slide-in 1s cubic-bezier(.4,0,.2,1) 0.5s forwards;

    ul {
        list-style-type: none;
        padding: 0;
        display: inline-flex;
        gap: 0.25em;
    }

    li a {
        display: block;
        text-decoration: none;
        color: inherit;
        padding: 0.5em 1.5em;
        height: 100%;
        border-radius: 40em;
        align-content: center;
        transition: background-color 0.3s ease, color 0.3s ease;

        &:hover {
            cursor: pointer;
            text-decoration: none;        
        }
    }

    li::after {
        content: "";
        display: block;
        background-color: var(--text-color);
        position: relative;
        bottom: 0.5em;
        width: calc(100% - 4em);
        transform: scaleX(0);
        margin-inline: 2em;
        height: 0.25em;
        border-radius: 1em;
        transition: transform 0.4s ease;
    }

    li:hover::after {
        transform: scaleX(1);
    }
}

@keyframes nav-slide-in {
    from {
        top: -10em;
        opacity: 0;
    }
    to {
        top: 1em;
        opacity: 1;
    }
}

.current-menu-item {
    background-color: var(--text-color);
    color: var(--text-color-inverted);

    &:hover {
        text-decoration: none;
    }
}


/* Header */

header {
    padding-block: 8em 1em;
}

.main-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;

    p {
        max-width: 60ch;
        font-size: 1.125em;
    }

    .portrait {
        border-radius: 50%;
        width: 10em;
        height: auto;
        object-fit: cover;
        margin-block-end: 1.5em;
        outline: light-dark(var(--gray-200), var(--gray-600)) 1px solid;
        outline-offset: 0.5em;
    }
}


/* About */

.videos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(24em, 1fr));
    gap: 1em;
    margin-block: 1.5em 0;

    iframe {
        border-radius: clamp(0.5em, 2vw, 1em);
        width: 100%;
        aspect-ratio: 16 / 9;
    }

    @media (max-width: 640px) {
        grid-template-columns: 1fr;
    }
}

.about-columns {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: clamp(3em, 4vw, 4em);
    align-items: start;
    margin-block-start: 1.5em;

    @media (max-width: 800px) {
        grid-template-columns: 1fr;

        .about-photo {
            display: none;
        }
    }
}


/* Links */

.link-block {
    --icon-size: 2em;

    background-color: var(--bg-secondary);
    color: var(--text-color);
    display: flex;
    flex-direction: row;
    gap: 1.25em;
    border-radius: 1em;
    border: 1px solid light-dark(hsl(from var(--gray-200) h s l / 0.5), hsl(from var(--gray-600) h s l / 0.5));
    padding: 1.5em 2em;
    text-decoration: none;
    align-items:center;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    
    .icon-wrapper {
        height: calc(var(--icon-size) * 2);
        width: calc(var(--icon-size) * 2);
        padding: calc(var(--icon-size) / 2);
        background-color: var(--bg-main);
        border-radius: 4rem;
        outline: 1px solid light-dark(hsl(from var(--gray-200) h s l / 0.5), var(--gray-600));

        box-shadow: var(--shadow);
        transition: box-shadow 0.3s ease;
    }

    .icon {
        fill: light-dark(var(--gray-600), var(--gray-400));
        display: block;
        width: var(--icon-size);
        height: var(--icon-size);
        transition: all 0.3s ease;
    }

    .original-icon {
        position: relative;
        top: -2em;
        opacity: 1;
    }

    .replacement-icon {
        position: relative;
        top: -1.5em;
        opacity: 0;
    }

    .text-wrapper {
        display: flex;
        flex-direction: column;

        p {
            margin: 0;
        }

        p:is(:nth-child(2)) {
            padding-block-start: 0.25em;
            font-size: 0.875em;
        }
    }

    .link-title {
        font-weight: bold;
        color: var(--text-color);
        font-size: 1rem;
        margin-block-end: 0.25em;
    }

    &:hover {
        cursor: pointer;
        text-decoration: none;
        background-color: light-dark(var(--gray-150), var(--gray-700));

        .original-icon {
            top: -0.5em;
            opacity: 0;
        }

        .replacement-icon {
            top: 0;
            opacity: 1;
        }
    }
}

.link-block + p {
    margin-top: 2em;
}

p + .link-block {
    margin-top: 2em;
}


/* Skip link */

.skiplink {
    position: absolute;
    top: -1000px;
    left: -1000px;
    background-color: var(--gray-800);
    color: var(--gray-0);
    padding: 1em 1.5em;
    z-index: 1000;
}

.skiplink:focus {
    top: 0;
    left: 0;
}


/* Portfolio */

.projects {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1em;
    margin-block-start: 1.5em;

    > * {
        grid-row: span 2;
    }

    @media (max-width: 800px) {
        > * {
            grid-column: span 2;
        }
    }
}

/* Contacts */

.contacts-grid {
    display: grid;
    grid-template-columns: 1fr 8em 8em 8em;
    list-style: none;
    gap: 1em;

    li {
        margin: 0;
    }
}


@media screen and (max-width: 1000px) {
    .contacts-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    li:has(.email-link) {
        grid-column: span 3;
    }
}

.link-block.dribbble {
    grid-column: span 2;
}

/* @media screen and (width > 800px) {
    .link-block.dribbble {
        display: flex;
        flex-direction: column;
        text-align: center;
        justify-content: center;
    }
} */

@media screen and (max-width: 480px) {
    .contacts-grid {
        display: flex;
        flex-direction: column;
    }

    .link-block:has(.icon-wrapper) {
        display: flex;
        flex-direction: column;
        text-align: center;
        padding-block: 2.5em;
    }
}

.social {
    justify-content: center;
    align-items: center;
    height: 100%;

    &:hover {
        background-color: var(--bg-color);
        border-color: var(--outline-color);
        
        .icon {
            fill: light-dark(var(--core-color), var(--gray-0));
        }
    }

    .icon {
        width: 3em;
        height: 3em;
        fill: light-dark(var(--gray-500), var(--gray-300));
    }
}


/* Footer */

.footer {
    font-size: 0.875em;
    color: var(--text-color-secondary);
    margin-block: 4em 0.5em;
    width: 100%;
    justify-self: left;

    p::after {
        content: "☺️";
        display: inline-block;
        margin-left: 0.5em;
        font-size: 1.25em;
        position: relative;
        top: 0.125em;
    }

    &:hover p::after {
        content: "🥰";
    }
}