:root {
  --bg: #f7f7fb; --bg-alt: #eeedf7; --surface: #ffffff; --text: #17142e; --muted: #5d5a78;
  --border: #e1dff0; --accent: #6c4bff; --accent-2: #00b8d9; --shadow: 0 10px 30px rgba(40, 20, 120, .08);
  --radius: 18px;
}
[data-theme="dark"] {
  --bg: #0f0b2e; --bg-alt: #151040; --surface: #1c1650; --text: #eeeaff; --muted: #a8a3cc;
  --border: #2c2570; --accent: #8f74ff; --accent-2: #2fd6f2; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.65; transition: background .3s, color .3s; overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.wrap { width: min(1140px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.center { text-align: center; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; border-radius: 6px; }

/* Nav */
.nav { position: fixed; inset: 0 0 auto; z-index: 50; transition: background .3s, box-shadow .3s; }
.nav.scrolled { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); box-shadow: 0 1px 0 var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.nav-links { display: flex; gap: 6px; list-style: none; }
.nav-links a { padding: 8px 14px; border-radius: 999px; font-weight: 500; color: var(--muted); transition: .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface); }
.nav-actions { display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); }
.menu-btn { display: none; }

/* Hero */
.hero { min-height: 100vh; display: flex; align-items: center; padding: 100px 0 60px;
  background: radial-gradient(60% 60% at 85% 30%, color-mix(in srgb, var(--accent) 25%, transparent), transparent),
              radial-gradient(40% 40% at 10% 90%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.eyebrow { font-family: "JetBrains Mono", monospace; color: var(--accent-2); }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1.05; letter-spacing: -.03em; margin: 6px 0 10px; }
.role { font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-weight: 600; color: var(--accent); min-height: 1.6em; }
.caret { animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.lead { color: var(--muted); max-width: 52ch; margin: 14px 0 28px; font-size: 1.05rem; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 999px; font-weight: 600; transition: transform .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn.ghost { border: 1px solid var(--border); background: var(--surface); }
.socials { display: flex; gap: 10px; margin-top: 28px; }
.socials a { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); color: var(--muted); transition: .2s; }
.socials a:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
.hero-img { position: relative; justify-self: center; max-width: 420px; }
.hero-img img { position: relative; z-index: 1; }
.blob { position: absolute; inset: 8% 4%; border-radius: 42% 58% 60% 40% / 45% 40% 60% 55%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); opacity: .55; filter: blur(2px); animation: morph 10s ease-in-out infinite; }
@keyframes morph { 50% { border-radius: 60% 40% 35% 65% / 55% 60% 40% 45%; transform: rotate(8deg); } }

/* Sections */
.section { padding: 96px 0; }
.section.alt { background: var(--bg-alt); }
.title { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.02em; margin-bottom: 18px; }
.title span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title.center { margin-bottom: 40px; }

.about-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 56px; align-items: center; }
.about-img img { border-radius: var(--radius); box-shadow: var(--shadow); }
.about-grid p { margin-bottom: 14px; }
.stats { display: flex; gap: 14px; margin-top: 24px; flex-wrap: wrap; }
.stats div { flex: 1; min-width: 110px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; text-align: center; }
.stats b { display: block; font-size: 1.9rem; color: var(--accent); }
.stats span { font-size: .85rem; color: var(--muted); }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); transition: transform .25s; }
.card:hover { transform: translateY(-6px); }
.card img { width: 56px; height: 56px; object-fit: contain; margin-bottom: 14px; }
.card h3 { font-size: 1.15rem; margin-bottom: 14px; }
.chips, .tags { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span, .tags span { font-size: .8rem; padding: 4px 11px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 500; }
.bars { list-style: none; display: grid; gap: 12px; }
.bars span { font-size: .9rem; }
.bars i { display: block; height: 7px; border-radius: 9px; background: var(--border); margin-top: 4px; position: relative; overflow: hidden; }
.bars i::after { content: ""; position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: width 1.2s ease; }
.card.in .bars i::after { width: var(--w); }

/* Projects */
.filters { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: -16px 0 34px; }
.filters button { padding: 8px 18px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 500; transition: .2s; }
.filters button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.project { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .25s, border-color .25s; }
.project:hover { transform: translateY(-6px); border-color: var(--accent); }
.project.hide { display: none; }
.p-img { aspect-ratio: 16/9; background: var(--bg-alt); overflow: hidden; }
.p-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.p-img.logo img { object-fit: contain; padding: 36px; }
.project:hover .p-img img { transform: scale(1.05); }
.p-body { padding: 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.date { font-family: "JetBrains Mono", monospace; font-size: .78rem; color: var(--accent-2); }
.p-body h3 { font-size: 1.12rem; line-height: 1.35; }
.p-body p { color: var(--muted); font-size: .95rem; }
details { font-size: .9rem; color: var(--muted); }
summary { cursor: pointer; color: var(--text); font-weight: 600; }
details ul { margin: 8px 0 0 18px; display: grid; gap: 4px; }
.link { margin-top: auto; font-weight: 600; color: var(--accent); display: inline-flex; gap: 8px; align-items: center; padding-top: 6px; }
.link:hover { text-decoration: underline; }

/* Timeline */
.timeline { max-width: 720px; margin: auto; }
.t-item { display: flex; gap: 22px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.t-item img { width: 80px; height: 80px; object-fit: contain; flex-shrink: 0; }
.t-item p { color: var(--muted); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 32px; }
.c-card { display: flex; align-items: center; gap: 12px; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); transition: .2s; text-align: left; min-width: 0; }
.c-card span { overflow-wrap: anywhere; }
a.c-card:hover, button.c-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.c-card i { color: var(--accent); font-size: 1.2rem; width: 22px; text-align: center; }

.footer { padding: 28px 0; text-align: center; color: var(--muted); border-top: 1px solid var(--border); font-size: .9rem; }
.to-top { position: fixed; right: 20px; bottom: 20px; width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .3s; z-index: 40; }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; opacity: 0; transition: .3s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .nav-links { position: absolute; top: 68px; left: 16px; right: 16px; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px; box-shadow: var(--shadow); display: none; }
  .nav-links.open { display: flex; }
  .hero-grid, .about-grid { grid-template-columns: 1fr; }
  .hero-img { order: -1; max-width: 280px; }
  .hero { text-align: center; }
  .lead { margin-inline: auto; }
  .cta, .socials { justify-content: center; }
  .about-img { max-width: 360px; margin: auto; }
  .section { padding: 72px 0; }
  .projects { grid-template-columns: 1fr; }
  .t-item { flex-direction: column; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
