/* ==========================================================================
   Josef Koumar — academic website
   Design tokens, layout and components
   ========================================================================== */

:root {
  --paper:        #fcfbf9;
  --surface:      #ffffff;
  --surface-alt:  #f5f3ef;
  --line:         #e3ded5;
  --line-strong:  #cec7ba;
  --ink:          #16181d;
  --ink-soft:     #3d424b;
  --muted:        #6b7280;
  --accent:       #1a5b8a;
  --accent-soft:  #e8f0f6;
  --accent-ink:   #12435f;
  --amber:        #9a6b16;
  --amber-soft:   #f7efdd;

  --serif: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(22, 24, 29, .05);
  --shadow: 0 6px 24px -12px rgba(22, 24, 29, .18);

  --wrap: 1080px;
  --header-h: 64px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:       #101318;
    --surface:     #171b22;
    --surface-alt: #1c212a;
    --line:        #2a303b;
    --line-strong: #3a4250;
    --ink:         #e9ecf1;
    --ink-soft:    #c3c9d4;
    --muted:       #939bab;
    --accent:      #7cb6df;
    --accent-soft: #17293a;
    --accent-ink:  #a8cfec;
    --amber:       #d9ad63;
    --amber-soft:  #2c2519;
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, .4);
    --shadow:      0 8px 28px -14px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper:       #101318;
  --surface:     #171b22;
  --surface-alt: #1c212a;
  --line:        #2a303b;
  --line-strong: #3a4250;
  --ink:         #e9ecf1;
  --ink-soft:    #c3c9d4;
  --muted:       #939bab;
  --accent:      #7cb6df;
  --accent-soft: #17293a;
  --accent-ink:  #a8cfec;
  --amber:       #d9ad63;
  --amber-soft:  #2c2519;
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, .4);
  --shadow:      0 8px 28px -14px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

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

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

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

img { max-width: 100%; display: block; }

figure { margin: 0; }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  z-index: 100;
}
.skip-link:focus { left: 16px; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.015em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand .brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: .8125rem;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .02em;
  vertical-align: -7px;
}

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

.site-nav a {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: .9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}
.site-nav a:hover { background: var(--surface-alt); color: var(--ink); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 14px;
}

.nav-toggle { display: none; }

@media (max-width: 800px) {
  .nav-toggle { display: inline-flex; }
  .header-actions { margin-left: auto; }
  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
    padding: 10px 16px 16px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .site-nav[hidden] { display: none; }
  .site-nav a { padding: 11px 12px; }
}

/* --------------------------------------------------------------- hero --- */

.hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 232px;
  gap: 56px;
  align-items: start;
}

.eyebrow {
  font-size: .78125rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.125rem);
  margin-bottom: 10px;
}

.hero-role {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--ink-soft);
  margin-bottom: 22px;
}

.hero-lead {
  font-size: 1.0625rem;
  color: var(--ink-soft);
  max-width: 58ch;
}

.portrait {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 1 / 1.08;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

.affiliations {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.affiliations li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: .9375rem;
  color: var(--ink-soft);
}
.affiliations svg {
  width: 15px; height: 15px;
  flex: none;
  color: var(--muted);
  transform: translateY(2px);
}
.affiliations strong { color: var(--ink); font-weight: 600; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: .9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.btn:hover { text-decoration: none; border-color: var(--line-strong); transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
:root[data-theme="dark"] .btn-primary { color: #0d1117; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #0d1117; }
}

/* ------------------------------------------------------------ metrics --- */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
}
.metrics > * {
  background: var(--surface);
  padding: 18px 20px;
}
.metric-value {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
}
.metric-label {
  font-size: .8125rem;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: .01em;
}

/* ------------------------------------------------------------ section --- */

.section { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-narrow { max-width: 760px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 1.75rem; }
.section-head .more { font-size: .9375rem; font-weight: 500; }

.page-head {
  padding: 56px 0 36px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: clamp(2rem, 4vw, 2.625rem); margin-bottom: 12px; }
.page-head p { color: var(--ink-soft); max-width: 62ch; }

.lede { font-size: 1.0625rem; color: var(--ink-soft); }

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

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cards-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card h3 {
  font-size: 1.0625rem;
  margin-bottom: 8px;
}
.card p { font-size: .9375rem; color: var(--muted); margin: 0; }
a.card:hover, .card-link:hover {
  text-decoration: none;
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 14px;
}
.card-icon svg { width: 18px; height: 18px; }

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  font-size: .8125rem;
  color: var(--muted);
}

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

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 8px;
}

.chip {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
:root[data-theme="dark"] .chip[aria-pressed="true"] { color: #0d1117; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip[aria-pressed="true"] { color: #0d1117; }
}
.chip .count { opacity: .65; margin-left: 5px; font-variant-numeric: tabular-nums; }

.year-group { margin-top: 44px; }

.year-label {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 20px;
}
.year-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.pub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.pub {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: border-color .15s, box-shadow .15s;
}
.pub:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.pub-title {
  font-size: 1.0625rem;
  line-height: 1.35;
  margin-bottom: 8px;
}
.pub-title a { color: var(--ink); }
.pub-title a:hover { color: var(--accent); text-decoration: none; }

.pub-authors {
  font-size: .9375rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.pub-authors .me { font-weight: 600; color: var(--ink); }

.pub-venue {
  font-family: var(--serif);
  font-style: italic;
  font-size: .9375rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.tag {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--surface-alt);
  color: var(--muted);
  border: 1px solid var(--line);
}
.tag-journal { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.tag-q1 { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.tag-cite { text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-size: .875rem;
}
.pub-links a, .pub-links button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.pub-links a:hover, .pub-links button:hover { text-decoration: underline; text-underline-offset: 2px; }
.pub-links svg { width: 14px; height: 14px; }

.pub-abstract {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: .9375rem;
  color: var(--ink-soft);
  line-height: 1.7;
}
.pub-abstract[hidden] { display: none !important; }

.empty-state {
  padding: 48px 0;
  text-align: center;
  color: var(--muted);
}

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

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 26px;
  border-left: 1px solid var(--line);
}

.timeline > li {
  position: relative;
  padding: 0 0 34px 0;
}
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line-strong);
}
.timeline > li.current::before { background: var(--accent); border-color: var(--accent); }

.tl-date {
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 3px;
}
.tl-title { font-size: 1.0625rem; margin-bottom: 2px; }
.tl-org {
  font-family: var(--serif);
  font-style: italic;
  font-size: .9375rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.tl-text { font-size: .9375rem; color: var(--ink-soft); margin: 0; }
.tl-text + .tl-text { margin-top: 8px; }

.sub-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.sub-list li {
  font-size: .9375rem;
  color: var(--ink-soft);
  padding-left: 18px;
  position: relative;
}
.sub-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .7em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}

/* -------------------------------------------------------------- table --- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: .9375rem;
}
table.data th {
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 16px 10px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 14px 16px 14px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-soft);
}
table.data td:first-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: .875rem;
}
table.data td strong { color: var(--ink); font-weight: 600; }
table.data tr:last-child td { border-bottom: 0; }

/* -------------------------------------------------------- misc blocks --- */

.callout {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: .9375rem;
  color: var(--ink-soft);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
}

.stack { display: grid; gap: 20px; }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-size: .875rem;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

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

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
  padding: 44px 0;
  margin-top: 0;
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}
.footer-note { font-size: .875rem; color: var(--muted); }
.social { display: flex; gap: 8px; }
.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  transition: color .15s, border-color .15s, transform .15s;
}
.social a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.social svg { width: 18px; height: 18px; }

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

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .portrait { max-width: 200px; order: -1; }
  .two-col { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 600px) {
  .hero { padding: 44px 0 40px; }
  .section { padding: 48px 0; }
  .pub { padding: 18px; }
  .wrap { padding-inline: 18px; }
  .metric-value { font-size: 1.5rem; }
}

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

@media print {
  .site-header, .site-footer, .actions, .filters, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .section, .page-head { padding: 12pt 0; border: 0; }
  .pub { break-inside: avoid; border: 0; padding: 0 0 10pt; }
}
