:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #4b5563;
  --border: #e5e7eb;
  --accent: #0284c7;
  --accent-soft: #e0f2fe;
  --tag-bg: #f3f4f6;
  --btn-bg: #111827;
  --btn-text: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --surface: #121826;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --border: #1f2937;
    --accent: #38bdf8;
    --accent-soft: #0c2a3d;
    --tag-bg: #1f2937;
    --btn-bg: #f3f4f6;
    --btn-text: #0b0f17;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--accent);
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.brand {
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--btn-bg);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-small {
  padding: 7px 14px;
  font-size: 14px;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  align-items: center;
  padding: 72px 0 48px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.lead {
  margin: 20px 0 28px;
  color: var(--muted);
  font-size: 18px;
  max-width: 620px;
}

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

.hero-photo {
  width: 280px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  list-style: none;
  padding: 0;
  margin: 36px 0 0;
}

.stats strong {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.stats span {
  color: var(--muted);
  font-size: 14px;
}

/* Sections */
.section {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

h2 {
  margin: 0 0 24px;
  font-size: 28px;
  letter-spacing: -0.01em;
}

h3 {
  margin: 0;
  font-size: 17px;
}

.section-lead {
  margin: -12px 0 24px;
  color: var(--muted);
}

/* Experience */
.timeline {
  display: grid;
  gap: 16px;
}

.job {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
}

.job-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.when {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.job-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.job ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.job li {
  margin-bottom: 4px;
}

/* Featured projects */
.featured {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.project {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.project-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--tag-bg);
}

.project-img.screens {
  height: auto;
  aspect-ratio: 1200 / 750;
}

.project-img.contain {
  object-fit: contain;
  padding: 20px;
}

.project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px 22px 22px;
}

.role {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.project-body h3 {
  font-size: 20px;
}

.project-body > p:not(.role) {
  color: var(--muted);
  margin: 8px 0 14px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.tags li {
  background: var(--tag-bg);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 500;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: auto;
}

.links a {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.links a:hover {
  text-decoration: underline;
}

.links a.apk {
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 8px;
}

/* Open-source tools */
.tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.tool {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

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

.tool h3 {
  font-size: 15px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.tool p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* More apps */
.apps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.app {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.app img {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 12px;
  object-fit: cover;
  background: var(--tag-bg);
}

.app p {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 14px;
}

/* Skills */
.skills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skills h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.skills .tags {
  margin: 0;
}

/* Education */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.two-col p,
.plain {
  color: var(--muted);
  margin: 0;
}

.plain {
  padding-left: 20px;
}

/* Contact & footer */
.contact {
  text-align: center;
}

.contact .hero-actions {
  justify-content: center;
}

.site-footer {
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* Responsive */
@media (max-width: 860px) {
  .nav {
    display: none;
  }

  .header-bar .btn-small {
    margin-left: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 40px;
  }

  .hero-photo {
    order: -1;
    width: 140px;
    border-radius: 50%;
  }

  .featured,
  .apps,
  .two-col {
    grid-template-columns: 1fr;
  }

  .tools,
  .skills {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .tools,
  .skills {
    grid-template-columns: 1fr;
  }

  .stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}
