/* ============================================================
   Syed Mujtaba Rizwan — Portfolio
   Theme tokens, layout, components. Dark default + light theme.
   ============================================================ */

:root {
  --max: 1140px;
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(120deg, #818cf8 0%, #22d3ee 100%);
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.55);
  --trans: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- DARK (default) ---------- */
[data-theme="dark"] {
  --bg: #0a0b12;
  --bg-alt: #11131d;
  --surface: #171a27;
  --surface-2: #1e2233;
  --border: #262b3d;
  --text: #e7e9f3;
  --text-dim: #9aa0b8;
  --text-faint: #6b7390;
  --chip-bg: #1c2031;
  --nav-bg: rgba(10, 11, 18, 0.72);
}

/* ---------- LIGHT ---------- */
[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: #e3e7f0;
  --text: #14182a;
  --text-dim: #545b75;
  --text-faint: #8a91aa;
  --chip-bg: #eef1f8;
  --nav-bg: rgba(246, 247, 251, 0.78);
  --shadow: 0 18px 50px -24px rgba(40, 50, 90, 0.28);
  --accent: #4f46e5;
  --accent-grad: linear-gradient(120deg, #4f46e5 0%, #0891b2 100%);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background var(--trans), color var(--trans);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.accent { color: var(--accent); }
.gradient-text {
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--accent-grad); z-index: 1000; transition: width 0.1s linear;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: var(--nav-bg);
  border-bottom: 1px solid transparent;
  transition: border-color var(--trans), background var(--trans);
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav__inner {
  max-width: var(--max); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.nav__brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.nav__brand-mark { font-family: var(--mono); color: var(--accent); font-size: 1rem; }
.nav__links { display: flex; gap: 28px; }
.nav__links a {
  font-size: 0.92rem; font-weight: 500; color: var(--text-dim);
  position: relative; transition: color var(--trans);
}
.nav__links a::after {
  content: ''; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
  background: var(--accent-grad); transition: width var(--trans);
}
.nav__links a:hover, .nav__links a.active { color: var(--text); }
.nav__links a:hover::after, .nav__links a.active::after { width: 100%; }
.nav__actions { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; display: grid; place-items: center;
  transition: transform var(--trans), border-color var(--trans), background var(--trans);
}
.theme-toggle:hover { transform: rotate(15deg); border-color: var(--accent); }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.nav__burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav__burger span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: var(--trans); }
.nav__burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger.open span:nth-child(2) { opacity: 0; }
.nav__burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 26px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; border: 1px solid transparent; transition: var(--trans);
}
.btn--primary { background: var(--accent-grad); color: #fff; box-shadow: 0 10px 30px -10px var(--accent); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -10px var(--accent); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100vh; display: flex; align-items: center; padding: 120px 0 60px; overflow: hidden; }
.hero__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.blob--1 { width: 460px; height: 460px; background: #6366f1; top: -120px; right: -80px; }
.blob--2 { width: 380px; height: 380px; background: #22d3ee; bottom: -100px; left: -100px; opacity: 0.35; }
[data-theme="light"] .blob { opacity: 0.22; }
.grid-overlay {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px; opacity: 0.25;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%);
}
.hero__inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: center; }
.hero__eyebrow { display: inline-flex; align-items: center; gap: 9px; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); background: var(--surface); border: 1px solid var(--border); padding: 7px 15px; border-radius: 999px; margin-bottom: 22px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.hero__title { font-size: clamp(2.4rem, 5.5vw, 4rem); font-weight: 800; line-height: 1.07; letter-spacing: -0.02em; margin-bottom: 18px; }
.hero__subtitle { font-size: clamp(1.1rem, 2.2vw, 1.4rem); color: var(--text); margin-bottom: 16px; font-weight: 500; }
.hero__lead { color: var(--text-dim); font-size: 1.02rem; max-width: 560px; margin-bottom: 30px; }
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }
.hero__socials { display: flex; gap: 14px; }
.hero__socials a { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--text-dim); transition: var(--trans); }
.hero__socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-3px); }

/* Hero visual */
.hero__visual { position: relative; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.hero__photo-wrap { position: relative; width: 240px; height: 240px; }
.hero__photo-ring { position: absolute; inset: -10px; border-radius: 50%; background: var(--accent-grad); opacity: 0.6; filter: blur(2px); animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero__photo, .hero__photo-fallback {
  position: relative; width: 240px; height: 240px; border-radius: 50%;
  object-fit: cover; border: 4px solid var(--bg); box-shadow: var(--shadow);
}
.hero__photo-fallback { display: none; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 700; font-size: 3rem; color: #fff; background: var(--accent-grad); }
.hero__code-card { width: 100%; max-width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.code-card__head { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.code-dot { width: 11px; height: 11px; border-radius: 50%; background: #ff5f56; }
.code-dot:nth-child(2) { background: #ffbd2e; }
.code-dot:nth-child(3) { background: #27c93f; }
.code-card__file { margin-left: auto; font-family: var(--mono); font-size: 0.78rem; color: var(--text-faint); }
.code-card__body { padding: 16px; font-family: var(--mono); font-size: 0.82rem; line-height: 1.7; color: var(--text-dim); overflow-x: auto; }
.c-key { color: #c792ea; } .c-cls { color: #82aaff; } .c-str { color: #c3e88d; } .c-fn { color: #82aaff; }

.hero__scroll { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); width: 26px; height: 42px; border: 2px solid var(--border); border-radius: 14px; display: grid; place-items: start center; padding-top: 7px; z-index: 1; }
.hero__scroll span { width: 4px; height: 8px; border-radius: 4px; background: var(--accent); animation: scroll 1.6s infinite; }
@keyframes scroll { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: -30px auto 30px; position: relative; z-index: 2; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 20px; text-align: center; }
.stat__num { font-size: 2.4rem; font-weight: 800; font-family: var(--mono); background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat__plus { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.stat__label { display: block; font-size: 0.85rem; color: var(--text-dim); margin-top: 4px; }

/* ---------- Section scaffolding ---------- */
.section { padding: 100px 0; }
.section--alt { background: var(--bg-alt); }
.section__head { margin-bottom: 50px; max-width: 640px; }
.section__tag { font-family: var(--mono); font-size: 0.82rem; font-weight: 600; color: var(--accent); letter-spacing: 0.05em; }
.section__title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -0.02em; margin-top: 10px; line-height: 1.15; }
.section__sub { color: var(--text-dim); margin-top: 14px; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.3fr 1fr; gap: 50px; align-items: start; }
.about__text p { color: var(--text-dim); margin-bottom: 16px; }
.about__text strong { color: var(--text); font-weight: 600; }
.about__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 26px; }
.about__meta > div { border-left: 2px solid var(--accent); padding-left: 14px; }
.about__meta-k { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.about__meta-v { font-weight: 600; font-size: 0.95rem; }
.about__meta-v a:hover { color: var(--accent); }
.about__highlights { display: grid; gap: 16px; }
.highlight { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px; transition: var(--trans); }
.highlight:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.highlight h3 { font-size: 1.02rem; margin-bottom: 6px; }
.highlight p { font-size: 0.9rem; color: var(--text-dim); }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.skill-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; transition: var(--trans); }
.skill-group:hover { border-color: var(--accent); }
.skill-group__title { font-size: 1.05rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.skill-group__title::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { font-size: 0.85rem; font-weight: 500; padding: 7px 14px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--border); color: var(--text-dim); transition: var(--trans); cursor: default; }
.chip:hover { color: var(--text); border-color: var(--accent); transform: translateY(-2px); }

/* ---------- Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 36px; }
.filter { padding: 9px 20px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); font-weight: 500; font-size: 0.9rem; cursor: pointer; transition: var(--trans); }
.filter:hover { color: var(--text); border-color: var(--accent); }
.filter.is-active { background: var(--accent-grad); color: #fff; border-color: transparent; }
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.project { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; display: flex; flex-direction: column; transition: var(--trans); position: relative; overflow: hidden; }
.project::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent-grad); transform: scaleX(0); transform-origin: left; transition: transform var(--trans); }
.project:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: var(--shadow); }
.project:hover::before { transform: scaleX(1); }
.project.hide { display: none; }
.project__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.project__icon { font-size: 1.8rem; }
.project__role { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); background: var(--chip-bg); padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); }
.project__title { font-size: 1.22rem; margin-bottom: 10px; }
.project__desc { font-size: 0.9rem; color: var(--text-dim); flex-grow: 1; margin-bottom: 16px; }
.project__tags { display: flex; flex-wrap: wrap; gap: 7px; }
.project__tags span { font-family: var(--mono); font-size: 0.72rem; padding: 4px 9px; border-radius: 6px; background: var(--chip-bg); color: var(--text-faint); }
.project__link { margin-top: 14px; font-size: 0.85rem; font-weight: 600; color: var(--accent); align-self: flex-start; }
.project__link:hover { text-decoration: underline; }

/* ---------- Timeline ---------- */
.timeline { position: relative; max-width: 780px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-left: 40px; margin-bottom: 26px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-dot { position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent-grad); border: 3px solid var(--bg-alt); }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; transition: var(--trans); }
.tl-card:hover { border-color: var(--accent); transform: translateX(4px); }
.tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.tl-head h3 { font-size: 1.1rem; }
.tl-date { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); white-space: nowrap; }
.tl-org { font-weight: 600; color: var(--text-dim); margin: 4px 0 10px; }
.tl-desc { font-size: 0.92rem; color: var(--text-dim); }

/* ---------- Contact ---------- */
.contact { text-align: center; max-width: 720px; margin: 0 auto; }
.contact__lead { color: var(--text-dim); margin: 18px auto 30px; max-width: 540px; }
.contact__actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 44px; }
.contact__cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.contact-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; text-align: left; transition: var(--trans); }
a.contact-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.contact-card span { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 6px; }
.contact-card strong { font-size: 0.98rem; word-break: break-word; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer p { color: var(--text-faint); font-size: 0.88rem; }
.footer__top { font-size: 0.88rem; font-weight: 600; color: var(--text-dim); }
.footer__top:hover { color: var(--accent); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero__inner { grid-template-columns: 1fr; gap: 40px; }
  .hero__visual { order: -1; flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .hero__code-card { max-width: 280px; }
  .about { grid-template-columns: 1fr; gap: 30px; }
  .projects { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .nav__links { position: fixed; inset: 64px 0 auto 0; flex-direction: column; gap: 0; background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: 10px 24px 20px; transform: translateY(-130%); transition: transform var(--trans); }
  .nav__links.open { transform: translateY(0); }
  .nav__links a { padding: 14px 0; border-bottom: 1px solid var(--border); }
  .nav__burger { display: flex; }
  .section { padding: 70px 0; }
  .skills { grid-template-columns: 1fr; }
  .projects { grid-template-columns: 1fr; }
  .contact__cards { grid-template-columns: 1fr; }
  .hero__photo-wrap, .hero__photo, .hero__photo-fallback { width: 190px; height: 190px; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
}

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