/* ==========================================================================
   Hugo Louiso — personal website
   Self-hosted fonts (SIL Open Font License, see fonts/LICENSE-*.txt)
   ========================================================================== */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/newsreader-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/newsreader-latin-400-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/inter-latin-500-normal.woff2") format("woff2");
}

/* --------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg: #faf9f6;
  --glow: rgba(30, 79, 145, 0.085);
  --surface: #ffffff;
  --text: #1b1a18;
  --text-2: #4a4843;
  --muted: #7b776f;
  --line: #e5e1d9;
  --line-strong: #cfc9be;
  --accent: #1e4f91;
  --accent-hover: #16407a;
  --accent-soft: rgba(30, 79, 145, 0.08);
  --on-accent: #ffffff;
  --selection-bg: #1e4f91;
  --selection-fg: #ffffff;
  --shadow: 0 1px 2px rgba(20, 18, 14, 0.05);

  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --date-w: 7rem;
  --rail-w: 1.75rem;
}

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

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(70rem 32rem at 50% -14rem, var(--glow), transparent 70%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}

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

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

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

img {
  display: block;
  max-width: 100%;
}

svg {
  display: block;
}

.page {
  width: min(56rem, 100% - 3rem);
  margin: 0 auto;
  padding: 5.5rem 0 3.5rem;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding-bottom: 3.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 3.5rem;
}

.identity {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 2.25rem;
}

.portrait {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--line-strong);
}

h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.5rem, 6vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--text);
}

.role {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--text-2);
}

.intro p {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  line-height: 1.7;
  text-align: justify;
  hyphens: auto;
}

.intro p:last-child {
  margin-bottom: 0;
}

.nowrap {
  white-space: nowrap;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 2rem;
}

.pill {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.pill svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.pill-email {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pill-hint {
  margin-left: 0.15rem;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section + .section {
  margin-top: 3.5rem;
}

h2 {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 0 0 1.5rem;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text);
}

h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Research interests ------------------------------------------------------ */

.interests {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2.5rem;
}

.interests li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
}

.interests li::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-1px);
}

/* Dated entries (timeline + papers) -------------------------------------- */

.timeline,
.papers {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry {
  position: relative;
  display: grid;
  grid-template-columns: var(--date-w) minmax(0, 1fr);
  padding-bottom: 1.75rem;
}

.entry:last-child {
  padding-bottom: 0;
}

.entry-date {
  padding-top: 0.2rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.entry-body {
  padding-left: var(--rail-w);
}

.entry-title {
  margin: 0;
  font-weight: 500;
  color: var(--text);
}

.entry-place,
.entry-note {
  margin: 0.2rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--muted);
}

.entry-note .label {
  color: var(--text-2);
}

.sep {
  margin: 0 0.4rem;
  color: var(--line-strong);
}

/* Timeline rail: a hairline with a dot per entry */

.timeline .entry::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--date-w) + 4px);
  width: 1px;
  background: var(--line-strong);
}

.timeline .entry::after {
  content: "";
  position: absolute;
  top: 0.6rem;
  left: var(--date-w);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}

.timeline .entry:first-child::before {
  top: 0.6rem;
}

.timeline .entry:last-child::before {
  bottom: auto;
  height: 0.6rem;
}

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

.paper-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.paper-title a {
  color: var(--text);
  text-decoration: none;
}

.paper-title a:hover {
  color: var(--accent);
}

.paper-authors {
  margin: 0.45rem 0 0;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.paper-authors .me {
  font-weight: 500;
  color: var(--text);
}

.paper-venue {
  margin: 0.15rem 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chip svg {
  width: 0.7rem;
  height: 0.7rem;
}

.chip:hover {
  background: var(--accent);
  color: var(--on-accent);
}

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

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 4.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--muted);
}

.footer p {
  margin: 0;
}

.footer .place {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 40rem) {
  :root {
    --date-w: 0px;
  }

  .page {
    width: min(56rem, 100% - 2rem);
    padding-top: 3.5rem;
  }

  .identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
  }

  .portrait {
    width: 96px;
    height: 96px;
  }

  .role {
    font-size: 1.25rem;
  }

  .intro p {
    font-size: 1.0625rem;
    text-align: left;
    hyphens: manual;
    text-wrap: pretty;
  }

  .hero {
    padding-bottom: 2.5rem;
    margin-bottom: 2.75rem;
  }

  .section + .section {
    margin-top: 2.75rem;
  }

  .interests {
    grid-template-columns: 1fr;
  }

  .entry {
    grid-template-columns: 1fr;
  }

  .entry-date {
    padding-top: 0;
    padding-left: var(--rail-w);
    margin-bottom: 0.2rem;
  }

  .papers .entry-date {
    padding-left: 0;
  }

  .papers .entry-body {
    padding-left: 0;
  }

  .entry-place > span {
    display: block;
  }

  .entry-place .sep {
    display: none;
  }

  .timeline .entry::after {
    top: 0.3rem;
  }

  .timeline .entry:first-child::before {
    top: 0.3rem;
  }

  .timeline .entry:last-child::before {
    height: 0.3rem;
  }
}

/* --------------------------------------------------------------------------
   Preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .page {
    width: auto;
    padding: 0;
  }

  .pill,
  .chip {
    box-shadow: none;
    border: 1px solid #999;
    background: none;
  }
}
