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

:root {
  --bg: #0b0d14;
  --surface: #14171f;
  --surface-2: #1c202b;
  --border: #252a36;
  --text: #e4e6ee;
  --text-muted: #7b83a0;
  --accent: #6c5ce7;
  --accent-glow: rgba(108,92,231,0.25);
  --green: #00cec9;
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 12px 40px rgba(0,0,0,0.4);
  --hero-glow: var(--accent-glow);
  --noise-opacity: 0.03;
}

[data-theme="light"] {
  --bg: #edeff6;
  --surface: #ffffff;
  --surface-2: #e3e6ef;
  --border: #c9cedc;
  --text: #0b0d14;
  --text-muted: #3d4370;
  --accent: #5a4bd1;
  --accent-glow: rgba(90,75,209,0.15);
  --green: #00897b;
  --shadow: 0 8px 32px rgba(0,0,0,0.08);
  --noise-opacity: 0.01;
  --hero-glow: rgba(90,75,209,0.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Century Gothic', 'Gothic A1', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

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

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Theme Toggle ─── */
.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 20px;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

/* ─── Hero ─── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 120px 0 80px;
}

.hero::after {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--hero-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
  transition: background var(--transition);
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 32px;
  width: fit-content;
  transition: background var(--transition), border var(--transition);
}

.hero__badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero h1 {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 900px;
}

.hero h1 .highlight {
  background: linear-gradient(135deg, var(--accent), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-top: 24px;
  line-height: 1.7;
}

.hero__cta {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #8b7cf7);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition), border var(--transition);
}
.btn--ghost:hover {
  background: var(--surface);
  border-color: var(--text-muted);
}

.hero__stats {
  display: flex;
  gap: 48px;
  margin-top: 64px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  transition: border var(--transition);
}

.stat__number {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.stat__number .accent { color: var(--accent); }
.stat__number .green { color: var(--green); }

.stat__label {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ─── Section ─── */
section { padding: 80px 0; }

.section__header {
  text-align: center;
  margin-bottom: 56px;
}

.section__tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.section__title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section__sub {
  color: var(--text-muted);
  margin-top: 12px;
  font-size: 1.05rem;
}

/* ─── Projects ─── */
.category-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  transition: border var(--transition);
}

.category-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.category-header .count {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 2px 12px;
  border-radius: 100px;
  transition: background var(--transition);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.project-card__img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.project-card__body {
  padding: 20px 24px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.project-card__desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.project-card__tech {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.project-card__tech span {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--surface-2);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  transition: background var(--transition);
}

.project-card--link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}

.project-card--link:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.project-card--link .title {
  font-weight: 600;
  font-size: 1.05rem;
}

.project-card--link .desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ─── Download ─── */
.download-section {
  text-align: center;
  padding: 60px 0 20px;
}

.download-section a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.download-section a:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}

/* ─── Footer ─── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  transition: border var(--transition);
}

footer .github-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
footer .github-link:hover { text-decoration: underline; }

/* ─── Reveal animation ─── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .hero { padding: 100px 0 60px; min-height: auto; }
  .hero__stats { gap: 24px; flex-wrap: wrap; }
  .projects-grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
  .theme-toggle { top: 16px; right: 16px; width: 42px; height: 42px; font-size: 18px; }
}
