:root {
  --blue: #1877F2;
  --blue-dark: #145dbf;
  --violet: #8b5cf6;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --surface: #ffffff;
  --surface-glass: rgba(255,255,255,0.7);
  --border: #e4e6eb;
  --text: #1c1e21;
  --text-muted: #65676b;
  --shadow: 0 2px 14px rgba(0,0,0,0.06);
  --shadow-lg: 0 20px 50px rgba(24,119,242,0.12);
  --radius: 16px;
  --maxw: 1120px;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
}

[data-theme="dark"] {
  --bg: #0e0f11;
  --bg-alt: #131518;
  --surface: #191b1f;
  --surface-glass: rgba(25,27,31,0.7);
  --border: #2b2e33;
  --text: #edeef0;
  --text-muted: #9a9ea5;
  --shadow: 0 2px 14px rgba(0,0,0,0.5);
  --shadow-lg: 0 20px 60px rgba(24,119,242,0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

::selection { background: var(--blue); color: #fff; }

/* ---------- Preloader ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.preloader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-mark {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--text);
  animation: pulse-mark 1.1s ease-in-out infinite;
}
.preloader-mark span { color: var(--blue); }
@keyframes pulse-mark {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.6; }
}

/* ---------- Cursor glow (desktop only) ---------- */
.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(24,119,242,0.10) 0%, rgba(24,119,242,0) 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
  will-change: transform;
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .cursor-glow { display: block; }
}

/* ---------- Scroll reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(.2,.8,.2,1), transform 0.7s cubic-bezier(.2,.8,.2,1);
}
[data-reveal].in-view { opacity: 1; transform: translateY(0); }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; }
.brand-dot { color: var(--blue); }
.nav-links { display: flex; gap: 26px; }
.nav-links a { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); transition: color 0.2s ease; position: relative; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -6px; width: 0; height: 2px; background: var(--blue);
  transition: width 0.2s ease;
}
.nav-links a:hover { color: var(--blue); }
.nav-links a:hover::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.4s ease;
}
.theme-toggle:hover { transform: rotate(20deg) scale(1.08); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.menu-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.menu-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.2s ease; }

.nav-links-mobile { display: none; flex-direction: column; padding: 8px 24px 16px; border-top: 1px solid var(--border); }
.nav-links-mobile a { padding: 10px 0; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.nav-links-mobile a:last-child { border-bottom: none; }

.scroll-progress { height: 3px; background: transparent; }
.scroll-progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--blue), var(--violet)); transition: width 0.1s linear; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 90px 24px 70px;
  overflow: hidden;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.55;
}
.hero-inner {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}
.hero-text { flex: 1.2; min-width: 0; }
.eyebrow { color: var(--blue); font-weight: 700; font-size: 0.95rem; margin-bottom: 14px; }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 16px;
  background: linear-gradient(100deg, var(--text) 40%, var(--blue) 70%, var(--violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.role { font-size: 1.15rem; font-weight: 600; color: var(--text); margin-bottom: 18px; }
.lede { color: var(--text-muted); font-size: 1.02rem; max-width: 560px; margin-bottom: 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.btn {
  display: inline-flex; align-items: center; padding: 13px 24px; border-radius: 10px;
  font-weight: 700; font-size: 0.95rem; transition: all 0.2s ease; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(24,119,242,0.3); }
.btn-primary:hover { background: var(--blue-dark); transform: translateY(-2px); box-shadow: 0 12px 26px rgba(24,119,242,0.4); }
.btn-ghost { background: var(--bg-alt); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); }
.btn-block { width: 100%; justify-content: center; }

.hero-meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: 0.88rem; color: var(--text-muted); align-items: center; }
.live-dot { display: inline-flex; align-items: center; gap: 4px; }

.hero-photo { flex: 0 0 auto; position: relative; }
.photo-orbit {
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  border: 1.5px dashed color-mix(in srgb, var(--blue) 40%, transparent);
  animation: spin 18s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.photo-frame {
  width: 270px; height: 270px;
  border-radius: 50%;
  overflow: hidden;
  border: 5px solid var(--surface);
  box-shadow: 0 0 0 4px var(--blue), var(--shadow-lg);
  transition: transform 0.15s ease;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }

.scroll-cue {
  position: absolute;
  bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 0.72rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.05em;
  z-index: 2;
}
.scroll-cue span {
  width: 18px; height: 30px; border: 2px solid var(--text-muted); border-radius: 12px; position: relative;
}
.scroll-cue span::before {
  content: ""; position: absolute; top: 5px; left: 50%; width: 3px; height: 6px; background: var(--blue);
  border-radius: 2px; transform: translateX(-50%); animation: scroll-dot 1.6s ease infinite;
}
@keyframes scroll-dot { 0% { top: 5px; opacity: 1; } 80% { top: 16px; opacity: 0; } 100% { opacity: 0; } }

/* ---------- Tilt cards (3D) ---------- */
.tilt-card, .tilt-card-soft { transform-style: preserve-3d; will-change: transform; }

/* ---------- Stats ---------- */
.stats { background: linear-gradient(120deg, var(--blue), var(--violet)); padding: 40px 24px; }
.stats-inner { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; text-align: center; }
.stat-num { display: block; font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; color: #fff; }
.stat-label { display: block; font-size: 0.85rem; color: rgba(255,255,255,0.88); margin-top: 4px; font-weight: 600; }

/* ---------- Sections ---------- */
.section { padding: 90px 24px; }
.section.alt { background: var(--bg-alt); }
.section-inner { max-width: var(--maxw); margin: 0 auto; }
.section-title {
  font-family: var(--font-display);
  font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 40px; display: flex; align-items: baseline; gap: 10px;
}
.section-title .num { color: var(--blue); font-size: 1.2rem; }
.section-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 36px; flex-wrap: wrap; }
.section-title-row .section-title { margin-bottom: 0; }
.section-note { color: var(--text-muted); font-size: 0.92rem; max-width: 320px; }
.sub-heading { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; margin: 48px 0 18px; }

.about-grid { display: flex; flex-direction: column; gap: 18px; max-width: 780px; }
.about-text { color: var(--text-muted); font-size: 1.05rem; }

/* ---------- Timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 32px; border-left: 2px solid var(--border); padding-left: 28px; }
.timeline-item { position: relative; }
.timeline-item::before {
  content: ""; position: absolute; left: -34px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--blue); border: 3px solid var(--bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent);
}
.timeline-date { font-size: 0.8rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.timeline-content {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow); transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.timeline-content:hover { box-shadow: var(--shadow-lg); }
.timeline-content h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; }
.company { color: var(--text-muted); font-weight: 500; }
.location { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 12px; }
.timeline-content ul { display: flex; flex-direction: column; gap: 7px; }
.timeline-content li { color: var(--text-muted); font-size: 0.93rem; padding-left: 16px; position: relative; }
.timeline-content li::before { content: "›"; position: absolute; left: 0; color: var(--blue); font-weight: 700; }

/* ---------- Projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 26px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: box-shadow 0.3s ease;
}
.project-card:hover { box-shadow: 0 24px 50px color-mix(in srgb, var(--accent, var(--blue)) 22%, transparent); }
.project-thumb { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--bg-alt); }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.project-card:hover .project-thumb img { transform: scale(1.06); }
.project-badge {
  position: absolute; top: 12px; right: 12px; background: var(--accent, var(--blue)); color: #fff;
  font-size: 0.7rem; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.project-body { padding: 22px 24px; }
.project-body h3 { font-size: 1.18rem; font-weight: 700; margin-bottom: 4px; }
.project-sub { color: var(--accent, var(--blue)); font-size: 0.85rem; font-weight: 600; margin-bottom: 12px; }
.project-body p:not(.project-sub) { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { background: var(--bg-alt); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; font-weight: 600; padding: 4px 10px; border-radius: 20px; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.skill-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); transition: box-shadow 0.25s ease; }
.skill-card:hover { box-shadow: var(--shadow-lg); }
.skill-card h4 { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.skill-icon { font-size: 1.1rem; }
.skill-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.skill-pills span { background: var(--bg-alt); color: var(--text-muted); font-size: 0.76rem; font-weight: 600; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); }

.cert-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.cert-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 13px 16px; font-size: 0.88rem; color: var(--text-muted); }
.cert-list li::before { content: "🎓 "; }

.edu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.edu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.edu-card h4 { font-size: 0.98rem; font-weight: 700; margin-bottom: 4px; }
.edu-card p { color: var(--text-muted); font-size: 0.85rem; }

/* ---------- Testimonials ---------- */
.testimonials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.testimonial-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); position: relative; }
.testimonial-card::before {
  content: "“"; position: absolute; top: 10px; right: 20px; font-family: var(--font-display);
  font-size: 3.2rem; color: var(--blue); opacity: 0.15; line-height: 1;
}
.testimonial-quote { color: var(--text-muted); font-size: 0.96rem; margin-bottom: 20px; font-style: italic; }
.testimonial-person { display: flex; align-items: center; gap: 12px; }
.testimonial-person img { width: 44px; height: 44px; border-radius: 50%; }
.testimonial-person strong { display: block; font-size: 0.92rem; }
.testimonial-person span { color: var(--text-muted); font-size: 0.8rem; }

/* ---------- Updates / Blog ---------- */
.updates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 40px; }
.update-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); transition: transform 0.2s ease; }
.update-card:hover { transform: translateY(-4px); }
.update-tag { display: inline-block; background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 20px; margin-bottom: 10px; }
.update-card h4 { font-size: 1.02rem; font-weight: 700; margin-bottom: 8px; }
.update-card p { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 12px; }
.update-card small { color: var(--text-muted); font-size: 0.76rem; }

.newsletter-form {
  background: linear-gradient(120deg, color-mix(in srgb, var(--blue) 10%, transparent), color-mix(in srgb, var(--violet) 10%, transparent));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.newsletter-text h3 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 4px; }
.newsletter-text p { color: var(--text-muted); font-size: 0.88rem; }
.newsletter-input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.newsletter-input-row input {
  padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border); font-size: 0.92rem;
  background: var(--surface); color: var(--text); min-width: 220px; font-family: inherit;
}
.newsletter-input-row input:focus { outline: none; border-color: var(--blue); }
.form-status { width: 100%; font-size: 0.85rem; margin-top: 10px; font-weight: 600; }
.form-status.success { color: #0a8f3c; }
.form-status.error { color: #e02424; }

/* ---------- Resume ---------- */
.resume-intro { color: var(--text-muted); margin-bottom: 20px; }
.resume-actions { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.resume-viewer { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
.resume-viewer iframe { width: 100%; height: 80vh; border: none; background: #fff; }

/* ---------- Contact ---------- */
.contact-lede { color: var(--text-muted); margin-bottom: 34px; }
.contact-layout { display: grid; grid-template-columns: 1fr 1.1fr; gap: 30px; align-items: start; }
.contact-grid { display: flex; flex-direction: column; gap: 16px; }
.contact-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); transition: transform 0.2s ease, border-color 0.2s ease;
}
a.contact-card:hover { transform: translateY(-3px); border-color: var(--blue); }
.contact-icon { font-size: 1.5rem; }
.contact-label { color: var(--text-muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.contact-value { font-size: 1rem; font-weight: 600; }

.contact-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contact-form input, .contact-form textarea {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); font-size: 0.92rem;
  background: var(--bg-alt); color: var(--text); font-family: inherit; resize: vertical;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--blue); background: var(--surface); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 26px 24px; background: var(--bg-alt); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

.back-to-top {
  position: fixed; bottom: 24px; right: 24px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--blue); color: #fff; border: none; font-size: 1.2rem; cursor: pointer;
  box-shadow: 0 8px 20px rgba(24,119,242,0.35); opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all 0.3s ease; z-index: 90;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--blue-dark); transform: translateY(-3px); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .contact-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .hero-inner { flex-direction: column-reverse; text-align: center; }
  .hero-cta, .hero-meta { justify-content: center; }
  .lede { margin-left: auto; margin-right: auto; }
  .photo-frame { width: 210px; height: 210px; }
  .stats-inner { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-links { display: none; }
  .menu-toggle { display: flex; }
  .nav-links-mobile.open { display: flex; }
  .section { padding: 60px 20px; }
  .resume-viewer iframe { height: 60vh; }
  .newsletter-form { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .photo-orbit { animation: none; }
}
