/* Look and layout follow "Future Imperfect" by HTML5 UP (html5up.net,
   CC BY 3.0), rewritten as a small stylesheet with no scripts or icon
   fonts. The credit in each page footer is required by that license. */

/* ─── Settings ─── */
:root {
    --bg: #f4f4f4;
    --card: #ffffff;
    --text: #646464;
    --heading: #3c3b3b;
    --muted: #aaaaaa;
    --accent: #2ebaae;
    --line: rgba(160, 160, 160, 0.3);
    --dotted: rgba(160, 160, 160, 0.65);
    --header-h: 3.5em;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Source Sans 3", "Source Sans Pro", Helvetica, sans-serif;
    font-size: 12pt;
    font-weight: 400;
    line-height: 1.75;
    padding-top: var(--header-h);
    -webkit-text-size-adjust: none;
}

@media screen and (min-width: 1681px) {
    body { font-size: 14pt; }
}

a {
    color: inherit;
    text-decoration: none;
    border-bottom: dotted 1px var(--dotted);
    transition: color 0.2s ease, border-bottom-color 0.2s ease;
}

a:hover, a:focus {
    color: var(--accent);
    border-bottom-color: transparent;
}

strong, b { color: var(--heading); font-weight: 700; }

p { margin: 0 0 2em 0; }

h1, h2, h3, h4, h5, h6 {
    color: var(--heading);
    font-family: "Raleway", Helvetica, sans-serif;
    font-weight: 800;
    letter-spacing: 0.25em;
    line-height: 1.65;
    margin: 0 0 1em 0;
    text-transform: uppercase;
}

h2 { font-size: 1.1em; }
h3 { font-size: 0.9em; }

h1 a, h2 a, h3 a { border-bottom: 0; }

ul {
    list-style: disc;
    margin: 0 0 2em 0;
    padding-left: 1em;
}

ul li { padding-left: 0.5em; }

/* ─── Top bar ─── */
#header {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    width: 100%;
    height: var(--header-h);
    line-height: var(--header-h);
    background: var(--card);
    border-bottom: solid 1px var(--line);
}

#header h1 {
    margin: 0;
    font-size: 1em;
    line-height: inherit;
    padding: 0 1.5em;
    white-space: nowrap;
    border-right: solid 1px var(--line);
}

#header h1 a { font-size: 0.7em; }

#header .links {
    flex: 1;
    min-width: 0;
    padding-left: 1.5em;
    overflow-x: auto;
    white-space: nowrap;
}

#header .links ul {
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

#header .links li {
    padding: 0 0 0 1em;
    margin-left: 1em;
    border-left: solid 1px var(--line);
    line-height: 1;
}

#header .links li:first-child {
    padding-left: 0;
    margin-left: 0;
    border-left: 0;
}

#header .links a {
    border-bottom: 0;
    font-family: "Raleway", Helvetica, sans-serif;
    font-size: 0.7em;
    font-weight: 400;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

#header .links a[aria-current="page"] {
    color: var(--heading);
    font-weight: 800;
}

/* ─── Page layout ─── */
/* The sidebar follows the main content in the markup, so phones and
   screen readers reach the content first; row-reverse puts it on the left. */
#wrapper {
    display: flex;
    flex-direction: row-reverse;
    width: 90em;
    max-width: 100%;
    margin: 0 auto;
    padding: 3em;
}

#main {
    flex: 1;
    min-width: 0;
}

#sidebar {
    flex: 0 0 22em;
    margin-right: 3em;
}

@media screen and (min-width: 1681px) {
    #wrapper { padding: 4.5em; }
}

/* ─── Cards ─── */
.post {
    position: relative;
    margin: 0 0 3em 0;
    padding: 3em 3em 1em 3em;
    background: var(--card);
    border: solid 1px var(--line);
}

/* Two-column card: section title on the left, items on the right. */
.post .row {
    display: grid;
    grid-template-columns: 3fr 9fr;
    column-gap: 2em;
}

.post .row > h3 { margin-top: 0.2em; }

/* ─── Profile card (home page) ─── */
.profile {
    margin-bottom: 1.5em;
    padding: 2.5em 2em 2em 2em;
    text-align: center;
}

.profile .photo {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 1.5em auto;
}

/* Letter-spacing adds space after the last letter; the matching left
   padding keeps centred headings visually centred. */
.profile h2 {
    margin-bottom: 0.4em;
    padding-left: 0.25em;
    font-size: 1.4em;
    font-weight: 900;
}

.profile p {
    margin: 0 0 1.5em 0;
    padding-left: 0.2em;
    font-family: "Raleway", Helvetica, sans-serif;
    font-size: 0.7em;
    letter-spacing: 0.2em;
    line-height: 2.2;
    text-transform: uppercase;
}

.profile .icons {
    justify-content: center;
    margin: 0;
}

#sidebar > .copyright { text-align: center; }

/* Home page, side by side: the profile card and the intro card share one
   height, so their top and bottom edges line up. The photo scales to
   fit whatever height the intro text leaves it, without being cropped. */
@media screen and (min-width: 737px) {
    .home #main,
    .home #sidebar {
        display: flex;
        flex-direction: column;
    }

    .home #main > .post { flex: 1 0 auto; }

    .home .profile {
        display: flex;
        flex: 1 0 auto;
        flex-direction: column;
        align-items: center;
        margin-bottom: 0;
        container-type: inline-size;
    }

    .home .profile .photo {
        flex: 1 1 0;
        min-height: 10em;
        /* Never taller than the photo's own 4:5 shape at the card's width. */
        max-height: min(375px, 125cqw);
        object-fit: contain;
    }

    /* The credit fills the band left by the intro card's bottom margin
       (3em of body text; this line is set at 0.55em). */
    .home #sidebar > .copyright {
        flex: none;
        box-sizing: border-box;
        height: calc(3em / 0.55);
        padding-top: calc(1.5em / 0.55);
    }
}

/* ─── Icons and credit ─── */
.icons {
    display: flex;
    gap: 1.25em;
    margin: 0 0 1.25em 0;
    padding: 0;
    list-style: none;
}

.icons li { padding: 0; }

.icons a {
    display: inline-flex;
    border-bottom: 0;
    color: var(--muted);
}

.icons a:hover, .icons a:focus { color: var(--accent); }

.icons svg {
    width: 1.15em;
    height: 1.15em;
    fill: currentColor;
}

.copyright {
    margin: 0;
    color: var(--muted);
    font-family: "Raleway", Helvetica, sans-serif;
    font-size: 0.55em;
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

/* Pages without the sidebar put the footer centred under the cards. */
#main > #footer {
    padding: 1em 0 2em 0;
    text-align: center;
}

#main > #footer .icons { justify-content: center; }

/* ─── Content items ─── */
.paper { margin-bottom: 1.5em; }

.paper-title {
    color: var(--heading);
    font-weight: 700;
}

.paper .venue { font-style: italic; }

.paper .links { margin-top: 0.15em; }
.paper .links a { margin-right: 1em; }

.paper .abstract {
    display: none;
    margin: 0.75em 0 0 0;
    padding-left: 1em;
    border-left: solid 2px var(--line);
}

.paper .abstract.is-open { display: block; }

/* ─── Narrower windows: profile on top, cards below ─── */
/* Medium windows: keep the two columns, with a slimmer profile card. */
@media screen and (max-width: 1280px) {
    #sidebar {
        flex-basis: clamp(16em, 25vw, 22em);
        margin-right: 2em;
    }

    .profile { padding: 2em 1.5em 1.5em 1.5em; }

    .profile h2 { font-size: 1.1em; }

    .profile p {
        font-size: 0.65em;
        letter-spacing: 0.15em;
    }
}

@media screen and (max-width: 736px) {
    :root { --header-h: 2.75em; }

    #header h1 { padding: 0 1em; }

    #header .links { padding-left: 1em; }

    /* Phones: stack everything in one column. The profile card and the
       credit join that column: card first, credit after the intro. */
    #wrapper {
        flex-direction: column;
        padding: 1.5em;
    }

    #sidebar { display: contents; }

    .profile {
        order: -1;
        margin-bottom: 2em;
    }

    .profile h2 { font-size: 1.25em; }

    .profile p {
        font-size: 0.7em;
        letter-spacing: 0.2em;
    }

    #sidebar > .copyright { padding: 1em 0 2em 0; }

    .post {
        left: -1.5em;
        width: calc(100% + 3em);
        margin: 0 0 2em 0;
        padding: 1.5em 1.5em 0.5em 1.5em;
        border-left: 0;
        border-right: 0;
    }

    .post .row { display: block; }
}

/* Very narrow phones: put the page links on their own row. */
@media screen and (max-width: 480px) {
    :root { --header-h: 5.5em; }

    #header {
        flex-direction: column;
        line-height: 2.75em;
    }

    #header h1 {
        height: 2.75em;
        border-right: 0;
        border-bottom: solid 1px var(--line);
    }

    #header .links ul { height: 2.75em; }
}
