/* ---------- Design tokens ---------- */
:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --text: #1c1b19;
  --text-secondary: #55534c;
  --text-muted: #8a877d;
  --border: #e4e1d7;
  --accent: #0f6e56;
  --accent-strong: #085041;
  --accent-tint: #e1f5ee;
  --highlight: #c98500;
  --highlight-tint: #faeeda;
  --map-lived: #18406e;
  --map-visited: #1d9e75;
  --map-want: #c98500;
  --map-none: #e4e1d7;
  --radius: 10px;
  --radius-lg: 16px;
  --max-width: 880px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --surface: #1c1b16;
    --surface-2: #262420;
    --text: #f3f1e9;
    --text-secondary: #c3c0b3;
    --text-muted: #8a877d;
    --border: #35332b;
    --accent: #5dcaa5;
    --accent-strong: #9fe1cb;
    --accent-tint: #1c2f28;
    --highlight: #fac775;
    --highlight-tint: #332617;
    --map-lived: #5b9bd8;
    --map-visited: #5dcaa5;
    --map-want: #fac775;
    --map-none: #35332b;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.5em;
}
h1 { font-size: 2.4rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Header / nav ---------- */
header.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.nav-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.nav-brand:hover { text-decoration: none; }

nav.nav-links {
  display: flex;
  gap: 1.5rem;
}

nav.nav-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

nav.nav-links a:hover { color: var(--accent-strong); text-decoration: none; }

nav.nav-links a.active {
  color: var(--text);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  color: var(--text);
  font-size: 1rem;
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  nav.nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  nav.nav-links.open { display: flex; }
  nav.nav-links a {
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--border);
  }
  .nav-bar { position: relative; }
}

/* ---------- Main / sections ---------- */
main { padding: 3rem 0 5rem; }

.hero {
  padding: 3rem 0 2.5rem;
}
.hero p.lede {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 60ch;
}

.section { margin: 2.5rem 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
}

.card + .card { margin-top: 1rem; }

.tag {
  display: inline-block;
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-strong);
  margin: 0 0.4rem 0.4rem 0;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }

.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { margin-bottom: 0.6rem; }

/* ---------- Blog ---------- */
.post-preview {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
}
.post-preview:first-child { padding-top: 0; }
.post-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
article.post h1 { margin-bottom: 0.2em; }
article.post .post-date { margin-bottom: 1.5rem; }
article.post { max-width: 68ch; }

/* ---------- Resume ---------- */
.resume-entry { margin-bottom: 1.75rem; }
.resume-entry .role-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.2rem;
}
.resume-entry .role { font-weight: 600; }
.resume-entry .org { color: var(--text-secondary); }
.resume-entry .dates {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* ---------- Travel / map ---------- */
.map-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
#world-map { width: 100%; height: auto; display: block; }
#world-map path {
  stroke: var(--bg);
  stroke-width: 0.5;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
#world-map path:hover { opacity: 0.8; }

#world-map .inset-label {
  font-family: var(--font-sans);
  font-size: 9px;
  fill: var(--text-muted);
}

.map-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  padding: 0.4rem 0.8rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}
.map-back:hover { color: var(--text); border-color: var(--border-strong, var(--border)); }
.map-back[hidden] { display: none; }

.map-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.country-stats {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.map-legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: -1px;
}

#map-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  opacity: 0;
  transform: translate(-50%, -120%);
  transition: opacity 0.1s ease;
  z-index: 20;
  white-space: nowrap;
}

.travel-stats {
  display: flex;
  gap: 2rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}
.travel-stats .stat-num {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-strong);
}
.travel-stats .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- Contact ---------- */
form.contact-form { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
form.contact-form label { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; display: block; }
form.contact-form input, form.contact-form textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
}
form.contact-form textarea { min-height: 140px; resize: vertical; }

/* ---------- Footer ---------- */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
footer.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
footer.site-footer a { color: var(--text-muted); }
