:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --text: #1a1c1e;
  --muted: #5d6268;
  --faint: #8a9097;
  --line: #e6e6e1;
  --accent: #2257d6;
  --accent-soft: #e8eefc;
  --chip: #f1f1ed;
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111315;
    --surface: #181b1e;
    --text: #e8eaed;
    --muted: #a2a8ae;
    --faint: #737a81;
    --line: #2a2e33;
    --accent: #7ea2ff;
    --accent-soft: #1e2840;
    --chip: #22262a;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 780px; margin: 0 auto; padding: 0 20px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { font-weight: 700; color: var(--text); letter-spacing: -0.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
#nav { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; }
#nav::-webkit-scrollbar { display: none; }
#nav a { color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
#nav a:hover { color: var(--text); text-decoration: none; }

/* Hero */
.hero { display: flex; gap: 28px; align-items: center; padding: 64px 0 40px; }
.avatar {
  flex: none; width: 112px; height: 112px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
  font-size: 40px; font-weight: 700; letter-spacing: -0.02em;
  object-fit: cover; border: 1px solid var(--line);
}
.hero h1 { font-size: clamp(32px, 5vw, 44px); line-height: 1.1; margin: 0 0 8px; letter-spacing: -0.025em; }
.headline { font-size: 18px; color: var(--muted); margin: 0 0 10px; }
.location { font-size: 14px; color: var(--faint); margin: 0 0 18px; display: flex; align-items: center; gap: 6px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { color: #fff; filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { .btn.primary, .btn.primary:hover { color: #0d1220; } }

/* Subpage header */
.page-head { padding: 48px 0 32px; }
.page-head .back { display: inline-block; font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 14px; }
.page-head .back:hover { color: var(--accent); text-decoration: none; }
.page-head h1 { font-size: clamp(30px, 4.5vw, 40px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.025em; }
.page-head .headline { margin: 0; }

/* Sections */
.section { padding: 36px 0; border-top: 1px solid var(--line); }
.section h2 {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--faint); margin: 0 0 20px;
}
.prose p { margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { margin: 0 0 14px; padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.about { font-size: 17px; }

/* Experience */
.company { margin-bottom: 32px; }
.company:last-child { margin-bottom: 0; }
.company-name { font-size: 17px; font-weight: 600; margin: 0 0 2px; }
.company-meta { font-size: 14px; color: var(--faint); margin: 0 0 12px; }
.roles { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.role { position: relative; padding-bottom: 18px; }
.role:last-child { padding-bottom: 0; }
.role::before {
  content: ""; position: absolute; left: -24px; top: 8px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.role-title { font-weight: 600; margin: 0; }
.role-dates { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.role .prose { color: var(--muted); font-size: 15px; }

/* Cards (projects, education, certs) */
.cards { display: grid; gap: 14px; }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px;
}
a.card { display: block; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card h3 { font-size: 16px; margin: 0 0 2px; }
.card .meta { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.card .meta:last-child { margin-bottom: 0; }
.card .prose { font-size: 15px; color: var(--muted); }
.card .arrow { color: var(--accent); font-size: 14px; font-weight: 500; margin-top: 10px; display: inline-block; }

/* Skills */
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chip { background: var(--chip); border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.chips.tech { gap: 6px; margin-top: 10px; }
.chips.tech .chip { font-size: 12.5px; padding: 3px 10px; color: var(--muted); }
.chip small { color: var(--faint); margin-left: 4px; }

/* Contact */
.contact p { margin: 0 0 16px; color: var(--muted); }

/* Footer */
.footer { padding: 32px 0 48px; color: var(--faint); font-size: 13px; border-top: 1px solid var(--line); }

/* Loading skeleton */
.skeleton { background: var(--chip); border-radius: 8px; animation: pulse 1.4s ease-in-out infinite; }
.skeleton.line { height: 18px; margin: 10px 0; }
.w60 { width: 60%; } .w80 { width: 80%; }
.hero-text { flex: 1; }
@keyframes pulse { 50% { opacity: .5; } }

.error { padding: 40px 0; color: var(--muted); }

@media (max-width: 600px) {
  .hero { flex-direction: column; align-items: flex-start; gap: 20px; padding: 40px 0 28px; }
  .avatar { width: 88px; height: 88px; font-size: 32px; }
  .cards.two { grid-template-columns: 1fr; }
  #nav { gap: 14px; }
}

@media print {
  .topbar, .links { display: none; }
  body { background: #fff; color: #000; }
  .section { break-inside: avoid-page; }
}
