/* ==========================================================================
   hugo-lopez.github.io
   One page: an identity sidebar beside a research column. No build step.
   ========================================================================== */

/* ---------- Colours and type ---------- */

/* One palette for every visitor: a near-black page with cream text. Maroon is
   too dark to read as text on this background, so it is used as a fill (the CV
   button, the section rules, selected text) and links and labels are cream. */

:root {
  --bg: #151412;
  --surface: #1f1d1a;           /* behind the photo while it loads */
  --text: #ece8df;
  --text-2: #c6c1b5;
  --muted: #9c968a;
  --rule: #34312b;
  --accent: #ece8df;            /* links and section labels */
  --accent-fill: #7a161b;       /* maroon: the CV button */
  --accent-fill-hover: #8f1c22;
  --on-accent: #f6f1e8;         /* text placed on maroon */
  --section-rule: #7a161b;      /* maroon line beside each section label */

  /* One typeface for all text: San Francisco on Apple devices. Apple does not
     allow it to be bundled with a website, so other devices show their own
     system font instead (Segoe UI on Windows, Roboto on Android). */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: dark;
}

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection {
  background: var(--accent-fill);
  color: var(--on-accent);
}

/* Keeps a short run, such as a page range, on one line. */
.nowrap {
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: -100rem;
  padding: 0.5rem 0.8rem;
  border-radius: 0.4rem;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: 0.875rem;
  text-decoration: none;
}

.skip-link:focus {
  left: 0.75rem;
  z-index: 10;
}

/* ---------- Layout ---------- */

.page {
  display: grid;
  /* The text column is wide enough for the longest paper title to sit on one line. */
  grid-template-columns: 15rem minmax(0, 48.5rem);
  column-gap: 4.5rem;
  justify-content: center;
  max-width: 74rem;
  margin: 0 auto;
  padding: 4.5rem 2.5rem 5rem;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 4.5rem;
  align-self: start;
}

/* In a short window the pinned sidebar is taller than the screen and its lower
   part (email, CV button) is cut off, so there it scrolls with the page. */
@media (max-height: 36rem) {
  .sidebar {
    position: static;
  }
}

.portrait {
  display: block;
  width: 13rem;
  height: 13rem;
  object-fit: cover;
  border-radius: 0.625rem;
  background: var(--surface);
}

.name {
  margin: 1.4rem 0 0.45rem;
  font-size: 2.125rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.role {
  margin: 0;
  color: var(--text-2);
  line-height: 1.45;
}

.role .org {
  display: block;
  color: var(--muted);
}

.contact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
  margin-top: 1.3rem;
  font-size: 0.875rem;
}

.email {
  text-decoration: none;
}

.email:hover {
  text-decoration: underline;
}

.button {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent-fill);
  border-radius: 0.4rem;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.button:hover {
  border-color: var(--accent-fill-hover);
  background: var(--accent-fill-hover);
}

/* ---------- Main column ---------- */

.lead {
  margin: 0;
  font-size: 1.3125rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.content > section {
  margin-top: 3.25rem;
}

/* Section label with a rule running to the right, like the headings on the CV. */
.section-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.5rem;
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Drawn as a border, not a background, so browsers snap it to whole pixels
   and every rule shows the same maroon. */
.section-title::after {
  content: "";
  flex: 1;
  height: 0;
  border-top: 1px solid var(--section-rule);
}

/* ---------- Papers ---------- */

.paper + .paper {
  margin-top: 2.25rem;
}

.paper-title {
  margin: 0;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.paper-authors,
.paper-venue {
  margin: 0.4rem 0 0;
  color: var(--text-2);
}

.paper-venue {
  margin-top: 0.1rem;
}

.paper-authors a {
  color: inherit;
  text-decoration-color: var(--rule);
}

.paper-authors a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* Under each paper: a row of links to its versions. */
.paper-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.35rem;
  margin-top: 0.8rem;
  font-size: 0.84375rem;
  font-weight: 600;
  line-height: 1.6;
}

.paper-links a {
  text-decoration: none;
}

.paper-links a:hover {
  text-decoration: underline;
}

/* ---------- Narrow screens: sidebar becomes a compact header ---------- */

@media (max-width: 54rem) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 2.25rem;
    max-width: 42rem;
    padding: 2.25rem 1.25rem 3.5rem;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 5.75rem minmax(0, 1fr);
    column-gap: 1.1rem;
  }

  .portrait {
    grid-row: 1 / span 2;
    width: 5.75rem;
    height: 5.75rem;
  }

  .name {
    grid-column: 2;
    align-self: end;
    margin: 0 0 0.2rem;
    font-size: 1.75rem;
  }

  .role {
    grid-column: 2;
    align-self: start;
    font-size: 1rem;
  }

  .contact {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-top: 1.1rem;
  }

  .lead {
    font-size: 1.1875rem;
  }

  .content > section {
    margin-top: 2.75rem;
  }

  .paper-title {
    font-size: 1.125rem;
  }
}

/* ---------- Motion and print ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* On paper the page is dark text on white. */
@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --text: #000;
    --text-2: #222;
    --muted: #444;
    --rule: #bbb;
    --accent: #000;
    --section-rule: #999;
    color-scheme: light;
  }

  body {
    font-size: 11pt;
  }

  .skip-link {
    display: none !important;
  }

  .button {
    border-color: #000;
    background: none;
    color: #000;
  }

  .page {
    display: block;
    max-width: none;
    padding: 0;
  }

  .sidebar {
    position: static;
    margin-bottom: 2rem;
  }
}
