:root {
  color-scheme: dark;
  --bg: #0d0e14;
  --surface: #151723;
  --text: #ececf1;
  --muted: #a3a6b8;
  --faint: #6c7086;
  --line: #252838;
  --accent: #8b9cff;
  --accent-soft: #1d2246;
  --violet: #a78bfa;
  --blue: #60a5fa;
  --teal: #2dd4bf;
  --pink: #f472b6;
  --amber: #fbbf24;
  --grad: linear-gradient(100deg, var(--blue), var(--violet) 50%, var(--pink));
  --radius: 12px;
  --max: 1040px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-family: var(--mono); font-weight: 500; letter-spacing: .04em; }
.nav nav { display: flex; gap: 28px; align-items: center; }
.nav nav a { font-size: 14px; color: var(--muted); transition: color .15s; }
.nav nav a:hover { color: var(--text); }
.nav .nav-cta { color: var(--text); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; }
.nav .nav-cta:hover { border-color: var(--text); }

/* Hero */
.hero { padding: 112px 24px 80px; }
.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--accent); margin-bottom: 20px; }
h1 { color: var(--text); font-size: clamp(24px, 3.2vw, 34px); line-height: 1.05; letter-spacing: -0.02em; font-weight: 700; white-space: nowrap; }
.lead { font-size: 19px; color: var(--muted); max-width: 58ch; margin-top: 24px; }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 36px; }

.btn {
  display: inline-flex; align-items: center;
  padding: 10px 20px; border-radius: 999px;
  font-size: 15px; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s, transform .15s, background .15s;
}
.btn:hover { border-color: var(--text); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-lg { padding: 14px 28px; font-size: 17px; }
.icon-link { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--muted); transition: color .15s, background .15s; }
.icon-link:hover { color: var(--text); background: var(--line); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 72px; padding-top: 32px; border-top: 1px solid var(--line); }
.stats dt { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.stats dd { color: var(--muted); font-size: 14px; }

/* Sections */
.section { padding: 88px 24px; border-top: 1px solid var(--line); opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.section.in { opacity: 1; transform: none; }
.section-title { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 40px; display: flex; align-items: baseline; gap: 14px; }
.section-title span { font-family: var(--mono); font-size: 13px; font-weight: 400; color: var(--faint); }
.section-intro { color: var(--muted); margin: -24px 0 28px; }
.section-intro a, .prose a, .edu a { color: var(--accent); }
.section-intro a:hover, .edu a:hover { text-decoration: underline; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 56px; }
.prose p { color: var(--muted); font-size: 17px; }
.prose p + p { margin-top: 18px; }
.facts { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 8px 20px; align-self: start; }
.facts li { padding: 14px 0; font-size: 15px; }
.facts li + li { border-top: 1px solid var(--line); }
.facts span { display: block; font-family: var(--mono); font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }

/* Experience */
.job { display: grid; grid-template-columns: 200px 1fr; gap: 32px; padding: 32px 0; }
.job + .job { border-top: 1px dashed var(--line); }
.job:first-child { padding-top: 0; }
.date { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.place { font-size: 14px; color: var(--faint); }
.job h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.job .at { color: var(--muted); font-weight: 500; }
.job .sub { color: var(--faint); font-size: 14px; margin-top: 2px; }
.job-body > ul:not(.tags) { margin-top: 14px; }
.job-body > ul:not(.tags) li { position: relative; padding-left: 18px; color: var(--muted); }
.job-body > ul:not(.tags) li + li { margin-top: 8px; }
.job-body > ul:not(.tags) li::before { content: ""; position: absolute; left: 0; top: .72em; width: 6px; height: 1px; background: var(--faint); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tags li { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); padding: 3px 9px; border-radius: 6px; }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip { font: inherit; font-size: 14px; color: var(--muted); background: transparent; border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: all .15s; }
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.projects { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card:hover { border-color: var(--faint); transform: translateY(-2px); box-shadow: 0 8px 24px -12px rgba(0,0,0,.12); }
.card[hidden] { display: none; }
.card { grid-column: span 2; }
.card.featured { grid-column: span 3; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.lang { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.lang i { width: 10px; height: 10px; border-radius: 50%; }
.badge { font-family: var(--mono); font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; }
.badge.live { color: #4ade80; background: #13261a; }
.card h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; flex-grow: 1; }
.card .tags { margin-top: 18px; }
.card-links { display: flex; gap: 18px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 500; }
.card-links a:hover { color: var(--accent); }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.skills > div { padding: 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.skills > div:nth-child(4n) { border-right: 0; }
.skills > div:nth-last-child(-n+4) { border-bottom: 0; }
.skills h3 { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.skills p { font-size: 15px; }

/* Education */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
.col-title { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.edu li { padding: 20px 0; border-bottom: 1px solid var(--line); }
.edu li:last-child { border-bottom: 0; }
.edu h4 { font-size: 17px; font-weight: 600; margin: 4px 0; letter-spacing: -0.01em; }
.edu p:not(.date) { color: var(--muted); font-size: 15px; }

/* Contact */
.contact { text-align: center; padding: 112px 24px; }
.contact h2 { font-size: clamp(36px, 5vw, 52px); letter-spacing: -0.03em; font-weight: 700; }
.contact > p { color: var(--muted); font-size: 18px; margin: 12px 0 32px; }
.contact-links { display: flex; justify-content: center; gap: 24px; margin-top: 28px; font-size: 15px; color: var(--muted); }
.contact-links a:hover { color: var(--text); }

.footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 13px; color: var(--faint); }

/* Responsive */
@media (max-width: 860px) {
  .hero { padding-top: 72px; }
  .about-grid, .edu-grid { grid-template-columns: 1fr; gap: 32px; }
  .job { grid-template-columns: 1fr; gap: 8px; }
  .projects { grid-template-columns: 1fr 1fr; }
  .card, .card.featured { grid-column: span 1; }
  .skills { grid-template-columns: 1fr 1fr; }
  .skills > div:nth-child(4n) { border-right: 1px solid var(--line); }
  .skills > div:nth-child(2n) { border-right: 0; }
  .skills > div:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .skills > div:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 560px) {
  .projects, .skills { grid-template-columns: 1fr; }
  .skills > div { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; }
  .skills > div:last-child { border-bottom: 0 !important; }
  .stats { grid-template-columns: 1fr; gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .section { opacity: 1; transform: none; transition: none; }
}

/* ---- Color accents ---- */
body {
  background:
    radial-gradient(900px 500px at 85% -5%, rgba(139,92,246,.16), transparent 60%),
    radial-gradient(700px 450px at -5% 15%, rgba(45,212,191,.10), transparent 60%),
    radial-gradient(800px 500px at 50% 110%, rgba(244,114,182,.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
.logo, .stats dt {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.eyebrow { color: var(--teal); }
.btn-primary { background: var(--grad); border-color: transparent; color: #0d0e14; font-weight: 600; }
.btn-primary:hover { background: var(--grad); border-color: transparent; color: #0d0e14; filter: brightness(1.12); transform: translateY(-1px); }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* Section numbers and skill labels cycle through the palette */
#about .section-title span     { color: var(--teal); }
#experience .section-title span{ color: var(--blue); }
#projects .section-title span  { color: var(--violet); }
#skills .section-title span    { color: var(--pink); }
#education .section-title span { color: var(--amber); }
.skills > div:nth-child(4n+1) h3 { color: var(--teal); }
.skills > div:nth-child(4n+2) h3 { color: var(--blue); }
.skills > div:nth-child(4n+3) h3 { color: var(--violet); }
.skills > div:nth-child(4n+4) h3 { color: var(--pink); }
.facts span, .col-title { color: var(--violet); }
.job .date, .edu .date { color: var(--teal); }

/* Project cards: thin color bar and glow per language */
.card { position: relative; overflow: hidden; --c: var(--accent); }
.card[data-lang="ruby"]   { --c: #f87171; }
.card[data-lang="java"]   { --c: var(--amber); }
.card[data-lang="python"] { --c: var(--blue); }
.card[data-lang="js"]     { --c: #facc15; }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--c); opacity: .85; }
.card:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); box-shadow: 0 10px 30px -14px color-mix(in srgb, var(--c) 55%, transparent); }
.card-links a:hover { color: var(--c); }
.card .tags li { background: color-mix(in srgb, var(--c) 8%, transparent); border-color: color-mix(in srgb, var(--c) 22%, var(--line)); }

/* Hero photo */
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 56px; align-items: center; }
.photo {
  position: relative; width: 280px; aspect-ratio: 1; border-radius: 50%;
  padding: 4px; background: var(--grad);
  box-shadow: 0 20px 60px -20px rgba(139,92,246,.5);
}
.photo img, .photo-fallback {
  width: 100%; height: 100%; border-radius: 50%;
  border: 4px solid var(--bg); display: block;
}
.photo img { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); object-fit: cover; z-index: 1; }
.photo-fallback {
  display: grid; place-items: center; background: var(--surface);
  font-family: var(--mono); font-size: 48px; color: var(--faint); letter-spacing: .05em;
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .photo { width: 180px; order: -1; }
}

/* Photo: natural color, slightly muted to sit well on the dark theme */
.photo img { filter: saturate(.85) contrast(1.04); }

/* Nav without logo */
.nav-inner { justify-content: flex-end; }

/* Neutral photo ring and primary button */
.photo { background: linear-gradient(145deg, #f4f4f7, #6c7086); box-shadow: 0 20px 60px -24px rgba(0,0,0,.8); }
.btn-primary, .btn-primary:hover { background: #ececf1; color: #0d0e14; border-color: #ececf1; }
.btn-primary:hover { background: #ffffff; filter: none; }

/* Company links in Experience */
.job .at a { color: var(--muted); border-bottom: 1px solid transparent; transition: color .15s, border-color .15s; }
.job .at a:hover { color: var(--accent); border-bottom-color: currentColor; }

/* Sub-role inside a job (e.g. earlier position at the same company) */
.subrole { margin-top: 28px; padding: 20px 0 0 20px; border-left: 2px solid var(--line); }
.subrole h4 { font-size: 16px; font-weight: 600; }
.subrole .date { margin-top: 2px; }
.subrole > ul:not(.tags) { margin-top: 12px; }
.subrole > ul:not(.tags) li { position: relative; padding-left: 18px; color: var(--muted); }
.subrole > ul:not(.tags) li + li { margin-top: 8px; }
.subrole > ul:not(.tags) li::before { content: ""; position: absolute; left: 0; top: .72em; width: 6px; height: 1px; background: var(--faint); }

/* Contact: email link + copy button */
.email-row { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.email-link {
  font-size: 18px; font-weight: 500; color: var(--text);
  border-bottom: 1px solid var(--faint); padding-bottom: 2px;
  transition: color .15s, border-color .15s;
}
.email-link:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--faint); }
.copy-btn.copied { color: #4ade80; border-color: #2f5f3f; }

/* Mobile menu */
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .nav-inner { justify-content: flex-end; position: relative; }
  .menu-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; padding: 0 10px;
    background: transparent; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  }
  .menu-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s, opacity .2s; }
  .nav.open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav.open .menu-toggle span:nth-child(2) { opacity: 0; }
  .nav.open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .nav nav {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px 24px 20px;
  }
  .nav.open nav { display: flex; }
  .nav nav a { font-size: 16px; color: var(--text); padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav nav a.nav-cta { margin-top: 16px; border: 1px solid var(--line); border-radius: 999px; text-align: center; padding: 12px; }

  /* Center the intro on phones */
  .hero-grid { justify-items: center; text-align: center; }
  .hero-links, .stats { justify-content: center; }
  .lead { margin-left: auto; margin-right: auto; }
  .stats { text-align: center; }
}
.hero-icons { display: inline-flex; gap: 4px; }
.contact h2 { color: var(--text); }
