/* Route view: map + trip journal. Used by /map, /share/<token> and the landing demo. */

.page-route main {
  height: calc(100dvh - var(--header-h));
}

.route-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(460px, 42%);
  height: 100%;
  background: var(--paper);
}

/* ------------------------------------------------------------------ map */

.route-map {
  position: relative;
  min-height: 320px;
  isolation: isolate; /* keep Leaflet's z-indexes under the site header */
  background: var(--paper-deep);
}

.route-map.leaflet-container {
  font-family: var(--font-body);
}

/* Soften the OpenStreetMap tiles towards the paper palette. */
.route-map .leaflet-tile-pane {
  filter: sepia(0.28) saturate(0.72) hue-rotate(-6deg) brightness(1.03) contrast(0.94);
}

.route-map .leaflet-bar {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-s);
}

.route-map .leaflet-bar a {
  width: 34px;
  height: 34px;
  border-bottom-color: var(--line);
  background: var(--card);
  color: var(--ink);
  line-height: 34px;
}

.route-map .leaflet-bar a:hover {
  background: var(--paper);
}

.route-map .leaflet-control-attribution {
  background: rgb(255 253 248 / 0.8);
  color: var(--ink-muted);
  font-size: 11px;
}

.pin-icon {
  border: 0;
  background: none;
}

.pin {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fffdf8;
  font: 600 13px/1 var(--font-mono);
  box-shadow: 0 0 0 3px #fffdf8, 0 6px 14px rgb(31 42 51 / 0.35);
  transition: transform 0.2s var(--ease), background-color 0.2s;
}

.leaflet-marker-icon:hover .pin,
.leaflet-marker-icon:focus-visible .pin {
  transform: scale(1.1);
}

.pin.is-active {
  background: var(--ink);
  transform: scale(1.22);
}

.leaflet-tooltip.pin-tooltip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  font: 500 13px/1.3 var(--font-body);
}

.leaflet-tooltip.pin-tooltip::before {
  display: none;
}

/* ------------------------------------------------------------------ journal */

.journal {
  overflow-y: auto;
  padding: 32px 28px 48px;
  border-left: 1px solid var(--line);
  background: var(--paper);
  overscroll-behavior: contain;
}

.journal-head {
  padding-bottom: 24px;
  margin-bottom: 20px;
  border-bottom: 2px dashed var(--line-strong);
}

.journal-title {
  margin: 10px 0 14px;
  font-size: clamp(30px, 3vw, 38px);
  font-weight: 540;
  font-variation-settings: "opsz" 96, "SOFT" 50;
  line-height: 1.05;
}

.journal-story {
  color: var(--ink);
  font: 400 18px/1.62 var(--font-display);
  font-variation-settings: "opsz" 18;
}

.journal-story .muted {
  font: 400 15px/1.5 var(--font-body);
}

.journal-empty {
  display: grid;
  gap: 16px;
  justify-items: start;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------ stops */

.stops {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 0;
  list-style: none;
}

/* The dotted route running through the stop numbers. */
.stops::before {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 25px;
  border-left: 2px dotted var(--line-strong);
}

.stop {
  position: relative;
  border-radius: var(--radius);
  transition: background-color 0.2s;
}

.stop.is-active {
  background: var(--card);
  box-shadow: var(--shadow-s), 0 0 0 1px var(--line);
}

.stop-head {
  display: grid;
  grid-template-columns: 28px 56px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  text-align: left;
  cursor: pointer;
}

.stop-head:hover {
  background: rgb(31 42 51 / 0.04);
}

.stop.is-active .stop-head:hover {
  background: none;
}

.stop-num {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fffdf8;
  font: 600 12px/1 var(--font-mono);
  box-shadow: 0 0 0 3px var(--paper);
}

.stop.is-active .stop-num {
  background: var(--ink);
  box-shadow: 0 0 0 3px var(--card);
}

.stop-thumb {
  width: 56px;
  height: 56px;
  border: 3px solid #fff;
  border-radius: 6px;
  background: var(--paper-deep);
  box-shadow: var(--shadow-s);
  object-fit: cover;
}

.stop-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.stop-place {
  overflow: hidden;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stop.is-active .stop-place {
  white-space: normal;
}

.stop-place.is-pending {
  color: var(--ink-muted);
}

.stop-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ink-muted);
  border-bottom: 2px solid var(--ink-muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s var(--ease);
}

.stop.is-active .stop-chevron {
  transform: rotate(225deg) translate(-2px, -2px);
}

.stop-body {
  display: grid;
  gap: 14px;
  padding: 4px 16px 20px 54px;
}

.stop-photo-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: zoom-in;
}

.stop-photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: var(--paper-deep);
  object-fit: cover;
}

.stop-photo figcaption {
  display: flex;
  flex-wrap: wrap;
  column-gap: 14px;
  margin-top: 8px;
}

.stop-photo figcaption span {
  white-space: nowrap;
}

.stop-insight {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.stop-description {
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.6;
}

.tips {
  display: grid;
  gap: 8px;
  width: 100%;
}

.tips-title {
  color: var(--ink-muted);
  font: 500 11.5px/1.4 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tips ul {
  display: grid;
  gap: 2px;
  padding: 0;
  list-style: none;
}

.tip {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
  line-height: 1.45;
}

.tip-kind {
  padding-top: 2px;
  color: var(--sea);
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tip-name {
  font-weight: 600;
}

.tip-note {
  display: block;
  color: var(--ink-soft);
}

.insight-error {
  display: grid;
  gap: 8px;
  justify-items: start;
  color: var(--ink-muted);
  font-size: 14.5px;
}

/* ------------------------------------------------------------------ small screens */

@media (max-width: 860px) {
  .page-route main {
    height: auto;
  }

  .route-view {
    grid-template-columns: 1fr;
    height: auto;
  }

  .page-route .route-map {
    position: sticky;
    top: var(--header-h);
    z-index: 1;
    height: 42vh;
    height: 42dvh;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 20px -14px rgb(31 42 51 / 0.4);
  }

  .journal {
    overflow: visible;
    padding: 24px var(--gutter) 64px;
    border-left: 0;
  }

  .stop-body {
    padding-left: 16px;
  }
}

/* ------------------------------------------------------------------ embedded (landing demo) */

.route-view--embedded {
  height: 640px;
}

.route-view--embedded .journal-title {
  font-size: 30px;
}

@media (max-width: 860px) {
  .route-view--embedded {
    height: auto;
  }

  .route-view--embedded .route-map {
    height: 320px;
  }

  .route-view--embedded .journal {
    max-height: 520px;
    overflow-y: auto;
  }
}
