/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a0f;
  --bg-alt:    #11111a;
  --bg-card:   #15151f;
  --border:    #23232f;
  --text:      #e6e6ed;
  --text-dim:  #8a8a99;
  --text-mute: #555566;
  --accent:    #00d9ff;
  --accent-2:  #7b5cff;
  --accent-3:  #ff5cb9;
  --gradient:  linear-gradient(135deg, #00d9ff 0%, #7b5cff 50%, #ff5cb9 100%);
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 20px 60px -20px rgba(0, 217, 255, 0.15);
  --max-w:     1200px;
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
section[id] { scroll-margin-top: 80px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; transition: color .2s ease; }
ul { list-style: none; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ============ NAV ============ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(10, 10, 15, 0.7);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.nav.scrolled { border-bottom-color: var(--border); }

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.2rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -1px;
}
.logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2.5rem;
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a {
  color: var(--text-dim);
  position: relative;
  transition: color .2s ease;
}
.nav-links a::before {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width .25s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::before { width: 100%; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--text);
  transition: .25s ease;
}

/* ============ HERO ============ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 8rem 0 4rem;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(123, 92, 255, 0.18) 0%, transparent 60%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  letter-spacing: 1px;
}

.hero-title {
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  margin-bottom: 1.8rem;
}
.accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  color: var(--text-dim);
  max-width: 580px;
  margin-bottom: 2.5rem;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

.hero-stats {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
}
.hero-stats span {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .25s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gradient);
  color: #0a0a0f;
  border: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -10px rgba(0, 217, 255, 0.5);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-small { padding: 0.6rem 1.2rem; font-size: 0.85rem; }

/* ============ SECTIONS ============ */
.section {
  padding: 7rem 0;
  position: relative;
}
.section:nth-of-type(even) { background: var(--bg-alt); }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
  letter-spacing: 1px;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 3.5rem;
  letter-spacing: -1px;
}

/* ============ ABOUT ============ */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3.5rem;
  align-items: center;
}
.about-text p {
  color: var(--text-dim);
  margin-bottom: 1.3rem;
  font-size: 1.02rem;
}
.about-text strong { color: var(--text); font-weight: 600; }

.tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin: 0.15rem;
  color: var(--accent);
  background: rgba(0, 217, 255, 0.05);
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.about-card pre { white-space: pre; }
.c-key { color: #ff5cb9; }
.c-cls { color: #00d9ff; }
.c-fn  { color: #7b5cff; }
.c-str { color: #88d96f; }
.c-arg { color: #ffb86c; }
.c-cmt { color: var(--text-mute); font-style: italic; }

/* ============ PROJECTS ============ */
.project {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 4rem;
  align-items: center;
  margin-bottom: 7rem;
}
.project:last-child { margin-bottom: 0; }
.project-reverse { direction: rtl; }
.project-reverse > * { direction: ltr; }

.project-num {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.project-info h3 {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.5px;
}
.project-desc {
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}
.project-desc strong { color: var(--text); font-weight: 600; }

.tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.8rem;
}
.tech li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  padding: 0.35rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
}

.project-links { display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* Project media */
.project-media {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--bg-card);
  aspect-ratio: 4 / 3;
  transition: transform .35s ease;
}
.project-media:hover { transform: translateY(-6px); }

/* Browser frame mock */
.browser-frame { height: 100%; display: flex; flex-direction: column; }
.browser-bar {
  background: #1a1a25;
  padding: 0.7rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.browser-bar > span {
  width: 11px; height: 11px; border-radius: 50%;
  background: #444;
}
.browser-bar > span:nth-child(1) { background: #ff5f56; }
.browser-bar > span:nth-child(2) { background: #ffbd2e; }
.browser-bar > span:nth-child(3) { background: #27c93f; }
.browser-url {
  flex: 1;
  background: #0a0a0f;
  border-radius: 5px;
  padding: 0.3rem 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-left: 0.6rem;
  text-align: center;
}
.browser-body { flex: 1; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.mock-job {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}
.mock-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  padding: 0.2rem 0.55rem;
  background: rgba(0, 217, 255, 0.1);
  color: var(--accent);
  border-radius: 3px;
  margin-bottom: 0.7rem;
}
.mock-line {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  margin-bottom: 0.4rem;
}
.w80 { width: 80%; } .w70 { width: 70%; } .w60 { width: 60%; }
.w55 { width: 55%; } .w50 { width: 50%; } .w40 { width: 40%; }

/* Terminal mock */
.term-body {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  gap: 0.9rem;
  justify-content: center;
}
.term-line { line-height: 1.6; }
.term-prompt { color: var(--accent); }
.term-dim { color: var(--text-mute); }
.term-ok { color: #88d96f; }

/* Chart mock */
.chart-body { justify-content: flex-end; }
.mock-bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  margin-bottom: 0.5rem;
}
.mock-bars span {
  flex: 1;
  background: linear-gradient(180deg, rgba(0, 217, 255, 0.75) 0%, rgba(123, 92, 255, 0.35) 100%);
  border-radius: 4px 4px 0 0;
}

/* Status rows mock */
.mock-status {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}
.mock-status .mock-line { margin-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-ok  { background: #27c93f; box-shadow: 0 0 10px rgba(39, 201, 63, 0.5); }
.dot-err { background: #ff5f56; box-shadow: 0 0 10px rgba(255, 95, 86, 0.5); }

/* ============ MORE PROJECTS GRID ============ */
.more-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 7rem 0 2rem;
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.mini-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: all .25s ease;
}
.mini-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}
.mini-card h4 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.3px; }
.mini-card p { color: var(--text-dim); font-size: 0.9rem; flex: 1; }
.mini-card .tech { margin-bottom: 0; }

/* ============ SKILLS ============ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem;
  transition: all .25s ease;
}
.skill-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}
.skill-card h4 {
  color: var(--accent);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 1rem;
  letter-spacing: 0.5px;
}
.skill-card ul li {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid transparent;
}

/* ============ EXPERIENCE ============ */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 2.4rem;
  border-left: 2px solid var(--border);
  padding-left: 2rem;
  margin-left: 0.4rem;
}
.tl-item { position: relative; }
.tl-item::before {
  content: '';
  position: absolute;
  left: calc(-2rem - 7px);
  top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gradient);
}
.tl-when {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.tl-body h4 { font-size: 1.15rem; font-weight: 700; }
.tl-org {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  margin: 0.15rem 0 0.5rem;
}
.tl-body p:last-child {
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 720px;
}
.edu-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 4.5rem 0 1.5rem;
}
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.edu-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
}
.edu-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.edu-card p {
  color: var(--text-dim);
  font-size: 0.88rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ============ CONTACT ============ */
.contact-inner { text-align: center; max-width: 720px; }
.contact-inner .eyebrow,
.contact-inner .section-title { text-align: center; }
.contact-sub {
  color: var(--text-dim);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
}
.contact-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.contact-loc {
  margin-top: 2rem;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ============ FOOTER ============ */
.footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer p {
  color: var(--text-mute);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ============ CHATBOT ============ */
.chat-widget {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.9rem;
}
.chat-fab {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 10px 30px -8px rgba(0, 217, 255, 0.5);
  transition: transform .2s ease;
}
.chat-fab:hover { transform: scale(1.08); }
.chat-panel[hidden] { display: none; }
.chat-panel {
  width: min(360px, calc(100vw - 2.8rem));
  height: 480px;
  max-height: 70vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
}
.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.chat-head strong { display: block; }
.chat-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-dim);
}
.chat-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.chat-close:hover { color: var(--text); }
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.msg {
  max-width: 85%;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.msg-bot {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg-user {
  background: rgba(0, 217, 255, 0.12);
  border: 1px solid rgba(0, 217, 255, 0.25);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg-typing span {
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: blink 1.2s infinite;
}
.msg-typing span:nth-child(2) { animation-delay: .2s; }
.msg-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.chat-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}
.chat-form input:focus { border-color: var(--accent); }
.chat-send {
  background: var(--gradient);
  color: #0a0a0f;
  border: none;
  border-radius: 8px;
  padding: 0 1rem;
  cursor: pointer;
  font-size: 1rem;
}

/* ============ ADVANCED POLISH ============ */
::selection { background: var(--accent); color: #0a0a0f; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 300;
  pointer-events: none;
}

.nav-links a.active { color: var(--text); }
.nav-links a.active::before { width: 100%; }

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 217, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 217, 255, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.hero-glow { animation: drift 14s ease-in-out infinite alternate; }
.hero-glow-2 {
  width: 500px; height: 500px;
  top: 65%; left: 20%;
  background: radial-gradient(circle, rgba(255, 92, 185, 0.10) 0%, transparent 60%);
  animation: drift 18s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate(-50%, -50%) translate(0, 0); }
  to   { transform: translate(-50%, -50%) translate(60px, -40px); }
}

.hero-eyebrow::after {
  content: '▌';
  margin-left: 4px;
  animation: caret 1.1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.section-title::after {
  content: '';
  display: block;
  width: 64px;
  height: 3px;
  border-radius: 2px;
  background: var(--gradient);
  margin-top: 0.9rem;
}
.contact-inner .section-title::after { margin-left: auto; margin-right: auto; }

.project-media { transition: transform .35s ease, border-color .35s ease, box-shadow .35s ease; }
.project-media:hover {
  border-color: rgba(0, 217, 255, 0.4);
  box-shadow: 0 24px 70px -18px rgba(0, 217, 255, 0.28);
}
.skill-card:hover, .mini-card:hover, .edu-card:hover {
  box-shadow: 0 14px 44px -14px rgba(0, 217, 255, 0.25);
}
.edu-card { transition: all .25s ease; }
.edu-card:hover { border-color: var(--accent); transform: translateY(-4px); }

.chat-fab { display: flex; align-items: center; justify-content: center; color: #0a0a0f; }
.chat-fab svg { width: 26px; height: 26px; }
.chat-send { display: flex; align-items: center; justify-content: center; }
.chat-send svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 880px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: fixed;
    top: 64px; right: 0;
    background: var(--bg-alt);
    border-left: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    transform: translateX(100%);
    transition: transform .3s ease;
    min-width: 220px;
  }
  .nav-links.open { transform: translateX(0); }

  .about-grid,
  .project,
  .project-reverse {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    direction: ltr;
  }

  .hero { padding: 6rem 0 3rem; min-height: auto; }
  .hero-stats { gap: 1.8rem; }
  .hero-stats strong { font-size: 1.5rem; }

  .section { padding: 5rem 0; }
  .section-title { margin-bottom: 2.5rem; }

  .footer-inner { flex-direction: column; text-align: center; }
}
