
:root {
  --bg: #fbfbf9;
  --bg-soft: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #15171c;
  --muted: #5b626d;
  --line: #e7e6e1;
  --accent: #2547c9;
  --accent-2: #7e22ce;
  --accent-soft: rgba(37, 71, 201, 0.08);
  --shadow: 0 18px 50px -24px rgba(15, 23, 42, 0.25);

  --body: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --maxw: 1080px;
  --pad: clamp(1.25rem, 5vw, 2.5rem);
}

html.dark {
  --bg: #030712;
  --bg-soft: #0b1120;
  --surface: #101828;
  --surface-2: #161f31;
  --ink: #f3f4f6;
  --muted: #98a2b3;
  --line: #1e2939;
  --accent: #3b82f6;
  --accent-2: #9333ea;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; display: block; }

.gradient-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 1rem; }
.nav-name { font-family: var(--mono); font-size: 0.95rem; font-weight: 500; }
.nav-name a { color: var(--ink); }
.nav-name a:hover { text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 1.1rem; transition: border-color .2s, color .2s, background .2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.sun { display: none; } .moon { display: inline-flex; }
html.dark .sun { display: inline-flex; } html.dark .moon { display: none; }

/* Language switcher */
.lang-switch { position: relative; }
#langToggle { width: auto; gap: .35rem; padding-inline: .55rem; }
.lang-current { font-family: var(--mono); font-size: .75rem; font-weight: 500; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + .5rem); z-index: 60;
  display: none; flex-direction: column; gap: 2px; min-width: 160px; padding: .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.lang-menu.open { display: flex; }
.lang-menu button {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  border: none; background: none; cursor: pointer; color: var(--ink);
  font-family: var(--body); font-size: .9rem; padding: .5rem .6rem; border-radius: 8px;
  transition: background .15s, color .15s;
}
.lang-menu button:hover { background: var(--surface-2); }
.lang-menu button[aria-checked="true"] { color: var(--accent); font-weight: 600; }
.lang-menu .lang-code { font-family: var(--mono); font-size: .7rem; color: var(--muted); min-width: 1.8rem; }
.lang-menu button[aria-checked="true"] .lang-code { color: var(--accent); }

/* Burger menu (mobile only) */
.nav-burger { display: none; }
.burger-close { display: none; }
.nav-burger[aria-expanded="true"] .burger-open { display: none; }
.nav-burger[aria-expanded="true"] .burger-close { display: inline-flex; }

@media (max-width: 720px) {
  .nav-burger { display: inline-flex; }
  .nav-right { gap: .6rem; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    padding: 0 var(--pad);
    box-shadow: var(--shadow);
    max-height: 0; overflow: hidden; opacity: 0; pointer-events: none;
    transition: max-height .25s ease, opacity .2s ease, padding .25s ease;
  }
  .nav-links.open { max-height: 80vh; opacity: 1; pointer-events: auto; padding: .25rem var(--pad) 1rem; }
  .nav-links a { font-size: .95rem; padding: .85rem 0; border-bottom: 1px solid var(--line-soft); }
  .nav-links a:last-child { border-bottom: none; }
}

/* ---------- Reveal ---------- */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
[data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; transition: none; } }

/* ---------- Section ---------- */
.section { padding-block: clamp(3.5rem, 9vw, 6rem); border-top: 1px solid var(--line); }
.eyebrow {
  display: inline-block; font-family: var(--mono); font-size: .75rem;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem;
}
.eyebrow::before { content: "// "; color: var(--muted); }
.section h2 { font-weight: 800; font-size: clamp(1.7rem, 4.5vw, 2.4rem); line-height: 1.1; letter-spacing: -.02em; margin-bottom: .6rem; }
.section .sub { color: var(--muted); margin-bottom: 2.5rem; max-width: 54ch; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: clamp(3.5rem, 10vw, 6.5rem) clamp(2.5rem, 7vw, 4.5rem); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; top: -20%; right: -10%; width: 560px; height: 560px;
  background: radial-gradient(circle, var(--accent-soft), transparent 65%); pointer-events: none; z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 820px) { .hero .wrap { grid-template-columns: 1fr; } .hero-media { order: -1; max-width: 280px; } }
.hero .greet { font-family: var(--mono); font-size: .95rem; color: var(--accent); }
.hero h1 { font-weight: 800; font-size: clamp(2.6rem, 8vw, 4.6rem); line-height: 1; letter-spacing: -.03em; margin-top: .6rem; }
.hero .role { font-weight: 700; font-size: clamp(1.15rem, 3.5vw, 1.8rem); margin-top: .5rem; min-height: 1.4em; }
.tw-cursor { display: inline-block; width: 3px; height: 1.05em; margin-left: 3px; vertical-align: -0.12em; background: var(--accent); border-radius: 1px; animation: tw-blink 1s steps(1) infinite; }
@keyframes tw-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tw-cursor { animation: none; } }
.hero .lede { margin-top: 1.5rem; font-size: clamp(1.0625rem, 2.5vw, 1.18rem); color: var(--muted); max-width: 52ch; }

.btn-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2.2rem; }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .75rem 1.5rem; border-radius: 10px; font-weight: 600; font-size: .9375rem; transition: transform .15s ease, box-shadow .2s ease, background .2s ease; }
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 10px 30px -10px var(--accent); }
.btn-primary:hover { box-shadow: 0 16px 36px -12px var(--accent); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.social-row { display: flex; gap: 1rem; margin-top: 2rem; }
.social-row a { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 1.25rem; transition: transform .15s, color .2s, border-color .2s; }
.social-row a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }

.hero-media { position: relative; justify-self: center; }
.hero-media::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); opacity: .35; filter: blur(26px); z-index: 0; }
.hero-media img { position: relative; z-index: 1; display: block; width: 100%; max-width: 340px; aspect-ratio: 1 / 1; object-fit: cover; object-position: center top; border-radius: 50%; border: 1px solid var(--line); box-shadow: var(--shadow); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.about-grid.single { grid-template-columns: 1fr; }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }
.about-grid .journey-title { margin-top: 0; }
@media (max-width: 820px) { .about-grid .journey-title { margin-top: 2.5rem; } }

.bio { max-width: 62ch; color: var(--muted); font-size: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin-top: 2.5rem; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem 1.2rem; background: var(--surface); }
.stat .num { font-weight: 800; font-size: clamp(1.6rem, 5vw, 2.3rem); line-height: 1; }
.stat .cap { font-size: .8125rem; color: var(--muted); margin-top: .5rem; }
@media (max-width: 480px) { .stat .cap { font-size: .72rem; } .stat { padding: 1.1rem .9rem; } }

.journey-title { font-weight: 700; font-size: 1.3rem; margin: 3rem 0 1.5rem; }
.timeline { border-left: 2px solid var(--line); padding-left: 1.75rem; margin-left: .4rem; }
.tl-item { position: relative; padding-bottom: 2rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: calc(-1.75rem - 7px); top: 4px; width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(120deg, var(--accent), var(--accent-2)); border: 3px solid var(--bg); }
.tl-date { font-family: var(--mono); font-size: .8125rem; color: var(--accent); }
.tl-role { font-weight: 600; margin-top: .2rem; font-size: 1.05rem; }
.tl-org { color: var(--muted); font-size: .9375rem; }

/* ---------- Skills ---------- */
.skill-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.skill-card { border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; background: var(--surface); }
.skill-card .label { font-family: var(--mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 1.2rem; }
.skill-row { margin-bottom: 1.1rem; }
.skill-row:last-child { margin-bottom: 0; }
.skill-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .45rem; }
.skill-head iconify-icon { font-size: 1.25rem; color: var(--ink); flex: none; }
.skill-name { font-size: .95rem; font-weight: 500; }
.skill-pct { font-family: var(--mono); font-size: .75rem; color: var(--muted); margin-left: auto; }
.skill-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.skill-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 3px; width: 0; transition: width 1.1s cubic-bezier(.4,0,.2,1); }
.is-in .skill-fill { width: var(--w); }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.project { display: flex; flex-direction: column; padding: 1.6rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease; }
.project:hover { text-decoration: none; transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.project-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.project-icon { font-size: 1.6rem; color: var(--accent); }
.project-meta { display: flex; gap: .9rem; font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.project-meta span { display: inline-flex; align-items: center; gap: .25rem; }
.project-title { font-weight: 700; font-size: 1.15rem; margin-top: 1rem; word-break: break-word; transition: color .2s; }
.project:hover .project-title { color: var(--accent); }
.project-desc { color: var(--muted); margin-top: .4rem; font-size: .95rem; flex: 1; }
.tags { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { font-family: var(--mono); font-size: .72rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: .2rem .55rem; border-radius: 6px; }
.project-state { font-family: var(--mono); font-size: .85rem; color: var(--muted); }

/* ---------- Blog ---------- */
.post-list { display: flex; flex-direction: column; gap: 1.25rem; }
.post-card { display: block; padding: 1.5rem 1.6rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease; }
.post-card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.post-meta { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.post-card h3 { font-weight: 700; font-size: 1.25rem; margin: .4rem 0; transition: color .2s; }
.post-card:hover h3 { color: var(--accent); }
.post-card p { color: var(--muted); font-size: .95rem; }
.empty { color: var(--muted); font-family: var(--mono); font-size: .9rem; }

/* ---------- Article ---------- */
.article { padding-block: clamp(2.5rem, 7vw, 4rem); }
.article .wrap { max-width: 720px; }
.article-head { margin-bottom: 2.5rem; }
.article h1 { font-weight: 800; font-size: clamp(2rem, 6vw, 3rem); line-height: 1.1; letter-spacing: -.02em; margin: .6rem 0; }
.prose { font-size: 1.1rem; }
.prose h2 { font-weight: 700; font-size: 1.6rem; margin: 2.2rem 0 .8rem; letter-spacing: -.01em; }
.prose h3 { font-weight: 700; font-size: 1.25rem; margin: 1.8rem 0 .6rem; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin-bottom: 1.2rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: .4rem; }
.prose img { border-radius: 12px; margin: 1.5rem 0; }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--muted); font-style: italic; }
.prose code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: .1rem .35rem; }
.prose pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.3rem; overflow-x: auto; margin-bottom: 1.4rem; }
.prose pre code { background: none; border: none; padding: 0; }
.back-link { font-family: var(--mono); font-size: .8125rem; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; margin-bottom: 2.5rem; }
.contact-card { display: flex; align-items: center; gap: 1.1rem; padding: 1.4rem 1.5rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); transition: transform .18s ease, border-color .2s ease, box-shadow .2s ease; }
a.contact-card:hover { text-decoration: none; transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.contact-card > iconify-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 12px; font-size: 1.4rem; color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.contact-card .label { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.contact-card .val { font-weight: 600; font-size: 1.02rem; margin-top: .15rem; word-break: break-word; }
a.contact-card:hover .val { color: var(--accent); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding-block: 2.5rem; }
footer .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; font-family: var(--mono); font-size: .8125rem; color: var(--muted); }
.footer-social { display: flex; gap: 1rem; font-size: 1.2rem; }
.footer-social a { color: var(--muted); }
.footer-social a:hover { color: var(--accent); }

/* ---------- Scroll to top ---------- */
#toTop { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 60; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.2rem; cursor: pointer; display: none; align-items: center; justify-content: center; box-shadow: var(--shadow); transition: color .2s, border-color .2s, transform .15s; }
#toTop:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
#toTop.show { display: inline-flex; }
