:root {
  --bg: #0d1117;
  --bg-elev: #161b22;
  --bg-soft: #1c2230;
  --fg: #e6edf3;
  --fg-dim: #8b949e;
  --accent: #58a6ff;
  --accent-2: #3fb950;
  --accent-3: #f0883e;
  --accent-4: #bc8cff;
  --accent-5: #f778ba;
  --border: #30363d;
  --grid: rgba(255,255,255,0.04);
  --shadow: 0 8px 24px rgba(0,0,0,0.5);
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="light"] {
  --bg: #fafbfc;
  --bg-elev: #ffffff;
  --bg-soft: #f1f4f9;
  --fg: #1f2328;
  --fg-dim: #656d76;
  --accent: #0969da;
  --accent-2: #1a7f37;
  --accent-3: #bc4c00;
  --accent-4: #8250df;
  --accent-5: #bf1b6b;
  --border: #d0d7de;
  --grid: rgba(0,0,0,0.04);
  --shadow: 0 8px 24px rgba(0,0,0,0.12);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #0d1117;
    --bg-elev: #161b22;
    --bg-soft: #1c2230;
    --fg: #e6edf3;
    --fg-dim: #8b949e;
    --accent: #58a6ff;
    --accent-2: #3fb950;
    --accent-3: #f0883e;
    --accent-4: #bc8cff;
    --accent-5: #f778ba;
    --border: #30363d;
    --grid: rgba(255,255,255,0.04);
    --shadow: 0 8px 24px rgba(0,0,0,0.5);
  }
}
@media (prefers-color-scheme: light) {
  html:not([data-theme]) {
    --bg: #fafbfc;
    --bg-elev: #ffffff;
    --bg-soft: #f1f4f9;
    --fg: #1f2328;
    --fg-dim: #656d76;
    --accent: #0969da;
    --accent-2: #1a7f37;
    --accent-3: #bc4c00;
    --accent-4: #8250df;
    --accent-5: #bf1b6b;
    --border: #d0d7de;
    --grid: rgba(0,0,0,0.04);
    --shadow: 0 8px 24px rgba(0,0,0,0.12);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.55;
  font-size: 16px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  transition: background-color .3s, color .3s;
}
a { color: var(--accent); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 20px 120px; }

.term {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--fg-dim);
}
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.r { background: #ff5f56; }
.dot.y { background: #ffbd2e; }
.dot.g { background: #27c93f; }
.term-bar .title { margin-left: auto; }
.term-bar .title-r { margin-right: auto; }

.toggle {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-dim);
  background: var(--bg);
  transition: all .2s;
  user-select: none;
}
.toggle:hover { color: var(--fg); border-color: var(--accent); }
.toggle .ico { font-size: 14px; }

header.hero { margin-bottom: 28px; }
.hero .term-body { padding: 22px 24px; }
.ascii {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.15;
  color: var(--accent);
  white-space: pre;
  margin: 0 0 18px 0;
  overflow-x: auto;
  text-shadow: 0 0 8px rgba(88,166,255,.25);
}
[data-theme="light"] .ascii { text-shadow: none; }
.prompt { font-family: var(--mono); font-size: 14px; color: var(--fg-dim); }
.prompt .user { color: var(--accent-2); }
.prompt .at { color: var(--fg-dim); }
.prompt .host { color: var(--accent-3); }
.prompt .path { color: var(--accent-4); }
.prompt .sym { color: var(--accent-5); }
.cmd { color: var(--fg); }
.cursor {
  display: inline-block;
  width: 8px; height: 16px;
  background: var(--accent);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.name { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; margin: 14px 0 2px; }
.role { font-family: var(--mono); color: var(--accent); font-size: 14px; }
.contact { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-family: var(--mono); font-size: 13px; }
.contact a { color: var(--fg-dim); text-decoration: none; border-bottom: 1px dashed transparent; transition: all .2s; }
.contact a:hover { color: var(--accent); border-color: var(--accent); }
.contact a.download-link { color: var(--accent-5); }
.contact a.download-link:hover { color: var(--accent); border-color: var(--accent-5); }
.contact .k { color: var(--accent-3); }

section { margin-top: 26px; }
h2.s {
  font-family: var(--mono);
  font-size: 13px;
  text-transform: lowercase;
  color: var(--accent);
  margin: 0 0 14px 0;
  display: flex; align-items: center; gap: 10px;
}
h2.s::before { content: "┌─"; color: var(--fg-dim); }
h2.s::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.section-body { padding: 18px 22px; }

.about { font-size: 15.5px; color: var(--fg); }
.about::before { content: "# "; color: var(--accent-2); font-family: var(--mono); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.skill { margin-bottom: 10px; }
.skill .row { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12.5px; margin-bottom: 4px; }
.skill .name { color: var(--fg); font-size: inherit; }
.skill .pct { color: var(--fg-dim); }
.bar { height: 6px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; position: relative; }
.bar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-4));
  width: 0;
  transition: width 1.2s cubic-bezier(.2,.8,.2,1);
}
.bar.exp > i { background: linear-gradient(90deg, var(--accent-2), var(--accent-3)); }

.tl { position: relative; padding-left: 22px; }
.tl::before {
  content: "";
  position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(var(--accent), transparent);
}
.job { position: relative; margin-bottom: 22px; }
.job::before {
  content: "";
  position: absolute; left: -22px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--bg-elev);
}
.job .head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin-bottom: 4px; }
.job .title { font-weight: 600; color: var(--fg); font-size: 15.5px; }
.job .company { color: var(--accent-4); font-family: var(--mono); font-size: 13.5px; }
.job .loc { color: var(--fg-dim); font-family: var(--mono); font-size: 12px; }
.job .dur {
  font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim);
  background: var(--bg-soft); padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border);
}
.job .desc { color: var(--fg); font-size: 14.5px; margin: 6px 0; }
.job ul { margin: 6px 0; padding-left: 20px; }
.job li { margin: 4px 0; color: var(--fg); }
.job li::marker { color: var(--accent); }
.contracts { margin-top: 10px; padding-left: 0; }
.contract {
  border-left: 2px solid var(--border);
  padding: 8px 0 8px 14px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, var(--bg-soft), transparent 60%);
  border-radius: 0 6px 6px 0;
}
.contract .ct { color: var(--accent-3); font-family: var(--mono); font-size: 13px; font-weight: 600; }
.contract .cc { color: var(--fg-dim); font-family: var(--mono); font-size: 12.5px; }
.contract .cd { color: var(--fg-dim); font-family: var(--mono); font-size: 11.5px; margin-top: 2px; }
.contract .cx { color: var(--fg); font-size: 14px; margin-top: 6px; }

.badge { display: inline-block; font-family: var(--mono); font-size: 10px; padding: 1px 7px; border-radius: 999px; margin-left: 8px; vertical-align: middle; font-weight: 600; letter-spacing: 0.3px; }
.badge.perm { background: rgba(63,185,80,0.15); color: var(--accent-2); border: 1px solid rgba(63,185,80,0.3); }
.badge.cont { background: rgba(88,166,255,0.15); color: var(--accent); border: 1px solid rgba(88,166,255,0.3); }

details.early { margin-top: 20px; }
details.early summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent-4);
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  user-select: none;
  transition: all .2s;
}
details.early summary:hover { border-color: var(--accent); color: var(--accent); }
details.early summary::marker { color: var(--accent-4); }
details.early .inner { margin-top: 14px; }
details.early .inner .job:last-child { margin-bottom: 0; }

.desc strong, li strong, .cx strong { color: var(--accent); font-weight: 600; }
.desc em, .cx em { color: var(--accent-4); font-style: italic; }

.edu { display: block; }
.edu .item { display: flex; flex-direction: column; align-items: stretch; }
.edu .org { font-weight: 600; color: var(--fg); font-size: 14px; }
.edu .deg { color: var(--accent-3); font-family: var(--mono); font-size: 12.5px; }
.edu .maj { color: var(--fg-dim); font-size: 13px; }
.edu .yr { color: var(--fg-dim); font-family: var(--mono); font-size: 11.5px; margin-top: 4px; }
.edu .quals { width: 100%; margin-top: 8px; display: grid; gap: 4px; }
.edu .qual { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: baseline; }
.edu .qual .yr { margin-top: 0; }

/* ---------- project link chip ---------- */
a.chip { text-decoration: none; display: inline-flex; width: auto; transition: border-color .2s, background .2s; }
a.chip:hover { border-color: var(--accent); background: var(--bg); }

.awards { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 11.5px;
  padding: 4px 9px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--fg);
  display: inline-flex; gap: 6px; align-items: center;
}
.chip .y { color: var(--fg-dim); font-size: 10.5px; }
.chip .t { color: var(--accent-2); }

.hobby { color: var(--fg); font-size: 15px; }
.hobby::before { content: "$ echo "; color: var(--accent-3); font-family: var(--mono); }

footer {
  margin-top: 40px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  text-align: center;
  border-top: 1px dashed var(--border);
  padding-top: 16px;
}
footer .heart { color: var(--accent-5); }
footer .cta {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--fg);
  font-family: var(--sans);
}
footer .cta a {
  color: var(--accent-5);
  text-decoration: none;
  font-family: var(--mono);
  border-bottom: 1px dashed transparent;
  transition: all .2s;
}
footer .cta a:hover { color: var(--accent); border-color: var(--accent); }

@media (max-width: 600px) {
  .ascii { font-size: 8px; }
  .name { font-size: 24px; }
  .term-body { padding: 16px !important; }
}

/* ---------- skip link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 14px;
  border-radius: 0 0 6px 6px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  top: 0;
}

/* ---------- focus ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.contact a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .bar > i {
    transition: none;
  }
  body {
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ---------- print ---------- */
@media print {
  html { background: #fff; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .wrap { max-width: 100%; padding: 0; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .bar > i { width: attr(data-w) !important; transition: none; }
  .cursor { display: none; }
  .toggle { display: none; }
  .skip-link { display: none; }
  .ascii { font-size: 6px; color: #333; text-shadow: none; }
  section { page-break-inside: avoid; }
  .job { page-break-inside: avoid; }
  .job .head { flex-wrap: wrap; }
  .job .dur { background: #eee; border-color: #ccc; color: #555; }
  .term { box-shadow: none; border: 1px solid #ccc; border-radius: 6px; }
  .term-bar { background: #eee; border-bottom: 1px solid #ccc; }
  .contact a { color: #000; }
  .contact a::after { content: " (" attr(href) ")"; font-size: 9px; color: #666; }
  .badge { border-color: #999; }
  .badge.perm { background: #e6f4ea; color: #137333; border-color: #137333; }
  .badge.cont { background: #e8f0fe; color: #1967d2; border-color: #1967d2; }
  .edu .item { background: #f5f5f5; border-color: #ddd; }
  .chip { background: #f5f5f5; border-color: #ddd; }
  .contract { border-left-color: #ccc; background: none; }
  details.early summary { border-style: solid; border-color: #ccc; }
  footer .cta { display: none; }
  footer { margin-top: 20px; color: #666; border-top-color: #ccc; }
  .bar > i { background: #333 !important; }
  .bar.exp > i { background: #555 !important; }
  .job::before { border-color: #333; }
  .tl::before { background: #999; }
}
