:root {
  --bg: #0f1115;
  --surface: #171a21;
  --border: #262b36;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --accent: #ff7a45;
  --max: 980px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  font-size: 17px;
}

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

img { max-width: 100%; display: block; border-radius: 8px; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.site-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"] { border-bottom: 2px solid var(--accent); }

/* ---------- layout ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 20px 80px;
}

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 2.2rem; margin: 0 0 0.4em; }
h2 { font-size: 1.5rem; margin: 2.2em 0 0.6em; }
h3 { font-size: 1.15rem; margin: 1.6em 0 0.4em; }

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

.hero-img { width: 100%; margin: 0 0 32px; }

section + section { margin-top: 48px; }

/* ---------- project cards (home) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card img { border-radius: 0; aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.card .body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .video { margin: 10px 0 14px; }
.card h3 { margin: 0; }
.card .roles { color: var(--muted); font-size: 0.92rem; }
.card .btn { margin-top: auto; align-self: flex-start; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.btn:hover { background: var(--accent); color: var(--bg); }

/* ---------- media ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 20px 0;
}
.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; }
}

/* ---------- CV ---------- */
.cv-entry { margin-bottom: 28px; }
.cv-entry h3 { margin-bottom: 0; }
.cv-entry .where { color: var(--muted); margin: 2px 0 8px; }
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.skills ul { padding-left: 1.1em; margin: 0; }
.skills h3 { margin-top: 0; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

/* ---------- contact / footer ---------- */
.contact { display: flex; gap: 14px; margin-top: 12px; }
.contact a {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
}
.contact a:hover { border-color: var(--accent); color: var(--accent); }
.contact svg { width: 20px; height: 20px; fill: currentColor; }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px 20px;
}

/* ---------- home intro ---------- */
.intro {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  align-items: center;
  margin-bottom: 24px;
}
.intro h1 { margin-bottom: 0.2em; }
.intro h2 { margin-top: 1em; }
.portrait {
  width: 220px;
  height: 220px;
  object-fit: cover;
  object-position: 50% 35%;
  border-radius: 50%;
  border: 3px solid var(--border);
}
@media (max-width: 700px) {
  .intro { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 20px; }
  .portrait { width: 160px; height: 160px; }
}

/* gallery images open full size */
.gallery a { display: block; }
.gallery a img { transition: opacity .15s; }
.gallery a:hover img { opacity: .85; }
@media (max-width: 440px) {
  .gallery { grid-template-columns: 1fr; }
}

/* ---------- inline code ---------- */
code {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------- architecture diagram ---------- */
.diagram {
  margin: 20px 0 28px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.diagram svg { width: 100%; height: auto; display: block; }
.d-box { fill: var(--bg); stroke: var(--border); stroke-width: 1.5; }
.d-accent { stroke: var(--accent); }
.d-platform { fill: transparent; stroke-dasharray: 5 4; }
.d-l { stroke: var(--muted); stroke-width: 1.5; }
.d-t { fill: var(--text); font: 600 15px Inter, system-ui, sans-serif; text-anchor: middle; }
.d-s { fill: var(--muted); font: 12.5px Inter, system-ui, sans-serif; text-anchor: middle; }

/* ---------- card without a screenshot ---------- */
.card-banner {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.card-banner strong { font-size: 2.4rem; letter-spacing: 0.04em; }
.card-banner span { color: var(--muted); font-size: 0.9rem; }
