:root {
  --bg: #0a0e0c;
  --bg-raise: #0e1411;
  --bg-card: #0d120f;
  --line: #1d2a23;
  --line-bright: #2c4035;
  --copper: #b87333;
  --copper-bright: #e0a458;
  --gold: #e6c068;
  --green: #4ade80;
  --green-dim: #2c7a4b;
  --amber: #fbbf24;
  --silk: #dce8df;
  --silk-dim: #8aa093;
  --silk-faint: #56685e;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--silk);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}
::selection { background: var(--green-dim); color: #fff; }

/* ---------- PCB background canvas ---------- */
#pcb-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
}
.content { position: relative; z-index: 1; }

/* ---------- Nav ---------- */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 58px;
  background: rgba(10, 14, 12, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--silk);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 1px;
}
.nav-logo .chip {
  width: 26px; height: 26px;
  border: 1px solid var(--copper);
  border-radius: 3px;
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--copper-bright);
  background: linear-gradient(135deg, #14110c, #0d0b08);
  position: relative;
}
.nav-logo .chip::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--green);
}
nav ul { display: flex; gap: 28px; list-style: none; }
nav a.nl {
  color: var(--silk-dim);
  text-decoration: none;
  transition: color .2s;
}
nav a.nl:hover { color: var(--green); }
nav a.nl .idx { color: var(--green-dim); margin-right: 4px; }
.nav-burger { display: none; }

/* ---------- Layout ---------- */
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 32px; }
section { scroll-margin-top: 58px; }
section.wrap { padding: 48px 32px; }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 36px;
  font-family: var(--mono);
}
.sec-head .num { color: var(--green-dim); font-size: 14px; }
.sec-head h2 {
  font-family: var(--sans);
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 600;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.sec-head .rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-bright), transparent);
  position: relative;
  top: -6px;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 60px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 64px;
  align-items: center;
  width: 100%;
}
h1 {
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.05;
  margin-bottom: 14px;
}
.hero-role {
  font-family: var(--mono);
  font-size: clamp(15px, 1.8vw, 18px);
  color: var(--copper-bright);
  margin-bottom: 22px;
}
.hero-role .cursor {
  display: inline-block;
  width: 9px; height: 18px;
  background: var(--green);
  vertical-align: -2px;
  margin-left: 3px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero-desc {
  color: var(--silk-dim);
  font-size: 16px;
  max-width: 480px;
  margin-bottom: 32px;
}
.hero-desc strong { color: var(--silk); font-weight: 500; }
.hero-cta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.btn {
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 4px;
  transition: all .2s;
  letter-spacing: 0.5px;
}
.btn-pri {
  background: var(--green);
  color: #07120b;
  font-weight: 700;
  border: 1px solid var(--green);
}
.btn-pri:hover { background: #6ee7a0; box-shadow: 0 0 24px rgba(74, 222, 128, 0.35); }
.btn-sec {
  color: var(--copper-bright);
  border: 1px solid var(--copper);
}
.btn-sec:hover { background: rgba(184, 115, 51, 0.12); box-shadow: 0 0 18px rgba(184, 115, 51, 0.25); }
.hero-social { display: flex; gap: 10px; margin-left: 6px; }
.hero-social a {
  color: var(--silk-dim);
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--line-bright);
  border-radius: 4px;
  transition: all .2s;
}
.hero-social a:hover { color: var(--green); border-color: var(--green-dim); transform: translateY(-2px); }

/* ---------- Buck converter widget ---------- */
.lab {
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: rgba(13, 18, 15, 0.88);
  backdrop-filter: blur(6px);
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,0.5);
}
.lab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--silk-dim);
  letter-spacing: 1px;
}
.lab-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 8px; animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 50% { opacity: 0.3; } }
.lab-bar .tag { color: var(--copper-bright); }
#scope { display: block; width: 100%; height: 210px; }
.lab-controls {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
}
.lab-row { display: flex; align-items: center; gap: 14px; }
.lab-row label { font-size: 11px; color: var(--silk-dim); white-space: nowrap; letter-spacing: 1px; }
input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--copper) var(--fill, 17%), var(--line-bright) var(--fill, 17%));
  outline: none;
  cursor: ew-resize;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 3px;
  background: var(--bg);
  border: 2px solid var(--copper-bright);
  box-shadow: 0 0 10px rgba(224, 164, 88, 0.5);
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 3px;
  background: var(--bg);
  border: 2px solid var(--copper-bright);
}
.lab-readouts { display: flex; gap: 10px; margin-top: 14px; }
.ro {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  background: #080c0a;
}
.ro .k { font-size: 9px; color: var(--silk-faint); letter-spacing: 1.5px; display: block; }
.ro .v { font-size: 19px; font-weight: 700; color: var(--green); text-shadow: 0 0 12px rgba(74,222,128,.45); }
.ro .v.amber { color: var(--amber); text-shadow: 0 0 12px rgba(251,191,36,.4); }
.ro .v.red { color: #f87171; text-shadow: 0 0 12px rgba(248,113,113,.4); }
.ro .v small { font-size: 11px; font-weight: 400; color: var(--silk-faint); }
.lab-note {
  margin-top: 12px;
  font-size: 10px;
  color: var(--silk-faint);
  line-height: 1.5;
}
.lab-note a { color: var(--copper-bright); text-decoration: none; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 250px 1.3fr 1fr; gap: 40px; align-items: start; }
.about-photo { margin: 0; }
.about-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--copper);
  border-radius: 6px;
}
.about-photo figcaption {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--silk-faint);
  text-align: center;
  margin-top: 10px;
}
.about-text p { color: var(--silk-dim); margin-bottom: 16px; font-size: 16px; }
.about-text strong { color: var(--silk); font-weight: 500; }
.edu-card {
  border: 1px solid var(--line-bright);
  border-left: 3px solid var(--copper);
  border-radius: 6px;
  background: var(--bg-card);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.edu-card .when { font-family: var(--mono); font-size: 11px; color: var(--copper-bright); letter-spacing: 1px; }
.edu-card h3 { font-size: 16px; font-weight: 600; margin: 4px 0 2px; }
.edu-card .where { color: var(--silk-dim); font-size: 13px; }

/* ---------- Experience & Projects: sub-labels ---------- */
.sub-label {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--silk-faint);
  margin: 4px 0 28px;
  scroll-margin-top: 70px;
}
.sub-label::before, .sub-label::after {
  content: '';
  height: 1px;
  background: var(--line);
  flex: 1;
}

/* ---------- Experience cards (card-edge connector style) ---------- */
.xp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: 26px 26px;
  margin-bottom: 64px;
}
.xp {
  position: relative;
  border: 1px solid var(--line-bright);
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--bg-raise), var(--bg-card));
  padding: 22px 22px 18px;
  transition: transform .22s, border-color .22s, box-shadow .22s;
}
.xp::after {
  content: '';
  position: absolute;
  left: 26px; right: 26px;
  bottom: -9px;
  height: 8px;
  background-image: repeating-linear-gradient(90deg, var(--gold) 0 16px, transparent 16px 27px);
  border-radius: 0 0 2px 2px;
  opacity: 0.45;
  transition: opacity .22s;
}
.xp:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 14px 44px rgba(0,0,0,0.5), 0 0 26px rgba(230, 192, 104, 0.13);
}
.xp:hover::after { opacity: 1; }
.xp h3 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin: 12px 0 3px;
}
.xp-role {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--copper-bright);
  letter-spacing: 1.5px;
  margin-bottom: 14px;
}
.xp-when {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--silk-dim);
  letter-spacing: 1px;
  white-space: nowrap;
}
.xp ul { margin: 0; padding: 0; list-style: none; }
.xp li {
  color: var(--silk-dim);
  font-size: 13.5px;
  line-height: 1.65;
  padding-left: 18px;
  position: relative;
  margin-bottom: 7px;
}
.xp li::before { content: '▸'; position: absolute; left: 0; color: var(--green-dim); }

/* ---------- Projects ---------- */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 36px;
  font-family: var(--mono);
}
.filters button {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 1px;
  padding: 8px 14px;
  background: transparent;
  color: var(--silk-dim);
  border: 1px solid var(--line-bright);
  border-radius: 3px;
  cursor: pointer;
  transition: all .2s;
}
.filters button:hover { color: var(--silk); border-color: var(--silk-faint); }
.filters button.on {
  color: var(--green);
  border-color: var(--green-dim);
  background: rgba(74, 222, 128, 0.07);
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.12);
}
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 26px;
}
.ic {
  position: relative;
  border: 1px solid var(--line-bright);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--bg-raise), var(--bg-card));
  padding: 24px 22px 18px;
  display: flex;
  flex-direction: column;
  transition: transform .22s, border-color .22s, box-shadow .22s;
}
.ic::before, .ic::after {
  content: '';
  position: absolute;
  left: 18px; right: 18px;
  height: 7px;
  background-image: repeating-linear-gradient(90deg, var(--copper) 0 6px, transparent 6px 17px);
  opacity: 0.5;
  transition: opacity .22s, background-image .22s;
}
.ic::before { top: -8px; }
.ic::after { bottom: -8px; }
.ic:hover {
  transform: translateY(-4px);
  border-color: var(--copper);
  box-shadow: 0 14px 44px rgba(0,0,0,0.5), 0 0 26px rgba(184, 115, 51, 0.13);
}
.ic:hover::before, .ic:hover::after { opacity: 1; }
.ic-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  font-family: var(--mono);
}
.ic-ref { font-size: 11px; color: var(--copper-bright); letter-spacing: 1.5px; }
.ic-ref .p1 { display: inline-block; width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--copper); margin-right: 7px; vertical-align: 1px; }
.ic-links { display: flex; gap: 10px; }
.ic-links a { color: var(--silk-dim); transition: color .2s, transform .2s; display: inline-flex; }
.ic-links a:hover { color: var(--green); transform: translateY(-1px); }
.ic h3 { font-size: 19px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.3px; }
.ic .desc { color: var(--silk-dim); font-size: 13.5px; line-height: 1.65; flex: 1; }
.ic .meta {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-bright);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tt {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--silk-dim);
  border: 1px solid var(--line-bright);
  padding: 3px 8px;
  border-radius: 2px;
}
.ic .stars {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 2px;
  margin-left: 8px;
  vertical-align: 2px;
}
.badge.live { color: var(--amber); border: 1px solid rgba(251,191,36,0.4); }
.badge.paper { color: var(--green); border: 1px solid var(--green-dim); }
.proj-cta { text-align: center; margin-top: 44px; }

/* ---------- Skills (datasheet style) ---------- */
.ds-table {
  border: 1px solid var(--line-bright);
  border-radius: 6px;
  overflow: hidden;
  font-family: var(--mono);
}
.ds-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  border-bottom: 1px solid var(--line);
}
.ds-row:last-child { border-bottom: none; }
.ds-row .k {
  padding: 16px 20px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--copper-bright);
  background: rgba(184, 115, 51, 0.05);
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
}
.ds-row .v { padding: 14px 20px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }

/* ---------- Resume ---------- */
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.res-card {
  border: 1px solid var(--line-bright);
  border-radius: 6px;
  background: var(--bg-card);
  padding: 24px 22px;
  text-decoration: none;
  color: var(--silk);
  transition: all .2s;
  font-family: var(--mono);
}
.res-card:hover { border-color: var(--green-dim); transform: translateY(-3px); box-shadow: 0 0 24px rgba(74,222,128,0.1); }
.res-card .rev { font-size: 10px; color: var(--silk-faint); letter-spacing: 1.5px; }
.res-card h3 { font-family: var(--sans); font-size: 17px; margin: 8px 0 6px; }
.res-card p { font-size: 12px; color: var(--silk-dim); line-height: 1.5; }
.res-card .dl { display: inline-block; margin-top: 14px; font-size: 11px; color: var(--green); letter-spacing: 1px; }

/* ---------- Contact ---------- */
.contact-box {
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 52px 40px;
  text-align: center;
}
.contact-box h2 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 12px; letter-spacing: -0.5px; }
.contact-box p { color: var(--silk-dim); max-width: 460px; margin: 0 auto 28px; font-size: 15px; }
.contact-links { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; font-family: var(--mono); }
.contact-links a {
  color: var(--silk-dim);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--line-bright);
  padding: 11px 20px;
  border-radius: 4px;
  transition: all .2s;
}
.contact-links a:hover { color: var(--green); border-color: var(--green-dim); }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--silk-faint);
}
footer .tag { color: var(--copper-bright); }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .about-grid { grid-template-columns: 1fr; }
  .about-photo { max-width: 260px; }
  .res-grid { grid-template-columns: 1fr; }
  .ds-row { grid-template-columns: 1fr; }
  .ds-row .k { border-right: none; border-bottom: 1px solid var(--line); padding: 10px 20px; }
  nav ul { display: none; }
}
