/* Site stylesheet (no framework). Colors live in the tokens below;
   dark mode redefines them. */

/* ------------------------------------------------------------------ */
/* Color tokens                                                        */
/* ------------------------------------------------------------------ */

:root {
    color-scheme: light;
    --bg: #ffffff;
    --text: #333333;
    --muted: #555555;
    --summary: #444444;
    --link: #337ab7;
    --link-hover: #23527c;
    --border: #dddddd;
    --surface: #f5f5f5;        /* BibTeX blocks */
    --surface-alt: #f2f2f2;    /* footer, language badges */
    --card: #ffffff;           /* cards, dialogs, buttons */
    --chip-bg: #eef4fa;        /* keyword tags */
    --chip-text: #2a6496;
    --accent: #337ab7;         /* timeline dots, date badges */
    --accent-text: #ffffff;
    --timeline-line: #d6e4f2;
    --nav-bg: #222222;
    --nav-border: #080808;
    --nav-text: #9d9d9d;
    --nav-text-hover: #ffffff;
    --nav-active-bg: #080808;
    --focus: #66afe9;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #15171c;
        --text: #e3e5e8;
        --muted: #a9afb8;
        --summary: #c9cdd3;
        --link: #74aee8;
        --link-hover: #a3c9f1;
        --border: #343842;
        --surface: #1f2228;
        --surface-alt: #1b1e23;
        --card: #1b1e23;
        --chip-bg: #1f2e3e;
        --chip-text: #a3c9f1;
        --accent: #74aee8;
        --accent-text: #0d1117;
        --timeline-line: #2c3b4d;
        --nav-bg: #0d0e11;
        --nav-border: #000000;
        --nav-text: #a9afb8;
        --nav-text-hover: #ffffff;
        --nav-active-bg: #000000;
        --focus: #74aee8;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #15171c;
    --text: #e3e5e8;
    --muted: #a9afb8;
    --summary: #c9cdd3;
    --link: #74aee8;
    --link-hover: #a3c9f1;
    --border: #343842;
    --surface: #1f2228;
    --surface-alt: #1b1e23;
    --card: #1b1e23;
    --chip-bg: #1f2e3e;
    --chip-text: #a3c9f1;
    --accent: #74aee8;
    --accent-text: #0d1117;
    --timeline-line: #2c3b4d;
    --nav-bg: #0d0e11;
    --nav-border: #000000;
    --nav-text: #a9afb8;
    --nav-text-hover: #ffffff;
    --nav-active-bg: #000000;
    --focus: #74aee8;
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding-top: 70px; /* room for the fixed navbar */
    font-family: 'Ubuntu', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.42857;
    color: var(--text);
    background-color: var(--bg);
    /* keep the footer at the bottom of the window on short pages */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#main-container {
    flex: 1 0 auto;
}

h1, h2, h3 {
    margin: 20px 0 10px;
    line-height: 1.1;
    color: inherit;
}

h1, h2 {
    font-family: 'Oswald', Helvetica, Arial, sans-serif;
    font-weight: 400;
}

h1 { font-size: 36px; }
h2 { font-size: 30px; }
h3 { font-size: 24px; font-weight: 500; }

p {
    margin: 0 0 10px;
}

ul, ol {
    margin: 0 0 10px;
}

ul ul, ul ol, ol ul, ol ol {
    margin-bottom: 0;
}

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

a:hover,
a:focus {
    color: var(--link-hover);
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

img {
    max-width: 100%;
    vertical-align: middle;
    border: 0;
}

button {
    font: inherit;
}

pre {
    margin: 0 0 10px;
    padding: 9.5px;
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.42857;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: auto;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.container {
    width: 100%;
    max-width: 970px;
    margin-right: auto;
    margin-left: auto;
    padding-right: 15px;
    padding-left: 15px;
}

.local-container {
    margin-bottom: 50px;
}

/* ------------------------------------------------------------------ */
/* Navbar                                                              */
/* ------------------------------------------------------------------ */

.site-nav {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
}

.nav-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-height: 50px;
}

.nav-brand {
    margin-right: auto;
    padding: 9px 0;
    font-family: 'Oswald', Helvetica, Arial, sans-serif;
    font-size: 1.9em;
    line-height: 32px;
    letter-spacing: -1px;
    color: var(--nav-text);
}

.nav-brand:hover,
.nav-brand:focus {
    color: var(--nav-text-hover);
    text-decoration: none;
}

.nav-links {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-links a {
    display: block;
    padding: 15px;
    line-height: 20px;
    color: var(--nav-text);
}

.nav-links a:hover,
.nav-links a:focus {
    color: var(--nav-text-hover);
    text-decoration: none;
}

.nav-links .active a {
    color: var(--nav-text-hover);
    background-color: var(--nav-active-bg);
}

.theme-toggle,
.nav-toggle {
    padding: 6px 8px;
    color: var(--nav-text);
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
}

.theme-toggle {
    margin-left: 8px;
}

.theme-toggle:hover,
.theme-toggle:focus {
    color: var(--nav-text-hover);
}

.theme-toggle .icon {
    width: 18px;
    height: 18px;
}

/* show the moon in light mode (switch to dark), the sun in dark mode */
.icon-sun { display: none; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun { display: inline-block; }
    :root:not([data-theme="light"]) .icon-moon { display: none; }
}

:root[data-theme="dark"] .icon-sun { display: inline-block; }
:root[data-theme="dark"] .icon-moon { display: none; }

.nav-toggle {
    display: none;
    margin-left: 8px;
    padding: 9px 10px;
    border-color: #333;
}

.nav-toggle:hover,
.nav-toggle:focus {
    background-color: #333;
}

.nav-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #fff;
    border-radius: 1px;
}

.nav-toggle .icon-bar + .icon-bar {
    margin-top: 4px;
}

@media (max-width: 767px) {
    .nav-toggle {
        display: block;
    }

    /* the menu folds into a full-width row below the bar */
    .nav-menu {
        display: none;
        order: 3;
        flex-basis: 100%;
        border-top: 1px solid #101010;
    }

    .nav-menu.open {
        display: block;
    }

    .nav-links {
        flex-direction: column;
        padding: 7px 0;
    }

    .nav-links a {
        padding: 10px 15px;
    }
}

/* ------------------------------------------------------------------ */
/* Home page                                                           */
/* ------------------------------------------------------------------ */

.intro {
    overflow: hidden;
}

.img-avatar {
    display: block;
    width: 110px;
    margin-right: auto;
    margin-left: auto;
    border-radius: 50%;
}

.intro .img-avatar {
    float: right;
    margin: 20px 0 10px 20px;
}

/* the intro's heading, next to the photo */
.intro .tagline {
    font-size: 30px;
    line-height: 1.3;
    margin: 20px 0 15px;
}

@media (max-width: 480px) {
    .intro .tagline {
        font-size: 24px;
    }
}

/* ------------------------------------------------------------------ */
/* Publications                                                        */
/* ------------------------------------------------------------------ */

/* Don't use class names like "pub-text": "pub" means advertising in French,
   and the Liste FR ad-block filter (##.pub-text) hides such elements. */

.publications {
    padding-left: 0;
    list-style-type: none;
}

.publications li {
    margin-bottom: 15px;
}

/* Figure + text side by side as table cells: the same technique as
   Bootstrap 3's "media" object, which displayed correctly everywhere. */
.publication.has-figure,
.paper-body {
    overflow: hidden;
}

.paper-thumb,
.paper-body {
    display: table-cell;
    vertical-align: top;
}

.paper-thumb {
    padding-right: 10px;
}

.paper-body {
    width: 10000px; /* take all remaining space (Bootstrap's media-body trick) */
}

/* entries without a figure line up with those that have one
   (figure 150px + 10px gap) */
.publications .publication:not(.has-figure) {
    padding-left: 160px;
}

.paper-figure {
    width: 150px;
    max-width: none;
    height: auto;
    padding: 3px;
    background: #fff; /* figures are drawn on white, in both themes */
    border: 1px solid var(--border);
}

.paper-figure-link {
    cursor: zoom-in;
}

/* Phones: the figure goes above the text so the text gets the full width */
@media (max-width: 480px) {
    .publication.has-figure,
    .paper-thumb,
    .paper-body {
        display: block;
        width: auto;
    }

    .paper-thumb {
        margin-bottom: 8px;
        padding-right: 0;
    }

    .publications .publication:not(.has-figure) {
        padding-left: 0;
    }

    .paper-figure {
        width: 220px;
        max-width: 100%; /* safe here: the single grid column has a fixed width */
    }
}

.paper-summary {
    margin: 6px 0 4px;
    color: var(--summary);
}

.paper-keywords {
    margin: 0;
}

.paper-keyword {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 1px 8px;
    font-size: 0.85em;
    color: var(--chip-text);
    background: var(--chip-bg);
    border-radius: 10px;
}

/* BibTeX toggle */
.paper-bibtex {
    position: relative;
    margin-top: 4px;
}

.paper-bibtex summary {
    display: inline-block;
    cursor: pointer;
    color: var(--link);
    font-size: 0.9em;
}

.paper-bibtex pre {
    margin: 6px 0 0;
    padding-right: 70px;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: normal;
    overflow-x: auto;
}

.copy-bibtex {
    position: absolute;
    top: 32px;
    right: 8px;
    padding: 2px 10px;
    font-size: 12px;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}

/* Figure zoom (lightbox) */
.lightbox {
    width: min(92vw, 820px);
    max-height: 92vh;
    padding: 16px 16px 12px;
    color: var(--text);
    background: var(--card);
    border: none;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.75);
}

.lightbox figure {
    margin: 0;
}

.lightbox img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(92vh - 90px);
    object-fit: contain;
    background: #fff;
}

.lightbox figcaption {
    margin-top: 10px;
    padding-right: 30px;
    color: var(--text);
}

.lightbox-close {
    position: absolute;
    top: 6px;
    right: 8px;
    padding: 0 8px;
    font-size: 28px;
    line-height: 1;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: var(--text);
}

/* ------------------------------------------------------------------ */
/* About page: timeline and software cards                             */
/* ------------------------------------------------------------------ */

.timeline {
    position: relative;
    margin: 10px 0 25px;
    padding-left: 0;
    list-style: none;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 7px;
    width: 2px;
    background: var(--timeline-line);
}

.timeline-item {
    position: relative;
    padding-left: 34px;
    margin-bottom: 20px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 1px;
    width: 14px;
    height: 14px;
    border: 3px solid var(--accent);
    border-radius: 50%;
    background: var(--bg);
}

/* filled dot = current role */
.timeline-current .timeline-item:first-child::before {
    background: var(--accent);
}

.timeline-date {
    display: inline-block;
    margin-bottom: 4px;
    padding: 1px 10px;
    font-size: 0.85em;
    font-weight: bold;
    color: var(--accent-text);
    background: var(--accent);
    border-radius: 10px;
}

.timeline-title {
    font-weight: bold;
}

.timeline-org {
    color: var(--muted);
}

.timeline-detail p {
    margin: 4px 0 0;
}

.software-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 10px 0 25px;
}

.software-card {
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.software-card h3 {
    margin: 0 0 8px;
    font-family: 'Oswald', Helvetica, Arial, sans-serif;
    font-size: 20px;
    font-weight: 400;
}

.software-card p {
    margin: 0 0 8px;
}

.software-langs {
    margin: 0;
}

.lang-badge {
    display: inline-block;
    margin: 2px 4px 0 0;
    padding: 1px 8px;
    font-size: 0.85em;
    color: var(--summary);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

#site-footer {
    margin-top: 30px;
    padding: 20px 0 15px;
    background-color: var(--surface-alt);
    border-top: 1px solid var(--border);
}

.footer-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.footer-name {
    font-family: 'Oswald', Helvetica, Arial, sans-serif;
    font-size: 1.4em;
    color: var(--text);
}

.social {
    display: flex;
    gap: 18px;
}

.social a {
    color: var(--muted);
}

.social a:hover,
.social a:focus {
    color: var(--link);
}

.icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    vertical-align: middle;
}

.footer-legal {
    margin: 12px 0 0;
    font-size: 0.9em;
    color: var(--muted);
}

/* the footer background is slightly darker, so use the darker link shade */
.footer-legal a {
    color: var(--link-hover);
}
