:root {
  --paper: #eef2ee;
  --ink: #17201c;
  --muted: #56635d;
  --contour: #c6d2cb;
  --terrain: #dbe5df;
  --route: #1f4fd1;
  --measure: 42rem;
  --rail: 11rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-variation-settings: "wdth" 100;
  font-size: 1.0625rem;
  line-height: 1.55;
  font-kerning: normal;
}

.wrap {
  max-width: calc(var(--measure) + var(--rail) + 2rem);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

a {
  color: inherit;
  text-decoration-color: var(--route);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover { color: var(--route); }
a:focus-visible {
  outline: 3px solid var(--route);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Hero ---------- */

.hero { padding-top: clamp(3rem, 9vw, 6.5rem); }

.name {
  margin: 0;
  font-size: clamp(2.6rem, 9vw, 5.75rem);
  font-weight: 820;
  font-variation-settings: "wdth" 125;
  line-height: 0.92;
  letter-spacing: -0.025em;
}

.role {
  max-width: 34rem;
  margin: 1.25rem 0 0;
  font-size: clamp(1.125rem, 2.2vw, 1.375rem);
  line-height: 1.4;
  color: var(--ink);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}
.contact a { color: var(--ink); }

/* ---------- Elevation profile ---------- */

.profile { margin: clamp(3.5rem, 8vw, 5rem) 0 0; }

.profile-chart {
  position: relative;
  height: clamp(170px, 24vw, 260px);
}

.profile-chart svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.grade line {
  stroke: var(--contour);
  stroke-width: 1;
  stroke-dasharray: 2 6;
  vector-effect: non-scaling-stroke;
}
.terrain { fill: var(--terrain); }
.route {
  fill: none;
  stroke: var(--route);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.waypoints {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.waypoints li {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 0;
  height: 0;
}

/* dot on the route */
.waypoints li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--route);
}
.waypoints li.now::before { background: var(--route); }

.waypoints li > span { position: absolute; left: 0; white-space: nowrap; transform: translateX(-50%); }
.wp-org {
  bottom: 18px;
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.2;
}
.wp-year {
  bottom: 38px;
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.waypoints li.below .wp-org { bottom: auto; top: 18px; }
.waypoints li.below .wp-year { bottom: auto; top: 38px; }
.waypoints li.start > span { transform: translateX(-12px); }
.waypoints li.now > span { transform: translateX(calc(-100% + 12px)); }

.profile figcaption {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.profile figcaption { max-width: calc(var(--measure) + var(--rail) + 2rem); }

/* the one orchestrated moment: the route draws itself on load */
@media (prefers-reduced-motion: no-preference) {
  .profile-chart svg { animation: ride 1.8s cubic-bezier(.45, .05, .25, 1) both; }
  .waypoints li { animation: arrive 0.35s ease-out both; animation-delay: var(--d, 0s); }
  .waypoints li:nth-child(1) { --d: 0.15s; }
  .waypoints li:nth-child(2) { --d: 0.55s; }
  .waypoints li:nth-child(3) { --d: 0.95s; }
  .waypoints li:nth-child(4) { --d: 1.35s; }
  .waypoints li:nth-child(5) { --d: 1.8s; }
}
@keyframes ride {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes arrive {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Content ---------- */

main { padding-block: clamp(3.5rem, 8vw, 5.5rem) 2rem; }

h2 {
  margin: 0 0 1.25rem;
  font-size: 1.375rem;
  font-weight: 750;
  font-variation-settings: "wdth" 112;
  letter-spacing: -0.01em;
}

section + section { margin-top: clamp(3.5rem, 7vw, 5rem); }

.summary p { max-width: var(--measure); margin: 0; font-size: 1.1875rem; }

.job {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--measure));
  gap: 0 0;
  padding-block: 1.75rem;
  border-top: 1px solid var(--contour);
}
.job:last-child { border-bottom: 1px solid var(--contour); }

.when {
  padding-right: 1rem;
  margin: 0.2rem 0 0;
  font-size: 0.9375rem;
  font-variation-settings: "wdth" 80;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.job h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 750;
  font-variation-settings: "wdth" 112;
  line-height: 1.25;
}
.title { margin: 0.15rem 0 0; color: var(--muted); }

.job ul { margin: 0.9rem 0 0; padding-left: 1.1rem; }
.job li + li { margin-top: 0.45rem; }
.job li::marker { color: var(--route); }

.also {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
}
.also p { margin: 0; }

.foot {
  padding-block: 2rem 4rem;
  color: var(--muted);
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  .job { grid-template-columns: 1fr; }
  .when { margin: 0 0 0.35rem; }
  .also { grid-template-columns: 1fr; }
  .wp-org { font-size: 0.8125rem; }
  .wp-year { font-size: 0.75rem; bottom: 34px; }
  .waypoints li.below .wp-year { top: 34px; }
}

@media (max-width: 480px) {
  /* not enough room for every label: keep the start, the jobs and today, drop the years */
  .wp-year { display: none; }
  .waypoints li:nth-child(2) .wp-org,
  .waypoints li:nth-child(4) .wp-org { bottom: 16px; }
}
