/* =====================
   CSS VARIABLES & RESET
   ===================== */
:root {
  --bg: #080b0f;
  --bg2: #0e1117;
  --bg3: #141920;
  --border: #1e2531;
  --text: #e2e8f0;
  --muted: #64748b;
  --accent: #00e5ff;
  --accent2: #7c3aed;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --font-mono: 'JetBrains Mono', monospace;
  --font-display: 'Syne', sans-serif;
  --nav-h: 70px;
  --max-w: 1100px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

/* ── Light Mode ── */
body.light {
  --bg: #f0f4f8;
  --bg2: #ffffff;
  --bg3: #e8edf2;
  --border: #d1d9e0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0891b2;
  --accent2: #7c3aed;
  --green: #16a34a;
  --red: #dc2626;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}

body.light .c-keyword { color: #7c3aed; }
body.light .c-class   { color: #b45309; }
body.light .c-fn      { color: #1d4ed8; }
body.light .c-self    { color: #c2410c; }
body.light .c-str     { color: #15803d; }
body.light .hero-bg-grid { opacity: 0.12; }
body.light .code-body { background: #f8fafc; color: #1e293b; }
body.light #navbar    { background: rgba(240,244,248,0.92); }

/* ── Theme Toggle Button ── */
.theme-toggle {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Smooth theme transition */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
strong { color: var(--accent); }
input, textarea, button { font-family: var(--font-mono); }

/* ======
   NAVBAR
   ====== */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 60px);
  z-index: 100;
  background: rgba(8, 11, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
#navbar.scrolled { border-color: var(--border); }

.nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  margin-right: 2rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}
.nav-link {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition: color 0.2s;
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s;
}
.nav-link:hover, .nav-link.active { color: var(--accent); }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 24px; height: 2px;
  background: var(--text);
  transition: all 0.3s;
}

/* ========
   SECTIONS
   ======== */
.section {
  min-height: 100vh;
  padding: calc(var(--nav-h) + 60px) clamp(20px, 7vw, 120px) 80px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-label {
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -1px;
}
.section-title.center { text-align: center; }

.section-sub {
  color: var(--muted);
  margin-bottom: 3rem;
  font-size: 0.9rem;
}
.section-sub.center { text-align: center; }

/* ======
   HERO
   ====== */
.hero-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 3vw, 50px);
  position: relative;
  overflow: clip;
}

.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.3;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at 60% 40%, black 30%, transparent 75%);
}

.hero-content { flex: 1; min-width: 0; max-width: 520px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 0.75rem;
  color: var(--green);
  margin-bottom: 1.5rem;
  animation: fadeUp 0.6s ease both;
}
.hero-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 1rem;
}
.hero-title .line { display: block; }
.hero-title .name-line { color: var(--accent); }
.cursor {
  display: inline-block;
  animation: blink 1s step-end infinite;
  color: var(--accent);
}
@keyframes blink { 50% { opacity: 0; } }

.hero-role {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
  min-height: 1.5em;
}
.typed-text { color: var(--accent2); }

.hero-desc {
  color: var(--muted);
  max-width: 460px;
  margin-bottom: 2rem;
  line-height: 1.8;
}

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

.hero-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.stat { display: flex; flex-direction: column; }
.stat-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.stat-label { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.stat-divider { width: 1px; height: 36px; background: var(--border); }

/* Code card */
.hero-code-card {
  flex-shrink: 0;
  width: clamp(260px, 30vw, 380px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 229, 255, 0.06);
  animation: fadeLeft 0.8s ease both 0.3s;
}
.code-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.code-card-header .dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red    { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green  { background: #22c55e; }
.code-file {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--muted);
}
.code-body {
  padding: 20px;
  font-size: 0.8rem;
  line-height: 1.9;
  overflow-x: auto;
}
.c-keyword { color: #c792ea; }
.c-class   { color: #ffcb6b; }
.c-fn      { color: #82aaff; }
.c-self    { color: #f78c6c; }
.c-str     { color: #c3e88d; }

/* ======
   BUTTONS
   ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: transparent;
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
}
.btn-outline {
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}
.full-w { width: 100%; }

/* ======
   ABOUT
   ====== */
.about-section { display: block; }
.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 60px;
  align-items: start;
  margin-top: 2rem;
}

.about-img-wrap { display: flex; flex-direction: column; gap: 1.5rem; }
.about-img-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: visible;
}
.about-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
}
.img-accent {
  position: absolute;
  inset: -8px;
  border: 1px solid var(--accent);
  border-radius: calc(var(--radius) + 4px);
  opacity: 0.2;
  z-index: -1;
}

.about-social { display: flex; flex-direction: column; gap: 10px; }
.social-btn {
  display: block;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  text-align: center;
  transition: all 0.2s;
  color: var(--muted);
}
.social-btn:hover { border-color: var(--accent); color: var(--accent); }
.social-btn.accent { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.social-btn.accent:hover { background: transparent; color: var(--accent); }

.about-text p { color: var(--muted); margin-bottom: 1rem; line-height: 1.9; }

.about-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 1.5rem;
  padding: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.info-item { display: flex; flex-direction: column; gap: 2px; }
.info-key { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.info-val { font-size: 0.85rem; color: var(--text); }
.c-green { color: var(--green) !important; }

/* ======
   SKILLS
   ====== */
.skills-section { display: block; }
.skills-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 3rem;
}
.skill-category {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s;
}
.skill-category:hover { border-color: rgba(0, 229, 255, 0.3); }
.cat-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 0.72rem;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--muted);
  transition: all 0.2s;
}
.tag:hover { border-color: var(--accent); color: var(--accent); }

.skill-bars {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.bars-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.bar-item { margin-bottom: 18px; }
.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 2px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.bar-fill.animated { width: var(--w); }

/* ========
   PROJECTS
   ======== */
.projects-section { display: block; }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.project-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.project-card:hover {
  border-color: rgba(0, 229, 255, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.project-card.featured {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--bg2), #0e1520);
  border-color: rgba(0, 229, 255, 0.2);
}
body.light .project-card.featured {
  background: linear-gradient(135deg, #ffffff, #f0f6ff);
}
.project-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.project-tag { font-size: 0.7rem; color: var(--accent); letter-spacing: 0.05em; }
.project-links { display: flex; gap: 12px; }
.plink { font-size: 0.75rem; color: var(--muted); transition: color 0.2s; }
.plink:hover, .plink.accent { color: var(--accent); }
.project-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}
.project-desc { font-size: 0.82rem; color: var(--muted); line-height: 1.8; flex: 1; }
.project-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.project-stack span {
  font-size: 0.68rem;
  padding: 3px 10px;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: 100px;
  color: var(--accent);
}

/* =======
   CONTACT
   ======= */
.contact-section { display: block; }
.contact-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 60px;
  align-items: start;
}

.contact-info { display: flex; flex-direction: column; gap: 24px; }
.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.c-icon { font-size: 1.2rem; margin-top: 2px; }
.c-label { font-size: 0.7rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; display: block; }
.c-value { font-size: 0.85rem; color: var(--text); }
a.c-value:hover { color: var(--accent); }

.contact-socials { display: flex; gap: 10px; flex-wrap: wrap; }
.soc-link {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  transition: all 0.2s;
}
.soc-link:hover { border-color: var(--accent); color: var(--accent); }

/* Contact form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.05em; }
.form-group input,
.form-group textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--muted); }

.form-notice {
  font-size: 0.8rem;
  min-height: 1.4em;
  color: var(--green);
  text-align: center;
}
.form-notice.error { color: var(--red); }

/* ======
   FOOTER
   ====== */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px clamp(20px, 7vw, 120px);
  max-width: var(--max-w);
  margin: 0 auto;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-logo { font-family: var(--font-display); font-weight: 800; color: var(--accent); }
.footer-copy { font-size: 0.75rem; color: var(--muted); }
.footer-top { font-size: 0.75rem; color: var(--muted); transition: color 0.2s; }
.footer-top:hover { color: var(--accent); }

/* =========
   ANIMATIONS
   ========= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeLeft {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-in.visible { opacity: 1; transform: none; }

/* ===========
   RESPONSIVE
   =========== */
@media (max-width: 1024px) {
  .hero-title { font-size: clamp(1.8rem, 4vw, 3rem); }
  .hero-content { max-width: 100%; }
}

@media (max-width: 900px) {
  .hero-section {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding-top: calc(var(--nav-h) + 40px);
    gap: 30px;
  }
  .hero-content { max-width: 100%; }
  .hero-title { font-size: clamp(2rem, 8vw, 3.5rem); letter-spacing: -1px; }
  .hero-cta    { justify-content: center; }
  .hero-stats  { justify-content: center; }
  .hero-desc   { margin: 0 auto 2rem; max-width: 100%; }
  .hero-code-card { width: 100%; max-width: 500px; }

  .about-grid,
  .contact-grid { grid-template-columns: 1fr; }
  .about-img-wrap { max-width: 280px; margin: 0 auto; }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 20px;
    gap: 1rem;
    z-index: 99;
  }
  .nav-links.open { display: flex; }
  .hamburger { display: flex; }
  .nav-right  { gap: 8px; }

  .hero-title { font-size: clamp(1.8rem, 9vw, 3rem); letter-spacing: -0.5px; }
  .form-row { grid-template-columns: 1fr; }
  .hero-code-card { display: none; }
  .skills-categories { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card.featured { grid-column: 1; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}