:root {
  --bg: #FFFFFF;
  --fg: #000000;
  --muted: #666666;
  --border: #DDDDDD;
  --accent: #000000;
  --accent-fg: #FFFFFF;
  --cell-bg: #FFFFFF;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
[data-theme="dark"] {
  --bg: #000000;
  --fg: #FFFFFF;
  --muted: #999999;
  --border: #333333;
  --accent: #FFFFFF;
  --accent-fg: #000000;
  --cell-bg: #000000;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body { transition: background .25s ease, color .25s ease; }
a { color: var(--fg); text-underline-offset: 0.18em; }

/* ---------- headings (skyzh scale: 600 weight, tight tracking) ---------- */
h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* ---------- nav ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 32px;
}
.nav .brand {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.nav .brand span { color: var(--muted); font-weight: 400; }
.nav .links {
  display: flex;
  gap: 18px;
  align-items: center;
}
.nav .links a {
  text-decoration: none;
  font-size: 15px;
  color: var(--muted);
  padding-bottom: 2px;
}
.nav .links a.active { font-weight: 600; }
.nav .links a:hover, .nav .links a.active {
  color: var(--fg);
  border-bottom: 1px solid var(--accent);
}
.toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  font-family: var(--font);
  font-size: 13px;
  padding: 5px 9px;
  cursor: pointer;
}
.toggle:hover { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.toggle:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- prose (skyzh-style airy sections) ---------- */
h1.hero {
  font-size: 24px;
  margin: 0 0 14px;
}
p.lede {
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg);
  max-width: 62ch;
  margin: 0 0 34px;
}
h2.section {
  font-size: 20px;
  color: var(--fg);
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
ul.facts {
  margin: 0 0 34px;
  padding-left: 20px;
  font-size: 16px;
  line-height: 1.65;
  max-width: 62ch;
}
ul.facts li + li { margin-top: 0.35rem; }
ul.facts li::marker { color: var(--muted); }

.connect {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 34px;
  font-size: 16px;
}
.connect a { text-decoration: none; border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.connect a:hover { border-color: var(--fg); }

/* ---------- home: latest list ---------- */
.latest-item {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.latest-item:not(:has(+ .latest-item)) { border-bottom: none; }
.latest-item a.title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 4px;
}
.latest-item a.title:hover { text-decoration: underline; }
.latest-item .lang { font-size: 13px; color: var(--muted); margin-left: 8px; }
.latest-item p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 60ch;
}
.see-all {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.8;
  color: var(--muted);
  text-decoration: none;
  float: right;
}
.see-all:hover { color: var(--fg); }

/* ---------- grid-cell components (projects / cv reuse these) ---------- */
.cellblock {
  border: 1px solid var(--border);
  margin-bottom: 34px;
}
.proj {
  display: grid;
  grid-template-columns: 56px 1fr;
  border-bottom: 1px solid var(--border);
  background: var(--cell-bg);
}
.proj:last-child { border-bottom: none; }
.proj .num {
  border-right: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18px;
  color: var(--muted);
  font-size: 14px;
}
.proj .body { padding: 16px 20px; }
.proj .title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.proj .title-row h3 { margin: 0; font-size: 18px; }
.proj .repo { font-size: 14px; color: var(--muted); margin-right: 12px; text-decoration: none; }
.proj .repo:hover { color: var(--fg); text-decoration: underline; }
.status {
  font-size: 12px;
  color: var(--accent-fg);
  background: var(--accent);
  border: 1px solid var(--accent);
  padding: 2px 6px;
  white-space: nowrap;
}
.status.muted { color: var(--muted); background: transparent; border-color: var(--border); }
p.desc {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.65;
  max-width: 66ch;
}
.stack { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.stack span { border: 1px solid var(--border); color: var(--muted); padding: 3px 7px; }

/* ---------- timeline (cv) ---------- */
.tl-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.tl-item:last-child { border-bottom: none; }
.tl-item .when { font-size: 14px; color: var(--muted); padding-top: 2px; }
.tl-item .what h3 { margin: 0 0 2px; font-size: 18px; }
.tl-item .what .org { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.tl-item .what p { margin: 0; font-size: 16px; line-height: 1.65; max-width: 58ch; }

footer.site {
  font-size: 14px;
  color: var(--muted);
  padding-top: 24px;
  margin-top: 10px;
}

@media (max-width: 600px) {
  .nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 28px;
  }
  .nav .brand {
    display: block;
    width: 100%;
    white-space: nowrap;
  }
  .nav .links {
    display: grid;
    grid-template-columns: repeat(4, max-content) minmax(54px, 1fr);
    gap: 10px;
    width: 100%;
  }
  .nav .links a {
    padding: 7px 0;
    white-space: nowrap;
  }
  .toggle {
    padding: 7px 8px;
    justify-self: end;
    min-width: 54px;
    white-space: nowrap;
  }
  .proj { grid-template-columns: 36px 1fr; }
  .tl-item { grid-template-columns: 1fr; gap: 4px; }
  .see-all { float: none; display: block; margin: -8px 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  body, .toggle { transition: none; }
}
