/*==============================================*\
|| TerraLoc – The photo map                       ||
|| css/photomap.css                               ||
\*==============================================*/

/*
 * Every photo athletes took on a public day out, piled where it was taken.
 * Approved as shared/web_mockups/photomap/ on 09.10.2026.
 *
 * Tokens and kit only. Colour stays where the theme puts it: sport hues in
 * the small rail and dots, ochre on the ascent figure and nowhere else,
 * orange (live, the CTA) not at all. The photos are the colour on this page.
 *
 * Anything drawn ON the map sits on the basemap, not on the page, and the
 * athlete picks the basemap: the prints are light on every one of them, the
 * way a photo is a print on any table.
 */

.tl-photomap-page {
  --tl-pm-top-offset: 0px;
  --tl-pm-panel-w: 392px;
  --tl-pm-print: #FFFFFF;
  --tl-pm-print-edge: rgba(35, 40, 31, .10);
  --tl-pm-shadow: 0 1px 2px rgba(35, 40, 31, .18), 0 6px 16px rgba(35, 40, 31, .22);
  --tl-pm-shadow-hot: 0 2px 4px rgba(35, 40, 31, .2), 0 14px 30px rgba(35, 40, 31, .3);
  --tl-pm-dark: #14180F;
}

.tl-pm-map[data-tl-basemap="dark"],
.tl-pm-map[data-tl-basemap="satellite"] {
  --tl-pm-print: #ECE9DE;
  --tl-pm-print-edge: rgba(0, 0, 0, .3);
  --tl-pm-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 18px rgba(0, 0, 0, .55);
  --tl-pm-shadow-hot: 0 2px 4px rgba(0, 0, 0, .55), 0 16px 34px rgba(0, 0, 0, .65);
}

.tl-pm-shell {
  /* svh so the panel is not pushed off by a phone's collapsing toolbar,
     with vh first for anything that does not know svh. */
  height: calc(100vh - var(--tl-pm-top-offset, 0px));
  height: calc(100svh - var(--tl-pm-top-offset, 0px));
  min-height: 560px;
  overflow: hidden;
}

.tl-pm-stage { position: relative; height: 100%; }

.tl-pm-map {
  position: absolute; inset: 0; z-index: 0;
  background: var(--tl-paper-deep);
}

/* The map's own controls keep the corners every map page uses; the style
   picker in the top left moves clear of the panel. */
@media (min-width: 861px) {
  .tl-pm-map .maplibregl-ctrl-top-left { left: calc(var(--tl-pm-panel-w) + 24px); }
}

/* -------------------------------------------------------- the piles */

/* One marker is a column: the print, a dashed leader, the dot on the spot.
   It is anchored at the bottom, so the dot is the point. */
.tl-pm-pin {
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
}
.tl-pm-pin.is-behind { visibility: hidden; }

.tl-pm-leader {
  width: 0; height: 12px;
  border-left: 1.5px dashed var(--tl-ink);
  opacity: .55;
}
.tl-pm-map[data-tl-basemap="dark"] .tl-pm-leader,
.tl-pm-map[data-tl-basemap="satellite"] .tl-pm-leader { border-left-color: #F3F2EC; }

.tl-pm-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tl-ink);
  box-shadow: 0 0 0 2px var(--tl-pm-print);
}

.tl-pm-print {
  --s: 72px;
  --rot: 0deg;
  position: relative;
  display: block;
  width: calc(var(--s) + 10px);
  padding: 5px 5px 0;
  border: 0; border-radius: 2px;
  background: var(--tl-pm-print);
  box-shadow: 0 0 0 1px var(--tl-pm-print-edge), var(--tl-pm-shadow);
  transform: rotate(var(--rot));
  transform-origin: 50% 100%;
  cursor: pointer;
  pointer-events: auto;
  transition: transform .18s ease, box-shadow .18s ease;
}

/* A pile reads as a pile: two more prints under the top one, askew, so
   twenty photos never look like one. */
.tl-pm-print.is-pile::before,
.tl-pm-print.is-pile::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: 2px;
  background: var(--tl-pm-print);
  box-shadow: 0 0 0 1px var(--tl-pm-print-edge), 0 2px 6px rgba(0, 0, 0, .14);
}
.tl-pm-print.is-pile::before { transform: rotate(4.5deg) translate(3px, -1px); }
.tl-pm-print.is-pile::after  { transform: rotate(-3.5deg) translate(-3px, 1px); }

.tl-pm-print:hover,
.tl-pm-pin.is-hot .tl-pm-print {
  transform: rotate(0deg) scale(1.07);
  box-shadow: 0 0 0 1px var(--tl-pm-print-edge), var(--tl-pm-shadow-hot);
}
.tl-pm-print:focus-visible {
  outline: none;
  transform: rotate(0deg) scale(1.07);
  box-shadow: 0 0 0 2px var(--tl-accent), var(--tl-pm-shadow-hot);
}
.tl-pm-pin.is-open .tl-pm-print { transform: rotate(0deg); box-shadow: 0 0 0 2.5px var(--tl-accent), var(--tl-pm-shadow-hot); }
.tl-pm-pin.is-open .tl-pm-dot { background: var(--tl-accent); }

/* The mosaic: 1, 2 and 3 photos lay out as themselves, from 4 a 2 by 2, a
   big pile a 3 by 3 with its best photo across four cells. */
.tl-pm-mosaic {
  display: grid; gap: 2px;
  width: var(--s); height: var(--s);
  overflow: hidden;
  background: var(--tl-pm-print);
}
.tl-pm-mosaic img {
  display: block; width: 100%; height: 100%; min-height: 0;
  object-fit: cover;
  background: var(--tl-hairline);
}
.tl-pm-mosaic.n1 { grid-template: 1fr / 1fr; }
.tl-pm-mosaic.n2 { grid-template: 1fr / 1fr 1fr; }
.tl-pm-mosaic.n3 { grid-template: 1fr 1fr / 2fr 1fr; }
.tl-pm-mosaic.n3 img:first-child { grid-row: span 2; }
.tl-pm-mosaic.n4 { grid-template: 1fr 1fr / 1fr 1fr; }
.tl-pm-mosaic.n6 { grid-template: repeat(3, 1fr) / repeat(3, 1fr); }
.tl-pm-mosaic.n6 img:first-child { grid-row: span 2; grid-column: span 2; }

/* The leg rail at its smallest: the sports in the pile, by share. */
.tl-pm-rail { display: flex; gap: 2px; height: 9px; padding: 3px 0; }
.tl-pm-rail i { display: block; height: 3px; border-radius: 1px; min-width: 3px; }

/* The count sits on the corner like a sticker. Ink, not orange: orange is
   live, and nothing here is. */
.tl-pm-count {
  position: absolute; top: -9px; right: -10px;
  min-width: 24px; height: 22px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--tl-ink); color: var(--tl-paper);
  box-shadow: 0 0 0 2px var(--tl-pm-print);
  font: 700 11px/1 var(--tl-font-mono); font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  transform: rotate(calc(var(--rot) * -1));
}

/* A photo alone, close in: the photo plate of the design direction, time
   on the left and height on the right. The print is light on every
   basemap, so its words are the light face's ink, never the theme's. */
.tl-pm-cap {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  height: 20px; padding: 0 1px;
  font: 600 9.5px/1 var(--tl-font-mono); font-variant-numeric: tabular-nums;
  color: #5C6253; letter-spacing: .02em;
}
.tl-pm-print.has-cap .tl-pm-rail { display: none; }

.tl-pm-pin.is-new .tl-pm-print { animation: tl-pm-drop .32s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes tl-pm-drop {
  from { opacity: 0; transform: translateY(-8px) rotate(var(--rot)) scale(.85); }
  to   { opacity: 1; transform: rotate(var(--rot)); }
}
@media (prefers-reduced-motion: reduce) {
  .tl-pm-pin.is-new .tl-pm-print { animation: none; }
  .tl-pm-print { transition: none; }
}

/* -------------------------------------------------------- the panel */

.tl-pm-panel {
  position: absolute; z-index: 5;
  top: 16px; left: 16px; bottom: 16px;
  width: var(--tl-pm-panel-w);
  display: flex; flex-direction: column;
  background: var(--tl-panel);
  border: 1px solid var(--tl-hairline); border-radius: 12px;
  box-shadow: var(--tl-lift-lg);
  overflow: hidden;
}
.tl-pm-panel-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--tl-hairline); }
.tl-pm-handle { display: none; }
.tl-pm-title {
  margin: .35rem 0 0;
  font-family: var(--tl-font-display); font-weight: 800;
  font-size: 1.7rem; line-height: 1.02; letter-spacing: -.025em;
  color: var(--tl-ink);
}
.tl-pm-sub { margin: .45rem 0 0; font-size: .88rem; line-height: 1.45; color: var(--tl-muted); }

/* The instrument band, small: 1px gaps on a hairline ground. */
.tl-pm-band {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
  margin-top: 14px;
  background: var(--tl-hairline);
  border: 1px solid var(--tl-hairline); border-radius: 8px; overflow: hidden;
}
.tl-pm-band > div { background: var(--tl-panel); padding: 8px 10px 9px; min-width: 0; }
.tl-pm-band .tl-lbl { display: block; font-size: 9.5px; letter-spacing: .18em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-pm-band b {
  display: block; margin-top: 3px;
  font: 600 1.45rem/1 var(--tl-font-mono); font-variant-numeric: tabular-nums;
  color: var(--tl-ink);
}

.tl-pm-scroll { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 14px 20px 20px; }

.tl-pm-filters { display: flex; flex-direction: column; gap: 10px; }
.tl-pm-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-pm-filters .tl-seg-item { height: 28px; padding: 0 11px; }

/* The sports: one line that scrolls, bleeding to the panel's edges. */
.tl-pm-chips {
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  margin: 0 -20px; padding: 0 20px 2px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 20px, #000 calc(100% - 36px), transparent);
          mask-image: linear-gradient(to right, transparent 0, #000 20px, #000 calc(100% - 36px), transparent);
}
.tl-pm-chips::-webkit-scrollbar { display: none; }
.tl-pm-sport {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--tl-hairline); border-radius: 999px;
  background: var(--tl-panel); color: var(--tl-ink);
  font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.tl-pm-sport::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tl-pm-sport em { font-style: normal; font: 500 11px/1 var(--tl-font-mono); color: var(--tl-dim); }
.tl-pm-sport:hover { border-color: var(--tl-hairline-strong); }
.tl-pm-sport[aria-pressed="true"] { background: var(--tl-ink); border-color: var(--tl-ink); color: var(--tl-paper); }
.tl-pm-sport[aria-pressed="true"] em { color: var(--tl-paper); opacity: .7; }

.tl-pm-list-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin: 20px 0 8px;
}
.tl-pm-all {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0; border: 0; background: none;
  font-size: 12px; font-weight: 600; color: var(--tl-muted); cursor: pointer;
}
.tl-pm-all:hover { color: var(--tl-accent); }

/* One day, its photos as a justified row: every photo keeps its shape. */
.tl-pm-day { margin: 0 0 16px; }
.tl-pm-day-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 0; margin: 0 0 6px;
  border: 0; background: none; text-align: left; cursor: pointer;
  color: var(--tl-ink);
}
.tl-pm-day-head::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tl-pm-day-title {
  flex: 1 1 auto; min-width: 0;
  font-weight: 650; font-size: .88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-pm-day-head:hover .tl-pm-day-title { color: var(--tl-accent); }
.tl-pm-day-meta { flex: 0 0 auto; font: 500 11px/1 var(--tl-font-mono); font-variant-numeric: tabular-nums; color: var(--tl-dim); }
.tl-pm-jr { display: flex; flex-wrap: wrap; gap: 4px; }
.tl-pm-jr::after { content: ""; flex: 999 1 0; }
.tl-pm-th {
  position: relative; display: block;
  flex: var(--ar) 1 calc(var(--ar) * 78px);
  padding: 0; border: 0; border-radius: 2px;
  overflow: hidden; cursor: pointer;
  background: var(--tl-hairline);
}
.tl-pm-th img { display: block; width: 100%; aspect-ratio: var(--ar); object-fit: cover; transition: transform .25s ease; }
.tl-pm-th:hover img, .tl-pm-th:focus-visible img { transform: scale(1.05); }
.tl-pm-th:focus-visible { outline: 2px solid var(--tl-accent); outline-offset: 1px; }
.tl-pm-th.is-open { box-shadow: 0 0 0 2px var(--tl-accent); }
.tl-pm-more { width: 100%; justify-content: center; }

.tl-pm-empty {
  padding: 18px 14px; text-align: center;
  border: 1px dashed var(--tl-hairline-strong); border-radius: 8px;
  color: var(--tl-muted); font-size: .88rem; line-height: 1.45;
}

/* Loading, a failure, the cap: one line over the map, centred on what the
   panel leaves free. */
.tl-pm-note {
  position: absolute; z-index: 4; bottom: 28px;
  left: calc(var(--tl-pm-panel-w) + 32px); right: 16px;
  margin: 0 auto; width: max-content; max-width: calc(100% - var(--tl-pm-panel-w) - 48px);
  padding: 8px 14px; border-radius: 999px;
  background: var(--tl-panel); border: 1px solid var(--tl-hairline);
  box-shadow: var(--tl-lift);
  font-size: .84rem; color: var(--tl-ink);
}

/* --------------------------------------------------------- the card */

/* Docked, like the live map's photo card, in the corner the panel leaves
   free. The photo is the card: full width, its own shape, nothing framing
   it above or below. */
.tl-pm-card {
  position: absolute; z-index: 6;
  top: 16px; right: 16px;
  width: 440px; max-height: calc(100% - 32px);
  display: flex; flex-direction: column;
  background: var(--tl-panel);
  border: 1px solid var(--tl-hairline); border-radius: 12px;
  box-shadow: var(--tl-lift-lg);
  overflow: hidden;
  transform: translateX(calc(100% + 24px));
  visibility: hidden;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .28s;
}
.tl-pm-card.is-open { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) { .tl-pm-card, .tl-pm-card.is-open { transition: none; } }

.tl-pm-card-photo { position: relative; flex: 0 0 auto; background: var(--tl-pm-dark); }
/* As tall as the photo's shape asks, up to what the words below leave. A
   portrait that reaches it keeps all of itself and gets dark sides, never
   bars above and below. */
.tl-pm-card-photo img {
  display: block; width: 100%; height: auto;
  aspect-ratio: var(--ar, 1.333);
  max-height: var(--tl-pm-photo-max, min(62vh, 600px));
  object-fit: contain;
}
.tl-pm-card-shade {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 10px;
  padding: 36px 14px 11px;
  background: linear-gradient(to bottom, rgba(10, 12, 8, 0), rgba(10, 12, 8, .62));
  font: 600 12px/1 var(--tl-font-mono); font-variant-numeric: tabular-nums;
  letter-spacing: .03em; color: #F3F2EC;
  pointer-events: none;
}
.tl-pm-ico {
  position: absolute;
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: rgba(20, 24, 15, .55); color: #F3F2EC;
  cursor: pointer; backdrop-filter: blur(6px);
  transition: background .15s, opacity .2s;
}
.tl-pm-ico:hover { background: rgba(20, 24, 15, .85); }
.tl-pm-ico:focus-visible { outline: 2px solid #F3F2EC; outline-offset: 2px; }
.tl-pm-card-x { top: 12px; right: 12px; }
.tl-pm-card-where { top: 12px; left: 12px; }
.tl-pm-card-nav { top: 50%; margin-top: -19px; width: 38px; height: 38px; }
.tl-pm-card-nav[disabled] { opacity: 0; pointer-events: none; }
.tl-pm-card-nav.is-prev { left: 12px; }
.tl-pm-card-nav.is-next { right: 12px; }
@media (hover: hover) {
  .tl-pm-card-nav { opacity: 0; }
  .tl-pm-card-photo:hover .tl-pm-card-nav:not([disabled]),
  .tl-pm-card-nav:focus-visible { opacity: 1; }
}

/* The day, as a filmstrip: where this photo sits among the others. */
.tl-pm-film {
  flex: 0 0 auto;
  display: flex; gap: 4px;
  padding: 8px 10px;
  overflow-x: auto; scrollbar-width: none;
  background: var(--tl-pm-dark);
}
.tl-pm-film::-webkit-scrollbar { display: none; }
.tl-pm-film:empty { display: none; }
.tl-pm-film button {
  flex: 0 0 auto; position: relative;
  width: 46px; height: 46px; padding: 0;
  border: 0; border-radius: 3px; overflow: hidden;
  background: #2C3625; cursor: pointer;
  opacity: .55; transition: opacity .15s;
}
.tl-pm-film button:hover { opacity: .9; }
.tl-pm-film button.is-on { opacity: 1; }
.tl-pm-film button.is-on::after { content: ""; position: absolute; inset: 0; border: 2px solid #F3F2EC; border-radius: 3px; }
.tl-pm-film button:focus-visible { outline: 2px solid #F3F2EC; outline-offset: -2px; opacity: 1; }
.tl-pm-film img { display: block; width: 100%; height: 100%; object-fit: cover; }

.tl-pm-card-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 18px 16px; }
.tl-pm-card-kicker { display: flex; justify-content: space-between; gap: 10px; }
.tl-pm-card-title {
  display: block; margin: .35rem 0 0;
  font-family: var(--tl-font-display); font-weight: 800;
  font-size: 1.35rem; line-height: 1.1; letter-spacing: -.02em;
  color: var(--tl-ink); text-decoration: none;
}
.tl-pm-card-title:hover { color: var(--tl-accent); }
.tl-pm-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  margin-top: 10px;
  font: 500 12px/1 var(--tl-font-mono); font-variant-numeric: tabular-nums;
  color: var(--tl-muted);
}
.tl-pm-card-meta .tl-pm-up { color: var(--tl-terra); font-weight: 600; }
.tl-pm-chipsport {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--tl-hairline); background: var(--tl-panel);
  font: 600 11.5px/1 var(--tl-font-body); color: var(--tl-ink);
}
.tl-pm-chipsport::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.tl-pm-card-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--tl-hairline);
}
.tl-pm-card-who {
  flex: 1 1 auto; min-width: 0;
  font-size: .88rem; font-weight: 600; color: var(--tl-ink); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-pm-card-who:hover { color: var(--tl-accent); }
.tl-pm-card-foot .tl-btn { flex: 0 0 auto; gap: 8px; }
.tl-pm-ava {
  flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tl-accent-dim); color: var(--tl-ink);
  font: 700 11px/1 var(--tl-font-mono);
}

/* Report: the activity lightbox's flow in the card's clothes. */
.tl-pm-flag { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.tl-pm-flag:empty { display: none; }
.tl-pm-flag-ask { flex: 1 1 100%; margin: 0; font-size: .82rem; line-height: 1.4; color: var(--tl-ink); }
.tl-pm-flag-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--tl-hairline); border-radius: 999px;
  background: var(--tl-panel); color: var(--tl-muted);
  font-size: 12.5px; cursor: pointer;
}
.tl-pm-flag-btn:hover { border-color: var(--tl-hairline-strong); color: var(--tl-ink); }
.tl-pm-flag-btn.is-confirm { background: var(--tl-ink); border-color: var(--tl-ink); color: var(--tl-paper); font-weight: 600; }
.tl-pm-flag-btn:disabled { cursor: default; opacity: .6; }
.tl-pm-flag-btn.is-done:disabled { opacity: 1; border-color: transparent; background: none; color: var(--tl-dim); }

/* ----------------------------------------------------------- phones */

@media (max-width: 860px) {
  .tl-pm-panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: auto; height: 46%;
    border-radius: 14px 14px 0 0; border-bottom: 0;
    transition: height .25s ease;
  }
  .tl-pm-panel.is-low { height: 148px; }
  .tl-pm-handle {
    display: block; width: 100%; height: 18px; margin: -10px 0 4px;
    border: 0; background: none; cursor: pointer;
  }
  .tl-pm-handle::before {
    content: ""; display: block; width: 40px; height: 4px; margin: 6px auto 0;
    border-radius: 2px; background: var(--tl-hairline-strong);
  }
  .tl-pm-panel-head { padding: 12px 16px; }
  .tl-pm-title { font-size: 1.35rem; }
  .tl-pm-sub { display: none; }
  .tl-pm-band { margin-top: 10px; }
  .tl-pm-band b { font-size: 1.15rem; }
  .tl-pm-scroll { padding: 12px 16px 18px; }
  .tl-pm-chips { margin: 0 -16px; padding: 0 16px 2px; }
  .tl-pm-note { left: 16px; top: 16px; bottom: auto; max-width: calc(100% - 32px); }

  .tl-pm-card {
    top: auto; left: 0; right: 0; bottom: 0;
    width: auto; max-height: 86%;
    border-radius: 14px 14px 0 0; border-bottom: 0;
    transform: translateY(calc(100% + 24px));
  }
  .tl-pm-card-photo img { max-height: 46vh; }

  .tl-pm-mosaic { width: calc(var(--s) * .78); height: calc(var(--s) * .78); }
  .tl-pm-print { width: calc(var(--s) * .78 + 10px); }
  .tl-pm-print.has-cap .tl-pm-mosaic { width: var(--s); height: var(--s); }
  .tl-pm-print.has-cap { width: calc(var(--s) + 10px); }
}
