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

/* ── Variables ── */
:root {
  --bg: #f9f8f6;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.1);
  --border-hover: rgba(0,0,0,0.2);
  --text: #1a1a18;
  --text-secondary: #6b6b67;
  --tag-bg: #f0efe9;
  --radius: 10px;
  --radius-lg: 14px;
}

body.dark {
  --bg: #111110;
  --surface: #1c1c1a;
  --border: rgba(255,255,255,0.1);
  --border-hover: rgba(255,255,255,0.22);
  --text: #e8e8e2;
  --text-secondary: #888882;
  --tag-bg: #252523;
}

/* ── Base ── */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Nav ── */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.nav-logo {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

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

.nav-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ── Theme Toggle ── */
.theme-toggle {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.theme-toggle:hover {
  border-color: var(--border-hover);
}

/* ── Hero ── */
.hero {
  margin-bottom: 4rem;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.5s ease forwards;
}

.hero-label {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 500;
  line-height: 1.25;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 24px;
}

.hero-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  display: inline-block;
}

.btn:hover {
  border-color: var(--border-hover);
  background: var(--surface);
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn-primary:hover {
  opacity: 0.85;
  background: var(--text);
}

.btn-icon {
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon img {
  filter: invert(0);
  transition: opacity 0.15s;
}

body.dark .btn-icon img {
  filter: invert(1);
}

/* ── Sections ── */
section {
  margin-bottom: 3.5rem;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.5s ease forwards;
}

section:nth-of-type(1) { animation-delay: 0.1s; }
section:nth-of-type(2) { animation-delay: 0.2s; }
section:nth-of-type(3) { animation-delay: 0.3s; }

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* ── Projects ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, transform 0.15s;
}

.project-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.project-title {
  font-size: 14px;
  font-weight: 500;
}

.project-arrow {
  font-size: 14px;
  color: var(--text-secondary);
  transition: transform 0.15s;
}

.project-card:hover .project-arrow {
  transform: translate(2px, -2px);
}

.project-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--tag-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.tag-python     { color: #7eb8f7; }
.tag-javascript { color: #f0c429; }
.tag-html       { color: #f07840; }
.tag-css        { color: #7b8ff5; }
.tag-opencv     { color: #4ecb8d; }
.tag-mediapipe  { color: #b57cf5; }

/* ── Skills ── */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-pill {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface);
}

/* ── Contact ── */
.contact-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.contact-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s;
}

.contact-link:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

/* ── Footer ── */
footer {
  padding: 2rem 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ── Animation ── */
@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Mobile ── */
@media (max-width: 520px) {
  .nav-links { gap: 1rem; }
  .projects-grid { grid-template-columns: 1fr; }
}