/* ===== Tokens ===== */
:root {
  --hh: 68px;           /* header height */
  --fh: 60px;           /* footer height */
  --bg: #0b1020;
  --bg-2: #121936;
  --surface: rgba(255,255,255,.05);
  --surface-2: rgba(255,255,255,.09);
  --border: rgba(255,255,255,.12);
  --text: #e8ecff;
  --muted: #a3acd1;
  --accent: #6ee7d8;
  --accent-2: #8b7bff;
  --accent-ink: #06121a;
  --shadow: 0 20px 50px -20px rgba(0,0,0,.6);
  --radius: 18px;
  --ease: cubic-bezier(.22,.8,.24,1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-theme="light"] {
  --bg: #f4f6ff;
  --bg-2: #e6eaff;
  --surface: rgba(255,255,255,.75);
  --surface-2: #ffffff;
  --border: rgba(20,30,80,.12);
  --text: #141a3a;
  --muted: #55608a;
  --accent: #0f9d8e;
  --accent-2: #5a4bff;
  --accent-ink: #ffffff;
  --shadow: 0 20px 40px -22px rgba(30,40,110,.35);
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  line-height: 1.6; overflow: hidden; height: 100vh; height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
body::before {          /* ambient gradient background */
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(60vmax 60vmax at 85% -10%, color-mix(in srgb, var(--accent-2) 28%, transparent), transparent 60%),
    radial-gradient(50vmax 50vmax at -10% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--bg);
}
h1,h2,h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem; border-radius: 10px; font-weight: 600; transition: top .2s; }
.skip-link:focus { top: 12px; text-decoration: none; }

.wrap { width: min(1100px, 100% - 2.5rem); margin-inline: auto; }
.wrap.narrow { width: min(820px, 100% - 2.5rem); }

/* ===== Static header ===== */
.site-header {
  position: fixed; inset: 0 0 auto 0; height: var(--hh); z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: .9rem; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.nav { display: flex; gap: .25rem; }
.nav-link { position: relative; padding: .5rem 1rem; border-radius: 999px; color: var(--muted); font-weight: 500; transition: color .25s, background .25s; }
.nav-link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav-link.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.header-actions { display: flex; gap: .5rem; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); transition: transform .2s var(--ease), background .2s; }
.icon-btn:hover { background: var(--surface-2); transform: translateY(-2px); }
.icon-btn:active { transform: scale(.94); }
.i-sun { display: none; }
:root[data-theme="light"] .i-sun { display: block; }
:root[data-theme="light"] .i-moon { display: none; }
.menu-btn { display: none; }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; }
.progress span { display: block; height: 100%; width: 25%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .6s var(--ease); }

/* ===== Slides ===== */
.slides { position: fixed; inset: var(--hh) 0 var(--fh) 0; overflow: hidden; outline: none; }
.slide {
  position: absolute; inset: 0; opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateX(calc(var(--dir, 1) * 8%)) scale(.98);
  transition: opacity .55s var(--ease), transform .65s var(--ease), visibility 0s .65s;
}
.slide.is-prev { transform: translateX(-8%) scale(.98); }
.slide.is-next { transform: translateX(8%) scale(.98); }
.slide.is-active { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }
.slide-scroll { height: 100%; overflow-y: auto; overflow-x: hidden; padding: clamp(1.5rem, 4vw, 3rem) 0 3rem; scrollbar-width: thin; scrollbar-color: var(--border) transparent; overscroll-behavior: contain; }

/* reveal-on-enter animation */
.reveal { opacity: 0; transform: translateY(22px); }
.slide.is-active .reveal { animation: rise .7s var(--ease) forwards; animation-delay: calc(.12s + var(--d, 0s)); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ===== Hero ===== */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; min-height: 52vh; }
.eyebrow { display: inline-flex; align-items: center; gap: .55rem; padding: .35rem .9rem; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; color: var(--muted); font-size: .85rem; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2s infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 10px rgba(52,211,153,0); } }
h1 { font-size: clamp(2.3rem, 6vw, 4.2rem); margin: 1rem 0 .4rem; }
.grad { background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.role { font-family: var(--mono); font-size: clamp(1rem, 2.4vw, 1.35rem); color: var(--accent); min-height: 1.7em; }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -.15em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { color: var(--muted); font-size: 1.08rem; max-width: 60ch; }
.cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.4rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .8rem 1.4rem; border-radius: 12px; border: 1px solid transparent; font-weight: 600; transition: transform .2s var(--ease), box-shadow .2s, background .2s; }
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); box-shadow: 0 10px 30px -10px var(--accent-2); }
.btn.ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: .5rem 1rem; font-size: .9rem; }

.hero-card { padding: 1.6rem; border-radius: 24px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.avatar { width: clamp(130px, 18vw, 180px); aspect-ratio: 1; margin: 0 auto 1.3rem; border-radius: 50%; padding: 5px; background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent)); animation: spin 14s linear infinite; }
.avatar span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--bg-2); font-size: 2.6rem; font-weight: 800; animation: spin 14s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.facts li { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--border); font-size: .92rem; }
.facts span { color: var(--muted); }
.facts b { font-weight: 600; text-align: right; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 2.2rem; }
.stat { padding: 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-align: center; }
.stat b { display: block; font-size: clamp(1.6rem, 4vw, 2.3rem); background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--muted); font-size: .88rem; }

/* ===== Section heads ===== */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.section-head h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin: 0; }
.section-head h2::after { content: ""; display: block; width: 56px; height: 4px; margin-top: .5rem; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ===== Resume ===== */
.tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.tab { padding: .6rem 1.1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 600; transition: all .25s; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.panel[hidden] { display: none; }
.panel.is-active { animation: fadeUp .5s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.timeline { position: relative; padding-left: 1.8rem; border-left: 2px solid var(--border); display: grid; gap: 1.4rem; margin-left: .4rem; }
.timeline li { position: relative; padding: 1.2rem 1.4rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: transform .25s var(--ease), border-color .25s; }
.timeline li:hover { transform: translateX(4px); border-color: var(--accent); }
.timeline li::before { content: ""; position: absolute; left: calc(-1.8rem - 8px); top: 1.5rem; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--accent); }
.timeline time { font-family: var(--mono); font-size: .8rem; color: var(--accent); }
.timeline h3 { font-size: 1.15rem; margin: .2rem 0 .6rem; }
.timeline small { color: var(--muted); font-weight: 500; font-size: .9rem; }
.timeline ul { display: grid; gap: .35rem; color: var(--muted); }
.timeline ul li { padding: 0 0 0 1.1rem; border: 0; background: none; position: relative; }
.timeline ul li::before { content: "›"; left: 0; top: 0; width: auto; height: auto; background: none; box-shadow: none; color: var(--accent); font-weight: 700; }
.timeline ul li:hover { transform: none; }
.timeline p { color: var(--muted); margin: 0; }

.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem 2rem; }
.skill-top { display: flex; justify-content: space-between; font-weight: 600; font-size: .95rem; margin-bottom: .4rem; }
.skill-top span:last-child { color: var(--muted); font-family: var(--mono); }
.bar { height: 10px; border-radius: 10px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.bar i { display: block; height: 100%; width: 0; border-radius: 10px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1.1s var(--ease); }
.panel.is-active .bar i.go { width: var(--w); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.chips li, .chip { padding: .3rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .82rem; color: var(--muted); }
.chips.sm { margin: .8rem 0 0; }
.chips.sm li { font-size: .75rem; padding: .2rem .65rem; }

.cards-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.cards-list li { padding: 1.1rem 1.3rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: transform .25s var(--ease), border-color .25s; }
.cards-list li:hover { transform: translateY(-4px); border-color: var(--accent); }
.cards-list b { display: block; }
.cards-list span { color: var(--muted); font-size: .88rem; }

/* ===== Projects ===== */
.carousel-ctrl { display: flex; gap: .5rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.4rem; }
.chip { cursor: pointer; font-weight: 600; font-size: .88rem; transition: all .25s; }
.chip:hover { color: var(--text); }
.chip.is-active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.track { display: flex; gap: 1.2rem; overflow-x: auto; scroll-snap-type: x mandatory; padding: .4rem .2rem 1.4rem; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.card { flex: 0 0 min(340px, 82%); scroll-snap-align: start; padding: 1.3rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .3s var(--ease), border-color .3s, opacity .35s; }
.card:hover { transform: translateY(-8px); border-color: var(--accent); }
.card.hide { display: none; }
.card h3 { font-size: 1.15rem; margin-top: .9rem; }
.card p { color: var(--muted); font-size: .95rem; flex: 1; }
.thumb { height: 130px; border-radius: 14px; display: grid; place-items: center; color: #fff; overflow: hidden; position: relative; }
.thumb svg { width: 44px; height: 44px; stroke-width: 1.6; transition: transform .4s var(--ease); }
.card:hover .thumb svg { transform: scale(1.2) rotate(-6deg); }
.t1 { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.t2 { background: linear-gradient(135deg, #059669, #0ea5e9); }
.t3 { background: linear-gradient(135deg, #db2777, #7c3aed); }
.t4 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.t5 { background: linear-gradient(135deg, #0891b2, #4f46e5); }
.t6 { background: linear-gradient(135deg, #16a34a, #0d9488); }
.card-links { display: flex; gap: 1.1rem; margin-top: 1rem; font-weight: 600; font-size: .9rem; }
.empty { color: var(--muted); text-align: center; padding: 2rem 0; }

/* ===== Connect ===== */
.social-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 1.4rem 0 2rem; }
.social-grid a { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: transform .25s var(--ease), border-color .25s, background .25s; }
.social-grid a:hover { transform: translateY(-4px); border-color: var(--accent); background: var(--surface-2); text-decoration: none; }
.social-grid svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.social-grid b { display: block; }
.social-grid small { color: var(--muted); }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 1.5rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.field { display: flex; flex-direction: column; gap: .35rem; }
.full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: .9rem; }
input, textarea { width: 100%; padding: .75rem .9rem; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); font: inherit; transition: border-color .2s, box-shadow .2s; }
:root[data-theme="light"] input, :root[data-theme="light"] textarea { background: #fff; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.err { color: #fb7185; min-height: 1em; font-size: .8rem; }
.note { margin-left: .8rem; color: var(--muted); font-size: .9rem; }

/* ===== Static footer ===== */
.site-footer {
  position: fixed; inset: auto 0 0 0; height: var(--fh); z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.foot-left { display: flex; align-items: center; gap: .6rem; }
.site-footer .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
.site-footer .icon-btn svg { width: 18px; height: 18px; }
.dots { display: flex; gap: .45rem; }
.dot { width: 10px; height: 10px; padding: 0; border-radius: 10px; border: 0; background: var(--border); transition: width .35s var(--ease), background .3s; }
.dot:hover { background: var(--muted); }
.dot.is-active { width: 28px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.copy { margin: 0; color: var(--muted); font-size: .85rem; }
.foot-social { display: flex; gap: .3rem; }
.foot-social a { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); transition: color .2s, background .2s, transform .2s; }
.foot-social a:hover { color: var(--accent); background: var(--surface); transform: translateY(-2px); text-decoration: none; }
.foot-social svg { width: 18px; height: 18px; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; text-align: left; }
  .hero-card { max-width: 440px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .skills, .cards-list { grid-template-columns: 1fr; }
  .menu-btn { display: grid; }
  .nav { position: fixed; top: var(--hh); left: 0; right: 0; flex-direction: column; padding: .8rem 1rem 1rem; background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); transform: translateY(-12px); opacity: 0; visibility: hidden; transition: all .3s var(--ease); }
  .nav.open { transform: none; opacity: 1; visibility: visible; }
  .nav-link { padding: .8rem 1rem; }
}
@media (max-width: 600px) {
  :root { --hh: 60px; --fh: 56px; }
  .brand-text, .copy { display: none; }
  .site-footer { justify-content: space-between; }
  .social-grid, .form { grid-template-columns: 1fr; }
  .section-head { flex-wrap: wrap; }
  .foot-social a { width: 32px; }
}
@media (max-width: 380px) { .foot-social li:nth-child(3) { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ===== Print (resume) ===== */
@media print {
  body { overflow: visible; height: auto; background: #fff; color: #000; }
  body::before, .site-header, .site-footer, .nav, .cta { display: none !important; }
  .slides { position: static; }
  .slide { position: static; opacity: 1; visibility: visible; transform: none; display: none; }
  #resume { display: block; }
  .slide-scroll { overflow: visible; height: auto; }
  .reveal { opacity: 1; transform: none; animation: none; }
  .tabs, .section-head a { display: none; }
  .panel[hidden] { display: block !important; }
  .bar i { width: var(--w) !important; }
  .timeline li, .cards-list li { background: none; border-color: #ccc; break-inside: avoid; }
  * { color: #000 !important; }
}
