:root {
  --bg: #0a0a0f;
  --bg-soft: #12121a;
  --text: #e9eef7;
  --muted: #9ea7b8;
  --accent: #00b7ff;
  --accent-soft: rgba(0, 183, 255, 0.2);
  --border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #111329 0%, var(--bg) 50%);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

#main-content {
  opacity: 1;
  transition: opacity 0.4s ease;
}

body.intro-active #main-content {
  opacity: 0;
  pointer-events: none;
}

#intro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0a0a0f;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#intro-overlay.hidden {
  opacity: 0;
  transform: translateY(-40px);
  pointer-events: none;
}

#intro-terminal {
  width: min(600px, 90vw);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(0.85rem, 2vw, 1rem);
  line-height: 2;
}

#intro-lines {
  min-height: 180px;
}

.intro-line {
  color: #00d4ff;
  opacity: 0;
  animation: introLineReveal 0.3s ease forwards;
}

.intro-line.welcome {
  color: #00ff88;
}

#intro-cursor {
  color: #00d4ff;
  animation: blink 0.8s infinite;
}

.intro-progress-shell {
  display: inline-block;
  width: 12ch;
  border: 1px solid rgba(0, 212, 255, 0.45);
  vertical-align: middle;
  margin: 0 4px;
}

.intro-progress-fill {
  display: block;
  width: 0;
  white-space: nowrap;
  overflow: hidden;
  animation: introProgressFill 0.8s ease forwards;
}

#matrix-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  opacity: 0.24;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(10, 10, 15, 0.68);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
}

.brand,
h1,
h2,
h3,
.terminal-line,
.tagline {
  font-family: "JetBrains Mono", monospace;
}

.brand {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
}

.nav-links a:hover {
  color: var(--text);
}

.section {
  padding: 84px 0;
}

.hero {
  min-height: 80vh;
  display: grid;
  align-items: center;
}

.terminal-line {
  color: #4dd17f;
}

h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  margin: 8px 0 16px;
}

.tagline {
  color: var(--muted);
  font-size: clamp(1rem, 2.6vw, 1.4rem);
  min-height: 2.2rem;
}

.caret {
  color: var(--accent);
  animation: blink 0.85s infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes introLineReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes introProgressFill {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.cta-row {
  margin-top: 28px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.02);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-soft);
}

.btn.primary {
  background: linear-gradient(120deg, rgba(0, 183, 255, 0.25), rgba(0, 183, 255, 0.08));
  border-color: rgba(0, 183, 255, 0.6);
}

h2 {
  margin-top: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  font-size: 0.8rem;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

.skill-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  position: relative;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  overflow: hidden;
  animation: chipPulse 3.4s ease-in-out infinite;
}

.chip::after {
  content: "";
  position: absolute;
  top: 0;
  left: -130%;
  width: 80%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  animation: shimmer 3.4s infinite;
}

@keyframes chipPulse {
  50% {
    box-shadow: 0 0 10px rgba(0, 183, 255, 0.2);
  }
}

@keyframes shimmer {
  60%,
  100% {
    left: 140%;
  }
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stats-card {
  position: relative;
  border: 1px solid rgba(0, 183, 255, 0.35);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  box-shadow: 0 0 16px rgba(0, 183, 255, 0.12);
  transition: transform 0.22s, box-shadow 0.22s;
  overflow: hidden;
}

.stats-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 24px rgba(0, 183, 255, 0.16);
}

.stats-card::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.85), transparent);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.55);
  animation: statsGlowPulse 2.6s ease-in-out infinite;
}

.stats-icon {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 8px;
}

.stats-number {
  margin: 0;
  color: #00d4ff;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(1.15rem, 3.2vw, 1.8rem);
  font-weight: 700;
}

.stats-label {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: clamp(0.72rem, 2vw, 0.92rem);
}

@keyframes statsGlowPulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scaleX(0.92);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
}

.terminal-widget {
  border: 1px solid rgba(0, 183, 255, 0.5);
  border-radius: 14px;
  box-shadow: 0 0 20px rgba(0, 183, 255, 0.14);
  overflow: hidden;
  font-family: "JetBrains Mono", monospace;
}

.terminal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 13, 13, 0.95);
}

.terminal-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.dot.red {
  background: #ff5f57;
}

.dot.yellow {
  background: #febc2e;
}

.dot.green {
  background: #28c840;
}

.terminal-title {
  margin: 0;
  color: #a0a0a0;
  font-size: 0.82rem;
}

.terminal-output {
  background: #0d0d0d;
  color: #a0a0a0;
  max-height: 300px;
  overflow-y: auto;
  padding: 14px 12px 6px;
}

.term-block {
  margin-bottom: 10px;
}

.term-command {
  color: #00d4ff;
}

.term-output {
  margin-top: 4px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.term-output.success {
  color: #00ff88;
}

.term-output.info {
  color: #a0a0a0;
}

.term-output.error {
  color: #ff6b6b;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: #0d0d0d;
  padding: 10px 12px;
}

.prompt {
  color: #00d4ff;
}

.terminal-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  color: #e9eef7;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
}

.terminal-blink {
  color: #00d4ff;
  animation: blink 0.9s infinite;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
  transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 183, 255, 0.45);
  box-shadow: 0 10px 24px rgba(0, 183, 255, 0.16);
}

.stack {
  color: var(--muted);
  font-size: 0.9rem;
}

.project-links {
  display: flex;
  gap: 12px;
}

.project-links a {
  color: var(--accent);
  text-decoration: none;
}

.project-links a[aria-disabled="true"] {
  color: #6f7786;
  pointer-events: none;
}

a {
  color: var(--accent);
}

.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.cursor-trail {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 183, 255, 0.7);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 30;
  mix-blend-mode: screen;
}

.konami-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(0, 183, 255, 0.5);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: "JetBrains Mono", monospace;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.konami-toast.show {
  opacity: 1;
}

body.rgb-boost {
  animation: hueShift 1.8s linear infinite;
}

@keyframes hueShift {
  from {
    filter: hue-rotate(0deg);
  }
  to {
    filter: hue-rotate(360deg);
  }
}

@media (max-width: 800px) {
  .skill-groups,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .nav-links {
    font-size: 0.88rem;
  }

  .cursor-trail {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stats-card {
    padding: 10px 6px;
  }

  .terminal-input-row {
    padding: 12px 10px;
  }

  .terminal-input {
    font-size: 16px;
  }
}

@media (max-width: 560px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-card:last-child {
    grid-column: span 2;
  }
}
