/* ============================================
   Palette — "Ink": near-white ground, deep navy
   accent. Light by default; the dark values below
   apply automatically when the visitor's OS/browser
   is set to dark mode.
   ============================================ */
:root {
    --bg: #fbfbfa;
    --bg-veil: rgba(251, 251, 250, 0.92);
    --text: #1b1f24;
    --muted: #6e757d;
    --line: #e2e4e6;
    --accent: #2f5d7c;
    --accent-soft: rgba(47, 93, 124, 0.28);
    --tint: rgba(47, 93, 124, 0.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #13171c;
        --bg-veil: rgba(19, 23, 28, 0.92);
        --text: #e4e8ec;
        --muted: #8b949e;
        --line: #262c33;
        --accent: #82b5d8;
        --accent-soft: rgba(130, 181, 216, 0.32);
        --tint: rgba(130, 181, 216, 0.09);
    }
}

/* ============================================
   Typography
   --------------------------------------------
   Crimson Pro for prose; Roboto for the logo,
   nav, and uppercase section headings, echoing
   the small-caps headings in the CV.
   ============================================ */
:root {
    --font-serif: 'Crimson Pro', Georgia, serif;
    --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Paper figures are white artwork; soften them
   against the dark ground so they don't glare. */
@media (prefers-color-scheme: dark) {
    .pub-figure {
        opacity: 0.88;
    }
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-serif);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 17px;
    transition: background-color 0.35s ease, color 0.35s ease;
}

/* Shared width for header, main, footer */
.wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 2.5rem;
}

/* ============================================
   Header Navigation
   ============================================ */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-veil);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    z-index: 1000;
    padding: 1.2rem 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 1px;
    color: var(--text);
}

nav {
    display: flex;
    gap: 2.25rem;
}

nav a {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 300;
    letter-spacing: 0.5px;
    color: var(--text);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* ============================================
   Main Content Layout
   ============================================ */
main.wrap {
    padding-top: 6rem;
}

section {
    padding: 3.5rem 0;
    border-bottom: 1px solid var(--line);
    /* Anchor jumps must clear the fixed header, or the section
       heading lands underneath it. */
    scroll-margin-top: 5rem;
}

section:last-child {
    border-bottom: none;
}

/* Section headings — small caps, matching the CV */
section h2 {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--muted);
    margin-bottom: 2.5rem;
}

/* Heading row that carries a right-aligned link. The link sits in a
   .pub-links span, so its right edge lines up with the publication
   link rows above it. */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.section-head h2 {
    margin-bottom: 0;
}

/* Inline links in prose */
main p a,
.tl-what a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-soft);
    transition: border-color 0.3s ease;
}

main p a:hover,
.tl-what a:hover {
    border-bottom-color: var(--accent);
}

/* ============================================
   Bio Section
   ============================================ */
#home {
    padding-top: 1.5rem;
}

.bio-container {
    display: grid;
    grid-template-columns: 1fr 185px;
    gap: 3rem;
    /* The photo is a little taller than the name/lede/links stack beside it,
       so centre the two rather than aligning their tops. */
    align-items: center;
}

.bio-text h1 {
    font-family: var(--font-sans);
    font-size: 38px;
    font-weight: 300;
    letter-spacing: -0.5px;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.bio-text p {
    margin-bottom: 1.5rem;
    font-size: 17px;
}

.social-links {
    display: flex;
    gap: 1.75rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.social-links a {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: none;
}

.social-links a:hover {
    opacity: 0.65;
}

.social-links .icon {
    width: 17px;
    height: 17px;
}

.profile-photo {
    width: 185px;
    height: 185px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 50%;
}

/* Icons referenced from the sprite in index.html */
.icon {
    fill: currentColor;
    flex-shrink: 0;
}

/* ============================================
   About Section
   ============================================ */
/* Matches the home bio line — both are single-sentence openers,
   and at 19px this outranked the 18px publication titles. */
.about-lede {
    font-size: 17px;
    line-height: 1.7;
    margin-bottom: 3rem;
    /* Wide enough for the sentence to sit on one line, while still
       capping the measure if the text ever grows. */
    max-width: 65ch;
}

/* Timeline / CV-style rows */
.timeline {
    display: grid;
    gap: 0;
}

.tl-item {
    display: grid;
    grid-template-columns: 125px 1fr;
    gap: 2rem;
    padding: 1.1rem 0;
    border-top: 1px solid var(--line);
    align-items: baseline;
}

.tl-item:last-child {
    border-bottom: 1px solid var(--line);
}

.tl-when {
    font-family: var(--font-sans);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 0.15rem;
}

.tl-what {
    font-size: 17px;
    line-height: 1.5;
}

.tl-where {
    display: block;
    font-size: 15px;
    color: var(--muted);
}

/* ============================================
   Publications Section
   ============================================ */
.publication {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 2rem;
    margin-bottom: 2.25rem;
    padding-bottom: 2.25rem;
    border-bottom: 1px solid var(--line);
    /* Figure sits centred against the text block rather than top-aligned,
       since entries vary in height. */
    align-items: center;
}

.publication:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* One standard figure box for every publication, so the column reads
   evenly. object-fit: contain pads rather than crops, so figures of
   any shape stay whole; the white ground matches the figures' own
   background, making the padding invisible. */
.pub-figure {
    width: 170px;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    display: block;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 2px;
    /* Breathing room so figures don't run to the border. */
    padding: 7px;
}

.pub-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 0.4rem;
    line-height: 1.45;
}

.pub-authors {
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

/* Own name emphasised so author position reads at a glance. Colour
   rather than weight: bold at this size read as a second title, while
   weight alone against the muted line was too faint. This leaves the
   title as the only bold element in the entry. */
.pub-authors strong {
    font-weight: 400;
    color: var(--text);
}

.pub-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.35rem 1.5rem;
}

.pub-venue {
    font-style: italic;
    font-size: 16px;
    color: var(--accent);
}

.pub-links {
    display: flex;
    gap: 1.25rem;
    flex-shrink: 0;
}

.pub-links a {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: opacity 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.pub-links a:hover {
    opacity: 0.65;
}

.pub-links .icon {
    width: 15px;
    height: 15px;
}

/* ============================================
   Footer
   ============================================ */
footer.wrap {
    padding-top: 3rem;
    padding-bottom: 2rem;
}

footer p {
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-align: center;
    margin: 0;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    header {
        position: static;
        background: var(--bg);
        padding: 1rem 0;
    }

    .logo {
        display: none;
    }

    .wrap {
        padding: 0 1.5rem;
    }

    .header-content {
        justify-content: center;
    }

    main.wrap {
        padding-top: 2rem;
    }

    .bio-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .profile-photo {
        width: 100%;
        max-width: 220px;
        height: 220px;
        margin: 0 auto;
        display: block;
    }

    .publication {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .pub-figure {
        width: 100%;
        max-width: 320px;
    }

    .pub-meta {
        justify-content: flex-start;
    }

    .tl-item {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    nav {
        gap: 1.5rem;
    }

    nav a {
        font-size: 13px;
    }
}
