/* ===================== Root & Reset ===================== */
:root {
  --bg: #05060a;
  --bg-alt: #090b12;
  --surface: rgba(255,255,255,0.04);
  --surface-strong: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.09);
  --text: #eef0f5;
  --text-dim: #a3a8bd;
  --purple: #7c5cff;
  --teal: #00d3c1;
  --coral: #ff6b6b;
  --amber: #ffb454;
  --grad: linear-gradient(135deg, var(--purple), var(--teal));
  --shadow-glow: 0 0 40px rgba(124,92,255,0.25);
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Sora', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
  line-height: 1.6;
}

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

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

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 10px; }

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
}

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ===================== Cursor Glow ===================== */
.cursor-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124,92,255,0.15), transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
  transition: left 0.15s ease-out, top 0.15s ease-out;
}

/* ===================== Preloader ===================== */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
#preloader.done { opacity: 0; visibility: hidden; }

.loader-scene { perspective: 600px; }
.cube {
  width: 60px; height: 60px;
  position: relative;
  transform-style: preserve-3d;
  animation: cube-rotate 2.4s infinite linear;
}
.cube .face {
  position: absolute;
  width: 60px; height: 60px;
  border: 1px solid var(--purple);
  background: rgba(124,92,255,0.12);
}
.face.front  { transform: translateZ(30px); }
.face.back   { transform: translateZ(-30px) rotateY(180deg); }
.face.right  { transform: rotateY(90deg) translateZ(30px); }
.face.left   { transform: rotateY(-90deg) translateZ(30px); }
.face.top    { transform: rotateX(90deg) translateZ(30px); }
.face.bottom { transform: rotateX(-90deg) translateZ(30px); }

@keyframes cube-rotate {
  0%   { transform: rotateX(0) rotateY(0); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

.loader-text {
  font-family: var(--font-head);
  color: var(--text-dim);
  letter-spacing: 2px;
  font-size: 14px;
  text-transform: uppercase;
}
.dots span { animation: blink 1.4s infinite; opacity: 0; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,100% { opacity: 0; } 50% { opacity: 1; } }

/* ===================== Navbar ===================== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 6%;
  transition: all 0.3s ease;
}
.navbar.scrolled {
  background: rgba(5,6,10,0.75);
  backdrop-filter: blur(14px);
  padding: 14px 6%;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.logo span { color: var(--purple); }
.logo em { color: var(--teal); font-style: normal; }

.nav-links {
  display: flex;
  gap: 32px;
}
.nav-links a {
  font-size: 14.5px;
  color: var(--text-dim);
  font-weight: 500;
  position: relative;
  transition: color 0.25s;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 0;
  width: 0; height: 2px;
  background: var(--grad);
  transition: width 0.3s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { width: 100%; }

.nav-cta {
  padding: 10px 22px;
  background: var(--grad);
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  transition: transform 0.25s, box-shadow 0.25s;
}
.nav-cta:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }

.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 101;
}
.burger span {
  width: 26px; height: 2px;
  background: var(--text);
  transition: 0.3s;
}
.burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===================== Hero ===================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 2;
  padding: 120px 20px 60px;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124,92,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,92,255,0.06) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  z-index: -1;
}

.hero-inner { max-width: 820px; }

.hero-tag {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 30px;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
  background: var(--surface);
}

.hero-name {
  font-family: var(--font-head);
  font-size: clamp(48px, 9vw, 96px);
  font-weight: 700;
  line-height: 1.05;
  background: linear-gradient(135deg, #fff 30%, var(--purple) 70%, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}

.hero-role {
  font-family: var(--font-head);
  font-size: clamp(20px, 3.5vw, 32px);
  font-weight: 500;
  color: var(--teal);
  margin-bottom: 24px;
  min-height: 44px;
}
.cursor-blink { animation: blink 1s infinite; color: var(--purple); }

.hero-desc {
  font-size: 17px;
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 36px;
}

.hero-btns {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 40px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s;
}
.btn-primary {
  background: var(--grad);
  color: #fff;
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: var(--shadow-glow); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--surface-strong); transform: translateY(-3px); }
.btn-small { padding: 9px 18px; font-size: 13px; border-radius: 30px; }

.hero-socials {
  display: flex;
  gap: 24px;
  justify-content: center;
}
.hero-socials a {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.25s;
}
.hero-socials a:hover { color: var(--teal); }

.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.scroll-indicator span {
  width: 20px; height: 32px;
  border: 2px solid var(--border);
  border-radius: 20px;
  position: relative;
}
.scroll-indicator span::before {
  content: '';
  position: absolute;
  top: 6px; left: 50%;
  width: 4px; height: 4px;
  background: var(--teal);
  border-radius: 50%;
  transform: translateX(-50%);
  animation: scroll-dot 1.6s infinite;
}
@keyframes scroll-dot {
  0% { top: 6px; opacity: 1; }
  80% { top: 18px; opacity: 0; }
  100% { top: 18px; opacity: 0; }
}

/* ===================== Sections ===================== */
.section {
  position: relative;
  z-index: 2;
  padding: 120px 6%;
}
.section.alt { background: linear-gradient(180deg, transparent, rgba(124,92,255,0.03), transparent); }

.section-head { text-align: center; max-width: 700px; margin: 0 auto 64px; }
.tag {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--purple);
  font-weight: 600;
  margin-bottom: 14px;
}
.section-head h2 {
  font-family: var(--font-head);
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 700;
  line-height: 1.3;
}
.section-sub {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 16px;
}

/* ===================== About ===================== */
.about-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 60px;
  max-width: 1100px;
  margin: 0 auto;
  align-items: center;
}
.about-card {
  position: relative;
  padding: 20px;
  aspect-ratio: 1/1.1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.about-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  position: relative;
  z-index: 2;
  filter: saturate(1.05);
}
.about-orbit {
  position: absolute;
  inset: -40%;
  border: 1px dashed rgba(124,92,255,0.3);
  border-radius: 50%;
  animation: spin 20s linear infinite;
  z-index: 1;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.about-content p { color: var(--text-dim); margin-bottom: 18px; font-size: 16px; }
.about-content strong { color: var(--text); }
.about-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin: 26px 0 30px;
  font-size: 14.5px;
  color: var(--text-dim);
}
.about-info strong { color: var(--teal); font-weight: 600; }

/* ===================== Skills ===================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
  max-width: 1200px;
  margin: 0 auto;
}
.skill-card {
  padding: 32px 26px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.3s;
  transform-style: preserve-3d;
  will-change: transform;
}
.skill-card:hover { border-color: rgba(124,92,255,0.4); }
.skill-icon { font-size: 34px; margin-bottom: 14px; }
.skill-card h3 { font-family: var(--font-head); font-size: 20px; margin-bottom: 16px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row span {
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* ===================== Timeline ===================== */
.timeline {
  max-width: 850px;
  margin: 0 auto;
  position: relative;
  padding-left: 30px;
  border-left: 2px solid var(--border);
}
.timeline-item { position: relative; margin-bottom: 50px; padding-left: 30px; }
.timeline-item:last-child { margin-bottom: 0; }
.tl-dot {
  position: absolute;
  left: -46px; top: 6px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 4px rgba(124,92,255,0.15);
}
.tl-card { padding: 28px 30px; }
.tl-date {
  display: inline-block;
  font-size: 13px;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.tl-card h3 { font-family: var(--font-head); font-size: 21px; margin-bottom: 4px; }
.tl-company { color: var(--text-dim); font-size: 14.5px; margin-bottom: 16px; }
.tl-card ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  color: var(--text-dim);
  font-size: 14.5px;
}
.tl-card ul li::before {
  content: '▹';
  position: absolute;
  left: 0;
  color: var(--purple);
}

/* ===================== Projects ===================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  max-width: 1300px;
  margin: 0 auto;
}
.project-card {
  position: relative;
  padding: 30px 26px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.3s;
  transform-style: preserve-3d;
  will-change: transform;
  overflow: hidden;
}
.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent, var(--purple));
}
.project-card:hover { border-color: var(--accent, var(--purple)); }
.pc-rank {
  position: absolute;
  top: 18px; right: 22px;
  font-family: var(--font-head);
  font-size: 34px;
  font-weight: 700;
  color: rgba(255,255,255,0.06);
}
.pc-icon { font-size: 32px; margin-bottom: 14px; }
.project-card h3 { font-family: var(--font-head); font-size: 19px; margin-bottom: 4px; padding-right: 20px; }
.pc-sub { color: var(--accent, var(--teal)); font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.pc-summary { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; min-height: 65px; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.pc-tags span {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.pc-actions { display: flex; gap: 12px; }

/* ===================== Modal ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s ease;
  padding: 20px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-box {
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 40px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  border-top: 3px solid var(--accent, var(--purple));
}
.modal-overlay.active .modal-box { transform: translateY(0); }
.modal-close {
  position: absolute;
  top: 20px; right: 20px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}
.modal-icon { font-size: 40px; margin-bottom: 14px; }
.modal-box h2 { font-family: var(--font-head); font-size: 24px; margin-bottom: 6px; padding-right: 30px; }
.modal-sub { color: var(--accent, var(--teal)); font-size: 14px; font-weight: 600; margin-bottom: 18px; }
.modal-points { margin: 22px 0 28px; }
.modal-points li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 12px;
  color: var(--text-dim);
  font-size: 14.5px;
}
.modal-points li::before {
  content: '▹';
  position: absolute;
  left: 0;
  color: var(--accent, var(--purple));
}

/* ===================== Education / Certs ===================== */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px;
  max-width: 1000px;
  margin: 0 auto;
}
.edu-card { padding: 30px; }
.edu-card h3 { font-family: var(--font-head); font-size: 19px; margin-bottom: 16px; }
.edu-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.edu-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 10px; }
.edu-date { font-size: 13px; color: var(--teal); font-weight: 600; }
.edu-card ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  color: var(--text-dim);
  font-size: 14px;
}
.edu-card ul li::before {
  content: '▹';
  position: absolute;
  left: 0;
  color: var(--purple);
}

/* ===================== Contact ===================== */
.contact-wrap {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 50px;
  max-width: 1100px;
  margin: 0 auto;
}
.contact-info { display: flex; flex-direction: column; gap: 20px; }
.contact-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.25s, border-color 0.25s;
}
.contact-item:hover { transform: translateX(6px); border-color: var(--purple); }
.c-icon { font-size: 22px; }
.contact-item strong { display: block; font-size: 14px; margin-bottom: 2px; }
.contact-item p { color: var(--text-dim); font-size: 13.5px; }

.contact-form { padding: 36px; display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.contact-form input, .contact-form textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  resize: none;
  outline: none;
  transition: border-color 0.25s;
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--purple); }
.contact-form button { align-self: flex-start; }

/* ===================== Footer ===================== */
.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 30px;
  color: var(--text-dim);
  font-size: 13.5px;
  border-top: 1px solid var(--border);
}

/* ===================== Responsive ===================== */
@media (max-width: 1024px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; }
  .about-card { max-width: 340px; margin: 0 auto; }
  .edu-grid { grid-template-columns: 1fr; }
  .contact-wrap { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links, .nav-cta { display: none; }
  .burger { display: flex; }
  .nav-links.active {
    display: flex;
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    width: 70%;
    background: rgba(5,6,10,0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
    padding: 40px;
    z-index: 100;
  }
  .skills-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .section { padding: 90px 6%; }
  .cursor-glow { display: none; }
}
