/* Fonts are self-hosted from /fonts (SIL Open Font License; see the OFL-*.txt files there). */
@font-face {
  font-family: "Courier Prime";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/courier-prime-400-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Courier Prime";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/courier-prime-400-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Courier Prime";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/courier-prime-700-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Courier Prime";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/courier-prime-700-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/fraunces-600-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/fraunces-600-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Aegean blues: the table shades very slightly from the lighter one to the deeper one. */
  --sea: #1a5591;
  --sea-light: #1f5f9e;
  --sea-deep: #164a82;
  --paper: #fbf9f4;
  --ink: #2b2a28;
  --type: "Courier Prime", "Courier New", ui-monospace, monospace;
  --serif: "Fraunces", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--paper); background: var(--sea); }

/* A felt-like Aegean-blue table top. */
.table-page, .map-page {
  background-color: var(--sea);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 .08 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(to bottom, var(--sea-light), var(--sea-deep));
  background-attachment: fixed;
  min-height: 100dvh;
}

/* Header */
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding: 14px max(20px, env(safe-area-inset-left)) 6px;
  position: relative;
  z-index: 2;
}
.logo {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.3rem, 2.4vw, 1.65rem);
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--paper);
  text-decoration: none;
}
.masthead nav { display: flex; gap: 18px; }
.masthead nav a, .info nav a {
  color: rgb(251 249 244 / 0.85);
  font: 500 15px/1.4 var(--sans);
  text-decoration: none;
  border-bottom: 1px solid rgb(251 249 244 / 0.3);
}
.masthead nav a:hover, .info nav a:hover { color: #fff; border-bottom-color: #fff; }

/* A Polaroid print: even border on three sides, a deep bottom edge with a handwritten caption. */
.polaroid {
  --pw: 220px;
  display: block;
  width: var(--pw);
  padding: calc(var(--pw) * 0.055) calc(var(--pw) * 0.055) 0;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25), 0 10px 24px -6px rgb(0 0 0 / 0.45);
  -webkit-tap-highlight-color: transparent;
}
.polaroid .photo {
  display: block;
  aspect-ratio: var(--frame, 1/1);
  background: var(--c, #777);
  overflow: hidden;
  position: relative;
}
.polaroid .photo::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08); }
.polaroid img { display: block; width: 100%; height: 100%; object-fit: cover; }
.polaroid .caption {
  display: block;
  height: calc(var(--pw) * 0.21);
  line-height: calc(var(--pw) * 0.21);
  padding: 0 0.4em;
  font-family: var(--type);
  font-size: calc(var(--pw) * 0.064);
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The table. Without JS it's a tidy wall of prints; table.js scatters them. */
.table {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  padding: 24px 20px 60px;
}
.table .polaroid:nth-child(3n) { rotate: -3deg; }
.table .polaroid:nth-child(3n + 1) { rotate: 2deg; }

/* Hidden until table.js scatters the prints, but shown anyway if it never does. */
.js .table:not(.scattered) { visibility: hidden; animation: reveal 0s 2s forwards; }
@keyframes reveal { to { visibility: visible; } }
.table.scattered { display: block; position: relative; padding: 0; margin: 0 auto; isolation: isolate; }
.table.scattered .polaroid { animation: drop 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) backwards; }
@keyframes drop { from { opacity: 0; scale: 1.3; } }
.table.scattered .polaroid {
  position: absolute;
  left: 0;
  top: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: manipulation;
  transition: scale 0.18s ease, box-shadow 0.18s ease, rotate 0.25s ease;
}
.table.scattered .polaroid img { pointer-events: none; }
.table.scattered .polaroid:hover { scale: 1.035; }
.table.scattered .polaroid.held {
  cursor: grabbing;
  scale: 1.07;
  transition: scale 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.2), 0 28px 44px -10px rgb(0 0 0 / 0.55);
}
@media (pointer: coarse) {
  .table.scattered .polaroid { cursor: pointer; }
  .table.scattered .polaroid:hover { scale: none; }
}

/* A print picked up off the table, shown whole. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  background: rgb(8 30 58 / 0.74);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s ease;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }
.lightbox .polaroid {
  cursor: zoom-in;
  rotate: var(--from-rotate, 0deg);
  scale: 0.55;
  transition: scale 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.15), rotate 0.32s ease;
}
.lightbox.open .polaroid { scale: 1; rotate: -1.2deg; }
.lightbox .close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--paper);
  font: 300 34px/1 var(--sans);
  cursor: pointer;
}

/* One cat, full screen. */
.viewer { height: 100dvh; overflow: hidden; background: #0b0b0b; }
.stage {
  position: fixed;
  inset: 0;
  background-color: color-mix(in oklab, var(--c) 38%, #0b0b0b);
  transition: background-color 0.6s ease;
  touch-action: none;
  cursor: pointer;
  user-select: none;
}
.shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.35s ease;
  -webkit-user-drag: none;
}
.shot.current { opacity: 1; }
.viewer-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-left)) 32px;
  background: linear-gradient(rgb(0 0 0 / 0.45), transparent);
  pointer-events: none;
  z-index: 1;
}
.viewer-top .logo { pointer-events: auto; text-shadow: 0 1px 8px rgb(0 0 0 / 0.4); }
.info {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: baseline;
  gap: 8px 18px;
  flex-wrap: wrap;
  padding: 36px max(18px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgb(0 0 0 / 0.6));
  pointer-events: none;
}
.info > * { pointer-events: auto; }
.info .label { font: 700 1rem/1.2 var(--type); }
.info .hint { font: 14px/1 var(--sans); opacity: 0.7; transition: opacity 0.6s; }
.info .hint.gone { opacity: 0; }
.info nav { display: flex; gap: 16px; margin-left: auto; }

/* Map */
.map-page { display: flex; flex-direction: column; height: 100dvh; }
.map { flex: 1; background: var(--sea-deep); }
.unmapped {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  translate: -50% 0;
  rotate: -1.5deg;
  z-index: 1000;
  margin: 0;
  padding: 6px 16px;
  background: #fff8c9;
  color: var(--ink);
  font: 700 1rem/1.3 var(--type);
  white-space: nowrap;
  box-shadow: 0 6px 14px -4px rgb(0 0 0 / 0.4);
}
.pin { display: block; cursor: pointer; }
.pin .polaroid { --pw: 46px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 10px -2px rgb(0 0 0 / 0.5); transition: scale 0.15s ease; }
.pin .polaroid .caption { font-size: 0; }
.pin:hover .polaroid { scale: 1.12; }
.stack { position: relative; width: 46px; height: 53px; }
.stack .polaroid { position: absolute; left: 0; top: 0; }
.stack .count {
  position: absolute;
  right: -12px;
  top: -12px;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 13px;
  background: #fff8c9;
  color: var(--ink);
  font: 700 13px/26px var(--type);
  text-align: center;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.35);
}
.maplibregl-popup-content { background: transparent; box-shadow: none; padding: 0; }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup .polaroid { --pw: 220px; rotate: -2deg; }

/* 404 */
.lost {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 40px 20px 80px;
  font: 700 1.15rem/1.3 var(--type);
  text-align: center;
}
.lost .polaroid { --pw: min(300px, 72vw); rotate: -3deg; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
