/* Tomasz Kazimierczuk — site stylesheet (no build step, no external fonts) */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d232b;
  --muted: #5b6470;
  --accent: #1f4f8f;
  --accent-hover: #163a6b;
  --accent-soft: #eaf0f8;
  --border: #e3e0d8;
  --code-bg: #f3f1ec;
  --shadow: 0 1px 2px rgba(20, 30, 45, .05), 0 4px 16px rgba(20, 30, 45, .05);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --measure: 46rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2028;
    --text: #e4e7eb;
    --muted: #9aa4b0;
    --accent: #8ab4f8;
    --accent-hover: #b3cdfb;
    --accent-soft: #1d2a3d;
    --border: #2a313b;
    --code-bg: #1f262f;
    --shadow: none;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--font-sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .25rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.01em;
}
.brand:hover { color: var(--accent); }

.site-nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .95rem;
  padding: .15rem 0;
  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); }

/* ---------- main ---------- */

main { flex: 1; overflow-wrap: anywhere; }
pre, pre code { overflow-wrap: normal; }
main.wrap { padding-top: 2.5rem; padding-bottom: 3rem; }

h1, h2, h3 {
  font-family: var(--font-serif);
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 2rem 0 .75rem;
}
h1 { font-size: 2rem; margin-top: 0; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
.page-title { margin-top: 0; }

p, ul, ol, table, pre { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; }
li { margin: .2rem 0; }
li > ul, li > ol { margin: .2rem 0 .4rem; }

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

img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
small, .muted { color: var(--muted); }
del { color: var(--muted); }

.lead { font-size: 1.12rem; color: var(--muted); }

.back {
  display: inline-block;
  font-size: .9rem;
  margin-bottom: 1rem;
  text-decoration: none;
}
.back:hover { text-decoration: underline; }

/* ---------- tables, code ---------- */

table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--border); padding: .4rem .6rem; text-align: left; vertical-align: top; }
th { background: var(--code-bg); }

code, pre, kbd { font-family: var(--font-mono); font-size: .88em; }
:not(pre) > code {
  background: var(--code-bg);
  padding: .1em .35em;
  border-radius: 4px;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .9rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: .85rem; }
div.highlighter-rouge, figure.highlight { margin: 0 0 1rem; }

/* Rouge / Pygments token colours used by older course pages */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cp, .highlight .cs { color: #6a737d; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kt, .highlight .kc { color: #a626a4; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .se, .highlight .sh { color: #50a14f; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: #b76b01; }
.highlight .nf, .highlight .nc, .highlight .nb { color: #4078f2; }
.highlight .o, .highlight .ow { color: #0184bc; }
@media (prefers-color-scheme: dark) {
  .highlight .c, .highlight .c1, .highlight .cm, .highlight .cp, .highlight .cs { color: #7f8b98; }
  .highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kt, .highlight .kc { color: #d38fe0; }
  .highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .se, .highlight .sh { color: #98c379; }
  .highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: #e5a65b; }
  .highlight .nf, .highlight .nc, .highlight .nb { color: #7aa8f7; }
  .highlight .o, .highlight .ow { color: #56b6c2; }
}

/* ---------- home ---------- */

.intro {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
}
.intro img {
  width: 200px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: block;
}
.intro h1 { margin-bottom: .25rem; }
.intro .role { color: var(--muted); margin: 0 0 1.25rem; }

.links {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.links a {
  display: inline-block;
  padding: .3rem .8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: .9rem;
  text-decoration: none;
}
.links a:hover { border-color: var(--accent); }

@media (max-width: 600px) {
  .intro { grid-template-columns: 1fr; gap: 1.25rem; }
  .intro img { width: 160px; }
  h1 { font-size: 1.7rem; }
}

/* ---------- cards (research, teaching) ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  margin: 0 0 1.25rem;
  box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }

.pub h2 { font-size: 1.15rem; margin: 0 0 .35rem; }
.pub .authors { margin: 0; font-size: .92rem; color: var(--muted); }
.pub .venue { margin: .1rem 0 .9rem; font-size: .92rem; font-style: italic; }
.pub figure { margin: 1rem 0 0; text-align: center; }
.pub figure img { border-radius: 6px; background: #fff; max-height: 320px; }
.pub p { margin-bottom: 0; }

/* teaching */
.term { margin: 0 0 .25rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: var(--font-sans); font-weight: 600; }
.current { border-left: 4px solid var(--accent); }
.current h2 { margin: 0; font-size: 1.2rem; }
.current h2 + h2 { margin-top: .6rem; }

.archive { list-style: none; padding: 0; margin: 0; }
.archive > li {
  padding: .9rem 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.archive > li:last-child { border-bottom: 0; }
.archive .links { margin-top: .5rem; }
.archive .course { font-weight: 500; }

details { margin: 0 0 1rem; }
summary { cursor: pointer; color: var(--accent); }

/* pleview */
.download {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  padding: .55rem 1.1rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.download:hover { background: var(--accent-hover); color: var(--bg); }
.banner { border-radius: 10px; border: 1px solid var(--border); background: #fff; margin-bottom: 1.5rem; }

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

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .88rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* research */
.pub .authors strong { color: var(--text); font-weight: 600; white-space: nowrap; }
.pub .venue a { text-decoration: none; }
.pub .venue a:hover { text-decoration: underline; }

/* older works: description collapsed until the card is clicked (enabled by JS) */
.pub.collapsible { cursor: pointer; transition: border-color .15s; }
.pub.collapsible:hover { border-color: var(--accent); }
.pub.collapsed > p:not(.authors):not(.venue),
.pub.collapsed > figure { display: none; }
.pub.collapsed .venue { margin-bottom: 0; }
.pub .more {
  display: inline-block;
  margin-top: .6rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  font-size: .85rem;
  color: var(--accent);
}
.pub .more::after { content: " ▾"; }
.pub:not(.collapsed) .more::after { content: " ▴"; }
.pub.collapsible:not(.collapsed) .venue { margin-bottom: .2rem; }
.pub.collapsible:not(.collapsed) .more { margin: 0 0 .9rem; }
.pub .more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* grant tooltip (home page): shown on hover/focus of the research-interests link */
.has-tip { position: relative; }
.grant-link {
  color: inherit;
  text-decoration: underline dotted var(--muted);
  text-decoration-thickness: 1px;
}
.grant-link:hover, .grant-link:focus-visible { color: var(--accent); text-decoration-color: var(--accent); }
.grant-tip {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-top: .35rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(20, 30, 45, .15);
  color: var(--text);
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.grant-tip::before { content: ""; position: absolute; left: 0; right: 0; top: -.5rem; height: .5rem; }
.grant-link:hover .grant-tip,
.grant-link:focus-visible .grant-tip { opacity: 1; visibility: visible; transform: none; }
.grant-tip strong { font-weight: 600; }
.grant-tip small { font-size: .82rem; }
.ncn {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--surface);
  font: 700 .8rem/1 var(--font-sans);
  letter-spacing: .04em;
}

/* contact (home page) */
.contact {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem 2rem;
  align-items: center;
  margin-top: 2.5rem;
}
.contact h2 { margin: 0 0 .75rem; font-size: 1.25rem; }
.contact-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .35rem 1.25rem;
  margin: 0;
}
.contact-list dt { color: var(--muted); font-size: .9rem; padding-top: .1rem; }
.contact-list dd { margin: 0; }

.logos { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.logos a { display: block; line-height: 0; }
.logos img { width: 170px; height: auto; mix-blend-mode: multiply; }
.logos .logo-lums { width: 150px; margin: -.75rem 0; }   /* the LUMS artwork has wide white margins */
@media (prefers-color-scheme: dark) {
  /* black-on-white logos: invert, then let the (now black) background vanish into the card */
  .logos img { filter: invert(1); mix-blend-mode: screen; }
}
@media (max-width: 600px) {
  .contact { grid-template-columns: 1fr; }
  .contact-list { grid-template-columns: 1fr; gap: 0; }
  .contact-list dt { padding-top: .6rem; }
  .logos { flex-direction: row; justify-content: flex-start; gap: 1.5rem; }
  .logos img { width: 140px; }
  .logos .logo-lums { width: 120px; margin: 0; }
}

/* header: LUMS logo next to the name */
.brand-group { display: flex; align-items: center; gap: .8rem; }
.header-logo { display: block; line-height: 0; }
.header-logo img { height: 56px; width: auto; margin: -.35rem 0; }
.brand-group .brand { padding-left: .8rem; border-left: 1px solid var(--border); }
@media (prefers-color-scheme: dark) {
  .header-logo img { filter: invert(1); }
}
@media (max-width: 600px) {
  .header-logo img { height: 46px; }
}
