/* ==================================================================
   Jakub Matišák — portfolio
   Design tokens + components from the v3 prototype, condensed.
   Tailwind handles spacing / responsive utilities in markup;
   anything unique (terminal, marquee, ASCII blocks, color-mix accents)
   lives here.
   ================================================================== */

:root {
  --accent: #7aa2f7;
  --title-size: 60px;

  --bg: #0a0a0b;
  --bg-soft: #101013;
  --bg-card: #111114;
  --bg-card-hover: #16161a;
  --line: #1f1f25;
  --line-strong: #2a2a33;
  --text: #e8e8ea;
  --text-dim: #9a9aa3;
  --text-mute: #62626c;
  --ok: #7dd87d;

  --radius: 4px;
  --radius-lg: 8px;

  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-serif: "Instrument Serif", "Times New Roman", Georgia, serif;
  --display: var(--font-mono);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
}
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(1200px 600px at 85% -10%, color-mix(in oklab, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(900px 500px at -5% 20%, color-mix(in oklab, var(--accent) 5%, transparent), transparent 70%),
    var(--bg);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
em { font-style: italic; color: var(--accent); font-family: var(--font-serif); font-weight: 400; }
strong { color: var(--text); font-weight: 600; }
::selection { background: var(--accent); color: #0a0a0b; }

button { font: inherit; color: inherit; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- backgrounds --- */
.bg-grid {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: .25;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 20%, black 40%, transparent 100%);
}
.bg-grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: .06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ==================================================================
   TopBar
   ================================================================== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
  transition: all .25s ease;
  border-bottom: 1px solid transparent;
}
.topbar.is-scrolled {
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
  padding: 12px 32px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -.01em;
}
.brand-dot {
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 18px color-mix(in oklab, var(--accent) 80%, transparent);
  flex-shrink: 0;
}
.brand-name { font-size: 16px; }
.brand-cursor { color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.brand-meta {
  margin-left: 8px;
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav {
  display: flex; gap: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.nav a { color: var(--text-dim); transition: color .15s; position: relative; }
.nav a:hover { color: var(--text); }
.nav a::after {
  content: ""; position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .25s cubic-bezier(.2,.7,.2,1);
}
.nav a:hover::after { transform: scaleX(1); }

.dot-live {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 var(--ok);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklab, var(--ok) 70%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* role switch + lang toggle pills */
.role-switch, .lang-switch {
  display: flex;
  gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
}
.rs-btn, .ls-btn {
  background: transparent;
  border: 0;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s;
}
.rs-btn:hover, .ls-btn:hover { color: var(--text); }
.rs-btn.is-on, .ls-btn.is-on { background: var(--accent); color: #0a0a0b; }

.bar-right { display: flex; gap: 10px; align-items: center; }

/* ==================================================================
   Layout
   ================================================================== */
.main { position: relative; z-index: 2; }
.section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 120px 32px;
  position: relative;
}
.section--contact { padding-bottom: 80px; }

.section-head {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: end;
  gap: 24px;
  margin-bottom: 64px;
}
.sh-n {
  font-family: var(--font-mono);
  color: var(--text-mute);
  font-size: 13px;
  padding-bottom: 8px;
}
.sh-t h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 44px;
  letter-spacing: -.02em;
  line-height: 1;
}
.sh-sub {
  color: var(--text-mute);
  font-size: 13px;
  margin-top: 10px;
  font-family: var(--font-mono);
}
.sh-line {
  height: 1px;
  background: linear-gradient(to right, var(--line-strong), transparent);
  align-self: center;
  margin-bottom: 6px;
}

/* ==================================================================
   Hero
   ================================================================== */
.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 140px 32px 80px;
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 64px;
  align-items: start;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 32px;
}
.hero-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: var(--title-size);
  line-height: .98;
  letter-spacing: -.035em;
  margin: 0 0 28px;
}
.hero-title .tail {
  display: inline-block;
  font-size: .55em;
  letter-spacing: -.02em;
  color: var(--text-dim);
  margin-top: 12px;
}
.hero-title.anim-swap { animation: titleSwap .55s cubic-bezier(.2,.7,.2,1); }
@keyframes titleSwap {
  from { opacity: 0; transform: translateY(8px); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.hero-sub {
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 520px;
  margin: 0 0 36px;
  text-wrap: pretty;
}
.hero-sub strong { color: var(--text); }

.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  transition: all .2s;
  cursor: pointer;
  text-decoration: none;
}
.btn--primary { background: var(--accent); color: #0a0a0b; border-color: var(--accent); }
.btn--primary:hover {
  background: color-mix(in oklab, var(--accent) 85%, white);
  transform: translateY(-1px);
  box-shadow: 0 10px 30px -10px color-mix(in oklab, var(--accent) 80%, transparent);
}
.btn--primary .arr { transition: transform .2s; }
.btn--primary:hover .arr { transform: translateX(4px); }
.btn--ghost { background: transparent; color: var(--text); }
.btn--ghost:hover { border-color: var(--text); }

.hero-stats {
  display: flex; gap: 48px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.stat-n {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1;
}
.stat-l { font-size: 12px; color: var(--text-mute); margin-top: 6px; }

.role-hint {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
}
.role-cmds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rc {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
}
.rc:hover { border-color: var(--accent); color: var(--accent); }
.rc.is-on { border-color: var(--accent); color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, transparent); }

/* Terminal */
.terminal {
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: 13px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255,255,255,.03) inset,
    0 30px 80px -20px rgba(0,0,0,.5),
    0 0 0 1px var(--line);
  position: relative;
}
.terminal::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 12%, transparent), transparent 40%);
  pointer-events: none;
}
.term-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 70%, transparent);
}
.tdot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.tdot--r { background: #ff5f57; }
.tdot--y { background: #febc2e; }
.tdot--g { background: #28c840; }
.term-title { margin-left: 12px; font-size: 11px; color: var(--text-mute); }
.term-body { padding: 20px 22px; min-height: 340px; }
.tl { line-height: 1.7; color: var(--text-dim); white-space: pre-wrap; word-break: break-word; }
.tl--cmd { color: var(--text); }
.tl--out { color: var(--text-dim); padding-left: 16px; }
.tl.ok { color: var(--ok); }
.prompt { color: var(--accent); font-weight: 700; }
.path { color: #7aa2f7; margin-right: 4px; }
.caret { display: inline-block; width: .55em; color: var(--accent); margin-left: 1px; }

.hero-marquee {
  margin-top: 80px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
          mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.marquee-track { display: flex; white-space: nowrap; animation: marquee 40s linear infinite; }
.marquee-inner { font-family: var(--font-mono); font-size: 14px; color: var(--text-mute); letter-spacing: .04em; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ==================================================================
   About
   ================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 64px;
  align-items: start;
}
.portrait { position: sticky; top: 100px; }
.portrait-inner {
  aspect-ratio: 3/4;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background:
    repeating-linear-gradient(45deg,
      color-mix(in oklab, var(--accent) 10%, transparent) 0 2px,
      transparent 2px 10px),
    linear-gradient(135deg, var(--bg-soft), var(--bg-card));
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.portrait-init {
  font-family: var(--display);
  font-size: 140px;
  font-weight: 500;
  letter-spacing: -.04em;
  color: var(--text);
  mix-blend-mode: difference;
}
.portrait-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.portrait-inner::after {
  content: "jakub.png";
  position: absolute; bottom: 10px; left: 12px;
  font-size: 10px; color: var(--text-mute); font-family: var(--font-mono);
  z-index: 2;
  background: color-mix(in oklab, var(--bg) 60%, transparent);
  padding: 2px 6px;
  border-radius: 2px;
}
.portrait-tag {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  font-size: 12px; color: var(--text-dim);
}

.affil {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  font-family: var(--font-mono);
  font-size: 12px;
}
.affil-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.affil-row:last-child { border-bottom: 0; }
.affil-k { color: var(--text-mute); }
.affil-v { color: var(--text); text-align: right; word-break: break-word; }

.about-copy { max-width: 640px; }
.about-copy .lead {
  font-family: var(--font-serif);
  font-size: 28px;
  line-height: 1.35;
  color: var(--text);
  margin: 0 0 24px;
  text-wrap: balance;
}
.about-copy p {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0 0 16px;
}
.facts {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 28px;
}
.facts > div {
  display: flex; justify-content: space-between; gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 0;
}
.facts dt { color: var(--text-mute); margin: 0; }
.facts dd { margin: 0; color: var(--text); text-align: right; }
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}
.chip--mute { background: color-mix(in oklab, var(--text) 10%, transparent); color: var(--text-dim); }

/* ==================================================================
   Dev (stack rows + side projects)
   ================================================================== */
.dev-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 64px;
  border-top: 1px solid var(--line);
}
.ds-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: center;
  padding: 22px 4px;
  border-bottom: 1px solid var(--line);
  transition: padding .25s, background .2s;
}
.ds-row:hover {
  background: color-mix(in oklab, var(--accent) 4%, transparent);
  padding-left: 16px;
}
.ds-h {
  font-family: var(--font-mono);
  font-size: 14px;
  display: flex; align-items: baseline; gap: 6px;
}
.ds-brk { color: var(--accent); }
.ds-name { color: var(--text); }
.ds-tag { margin-left: 8px; font-size: 11px; color: var(--text-mute); text-transform: lowercase; }
.ds-items { display: flex; flex-wrap: wrap; gap: 8px; }
.ds-chip {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  transition: border-color .2s, color .2s;
}
.ds-row:hover .ds-chip { border-color: var(--line-strong); }

.side-h {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 12px;
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.side-h-l { color: var(--text); }
.side-h-r { color: var(--text-mute); }

.side-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
/* Odd-count tail: if the last card sits alone in its row, stretch it. */
.side-grid > .side-card:nth-child(odd):last-child { grid-column: 1 / -1; }
.side-card {
  padding: 24px 26px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color .2s, background .2s, transform .2s;
}
.side-card:hover { border-color: var(--line-strong); background: var(--bg-card-hover); }
.side-top { display: flex; justify-content: space-between; align-items: baseline; }
.side-name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--text);
}
.side-hash { color: var(--accent); margin-right: 2px; font-weight: 700; }
.side-yrs { font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); }
.side-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: lowercase;
  color: var(--accent);
  letter-spacing: .04em;
  margin-top: -4px;
}
.side-desc {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
  flex: 1;
  text-wrap: pretty;
}
.side-meta {
  display: flex; gap: 12px; align-items: baseline;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
}
.sm-k { color: var(--text-mute); text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }
.sm-v { color: var(--text); }
.side-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 4px 10px;
  background: color-mix(in oklab, var(--text) 6%, transparent);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ==================================================================
   Research — topics + OVL card
   ================================================================== */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 64px;
}
.topic {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  transition: border-color .2s, background .2s;
}
.topic:hover { border-color: var(--line-strong); background: var(--bg-card-hover); }
.topic-k {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  margin-bottom: 8px;
}
.topic-bullet { color: var(--accent); margin-right: 4px; }
.topic-desc {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  text-wrap: pretty;
}
.topic-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  margin-left: auto;
}
.topic-tag--primary   { background: color-mix(in oklab, var(--accent) 20%, transparent); color: var(--accent); }
.topic-tag--secondary { background: color-mix(in oklab, #bb9af7      20%, transparent); color: #bb9af7; }
.topic-tag--active    { background: color-mix(in oklab, var(--ok)     22%, transparent); color: var(--ok); }
.topic-tag--growing   { background: color-mix(in oklab, var(--text)   10%, transparent); color: var(--text-dim); }

.ovl-card {
  padding: 32px;
  background:
    linear-gradient(135deg,
      color-mix(in oklab, var(--accent) 10%, transparent),
      color-mix(in oklab, var(--accent) 2%, transparent)),
    var(--bg-card);
  border: 1px solid color-mix(in oklab, var(--accent) 25%, var(--line));
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
}
/* Stop the ASCII <pre> from forcing the grid track wider than viewport. */
.ovl-l, .ovl-r { min-width: 0; }
.ovl-ascii { max-width: 100%; }
.ovl-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 12px;
}
.ovl-name {
  font-family: var(--display);
  font-size: 56px;
  font-weight: 500;
  letter-spacing: -.03em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 12px;
}
.ovl-sub {
  display: block;
  font-size: 16px;
  letter-spacing: -.01em;
  color: var(--text-dim);
  margin-top: 6px;
  font-weight: 400;
}
.ovl-l p {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 18px;
  max-width: 480px;
}
.ovl-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.ovl-ascii {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
}

/* ==================================================================
   Grants
   ================================================================== */
.grant-filter { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.gf {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .15s;
}
.gf:hover { border-color: var(--line-strong); color: var(--text); }
.gf.is-on { border-color: var(--accent); color: var(--accent); background: color-mix(in oklab, var(--accent) 8%, transparent); }
.gf-c {
  font-size: 10px;
  background: color-mix(in oklab, var(--text) 10%, transparent);
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--text-mute);
}
.gf.is-on .gf-c { background: color-mix(in oklab, var(--accent) 20%, transparent); color: var(--accent); }

.grant-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.grant {
  display: grid;
  grid-template-columns: 200px 1fr 160px;
  gap: 20px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  transition: background .2s, padding .25s;
}
.grant:hover { background: var(--bg-card); padding-left: 16px; padding-right: 16px; }
.grant.is-featured { background: color-mix(in oklab, var(--accent) 4%, transparent); }
.g-type { display: flex; flex-direction: column; gap: 6px; }
.g-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 3px;
  width: max-content;
  letter-spacing: .03em;
}
.g-badge--kega          { background: color-mix(in oklab, #ff7a45 22%, transparent); color: #ff7a45; }
.g-badge--vega          { background: color-mix(in oklab, #7aa2f7 22%, transparent); color: #7aa2f7; }
.g-badge--apvv          { background: color-mix(in oklab, #bb9af7 22%, transparent); color: #bb9af7; }
.g-badge--inydomaci,
.g-badge--mladvskumnk   { background: color-mix(in oklab, var(--text) 10%, transparent); color: var(--text-dim); }
.g-role {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-mute);
}
.g-role--garant { color: var(--ok); }
.g-id { font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); margin-bottom: 4px; }
.g-name { font-family: var(--font-sans); font-size: 15px; color: var(--text); line-height: 1.4; text-wrap: pretty; }
.grant.is-featured .g-name { font-weight: 600; }
.g-meta { text-align: right; font-family: var(--font-mono); font-size: 12px; }
.g-years { color: var(--text); }
.g-status { color: var(--text-mute); margin-top: 4px; font-size: 11px; }
.g-status--running { color: var(--ok); }

/* ==================================================================
   Publications
   ================================================================== */
.pubs-h {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 12px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.pubs-h-l { color: var(--text); }
.pubs-h-r a { color: var(--text-dim); border-bottom: 1px solid var(--line); }
.pubs-h-r a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.pub-list { list-style: none; padding: 0; margin: 0; }
.pub { border-bottom: 1px solid var(--line); position: relative; }
.pub.is-featured .pub-title { font-weight: 600; }
.pub-row {
  display: grid;
  grid-template-columns: 70px 110px 1fr 30px;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: padding .25s;
}
.pub-row:hover { padding-left: 8px; }
.pub-year { color: var(--text-mute); }
.pub-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 3px 8px;
  border-radius: 2px;
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  color: var(--accent);
  width: max-content;
}
.pub-type--journal   { background: color-mix(in oklab, var(--ok) 18%, transparent); color: var(--ok); }
.pub-type--monograph { background: color-mix(in oklab, #bb9af7 20%, transparent);    color: #bb9af7; }
.pub-title {
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  text-wrap: pretty;
}
.pub-toggle { font-family: var(--font-mono); color: var(--text-mute); font-size: 18px; transition: color .2s; }
.pub.is-open .pub-toggle { color: var(--accent); }
.pub-body { padding: 8px 0 28px 86px; display: flex; flex-direction: column; gap: 14px; }
.pub-body[hidden] { display: none; }
.pub-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.pub-meta > div { display: flex; gap: 12px; }
.pm-k { color: var(--text-mute); min-width: 60px; }
.pm-v { color: var(--text); }
.pub-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.pubs-more { margin-top: 20px; text-align: center; }
.pubs-more-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all .2s;
}
.pubs-more-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ==================================================================
   Teaching
   ================================================================== */
.teach-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 48px;
}
.ts-card {
  padding: 28px 22px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: border-color .2s;
}
.ts-card:hover { border-color: var(--line-strong); }
.ts-n {
  font-family: var(--display);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -.03em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 10px;
}
.ts-l { font-family: var(--font-mono); font-size: 12px; color: var(--text-mute); line-height: 1.4; }
.ts-card--cta {
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--accent) 18%, transparent),
    color-mix(in oklab, var(--accent) 4%, transparent));
  border-color: color-mix(in oklab, var(--accent) 30%, var(--line));
  display: flex; flex-direction: column; justify-content: space-between;
}
.ts-cta-l { font-family: var(--display); font-size: 20px; color: var(--text); font-weight: 500; }
.ts-cta-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.ts-cta-link .arr { transition: transform .2s; }
.ts-cta-link:hover .arr { transform: translateX(4px); }

.theses-h {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
}
.theses-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}
.theses { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 13px; }
.theses td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
.theses tr:last-child td { border-bottom: 0; }
.theses tr:hover td { background: var(--bg-card-hover); }
.th-year { color: var(--text-mute); width: 60px; }
.th-level { width: 60px; }
.th-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.th-pill--bc   { background: color-mix(in oklab, #7aa2f7 22%, transparent); color: #7aa2f7; }
.th-pill--dipl { background: color-mix(in oklab, #bb9af7 22%, transparent); color: #bb9af7; }
.th-name { color: var(--text); font-family: var(--font-sans); font-size: 14px; }
.th-student { color: var(--text-dim); text-align: right; white-space: nowrap; }
.theses-foot { margin-top: 28px; text-align: center; }
.link-arr {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  transition: all .2s;
}
.link-arr:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ==================================================================
   Contact
   ================================================================== */
.contact { display: grid; grid-template-columns: 1.4fr 1fr; gap: 64px; align-items: start; }
.contact-lead {
  font-family: var(--font-serif);
  font-size: 48px;
  line-height: 1.1;
  margin-bottom: 32px;
  text-wrap: balance;
}
.email-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 24px;
}
.email-btn:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.email-at { font-size: 20px; color: var(--text); letter-spacing: -.01em; }
.email-copy {
  font-size: 12px;
  color: var(--text-mute);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  transition: all .2s;
}
.email-btn:hover .email-copy { color: var(--accent); border-color: var(--accent); }
.email-btn.is-copied .email-copy { color: var(--ok); border-color: var(--ok); }

.contact-note {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 460px;
}
.sock-h { font-family: var(--font-mono); font-size: 12px; color: var(--text-mute); margin-bottom: 16px; }
.contact-socials ul { list-style: none; padding: 0; margin: 0; }
.contact-socials li { border-top: 1px solid var(--line); }
.contact-socials li:last-child { border-bottom: 1px solid var(--line); }
.contact-socials a {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  transition: padding .25s;
}
.contact-socials a:hover { padding-left: 12px; }
.sk-k { min-width: 80px; color: var(--text-mute); text-transform: lowercase; }
.sk-v { color: var(--text); flex: 1; }
.sk-arr { color: var(--text-mute); transition: all .2s; }
.contact-socials a:hover .sk-arr { color: var(--accent); transform: translate(3px, -3px); }

/* ==================================================================
   Colophon + Footer
   ================================================================== */
.colophon {
  max-width: 1280px;
  margin: 60px auto 0;
  padding: 80px 32px;
  border-top: 1px dashed var(--line-strong);
  position: relative;
  z-index: 2;
}
.colophon::before {
  content: "// EOF · postscript";
  position: absolute;
  top: -10px; left: 32px;
  padding: 0 12px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: .08em;
}
.colophon-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 64px; align-items: center; }
.colo-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 24px;
}
.colo-q {
  font-family: var(--font-serif);
  font-size: 48px;
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  line-height: 1.15;
  margin: 0 0 28px;
  text-wrap: balance;
  position: relative;
}
.colo-q em { color: var(--accent); font-style: italic; }
.q-mark {
  font-size: 1.4em;
  color: var(--accent);
  line-height: 0;
  opacity: .6;
  display: inline-block;
  transform: translateY(.15em);
  margin: 0 -.05em;
}
.colo-a {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.3;
  color: var(--text);
  margin: 0 0 32px;
}
.colo-a strong { color: var(--accent); position: relative; }
.colo-a strong::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 8px;
  background: color-mix(in oklab, var(--accent) 22%, transparent);
  z-index: -1;
  border-radius: 2px;
}
.colo-foot {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  padding: 16px 20px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0;
}
.ans-prompt { color: var(--accent); font-weight: 700; margin-right: 6px; }
.ans-out { color: var(--text); }
.colo-r { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.colo-ascii {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 0;
  white-space: pre;
  transition: border-color .25s, color .25s;
  cursor: default;
}
.colo-ascii.is-hover { border-color: var(--accent); color: var(--accent); }
.colo-stamp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: .04em;
  text-align: center;
}

.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 32px 64px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  gap: 32px;
  position: relative;
  z-index: 2;
}
.foot-brand { font-family: var(--font-mono); font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.foot-brand span { color: var(--accent); }
.foot-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-mute); }
.foot-meta a { color: var(--text-dim); border-bottom: 1px solid var(--line); }
.foot-meta a:hover { color: var(--accent); }
.foot-ascii {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.3;
  color: var(--text-mute);
  margin: 0;
  white-space: pre;
}

/* ==================================================================
   Scroll reveal — applied via data-reveal in markup
   ================================================================== */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity .7s ease var(--reveal-delay, 0ms),
    transform .7s cubic-bezier(.2,.7,.2,1) var(--reveal-delay, 0ms);
}
[data-reveal].is-in { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .hero-title.anim-swap, .marquee-track { animation: none; }
}

/* ==================================================================
   Responsive
   ================================================================== */
@media (max-width: 1100px) {
  :root { --title-size: 56px; }
  .hero-grid    { grid-template-columns: 1fr; gap: 48px; }
  .about-grid   { grid-template-columns: 1fr; gap: 32px; }
  .portrait     { position: static; max-width: 280px; }
  .stack-grid   { grid-template-columns: 1fr; gap: 32px; }
  .contact      { grid-template-columns: 1fr; gap: 48px; }
  .contact-lead { font-size: 36px; }
  .section-head { grid-template-columns: auto 1fr; }
  .sh-line      { display: none; }
  .role-switch  { display: none; }
  .topic-grid   { grid-template-columns: 1fr; }
  .side-grid    { grid-template-columns: 1fr; }
  .ovl-card     { grid-template-columns: 1fr; }
  .ovl-name     { font-size: 44px; }
  .ds-row       { grid-template-columns: 1fr; gap: 12px; }
  .grant        { grid-template-columns: 1fr; gap: 6px; padding: 16px 4px; }
  .grant:hover  { padding-left: 4px; padding-right: 4px; }
  .g-meta       { text-align: left; display: flex; gap: 16px; }
  .teach-summary { grid-template-columns: repeat(2, 1fr); }
  .colophon-grid { grid-template-columns: 1fr; gap: 40px; }
  .colo-q       { font-size: 36px; }
  .colo-a       { font-size: 22px; }
}
@media (max-width: 640px) {
  :root { --title-size: 44px; }
  .section { padding: 80px 20px; }
  .hero    { padding: 120px 20px 60px; }
  .topbar  { padding: 14px 20px; }
  .topbar.is-scrolled { padding: 10px 20px; }
  .nav     { display: none; }
  .hero-stats { gap: 24px; flex-wrap: wrap; }
  .stat-n  { font-size: 24px; }
  .facts   { grid-template-columns: 1fr; }
  .sh-t h2 { font-size: 32px; }
  .footer  { flex-direction: column; align-items: flex-start; }
  .foot-ascii { font-size: 8px; }
  .email-at { font-size: 15px; }
  .teach-summary { grid-template-columns: 1fr; }
  .ovl-r { display: none; }  /* hide OVL ASCII diagram on phones */
  .theses td { padding: 10px 12px; font-size: 12px; }
  .th-name { font-size: 13px; }
  .th-student { display: block; text-align: left; margin-top: 4px; color: var(--text-mute); font-size: 11px; }
  .colophon { padding: 60px 20px; }
  .colo-q { font-size: 28px; }
  .colo-ascii { font-size: 10px; padding: 16px; }
  .pub-row { grid-template-columns: 1fr; gap: 4px; padding: 14px 0; }
  .pub-toggle { position: absolute; right: 0; top: 14px; }
  .pub-body { padding: 4px 0 20px; }
  .pub-meta { grid-template-columns: 1fr; }
  .brand-meta { display: none; }
}
