/* ------------------------------------------------------------------
   markomilenkovic.rs — shared stylesheet
   Paper-like, typographic, one accent colour. No framework.
   ------------------------------------------------------------------ */

:root {
  --serif: "Source Serif 4", "Source Serif Pro", Charter, "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --bg: #fbfaf7;
  --bg-sunk: #f3f1ec;
  --text: #1b1b1a;
  --muted: #625f59;
  --faint: #8d8a83;
  --rule: #e3e0d8;
  --accent: #1d4e89;
  --accent-soft: #c9d8ec;
  --figure-bg: #ffffff;

  --measure: 46rem;
  --thumb-w: 11.5rem;
  --gap: 1.6rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312;
    --bg-sunk: #1b1b19;
    --text: #e8e6e1;
    --muted: #a6a39c;
    --faint: #7a776f;
    --rule: #2c2b28;
    --accent: #8fb4e8;
    --accent-soft: #2a3e5c;
    --figure-bg: #f4f3ef;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-variant-numeric: oldstyle-nums proportional-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4.5rem 1.25rem 3rem;
}

/* ---------- links ---------- */

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color .15s;
}
a:hover, a:focus-visible { text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.skip {
  position: absolute; left: -9999px;
}
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: .4rem .7rem; z-index: 10; }

/* ---------- site nav (top, quiet) ---------- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin: -2.75rem 0 2.75rem;
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  padding-bottom: .65rem;
}
.brand:hover { color: var(--accent); }
.site-nav { display: flex; gap: 1.5rem; margin-left: auto; font-family: var(--sans); font-size: .86rem; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: .65rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.site-nav .pdf {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--faint);
  margin-left: .1rem;
}

/* calmer rag and no one-word last lines (ignored by older browsers) */
p, li { text-wrap: pretty; }
h1, h4, .paper-title, .paper-title-en { text-wrap: balance; }

/* ---------- "on this page" index ---------- */

.toc {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem 1rem;
  margin: 2.4rem 0 0;
  padding: .7rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: .8rem;
}
.toc-label {
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
}
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

section[id] { scroll-margin-top: 1.5rem; }

/* wide screens: a fixed index in the empty left margin, highlighting the current section */
@media (min-width: 76rem) {
  .toc {
    position: fixed;
    top: 7.5rem;
    left: calc(50% - 23rem - 12.5rem);
    width: 10.5rem;
    display: block;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .toc-label { display: block; margin: 0 0 .6rem .9rem; }
  .toc ol { display: block; }
  .toc a {
    display: block;
    padding: .3rem 0 .3rem .9rem;
    border-left: 2px solid var(--rule);
    line-height: 1.35;
  }
  .toc a[aria-current] { color: var(--text); border-left-color: var(--accent); }
}

/* ---------- intro ---------- */

.intro {
  display: grid;
  grid-template-columns: 1fr 10.5rem;
  gap: 2.5rem;
  align-items: start;
}

.intro h1 {
  font-weight: 600;
  font-size: 2.35rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 .35rem;
}

.intro .role {
  font-family: var(--sans);
  font-size: .86rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.5;
}

.intro p { margin: 0 0 1rem; }

.portrait {
  width: 10.5rem;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  background: var(--bg-sunk);
  display: grid;
  place-items: center;
  color: var(--faint);
  font-family: var(--sans);
  font-size: .75rem;
  margin-top: .4rem;
  border: 1px solid var(--rule);
}

.links {
  font-family: var(--sans);
  font-size: .86rem;
  margin: 1.4rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.15rem;
}
.links a { text-decoration: none; }
.links a:hover { text-decoration: underline; }

.interests {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--muted);
  margin: 1.1rem 0 0;
}
.interests { display: flex; flex-wrap: wrap; row-gap: .15rem; }
.interests span { white-space: nowrap; }
.interests span:not(:last-child)::after { content: "·"; margin: 0 .5em; color: var(--faint); }

/* ---------- sections ---------- */

section { margin-top: 3.6rem; }

h2 {
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.5rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--rule);
}

h3.sub {
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--faint);
  margin: 2.4rem 0 1.2rem;
}

.lede { color: var(--muted); margin: -0.4rem 0 1.6rem; font-size: .98rem; }

/* ---------- news ---------- */

.news { list-style: none; margin: 0; padding: 0; }
.news li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: .3rem 0;
}
.news time, .dated time {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--faint);
  font-variant-numeric: lining-nums tabular-nums;
  padding-top: .2rem;
  white-space: nowrap;
}

/* ---------- entries (papers / projects) ---------- */

.entry {
  display: grid;
  grid-template-columns: var(--thumb-w) 1fr;
  gap: var(--gap);
  align-items: start;
}
.entry + .entry { margin-top: 2.1rem; }

.thumb {
  width: var(--thumb-w);
  aspect-ratio: 3 / 2;
  background: var(--figure-bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  margin-top: .3rem;
}
.thumb img, .thumb video, .thumb canvas, .thumb svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.thumb.cover img, .thumb.cover video { object-fit: cover; }
.thumb.pad img { padding: .45rem; }

.entry h4 {
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 .3rem;
}
.entry h4 a { color: var(--text); text-decoration: none; }
.entry h4 a:hover { color: var(--accent); }

.authors { margin: 0; font-size: .95rem; }
.authors .me { font-weight: 600; }

.venue {
  margin: .1rem 0 0;
  font-size: .95rem;
  font-style: italic;
  color: var(--muted);
}

.award {
  font-family: var(--sans);
  font-style: normal;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.lang {
  font-family: var(--sans);
  font-style: normal;
  font-size: .72rem;
  color: var(--faint);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0 .3rem;
  white-space: nowrap;
}

.tldr { margin: .55rem 0 0; font-size: .95rem; }

.actions {
  font-family: var(--sans);
  font-size: .78rem;
  margin: .55rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1rem;
  align-items: baseline;
}
.actions a { text-decoration: none; }
.actions a:hover { text-decoration: underline; }

details.bib { display: contents; }
details.bib summary {
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}
details.bib summary::-webkit-details-marker { display: none; }
details.bib summary:hover { text-decoration: underline; }
details.bib pre {
  flex-basis: 100%;
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.5;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .7rem .85rem;
  margin: .4rem 0 0;
  overflow-x: auto;
  white-space: pre;
  user-select: all;
}


/* ---------- compact lists (teaching, awards) ---------- */

.dated { list-style: none; margin: 0; padding: 0; }
.dated li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: .3rem 0;
}
.dated .what { margin: 0; }
.dated .note { color: var(--muted); font-size: .95rem; }

.role-block p { margin: 0 0 .9rem; }
.role-block .role-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0 1rem;
  margin: 0;
}
.role-block .role-org { margin: 0 0 .8rem; color: var(--muted); }
.role-title { font-weight: 600; }
.role-meta {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--faint);
  font-variant-numeric: lining-nums tabular-nums;
}

ul.plain {
  margin: .4rem 0 0;
  padding-left: 1.1rem;
}
ul.plain li { margin: .25rem 0; }
ul.plain li::marker { color: var(--faint); }

.also { font-size: .95rem; color: var(--muted); margin-top: 2rem; }

a.mat {
  font-family: var(--sans);
  font-size: .78rem;
  margin-left: .35rem;
  text-decoration: none;
  white-space: nowrap;
}
a.mat:hover { text-decoration: underline; }

/* ---------- about page ---------- */

.page-title {
  font-weight: 600;
  font-size: 2.35rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 1.1rem;
}

.standfirst {
  font-size: 1.22rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 .5rem;
}

.prose p { margin: 0 0 1.05rem; hyphens: auto; }
.prose p:last-child { margin-bottom: 0; }

.prose ol.questions { margin: .2rem 0 1.1rem; padding-left: 1.6rem; }
.prose ol.questions li { margin: .5rem 0; padding-left: .35rem; }
.prose ol.questions li::marker { color: var(--faint); font-family: var(--sans); font-size: .85em; }

figure.photo { margin: 2rem 0; }
figure.photo .frame {
  aspect-ratio: 5 / 4;
  background: var(--bg-sunk);
  border-radius: 3px;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-family: var(--sans);
  font-size: .75rem;
  overflow: hidden;
}
figure.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
figure.photo figcaption {
  font-family: var(--sans);
  font-size: .76rem;
  color: var(--faint);
  margin-top: .5rem;
}

/* timeline: years on a thin rule */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 1.5rem;
  position: relative;
  padding-bottom: 1.2rem;
}
.timeline > li::before {
  content: "";
  position: absolute;
  left: calc(3.5rem + .75rem);
  top: .55rem;
  bottom: -.55rem;
  width: 1px;
  background: var(--rule);
}
.timeline > li:last-child::before { display: none; }
.timeline > li::after {
  content: "";
  position: absolute;
  left: calc(3.5rem + .75rem - 3px);
  top: .5rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--faint);
}
.timeline > li.now::after { background: var(--accent); border-color: var(--accent); }
.timeline .year {
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
  padding-top: .2rem;
}
.timeline ul { list-style: none; margin: 0; padding: 0 0 0 .5rem; }
.timeline ul li { margin: 0 0 .3rem; }
.timeline .future { color: var(--faint); font-style: italic; }

/* coursework */
.coursework {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.coursework h3 {
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--faint);
  margin: 0 0 .5rem;
}
.coursework ul { list-style: none; margin: 0; padding: 0; font-size: .95rem; }
.coursework li { margin: 0 0 .3rem; line-height: 1.4; }
.small-note {
  font-family: var(--sans);
  font-size: .76rem;
  color: var(--faint);
  margin: 1.2rem 0 0;
}

/* copyable third-person bio */
.shortbio {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.1rem 1.2rem 1rem;
  background: var(--bg-sunk);
}
.shortbio p { margin: 0; font-size: .98rem; }
.shortbio .bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: .8rem;
  font-family: var(--sans);
  font-size: .76rem;
  color: var(--faint);
}
.copy-btn {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.copy-btn:hover { text-decoration: underline; }

@media (max-width: 40rem) {
  .page-title { font-size: 2rem; }
  .standfirst { font-size: 1.1rem; }
  .coursework { grid-template-columns: 1fr; gap: 1.1rem; }
  .timeline > li { grid-template-columns: 2.9rem 1fr; gap: 1.1rem; }
  .timeline > li::before { left: calc(2.9rem + .55rem); }
  .timeline > li::after { left: calc(2.9rem + .55rem - 3px); }
}

/* ---------- paper landing pages ---------- */

.eyebrow {
  font-family: var(--sans);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 .9rem;
}
.paper-title {
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  margin: 0 0 .5rem;
}
.paper-title-en { font-style: italic; color: var(--muted); margin: 0 0 1.2rem; font-size: 1.05rem; }
.paper-meta p { margin: .15rem 0; }
.paper-meta .actions { margin-top: .9rem; font-size: .82rem; }
.paper-figure {
  margin: 2rem 0 0;
  background: var(--figure-bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1rem;
}
.paper-figure img { width: 100%; height: auto; display: block; }
.paper-figure figcaption { font-family: var(--sans); font-size: .76rem; color: #6b6861; margin-top: .6rem; }
.cite-text { font-size: .95rem; }
pre.bibtex {
  font-family: var(--mono);
  font-size: .74rem;
  line-height: 1.5;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .8rem .9rem;
  margin: .8rem 0 0;
  overflow-x: auto;
  user-select: all;
}

@media (max-width: 40rem) {
  .paper-title { font-size: 1.45rem; }
}

/* ---------- footer ---------- */

footer {
  margin-top: 4.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: .75rem;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem;
}
footer a { color: var(--faint); }

/* ---------- small screens ---------- */

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .page { padding: 3.5rem 1rem 2.5rem; }
  .site-header { margin: -2rem 0 2rem; }
  .site-nav { gap: 1.1rem; }
  .intro { grid-template-columns: 1fr; gap: 1.25rem; }
  .intro .portrait { order: -1; width: 7.5rem; margin-top: 0; }
  .intro h1 { font-size: 2rem; }
  .entry { grid-template-columns: 1fr; gap: .8rem; }
  .thumb { width: 100%; max-width: 22rem; }
  .news li, .dated li { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- motion & print ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

@media print {
  :root { --bg: #fff; --text: #000; --muted: #333; --faint: #555; --accent: #000; }
  .site-header, .toc, .thumb, .actions, .skip { display: none !important; }
  .page { padding: 0; max-width: none; }
  .entry { grid-template-columns: 1fr; }
  section { margin-top: 1.6rem; break-inside: avoid-page; }
  a { text-decoration: none; }
}
