:root {
  --bg: #0b0f1a;
  --bg-alt: #111827;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #22d3ee;
  --accent-2: #a855f7;
  --accent-gradient: linear-gradient(135deg, #22d3ee, #a855f7);
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --font-mono: 'JetBrains Mono', 'Noto Sans SC', monospace;
  --font-sans: 'Noto Sans SC', -apple-system, 'PingFang SC', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: radial-gradient(ellipse at 50% -10%, #14204a 0%, #0a0f24 40%, #060a18 75%, #04060f 100%);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

::selection {
  background: rgba(34, 211, 238, 0.3);
}

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

/* ---------- Background layers ---------- */
#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.cursor-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.12), transparent 60%);
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s;
  opacity: 0;
}

/* ---------- Glass utility ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.hero-content {
  max-width: 720px;
  width: 100%;
}

.hero-greeting {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 12px;
}

.hero-name {
  font-size: clamp(2.6rem, 8vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  min-height: 1.2em;
}

.hero-role {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  color: var(--text-dim);
  margin-top: 12px;
}

.blink {
  animation: blink 1s steps(1) infinite;
  color: var(--accent);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero-desc {
  margin-top: 24px;
  color: var(--text-dim);
  max-width: 560px;
  font-size: 1.05rem;
}

.hero-actions {
  margin-top: 36px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.25s, box-shadow 0.25s;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.25);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(34, 211, 238, 0.4);
}

.btn-ghost {
  border: 1px solid var(--glass-border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.btn-ghost:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.15);
}

.hero-scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 2px solid var(--text-dim);
  border-radius: 14px;
  display: flex;
  justify-content: center;
}

.hero-scroll span {
  width: 4px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  margin-top: 8px;
  animation: scroll-hint 1.6s ease-in-out infinite;
}

@keyframes scroll-hint {
  0%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(10px);
    opacity: 0.3;
  }
}

/* ---------- Sections ---------- */
.section {
  position: relative;
  z-index: 2;
  padding: 100px 24px;
}

.section-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.section-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 48px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.section-index {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
  font-weight: 500;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--glass-border), transparent);
  max-width: 320px;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  align-items: stretch;
}

.about-text,
.about-card {
  padding: 32px;
  border-radius: var(--radius);
}

.about-text p {
  margin-bottom: 16px;
  color: var(--text-dim);
}

.about-text strong {
  color: var(--text);
}

.tag {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.about-card {
  padding: 0;
  overflow: hidden;
}

.about-card-header {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--glass-border);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red {
  background: #f87171;
}
.dot.yellow {
  background: #fbbf24;
}
.dot.green {
  background: #34d399;
}

.terminal-body {
  padding: 20px 24px 24px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.terminal-body p {
  margin-bottom: 8px;
  line-height: 1.6;
}

.prompt {
  color: var(--accent);
  margin-right: 4px;
}

.muted {
  color: var(--text-dim);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skill-category {
  padding: 28px;
  border-radius: var(--radius);
}

.skill-category h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: var(--accent);
}

.skill-bar {
  margin-bottom: 18px;
}

.skill-name,
.skill-percent {
  font-size: 0.9rem;
  display: block;
}

.skill-percent {
  color: var(--text-dim);
  font-family: var(--font-mono);
  float: right;
}

.skill-bar-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 6px;
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--accent-gradient);
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.project-card {
  padding: 24px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: rgba(34, 211, 238, 0.4);
  box-shadow: 0 16px 40px rgba(34, 211, 238, 0.12);
}

.project-thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--thumb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.project-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.project-card p {
  color: var(--text-dim);
  font-size: 0.92rem;
  flex: 1;
  margin-bottom: 16px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.project-tags span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
}

.project-links a {
  color: var(--text-dim);
  font-size: 0.88rem;
  text-decoration: none;
  margin-right: 16px;
  transition: color 0.3s;
}

.project-links a:hover {
  color: var(--accent);
}

/* ---------- Contact ---------- */
.contact-box {
  padding: 48px;
  border-radius: var(--radius);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.contact-box::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle at 30% 30%, rgba(34, 211, 238, 0.15), transparent 50%);
  animation: rotate-glow 12s linear infinite;
}

.contact-box > * {
  position: relative;
}

@keyframes rotate-glow {
  to {
    transform: rotate(360deg);
  }
}

.contact-box h3 {
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.contact-box p {
  color: var(--text-dim);
  margin-bottom: 28px;
}

.social-links {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 28px;
}

.social-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.social-links a:hover {
  color: var(--accent);
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px 24px;
  color: var(--text-dim);
  font-size: 0.88rem;
  border-top: 1px solid var(--glass-border);
}

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal.visible:nth-child(2) {
  transition-delay: 0.1s;
}
.reveal.visible:nth-child(3) {
  transition-delay: 0.2s;
}
.reveal.visible:nth-child(4) {
  transition-delay: 0.3s;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .about-grid,
  .skills-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    transition: none;
    opacity: 1;
    transform: none;
  }

  .hero-scroll span,
  .contact-box::before {
    animation: none;
  }
}
