/* =========================================================
   Michał Pojnar · personal academic site
   Colours live in the variables below (light, then dark).
   ========================================================= */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1f22;
  --muted: #565d63;
  --border: #e2dfd7;
  --accent: #1d5c6e;          /* links, small details */
  --accent-soft: #e5eff1;
  --focus: #1d5c6e;

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  --measure: 44rem;
  --header-h: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191b;
    --surface: #1d2124;
    --text: #e6e4df;
    --muted: #a5abaf;
    --border: #30363a;
    --accent: #8cc8d8;
    --accent-soft: #22323a;
    --focus: #8cc8d8;
  }
}

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

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

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
}

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

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

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

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--focus);
  z-index: 100;
}
.skip-link:focus { top: 0.75rem; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-block: 0.6rem;
}

.site-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.nav-list a {
  display: inline-block;
  padding-block: 0.2rem;
  color: var(--muted);
  text-decoration: none;
}
.nav-list a:hover { color: var(--text); }

@media (min-width: 40rem) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-h);
    padding-block: 0;
  }
  .nav-list { gap: 1.5rem; }
}

/* Keep section headings clear of the sticky header */
section[id] { scroll-margin-top: 6rem; }
@media (min-width: 40rem) {
  section[id] { scroll-margin-top: calc(var(--header-h) + 1.5rem); }
}

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

.hero {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-block: 3rem 2.5rem;
}

@media (min-width: 40rem) {
  .hero {
    flex-direction: row;
    align-items: center;
    gap: 2.25rem;
    padding-block: 5rem 3.5rem;
  }
}

/* Photo is drawn over the initials. If img/photo.jpg is missing,
   nothing is drawn and the initials stay visible. */
.avatar {
  position: relative;
  flex: none;
  width: 8.5rem;
  height: 8.5rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
}

.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../img/photo.jpg") center / cover no-repeat;
}

.avatar-initials {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.hero h1 {
  font-size: clamp(2.1rem, 6vw, 2.9rem);
  letter-spacing: -0.01em;
}

.tagline {
  margin: 0.4rem 0 1rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.lead {
  font-size: 1.1rem;
  max-width: 36rem;
}

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

.section {
  padding-block: 2.75rem;
  border-top: 1px solid var(--border);
}

.section h2 {
  font-size: 1.65rem;
  margin-bottom: 1.5rem;
}

.subhead {
  font-size: 1.2rem;
  margin: 2.25rem 0 0.9rem;
}

.plain-list {
  margin: 0;
  padding-left: 1.2rem;
}
.plain-list li + li { margin-top: 0.4rem; }
.plain-list li::marker { color: var(--muted); }

.note { color: var(--muted); }

/* ---------- Research cards ---------- */

.cards {
  display: grid;
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  padding: 1.4rem 1.4rem 1.5rem;
}

.card-title { font-size: 1.3rem; }

.card-meta {
  margin: 0.25rem 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.card-title + .study { margin-top: 1rem; }

.study + .study {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.study h4 { font-size: 1.08rem; }

.status {
  margin: 0.15rem 0 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Publications & talks ---------- */

.refs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.refs li {
  padding-left: 2rem;
  text-indent: -2rem;        /* APA hanging indent */
  overflow-wrap: anywhere;
}
.refs li + li { margin-top: 1rem; }

.me { font-weight: 600; }

/* ---------- Background ---------- */

.timeline {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  gap: 0.1rem;
}
.timeline li + li { margin-top: 1rem; }

.when {
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 40rem) {
  .timeline li {
    grid-template-columns: 7.5rem 1fr;
    gap: 1rem;
  }
  .when { padding-top: 0.1rem; }
}

/* ---------- Contact ---------- */

.email {
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.profiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

/* Profile links with an empty href are hidden */
.profiles li:has(> a[href=""]),
.profiles a[href=""] { display: none; }

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

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- 404 ---------- */

.not-found { padding-block: 5rem; }
.not-found h1 { font-size: 2rem; margin-bottom: 1rem; }
