:root {
    --bg-color: #fcfbf9;
    --text-color: #222222;
    --accent-color: #003366; /* Academic Blue */
    --light-gray: #ededed;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Charis SIL', 'XCharter', 'Charter', 'Bitstream Charter', Georgia, serif; /* Charter, as in LaTeX's XCharter */
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 15px; /* plain text size; headings are set separately in rem */
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

a { color: var(--accent-color); }

/* Fill each line: words are split with a hyphen at line ends, and lines are justified */
p, main li {
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
}

.container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

/* ---------- Header: name on the left, page links on the right ---------- */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--text-color);
    padding-bottom: 18px;
    margin-bottom: 36px;
}

h1 {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 500;
    font-size: 2.4rem;
    line-height: 1.2;
    margin: 0;
}
h1 a { color: var(--accent-color); text-decoration: none; }

nav {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
}
nav a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color .2s, border-color .2s;
}
nav a:hover { color: var(--accent-color); border-bottom-color: var(--accent-color); }
nav a[aria-current="page"] { color: var(--accent-color); border-bottom-color: var(--accent-color); }

/* ---------- Section headings ---------- */
h2 {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.7rem;
    font-weight: 500;
    margin: 0 0 16px;
    color: var(--accent-color);
}

h3 {
    font-family: 'EB Garamond', Georgia, serif;
    color: var(--accent-color);
    font-size: 1.35rem;
    font-weight: 500;
    margin: 24px 0 8px;
}

li { margin-bottom: 8px; }

/* ---------- About ---------- */
.profile-section {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 10px;
}
.profile-section p:first-of-type { margin-top: 0; }

.profile-photo {
    width: 230px;
    aspect-ratio: 3 / 4; /* matches photo.jpg, so nothing is cropped */
    background-color: var(--light-gray);
    border: 1px solid #ccc;
    flex-shrink: 0;
    overflow: hidden;
}
.profile-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Lists of items (Resources) ---------- */
main ul { margin: 0; padding-left: 1.3em; }
main ul > li { margin-bottom: 4px; }

/* Numbered list (Research): [1], [2], ... */
@counter-style brackets { system: extends decimal; prefix: "["; suffix: "]  "; }
ol.pubs { list-style: brackets; margin: 0; padding-left: 2.4em; }
ol.pubs > li { margin-bottom: 4px; }

/* Blog list: date on the left, like a bullet */
.posts { list-style: none; margin: 0; padding: 0; }
.posts li { display: grid; grid-template-columns: 9em 1fr; margin-bottom: 4px; }

/* ---------- Go-to-top button ---------- */
#toTop {
    position: fixed; right: 24px; bottom: 24px;
    width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid #ccc; background: #fff; color: var(--accent-color);
    font-size: 1.2rem; line-height: 1; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    opacity: 0; pointer-events: none; transition: opacity .25s;
}
#toTop.show { opacity: 1; pointer-events: auto; }
#toTop:hover { border-color: var(--accent-color); }

footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--light-gray);
    font-size: 0.8rem;
    color: #777;
    text-align: center;
}
footer p { text-align: center; }

@media (max-width: 600px) {
    header { flex-direction: column; align-items: flex-start; }
    h1 { font-size: 1.9rem; }
    nav { gap: 16px; }
    .profile-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}
