/*!
 * Vukasin Bozic — personal site
 * Hand-written, no framework, no build step.
 */

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

:root {
  --rail: 17rem;

  --paper: #fbfaf8;
  --surface: #f4f2ec;
  --surface-2: #efece4;
  --ink: #15171b;
  --ink-soft: #3c424a;
  --muted: #5c626b;
  --faint: #686e76;
  --rule: #e3dfd7;
  --rule-soft: #ece8e1;

  --accent: #2f5d7c;
  --accent-hover: #1f4359;
  --accent-wash: #e9f0f5;
  --accent-line: #c6d7e3;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 22, 28, .04), 0 10px 30px -22px rgba(20, 22, 28, .5);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"],
html.dark {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101216;
    --surface: #15181d;
    --surface-2: #1b1f25;
    --ink: #e9e7e3;
    --ink-soft: #c3c7cc;
    --muted: #98a0a9;
    --faint: #79818b;
    --rule: #262b32;
    --rule-soft: #1f242a;

    --accent: #82b4d4;
    --accent-hover: #a3cbe5;
    --accent-wash: #17242e;
    --accent-line: #2c4a5e;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -22px rgba(0, 0, 0, .9);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #101216;
  --surface: #15181d;
  --surface-2: #1b1f25;
  --ink: #e9e7e3;
  --ink-soft: #c3c7cc;
  --muted: #98a0a9;
  --faint: #79818b;
  --rule: #262b32;
  --rule-soft: #1f242a;

  --accent: #82b4d4;
  --accent-hover: #a3cbe5;
  --accent-wash: #17242e;
  --accent-line: #2c4a5e;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -22px rgba(0, 0, 0, .9);
}

/* ---------------------------------------------------------------- base */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1, "cv05" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin: 0;
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: .18em;
  text-decoration-thickness: from-font;
  transition: color .15s ease;
}
a:hover, a:focus-visible { color: var(--accent-hover); text-decoration: underline; }

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

img { max-width: 100%; height: auto; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: .6rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- rail */

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--rail);
  padding: 2.25rem 1.5rem 1.5rem;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.rail__identity { text-align: center; }

.rail__photo {
  display: block;
  width: 8.5rem;
  height: 8.5rem;
  margin: 0 auto .95rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--rule), 0 6px 20px -12px rgba(20, 22, 28, .6);
}

.rail__name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--ink);
}
.rail__name a { color: inherit; }
.rail__name a:hover { color: var(--accent); text-decoration: none; }

.rail__role {
  margin-top: .3rem;
  font-size: .78rem;
  line-height: 1.5;
  color: var(--muted);
}

.rail__nav {
  margin: 1.9rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--rule);
  list-style: none;
}

.rail__nav li + li { margin-top: .1rem; }

.rail__nav a {
  position: relative;
  display: block;
  padding: .4rem .7rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: .845rem;
  font-weight: 500;
  letter-spacing: .01em;
  transition: color .15s ease, background-color .15s ease;
}
.rail__nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }

.rail__nav a.is-active {
  color: var(--ink);
  font-weight: 600;
  background: var(--surface-2);
}
.rail__nav a.is-active::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 1.1rem;
  background: var(--accent);
  border-radius: 2px;
}

.rail__foot {
  margin-top: auto;
  padding-top: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.social {
  display: flex;
  gap: .15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social a {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: color .15s ease, background-color .15s ease;
}
.social a:hover { color: var(--ink); background: var(--surface-2); }
.social svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.theme-toggle:hover { color: var(--ink); background: var(--surface-2); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
  :root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
}

.rail__toggle { display: none; }

/* ---------------------------------------------------------------- layout */

.page {
  margin-left: var(--rail);
  padding: 0 clamp(1.5rem, 5vw, 5rem);
}

.section {
  max-width: 54rem;
  padding: clamp(3.25rem, 7vw, 5.5rem) 0;
  border-bottom: 1px solid var(--rule-soft);
}
.section:last-of-type { border-bottom: 0; }

.section__label {
  margin-bottom: 2rem;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
}

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

.intro { padding-top: clamp(3.5rem, 9vw, 7rem); }

.intro__name {
  font-size: clamp(2.4rem, 5.5vw, 3.35rem);
  letter-spacing: -.035em;
  line-height: 1.05;
}
.intro__name span { color: var(--muted); font-weight: 500; }

.intro__meta {
  margin: 1rem 0 1.9rem;
  font-size: .95rem;
  color: var(--muted);
}
.intro__meta strong { color: var(--ink-soft); font-weight: 600; }

.intro__meta-item { display: inline-block; }
.intro__meta-item:not(:last-child)::after {
  content: "|";
  margin: 0 .55rem;
  color: var(--rule);
}

@media (max-width: 620px) {
  .intro__meta-item { display: block; }
  .intro__meta-item:not(:last-child)::after { content: none; }
}

.intro__lede {
  max-width: 46rem;
  font-size: 1.075rem;
  line-height: 1.72;
  color: var(--ink-soft);
}
.intro__lede + .intro__lede { margin-top: .9rem; }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: 1.9rem;
  padding: 0;
  list-style: none;
}

.tag {
  padding: .3rem .7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- publications */

.pub-list { display: grid; gap: 1.1rem; }

.pub {
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.pub:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow);
}

.pub__title {
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.015em;
}

.pub__authors {
  margin: .5rem 0 .2rem;
  font-size: .9rem;
  color: var(--muted);
}
.pub__authors .me { color: var(--ink); font-weight: 600; }

.pub__venue {
  font-size: .875rem;
  color: var(--faint);
}

.badge {
  display: inline-block;
  margin-left: .55rem;
  padding: .1rem .5rem;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  vertical-align: 2px;
  white-space: nowrap;
}

.pub__links {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .95rem;
}

.linkpill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: .8rem;
  font-weight: 500;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.linkpill:hover {
  border-color: var(--accent-line);
  background: var(--accent-wash);
  color: var(--accent);
  text-decoration: none;
}
.linkpill svg { width: .8rem; height: .8rem; fill: currentColor; opacity: .75; }

/* ---------------------------------------------------------------- timeline items */

.entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: .35rem 2rem;
  padding-bottom: 2.1rem;
}
.entry + .entry {
  padding-top: 2.1rem;
  border-top: 1px solid var(--rule-soft);
}
.entry:last-child { padding-bottom: 0; }

.entry__when {
  order: -1;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.entry__role {
  font-size: 1.04rem;
  font-weight: 600;
  letter-spacing: -.015em;
}

.entry__org {
  margin: .12rem 0 .6rem;
  font-size: .92rem;
  font-weight: 500;
  color: var(--accent);
}

.entry__org--plain { color: var(--muted); font-weight: 500; }

.entry__body { font-size: .94rem; color: var(--ink-soft); }
.entry__body p { margin-bottom: .65rem; }

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

@media (min-width: 700px) {
  .entry {
    grid-template-columns: minmax(0, 1fr) 11rem;
    align-items: start;
  }
  .entry__main { grid-column: 1; grid-row: 1; }
  .entry__when { grid-column: 2; grid-row: 1; text-align: right; padding-top: .3rem; }
}

/* ---------------------------------------------------------------- skills */

.skill-groups { display: grid; gap: 1.6rem; }

.skill-group__label {
  margin-bottom: .7rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------------------- awards */

.awards {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: .85rem;
}

.awards li {
  position: relative;
  padding-left: 1.5rem;
  font-size: .95rem;
  color: var(--ink-soft);
}
.awards li::before {
  content: "";
  position: absolute;
  left: .1rem;
  top: .62rem;
  width: .4rem;
  height: .4rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: .55;
}

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

.foot {
  max-width: 54rem;
  padding: 2.5rem 0 3.5rem;
  border-top: 1px solid var(--rule-soft);
  font-size: .82rem;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  justify-content: space-between;
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 899px) {
  .rail {
    position: sticky;
    inset: 0 auto auto 0;
    width: auto;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: .7rem 1.1rem;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    flex-direction: row;
    align-items: center;
    gap: .75rem;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
  }

  .rail__identity {
    display: flex;
    align-items: center;
    gap: .7rem;
    text-align: left;
    margin-right: auto;
    min-width: 0;
  }

  .rail__photo { width: 2.4rem; height: 2.4rem; margin: 0; }
  .rail__name { font-size: .98rem; }
  .rail__role { display: none; }

  .rail__toggle {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink-soft);
    cursor: pointer;
  }
  .rail__toggle svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }
  .rail__toggle .icon-close { display: none; }
  .rail__toggle[aria-expanded="true"] .icon-close { display: block; }
  .rail__toggle[aria-expanded="true"] .icon-menu { display: none; }

  .rail__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: .5rem;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    border-top: 0;
    box-shadow: var(--shadow);
    z-index: 41;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }
  .rail.is-open .rail__nav { display: block; }
  .rail__nav a { padding: .6rem .8rem; font-size: .92rem; }
  .rail__nav a.is-active::before { left: .1rem; }

  .rail__foot { margin: 0; padding: 0; }
  .social { display: none; }

  .page { margin-left: 0; }
  .intro { padding-top: 2.75rem; }
}

@media (max-width: 420px) {
  .rail__name { font-size: .9rem; }
}

/* ---------------------------------------------------------------- print */

@media print {
  :root { --paper: #fff; --surface: #fff; --ink: #000; --ink-soft: #222; --muted: #555; --rule: #ccc; --rule-soft: #ddd; --accent: #000; }
  .rail__nav, .rail__foot, .theme-toggle, .rail__toggle, .skip-link { display: none !important; }
  .rail { position: static; width: auto; border: 0; border-bottom: 1px solid #ccc; flex-direction: row; align-items: center; gap: 1rem; background: #fff; }
  .rail__identity { display: flex; align-items: center; gap: 1rem; text-align: left; }
  .rail__photo { width: 4rem; height: 4rem; margin: 0; box-shadow: none; }
  .page { margin-left: 0; padding: 0; }
  .section { padding: 1.5rem 0; max-width: none; break-inside: avoid; }
  .pub, .entry { break-inside: avoid; }
  .pub { border-color: #ddd; box-shadow: none; }
  a { color: #000; }
}
