/* =========================================================
   About me: a marine field notebook
   Loaded only on about-me.html, after journal.css. A taped
   instant photo, an info label, the bio on truly ruled
   notebook paper, and a LinkedIn-style logbook with a logo tile
   per entry. Type stays the site's two families.
   Motion: the photo drops in, the compass needle swings and
   settles, the wave rule draws itself; all once, all gentle
   or off under reduced motion.
   ========================================================= */

:root {
  --line-h: 2rem;           /* the notebook's rule spacing; text sits on these lines */
  --notepaper: #fffdf7;
  --tape: rgba(226, 210, 160, .75);
}

/* ---------- Cover: the title and a compass rose ---------- */

.notebook-hero .container { position: relative; }
.compass { position: absolute; right: var(--space-6); top: 0; width: 120px; height: 120px; color: var(--ink); }
.compass text { font-family: var(--serif); font-style: italic; }
/* The needle swings in and settles a touch east of north, like a real card finding its heading. */
.compass-needle { transform-box: view-box; transform-origin: 60px 60px; transform: rotate(8deg); animation: needle-settle 1700ms var(--ease-out) 300ms backwards; }
@keyframes needle-settle {
  0% { transform: rotate(-150deg); }
  45% { transform: rotate(30deg); }
  70% { transform: rotate(-6deg); }
  88% { transform: rotate(12deg); }
  100% { transform: rotate(8deg); }
}
@media (max-width: 767.98px) {
  .compass { width: 72px; height: 72px; top: auto; bottom: var(--space-8); }
}

/* ---------- The spread: specimen column + ruled page ---------- */

.notebook-spread { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--space-16); align-items: start; }
.specimen-col { display: grid; gap: var(--space-12); position: sticky; top: calc(var(--nav-h) + var(--space-8)); }
@media (max-width: 899.98px) {
  .notebook-spread { grid-template-columns: minmax(0, 1fr); gap: var(--space-12); }
  .specimen-col { position: static; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); align-items: start; gap: var(--space-8); }
}
@media (max-width: 599.98px) { .specimen-col { grid-template-columns: minmax(0, 1fr); } .polaroid { max-width: 280px; justify-self: center; } }

/* Instant photo, taped into the notebook. Drops in once; straightens when you point at it. */
.polaroid {
  position: relative; margin: 0; padding: 12px 12px 0;
  background: #fffefa; border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(22, 24, 29, .12), 0 14px 28px -14px rgba(22, 24, 29, .4);
  transform: rotate(-2.5deg);
  transition: transform var(--motion-300) var(--ease-out);
  animation: photo-drop 700ms var(--ease-out) 150ms backwards;
}
.polaroid img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; filter: saturate(.92) contrast(1.02); }
.polaroid figcaption { padding: var(--space-3) 0 var(--space-4); text-align: center; font-family: var(--serif); font-style: italic; font-size: var(--text-body); line-height: 1.4; color: var(--ink-soft); }
.polaroid::before, .polaroid::after {
  content: ""; position: absolute; top: -12px; width: 92px; height: 26px; z-index: 1;
  background: var(--tape); box-shadow: 0 1px 1px rgba(22, 24, 29, .08);
}
.polaroid::before { left: -16px; transform: rotate(-32deg); }
.polaroid::after { right: -16px; transform: rotate(28deg); }
@media (hover: hover) and (pointer: fine) { .polaroid:hover { transform: rotate(0deg) scale(1.015); } }
@keyframes photo-drop { from { opacity: 0; transform: translate3d(0, -16px, 0) rotate(-7deg); } }

/* Specimen label: the tag tied to a field sample, filled in by hand. */
.specimen-label {
  position: relative; margin: 0; padding: var(--space-4) var(--space-6) var(--space-6);
  background: var(--raised); border: 1px solid var(--ink); border-radius: var(--radius); box-shadow: var(--stack);
}
.specimen-label::before { /* the string hole */
  content: ""; position: absolute; top: 14px; right: 16px; width: 10px; height: 10px;
  border: 1px solid var(--ink); border-radius: 50%; background: var(--paper);
}
.label-head {
  display: flex; justify-content: space-between; gap: var(--space-4);
  margin-bottom: var(--space-2); padding: 0 var(--space-8) var(--space-2) 0;
  border-bottom: 2px solid var(--margin-red);
  font-size: var(--text-meta); font-weight: 600; line-height: 1.4; letter-spacing: .12em; text-transform: uppercase;
}
.label-head span:last-child { font-family: var(--mono); font-weight: 500; letter-spacing: .04em; }
.specimen-label > div:not(.label-head) {
  display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: var(--space-3); align-items: baseline;
  padding: var(--space-2) 0; border-bottom: 1px dotted var(--line);
}
.specimen-label > div:last-child { border-bottom: 0; }
.specimen-label dt { font-size: var(--text-meta); font-weight: 600; line-height: 1.4; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.specimen-label dd { margin: 0; font-family: var(--sans); font-size: var(--text-secondary); line-height: 1.5; color: var(--ink); }

/* Ruled notebook page: the rules sit exactly under each line of text. */
.ruled-page {
  position: relative; max-width: 46rem;
  padding: var(--line-h) var(--space-8) var(--line-h) calc(var(--space-12) + var(--space-4));
  background-color: var(--notepaper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--line-h) - 1px), rgba(66, 72, 237, .17) calc(var(--line-h) - 1px) var(--line-h));
  background-position: 0 -7px; /* drops each rule just under the text's baseline */
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--stack);
}
.ruled-page::before { /* the red margin line */
  content: ""; position: absolute; top: 0; bottom: 0; left: var(--space-12); width: 1px; background: var(--margin-red);
}
.ruled-page h2 { margin: 0; font-size: var(--step-4); line-height: calc(var(--line-h) * 2); }
.ruled-page p { margin: 0 0 var(--line-h); font-size: 1.0625rem; line-height: var(--line-h); color: var(--ink-soft); }
.ruled-page p:last-child { margin-bottom: 0; }
.ruled-page .dropcap::first-letter { font-size: calc(var(--line-h) * 2.4); line-height: calc(var(--line-h) * 2); margin: .1em .12em 0 0; }
@media (max-width: 599.98px) {
  .ruled-page { padding-left: var(--space-8); padding-right: var(--space-4); }
  .ruled-page::before { left: var(--space-4); }
}

/* ---------- The logbook (LinkedIn-style, one logo tile per entry) ---------- */

/* An engraved swell: a faint ink wave behind a blue breaking wave, drifting in opposite
   directions like a real sea. Each layer is a tile one wavelength wide, so the curls never
   stretch at any width and the drift loops seamlessly (transform only). */
.wave-rule {
  position: relative; height: 64px; margin-bottom: var(--space-8); overflow: hidden;
  clip-path: inset(0);
  transition: clip-path 1400ms var(--ease-out) 100ms, opacity var(--motion-300) var(--ease-out), transform var(--motion-300) var(--ease-out);
}
/* It sweeps in from the left the first time it reaches the screen. */
html.js-reveal .wave-rule[data-reveal]:not(.is-revealed) { clip-path: inset(0 100% 0 0); }
.wave-track { position: absolute; background-repeat: repeat-x; will-change: transform; }
.wave-back {
  top: 4px; left: -100px; right: 0; height: 40px; opacity: .35;
  background-image: url(../img/wave-back.svg); background-size: 100px 40px;
  animation: swell-right 16s linear infinite;
}
.wave-front {
  top: 14px; left: 0; right: -120px; height: 48px;
  background-image: url(../img/wave-front.svg); background-size: 120px 48px;
  animation: swell-left 11s linear infinite;
}
@keyframes swell-left { to { transform: translate3d(-120px, 0, 0); } }
@keyframes swell-right { to { transform: translate3d(100px, 0, 0); } }

.logbook { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-12) var(--space-16); }
@media (max-width: 767.98px) { .logbook { grid-template-columns: minmax(0, 1fr); gap: var(--space-12); } }
.log-group { padding: 0; }
.log-group h3 {
  display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap;
  margin: 0 0 var(--space-2); padding-bottom: var(--space-3); border-bottom: 2px solid var(--ink);
  font-size: var(--step-2);
}
.log-group ul { list-style: none; margin: 0; padding: 0; }
.log-group li {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: var(--space-4); align-items: center;
  padding: var(--space-4) 0; border-bottom: 1px solid var(--line);
}
.log-group strong { display: block; font-family: var(--serif); font-size: var(--step-1); font-weight: 500; line-height: 1.3; color: var(--ink); }
.log-group li span:not(.org-logo) { display: block; font-size: var(--text-secondary); line-height: 1.5; color: var(--muted); }

/* LinkedIn-style: the logo itself fills the tile, no frame or padding around it. */
.org-logo {
  display: block; width: 52px; height: 52px; object-fit: contain; border-radius: 4px;
  transition: transform var(--motion-200) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .log-group li:hover .org-logo { transform: rotate(-4deg); } }

/* ---------- Favorite trips: ink passport stamps ---------- */

.trips-section { padding-top: 0; }
/* Favorite trips and songs sit under the "Outside research" heading, one level down. */
.section-head--sub { margin-bottom: var(--space-6); }
.section-head--sub h3 { margin: 0; font-size: var(--step-3); }
/* Four to a row on a laptop, spread edge to edge, with every other stamp pressed a little
   lower so the page reads like a well-used passport rather than a grid. */
.trips {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); justify-items: center; align-items: center;
  gap: var(--space-10, 2.5rem) var(--space-6); list-style: none; margin: 0; padding: var(--space-4) 0 var(--space-8);
}
.trip { flex: none; }
.trip:nth-child(even) { margin-top: var(--space-8); }
@media (max-width: 899.98px) { .trips { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* A passport stamp: its own shape, ink and angle, with a small engraved drawing of the place. */
.trip-face {
  display: grid; place-items: center; align-content: center; gap: 2px;
  padding: var(--space-3); text-align: center; color: var(--stamp-ink, var(--ink));
  border: 2px solid currentColor; outline: 1px solid currentColor; outline-offset: 4px;
  opacity: .86; transform: rotate(var(--tilt, 0deg));
  transition: transform var(--motion-200) var(--ease-out), opacity var(--motion-150) var(--ease-out);
}
.trip--round { width: 156px; height: 156px; border-radius: 50%; }
.trip--oval  { width: 186px; height: 140px; border-radius: 50%; }
.trip--badge { width: 168px; height: 156px; border-radius: 28px; border-style: double; border-width: 4px; outline-offset: 5px; }
/* Postage stamp: the dotted outline reads as a perforated edge. */
.trip--post  { width: 138px; height: 166px; border-radius: 2px; outline: 3px dotted currentColor; outline-offset: 5px; }
.trip-icon { width: 40px; height: 40px; margin-bottom: 2px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.trip-icon .dot, .trip-icon .fill { fill: currentColor; stroke: none; }
.trip-icon .fill { fill-rule: evenodd; } /* holes in the shape show the paper, like an orca's white patches */
.trip-country { max-width: 8em; font-family: var(--serif); font-size: var(--text-body); font-weight: 600; line-height: 1.15; letter-spacing: .05em; text-transform: uppercase; }
.trip-coords { font-family: var(--mono); font-size: var(--text-meta); letter-spacing: .02em; }
/* Each stamp presses down the first time the row reaches the screen, staggered by the reveal. */
html.js-reveal .trip[data-reveal]:not(.is-revealed) .trip-face { opacity: 0; transform: rotate(var(--tilt, 0deg)) scale(1.3); }
@media (hover: hover) and (pointer: fine) { .trip:hover .trip-face { opacity: 1; transform: rotate(0deg); } }
@media (max-width: 599.98px) {
  .trips { gap: var(--space-6) var(--space-3); }
  .trip-face { padding: var(--space-2); }
  .trip--round { width: 156px; height: 156px; }
  .trip--badge { width: 160px; height: 146px; }
  .trip--oval { width: 162px; height: 128px; }
  .trip--post { width: 142px; height: 158px; }
  .trip-icon { width: 34px; height: 34px; }
  .trip-country { font-size: .9rem; letter-spacing: .03em; }
  .trip-coords { white-space: nowrap; letter-spacing: 0; }
}

/* ---------- Trip albums: each stamp opens a scrapbook page ---------- */

.trips-hint { margin: var(--space-2) 0 0; font-family: var(--serif); font-style: italic; color: var(--ink-soft); }
/* The stamps are buttons now; keep them looking like ink, not form controls. */
button.trip-face { font: inherit; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
button.trip-face:focus-visible { opacity: 1; transform: rotate(0deg); box-shadow: 0 0 0 9px var(--paper), 0 0 0 11px var(--brand); }
button.trip-face:active { transform: rotate(0deg) scale(.96); }

html.album-open { overflow: hidden; }
.trip-album {
  width: min(1040px, calc(100vw - 32px)); max-width: none; max-height: none; margin: auto;
  padding: 0; border: 0; background: transparent; color: var(--ink); overflow: visible;
}
.trip-album::backdrop { background: rgba(22, 24, 29, .55); }
.trip-album[open]::backdrop { animation: fade-in 250ms var(--ease-out); }
.album-page {
  position: relative; max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain;
  padding: var(--space-8) var(--space-12) var(--space-12);
  background-color: var(--notepaper); border: 1px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--stack), 0 30px 60px -24px rgba(5, 13, 36, .55);
}
.trip-album[open] .album-page { animation: album-in 420ms var(--ease-out); }
@keyframes album-in { from { opacity: 0; transform: translate3d(0, 24px, 0) scale(.98); } }

.album-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: start; gap: var(--space-4);
  margin-bottom: var(--space-8); padding-bottom: var(--space-4); border-bottom: 2px solid var(--margin-red);
}
.album-coords { margin: 0; font-family: var(--mono); font-size: var(--text-meta); letter-spacing: .06em; color: var(--muted); }
.album-head h2 { margin: var(--space-1) 0 0; font-size: var(--step-4); color: var(--stamp-ink, var(--ink)); }
.album-note { margin: var(--space-2) 0 0; font-family: var(--serif); font-style: italic; color: var(--ink-soft); }
/* The trip's own stamp, pressed into the page corner at a smaller size. */
.album-stamp-wrap { position: relative; width: 104px; height: 104px; }
.album-stamp {
  position: absolute; top: 0; right: 0; color: var(--stamp-ink, var(--ink)); opacity: .9;
  transform-origin: top right; transform: rotate(var(--album-tilt, 0deg)) scale(.62);
}
.trip-album[open] .album-stamp { animation: album-stamp-press 520ms var(--ease-out) 260ms backwards; }
@keyframes album-stamp-press { from { opacity: 0; transform: rotate(calc(var(--album-tilt, 0deg) - 10deg)) scale(.9); } }
.album-close {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; cursor: pointer;
  background: var(--raised); color: var(--ink); border: 1px solid var(--ink); border-radius: 50%;
  transition: transform var(--motion-150) var(--ease-out);
}
.album-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.album-close:hover { transform: rotate(90deg); }
.album-close:active { transform: scale(.94); }

/* The collage: taped instant photos in loose columns, each at its own small angle. */
/* Columns are filled by trips.js (shortest column first) and stretch to a shared bottom edge;
   any spare height in a column is spread between its frames, so no column stops short. */
.album-grid { display: flex; align-items: stretch; gap: var(--space-8); }
.album-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; list-style: none; margin: 0; padding: 0; }
.album-photo { padding: var(--space-3) 0 var(--space-6); }
.album-photo figure {
  position: relative; margin: 0; padding: 10px 10px 0; background: #fffefa;
  border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(22, 24, 29, .12), 0 12px 24px -14px rgba(22, 24, 29, .45);
  transform: rotate(var(--tilt, 0deg)); transition: transform var(--motion-300) var(--ease-out);
}
.album-photo img, .album-placeholder { display: block; width: 100%; height: auto; }
.album-placeholder {
  display: grid; place-items: center; color: var(--muted); font-family: var(--mono); font-size: var(--text-meta); letter-spacing: .06em;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--stamp-ink, var(--ink)) 9%, transparent) 0 10px, transparent 10px 20px), var(--paper);
  border: 1px dashed color-mix(in srgb, var(--stamp-ink, var(--ink)) 35%, transparent);
}
.album-photo figcaption { padding: var(--space-2) var(--space-1) var(--space-3); text-align: center; font-family: var(--serif); font-style: italic; font-size: var(--text-secondary); line-height: 1.4; color: var(--ink-soft); }
.album-photo:not(:has(figcaption)) figure { padding-bottom: 28px; }
.album-photo.is-taped figure::before {
  content: ""; position: absolute; top: -12px; left: 50%; width: 84px; height: 24px; z-index: 1;
  background: var(--tape); transform: translateX(-50%) rotate(-3deg); box-shadow: 0 1px 1px rgba(22, 24, 29, .08);
}
/* Photos drop onto the page one after another when the album opens. */
.trip-album[open] .album-photo figure { animation: album-photo-drop 520ms var(--ease-out) backwards; animation-delay: calc(140ms + var(--i, 0) * 70ms); }
@keyframes album-photo-drop { from { opacity: 0; transform: translate3d(0, -14px, 0) rotate(calc(var(--tilt, 0deg) - 6deg)); } }
@media (hover: hover) and (pointer: fine) {
  .album-photo figure:hover { transform: rotate(0deg) scale(1.02); z-index: 2; }
}

@media (max-width: 599.98px) {
  .trip-album { width: calc(100vw - 16px); }
  .album-page { max-height: calc(100dvh - 16px); padding: var(--space-6) var(--space-4) var(--space-8); }
  .album-head { grid-template-columns: minmax(0, 1fr) auto; }
  .album-stamp-wrap { display: none; }
  .album-grid { gap: var(--space-4); }
  .album-photo figure { padding: 6px 6px 0; }
}

/* ---------- Preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  .polaroid { animation-name: fade-in; transition: none; }
  .compass-needle { animation: none; }
  .wave-rule { transition: none; }
  .wave-track { animation: none; }
  .org-logo { transition: none; }
  .trip-album[open] .album-page, .trip-album[open] .album-stamp, .trip-album[open] .album-photo figure, .trip-album[open]::backdrop { animation: none; }
  .album-photo figure, .album-close { transition: none; }
}

/* Trips with no surviving photos keep their stamp but are not clickable. */
button.trip-face.is-plain { cursor: default; }

/* ---------- Trip map: a sea chart with a pin per stamp ---------- */

.trip-map { margin: var(--space-4) 0 var(--space-12); }
.map-sheet {
  position: relative; aspect-ratio: 1000 / 372.2; padding: 0;
  background-color: var(--notepaper); border: 1px solid var(--ink); border-radius: var(--radius); box-shadow: var(--stack);
  overflow: hidden;
}
.map-land, .map-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-land { opacity: .9; }
.map-lines .graticule { stroke: var(--pen); stroke-opacity: .12; stroke-width: 1; vector-effect: non-scaling-stroke; }
.map-lines .equator { stroke-opacity: .25; stroke-dasharray: 4 4; }
.map-lines .leader { stroke: var(--ink); stroke-opacity: .55; stroke-width: 1; vector-effect: non-scaling-stroke; }
.map-pins { position: absolute; inset: 0; }

/* Pins: a dot in the stamp's ink on a paper ring. They drop in when the map reaches the screen. */
.map-pin {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; padding: 0; border-radius: 50%;
  background: var(--stamp-ink, var(--ink)); border: 2px solid var(--notepaper); box-shadow: 0 0 0 1px var(--stamp-ink, var(--ink)), 0 2px 4px rgba(22, 24, 29, .35);
  cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: transform var(--motion-150) var(--ease-out);
}
/* A bigger invisible hit area, so small pins are easy to tap. */
button.map-pin::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; }
button.map-pin::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--stamp-ink, var(--ink));
  opacity: 0; transform: scale(.6); transition: opacity var(--motion-200) var(--ease-out), transform var(--motion-200) var(--ease-out);
}
button.map-pin:focus-visible { outline: 2px solid var(--brand); outline-offset: 6px; }
@media (hover: hover) and (pointer: fine) {
  button.map-pin:hover { transform: scale(1.25); }
  button.map-pin:hover::after { opacity: .5; transform: scale(1); }
}
button.map-pin:active { transform: scale(.9); }
.map-pin.is-plain { background: var(--notepaper); cursor: default; }

.map-label {
  position: absolute; transform: translate(0, -50%); padding: 1px 6px; white-space: nowrap; pointer-events: none;
  font-family: var(--mono); font-size: var(--text-meta); letter-spacing: .06em; text-transform: uppercase; line-height: 1.5;
  color: var(--stamp-ink, var(--ink)); background: var(--notepaper); border: 1px solid currentColor; border-radius: 3px;
}
.map-label--left { transform: translate(-100%, -50%); }
.map-label.is-plain { border-style: dashed; opacity: .75; }

html.js-reveal .trip-map[data-reveal]:not(.is-revealed) .map-pin { opacity: 0; transform: translate3d(0, -10px, 0); }
.trip-map .map-pin { transition: transform var(--motion-300) var(--ease-out), opacity var(--motion-300) var(--ease-out); }

/* On phones the map is too small for labels; the stamps below name every place. */
@media (max-width: 699.98px) {
  .map-label, .map-lines .leader { display: none; }
  .map-pin { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
}

@media (prefers-reduced-motion: reduce) {
  .map-pin, button.map-pin::after { transition: none; }
  html.js-reveal .trip-map[data-reveal]:not(.is-revealed) .map-pin { transform: none; }
}

/* Other places: soft ink dots, quieter than the favorite pins. Places close together share a
   small numbered marker. Hover or tap shows a little card with the name, or the list. */
.map-mark {
  position: absolute; padding: 0; cursor: pointer; border: 0; color: var(--ink);
  -webkit-appearance: none; appearance: none; font: inherit;
}
.map-dot { width: 18px; height: 18px; margin: -9px 0 0 -9px; background: none; }
.map-dot::before { /* the dot itself; the button around it is a bigger, easier target */
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 55%, transparent); box-shadow: 0 0 0 2px var(--notepaper);
  transition: transform var(--motion-150) var(--ease-out), background-color var(--motion-150) var(--ease-out);
}
.map-group {
  display: grid; place-items: center; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%;
  background: var(--notepaper); border: 1.5px solid color-mix(in srgb, var(--ink) 65%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent);
  transition: transform var(--motion-150) var(--ease-out);
}
.map-count { font-family: var(--mono); font-size: .75rem; font-weight: 600; line-height: 1; color: var(--ink); }

/* The name card (or list card) that appears above a dot or group. */
.map-card {
  position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 4; display: grid; gap: 1px;
  padding: 4px 8px; white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, 4px);
  font-family: var(--mono); font-size: var(--text-meta); letter-spacing: .05em; text-transform: uppercase; line-height: 1.5; text-align: left;
  color: var(--ink); background: var(--notepaper); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 6px 14px -8px rgba(22, 24, 29, .45);
  transition: opacity var(--motion-150) var(--ease-out), transform var(--motion-150) var(--ease-out);
}
.map-card b { font-weight: 600; color: var(--muted); letter-spacing: .1em; margin-bottom: 2px; }
.map-mark:hover .map-card, .map-mark:focus-visible .map-card, .map-mark.is-open .map-card { opacity: 1; transform: translate(-50%, 0); }
.map-mark:hover, .map-mark.is-open { z-index: 5; }
@media (hover: hover) and (pointer: fine) {
  .map-dot:hover::before { transform: scale(1.3); background: var(--ink); }
  .map-group:hover { transform: scale(1.1); }
}
.map-dot.is-open::before { background: var(--ink); }
.map-mark:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 50%; }

.map-legend {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin: var(--space-3) 0 0;
  font-family: var(--mono); font-size: var(--text-meta); letter-spacing: .04em; color: var(--ink-soft);
}
.map-legend span { display: inline-flex; align-items: center; gap: var(--space-2); }
.key-pin { width: 12px; height: 12px; border-radius: 50%; background: var(--pen); border: 2px solid var(--notepaper); box-shadow: 0 0 0 1px var(--pen); }
.key-dot { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 55%, transparent); }
.key-group {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-style: normal;
  font-size: .68rem; font-weight: 600; color: var(--ink); border: 1.5px solid color-mix(in srgb, var(--ink) 65%, transparent);
}

@media (prefers-reduced-motion: reduce) { .map-card, .map-dot::before, .map-group { transition: none; } }

/* The map's caption reads in the same small capitals as its "Fig. 2" tag. */
.trip-map figcaption {
  margin-top: var(--space-3); font-family: var(--sans); font-size: var(--text-meta); font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; line-height: 1.6; color: var(--muted);
}
.trip-map figcaption .fig-no { margin-right: var(--space-2); }
/* Group lists are taller, so they open downward where the map has room. */
.map-group .map-card { bottom: auto; top: calc(100% + 8px); transform: translate(-50%, -4px); }
.map-group:hover .map-card, .map-group:focus-visible .map-card, .map-group.is-open .map-card { transform: translate(-50%, 0); }
/* Let name and list cards spill past the map's frame (the phone-size map is short). */
.map-sheet { overflow: visible; }
.map-land { border-radius: var(--radius); }
.trip-map .map-pins { z-index: 2; }
