:root {
  --green-dark: #264736;
  --green: #3f6f55;
  --green-light: #9cc5ad;
  --green-pale: #e7f0ea;
  --amber: #9a5a24;
  --paper: #fcfcf7;
  --ink: #2b2b2b;
  --muted: #5f6661;
  --side-ink: #e8efe9;
  --work: #3f6f55;
  --education: #b9772f;
  --font-head: "Montserrat", system-ui, sans-serif;
  --font-body: "Lato", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--green); }
h1, h2, h3 { font-family: var(--font-head); }

/* ---------- Layout ---------- */
.page {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}
@media (min-width: 960px) {
  .page { grid-template-columns: 320px 1fr; }
  .identity .photo { display: none; }
}
/* Small screens: identity & experience first, sidebar after */
@media (max-width: 959px) {
  .main { order: -1; }
  .sidebar .photo { display: none; }
  .identity .photo { width: 110px; height: 110px; margin: 0 0 1rem; border-width: 4px; }
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: relative;
  background: var(--green-dark);
  color: var(--side-ink);
  padding: 2.5rem 1.75rem 12rem;
  overflow: hidden;
}
.sidebar::after { /* topographic contour decoration */
  content: "";
  position: absolute;
  left: -120px; bottom: -140px;
  width: 420px; height: 420px;
  background: url("../img/topo.e9bb4993ebe1.svg") no-repeat center / contain;
  opacity: .22;
  pointer-events: none;
}
.photo {
  display: block;
  width: 180px; height: 180px;
  margin: 0 auto 2rem;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid var(--green-light);
}
.side-title {
  margin: 2rem 0 1rem;
  padding-bottom: .5rem;
  font-size: .95rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green-light);
  border-bottom: 1px solid rgba(156, 197, 173, .45);
}
.sidebar section:first-of-type .side-title { margin-top: 0; }
.sidebar h3 {
  margin: 1.1rem 0 .5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: #fff;
}
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag {
  padding: .1rem .55rem;
  font-size: .88rem;
  border: 1px solid rgba(232, 239, 233, .55);
  border-radius: 6px;
}
.side-bullets { margin: .6rem 0 0; padding-left: 1.2rem; font-size: .95rem; }
.side-bullets:empty { display: none; }

.lang { margin-bottom: .8rem; }
.lang-row { display: flex; justify-content: space-between; }
.bar { height: 4px; margin-top: .3rem; background: rgba(255, 255, 255, .15); border-radius: 2px; }
.bar span { display: block; height: 100%; background: var(--green-light); border-radius: 2px; }

.soft { margin-bottom: .9rem; }
.soft strong { display: block; color: #fff; }
.soft span { font-size: .93rem; }

/* ---------- Main column ---------- */
.main {
  position: relative;
  padding: 2.5rem 1rem 4rem;
  max-width: 900px;
  width: 100%;
  overflow: hidden;
}
@media (min-width: 640px) { .main { padding: 3rem 3rem 5rem; } }
.main::after {
  content: "";
  position: absolute;
  right: -100px; bottom: -100px;
  width: 380px; height: 380px;
  background: url("../img/topo.e9bb4993ebe1.svg") no-repeat center / contain;
  opacity: .5;
  pointer-events: none;
  z-index: -1;
}

.identity h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1;
  color: var(--green-dark);
}
.headline { margin: .5rem 0 0; font-size: 1.3rem; font-weight: 700; color: var(--green); }
.subheadline { margin: .1rem 0 0; color: var(--muted); }
.contact { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin: 1rem 0; color: var(--muted); }

.btn {
  display: inline-block;
  padding: .5rem 1rem;
  font: 700 .9rem var(--font-body);
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--green-dark); }
.btn-small { padding: .35rem .8rem; font-size: .85rem; }

.section-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
  font-size: 1rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--green-light); }
.profile-summary { margin: 0; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.75rem; border-left: 2px solid var(--green-light); margin-left: .5rem; }
.step {
  position: relative;
  margin: 0 0 1.5rem;
  padding: .25rem .5rem;
  border-radius: 6px;
  transition: background-color .3s;
}
.step::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem - 8px);
  top: .55rem;
  width: 10px; height: 10px;
  background: var(--paper);
  border: 3px solid var(--green);
  border-radius: 50%;
}
.step.is-active { background: var(--green-pale); }
.step-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 1rem; align-items: baseline; }
.step h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.dates { font-weight: 700; color: var(--amber); white-space: nowrap; }
.org { margin: 0; font-weight: 700; color: var(--green); }
.summary { margin: .2rem 0 0; font-style: italic; color: var(--muted); }
.step ul { margin: .4rem 0 0; padding-left: 1.2rem; list-style: disc; }

.locate {
  vertical-align: middle;
  margin-left: .25rem;
  padding: 2px 4px;
  color: var(--green);
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.locate:hover, .locate:focus-visible { border-color: var(--green-light); background: var(--green-pale); }

/* ---------- Projects ---------- */
.projects { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.project { padding: 1rem 1.25rem; background: var(--green-pale); border-radius: 10px; }
.project h3 { margin: 0 0 .3rem; font-size: 1rem; }
.project p { margin: 0; }

/* ---------- Map ---------- */
.map-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .8rem;
  font: .88rem var(--font-body);
  color: var(--green-dark);
  background: #fff;
  border: 1px solid var(--green-light);
  border-radius: 999px;
  cursor: pointer;
}
.chip.active { color: #fff; background: var(--green); border-color: var(--green); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; }
.dot.work { background: var(--work); }
.dot.education { background: var(--education); }

#journey-map {
  height: 460px;
  border-radius: 10px;
  border: 1px solid var(--green-light);
  z-index: 0;
}
.map-caption { min-height: 1.5em; margin: .5rem 0 0; font-style: italic; color: var(--muted); }

.journey-marker {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  font: 700 13px var(--font-body);
  color: #fff;
  background: var(--work);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.journey-marker.education { background: var(--education); }
.journey-marker.mixed { background: linear-gradient(135deg, var(--work) 50%, var(--education) 50%); }
.journey-marker.is-current { outline: 3px solid var(--amber); outline-offset: 2px; }

.leaflet-popup-content { font-family: var(--font-body); margin: 12px 16px; }
.popup-city { margin: 0 0 .4rem; font: 700 1rem var(--font-head); color: var(--green-dark); }
.popup-steps { list-style: none; margin: 0; padding: 0; }
.popup-steps li + li { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid #eee; }
.popup-steps a { font-weight: 700; color: var(--green-dark); }
.popup-meta { display: block; font-size: .85rem; color: var(--muted); }
.popup-kind { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.popup-kind.work { color: var(--work); }
.popup-kind.education { color: var(--education); }

/* ---------- Print: keep the CV, drop the interactive map ---------- */
@media print {
  .map-section, .btn, .locate { display: none !important; }
  .page { grid-template-columns: 260px 1fr; }
  .sidebar, .tag, .bar span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .step { break-inside: avoid; }
}
