:root {
  --bg: #f7f6f2;
  --bar: #ebe9e2;
  --code: #eeece5;
  --line: #dcd9cf;
  --line-soft: #e3e0d7;
  --text: #1d1d1b;
  --text-body: #33322e;
  --muted-1: #5c5a52;
  --muted-2: #6f6c63;
  --muted-3: #8a877d;
  --marker: #b9b5a8;
  --accent: #2e56c9;
  --success: #2f8a57;
  --badge: #4a4943;
  --syn-key: #b4421f;
  --syn-str: #2f7a4f;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --tabbar-h: 43px;
  --statusbar-h: 26px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  font-family: var(--mono);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Tab bar */
.tabbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: stretch;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.tabs { display: flex; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.tab {
  flex: none;
  padding: 12px 20px;
  border-right: 1px solid var(--line);
  border-top: 2px solid transparent;
  color: var(--muted-3);
}
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { background: var(--bg); color: var(--text); border-top-color: var(--accent); }

.lang { display: flex; align-items: center; gap: 2px; padding: 0 14px; flex: none; }
.lang a {
  font-size: 12px;
  padding: 4px 9px; border-radius: 3px;
  background: transparent; color: var(--muted-3);
  -webkit-tap-highlight-color: transparent;
}
.lang a:hover { text-decoration: none; color: var(--text); }
.lang a[aria-current="page"] { background: var(--text); color: var(--bg); }

/* Body + sidebar */
.body { flex: 1; display: flex; align-items: flex-start; }
.sidebar {
  display: none;
  position: sticky; top: var(--tabbar-h);
  flex: none; width: 220px;
  height: calc(100vh - var(--tabbar-h) - var(--statusbar-h));
  border-right: 1px solid var(--line-soft);
  padding: 24px 12px;
  font-size: 13px; line-height: 1.5; color: var(--muted-2);
  flex-direction: column; gap: 2px;
}
@media (min-width: 900px) { .sidebar { display: flex; } }
.sidebar-root { color: var(--text); font-weight: 600; padding: 4px 8px; }
.sidebar a { padding: 4px 8px 4px 22px; border-radius: 3px; color: var(--muted-2); }
.sidebar a:hover { text-decoration: none; color: var(--text); }
.sidebar a.active { background: var(--bar); color: var(--accent); }

.main { flex: 1; min-width: 0; padding: clamp(40px, 7vw, 72px) clamp(22px, 6vw, 80px) 96px; }
.content { max-width: 880px; }

/* Hero */
.hero { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; }
.hero-text { flex: 1 1 380px; min-width: 0; }
h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 56px); font-weight: 600;
  letter-spacing: -0.03em; line-height: 1.05;
}
.md { color: var(--marker); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted-2); }
.role { margin: 18px 0 0; font-family: var(--sans); font-size: 19px; font-weight: 500; line-height: 1.45; }
.role-co { color: var(--muted-2); font-weight: 400; }

.badges { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.badge { display: flex; }
.badge-k, .badge-v { color: #fff; padding: 3px 8px; }
.badge-k { background: var(--badge); border-radius: 3px 0 0 3px; }
.badge-v { background: var(--accent); border-radius: 0 3px 3px 0; }
.badge-v.green { background: var(--success); }

.intro {
  margin: 32px 0 0;
  font-family: var(--sans); font-size: 19px; line-height: 1.65;
  color: var(--text-body); text-wrap: pretty;
}

.photo { flex: 0 0 260px; margin: 0; }
.photo-frame {
  position: relative;
  width: 260px; height: 325px;
  border-radius: 6px; overflow: hidden;
  background: var(--line);
  cursor: crosshair;
}
.photo-frame img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 40%;
}
.photo-frame .photo-pixel { image-rendering: pixelated; opacity: 0; transition: opacity .25s; }
.photo-frame.pixel .photo-pixel { opacity: 1; }
.photo figcaption { margin-top: 10px; font-size: 12px; color: var(--muted-3); }

/* Sections */
h2 { margin: 56px 0 0; font-size: 26px; font-weight: 600; scroll-margin-top: 72px; }
h2.first { margin-top: 88px; }

/* Experience timeline */
.log { list-style: none; margin: 28px 0 0; padding: 0; }
.job { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 16px; }
.job-rail { position: relative; display: flex; justify-content: center; }
.job-rail::before {
  content: '';
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: var(--line);
}
.job:first-child .job-rail::before { top: 12px; }
.job:last-child .job-rail::before { bottom: calc(100% - 12px); }
.job-dot {
  position: relative;
  margin-top: 6px;
  width: 12px; height: 12px;
  box-sizing: content-box;
  border-radius: 50%;
  border: 2px solid var(--marker);
  background: var(--bg);
}
.job.current .job-dot { border-color: var(--accent); }
.job-body { padding-bottom: 26px; }
.job-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; color: var(--muted-3); }
.job-dur { color: var(--marker); }
.job-dur:empty { display: none; }
.head { background: var(--accent); color: #fff; padding: 1px 7px; border-radius: 3px; font-size: 11px; }
.job-role { margin-top: 4px; font-family: var(--sans); font-size: 18px; font-weight: 600; }
.job-co { margin-top: 2px; font-family: var(--sans); font-size: 16px; color: var(--muted-1); }

/* Skills JSON */
.json {
  margin-top: 22px;
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px 26px;
  font-size: 15px; line-height: 1.9;
}
.json .p { color: var(--muted-3); }
.json .k { color: var(--syn-key); }
.json .s { color: var(--syn-str); }
.json .i1 { padding-left: 24px; }
.json .i2 { padding-left: 48px; }
.json .arr { display: flex; flex-wrap: wrap; column-gap: 12px; }

/* Markdown lists */
.mdlist {
  list-style: none; margin: 18px 0 0; padding: 0;
  font-family: var(--sans); font-size: 18px;
}
.mdlist.contact { display: flex; flex-direction: column; gap: 10px; }
.mdlist a { text-decoration: underline; text-underline-offset: 3px; }
.mdlist.projects li { display: flex; }
.mdlist.projects .mono { flex: none; white-space: pre; }
.mdlist.projects li > div { line-height: 1.55; text-wrap: pretty; }
.proj-meta { margin-top: 6px; font-family: var(--mono); font-size: 13px; color: var(--muted-3); line-height: 1.6; }

/* Status bar */
.statusbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: space-between; gap: 16px;
  background: var(--accent); color: #fff;
  font-size: 12px; padding: 5px 20px;
}
.status-l, .status-r { display: flex; gap: 20px; }
.status-l { min-width: 0; }
