/* ---------------------------------------------------------------------
   Piotr Bartman-Szwarc — personal site
   Minimal, responsive, light/dark (auto via prefers-color-scheme).
   --------------------------------------------------------------------- */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --text: #1b1f24;
  --text-muted: #5a6472;
  --accent: #0a5fd6;
  --border: #e2e5ea;
  --max-width: 780px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a;
    --bg-alt: #1a1e25;
    --text: #e8eaed;
    --text-muted: #9aa4b2;
    --accent: #6ea8ff;
    --border: #2a2f38;
    color-scheme: dark;
  }
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --text: #1b1f24;
  --text-muted: #5a6472;
  --accent: #0a5fd6;
  --border: #e2e5ea;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #12151a;
  --bg-alt: #1a1e25;
  --text: #e8eaed;
  --text-muted: #9aa4b2;
  --accent: #6ea8ff;
  --border: #2a2f38;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  line-height: 1.6;
  font-size: 17px;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

header.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
  gap: 12px;
}

.site-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  white-space: nowrap;
}

.site-title:hover { text-decoration: none; }

nav.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

nav.site-nav a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.92rem;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
}

nav.site-nav a:hover,
nav.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}

.nav-toggle,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  line-height: 1;
}

.theme-toggle:hover,
.nav-toggle:hover { color: var(--text); }

/* Show only the icon matching the active theme: sun in light, moon in dark. */
.theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: inline; }
}

:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.icon-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
}

.icon-link:hover {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}

.nav-toggle {
  display: none;
}

@media (max-width: 640px) {
  .nav-toggle { display: inline-block; }

  nav.site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 20px 16px;
  }

  nav.site-nav.open { display: flex; }

  header.site-header { position: relative; }

  nav.site-nav a { padding: 10px 6px; }
}

/* ---------------------------------------------------------------------
   Main content
   --------------------------------------------------------------------- */

main { padding: 40px 0 80px; }

h1, h2, h3 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.25;
}

h1 { font-size: 1.8rem; margin: 0 0 8px; }
h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin: 40px 0 18px;
}
h2:first-of-type { margin-top: 8px; }

.lede { font-size: 1.02rem; }

.roles {
  font-size: 1.05rem;
  margin: 18px 0 0;
  padding-left: 1.1em;
}
.roles li { margin-bottom: 4px; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

/* profile / links row */
.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.profile-links li { display: flex; align-items: center; gap: 6px; }

.btn {
  display: inline-block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  margin-top: 8px;
}
.btn:hover { text-decoration: none; opacity: 0.9; }

/* ---------------------------------------------------------------------
   Entry lists (employment / education / talks / teaching / publications)
   --------------------------------------------------------------------- */

.entry-group { margin-bottom: 26px; }

.entry-group .org {
  font-weight: 400;
  margin-bottom: 2px;
}

.entry-group .org-meta {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

ul.entries {
  margin: 0;
  padding-left: 1.1em;
}

ul.entries > li { margin-bottom: 10px; }

.talks-list > li { margin-bottom: 20px; }

.period {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

ul.bullets {
  margin: 4px 0 0;
  padding-left: 1.2em;
  font-size: 0.95rem;
}

/* project / software cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: var(--bg-alt);
}

.card h3 { margin: 0 0 4px; font-size: 1.02rem; }
.card .meta {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.card p { margin: 0; font-size: 0.92rem; }

/* publications */
.pub {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: none; }
.pub .authors { font-weight: 400; }
.pub .title { margin: 2px 0; }
.pub .venue { color: var(--text-muted); font-size: 0.92rem; }

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

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 40px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 2px;
}
