/* ---------- Tokens ---------- */
:root,
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f6f6f4;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-soft: #5c5c5c;
  --line: #e6e6e2;
  --accent: #2f6df0;
  --accent-soft: #eaf0fe;
  --nav-bg: rgba(255, 255, 255, 0.8);
  --shadow: rgba(0, 0, 0, 0.07);
  --thumb: linear-gradient(135deg, #e9edf7, #f3f0fb);
  --radius: 14px;
  --maxw: 1080px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --bg-alt: #151a21;
  --card: #171c24;
  --text: #f2f4f8;
  --text-soft: #a3acba;
  --line: #29313c;
  --accent: #5b8cff;
  --accent-soft: #1c2738;
  --nav-bg: rgba(14, 17, 22, 0.8);
  --shadow: rgba(0, 0, 0, 0.4);
  --thumb: linear-gradient(135deg, #1c2433, #241f33);
}

:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
h1, h2, h3 { font-family: "Space Grotesk", "Inter", sans-serif; line-height: 1.1; margin: 0; }
p { margin: 0 0 1rem; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(47,109,240,0.25); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(47,109,240,0.35); }
.btn--ghost { border: 1px solid var(--line); color: var(--text); }
.btn--ghost:hover { background: var(--bg-alt); transform: translateY(-2px); }

.link {
  font-weight: 500;
  color: var(--accent);
  position: relative;
  transition: opacity 0.2s var(--ease);
}
.link:hover { opacity: 0.7; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.nav.is-scrolled { border-color: var(--line); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.nav__logo { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }
.nav__logo span { color: var(--accent); }
.nav__links { display: flex; gap: 2rem; }
.nav__links a { font-weight: 500; font-size: 0.95rem; color: var(--text-soft); transition: color 0.2s var(--ease); }
.nav__links a:hover { color: var(--text); }

.nav__actions { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-alt);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--accent); }
.theme-toggle__moon { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__moon { display: inline; }

.nav__toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav__toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.3s var(--ease), opacity 0.3s var(--ease); }

/* ---------- Hero ---------- */
.hero { padding: clamp(4rem, 12vw, 9rem) 0 clamp(3rem, 8vw, 6rem); }
.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.2rem;
}
.hero__title { font-size: clamp(2.4rem, 6vw, 4.4rem); letter-spacing: -0.03em; margin-bottom: 1.5rem; }
.hero__lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--text-soft); max-width: 540px; margin-bottom: 2.2rem; }
.hero__actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- Sections ---------- */
.section { padding: clamp(3.5rem, 9vw, 7rem) 0; }
.section--alt { background: var(--bg-alt); }
.section__label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.8rem;
}
.section__title { font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: -0.02em; }
.section__head { margin-bottom: 3rem; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 3rem; }
.about__intro .section__title { max-width: 14ch; }
.about__body p { color: var(--text-soft); font-size: 1.05rem; }
.about__body em { color: var(--text); font-style: italic; }
.about__now {
  margin-top: 1.2rem;
  padding: 0.6rem 0 0.6rem 1rem;
  border-left: 2px solid var(--accent);
  color: var(--text-soft);
  font-size: 0.98rem;
}
.about__now strong { color: var(--text); }

.skills { margin-top: 2rem; }
.skills__heading { font-size: 1rem; margin-bottom: 1rem; }
.skills__grid { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.skills__grid li {
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
}
.section--alt .skills__grid li { background: var(--card); }

/* ---------- Projects ---------- */
.projects { display: grid; gap: 2.5rem; }
.project {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.project:hover { transform: translateY(-4px); box-shadow: 0 18px 40px var(--shadow); }
.project:nth-child(even) .project__thumb { order: 2; }

.project__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  background: var(--thumb);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.project__thumb img { width: 100%; height: 100%; object-fit: cover; }
.project__thumb[data-placeholder]::after {
  content: attr(data-placeholder);
  color: #9aa3b2;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}
.project__thumb:has(img)::after { content: none; }

.project__meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
}
.project__title { font-size: 1.5rem; margin-bottom: 0.7rem; }
.project__desc { color: var(--text-soft); margin-bottom: 1.2rem; }
.project__links { display: flex; gap: 1.4rem; flex-wrap: wrap; }

/* ---------- Contact ---------- */
.contact { text-align: center; max-width: 640px; }
.contact__lead { color: var(--text-soft); font-size: 1.1rem; margin: 0.5rem 0 2rem; }
.contact__email {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 600;
  color: var(--accent);
  border-bottom: 2px solid transparent;
  transition: border-color 0.25s var(--ease);
}
.contact__email:hover { border-color: var(--accent); }
.contact__socials { display: flex; gap: 1.6rem; justify-content: center; margin-top: 2rem; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 2rem 0; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; color: var(--text-soft); font-size: 0.9rem; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .about { grid-template-columns: 1fr; gap: 1.5rem; }
  .project, .project:nth-child(even) .project__thumb { grid-template-columns: 1fr; order: 0; }
  .project__thumb { order: -1; }

  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: 68px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 24px 1rem;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
  }
  .nav__links.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__links li { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
  .nav__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav__toggle.is-open span:nth-child(2) { opacity: 0; }
  .nav__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

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