:root {
  --bg: #fcfdfc;
  --text: #17201b;
  --muted: #4b5751;
  --accent: #1f5135;
  --accent-hover: #2d6a4f;
  --tint: #eaf3ed;
  --rule: #d5e3da;
  --focus: #1f5135;

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 72rem;
  --text-measure: 44rem;
  --date-col: 9.5rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: #fff;
  z-index: 10;
}

.skip-link:focus {
  top: 0.75rem;
  color: #fff;
}

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

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
}

.topbar__name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.topbar__name:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 1.1rem;
  margin-left: auto;
  font-size: 0.95rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.lang {
  display: flex;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}

.lang a,
.lang span {
  padding: 0.2rem 0.55rem;
  text-decoration: none;
  line-height: 1.5;
}

.lang span {
  background: var(--accent);
  color: #fff;
}

.lang a:hover {
  background: var(--tint);
}

/* Intro */

.intro {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--rule);
}

h1 {
  font-size: 2.25rem;
  line-height: 1.2;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.role {
  margin: 0.35rem 0 1.25rem;
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 600;
}

.lede {
  margin: 0 0 1.5rem;
  max-width: 40rem;
}

.contacts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.button {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: var(--accent-hover);
  color: #fff;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: 2.25rem 0 0;
  padding: 0;
}

.facts div {
  border-top: 2px solid var(--accent);
  padding-top: 0.5rem;
}

.facts dt {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
}

.facts dd {
  margin: 0.15rem 0 0;
  font-size: 0.925rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Sections */

section {
  padding: 2.75rem 0 2.25rem;
  border-bottom: 1px solid var(--rule);
}

h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 1.5rem;
  font-weight: 600;
}

h3 {
  font-size: 1.0625rem;
  margin: 0;
  font-weight: 600;
  line-height: 1.45;
}

h4 {
  font-size: 1rem;
  margin: 1.25rem 0 0.4rem;
  font-weight: 600;
}

p {
  margin: 0 0 1rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.925rem;
}

/* Skills table */

.skills {
  margin: 0;
}

.skills > div {
  display: grid;
  grid-template-columns: var(--date-col) 1fr;
  gap: 0 1.5rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}

.skills > div:first-child {
  border-top: 0;
  padding-top: 0;
}

.skills dt {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.5;
  padding-top: 0.05rem;
}

.skills dd {
  margin: 0;
}

.skills .where {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
}

/* CV-style entries: dates sit at the right of the first line,
   so the text gets the full width instead of a table column */

.entry {
  position: relative;
  padding: 1.1rem 0 1.2rem;
  border-top: 1px solid var(--rule);
}

h2 + .entry {
  border-top: 0;
  padding-top: 0.15rem;
}

.entry__date {
  position: absolute;
  top: 1.15rem;
  right: 0;
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

h2 + .entry > .entry__date {
  top: 0.2rem;
}

.entry > div > :first-child {
  padding-right: 10.5rem;
}

.entry__org {
  margin: 0;
  color: var(--muted);
}

.entry__org a {
  color: var(--text);
  font-weight: 600;
}

.entry__org a:hover {
  color: var(--accent);
}

.entry__rank {
  margin: 0.2rem 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--accent);
}

.entry ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}

.entry li {
  margin-bottom: 0.15rem;
}

.entry li::marker {
  color: var(--accent);
}

.stack {
  margin: 0.4rem 0 0;
  font-size: 0.925rem;
  color: var(--muted);
}

.stack b {
  color: var(--text);
  font-weight: 600;
}

.subrole {
  margin-top: 0.7rem;
}

.pubs {
  margin: 0;
  padding-left: 1.2rem;
}

.pubs li {
  margin-bottom: 0.35rem;
}

.plain {
  list-style: none;
  padding: 0;
  margin: 0;
}

.plain li {
  margin-bottom: 0.3rem;
}

/* Two short lists side by side (conferences and courses) */

@media (min-width: 761px) {
  .duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2.5rem;
  }
}

.note {
  background: var(--tint);
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--accent);
  margin: 0 0 1.5rem;
}

/* CV downloads */

.cv-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cv-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}

.cv-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.cv-list p {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.cv-list .dl {
  white-space: nowrap;
  font-weight: 600;
}

/* Footer */

footer {
  padding: 2rem 0 3rem;
  font-size: 0.95rem;
  color: var(--muted);
}

footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

footer p {
  margin: 0;
}

/* Role pages and case studies */

.focus {
  margin: -0.85rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.case {
  padding: 1.75rem 0 1.5rem;
  border-top: 1px solid var(--rule);
}

h2 + .case {
  border-top: 0;
  padding-top: 0;
}

.case__org {
  margin: 0 0 0.15rem;
  color: var(--muted);
  font-size: 0.925rem;
}

.case h3 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.case__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1rem;
}

.case__metrics div {
  background: var(--tint);
  border-left: 3px solid var(--accent);
  padding: 0.35rem 0.75rem;
  border-radius: 0 4px 4px 0;
}

.case__metrics dt {
  display: inline;
  font-weight: 700;
  color: var(--accent);
}

.case__metrics dd {
  display: inline;
  margin: 0 0 0 0.35rem;
  font-size: 0.925rem;
  color: var(--muted);
}

.case__label {
  margin-bottom: 0.25rem;
}

.case ul {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
}

.case li {
  margin-bottom: 0.35rem;
}

.case li::marker {
  color: var(--accent);
}

.case__roles {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.intro__h {
  margin: 1.5rem 0 0.6rem;
}

.role-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.role-links a {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.role-links a:hover {
  background: var(--tint);
}

.note-after {
  margin: 1.5rem 0 0;
}

/* Hero: full-screen name on the main page (assets/hero.js) */

.hero {
  --p: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 70% 40%, var(--tint) 0%, rgba(234, 243, 237, 0) 70%),
    var(--bg);
  border-bottom: 1px solid var(--rule);
}

@supports (height: 100svh) {
  .hero {
    min-height: 100svh;
  }
}

.hero__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: translateY(calc(var(--p) * 18vh)) scale(calc(1 + var(--p) * 0.08));
  transform-origin: 60% 40%;
  will-change: transform;
}

.hero__heat circle {
  transform-box: fill-box;
  transform-origin: center;
}

.hero__route {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-opacity: 0.32;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.hero__route--b {
  stroke: #52b788;
  stroke-opacity: 0.45;
}

.hero__route--d {
  stroke: #95d5b2;
  stroke-opacity: 0.6;
}

.hero__riders circle {
  fill: var(--accent);
}

.hero__inner {
  position: relative;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.25rem 6rem;
  transform: translateY(calc(var(--p) * -14vh)) scale(calc(1 - var(--p) * 0.1));
  transform-origin: 0 50%;
  opacity: calc(1 - var(--p) * 1.5);
  will-change: transform, opacity;
}

.hero__name {
  margin: 0;
  font-size: clamp(3.1rem, 14vw, 10.5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.hero__line {
  display: block;
  white-space: nowrap;
}

.hero__line + .hero__line {
  color: var(--accent);
}

.hero__char {
  display: inline-block;
}

.hero__cue {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: calc(1 - var(--p) * 4);
}

.hero__cue:hover {
  color: var(--accent);
}

.hero__arrow {
  position: relative;
  width: 1.6rem;
  height: 2.6rem;
  border: 2px solid currentColor;
  border-radius: 1rem;
}

.hero__arrow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.45rem;
  width: 4px;
  height: 0.55rem;
  margin-left: -2px;
  border-radius: 2px;
  background: currentColor;
}

/* Animation runs only with JS and without reduced motion */

@media (prefers-reduced-motion: no-preference) {
  .js-hero .hero__name,
  .js-hero .hero__cue > span {
    opacity: 0;
  }

  .js-hero .hero.is-ready .hero__name {
    opacity: 1;
  }

  .hero__char {
    opacity: 0;
    transform: translateY(0.55em) rotate(8deg);
    filter: blur(10px);
    transition:
      opacity 0.7s ease,
      transform 0.9s cubic-bezier(0.2, 0.75, 0.25, 1),
      filter 0.7s ease;
    transition-delay: calc(var(--i) * 55ms + 150ms);
  }

  .hero.is-ready .hero__char {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .js-hero .hero.is-ready .hero__cue > span {
    animation: hero-rise 0.8s 2s ease forwards;
  }

  .js-hero .hero__route {
    stroke-dashoffset: 1;
  }

  .js-hero .hero.is-ready .hero__route {
    transition: stroke-dashoffset 2.6s cubic-bezier(0.45, 0, 0.2, 1) 0.2s;
    stroke-dashoffset: 0;
  }

  .js-hero .hero.is-ready .hero__route--b { transition-delay: 0.45s; }
  .js-hero .hero.is-ready .hero__route--c { transition-delay: 0.7s; }
  .js-hero .hero.is-ready .hero__route--d { transition-delay: 0.95s; }

  /* Demand hot spots: fade in, then breathe slowly, each on its own rhythm */
  .js-hero .hero__heat {
    opacity: 0;
  }

  .js-hero .hero.is-ready .hero__heat {
    opacity: 1;
    transition: opacity 2s ease 0.3s;
  }

  .hero__heat circle {
    animation: hero-pulse var(--t, 8s) ease-in-out var(--d, 0s) infinite alternate;
  }

  .hero__arrow::before {
    animation: hero-wheel 1.8s ease-in-out infinite;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__map,
  .hero__inner {
    transform: none;
  }

  .hero__riders {
    display: none;
  }
}

@keyframes hero-rise {
  from { opacity: 0; transform: translateY(0.8rem); }
  to { opacity: 1; transform: none; }
}

@keyframes hero-pulse {
  from { transform: scale(0.82); opacity: 0.65; }
  to { transform: scale(1.12); opacity: 1; }
}

@keyframes hero-wheel {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(0.9rem); }
}

/* Location and visa line, more cases, recognition */

.location {
  margin: -0.75rem 0 1.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.more-cases {
  list-style: none;
  margin: 0;
  padding: 0;
}

.more-cases li {
  padding: 0.6rem 0;
  border-top: 1px solid var(--rule);
}

.more-cases li:first-child {
  border-top: 0;
}

.more-cases a {
  font-weight: 600;
}

.more-cases span {
  color: var(--muted);
  font-size: 0.925rem;
}

.recognition li {
  margin-bottom: 0.5rem;
}

/* A case opened by a link (…/#ride-quality) gets a soft highlight */

.case:target {
  background: linear-gradient(90deg, var(--tint), rgba(234, 243, 237, 0));
  box-shadow: -1.25rem 0 0 var(--tint);
  border-top-color: var(--accent);
}

/* At a glance (main page, right of the intro) */

.glance {
  margin: 2rem 0 0;
  padding: 1.25rem 1.4rem 1.4rem;
  background: var(--tint);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
}

.glance__h {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.roles-h {
  margin-top: 2rem;
}

.glance__now {
  list-style: none;
  margin: 0;
  padding: 0;
}

.glance__now li {
  padding: 0.45rem 0;
  border-top: 1px solid var(--rule);
  line-height: 1.4;
}

.glance__now li:first-child {
  border-top: 0;
  padding-top: 0;
}

.glance__now b {
  display: block;
  font-weight: 600;
}

.glance__now span {
  font-size: 0.9rem;
  color: var(--muted);
}

.glance__roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.glance__roles a {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.glance__roles a:hover {
  background: var(--accent);
  color: #fff;
}

/* Wide screens: section titles in a left rail, intro with a side column */

@media screen and (min-width: 1000px) {
  .intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 21rem;
    column-gap: 4rem;
    align-items: start;
  }

  .intro > * {
    grid-column: 1;
  }

  .intro > .glance,
  .intro > .facts {
    grid-column: 2;
    grid-row: 1 / span 20;
    margin-top: 0.35rem;
  }

  .intro > .facts {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  .lede {
    max-width: var(--text-measure);
  }

  main section {
    display: grid;
    grid-template-columns: 12rem minmax(0, 1fr);
    column-gap: 3rem;
  }

  main section > * {
    grid-column: 2;
    min-width: 0;
  }

  main section > h2 {
    grid-column: 1;
    grid-row: 1 / span 200;
    align-self: start;
    position: sticky;
    top: 5rem;
    margin-top: 0.2rem;
  }

  main section > p,
  main section > ul.plain,
  main section > ol:not(.pubs) {
    max-width: var(--text-measure);
  }
}

/* Small screens */

@media (max-width: 760px) {
  .topbar .wrap {
    flex-wrap: wrap;
    gap: 0 1rem;
  }

  .nav {
    order: 3;
    width: 100%;
    margin: 0;
    padding: 0 0 0.55rem;
    gap: 1rem;
    overflow-x: auto;
    font-size: 0.9rem;
  }

  .nav a {
    white-space: nowrap;
  }

  .lang {
    margin-left: auto;
  }

  html {
    scroll-padding-top: 6rem;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 1rem;
  }

  .intro {
    padding: 2rem 0 2rem;
  }

  h1 {
    font-size: 1.85rem;
  }

  .role {
    font-size: 1.125rem;
    margin-bottom: 0.9rem;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1.75rem;
  }

  .facts div {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
  }

  .facts dt {
    font-size: 1.2rem;
    min-width: 7.5rem;
    white-space: nowrap;
  }

  .skills > div {
    grid-template-columns: 1fr;
  }

  .entry__date,
  h2 + .entry > .entry__date {
    position: static;
    margin-bottom: 0.1rem;
  }

  .entry > div > :first-child {
    padding-right: 0;
  }

  .cv-list li {
    grid-template-columns: 1fr;
  }

  section {
    padding: 2.25rem 0 1.75rem;
  }
}

/* Print: the page doubles as a CV */

@media print {
  @page {
    margin: 14mm 14mm 16mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
    line-height: 1.4;
  }

  .topbar,
  .hero__map,
  .hero__cue,
  .skip-link,
  .button,
  .no-print,
  #cv,
  #about {
    display: none !important;
  }

  .wrap {
    max-width: none;
    padding: 0;
  }

  .hero {
    min-height: 0;
    background: none;
    border: 0;
  }

  .hero__inner {
    padding: 0;
    transform: none;
    opacity: 1;
  }

  .hero__name {
    font-size: 18pt;
    letter-spacing: 0;
    line-height: 1.2;
  }

  .hero__line {
    display: inline;
  }

  .hero__line + .hero__line {
    color: inherit;
  }

  .hero__name,
  .hero__char {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .intro {
    padding: 0 0 8pt;
  }

  h1 {
    font-size: 18pt;
  }

  .role {
    font-size: 12pt;
    margin-bottom: 6pt;
  }

  section {
    padding: 10pt 0 6pt;
    border-color: #999;
  }

  h2 {
    margin-bottom: 8pt;
    color: #000;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  .contacts a[href^="mailto:"]::after,
  .contacts a[href^="https://"]::after {
    content: " (" attr(href) ")";
    font-size: 8.5pt;
  }

  .contacts a[href^="mailto:"]::after {
    content: "";
  }

  .entry,
  .case,
  .skills > div,
  .facts div {
    break-inside: avoid;
  }

  .entry {
    margin-bottom: 10pt;
  }

  .facts {
    margin-top: 10pt;
  }

  .facts dt {
    font-size: 13pt;
  }
}
