:root {
    --main_text_color: #1a1a1a;
    --secondary_text_color: #555;
    --border_color: #d9d9d9;
    --bold_color: #661959;
    --link_color: #90317d;
    --bg_color: #fff;
}

/* Night mode colors */
html[data-theme="dark"] {
    color-scheme: dark;
    --main_text_color: #ffffff;
    --secondary_text_color: #e8e8e8;
    --border_color: #444;
    --bold_color: #c178ef;
    --link_color: #dfbef6;
    --bg_color: #121212;
}

/* Night/Light mode switch hardcoded into the top-right corner */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--main_text_color);
}

#theme-toggle {
    position: relative;
    width: 2rem;
    height: 1.2rem;
    padding: 0;
    background: var(--bg_color);
    border: 0.1rem solid var(--border_color);
    border-radius: 999px;
    cursor: pointer;
}

#theme-toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0.1rem;
    width: 0.8rem;
    height: 0.8rem;
    transform: translateY(-50%);
    border-radius: 50%;
    background: var(--bold_color);
    transition: left 0.15s;
}

html[data-theme="dark"] #theme-toggle {
    background: var(--bold_color);
    border-color: var(--bold_color);
}

html[data-theme="dark"] #theme-toggle::after {
    left: calc(100% - 0.9rem);
    background: var(--bg_color);
}

/* Base */
* {
    box-sizing: border-box;
}

a {
    color: var(--link_color);
    text-decoration: none;
}

a:hover span {
    font-weight: bold;
}

body {
    margin: 0;
    font:
        400 16px/1.55 "Inter",
        system-ui,
        Arial,
        sans-serif;
    color: var(--main_text_color);
    background: var(--bg_color);
}

/* 2/3 for experience + education + publications, 1/3 for aside info */
.cv {
    max-width: 120ch;
    margin: 2rem auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 5rem;
}

/* For phones */
@media (width <= 700px) {
    .cv {
        grid-template-columns: 1fr;
        margin: 2rem 2rem;
        gap: 5rem;
    }

    /* Stack the photo above the text to avoid overflows */
    header .intro {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    header .intro .photo {
        justify-self: center;
    }
}

header {
    grid-column: 1 / -1; /* Cover both columns */
}

/* Photo next to the name, centred */
header .intro {
    display: grid;
    grid-template-columns: auto 1fr; /* Vertically to photo, horizontally all width */
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.photo {
    width: 200px;
    height: 200px;
    border-radius: 0.5em;
    border: 0.15rem solid var(--main_text_color);
}

header .intro h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: 0.04rem;
}

header .intro p {
    color: var(--secondary_text_color);
}

/* Section navigation bar */
header nav.menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    border-top: 0.1rem solid var(--border_color);
    border-bottom: 0.1rem solid var(--border_color);
    padding: 0.75rem 0;
    margin-top: 1rem;
}

h2 {
    font-size: 1.25rem;
    letter-spacing: 0.12em;
    color: var(--bold_color);
    border-bottom: 1px solid var(--border_color);
    padding-bottom: 0.25rem;
    margin: 2rem 0 0.75rem;
}

section {
    margin-bottom: 1.25rem;
}

section h3 {
    margin: 0;
    font-size: 1rem;
}

/* Extra details in two columns */
section .extra_details {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    color: var(--secondary_text_color);
    font-size: 0.9rem;
    font-style: italic;
}

section p {
    margin: 0.35rem 0 0;
}

aside ul {
    list-style: none;
    margin: 0;
    padding: 1em;
}

aside li {
    padding: 0.2rem 0;
}

aside li::before {
    content: "• ";
    color: var(--bold_color);
}
