/* ============ Tokens ============ */
:root {
  --bg: #0b1120;
  --bg-alt: #0f172a;
  --surface: #111a2e;
  --surface-2: #16213a;
  --border: #1f2a44;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --heading: #f8fafc;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-ink: #0b1120;
  --live: #22c55e;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .55);
  --radius: 14px;
  --maxw: 1140px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f8fafc;
  --bg-alt: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #334155;
  --muted: #64748b;
  --heading: #0f172a;
  --accent: #0284c7;
  --accent-2: #4f46e5;
  --accent-ink: #ffffff;
  --shadow: 0 10px 30px -14px rgba(15, 23, 42, .25);
  color-scheme: light;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.65;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; transition: background .3s, color .3s;
}
h1, h2, h3 { color: var(--heading); line-height: 1.2; margin: 0; letter-spacing: -.02em; }
p { margin: 0 0 1rem; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
svg.fill { fill: currentColor; stroke: none; }
strong { color: var(--heading); font-weight: 600; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px; font: 600 15px/1 var(--font);
  border: 1px solid transparent; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s, border-color .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 24px -10px var(--accent); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -10px var(--accent); }
.btn--ghost { background: transparent; color: var(--heading); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn--sm { padding: 9px 16px; font-size: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: transparent; border: 1px solid var(--border); color: var(--heading); cursor: pointer; transition: border-color .2s, color .2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ============ Nav ============ */
.nav { position: fixed; inset: 0 0 auto; z-index: 50; transition: background .3s, border-color .3s, backdrop-filter .3s; border-bottom: 1px solid transparent; }
.nav.scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom-color: var(--border); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--heading); }
.logo__mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 14px; letter-spacing: .02em; }
.nav__links { display: flex; gap: 4px; }
.nav__links a { padding: 8px 12px; border-radius: 8px; font-size: 14.5px; font-weight: 500; color: var(--muted); transition: color .2s, background .2s; }
.nav__links a:hover, .nav__links a.active { color: var(--heading); background: var(--surface-2); }
.nav__actions { display: flex; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.i-moon { display: none; }
[data-theme="light"] .i-sun { display: none; }
[data-theme="light"] .i-moon { display: block; }

/* ============ Hero ============ */
.hero { position: relative; padding: 140px 0 72px; overflow: hidden; }
.hero__glow {
  position: absolute; inset: -20% -10% auto; height: 700px; pointer-events: none; z-index: -1;
  background:
    radial-gradient(600px 300px at 20% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(500px 300px at 80% 20%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 70%);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 70%);
}
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 13.5px; color: var(--muted); background: var(--surface); margin-bottom: 24px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.5rem); font-weight: 800; margin-bottom: 22px; min-height: 2.4em; }
.grad { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.typed { color: var(--accent); }
.caret { display: inline-block; width: 3px; height: .9em; margin-left: 4px; background: var(--accent); vertical-align: -0.08em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 580px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 30px 0 26px; }
.socials { display: flex; gap: 10px; }
.socials a { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); color: var(--muted); transition: color .2s, border-color .2s, transform .2s; }
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-3px); }

/* Photo */
.hero__photo { position: relative; justify-self: center; width: 100%; max-width: 400px; }
.photo {
  position: relative; border-radius: 28px; padding: 4px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2) 60%, transparent);
  box-shadow: 0 30px 60px -25px color-mix(in srgb, var(--accent) 55%, transparent);
}
.photo::before {
  content: ""; position: absolute; inset: -28px; z-index: -1; border-radius: 40px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent);
}
.photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 24px; background: var(--surface); }
.float-badge {
  position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: float 5s ease-in-out infinite;
}
.float-badge strong { display: block; font-size: 14px; line-height: 1.2; }
.float-badge small { display: block; font-size: 12px; color: var(--muted); }
.float-badge--tl { top: 28px; left: -36px; }
.float-badge--br { bottom: 36px; right: -30px; animation-delay: -2.5s; }
.fb-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); font: 700 11px var(--mono); }
.fb-ico--aws { color: #f59e0b; background: rgba(245, 158, 11, .14); }
@keyframes float { 50% { transform: translateY(-8px); } }

.code.code--about { margin-top: 28px; transform: none; }
.code { background: #0d1426; border: 1px solid #1e2a47; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transform: perspective(1200px) rotateY(-6deg) rotateX(3deg); transition: transform .5s; }
.code:hover { transform: none; }
.code__bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; background: #0a1020; border-bottom: 1px solid #1e2a47; }
.code__bar span { width: 11px; height: 11px; border-radius: 50%; background: #ef4444; }
.code__bar span:nth-child(2) { background: #f59e0b; }
.code__bar span:nth-child(3) { background: #22c55e; }
.code__bar em { margin-left: auto; font: 12px var(--mono); color: #64748b; font-style: normal; }
.code pre { margin: 0; padding: 20px 22px; overflow-x: auto; font: 13.5px/1.7 var(--mono); color: #cbd5e1; }
.code .k { color: #c084fc; } .code .t { color: #38bdf8; } .code .s { color: #86efac; } .code .f { color: #fbbf24; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 64px; }
.stat { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-align: center; }
.stat strong { display: block; font-size: 1.9rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { font-size: 14px; color: var(--muted); }

/* ============ Sections ============ */
.section { padding: 96px 0; }
.section--alt { background: var(--bg-alt); }
.section__head { margin-bottom: 44px; }
.kicker { font: 500 13.5px var(--mono); color: var(--accent); letter-spacing: .04em; margin-bottom: 10px; text-transform: uppercase; }
.section h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 800; }

/* About */
.about { display: grid; grid-template-columns: .9fr 1.1fr; gap: 56px; }
.about .section__head { position: sticky; top: 100px; align-self: start; }
.about__body p { font-size: 1.05rem; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 28px; }
.facts li { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--heading); font-weight: 500; font-size: 15px; }
.facts span { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: .05em; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.skill { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: transform .25s, border-color .25s, box-shadow .25s; }
.skill:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: var(--shadow); }
.skill--wide { grid-column: 1 / -1; }
.skill__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.skill__icon svg { width: 22px; height: 22px; }
.skill h3 { font-size: 1.1rem; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 6px 12px; font-size: 13.5px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.chips--sm { margin-top: 16px; }
.chips--sm li { padding: 4px 10px; font: 12.5px var(--mono); color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }

/* Timeline */
.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--accent-2), transparent); }
.tl { position: relative; margin-bottom: 22px; }
.tl__dot { position: absolute; left: -32px; top: 26px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); }
.tl__dot--live { border-color: var(--live); box-shadow: 0 0 0 5px color-mix(in srgb, var(--live) 18%, transparent); }
.tl__card { padding: 24px 26px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .25s, transform .25s; }
.tl__card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateX(4px); }
.tl__top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.tl h3 { font-size: 1.15rem; }
.org { margin: 4px 0 0; color: var(--accent); font-weight: 500; font-size: 15px; }
.date { font: 13px var(--mono); color: var(--muted); padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; height: fit-content; white-space: nowrap; }
.bullets li { position: relative; padding-left: 20px; margin: 7px 0; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.project { display: flex; flex-direction: column; padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: transform .25s, border-color .25s, box-shadow .25s; }
.project:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: var(--shadow); }
.project--feature { grid-column: 1 / -1; position: relative; overflow: hidden; }
.project--feature::after { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.project__head { margin-bottom: 12px; }
.badge { display: inline-block; font: 500 12px var(--mono); color: var(--accent-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.project h3 { font-size: 1.3rem; }
.project > p { color: var(--muted); }
.project .chips--sm { margin-top: auto; padding-top: 16px; }
.note { margin: 14px 0 0; font-size: 13.5px; color: var(--muted); font-style: italic; }
.project__links { display: flex; gap: 16px; margin-top: 18px; }
.project__links a { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; color: var(--heading); }
.project__links a:hover { color: var(--accent); }

/* Credentials */
.creds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.cred { padding: 26px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.cred h3 { font-size: 1.1rem; margin-bottom: 18px; }
.edu li { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.edu li:last-child { border-bottom: 0; }
.edu strong { display: block; font-size: 15px; }
.edu span { display: block; font-size: 14px; color: var(--muted); }
.edu em { display: block; margin-top: 4px; font: normal 12.5px var(--mono); color: var(--accent); }
.list li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; font-size: 14.5px; border-bottom: 1px dashed var(--border); color: var(--heading); }
.list li:last-child { border-bottom: 0; }
.tag { flex-shrink: 0; min-width: 58px; text-align: center; padding: 3px 8px; font: 500 11.5px var(--mono); border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.tag--aws { color: #f59e0b; border-color: rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .1); }

/* Contact */
.contact { text-align: center; max-width: 860px; }
.contact .lead { margin: 14px auto 36px; }
.contact__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; text-align: left; }
.contact__item { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .2s, transform .2s; }
.contact__item:hover { border-color: var(--accent); transform: translateY(-3px); }
.contact__item svg { grid-row: 1 / 3; width: 44px; height: 44px; padding: 11px; border-radius: 12px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.contact__item span { font-size: 13px; color: var(--muted); }
.contact__item strong { font-size: 15px; overflow-wrap: anywhere; }
.contact__cta { display: flex; gap: 14px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 26px 0; font-size: 14px; color: var(--muted); }
.footer__inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer p { margin: 0; }

.to-top { position: fixed; right: 22px; bottom: 22px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; border: 0; cursor: pointer; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(16px); pointer-events: none; transition: opacity .3s, transform .3s; z-index: 40; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 10px 18px; border-radius: 10px; background: var(--heading); color: var(--bg); font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; 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; }
.no-js .reveal { opacity: 1; transform: none; }

/* ============ Responsive ============ */
@media (max-width: 980px) {
  .hero__grid, .about { grid-template-columns: 1fr; gap: 40px; }
  .about .section__head { position: static; margin-bottom: 0; }
  .about { gap: 24px; }
  .code { transform: none; }
  .skills, .creds { grid-template-columns: repeat(2, 1fr); }
  .creds .cred:first-child { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .menu-btn { display: inline-grid; }
  .nav__links {
    position: fixed; top: 68px; left: 0; right: 0; flex-direction: column; gap: 2px; padding: 12px 16px 20px;
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    transform: translateY(-120%); opacity: 0; transition: transform .3s, opacity .3s; pointer-events: none;
  }
  .nav__links.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__links a { padding: 12px 14px; font-size: 16px; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .hero { padding: 112px 0 56px; }
  .hero h1 { min-height: 3.6em; }
  .hide-sm { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); margin-top: 44px; }
  .section { padding: 72px 0; }
  .skills, .projects, .creds, .contact__grid, .facts { grid-template-columns: 1fr; }
  .project, .tl__card, .skill, .cred { padding: 20px; }
  .code pre { font-size: 12px; padding: 16px; }
  .logo__text { display: none; }
  .hero__photo { max-width: 300px; }
  .float-badge { padding: 8px 10px; }
  .float-badge--tl { left: -10px; top: 18px; }
  .float-badge--br { right: -10px; bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
