:root {
  --ink: #111;
  --muted: #666;
  --rule: #ddd;
  --link: #0645ad;
  --visited: #5a3696;
}

html, body { background: #fff; }
body {
  margin: 0;
  color: var(--ink);
  font: 17px/1.55 Georgia, "Times New Roman", serif;
}

.page {
  display: grid;
  grid-template-columns: minmax(260px, 28rem) 1fr;
  gap: 3.5rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

a { color: var(--link); }
a:visited { color: var(--visited); }

h1 { font-size: 1.6rem; font-weight: normal; margin: 0; }
h1 a, h1 a:visited { color: var(--ink); text-decoration: none; }
h2 { font-size: 1.1rem; font-weight: normal; font-style: italic; margin: 0 0 .6rem; }
.tag { margin: .2rem 0 0; color: var(--muted); }

nav { margin: 1.6rem 0 1.8rem; padding: .5rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
nav a { margin-right: 1.2rem; }
nav a.here { color: var(--ink); text-decoration: none; }

.list { padding-left: 1.1rem; margin: 0; }
.list li { margin-bottom: .4rem; }
.muted, .note { color: var(--muted); }

footer { margin-top: 3rem; font-size: .85rem; color: var(--muted); }

.figure { margin: 0; position: sticky; top: 3rem; align-self: start; }
#globe { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: calc(100vh - 8rem); touch-action: none; }
#globe canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#globe canvas.pointing { cursor: pointer; }
#globe canvas:active { cursor: grabbing; }
#globe-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); }
figcaption { margin-top: .6rem; font-size: .85rem; color: var(--muted); }

#tip {
  position: fixed; left: 0; top: 0; pointer-events: none; transform: translate(-9999px, 0);
  padding: 2px 6px; background: #fff; border: 1px solid #999; font-size: .85rem; white-space: nowrap;
}

@media (max-width: 820px) {
  .page { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem 16px; }
  .figure { position: static; order: -1; }
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, 13.5rem); gap: 1.4rem 1rem; }
.grid figure { margin: 0; }
h3 { font-size: 1rem; font-weight: normal; margin: 0 0 .7rem; color: var(--muted); }
.wgroup + .wgroup { margin-top: 2.4rem; }
.grid img, .grid video { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #f3f3f3; }
.grid figcaption { margin-top: .35rem; color: var(--ink); font-size: .85rem; line-height: 1.3; }
.grid figcaption span { display: block; color: var(--muted); }
.figure > figcaption { text-align: center; }

/* A section is open: the text column widens to four gallery squares (4 x 13.5rem + 3 x 1rem),
   and the globe shrinks to the right. Back home, everything returns to the layout above. */
.page { transition: grid-template-columns .35s ease; }
body.open .page { grid-template-columns: minmax(0, 57rem) minmax(160px, 1fr); }
body.open .figure { justify-self: end; width: min(100%, 300px); }
@media (max-width: 820px) {
  body.open .page { grid-template-columns: 1fr; }
  body.open .figure { justify-self: center; width: min(100%, 240px); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* video squares: the clip overlays the grid and takes its own (taller) shape while pointed at */
.grid a.vid { display: block; position: relative; aspect-ratio: 1 / 1; }
.grid a.vid video { position: absolute; top: 0; left: 0; height: 100%; transition: height .25s ease; }
.grid a.vid:hover video { z-index: 2; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }

/* Project popups: the <span class="pop"> after a link appears while the line is pointed at or focused. */
.list li { position: relative; }
.pop {
  position: absolute; left: 0; top: 100%; z-index: 5; margin-top: .25rem;
  width: max-content; max-width: min(22rem, 85vw);
  padding: .45rem .65rem; background: #fff; border: 1px solid var(--rule);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  font-size: .85rem; line-height: 1.4; color: var(--muted);
  opacity: 0; visibility: hidden; transform: translateY(-2px);
  transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
  pointer-events: none;
}
.list li:hover > .pop, .list li:focus-within > .pop {
  opacity: 1; visibility: visible; transform: none;
  transition-delay: .12s, .12s, 0s;
}
