:root {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --bg-soft: #f1f2f6;
  --text: #14161c;
  --muted: #5d6472;
  --border: #e4e6ec;
  --accent: #5b5bf0;
  --accent-2: #14b8a6;
  --accent-soft: rgba(91, 91, 240, .1);
  --shadow: 0 10px 30px -12px rgba(20, 22, 28, .18);
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-elev: #12151c;
  --bg-soft: #181c25;
  --text: #eceef4;
  --muted: #9aa1b2;
  --border: #242936;
  --accent: #8b8bff;
  --accent-2: #2dd4bf;
  --accent-soft: rgba(139, 139, 255, .14);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: min(1080px, 100% - 40px); margin-inline: auto; }
.mono { font-family: var(--mono); }

/* progress bar */
.progress {
  position: fixed; inset: 0 auto auto 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 100;
}

/* header */
.header {
  position: fixed; top: 0; inset-inline: 0; z-index: 50;
  backdrop-filter: blur(14px) saturate(160%);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.header.scrolled { border-bottom-color: var(--border); }
.header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-weight: 800; letter-spacing: -.02em; color: var(--text); font-size: 1.1rem; }
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--muted); font-size: .9rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; transition: .2s;
}
.nav a:hover { color: var(--text); text-decoration: none; background: var(--bg-soft); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text); cursor: pointer; transition: .2s; margin-left: 8px;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
.sun { display: none; }
:root[data-theme="dark"] .sun { display: block; }
:root[data-theme="dark"] .moon { display: none; }

/* hero */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; padding: 120px 0 80px; overflow: hidden; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; z-index: -1; pointer-events: none;
}
.blob.one { width: 460px; height: 460px; background: var(--accent); top: -120px; right: -100px; }
.blob.two { width: 380px; height: 380px; background: var(--accent-2); bottom: -120px; left: -120px; opacity: .22; }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; font-size: .82rem; font-weight: 500;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--muted);
}
.badge i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); }
h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); line-height: 1.05; letter-spacing: -.04em; margin: 22px 0 14px; font-weight: 800; }
.gradient {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.typed-line { font-size: clamp(1.1rem, 2.5vw, 1.4rem); color: var(--muted); font-weight: 500; min-height: 2em; }
.typed-line .caret { display: inline-block; width: 2px; height: 1.1em; background: var(--accent); margin-left: 3px; vertical-align: -3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { max-width: 60ch; color: var(--muted); font-size: 1.05rem; margin: 18px 0 30px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 12px;
  font-weight: 600; font-size: .95rem; border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text); cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn svg { width: 18px; height: 18px; }
.meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 30px; color: var(--muted); font-size: .9rem; }
.meta span { display: inline-flex; align-items: center; gap: 8px; }
.meta img { width: 18px; height: 18px; }
:root[data-theme="dark"] .meta img { filter: invert(.85); }

.portrait { position: relative; justify-self: center; width: min(340px, 80%); aspect-ratio: 1; }
.portrait::before {
  content: ""; position: absolute; inset: -14px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent));
  animation: spin 10s linear infinite; filter: blur(2px);
}
.portrait img { position: relative; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 6px solid var(--bg); }
@keyframes spin { to { transform: rotate(360deg); } }

.scroll-hint { position: absolute; bottom: 26px; left: 50%; translate: -50% 0; color: var(--muted); font-size: .8rem; animation: float 2.2s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(6px); } }

/* sections */
section { padding: 100px 0; }
.eyebrow { font-family: var(--mono); color: var(--accent); font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); letter-spacing: -.03em; margin: 8px 0 44px; line-height: 1.15; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 56px; }
.stat { padding: 22px; border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--border); }
.stat b { display: block; font-size: 2rem; letter-spacing: -.03em; }
.stat span { color: var(--muted); font-size: .88rem; }

/* timeline */
.timeline { position: relative; display: grid; gap: 22px; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.card {
  position: relative; padding: 26px; border-radius: var(--radius);
  background: var(--bg-elev); border: 1px solid var(--border);
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.timeline .card::before {
  content: ""; position: absolute; left: -33px; top: 32px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
}
.timeline .card.current::before { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.card-head { display: flex; gap: 16px; align-items: flex-start; }
.logo-tile {
  flex: none; width: 52px; height: 52px; border-radius: 12px; background: #fff;
  border: 1px solid var(--border); display: grid; place-items: center; padding: 8px;
}
.logo-tile img { max-height: 100%; object-fit: contain; }
.card-title { flex: 1; min-width: 0; }
.card h3 { margin: 0; font-size: 1.15rem; letter-spacing: -.01em; }
.org { color: var(--muted); font-size: .95rem; }
.org a { color: inherit; }
.org a:hover { color: var(--accent); }
.when { text-align: right; font-family: var(--mono); font-size: .8rem; color: var(--muted); white-space: nowrap; }
.when em { display: block; font-style: normal; color: var(--accent); }
.card ul.points { margin-top: 16px; display: grid; gap: 8px; color: var(--muted); font-size: .95rem; }
.card ul.points li { position: relative; padding-left: 20px; }
.card ul.points li::before { content: "›"; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 500;
  background: var(--accent-soft); color: var(--accent); font-family: var(--mono);
}
.more-btn {
  margin-top: 14px; background: none; border: none; color: var(--accent); font: inherit;
  font-size: .88rem; font-weight: 600; cursor: pointer; padding: 0;
}
.collapsible { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .35s; }
.collapsible > div { overflow: hidden; }
.collapsible.closed { grid-template-rows: 0fr; }

/* projects */
.subhead { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 8px 0 16px; }
.subhead:not(:first-of-type) { margin-top: 40px; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.project { display: flex; flex-direction: column; gap: 10px; padding: 20px; color: var(--text); }
.project.link:hover { text-decoration: none; }
.project p { margin: 0; color: var(--muted); font-size: .9rem; }
.p-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.p-top b { font-size: 1rem; }
.lang { flex: none; font-family: var(--mono); font-size: .72rem; padding: 3px 9px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); }
.lang::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--c, var(--accent)); }
.lang.kotlin { --c: #a97bff; } .lang.java { --c: #f89820; } .lang.python { --c: #3776ab; }
.priv { align-self: flex-start; font-size: .75rem; color: var(--muted); border: 1px dashed var(--border); padding: 2px 10px; border-radius: 999px; }

/* skills */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-soft); margin-bottom: 28px; flex-wrap: wrap; }
.tab { border: none; background: none; padding: 8px 18px; border-radius: 9px; font: inherit; font-size: .9rem; font-weight: 600; color: var(--muted); cursor: pointer; transition: .2s; }
.tab[aria-selected="true"] { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.skill-grid[hidden] { display: none; }
.skill {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 12px;
  border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--border);
  font-size: .88rem; font-weight: 600; transition: .25s; animation: pop .4s both;
}
.skill:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.skill img { width: 48px; height: 48px; object-fit: contain; }
:root[data-theme="dark"] .skill img { background: #fff; border-radius: 12px; padding: 7px; }
.skill .glyph { width: 48px; height: 48px; display: grid; place-items: center; font-size: 1.4rem; color: var(--accent); background: var(--accent-soft); border-radius: 12px; }
@keyframes pop { from { opacity: 0; transform: scale(.92); } }

/* awards */
.awards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.award { display: flex; gap: 16px; align-items: flex-start; text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.award .trophy { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(245, 158, 11, .15); font-size: 1.3rem; }
.award p { margin: 0; font-weight: 600; font-size: .98rem; }
.award small { color: var(--accent); font-weight: 600; }

/* two col lists */
.tag-list { display: flex; flex-wrap: wrap; gap: 12px; }
.tag {
  display: inline-flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 14px;
  background: var(--bg-elev); border: 1px solid var(--border); font-weight: 500; transition: .2s;
}
.tag:hover { border-color: var(--accent); transform: translateY(-2px); }
.tag img { width: 26px; height: 26px; object-fit: contain; }
.tag small { color: var(--muted); font-weight: 400; }
.interests .tag img { filter: none; }
:root[data-theme="dark"] .interests .tag img { background: #fff; border-radius: 6px; padding: 2px; width: 30px; height: 30px; }
.prose { margin-top: 36px; display: grid; gap: 14px; max-width: 70ch; color: var(--muted); }
.prose p { margin: 0; }

/* footer */
footer { padding: 60px 0 40px; border-top: 1px solid var(--border); text-align: center; color: var(--muted); }
footer .big { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -.03em; color: var(--text); margin-bottom: 20px; }
.socials { display: flex; justify-content: center; gap: 12px; margin: 22px 0; }
.socials .icon-btn { margin: 0; width: 46px; height: 46px; }
footer small { font-size: .82rem; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(5, 7, 12, .85); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-height: 88vh; max-width: min(1000px, 100%); border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); background: #fff; }
.lightbox .close { position: absolute; top: 18px; right: 18px; color: #fff; border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); }

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

/* responsive */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; text-align: left; }
  .portrait { order: -1; width: 170px; justify-self: start; margin: 14px 0 0 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .awards { grid-template-columns: 1fr; }
  .menu-btn { display: grid; }
  .nav {
    position: fixed; top: 64px; inset-inline: 0; flex-direction: column; align-items: stretch;
    padding: 12px 20px 20px; background: var(--bg); border-bottom: 1px solid var(--border);
    transform: translateY(-120%); transition: transform .3s; z-index: -1;
  }
  .nav.open { transform: none; }
  .nav a { padding: 12px 14px; border-radius: 10px; }
  .nav-actions { display: flex; }
  .card-head { flex-wrap: wrap; }
  .when { text-align: left; width: 100%; padding-left: 68px; white-space: normal; }
  section { padding: 72px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print {
  .header, .progress, .scroll-hint, .blob, .lightbox, .icon-btn { display: none !important; }
  .reveal { opacity: 1; transform: none; }
  section { padding: 24px 0; }
}
