:root {
  --background: #0a0f1c;
  --panel-background: color-mix(in srgb, var(--background) 92%, transparent);
  --text: #eef1f7;
  --text-muted: #9aa4b8;
  --accent: #f4a259;
  --rule: rgba(238, 241, 247, 0.18);
  --font: "Manrope", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --screen-height: 100vh;
  --text-shadow-over-imagery: 0 1px 16px color-mix(in srgb, var(--background) 70%, transparent);
}

@supports (height: 100svh) {
  :root {
    --screen-height: 100svh;
  }
}

/* ---- Base ---- */

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

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

h1,
h2 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.pill {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--text);
  color: var(--background);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.pill:hover {
  transform: translateY(-2px);
}

/* ---- Header: always on screen, fading into the page instead of ending at a line ---- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px var(--gutter) 48px;
  background: linear-gradient(to bottom, var(--background), color-mix(in srgb, var(--background) 60%, transparent) 45%, transparent);
  text-shadow: var(--text-shadow-over-imagery);
}

.brand {
  font-weight: 600;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 24px;
}

.site-nav a {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.site-nav a[aria-current] {
  text-decoration: underline;
  text-underline-offset: 6px;
}

/* ---- Hero: the photo fades into the page so the globe below has no edge ---- */

.hero {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
  height: var(--screen-height);
  min-height: 560px;
  overflow: hidden;
  text-align: center;
}

.hero-photo,
.get-in-touch-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--background) 45%, transparent),
    transparent 30%,
    transparent 55%,
    var(--background)
  );
}

.hero-heading {
  position: relative;
  z-index: 1;
  grid-row: 2;
  padding-inline: var(--gutter);
  text-shadow: var(--text-shadow-over-imagery);
}

.hero h1 {
  font-size: clamp(2.5rem, 4.5vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero-subline {
  margin: 8px 0 0;
}

.hero .pill {
  position: relative;
  z-index: 1;
  grid-row: 3;
  align-self: center;
}

.side-label {
  position: absolute;
  z-index: 1;
  left: var(--gutter);
  top: 50%;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  writing-mode: vertical-rl;
  transform: translateY(-50%) rotate(180deg);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  /* The hero photo's sun sits behind the label; a tight dark edge keeps the
     white text readable on white. */
  text-shadow: 0 0 2px var(--background), 0 0 8px color-mix(in srgb, var(--background) 80%, transparent);
}

.side-label:empty {
  display: none;
}

.side-label::before {
  content: "";
  width: 1px;
  height: 96px;
  background: currentColor;
  box-shadow: 0 0 3px var(--background);
}

/* ---- Places: the globe stays pinned while the stops scroll over it ---- */

.globe-stage {
  position: sticky;
  top: 0;
  height: var(--screen-height);
}

.globe {
  position: absolute;
  inset: 0;
}

/* For half a screen before the first stop and after the last, no stop
   crosses the middle, so the globe shows the whole Earth. */
.stops {
  position: relative;
  margin-top: calc(-1 * var(--screen-height));
  padding-block: calc(var(--screen-height) / 2);
  pointer-events: none;
}

/* How much of the globe the photos cover. places.js reads these to keep the
   current stop centred in the part of the globe left uncovered, so they are
   registered as lengths and compute to pixels. */
@property --photos-cover-right {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

@property --photos-cover-bottom {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.places {
  --photos-cover-right: 50vw;
  --photos-cover-bottom: 0px;
}

/* Each stop clips its own panel, so hidden photos leave the screen instead
   of sliding into the next stop or widening the page. */
.stop {
  position: relative;
  display: flex;
  justify-content: flex-end;
  min-height: var(--screen-height);
  overflow: clip;
}

.stop-panel {
  position: relative;
  width: var(--photos-cover-right);
  height: var(--screen-height);
  background: var(--background);
  pointer-events: auto;
  mask-image: linear-gradient(to right, transparent, #000 22%);
  transition: translate 0.5s ease;
}

/* Consecutive panels join without a seam; only the outer ends of the run
   fade, where the panels meet the map. */
.stop:first-child .stop-panel {
  mask-image: linear-gradient(to right, transparent, #000 22%), linear-gradient(to bottom, transparent, #000 15%);
  mask-composite: intersect;
}

.stop:last-child .stop-panel {
  mask-image: linear-gradient(to right, transparent, #000 22%), linear-gradient(to top, transparent, #000 15%);
  mask-composite: intersect;
}

.places.is-photos-hidden .stop-panel {
  translate: 100% 0;
}

.stop-photos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
  gap: 10px;
  height: 100%;
  margin: 0;
  padding: 96px var(--gutter) 150px 18%;
  list-style: none;
}

.stop-photos li:first-child {
  grid-column: 1 / -1;
}

.stop-photos a,
.stop-photos img {
  display: block;
  width: 100%;
  height: 100%;
}

.stop-photos img {
  object-fit: cover;
  border-radius: 8px;
  transition: filter 0.3s ease;
}

.stop-photos a:hover img {
  filter: brightness(1.12);
}

.stop-label {
  position: absolute;
  left: 18%;
  right: var(--gutter);
  bottom: 56px;
}

.stop-count {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  color: var(--accent);
}

.stop-name {
  font-size: 1.75rem;
}

.stop-months {
  margin: 4px 0 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.photos-toggle {
  position: fixed;
  top: 50%;
  right: var(--photos-cover-right);
  z-index: 2;
  padding: 12px;
  border: none;
  background: none;
  color: color-mix(in srgb, var(--text) 70%, transparent);
  font: inherit;
  font-size: 2.25rem;
  line-height: 1;
  text-shadow: var(--text-shadow-over-imagery);
  cursor: pointer;
  translate: 50% -50%;
  transition: right 0.5s ease, translate 0.5s ease, rotate 0.5s ease, color 0.2s ease;
}

.photos-toggle:hover {
  color: var(--text);
}

.places.is-photos-hidden .photos-toggle {
  right: var(--gutter);
  translate: 0 -50%;
  rotate: 180deg;
}

.places-nav {
  position: absolute;
  left: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
}

.places-nav ol {
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 1px solid var(--rule);
  list-style: none;
}

.places-nav a {
  display: block;
  padding: 5px 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  text-shadow: var(--text-shadow-over-imagery);
  transition: color 0.3s ease;
}

.places-nav a:hover,
.places-nav a[aria-current] {
  color: var(--text);
}

.places-nav a[aria-current]::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.globe .maplibregl-ctrl-attrib {
  background: var(--panel-background);
  color: var(--text-muted);
}

.globe .maplibregl-ctrl-attrib a {
  color: inherit;
}

/* Cooperative gestures give phones one-finger scrolling and two-finger map
   moves, but always explain that with an overlay; the behaviour stays, the
   overlay does not. */
.globe .maplibregl-cooperative-gesture-screen {
  display: none;
}

.globe .maplibregl-ctrl-top-left {
  top: 84px;
  left: calc(var(--gutter) - 10px);
}

.globe .maplibregl-ctrl-group {
  border: 1px solid var(--rule);
  background: var(--panel-background);
  box-shadow: none;
}

.globe .maplibregl-ctrl-group button + button {
  border-top-color: var(--rule);
}

.globe .maplibregl-ctrl-icon {
  filter: invert(1);
}

.stop-pin {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 2px solid var(--text);
  border-radius: 50%;
  background: var(--background);
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* A dot this small is hard to hit; the invisible ring makes it easier. */
.stop-pin::after {
  content: "";
  position: absolute;
  inset: -12px;
}

.stop-pin:hover {
  background: var(--text);
}

.stop-pin.is-current {
  background: var(--accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 24px var(--accent);
}

/* ---- About: rises over the globe as it pulls back to the whole Earth ---- */

.about {
  position: relative;
  margin-top: calc(-0.4 * var(--screen-height));
  padding: calc(0.4 * var(--screen-height)) var(--gutter) 15vh;
  background: linear-gradient(to bottom, transparent, var(--background) calc(0.4 * var(--screen-height)));
}

.about-inner {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 520px);
  justify-content: center;
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
}

.about-photo {
  border-radius: 16px;
}

.about h2 {
  margin-bottom: 16px;
  font-size: 2rem;
}

.about p {
  color: var(--text-muted);
}

.about-facts {
  margin: 24px 0 0;
}

.about-facts dt {
  margin-top: 14px;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.about-facts dt:first-child {
  margin-top: 0;
}

.about-facts dd {
  margin: 4px 0 0;
}

/* ---- Get in touch: mirrors the hero, its photo fading up out of the page ---- */

.get-in-touch {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 80vh;
  overflow: hidden;
  text-align: center;
}

.get-in-touch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    var(--background),
    transparent 45%,
    color-mix(in srgb, var(--background) 50%, transparent)
  );
}

.get-in-touch-inner {
  position: relative;
  z-index: 1;
}

.get-in-touch h2 {
  margin-bottom: 24px;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.site-credit {
  position: absolute;
  right: var(--gutter);
  bottom: 24px;
  z-index: 1;
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.6;
  text-shadow: var(--text-shadow-over-imagery);
}

.get-in-touch-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---- Content rises in as it scrolls into view; browsers without
        scroll-driven animations show it in place ---- */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal-on-scroll {
      animation: rise-into-view linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 35%;
    }
  }
}

@keyframes rise-into-view {
  from {
    opacity: 0;
    translate: 0 40px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

/* ---- Photo viewer: a native <dialog>, so Esc, focus and the inert page
        behind it come from the browser ---- */

html:has(.photo-viewer[open]) {
  overflow: hidden;
}

.photo-viewer {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  background: var(--background);
  color: var(--text);
  overflow: hidden;
}

.photo-viewer::backdrop {
  background: transparent;
}

.photo-viewer-backdrop {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  filter: blur(48px) brightness(0.45);
  scale: 1.2;
}

.photo-viewer-strip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0;
  padding: 0 50%;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.photo-viewer-strip li {
  flex: 0 0 auto;
  scroll-snap-align: center;
}

.photo-viewer-strip img {
  width: auto;
  height: auto;
  max-width: 86vw;
  max-height: 78dvh;
  border-radius: 8px;
}

.photo-viewer-close,
.photo-viewer-previous,
.photo-viewer-next {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--panel-background);
  color: var(--text);
  font: inherit;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.photo-viewer-close {
  top: 20px;
  right: var(--gutter);
}

.photo-viewer-name {
  position: absolute;
  top: 30px;
  left: var(--gutter);
  right: calc(var(--gutter) + 64px);
  font-size: 1.25rem;
  text-shadow: var(--text-shadow-over-imagery);
}

.photo-viewer-previous,
.photo-viewer-next {
  top: 50%;
  translate: 0 -50%;
}

.photo-viewer-previous {
  left: var(--gutter);
}

.photo-viewer-next {
  right: var(--gutter);
}

.photo-viewer-previous:disabled,
.photo-viewer-next:disabled {
  opacity: 0.3;
  cursor: default;
}

.photo-viewer-date {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  font-size: 0.9375rem;
  color: var(--text-muted);
  text-align: center;
}

@media (prefers-reduced-motion: no-preference) {
  .photo-viewer-strip {
    scroll-behavior: smooth;
  }

  .photo-viewer[open] {
    animation: fade-in 0.25s ease;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ---- Phones: the places nav becomes a strip under the header, and the
        photos become a band along the bottom ---- */

@media (max-width: 720px) {
  .site-nav {
    gap: 16px;
  }

  .side-label {
    display: none;
  }

  .places {
    --photos-cover-right: 0px;
    --photos-cover-bottom: 48svh;
  }

  .stop {
    align-items: flex-end;
  }

  .stop-panel {
    width: 100%;
    height: var(--photos-cover-bottom);
  }

  .stop-panel,
  .stop:first-child .stop-panel,
  .stop:last-child .stop-panel {
    mask-image: linear-gradient(to bottom, transparent, #000 18%);
  }

  .places.is-photos-hidden .stop-panel {
    translate: 0 100%;
  }

  .stop-photos {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 48px 16px 92px;
  }

  .stop-photos li:first-child {
    grid-column: auto;
    grid-row: 1 / -1;
  }

  .stop-label {
    left: 16px;
    right: 16px;
    bottom: 20px;
  }

  .stop-name {
    font-size: 1.25rem;
  }

  .photos-toggle {
    top: auto;
    right: 50%;
    bottom: var(--photos-cover-bottom);
    translate: 50% 50%;
    rotate: 90deg;
  }

  .places.is-photos-hidden .photos-toggle {
    right: 50%;
    bottom: 72px;
    translate: 50% 50%;
    rotate: -90deg;
  }

  .globe .maplibregl-ctrl-top-left {
    top: 96px;
  }

  .places-nav {
    top: 56px;
    left: 0;
    right: 0;
    transform: none;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .places-nav ol {
    display: flex;
    gap: 18px;
    width: max-content;
    padding: 0 var(--gutter);
    border-left: none;
  }

  .places-nav a {
    white-space: nowrap;
  }

  .photo-viewer-previous,
  .photo-viewer-next {
    top: auto;
    bottom: 16px;
    translate: none;
  }

  .about-inner {
    grid-template-columns: minmax(0, 420px);
  }

  .site-credit {
    left: var(--gutter);
    text-align: center;
  }
}
