/* Helvetica Neue in thin (200) and light (300), plus regular (400) for titles, each with its
   italic. Faces are picked by exact name because the plain "Helvetica Neue" family can't reach
   Light in some browsers. It ships with Apple devices; elsewhere the fallbacks in --font apply. */
@font-face {
    font-family: "HN";
    font-weight: 200;
    src: local("HelveticaNeue-Thin"), local("Helvetica Neue Thin");
}
@font-face {
    font-family: "HN";
    font-weight: 200;
    font-style: italic;
    src: local("HelveticaNeue-ThinItalic"), local("Helvetica Neue Thin Italic");
}
@font-face {
    font-family: "HN";
    font-weight: 300;
    src: local("HelveticaNeue-Light"), local("Helvetica Neue Light");
}
@font-face {
    font-family: "HN";
    font-weight: 300;
    font-style: italic;
    src: local("HelveticaNeue-LightItalic"), local("Helvetica Neue Light Italic");
}
@font-face {
    font-family: "HN";
    font-weight: 400;
    src: local("HelveticaNeue"), local("Helvetica Neue");
}
@font-face {
    font-family: "HN";
    font-weight: 400;
    font-style: italic;
    src: local("HelveticaNeue-Italic"), local("Helvetica Neue Italic");
}

:root {
    --c0: #006aff;
    --c1: #F90B46;
    --fluro: linear-gradient(90deg, var(--c0), var(--c1));
    /* accent colour: set per list item by site.js, or per work page on <body> */
    --c: var(--c0);

    --bg: #0d0d10;
    --text: #ececf0;
    --muted: #8a8a96;
    --rule: #26262d;

    --font: "HN", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --thin: 200;
    --light: 300;
    --regular: 400;

    color-scheme: dark;
    background: var(--bg);
    /* rem base: every size and spacing scales from this */
    font-size: 17px;
}

* { box-sizing: border-box; }

::selection { background: var(--c1); color: #fff; }

body {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font: var(--thin) 18px/1.65 var(--font);
    border-top: 4px solid;
    border-image: var(--fluro) 1;
}

a { color: inherit; text-decoration: none; }
b { font-weight: var(--light); }
button { padding: 0; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; margin: 0; padding: 0; }

/* avoid lines with a single word on them */
p, .desc, .title { text-wrap: pretty; }

/* gradient text */
.name, .idx, .motto {
    background: var(--fluro);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.wall {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* top navigation, lined up with the page content rather than the screen edge */
.site-nav {
    display: flex;
    justify-content: flex-end;
    gap: 2.25rem;
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 2rem 1.5rem 0;
    font: var(--light) 1.05rem var(--font);
}
.site-nav a {
    padding-bottom: .2rem;
    color: color-mix(in srgb, var(--text) 70%, var(--bg));
    transition: color .2s;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] {
    color: var(--text);
    background: var(--fluro) left bottom / 100% 2px no-repeat;
}
/* north-east arrow on links that open in a new tab */
.site-nav a[target="_blank"]::after {
    content: "↗" / "";
    display: inline-block;
    margin-left: .15em;
    font-size: .9em;
    vertical-align: .2em;
    transition: transform .2s;
}
.site-nav a[target="_blank"]:hover::after { transform: translate(.1em, -.1em); }

/* home page: sidebar + content */
.layout {
    flex: 1;
    display: grid;
    grid-template-columns: 325px minmax(0, 775px);
    gap: 6.25rem;
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 3rem 1.5rem 5rem;
}
.side {
    position: sticky;
    top: 5rem;
    align-self: start;
}
/* photo above the name, with a gradient side bar like the papers list. It shows in grey; the
   colour copy fades in slowly while hovered and fades out quickly after. The colour layer
   ignores the pointer, so right-click / drag / save always get the grey <img> underneath. */
.portrait {
    position: relative;
    width: 15rem;
    margin-bottom: 1.75rem;
    border-left: 6px solid;
    border-image: linear-gradient(180deg, var(--c0), var(--c1)) 1;
    filter: brightness(.85);
    transition: filter .6s ease-out;
}
.portrait img { display: block; width: 100%; height: auto; }
.portrait::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("images/me-colour.jpg") center / cover;
    opacity: 0;
    pointer-events: none;
    transition: opacity .6s ease-out;
}
.portrait:hover { filter: none; transition: filter 5s ease-in; }
.portrait:hover::after { opacity: 1; transition: opacity 5s ease-in; }
.name {
    width: fit-content;
    margin: 0;
    font-size: 2.35rem;
    line-height: 1;
    font-weight: var(--regular);
    letter-spacing: -.03em;
}
.native { margin: .6rem 0 0; color: var(--muted); font-size: .9rem; }
.role { margin: 1.25rem 0 2rem; color: var(--muted); font-size: .95rem; line-height: 1.5; }

.links {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    font-weight: var(--light);
    font-size: .9rem;
}
.links > * {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: fit-content;
}
/* a pocket hold before each link, inlined so the mask also works when opened from disk */
.links > *::before {
    content: "";
    flex: none;
    width: .9em;
    height: .9em;
    background: var(--fluro);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill-rule='evenodd' d='M3 16C2 9 8 4 16 4c7 0 13 3 13 10c1 7-4 13-12 14c-8 1-13-5-14-12Z M16 13.5m-8 0a8 4.6 0 1 0 16 0a8 4.6 0 1 0-16 0Z'/%3E%3C/svg%3E")
        center / contain no-repeat;
    transition: transform .3s;
}
.links > :nth-child(2)::before { transform: rotate(12deg); }
.links > :hover::before { transform: rotate(0) scale(1.2); }

section + section { margin-top: 4rem; }

h2 {
    display: flex;
    align-items: baseline;
    gap: .9rem;
    margin: 0 0 1.25rem;
    font-size: 1.5rem;
    font-weight: var(--light);
    letter-spacing: -.01em;
}
h2::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--rule);
}
.idx { font: var(--light) .8rem var(--font); }

.content p a {
    background: var(--fluro) left bottom / 100% 2px no-repeat;
    transition: background-size .25s;
}
.content p a:hover { background-size: 100% 100%; color: #fff; }

/* papers: in the home page list and at the top of each work page */
.pubs li {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.75rem;
    padding: .25rem 0 .25rem 1.25rem;
    border-left: 3px solid var(--c);
}
.pubs .title {
    width: fit-content;
    font-size: 1.05rem;
    font-weight: var(--regular);
    transition: color .2s;
}
.pubs .title:hover { color: var(--c); }
.pubs .desc { margin-top: .2rem; color: var(--muted); font-size: .95rem; }
.pubs .authors { color: var(--muted); font-size: .95rem; }
.authors b { color: var(--text); }
.venue { font: var(--light) .8rem var(--font); color: var(--c); }
.pubs .venue { line-height: 1.9; }

/* link pills (pdf, bibtex) and the BibTeX box */
.tags { display: flex; gap: .5rem; margin-top: .4rem; }
.tags > * {
    padding: .1rem .55rem;
    font: var(--light) .75rem var(--font);
    border: 1px solid var(--rule);
    border-radius: 99px;
    transition: border-color .2s, color .2s;
}
.tags > :hover, .tags [aria-expanded="true"] { border-color: var(--c); color: var(--c); }
.bib {
    margin: .6rem 0 0;
    padding: .75rem 1rem;
    overflow-x: auto;
    font: var(--light) .72rem/1.6 var(--font);
    color: var(--muted);
    background: color-mix(in srgb, var(--text) 4%, var(--bg));
    border: 1px solid var(--rule);
    border-radius: 6px;
    user-select: all;
}

/* work pages: one write-up per paper */
.post {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 5rem;
}
.post-head { padding-left: 1.25rem; border-left: 3px solid var(--c); }
.post-head h1 {
    margin: .4rem 0 .6rem;
    font-size: 2.2rem;
    line-height: 1.15;
    font-weight: var(--regular);
    letter-spacing: -.02em;
    text-wrap: balance;
}
.post-head .authors { margin: 0; color: var(--muted); }
.post-head .tags { margin-top: 1rem; }

.post-body { margin-top: 3.5rem; }
.post-body .lede { font-size: 1.15rem; line-height: 1.6; }
.post-body h2 { margin-top: 3rem; }
.post-body li {
    position: relative;
    margin-bottom: .8rem;
    padding-left: 1.25rem;
    text-wrap: pretty;
}
.post-body li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .62em;
    width: .45rem;
    height: .45rem;
    border-radius: 50%;
    background: var(--c);
}

/* footer: pinned to the bottom of the page, spanning the full screen width */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem 2rem;
    width: 100%;
    padding: 1.5rem 2rem 2rem;
    font: var(--light) .75rem var(--font);
    color: var(--muted);
    border-top: 1px solid var(--rule);
}
.motto { text-transform: uppercase; letter-spacing: .12em; }

/* narrow screens */
@media (max-width: 1025px) {
    .site-nav { justify-content: flex-start; gap: 1.75rem; padding: 1.5rem 1rem 0; }
    .layout { grid-template-columns: minmax(0, 1fr); gap: 3rem; padding: 3rem 1rem; }
    .side { position: static; }
    .portrait { width: 12rem; }
    .name { font-size: 2.6rem; }
    .links { flex-direction: row; flex-wrap: wrap; gap: .4rem 1.1rem; }
    .post { padding: 2.5rem 1rem 3rem; }
    .post-head h1 { font-size: 1.75rem; }
    .site-footer { padding: 1.25rem 1rem 1.5rem; }
}

/* short screens: let the sidebar scroll so the links under the photo stay reachable */
@media (max-height: 760px) {
    .side { position: static; }
}
