/* ---------- Tokens ---------- */
:root {
  --bg: #0b1020;
  --bg-raised: #121935;
  --text: #e8ebf5;
  --muted: #a3afcc;
  --accent: #8ea2ff;
  --accent-ink: #0b1020;
  --line: rgba(255, 255, 255, 0.12);
  --font-head: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 68px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-raised: #ffffff;
  --text: #151a2e;
  --muted: #4d5877;
  --accent: #3347d1;
  --accent-ink: #ffffff;
  --line: rgba(21, 26, 46, 0.14);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
ul { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -0.01em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1100px, 100% - 48px); margin-inline: auto; }

.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 3000;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; z-index: 2000;
  height: 3px; width: 100%;
  background: var(--accent);
  transform: scaleX(0); transform-origin: left;
}

.navbar {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding-inline: max(24px, calc((100% - 1100px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
.navbar.scrolled { border-bottom-color: var(--line); }

.logo {
  font-family: var(--font-head); font-weight: 700; font-size: 1.25rem;
  text-decoration: none; margin-right: auto;
}

.nav-menu ul { display: flex; gap: 28px; }
.nav-menu a {
  text-decoration: none; font-size: 0.97rem; font-weight: 500; color: var(--muted);
  padding: 6px 0; border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.nav-menu a:hover, .nav-menu a.active { color: var(--text); }
.nav-menu a.active { border-bottom-color: var(--accent); }

.nav-tools { display: flex; align-items: center; gap: 8px; }

.theme-toggle, .menu-toggle {
  width: 42px; height: 42px; border-radius: 10px;
  background: none; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 0.2s ease;
}
.theme-toggle:hover, .menu-toggle:hover { border-color: var(--accent); }

.menu-toggle { display: none; flex-direction: column; gap: 5px; }
.menu-toggle span {
  width: 18px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  padding-top: calc(var(--nav-h) + 40px); padding-bottom: 64px;
  display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 56px;
}

.hero-role { color: var(--accent); font-weight: 600; margin-bottom: 14px; }

.hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 4.9rem);
  font-weight: 700; margin-bottom: 20px;
}

.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.2s ease-in-out 1s 2; }
@keyframes wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(18deg); } 75% { transform: rotate(-14deg); } }

.hero-subtitle { max-width: 34ch; font-size: 1.25rem; color: var(--muted); margin-bottom: 36px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 28px; border-radius: 10px;
  font-weight: 600; font-size: 1rem; text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover { transform: translateY(-2px); }
.button-ghost { border-color: var(--line); }
.button-ghost:hover { border-color: var(--accent); }

.hero-image { justify-self: center; position: relative; width: min(100%, 340px); aspect-ratio: 1; }
.hero-image::before {
  content: ''; position: absolute; inset: 0;
  border: 2px solid var(--accent); border-radius: 24px;
  transform: translate(14px, 14px);
}
.hero-image img {
  position: relative; width: 100%; height: 100%;
  object-fit: cover; border-radius: 24px; background: var(--bg-raised);
}

/* One page-load moment: the hero rises in once */
.js .hero-copy, .js .hero-image { animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.js .hero-image { animation-delay: 0.15s; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* ---------- Sections: heading left, content right ---------- */
.section {
  display: grid; grid-template-columns: 220px 1fr; gap: 48px;
  padding-block: 80px; border-top: 1px solid var(--line);
}
.section h2 { font-size: 1.7rem; position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; }
.section-body { max-width: 720px; }
.section-body > p { color: var(--muted); margin-bottom: 20px; }
.section-body h3 { font-size: 1.15rem; margin: 40px 0 14px; }

.facts { display: flex; flex-wrap: wrap; gap: 36px; margin-top: 32px; }
.facts dt { order: 2; color: var(--muted); font-size: 0.92rem; }
.facts div { display: flex; flex-direction: column; }
.facts dd { order: 1; font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; line-height: 1.1; }

.education { border-left: 3px solid var(--accent); padding-left: 18px; }
.education-degree { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.education-meta { color: var(--muted); margin: 0; }

/* Skills */
.skill-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 40px; margin-top: 12px; }
.skill-group { padding: 18px 0; border-top: 1px solid var(--line); }
.skill-group h3 { margin: 0 0 10px; font-size: 1rem; color: var(--muted); font-family: var(--font-body); font-weight: 500; }
.skill-group ul { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-group li {
  padding: 6px 14px; border-radius: 999px; font-size: 0.95rem; font-weight: 500;
  background: var(--bg-raised); border: 1px solid var(--line);
}

/* Projects */
.project { padding: 28px 0; border-top: 1px solid var(--line); }
.project:first-child { border-top: 0; padding-top: 0; }
.project-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 8px; }
.project-head h3 { font-size: 1.5rem; margin: 0; }
.project-head i { color: var(--accent); font-size: 1.2rem; }
.project p { color: var(--muted); margin-bottom: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font-size: 0.85rem; font-weight: 500; padding: 4px 12px; border-radius: 6px;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}


/* Project links */
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease,
              border-color 0.2s ease,
              transform 0.2s ease;
}

.project-link:hover {
  background-color: color-mix(in srgb, var(--accent) 10%, transparent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.project-link .fa-arrow-up-right-from-square {
  font-size: 0.75rem;
}


/* Contact */
.contact-list { margin-top: 12px; }
.contact-list a {
  display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px;
  padding: 16px 4px; border-top: 1px solid var(--line);
  text-decoration: none; font-weight: 600;
  transition: background 0.2s ease, padding 0.2s ease;
}
.contact-list li:last-child a { border-bottom: 1px solid var(--line); }
.contact-list a:hover { background: var(--bg-raised); padding-inline: 14px; }
.contact-list i { font-size: 1.2rem; color: var(--accent); }
.contact-list span { color: var(--muted); font-weight: 400; font-size: 0.95rem; overflow-wrap: anywhere; text-align: right; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding: 32px 0 40px; color: var(--muted); font-size: 0.95rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 48px; min-height: auto; padding-top: calc(var(--nav-h) + 48px); }
  .hero-image { order: -1; justify-self: start; width: 220px; }
  .section { grid-template-columns: 1fr; gap: 24px; padding-block: 60px; }
  .section h2 { position: static; }

  .menu-toggle { display: inline-flex; }
  .nav-menu {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px 24px 16px;
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }
  .nav-menu.active { opacity: 1; transform: none; visibility: visible; }
  .nav-menu ul { flex-direction: column; gap: 0; }
  .nav-menu a { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav-menu li:last-child a { border-bottom: 0; }
}

@media (max-width: 560px) {
  .wrap { width: calc(100% - 32px); }
  .navbar { padding-inline: 16px; }
  .skill-groups { grid-template-columns: 1fr; }
  .hero-actions .button { flex: 1 1 100%; }
  .contact-list a { grid-template-columns: 32px 1fr; }
  .contact-list span { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .navbar, .scroll-progress, .skip-link, .hero-actions { display: none; }
  body { background: #fff; color: #000; }
  .hero { min-height: auto; padding-top: 0; }
}