/* ---------- Variables & Theme ---------- */
:root {
  --bg: #0f1117;
  --bg-alt: #161922;
  --surface: #1c2030;
  --text: #e6e8ee;
  --text-muted: #9aa3b2;
  --primary: #6c8cff;
  --primary-strong: #5570f0;
  --accent: #64ffda;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --maxw: 1080px;
}

[data-theme="light"] {
  --bg: #f7f8fc;
  --bg-alt: #eef1f8;
  --surface: #ffffff;
  --text: #1a1d27;
  --text-muted: #5b6373;
  --primary: #4361ee;
  --primary-strong: #2f49d0;
  --accent: #0d9488;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

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

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

a { color: var(--primary); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-size: 1.4rem; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.logo-dot { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 1.6rem; list-style: none; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); }

.theme-toggle, .nav-toggle {
  background: none; border: none; cursor: pointer; color: var(--text);
  font-size: 1.1rem;
}
.nav-toggle { display: none; flex-direction: column; gap: 5px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.3s; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 0.8rem 1.6rem; border-radius: 10px;
  font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: all 0.2s ease;
  border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-strong); color: #fff; transform: translateY(-2px); }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.btn-large { padding: 1rem 2.2rem; font-size: 1.05rem; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 7rem 0 5rem; overflow: hidden; }
.hero-inner { max-width: 760px; }
.hero-eyebrow { color: var(--accent); font-weight: 600; letter-spacing: 1px; margin-bottom: 0.6rem; }
.hero-title {
  font-size: clamp(2.8rem, 8vw, 5rem); font-weight: 800; letter-spacing: -2px;
  line-height: 1.05;
}
.hero-subtitle {
  font-size: clamp(1.3rem, 4vw, 2rem); font-weight: 700; color: var(--text-muted);
  margin: 0.4rem 0 1.4rem;
}
.hero-text { font-size: 1.1rem; color: var(--text-muted); max-width: 580px; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-glow {
  position: absolute; top: -20%; right: -10%; width: 600px; height: 600px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 65%);
  opacity: 0.18; filter: blur(40px); pointer-events: none; z-index: -1;
}

/* ---------- Sections ---------- */
.section { padding: 5rem 0; }
.section-alt { background: var(--bg-alt); }
.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700; margin-bottom: 2.2rem;
  letter-spacing: -0.5px;
}
.section-num { color: var(--accent); font-weight: 600; font-size: 0.7em; margin-right: 0.4rem; }
.section-lead, .contact-lead { color: var(--text-muted); margin-bottom: 2rem; max-width: 620px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 3rem; }
.about-text p { margin-bottom: 1.1rem; color: var(--text-muted); }
.about-text p:first-child { color: var(--text); }
.about-skills h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.skill-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.skill-tags li {
  background: var(--surface); border: 1px solid var(--border);
  padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.85rem; color: var(--text-muted);
}

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.4rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.8rem; transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: var(--primary); }
.card-icon { font-size: 2rem; margin-bottom: 0.8rem; }
.card h3 { margin-bottom: 0.6rem; font-size: 1.15rem; }
.card p { color: var(--text-muted); font-size: 0.95rem; }

/* ---------- Projects ---------- */
#projects .cards { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { #projects .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { #projects .cards { grid-template-columns: 1fr; } }
.project-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.project-folder { font-size: 1.8rem; }
.project-links { display: flex; gap: 0.9rem; }
.project-links a { color: var(--text-muted); font-weight: 600; }
.project-links a:hover { color: var(--accent); }
.project-badge {
  font-size: 0.72rem; color: var(--text-muted); border: 1px solid var(--border);
  padding: 0.2rem 0.6rem; border-radius: 999px; white-space: nowrap;
}
.project-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.project-tags li { font-size: 0.78rem; color: var(--accent); font-family: monospace; }

/* ---------- Bonus / 3D game ---------- */
.game-levels { display: flex; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.game-level {
  padding: 0.5rem 1.2rem; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-size: 0.92rem; font-family: inherit;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); transition: all 0.2s ease;
}
.game-level:hover { border-color: var(--primary); color: var(--primary); }
.game-level.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.scene-wrap { position: relative; }
.scene {
  width: 100%; height: clamp(340px, 60vh, 560px);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  background: radial-gradient(circle at 50% 30%, #2a3344 0%, #161b26 80%);
  cursor: crosshair; touch-action: none;
}
.scene canvas { display: block; width: 100% !important; height: 100% !important; }
.scene-hint {
  position: absolute; bottom: 0.9rem; left: 50%; transform: translateX(-50%);
  margin: 0; padding: 0.4rem 0.9rem; border-radius: 999px;
  font-size: 0.82rem; color: #fff; background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px); pointer-events: none; white-space: nowrap; max-width: 92%;
}
.scene-fallback {
  margin-top: 1rem; color: var(--text-muted); font-size: 0.95rem;
}
.game-status {
  position: absolute; top: 0.8rem; left: 0.9rem; display: flex; gap: 0.8rem;
  font-size: 0.85rem; font-weight: 600; color: #fff; pointer-events: none;
}
.game-status span {
  padding: 0.3rem 0.7rem; border-radius: 999px;
  background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px);
}
.game-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.8rem; text-align: center;
  background: rgba(12, 15, 23, 0.72); backdrop-filter: blur(6px);
  border-radius: var(--radius);
}
.game-overlay-title { font-size: 1.8rem; font-weight: 800; color: #fff; margin: 0; }
.game-overlay-sub { color: #cfd6e4; margin: 0; }
.game-restart { margin-top: 0.4rem; }

@media (max-width: 600px) {
  .scene-hint { font-size: 0.72rem; }
  .game-status { font-size: 0.75rem; }
}

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact-lead { margin-left: auto; margin-right: auto; }
.socials { display: flex; justify-content: center; gap: 1.8rem; margin-top: 2rem; }
.socials a { color: var(--text-muted); font-weight: 500; }
.socials a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 2.5rem 0; text-align: center; }
.site-footer p { color: var(--text-muted); font-size: 0.9rem; }
.footer-note { margin-top: 0.4rem; font-size: 0.8rem; }

/* ---------- Reveal animation ---------- */
.section, .hero-inner { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.section.visible, .hero-inner.visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 1rem;
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: 1.4rem 1.5rem; transform: translateY(-150%); transition: transform 0.3s ease;
  }
  .nav-links.open { transform: translateY(0); }
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
  .section, .hero-inner { opacity: 1; transform: none; }
}
