:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #1c1b1f;
  --muted: #6b6870;
  --border: #e4e0d8;
  --accent: #ff5a36;
  --accent-soft: #ffe7e0;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}

[data-theme="dark"] {
  --bg: #121114;
  --surface: #1c1b20;
  --text: #f0eef2;
  --muted: #9b97a3;
  --border: #2c2a31;
  --accent: #ff7a5c;
  --accent-soft: #3a2420;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .3s, color .3s;
}

h1, h2, h3, .logo { font-family: "Space Grotesk", sans-serif; }

a { color: inherit; }

/* ---------- NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem clamp(1.25rem, 5vw, 4rem);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.logo { font-size: 1.5rem; font-weight: 700; text-decoration: none; }
.logo span { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a {
  text-decoration: none; font-weight: 500; color: var(--muted);
  position: relative; transition: color .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.theme-toggle {
  background: none; border: 1px solid var(--border); color: var(--text);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.1rem;
}
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: .5rem; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: .3s; }

/* ---------- HERO ---------- */
.hero {
  min-height: calc(100vh - 70px);
  display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 3rem;
  padding: 3rem clamp(1.25rem, 5vw, 4rem);
  max-width: 1200px; margin: 0 auto;
}
.eyebrow { color: var(--muted); font-weight: 500; margin-bottom: .5rem; }
.hero h1 { font-size: clamp(3rem, 8vw, 5.5rem); line-height: 1; letter-spacing: -.03em; }
.role { font-size: 1.35rem; color: var(--accent); font-weight: 600; margin: 1rem 0 1.25rem; }
.bio { color: var(--muted); max-width: 52ch; font-size: 1.05rem; }
.hero-cta { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }

.hero-photo { display: flex; justify-content: center; }
.avatar {
  width: min(320px, 70vw); aspect-ratio: 1;
  border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%;
  background: linear-gradient(135deg, var(--accent), #ffb347);
  display: grid; place-items: center;
  font-family: "Space Grotesk", sans-serif; font-size: 5rem; font-weight: 700; color: #fff;
  box-shadow: var(--shadow);
  animation: blob 10s ease-in-out infinite;
  background-size: cover; background-position: center;
}
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes blob {
  50% { border-radius: 58% 42% 45% 55% / 52% 58% 42% 48%; }
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-block; padding: .85rem 1.6rem; border-radius: 999px;
  font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: transform .15s, background .2s, color .2s;
  font-family: inherit;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { border-color: var(--text); color: var(--text); }
.btn-ghost:hover { background: var(--text); color: var(--bg); }

/* ---------- SECTIONS ---------- */
.section {
  max-width: 1200px; margin: 0 auto;
  padding: 5rem clamp(1.25rem, 5vw, 4rem);
}
.section-title {
  font-size: clamp(2rem, 4vw, 2.75rem); margin-bottom: 2.5rem;
  display: flex; align-items: baseline; gap: 1rem;
}
.section-title span { font-size: 1rem; color: var(--accent); font-weight: 500; }

/* ---------- LINKS ---------- */
.links-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem;
}
.link-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.1rem 1.25rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; transition: transform .2s, border-color .2s, box-shadow .2s;
}
.link-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.link-icon {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px;
  display: grid; place-items: center; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.link-card strong { display: block; }
.link-card small { color: var(--muted); }
.link-card .arrow { margin-left: auto; color: var(--muted); transition: transform .2s; }
.link-card:hover .arrow { transform: translate(3px, -3px); color: var(--accent); }

/* ---------- PROJECTS ---------- */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 2rem; }
.filter {
  padding: .5rem 1.1rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-family: inherit; font-weight: 500; transition: .2s;
}
.filter:hover { color: var(--text); }
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem;
}
.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform .25s, box-shadow .25s;
}
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.project-card.hidden { display: none; }
.project-thumb {
  height: 170px; display: grid; place-items: center; font-size: 3.5rem;
  background: linear-gradient(135deg, hsl(var(--hue) 85% 70%), hsl(calc(var(--hue) + 40) 85% 60%));
}
.project-body { padding: 1.4rem; }
.project-body h3 { font-size: 1.25rem; margin-bottom: .4rem; }
.project-body p { color: var(--muted); font-size: .95rem; }
.tags { list-style: none; display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0; }
.tags li {
  font-size: .78rem; padding: .2rem .65rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.project-links { display: flex; gap: 1.2rem; }
.project-links a { font-weight: 600; text-decoration: none; font-size: .95rem; }
.project-links a:hover { color: var(--accent); }

/* ---------- CONTACT ---------- */
.contact-wrap { display: grid; grid-template-columns: 1fr 1.4fr; gap: 3rem; align-items: start; }
.contact-info p { color: var(--muted); font-size: 1.05rem; }
.contact-email { margin-top: 1.5rem; font-weight: 600; }
.contact-email a { color: var(--accent); }

.contact-form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow);
}
.field { margin-bottom: 1.2rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.field input, .field textarea {
  width: 100%; padding: .8rem 1rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px;
  transition: border-color .2s, box-shadow .2s; resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.field.invalid input, .field.invalid textarea { border-color: #e53935; }
.error { color: #e53935; font-size: .82rem; min-height: 1em; display: block; margin-top: .25rem; }
.contact-form .btn { width: 100%; }
.contact-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-status { margin-top: 1rem; text-align: center; font-weight: 500; }
.form-status.success { color: #2e9d5b; }
.form-status.fail { color: #e53935; }

/* ---------- FOOTER ---------- */
.footer { text-align: center; padding: 2rem; color: var(--muted); border-top: 1px solid var(--border); font-size: .9rem; }

/* ---------- REVEAL ANIMATION ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s, transform .6s; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 800px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 1.25rem; padding: 1.5rem;
    background: var(--bg); border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .hero { grid-template-columns: 1fr; text-align: center; min-height: auto; padding-top: 2rem; }
  .hero-photo { order: -1; }
  .avatar { width: 200px; font-size: 3.5rem; }
  .bio { margin: 0 auto; }
  .hero-cta { justify-content: center; }
  .contact-wrap { grid-template-columns: 1fr; }
}

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