@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

/* ── DARK (default) ── */
:root {
  --bg:      #0d1117;
  --bg2:     #151c28;
  --bg3:     #1c2536;
  --border:  rgba(147,197,253,0.1);
  --border2: rgba(147,197,253,0.22);
  --text:    #e8f0ff;
  --muted:   #8fa3c8;
  --accent:  #93c5fd;
  --accent2: #f9a8d4;
  --mono: 'JetBrains Mono', 'Fira Mono', 'Courier New', monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── LIGHT ── */
[data-theme="light"] {
  --bg:      #f0f5ff;
  --bg2:     #ddeaff;
  --bg3:     #c6d8ff;
  --border:  rgba(59,130,246,0.28);
  --border2: rgba(59,130,246,0.5);
  --text:    #0d1f38;
  --muted:   #2e4a6e;
  --accent:  #1d4ed8;
  --accent2: #be185d;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease, opacity 0.25s ease;
}

body.leaving {
  opacity: 0;
  pointer-events: none;
}

/* NAV */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  height: 68px;
}

.nav-logo {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s, transform 0.2s, text-shadow 0.2s;
  display: inline-block;
}

.nav-links a:hover,
.nav-links a.active { color: var(--text); }

.nav-links a:hover {
  transform: scale(1.1);
  text-shadow: 0 0 12px rgba(232, 234, 240, 0.5);
}


/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 22px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.btn-primary { background: var(--accent); color: var(--bg); font-weight: 700; }
.btn-primary:hover { opacity: 0.88; transform: scale(1.06); box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { border-color: var(--muted); transform: scale(1.06); box-shadow: 0 0 22px rgba(255, 255, 255, 0.08); }

/* CONTENT PAGES */
.page-content {
  max-width: 860px;
  margin: 0 auto;
  padding: calc(68px + 4rem) 2rem 5rem;
  animation: page-enter 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
  animation-delay: 0.05s;
}

.section-label {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

h2 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 1.2rem; color: var(--text); }
p { color: var(--muted); line-height: 1.85; margin-bottom: 1rem; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--bg3); border: 1px solid var(--border); color: var(--muted); font-family: var(--sans); font-size: 13px; padding: 4px 12px; border-radius: 3px; }

.divider { border: none; border-top: 1px solid var(--border); margin: 3.5rem 0; }

footer { text-align: center; padding: 2rem; font-family: var(--mono); font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); letter-spacing: 0.06em; }

/* ABOUT */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; margin-bottom: 3rem; }

.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.stat { background: var(--bg2); padding: 1.2rem; }
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--accent); font-family: var(--mono); letter-spacing: -0.03em; line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* SKILLS */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.skill-group { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 1.2rem; }
.skill-group-title { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--accent2); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.75rem; }

/* TERMINAL */
.terminal {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 1.25rem 1.5rem; font-family: var(--sans); font-size: 13px; margin-top: 3rem; max-width: 520px;
}
.terminal-bar { display: flex; gap: 6px; margin-bottom: 1rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }
.terminal-line { color: var(--muted); }
.terminal-line .prompt { color: var(--accent); }
.terminal-line .cmd { color: var(--text); }
.terminal-line .out { color: var(--accent2); }
.terminal-line.gap { margin-top: 0.5rem; }

/* PROJECTS */
.project-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.project-card { background: var(--bg2); padding: 1.5rem 1.75rem; display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start; transition: background 0.15s; text-decoration: none; }
.project-card:hover { background: var(--bg3); }
.project-name { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.project-desc { font-size: 15px; color: var(--muted); margin: 0; line-height: 1.65; }
.project-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.lang-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.project-lang { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.project-arrow { color: var(--border2); font-size: 18px; transition: color 0.15s, transform 0.15s; }
.project-card:hover .project-arrow { color: var(--accent); transform: translateX(3px); }

/* CONTACT */
.contact-inner { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 2.5rem; text-align: center; }
.contact-inner h2 { margin-bottom: 0.5rem; }
.contact-inner p { max-width: 420px; margin: 0 auto 2rem; }
.contact-links { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.contact-link { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); text-decoration: none; border: 1px solid var(--border); padding: 9px 18px; border-radius: 4px; letter-spacing: 0.06em; text-transform: uppercase; transition: all 0.2s; }
.contact-link:hover { color: var(--text); border-color: var(--border2); }

/* HAMBURGER */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 101;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.25s ease;
}

.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* MOBILE MENU */
.mobile-menu {
  position: fixed;
  top: 68px;
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-menu.open {
  opacity: 1;
  pointer-events: all;
}

.mobile-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  transform: translateY(-34px);
}

.mobile-links a {
  font-family: var(--sans);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s;
}

.mobile-links a:hover { color: var(--text); }

/* THEME TOGGLE */
.nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

.theme-switch {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 14px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.theme-switch:hover { border-color: var(--accent); }

.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.theme-switch-thumb svg { width: 11px; height: 11px; display: block; }

[data-theme="light"] .theme-switch-thumb { transform: translateX(24px); }

@media (max-width: 640px) {
  nav { padding: 0 1rem; display: flex; justify-content: space-between; align-items: center; }
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .about-grid { grid-template-columns: 1fr; }
}

/* ── BACK TO TOP ── */
.back-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  z-index: 40;
  pointer-events: none;
}
.back-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-top:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 25%, transparent);
}
.back-top svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* CUSTOM CURSOR */
@media (pointer: fine) {
  * { cursor: none !important; }

  .cursor-cat {
    position: fixed;
    width: 28px;
    height: 28px;
    pointer-events: none;
    z-index: 9999;
    transform-origin: top left;
    transition: transform 0.1s;
  }

  .cursor-cat img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  .cursor-cat.expanded {
    transform: scale(1.25);
  }
}

/* PAGE TRANSITIONS */
@keyframes page-enter {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
