:root {
  --bg: #0b0f14;
  --bg-elev: #121821;
  --border: #1f2937;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="light"] {
  --bg: #f6f8fa;
  --bg-elev: #ffffff;
  --border: #d8dee4;
  --text: #1f2328;
  --muted: #59636e;
  --accent: #0891b2;
  --accent-2: #7c3aed;
  --shadow: 0 10px 30px rgba(31, 35, 40, .08);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  transition: background .3s, color .3s;
}

a { color: inherit; }

/* Subtle animated grid background */
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  opacity: .5;
}
.bg-grid::after {
  content: ""; position: absolute; left: 50%; top: -200px; width: 700px; height: 500px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 25%, transparent), transparent);
  filter: blur(40px);
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 72px 16px 32px;
}

/* Theme toggle */
.theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 10;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text);
  cursor: pointer; display: grid; place-items: center; font-size: 16px;
  box-shadow: var(--shadow); transition: transform .2s;
}
.theme-toggle:hover { transform: rotate(20deg); }
[data-theme="dark"] .icon-dark, [data-theme="light"] .icon-light { display: none; }

/* Profile */
.profile { text-align: center; }
.avatar-wrap { position: relative; width: 128px; height: 128px; margin: 0 auto 18px; }
.avatar {
  width: 128px; height: 128px; border-radius: 50%; object-fit: cover;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.avatar-fallback {
  display: grid; place-items: center;
  font: 700 40px/1 var(--mono); color: #fff;
}
.status-dot {
  position: absolute; right: 10px; bottom: 10px; width: 18px; height: 18px;
  border-radius: 50%; background: #22c55e; border: 3px solid var(--bg);
}
h1 {
  margin: 0; font-size: clamp(1.6rem, 5vw, 2.1rem); font-weight: 700; letter-spacing: -.02em;
}
.role { margin: 6px 0 22px; color: var(--muted); font-weight: 500; }
.role .sep { color: var(--accent); margin: 0 4px; }

/* Terminal bio */
.terminal {
  text-align: left; max-width: 520px; margin: 0 auto;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.terminal-bar { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.terminal-bar span { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.terminal-bar span:nth-child(2) { background: #febc2e; }
.terminal-bar span:nth-child(3) { background: #28c840; }
.terminal pre {
  margin: 0; padding: 14px 16px; font: 14px/1.6 var(--mono);
  white-space: pre-wrap; word-break: break-word; min-height: 5.6em;
}
.prompt { color: var(--accent); margin-right: 6px; }
.out { color: var(--muted); }
.cursor { color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.tags {
  list-style: none; padding: 0; margin: 20px 0 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.tags li {
  font: 12px var(--mono); padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--bg-elev);
}

/* Links */
.links { display: grid; gap: 12px; margin-top: 40px; }
.link {
  --brand: var(--accent);
  display: grid; grid-template-columns: 28px 1fr auto 16px; align-items: center; gap: 14px;
  padding: 16px 18px; text-decoration: none;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
}
.link > i:first-child { font-size: 22px; color: var(--brand); text-align: center; }
.link span { font-weight: 600; }
.link small { color: var(--muted); font-size: 13px; }
.link .ext { font-size: 12px; color: var(--muted); opacity: 0; transition: opacity .18s; }
.link:hover, .link:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 60%, var(--border));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 18%, transparent);
  outline: none;
}
.link:hover .ext, .link:focus-visible .ext { opacity: 1; }
[data-theme="light"] .link[style*="#e7e9ea"] { --brand: #000 !important; }

@media (max-width: 420px) {
  .link { grid-template-columns: 26px 1fr 16px; }
  .link small { display: none; }
}

/* Projects */
.projects { margin-top: 48px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 1.1rem; }
.section-head h2 i { color: var(--accent); margin-right: 6px; }
.section-head a { color: var(--muted); font-size: 14px; text-decoration: none; }
.section-head a:hover { color: var(--accent); }

.repo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.repo {
  display: flex; flex-direction: column; gap: 8px; min-height: 120px;
  padding: 16px; text-decoration: none;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .18s, border-color .18s;
}
a.repo:hover { transform: translateY(-2px); border-color: var(--accent); }
.repo-name { font: 600 14px var(--mono); color: var(--accent); overflow-wrap: anywhere; }
.repo-desc { color: var(--muted); font-size: 14px; flex: 1; }
.repo-meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.lang-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.repo-empty { color: var(--muted); font-size: 14px; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-elev) 25%, var(--border) 50%, var(--bg-elev) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Footer */
.footer { margin-top: 56px; text-align: center; color: var(--muted); font-size: 13px; }

/* Reveal on load */
.reveal { opacity: 0; transform: translateY(12px); animation: reveal .6s ease forwards; }
.links.reveal { animation-delay: .12s; }
.projects.reveal { animation-delay: .24s; }
@keyframes reveal { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
