/* Mateusz Michalek — personal site
   Spectral (serif) for reading, IBM Plex Sans for navigation and metadata. */

:root {
  --ground:   #faf8f4;
  --surface:  #ffffff;
  --ink:      #1c1c1a;
  --body:     #2a2a26;
  --muted:    #5a574f;
  --faint:    #8a867c;
  --rule:     #e2ddd2;
  --rule-str: #d8d2c5;
  --accent:   #1b4d5c;
  --accent-d: #0f3540;
  --accent-l: #b9cbd1;
  --sienna:   #8f4e22;
  --green:    #14603f;
  --green-bg: #e7f0ea;
  --sienna-bg:#f5eae0;
  --grey-bg:  #edebe4;

  --serif: Spectral, Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --measure: 68ch;
  --gutter: 2rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:   #14150f;
    --surface:  #1c1d17;
    --ink:      #f0ede4;
    --body:     #ddd9ce;
    --muted:    #a8a396;
    --faint:    #8a857a;
    --rule:     #32332b;
    --rule-str: #42433a;
    --accent:   #86c4d6;
    --accent-d: #b3dbe8;
    --accent-l: #3a5d68;
    --sienna:   #d9a273;
    --green:    #8fcaa8;
    --green-bg: #1b2a22;
    --sienna-bg:#2d2119;
    --grey-bg:  #24251e;
  }
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--body);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.66;
  font-synthesis-weight: none;
}

/* accent rule across the very top */
body::before {
  content: "";
  display: block;
  height: 5px;
  background: var(--accent);
}

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

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-l); }
a:hover, a:focus-visible { color: var(--accent-d); border-bottom-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }
a.plain { border-bottom: none; }
a.plain:hover { border-bottom: 1px solid currentColor; }

h1, h2, h3, h4 { color: var(--ink); font-weight: 500; line-height: 1.22; margin: 0; }
h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 2.75rem); letter-spacing: -0.4px; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.22rem; }
p { margin: 0 0 1.1em 0; max-width: var(--measure); }
em { font-style: italic; }

/* ---------- masthead + nav ---------- */

/* padding-top only: the shorthand would wipe out .wrap's side gutter */
.masthead { padding-top: 3rem; }

.ident { display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; }
.portrait { width: 132px; height: 132px; object-fit: cover; border-radius: 2px; flex: 0 0 auto; }
.ident-text { flex: 1 1 22rem; }
.ident-text h1 { margin-bottom: .5rem; }
.role { font-size: 1.1rem; color: var(--muted); line-height: 1.5; }
.contact-block {
  font-family: var(--sans); font-size: .82rem; color: var(--muted);
  line-height: 1.9; text-align: right; flex: 0 0 auto; padding-top: .35rem;
}

.pagehead { padding-top: 2.5rem; display: flex; justify-content: space-between;
  align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.pagehead .sitename { font-size: 1.5rem; font-weight: 500; color: var(--ink); border-bottom: none; }
.pagehead .sitename:hover { border-bottom: 1px solid currentColor; }
.pagehead .affil { font-family: var(--sans); font-size: .82rem; color: var(--muted); }

nav.main {
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--rule);
  display: flex; gap: 2.1rem; align-items: center; flex-wrap: wrap;
}
nav.main a, nav.main span[aria-current] {
  font-family: var(--sans); font-size: .8rem; font-weight: 500;
  letter-spacing: .10em; text-transform: uppercase;
  padding: .75rem 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--muted); display: inline-block;
}
nav.main a { border-bottom-color: transparent; }
nav.main a:hover { color: var(--ink); border-bottom-color: var(--rule-str); }
nav.main [aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

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

main { padding: 3.25rem 0 0 0; }

.cols { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); gap: 4.5rem; align-items: start; }
.lede { font-size: 1.16rem; line-height: 1.68; color: var(--body); }

.eyebrow {
  font-family: var(--sans); font-size: .7rem; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--sienna);
  margin: 0 0 .9rem 0;
}

.side { display: flex; flex-direction: column; gap: 2.2rem; }
.side section { border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.side section:first-child { border-top: none; padding-top: 0; }
.side ul { list-style: none; margin: 0; padding: 0; font-family: var(--sans); font-size: .87rem; }
.side ul li { margin-bottom: .62rem; line-height: 1.5; }
.side .when { color: var(--faint); }

/* ---------- publication / work lists ---------- */

.worklist { list-style: none; margin: 0; padding: 0; }
.worklist li { display: flex; gap: 1.3rem; padding: 1.05rem 0; border-top: 1px solid var(--rule); }
.worklist li:last-child { border-bottom: 1px solid var(--rule); }
.worklist .yr { font-family: var(--sans); font-size: .8rem; color: var(--faint); width: 2.6rem; flex: 0 0 auto; padding-top: .22rem; }
.worklist .ttl { font-size: 1.05rem; line-height: 1.45; color: var(--ink); }
.worklist .meta { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin-top: .3rem; line-height: 1.55; }
.worklist .meta cite { font-family: var(--serif); font-style: italic; font-size: .95rem; }

.pubyear {
  font-family: var(--sans); font-size: .7rem; font-weight: 600; letter-spacing: .13em;
  text-transform: uppercase; color: var(--sienna);
  padding-bottom: .7rem; border-bottom: 2px solid var(--accent); margin: 2.5rem 0 0 0;
}
.pubyear:first-of-type { margin-top: 0; }

.pubs { list-style: none; margin: 0; padding: 0; }
.pubs li { padding: 1.15rem 0; border-bottom: 1px solid var(--rule); }
.pubs .ttl { font-size: 1.08rem; line-height: 1.45; color: var(--ink); }
.pubs .authors { font-family: var(--sans); font-size: .84rem; color: var(--muted); margin-top: .35rem; line-height: 1.55; }
.pubs .venue { font-family: var(--sans); font-size: .84rem; color: var(--body); margin-top: .35rem; line-height: 1.55; }
.pubs .venue cite { font-family: var(--serif); font-style: italic; font-size: .96rem; }
.pubs .links { font-family: var(--sans); font-size: .82rem; margin-top: .4rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.me { color: var(--ink); font-weight: 500; }

/* ---------- cards & callouts ---------- */

.card { background: var(--surface); border: 1px solid var(--rule); padding: 1.6rem 1.75rem; }
.card h2, .card h3 { margin-bottom: .45rem; }

.note { background: var(--sienna-bg); border: 1px solid var(--rule-str); padding: 1.15rem 1.4rem; display: flex; gap: 1rem; }
.note::before { content: ""; width: 3px; background: var(--sienna); flex: 0 0 auto; border-radius: 2px; }
.note p { margin: 0; }

.bookrow { display: flex; gap: 1.75rem; align-items: flex-start; }
.bookcover {
  width: 78px; height: 106px; background: var(--accent); color: var(--ground);
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  padding: .55rem; font-size: .66rem; line-height: 1.3; text-align: center;
}

/* ---------- research / conjecture rows ---------- */

.rows { margin-top: 3rem; }
.row { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 4rem;
  padding: 2.1rem 0; border-top: 1px solid var(--rule-str); align-items: start; }
.row:last-child { border-bottom: 1px solid var(--rule-str); }
.row .side-label h2 { font-size: 1.45rem; }
.row .tags { font-family: var(--sans); font-size: .78rem; color: var(--faint); margin-top: .65rem; line-height: 1.7; }
.row .prose { font-size: 1.04rem; line-height: 1.68; }
.row .prose p:last-child { margin-bottom: 0; }

.status { display: inline-flex; gap: .5rem; align-items: center; padding: .3rem .7rem;
  border-radius: 2px; font-family: var(--sans); font-size: .78rem; font-weight: 500; margin-top: .6rem; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.status.proved     { background: var(--green-bg);  color: var(--green); }
.status.proved .dot{ background: currentColor; }
.status.counter    { background: var(--sienna-bg); color: var(--sienna); }
.status.counter .dot{ background: currentColor; }
.status.open       { background: var(--grey-bg);   color: var(--muted); }
.status.open .dot  { background: currentColor; }

.src { font-family: var(--sans); font-size: .78rem; color: var(--faint); margin-top: .8rem; line-height: 1.6; }
.left-note { font-family: var(--sans); font-size: .88rem; line-height: 1.6; color: var(--muted); margin-top: .8rem; }
.left-note b { color: var(--sienna); font-weight: 500; }

/* ---------- CV ---------- */

.cv-section { border-top: 1px solid var(--rule-str); padding: 1.9rem 0; display: grid;
  grid-template-columns: 15rem minmax(0, 1fr); gap: 4rem; align-items: start; }
.cv-section:last-of-type { border-bottom: 1px solid var(--rule-str); }
.cv-section h2 { font-size: 1.32rem; }
.cv-list { list-style: none; margin: 0; padding: 0; }
/* wide enough for a split range like "2020–2025, 2026–2027" on one line */
.cv-list li { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: 1.25rem;
  padding: .5rem 0; font-size: 1rem; line-height: 1.55; }
.cv-list li.nodate { grid-template-columns: minmax(0, 1fr); }
.cv-list .when { font-family: var(--sans); font-size: .84rem; color: var(--faint);
  padding-top: .18rem; white-space: nowrap; }
.cv-sublabel { font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--faint); margin: 1.1rem 0 .5rem 0; }
.cv-section > div > .cv-sublabel:first-child { margin-top: 0; }

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

footer { margin-top: 4rem; border-top: 1px solid var(--rule); padding: 1.6rem 0 2.5rem 0;
  font-family: var(--sans); font-size: .8rem; color: var(--faint);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1fr); gap: 2.75rem; }
  .row, .cv-section { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .cv-section { padding: 1.5rem 0; }
  .contact-block { text-align: left; }
}

@media (max-width: 620px) {
  :root { --gutter: 1rem; }
  body { font-size: 17px; }
  .portrait { width: 96px; height: 96px; }
  .ident { gap: 1.25rem; }
  nav.main { gap: 1.1rem; }
  nav.main a, nav.main span[aria-current] { font-size: .72rem; letter-spacing: .07em; }
  .worklist li { flex-direction: column; gap: .3rem; }
  .worklist .yr { width: auto; padding-top: 0; }
  .cv-list li { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .bookrow { flex-direction: column; gap: 1rem; }
}

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

@media print {
  :root { --ground: #fff; --surface: #fff; --ink: #000; --body: #000; --muted: #333; }
  body { font-size: 11pt; }
  body::before, nav.main, footer { display: none; }
  a { color: #000; border-bottom: none; }
  .row, .cv-section { break-inside: avoid; }
  .cv-section { padding: .7rem 0; }
}

/* ---------- conjectures: section heads & update blocks ---------- */

.sectionhead {
  font-size: 1.9rem; margin: 4rem 0 0 0; padding-bottom: .6rem;
  border-bottom: 2px solid var(--accent);
}
.rows + .sectionhead { margin-top: 4.5rem; }

.update {
  background: var(--accent-soft, #edf1f1); border: 1px solid var(--accent-l);
  padding: 1.05rem 1.3rem; margin-top: 1rem; display: flex; gap: 1rem;
}
.update::before { content: ""; width: 3px; background: var(--accent); flex: 0 0 auto; border-radius: 2px; }
.update p { margin: 0; font-size: 1rem; }

@media (prefers-color-scheme: dark) {
  :root { --accent-soft: #17262b; }
}
