:root {
  --bg: #f6f8fc;
  --bg-2: #eef2fa;
  --panel: #ffffff;
  --line: #e2e7f1;
  --line-strong: #cdd5e6;
  --text: #121a2e;
  --body: #3d4760;
  --muted: #667089;
  --accent: #3d5cf5;
  --accent-2: #8b5cf6;
  --accent-soft: #eef1ff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(18, 26, 46, .04), 0 12px 32px -12px rgba(18, 26, 46, .14);
  --shadow-lg: 0 2px 4px rgba(18, 26, 46, .04), 0 30px 60px -24px rgba(40, 56, 120, .28);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 88% -10%, rgba(139, 92, 246, .14), transparent 60%),
    radial-gradient(900px 560px at -8% 16%, rgba(61, 92, 245, .12), transparent 60%),
    radial-gradient(1000px 700px at 50% 110%, rgba(14, 165, 233, .10), transparent 60%),
    radial-gradient(rgba(61, 92, 245, .10) 1px, transparent 1px);
  background-size: auto, auto, auto, 26px 26px;
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.mono { font-family: var(--mono); }
a { color: inherit; }
code { font-family: var(--mono); font-size: .85em; background: var(--accent-soft); padding: .1em .4em; border-radius: 6px; color: #2f45c4; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px clamp(20px, 5vw, 64px);
  background: rgba(246, 248, 252, .78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { font-family: var(--mono); font-weight: 600; text-decoration: none; }
.logo span { color: var(--accent); }
.nav nav { display: flex; gap: 28px; align-items: center; }
.nav nav a { text-decoration: none; color: var(--muted); font-size: .95rem; transition: color .2s; }
.nav nav a:hover { color: var(--text); }

main { max-width: 1180px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 48px); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.5fr 1fr; align-items: center; gap: clamp(32px, 6vw, 80px); padding: clamp(56px, 10vh, 110px) 0 24px; }
.hero-photo { display: flex; justify-content: center; }
.photo-ring {
  position: relative; width: min(340px, 80vw); aspect-ratio: 1; border-radius: 50%; padding: 5px;
  background: conic-gradient(from 200deg, var(--accent), var(--accent-2), #0ea5e9, var(--accent));
  box-shadow: 0 30px 70px -24px rgba(61, 92, 245, .45);
  animation: float 7s ease-in-out infinite;
}
.photo-ring img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; border-radius: 50%; display: block; border: 6px solid #fff; }
@keyframes float { 50% { transform: translateY(-10px); } }
.eyebrow { color: var(--accent); font-size: .85rem; letter-spacing: .04em; display: flex; align-items: center; gap: 10px; margin: 0 0 18px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(61, 92, 245, .5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(61, 92, 245, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 92, 245, 0); } }
h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.08; letter-spacing: -.035em; margin: 0 0 24px; font-weight: 800; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes blink { 50% { opacity: 0; } }
.lede { color: var(--body); font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 640px; margin: 0 0 36px; }
.cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  text-decoration: none; font-weight: 600; font-size: .95rem;
  box-shadow: 0 1px 2px rgba(18, 26, 46, .05);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.btn.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.icon-btn { display: inline-flex; align-items: center; gap: 8px; }
.icon-btn svg { width: 16px; height: 16px; }
.nav-icons { display: inline-flex; gap: 6px; margin-left: 4px; }
.icon-link { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; color: var(--muted) !important; transition: color .2s, border-color .2s, transform .2s; }
.icon-link:hover { color: var(--accent) !important; border-color: var(--accent); transform: translateY(-2px); }
.icon-link svg { width: 16px; height: 16px; }

/* ---------- sections ---------- */
.section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.02em; margin: 0 0 40px; }
.section-title .mono { color: var(--accent); font-size: .6em; vertical-align: middle; margin-right: 8px; }
.projects { padding: 56px 0 40px; }

.project {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(28px, 4vw, 56px);
  align-items: center; margin-bottom: 110px;
}
.project.flip .project-visual { order: 2; }
.project:last-of-type { margin-bottom: 40px; }
.kicker { color: var(--accent); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 8px; font-weight: 500; }
.project h3 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0 0 14px; letter-spacing: -.02em; }
.project-body > p { color: var(--body); margin: 0 0 18px; }
.points { list-style: none; padding: 0; margin: 0 0 22px; }
.points li { position: relative; padding-left: 22px; margin-bottom: 8px; color: var(--muted); font-size: .95rem; }
.points li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }
.points b { color: var(--text); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.tags span { font-family: var(--mono); font-size: .75rem; padding: 5px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line-strong); color: #39425a; }
.link { color: var(--accent); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.links { display: flex; gap: 24px; flex-wrap: wrap; }

/* ---------- project visuals ---------- */
.project-visual { position: relative; }
.project-visual > * {
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel); overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform .4s ease, box-shadow .3s;
}
.project:hover .project-visual > * { transform: translateY(-4px); }

.shot { display: block; position: relative; text-decoration: none; background: #17243a !important; }
.shot img { display: block; width: 100%; height: auto; transition: transform .6s ease; }
.project:hover .shot img { transform: scale(1.03); }
.shot-badge {
  position: absolute; top: 12px; right: 12px; font-size: .7rem; color: var(--accent);
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px;
}

/* ---------- blackjack scene ---------- */
.table-scene {
  aspect-ratio: 16 / 11; position: relative; padding: 18px;
  background: radial-gradient(ellipse at 50% 40%, #13805e 0%, #0d5c44 55%, #083d2d 100%) !important;
  display: flex; flex-direction: column; justify-content: space-around;
}
.table-scene::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.08) 0 1px, transparent 1px 3px);
}
.hud { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; justify-content: space-between; font-size: .7rem; color: #e3f6ee; opacity: .9; z-index: 2; }
.rec { color: #ff6b6b; animation: blink 1.4s steps(1) infinite; }
.hand { display: flex; flex-direction: column-reverse; align-items: center; gap: 6px; }
.hand.dealer { margin-top: 26px; }
.hand-label { font-size: .65rem; letter-spacing: .15em; color: rgba(255,255,255,.65); }
.cards { display: flex; gap: 14px; min-height: 108px; }
.card {
  position: relative; width: 72px; height: 100px; border-radius: 8px;
  background: #fbfaf7; color: #111; box-shadow: 0 8px 18px rgba(0,0,0,.35);
  font-weight: 700; opacity: 0; transform: translateY(-20px) rotate(-6deg);
  animation: deal .45s cubic-bezier(.2,.8,.2,1) forwards;
}
.card.red { color: #c62828; }
.card .tl { position: absolute; top: 6px; left: 8px; font-size: 1rem; line-height: 1; text-align: center; }
.card .br { position: absolute; bottom: 6px; right: 8px; font-size: 1rem; line-height: 1; transform: rotate(180deg); text-align: center; }
.card .mid { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; }
@keyframes deal { to { opacity: 1; transform: translateY(0) rotate(var(--rot, 0deg)); } }
.bbox { position: absolute; inset: -6px; border: 2px solid #39ff9c; border-radius: 6px; opacity: 0; animation: box .3s ease forwards; }
.bbox span {
  position: absolute; top: -20px; left: -2px; background: #39ff9c; color: #04140f;
  font: 600 .65rem var(--mono); padding: 2px 5px; border-radius: 3px 3px 3px 0; white-space: nowrap;
}
@keyframes box { from { opacity: 0; transform: scale(1.15); } to { opacity: 1; transform: scale(1); } }
.decision {
  position: absolute; bottom: 14px; right: 14px; z-index: 2;
  background: rgba(4, 20, 15, .85); border: 1px solid #39ff9c; color: #39ff9c;
  padding: 8px 12px; border-radius: 8px; font-size: .78rem; opacity: 0; transition: opacity .3s;
}
.decision.show { opacity: 1; }
.decision b { color: #fff; font-size: 1rem; margin-left: 6px; }

/* ---------- pipeline ---------- */
.pipeline { padding: 18px; background: linear-gradient(180deg, #f8faff, #fff) !important; }
#pipe-svg { width: 100%; height: auto; display: block; }
.edge { stroke: #c6cee2; stroke-width: 2; stroke-dasharray: 5 6; animation: dash 1.2s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -22; } }
.node rect { fill: #fff; stroke: #d5dcea; stroke-width: 1.5; transition: stroke .3s, fill .3s; }
.node text { fill: var(--text); font: 600 13px Inter, sans-serif; text-anchor: middle; }
.node text.sub { fill: var(--muted); font: 400 10px var(--mono); }
.node.accent rect { stroke: var(--accent-2); fill: #f5f0ff; }
.node.lit rect { stroke: var(--accent); fill: var(--accent-soft); }
.node.verdict.fraud rect { stroke: #e5484d; fill: #fff0f0; }
.node.verdict.fraud text:first-of-type { fill: #c9262c; }
.node.verdict.legit rect { stroke: #1f9d6b; fill: #ecfbf4; }
.node.verdict.legit text:first-of-type { fill: #13734d; }
.packet { fill: var(--accent); filter: drop-shadow(0 0 5px rgba(61, 92, 245, .6)); }
.packet.bad { fill: #e5484d; filter: drop-shadow(0 0 5px rgba(229, 72, 77, .6)); }

/* ---------- chart ---------- */
.viz-root {
  color-scheme: light;
  --surface-1: #ffffff;
  --text-primary: #191919;
  --text-secondary: #666666;
  --grid: #edf0f5;
  --series-1: #257de0; /* Li-ion NMC */
  --series-2: #f47230; /* LFP */
  --series-3: #00b894; /* Solid-State */
}
.chart-card { padding: 20px 20px 14px; }
.chart-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-title { margin: 0; font-weight: 600; font-size: .98rem; color: var(--text-primary); }
.chart-sub { margin: 2px 0 0; font-size: .72rem; color: var(--text-secondary); }
.legend { list-style: none; display: flex; gap: 14px; margin: 0; padding: 0; font-size: .75rem; color: var(--text-secondary); align-items: center; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-wrap .axis text { fill: var(--text-secondary); font: 10px var(--mono); }
.chart-wrap .gridline { stroke: var(--grid); stroke-width: 1; }
.chart-wrap .eol { stroke: #8a8f99; stroke-dasharray: 4 4; stroke-width: 1; }
.chart-wrap .eol-label { fill: var(--text-secondary); font: 10px var(--mono); }
.chart-wrap .series { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-wrap .dlabel { font: 600 11px Inter, sans-serif; fill: var(--text-primary); }
.chart-wrap .crosshair { stroke: #b3b9c4; stroke-width: 1; }
.chart-wrap .hover-dot { stroke: var(--surface-1); stroke-width: 2; }
.tooltip {
  position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  border-radius: 8px; padding: 8px 10px; font-size: .75rem; color: var(--text-primary);
  opacity: 0; transition: opacity .12s; white-space: nowrap; z-index: 3;
}
.tooltip .t-head { color: var(--text-secondary); font-family: var(--mono); margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 6px; }
.tooltip .t-row i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tooltip .t-row b { margin-left: auto; padding-left: 12px; font-weight: 600; }
.chart-note { font-size: .68rem; color: var(--text-secondary); margin: 8px 0 0; }

/* ---------- experience ---------- */
.experience { padding: 40px 0 72px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 28px; border-left: 2px solid var(--line); }
.role { position: relative; padding: 0 0 40px; }
.role:last-child { padding-bottom: 0; }
.role::before {
  content: ""; position: absolute; left: -36px; top: 8px; width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 0 5px var(--bg);
}
.role-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.role h3 { margin: 0; font-size: 1.2rem; letter-spacing: -.01em; }
.role .at { color: var(--accent); font-weight: 600; }
.role-meta { margin: 2px 0 0; color: var(--muted); font-size: .78rem; }
.role-date { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.role .points { max-width: 900px; }
.subrole { margin: 0 0 18px; }
.subrole .role-head { margin-bottom: 8px; }
.subrole h4 { margin: 0; font-size: 1.02rem; color: var(--text); display: flex; align-items: center; gap: 10px; }
.subrole h4::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg); }
.subrole .points { margin-bottom: 10px; padding-left: 17px; }

/* ---------- volunteer ---------- */
.volunteer { padding: 40px 0 72px; }
.vol-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.vol-body h3 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); margin: 0 0 14px; letter-spacing: -.02em; }
.vol-body > p { color: var(--body); margin: 0 0 18px; }
.carousel { position: relative; min-width: 0; }
.track {
  display: flex; gap: 22px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  padding: 10px calc(50% - 125px) 18px; scrollbar-width: none; outline: none;
}
.track::-webkit-scrollbar { display: none; }
.slide { flex: none; width: 250px; margin: 0; scroll-snap-align: center; text-align: center; transition: transform .35s ease, opacity .35s ease; opacity: .45; transform: scale(.9); }
.slide.active { opacity: 1; transform: none; }
.phone {
  border-radius: 34px; padding: 9px; background: #111827;
  box-shadow: 0 2px 0 1px #2b3446 inset, var(--shadow-lg);
}
.phone img { display: block; width: 100%; height: auto; aspect-ratio: 540 / 1174; object-fit: cover; border-radius: 26px; }
.slide figcaption { margin-top: 12px; font-size: .75rem; color: var(--muted); letter-spacing: .04em; }
.carousel-ctrl { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 6px; }
.nav-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  font-size: 1.4rem; line-height: 1; cursor: pointer; display: grid; place-items: center; padding-bottom: 3px;
  box-shadow: 0 1px 2px rgba(18, 26, 46, .05); transition: border-color .2s, color .2s, transform .2s;
}
.nav-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.nav-btn:disabled { opacity: .35; cursor: default; transform: none; }
.dots { display: flex; gap: 8px; }
.dots button { width: 8px; height: 8px; border-radius: 999px; border: 0; padding: 0; background: var(--line-strong); cursor: pointer; transition: width .25s, background .25s; }
.dots button.on { width: 22px; background: var(--accent); }

/* ---------- cards: education + certifications ---------- */
.education, .certs { padding: 40px 0 72px; }
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.edu-card, .cert-card {
  display: flex; gap: 18px; padding: 24px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .3s, border-color .3s, box-shadow .3s;
}
.edu-card:hover, .cert-card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.edu-mark, .cert-mark {
  flex: none; width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center;
  font-weight: 600; font-size: .85rem; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.cert-mark.aws { background: linear-gradient(135deg, #ff9900, #f2711c); }
.cert-mark.hashi { background: linear-gradient(135deg, #7b42bc, #5c2fa0); }
.edu-card h3, .cert-card h3 { margin: 0 0 4px; font-size: 1.1rem; letter-spacing: -.01em; }
.cert-card h3 { font-size: 1rem; line-height: 1.35; }
.edu-degree { margin: 0; color: var(--text); font-weight: 500; }
.edu-focus { margin: 2px 0 14px; color: var(--muted); font-size: .92rem; }
.cert-issuer { margin: 0; color: var(--muted); font-size: .88rem; }
.edu-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.edu-meta span { font-size: .72rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: #39425a; background: var(--bg); }

/* ---------- about ---------- */
.about { padding: 40px 0 64px; }
.about-text { color: var(--body); font-size: 1.15rem; max-width: 720px; margin: 0 0 40px; }
.toolbox { display: grid; grid-template-columns: 1fr 2fr; gap: 28px 40px; }
.tool-group:last-child { grid-column: 1 / -1; }
.toolbox h4 { margin: 0 0 12px; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--muted); font-weight: 500; }
.contact-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 0 0 80px; }
.contact-item {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: #fff; text-decoration: none; color: var(--body); font-size: .92rem;
  box-shadow: 0 1px 2px rgba(18, 26, 46, .05);
  transition: border-color .2s, color .2s, transform .2s, box-shadow .2s;
}
.contact-item:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow); }
.contact-item svg { width: 16px; height: 16px; color: var(--accent); }
footer { text-align: center; color: var(--muted); font-size: .75rem; padding: 28px; border-top: 1px solid var(--line); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translate(-50%, 16px);
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  background: var(--text); color: #fff; font-size: .88rem; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 980px) {
  .cert-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 880px) {
  .project, .edu-grid, .cert-grid, .toolbox, .vol-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-photo { order: -1; }
  .photo-ring { width: min(230px, 60vw); }
  .nav nav > a { display: none; }
  .project.flip .project-visual { order: 0; }
  .nav nav { gap: 18px; }
  .table-scene { aspect-ratio: auto; min-height: 380px; padding-top: 34px; }
  .card { width: 58px; height: 82px; }
  .cards { min-height: 90px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
