/* ---------- Fonts: Latin Modern, same family as the LaTeX CV ---------- */
@font-face { font-family: "LM Roman"; src: url("fonts/lmroman10-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "LM Roman"; src: url("fonts/lmroman10-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "LM Roman"; src: url("fonts/lmroman10-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "LM Roman"; src: url("fonts/lmroman10-bolditalic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "LM Roman Caps"; src: url("fonts/lmromancaps10-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* ---------- Theme tokens ---------- */
:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #5c5c5c;
  --faint: #8a8a8a;
  --rule: #111111;
  --hairline: #e2e2e2;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161618;
    --text: #e8e6e3;
    --muted: #a8a5a0;
    --faint: #75736f;
    --rule: #d6d3ce;
    --hairline: #2c2c30;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161618;
  --text: #e8e6e3;
  --muted: #a8a5a0;
  --faint: #75736f;
  --rule: #d6d3ce;
  --hairline: #2c2c30;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 32px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "LM Roman", "Latin Modern Roman", "CMU Serif", Georgia, serif;
  font-size: 18px;
  line-height: 1.5;
  transition: background-color .2s ease, color .2s ease;
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
ul { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
sup { line-height: 0; }
.smallcaps { font-family: "LM Roman Caps", "LM Roman", serif; font-variant: small-caps; letter-spacing: .03em; }

/* ---------- Layout: sidebar + content ---------- */
.layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 720px) 200px;
  gap: 56px;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ---------- Sidebar navigation ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 72px 0 32px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { font-size: 20px; text-decoration: none; margin-bottom: 28px; }
.nav { border-left: 1px solid var(--hairline); }
.nav a {
  display: block;
  padding: 5px 0 5px 16px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 17px;
  transition: color .15s ease, border-color .15s ease;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); border-left-color: var(--text); }
.sidebar-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; }

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 17px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease;
}
.tool:hover { border-color: var(--text); }
button.tool { padding: 0; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ---------- Content ---------- */
.content { padding: 72px 0 64px; }

.hero { display: flex; align-items: center; gap: 24px; margin-bottom: 56px; }
.cv-download { margin: -20px 0 28px; }
.cv-download a { display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; color: var(--muted); text-decoration: none; }
.cv-download a:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--faint); }
.cv-download i { font-size: 13px; }
.hero img { width: 112px; height: 112px; border-radius: 50%; flex-shrink: 0; }
.hero h1 { margin: 0; font-size: 38px; font-weight: 700; line-height: 1.1; }
.hero .title { margin-top: 4px; font-size: 20px; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: 16px; }
.links a { text-decoration: none; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.links a:hover { color: var(--text); }
.links i { font-size: 15px; }
.hf { font-size: 15px; line-height: 1; }

/* Section titles: \scshape + \titlerule, as in the CV */
section { margin-bottom: 52px; }
h2 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 16px;
  margin: 0 0 20px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
  font-family: "LM Roman Caps", "LM Roman", serif;
  font-variant: small-caps;
  font-weight: 400;
  font-size: 25px;
  letter-spacing: .03em;
}
h2 .note {
  font-family: "LM Roman", serif;
  font-variant: normal;
  font-style: italic;
  font-size: 14px;
  letter-spacing: 0;
  color: var(--muted);
}

/* ---------- Entries ---------- */
.entry + .entry { margin-top: 26px; }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.entry-title { font-weight: 700; }
.entry-sub { font-style: italic; }
.date { font-style: italic; font-size: 15px; white-space: nowrap; color: var(--muted); }
.meta { font-size: 16px; color: var(--muted); margin-top: 2px; }
.meta .me { color: var(--text); font-weight: 700; }
.venue { font-size: 16px; margin-top: 2px; }
.desc { margin-top: 6px; font-size: 16.5px; }

.items { margin-top: 6px; font-size: 16.5px; }
.items > li { position: relative; padding-left: 18px; }
.items > li + li { margin-top: 3px; }
.items > li::before { content: "\2013"; position: absolute; left: 0; color: var(--muted); }

.star { font-size: 1.1em; line-height: 0; vertical-align: .3em; margin-left: 1px; }

/* Links: in the right-hand column, next to each entry */
.entry { position: relative; }
.entry-links {
  position: absolute;
  top: 3px;
  left: calc(100% + 56px);
  width: 200px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14.5px;
  line-height: 1.45;
}
.entry-links a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.entry-links a:hover { color: var(--text); }
.entry-links i, .entry-links .hf { width: 14px; flex-shrink: 0; text-align: center; font-size: 12px; }
.entry-links .ai { font-size: 14px; }

/* ---------- Skills & hobbies ---------- */
.skills { display: grid; grid-template-columns: 190px 1fr; gap: 6px 20px; margin: 0; font-size: 16.5px; }
.skills dt { font-weight: 700; }
.skills dd { margin: 0; }
.hobbies { font-size: 16.5px; }

footer { padding-top: 20px; border-top: 1px solid var(--hairline); font-size: 14px; color: var(--muted); }

/* ---------- Medium screens: no right column, links go inline ---------- */
@media (max-width: 1300px) {
  .layout { grid-template-columns: 200px minmax(0, 760px); max-width: 1080px; }
  .entry-links { position: static; width: auto; flex-direction: row; flex-wrap: wrap; gap: 2px 18px; margin: 4px 0 2px; }
}

/* ---------- Tablet & phone: nav becomes a top bar ---------- */
@media (max-width: 960px) {
  .layout { display: block; padding: 0 16px; }
  .sidebar {
    z-index: 10;
    height: auto;
    padding: 10px 0;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--hairline);
  }
  .sidebar .brand { display: none; }
  .nav {
    display: flex;
    gap: 18px;
    border-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 4px 0; margin: 0; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 16px; }
  .nav a.active { border-bottom-color: var(--text); }
  .sidebar-tools { margin: 0; flex-shrink: 0; order: 3; }
  .cv-download { margin: 0; flex-shrink: 0; order: 2; }
  .cv-download .label { display: none; }
  .cv-download i { font-size: 17px; }
  .content { padding-top: 40px; }
  html { scroll-padding-top: 72px; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 40px; }
  .hero img { width: 84px; height: 84px; }
  .hero h1 { font-size: 30px; }
  .entry-head { flex-direction: column; gap: 4px; }
  .skills { grid-template-columns: 1fr; gap: 0; }
  .skills dd { margin-bottom: 8px; }
}

@media print {
  .sidebar, footer { display: none; }
  .layout { display: block; }
  .content { padding: 0; }
}
