/* ===========================================================
   Global variables
   =========================================================== */
* {
    --sub-text-color: #222;
    --url-color: #11131f;
    --url-hover-color: #5d5e68;
}

body {
    margin: 0;
    padding: 0;
}

hr {
    width: 25vw;
}

/* Links: use the theme color and lighten slightly on hover */
a {
    color: var(--url-color);

    &:hover {
        color: var(--url-hover-color);
    }
}

/* ===========================================================
   Layout helpers
   =========================================================== */

/* Generic centered column container, reused across sections */
.containerDiv {
    display: flex;
    flex-direction: column;
    align-items: center;

    /* Row of skill pills, wraps and centers */
    .skillsDiv {
        display: flex;
        flex-wrap: wrap;
        flex-direction: row;
        justify-content: center;
        gap: 5px;
    }
}

/* Individual skill "pill" badge. Background color is set per-instance
   via the --color custom property (see inline style in HTML). */
.skill {
    padding: 2px;
    background-color: var(--color);
    border: 3px solid color-mix(in srgb, var(--color), black 20%);
    border-radius: 5px;

    transition: all 0.2s;
    &:hover {
        scale: 1.3;
    }
}

/* ===========================================================
   Intro section
   Includes: photo, name, graduation, links, about-me title/intro
   =========================================================== */
#intro {
    img {
        border-radius: 5px;
        max-width: 200px;
        aspect-ratio: 1/1;
    }

    #pHey {
        color: var(--sub-text-color);
        font-size: 1.1rem;
        margin: 0.75rem 0 0.2rem;
    }

    h1 {
        font-size: 3rem;
        line-height: 1.05;
        margin: 0;
    }

    sup {
        color: var(--sub-text-color);
        line-height: 1.2;
        margin-top: 0.15rem;
        margin-bottom: 2rem;
    }

    h2 {
        margin: 2rem 0 0 0;
    }

    #pField {
        width: min(70ch, calc(100% - 2rem));
        margin: 0;
        line-height: 1.5;
        text-align: center;
    }

    margin-bottom: 0.5rem;
}

/* ===========================================================
   About Me section
   Wrapping row of info blocks (lists or skill pills)
   =========================================================== */
#aboutMe {
    padding: 0 10vw;
    display: flex;
    flex-direction: column;
    align-items: center;

    #aboutMeContainer {
        display: flex;
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;

        > div {
            box-sizing: border-box;
            width: min(100%, 450px);
            flex: 1 1 320px;
            max-width: 450px;
        }

        div p {
            font-weight: bold;
            margin-bottom: 0.3rem;
        }

        ul,
        div {
            margin-top: 0;
        }
    }
}

/* ===========================================================
   Projects section
   Grid of project cards
   =========================================================== */
#projectsDiv {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 1vw;
    padding: 2px;
    max-width: 80vw;
    margin-bottom: 2rem;

    .projectBox {
        border: solid 1px black;
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        border-radius: 5px;

        width: 215px;
        min-height: 140px;
        height: auto;
        overflow: visible;
        padding: 0.5rem 1rem;

        h3 {
            margin-top: 0;
            margin-bottom: 0.2rem;
        }

        p {
            display: -webkit-box;
            overflow: hidden;
            margin-top: 0;
            font-size: 0.9rem;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 6;
            line-clamp: 6;
        }

        .projectDescription.expanded {
            display: block;
            overflow: visible;
            -webkit-line-clamp: unset;
            line-clamp: unset;
        }

        .descriptionToggle {
            padding: 0;
            border: 0;
            background: transparent;
            color: var(--url-color);
            cursor: pointer;
            font-size: 0.8rem;
            text-decoration: underline;

            &:hover,
            &:focus-visible {
                color: var(--url-hover-color);
            }
        }

        sub {
            font-size: 0.8rem;
            text-decoration: underline;
        }

        /* Row of skill pills shown inside each project card */
        .skillBox {
            padding-top: 6px;
            font-size: 0.7rem;
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            margin-bottom: 0.25rem;
            gap: 5px;
        }
    }
}

/* ===========================================================
   Contact section
   =========================================================== */
#contact {
    text-align: center;
    margin: 2rem 0 1rem 0;

    h3 {
        margin-top: 0;
    }

    div {
        display: flex;
        flex-direction: column;

        p {
            margin: 0;
        }
    }
}

#bodyHolder {
    position: relative;
    width: 100%;
    height: 100%;
    padding-top: 60px;
}

#backLink {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid #8b8b8b;
    border-radius: 999px;
    background: transparent;
    color: var(--url-color);
    font-size: 0.8rem;
    text-decoration: none;

    &:hover,
    &:focus-visible {
        border-color: #222;
        background: #222;
        color: #fff;
    }
}

/* ===========================================================
   Touchups for wider site display
   =========================================================== */
@media (min-width: 1100px) {
    body {
        padding: 5%;
        background-image: radial-gradient(#bbb 1px, transparent 1px);
        background-size: 20px 20px;
    }

    #bodyHolder {
        border-radius: 20px;
        padding-bottom: 1rem;
        background-color: #f0f0f0;
        max-width: 75vw;
        margin: 0 auto;
    }
}

/* ===========================================================
   Mobile layout
   =========================================================== */
@media (max-width: 600px) {
    body {
        padding: 24px 16px 32px;
        margin: 0;
        overflow-wrap: anywhere;
    }

    #bodyHolder {
        padding-top: 0;
    }

    #backLink {
        position: static;
        display: inline-block;
        margin-bottom: 1.5rem;
    }

    hr {
        width: min(75vw, 280px);
    }

    #intro {
        text-align: center;

        img {
            width: min(55vw, 220px);
            max-width: none !important;
            height: auto;
        }

        h1 {
            max-width: 100%;
            margin: 0;
            font-size: clamp(2rem, 11vw, 3rem);
            line-height: 1.05;
        }

        sup {
            margin-bottom: 1.25rem;
        }

        h2 {
            margin-top: 1.5rem;
        }

        #pField {
            max-width: 36rem;
        }
    }

    #aboutMe {
        padding: 0;

        #aboutMeContainer {
            width: 100%;
            gap: 0.75rem;

            > div {
                flex-basis: 100%;
            }
        }
    }

    .skill {
        padding: 3px 5px;
    }

    #projectsDiv {
        width: 100%;
        max-width: none;
        gap: 0.75rem;
        padding: 0;

        .projectBox {
            box-sizing: border-box;
            width: 100%;
            max-width: 360px;
            min-height: 150px;
            aspect-ratio: auto;
        }
    }

    #contact {
        margin: 1rem 0 0.5rem 0;
    }
}

/* Hover scaling can obscure nearby content on touch-only devices. */
@media (hover: none) {
    .skill:hover {
        scale: 1;
    }
}
