:root {
  --bg: #fbfaf7;
  --surface: #f3f0e8;
  --text: #1f2430;
  --muted: #6b6f7a;
  --rule: #e2ddd0;
  --accent: #2f5d8a;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --surface: #1d2027;
    --text: #e6e3dc;
    --muted: #9a9ca3;
    --rule: #2c2f36;
    --accent: #8fb6dc;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.125rem/1.65 "Spectral", Georgia, serif;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.hero-photo img {
  display: block;
  width: 100%;
  height: clamp(240px, 55vh, 560px);
  object-fit: cover;
  object-position: center 45%;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

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

/* Hero */
.hero { padding-bottom: 3rem; }
.portrait {
  position: relative;
  display: block;
  width: 9rem; height: 9rem;
  border-radius: 50%;
  object-fit: cover;
  margin: -4.5rem 0 1.75rem;
  border: 4px solid var(--bg);
}
.eyebrow { text-transform: uppercase; color: var(--muted); margin: 0 0 1rem; }
h1 { font-size: clamp(2.5rem, 9vw, 3.75rem); font-weight: 400; line-height: 1.05; margin: 0 0 1.25rem; }
.lede { font-size: 1.3rem; line-height: 1.5; margin: 0 0 0.75rem; max-width: 36rem; }
.sublede { color: var(--muted); font-style: italic; margin: 0 0 2rem; max-width: 36rem; }

.jump { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; text-transform: uppercase; }
.jump a { color: var(--muted); text-decoration: none; }
.jump a:hover { color: var(--accent); }

/* Sections */
section { padding: 2.5rem 0; border-top: 1px solid var(--rule); }
h2 {
  font: 500 0.8rem "IBM Plex Mono", ui-monospace, monospace;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 1.25rem;
}
section p { margin: 0 0 1rem; }
section p:last-child { margin-bottom: 0; }

/* Explore: the map, with a popup of name, years and photos per country */
.map-wrap { position: relative; margin: 1.5rem 0 0.75rem; }
.map { display: block; width: 100%; height: auto; }
.map .land path { fill: var(--rule); }
.map .visited path { fill: var(--accent); cursor: pointer; outline: none; transition: fill 0.15s; }
.map .visited path:hover,
.map .visited path:focus-visible,
.map .visited path.active { fill: #d9792b; }
.map .pins circle { fill: var(--accent); stroke: var(--bg); stroke-width: 2; pointer-events: none; }
.map-hint { color: var(--muted); text-transform: uppercase; margin: 0; }

.map-pop {
  position: absolute; z-index: 10;
  max-width: min(24rem, 100%);
  padding: 0.75rem 0.9rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
  pointer-events: none;
}
.map-pop .pop-name { font-weight: 600; margin: 0; }
.map-pop .pop-photos { display: flex; gap: 0.5rem; margin-top: 0.7rem; }
.map-pop figure { margin: 0; flex: 1 1 0; min-width: 0; }
.map-pop img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: 5px;
}
.map-pop figcaption { font-size: 0.68rem; line-height: 1.3; margin-top: 0.3rem; }
.map-pop figcaption span { display: none; }

/* Project cards */
.cards { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 600px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 700px) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }

/* A lone card spans the row, with the picture on the left and the text on the right. */
@media (min-width: 600px) {
  .card.wide {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1.4rem;
    align-content: center;
  }
  .card.wide > .card-media {
    grid-column: 1; grid-row: 1 / span 10;
    margin: -1.25rem 0 -1.25rem -1.4rem;
  }
  .card.wide > :not(.card-media) { grid-column: 2; }
  .card.wide .card-img, .card.wide .card-photo { border-radius: 7px 0 0 7px; }
}

.card {
  display: block;
  padding: 1.25rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-img {
  display: block;
  width: calc(100% + 2.8rem);
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin: -1.25rem -1.4rem 1rem;
  border-radius: 7px 7px 0 0;
}
.card-media { position: relative; margin: -1.25rem -1.4rem 1rem; }
.card-media .card-img { width: 100%; margin: 0; }
/* The photo sits over the drawing and fades in on hover (or tap on touch screens). */
.card-photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 7px 7px 0 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}
/* Screenshots: show all of it, pinned to the top, rather than cropping. */
.card-photo.contain { object-fit: contain; object-position: top; background: #fff; }
.card:hover .card-photo,
.card:focus-within .card-photo,
.card-media.show .card-photo { opacity: 1; }
.court { color: var(--muted); background: var(--rule); opacity: 0.85; }
.court .shots { fill: #d9792b; }
.card-tag { text-transform: uppercase; color: var(--muted); margin: 0 0 0.4rem; }
.card h3 { font-size: 1.3rem; font-weight: 500; margin: 0 0 0.5rem; }
.card > p:not(.mono) { font-size: 1rem; }
.card-link { color: var(--accent); text-transform: uppercase; margin-top: 1rem; }
a.card:hover .card-link { text-decoration: underline; text-underline-offset: 3px; }
.card .card-subtitle { font-style: italic; color: var(--muted); margin: -0.35rem 0 0.5rem; }


/* Contact */
.links { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.links a {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  text-decoration: none;
  text-transform: uppercase;
}
.links a:hover { background: var(--accent); color: var(--bg); }

footer { padding-top: 2rem; border-top: 1px solid var(--rule); color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .card-photo { transition: none; }
  a.card:hover { transform: none; }
}
