/* Full-screen loading lock while tab data/tracks are loading. */
#app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(16, 20, 24, 0.78);
  backdrop-filter: blur(1.5px);
  pointer-events: auto;
}

body.skadi-loading #app-loading-overlay {
  display: flex;
}

.app-loading-overlay-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: rgba(255, 255, 255, 0.95);
  animation: skadi-loading-spin 0.75s linear infinite;
}

@keyframes skadi-loading-spin {
  to { transform: rotate(360deg); }
}

/* Popup photo icon (same line as activity name, icon only) */
.popup-photos-row {
  display: inline;
  margin-left: 0.35em;
}

.popup-photos-btn {
  display: inline;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3em;
  line-height: inherit;
  vertical-align: baseline;
}

.popup-photos-btn:hover {
  opacity: 0.8;
}

.popup-photos-btn:focus {
  outline: none;
}

.popup-journal-row {
  display: inline;
  margin-left: 0.35em;
}

.popup-journal-btn {
  display: inline;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3em;
  line-height: inherit;
  vertical-align: baseline;
}

.popup-journal-btn:hover {
  opacity: 0.8;
}

.popup-journal-btn:focus {
  outline: none;
}

.popup-journal-text {
  margin-top: 8px;
  margin-bottom: 0;
  white-space: pre-wrap;
  line-height: 1.4;
}

/* Center the Strava/Komoot link in track popups (Mac-like neat UX). */
.mapboxgl-popup .popup-activity-link {
  display: block;
  width: fit-content;
  margin: 6px auto 0;
  text-align: center;
}

/* journal popup min width — adjust here (Mapbox GL) */
.mapboxgl-popup.journal-text-popup .mapboxgl-popup-content-wrapper {
  min-width: 520px;
}

.mapboxgl-popup.journal-text-popup .mapboxgl-popup-content {
  margin-bottom: 1px;
}

/* Ensure track popups always render above summit triangles (markers are DOM overlays too). */
.mapboxgl-popup {
  z-index: 10000 !important;
}

/* Neat UX: rounded corners + subtle softness (Mac-like). */
.mapboxgl-popup-content {
  border-radius: 8px !important;
  overflow: hidden;
  padding-right: 12px;
  background: #333;
  color: #fff;
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.mapboxgl-popup[class*="mapboxgl-popup-anchor-top"] .mapboxgl-popup-tip {
  border-bottom-color: #333 !important;
}

.mapboxgl-popup[class*="mapboxgl-popup-anchor-bottom"] .mapboxgl-popup-tip {
  border-top-color: #333 !important;
}

.mapboxgl-popup[class*="mapboxgl-popup-anchor-left"] .mapboxgl-popup-tip {
  border-right-color: #333 !important;
}

.mapboxgl-popup[class*="mapboxgl-popup-anchor-right"] .mapboxgl-popup-tip {
  border-left-color: #333 !important;
}

/* Track popup header: [Title] [📷] [📖] [×] */
.track-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

/* Summit popup header: [Title] [×] — one row, × right, no overlap */
.summit-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.summit-popup-title {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 1.08em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-popup-title {
  font-weight: bold;
  font-size: 1.08em;
  white-space: nowrap;
}

.summit-popup-close,
.track-popup-close {
  flex: 0 0 auto;
  margin-left: auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  color: rgba(255, 255, 255, 0.72);
}

.summit-popup-close:hover,
.track-popup-close:hover {
  color: #fff;
}

/* Avoid the old inline margins inside the flex header row. */
.track-popup-header .popup-photos-row,
.track-popup-header .popup-journal-row {
  margin-left: 0 !important;
  display: flex;
  align-items: center;
}

/* Make the emoji buttons sit neatly in the header. */
.track-popup-header .popup-photos-btn,
.track-popup-header .popup-journal-btn {
  font-size: 1.15em;
  padding: 0;
}

.summit-popup-body,
.track-popup-body,
.popup-journal-text {
  color: #fff;
}

.summit-popup-body b,
.track-popup-body b {
  color: #fff;
}

/* Adventure enriched: one inset value on all sides (overrides global padding-right + Mapbox defaults). */
.mapboxgl-popup.adventure-enriched-popup {
  --adventure-popup-inner: 24px;
}

.mapboxgl-popup.adventure-enriched-popup .mapboxgl-popup-content {
  padding: var(--adventure-popup-inner) !important;
  box-sizing: border-box;
}

.mapboxgl-popup.adventure-enriched-popup .mapboxgl-popup-close-button {
  top: calc(var(--adventure-popup-inner) * 0.5) !important;
  right: calc(var(--adventure-popup-inner) * 0.5) !important;
}

/* Adventure enriched point popup: text + photo side by side on wide viewports */
.mapboxgl-popup.adventure-enriched-popup .adventure-enriched-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.mapboxgl-popup.adventure-enriched-popup .adventure-enriched-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.mapboxgl-popup.adventure-enriched-popup .adventure-enriched-note {
  font-style: italic;
  margin-top: 0.5em;
}

/* Portrait slot height = prior 280px (desktop) / 360px (mobile) × 1.3; landscape uses same frame */
.mapboxgl-popup.adventure-enriched-popup .adventure-enriched-photo-frame {
  flex: 0 1 auto;
  min-width: 0;
  width: 100%;
  height: 468px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.mapboxgl-popup.adventure-enriched-popup .adventure-enriched-photo-open {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 6px;
  position: relative;
}

/* Height-first: both portrait and landscape scale up to fill the frame height (landscape was width-first before, which kept the bitmap small). */
.mapboxgl-popup.adventure-enriched-popup .adventure-enriched-thumb {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

@media (min-width: 768px) {
  .mapboxgl-popup.adventure-enriched-popup .mapboxgl-popup-content-wrapper {
    min-width: min(936px, calc(100vw - 24px));
  }

  .mapboxgl-popup.adventure-enriched-popup .adventure-enriched-body {
    flex-direction: row;
    align-items: flex-start;
  }

  .mapboxgl-popup.adventure-enriched-popup .adventure-enriched-meta {
    flex: 1 1 42%;
    min-width: 0;
  }

  .mapboxgl-popup.adventure-enriched-popup .adventure-enriched-photo-frame {
    flex: 0 1 58%;
    min-width: 0;
    height: 364px;
  }
}

.mapboxgl-popup .popup-activity-link {
  background: #45818e;
}

.mapboxgl-popup .popup-activity-link:hover {
  background: #45818e;
}

.mapboxgl-popup-close-button {
  border-radius: 6px;
  top: 4px !important;
  right: 4px !important;
}

/* Bottom-left FAB row: 3D (left) then gap then legend “i” — tweak --skadi-3d-gap / --skadi-legend-fab-*; debug button on localhost matches #map-3d-toggle */
:root {
  --skadi-legend-fab-left: 12px;
  --skadi-legend-fab-bottom: 28px;
  --skadi-legend-fab-size: 42px;
  --skadi-3d-gap: 8px;
  /* Horizontal position of the legend “i” FAB (right-hand of the pair) */
  --skadi-legend-toggle-left: calc(var(--skadi-legend-fab-left) + var(--skadi-legend-fab-size) + var(--skadi-3d-gap));
  --skadi-accent: #45818e;
  --skadi-fab-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  --skadi-fab-ring-selected: 0 0 0 2px var(--skadi-accent), var(--skadi-fab-shadow);
}

/* Hidden legend toggle and panel */
#legend-toggle-btn {
  position: absolute;
  left: var(--skadi-legend-toggle-left);
  bottom: var(--skadi-legend-fab-bottom);
  z-index: 1001;
  width: var(--skadi-legend-fab-size);
  height: var(--skadi-legend-fab-size);
  border: none;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-weight: bold;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--skadi-fab-shadow);
}

#legend-toggle-btn[aria-expanded="true"] {
  box-shadow: var(--skadi-fab-ring-selected);
}

#legend-toggle-btn:hover {
  background: #444;
}

#legend-toggle-btn.hidden {
  display: none;
}

/* Panel stays left-aligned with the map edge like before the 3D / “i” swap */
#map-legend {
  position: absolute;
  left: var(--skadi-legend-fab-left);
  bottom: calc(var(--skadi-legend-fab-bottom) + var(--skadi-legend-fab-size) + 8px);
  z-index: 1001;
  width: 230px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 10px;
  border-radius: 5px;
  background: #333;
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  font-family: Arial, sans-serif;
  font-size: 13px;
}

#map-legend.hidden {
  display: none;
}

#adventure-live-banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 1003;
  max-width: none;
  border: none;
  border-radius: 0;
  padding: 10px 12px;
  background: rgba(61, 49, 49, 0.97);
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#adventure-live-banner.hidden {
  display: none;
}

#adventure-live-banner:hover {
  background: rgba(74, 58, 58, 0.97);
}

#adventure-live-record-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d64b4b;
  opacity: 0;
  flex: 0 0 9px;
  display: none;
}

#adventure-live-banner.is-live-day #adventure-live-record-dot {
  display: block;
  animation: adventure-record-pulse 2.2s ease-in-out infinite;
}

@keyframes adventure-record-pulse {
  0% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.35; transform: scale(0.9); }
}

#adventure-local-controls {
  position: absolute;
  left: 12px;
  top: 48px;
  z-index: 1003;
  width: min(560px, calc(100vw - 24px));
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(51, 51, 51, 0.94);
}

#adventure-local-controls.hidden {
  display: none;
}

#adventure-local-controls button,
#adventure-local-controls input {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
  padding: 7px 9px;
}

#adventure-local-controls button {
  cursor: pointer;
}

#adventure-local-controls button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.adventure-local-point-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

#adventure-point-input {
  flex: 1;
  min-width: 0;
}

#adventure-local-error {
  width: 100%;
  font-size: 12px;
  color: #ffc99e;
}

#adventure-local-error.hidden {
  display: none;
}

.legend-section + .legend-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.legend-title {
  font-weight: bold;
  margin-bottom: 6px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.legend-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
}

.legend-icon svg {
  width: 18px;
  height: 18px;
}

.legend-track-line {
  width: 18px;
  height: 0;
  border-top: 3px solid #fff;
  border-radius: 2px;
}

/* Map 3D / 2D toggle — left of the legend “i” FAB (not inside the legend panel) */
#map-3d-toggle,
#map-3d-toggle-debug {
  position: absolute;
  left: var(--skadi-legend-fab-left);
  bottom: var(--skadi-legend-fab-bottom);
  z-index: 1002;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--skadi-fab-shadow);
}

#map-3d-toggle[aria-pressed="true"] {
  box-shadow: var(--skadi-fab-ring-selected);
}

#map-3d-toggle.hidden,
#map-3d-toggle-debug.hidden {
  display: none;
}

#map-3d-toggle:hover {
  background: #444;
}

/* Localhost only: same geometry as #map-3d-toggle; orange ring = no Mapbox action */
#map-3d-toggle-debug {
  box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.95), var(--skadi-fab-shadow);
  cursor: default;
}

#map-3d-toggle-debug:hover {
  background: #444;
}

/* Skadi chatbot */
#skadi-chat-toggle {
  position: absolute;
  right: 12px;
  bottom: 28px;
  z-index: 1001;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: var(--skadi-fab-shadow);
}

#skadi-chat-toggle[aria-expanded="true"] {
  box-shadow: var(--skadi-fab-ring-selected);
}

#skadi-chat-toggle.hidden {
  display: none;
}

#skadi-chat-toggle:hover {
  background: #444;
}

#skadi-chat-panel {
  position: absolute;
  right: 12px;
  bottom: 78px;
  z-index: 1001;
  width: 320px;
  max-width: calc(100vw - 24px);
  height: 420px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  background: #333;
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  font-family: Arial, sans-serif;
  overflow: hidden;
}

#skadi-chat-panel.hidden {
  display: none;
}

#skadi-chat-header {
  padding: 10px 12px;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

#skadi-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skadi-message {
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.35;
  white-space: pre-line;
}

.skadi-message.skadi-bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.12);
}

.skadi-message.skadi-user {
  align-self: flex-end;
  background: #45818e;
}

#skadi-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

#skadi-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #45818e;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 8px;
}

#skadi-chat-input:focus {
  outline: none;
  border-color: #45818e;
  box-shadow: 0 0 0 1px #45818e;
}

#skadi-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

#skadi-chat-send {
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  background: #45818e;
  color: #fff;
  cursor: pointer;
}

#skadi-chat-send:hover:not(:disabled) {
  background: #45818e;
}

#skadi-chat-send:disabled {
  opacity: 0.65;
  cursor: default;
}

/* Journal panel — fixed; top/height set inline in script.js from <header> offsetHeight */
#map {
  transition: width 300ms ease, height 300ms ease, flex-basis 300ms ease;
}

body.journal-open #map {
  width: 50%;
}

#journal-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 50%;
  z-index: 10050;
  background: #333;
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  font-family: Arial, sans-serif;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms ease, opacity 300ms ease;
  display: flex;
  flex-direction: column;
}

#journal-panel:not(.hidden) {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

#journal-panel-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

#journal-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

#journal-close-btn,
.bike-journal-nav-btn,
.bike-journal-close-btn {
  background: rgba(255, 255, 255, 0.12);
}

#journal-close-btn:hover,
.bike-journal-nav-btn:hover:not(.is-disabled),
.bike-journal-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

#journal-close-btn {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  line-height: 0;
  cursor: pointer;
}

#journal-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

#journal-content {
  padding: 14px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  line-height: 1.5;
}

#journal-content img {
  display: block;
  width: 100%;
  height: auto;
  margin: 12px 0;
}

/* Notion "Code" blocks rendered as Markdown (see script.js notionCodeBlockTreatAsMarkdown) */
.notion-markdown-from-code {
  margin: 0 0 1.25em;
}

.notion-markdown-from-code:last-child {
  margin-bottom: 0;
}

@media (max-width: 767px) {
  body.journal-open #map {
    width: 100%;
    visibility: hidden;
    pointer-events: none;
  }

  #journal-panel {
    width: 100%;
    border-left: none;
  }
}

/* --- Bike immersive journal: document flow, page scroll, sticky étape header --- */
body.bike-journal-open #site-header,
body.bike-journal-open #tabs {
  display: none !important;
}

body.bike-journal-open #tab-content {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100vh;
  overflow: visible;
  position: relative;
}

body.bike-journal-open #map {
  flex: 0 0 auto;
  height: 40vh !important;
  min-height: 25vh;
  width: 100% !important;
  position: relative;
}

#bike-journal-immersive {
  display: none;
  flex-direction: column;
  flex: 0 1 auto;
  width: 100%;
  min-height: 60vh;
  height: auto;
  background: #2a2a2a;
  color: #fff;
  font-family: Arial, sans-serif;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  box-sizing: border-box;
  position: relative;
}

body.bike-journal-open #bike-journal-immersive:not(.hidden) {
  display: flex;
}

/* Title + nav + close + stats: stick to viewport top while markdown scrolls with the page */
.bike-journal-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 10040;
  background: #333;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.bike-journal-frozen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 48px;
}

.bike-journal-title {
  flex: 1;
  margin: 0;
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  min-width: 0;
}

.bike-journal-nav-btn {
  box-sizing: border-box;
  flex-shrink: 0;
  /* Grid + zero line-height: centers the glyph box; avoids flex baseline quirks on <button> */
  display: grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  margin: 0;
  padding: 0;
  padding-top: 0;
  padding-bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.bike-journal-nav-glyph {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  line-height: 1;
}

.bike-journal-nav-glyph-prev::before {
  content: "";
  position: absolute;
  left: 66%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 3px solid #fff;
  border-right: 3px solid #fff;
  transform: translate(-50%, -50%) rotate(-135deg);
}

.bike-journal-nav-glyph-prev::after {
  content: none;
}

.bike-journal-nav-glyph-next::before {
  content: "";
  position: absolute;
  left: 33%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 3px solid #fff;
  border-right: 3px solid #fff;
  transform: translate(-50%, -50%) rotate(45deg);
}

.bike-journal-nav-glyph-next::after {
  content: none;
}

.bike-journal-nav-btn::-moz-focus-inner {
  padding: 0;
  border: 0;
}

.bike-journal-nav-btn:hover:not(.is-disabled) {
  background: rgba(255, 255, 255, 0.22);
  padding: 0;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 0;
}

.bike-journal-nav-btn.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  padding: 0;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 0;
}

.bike-journal-close-btn {
  box-sizing: border-box;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  margin: 0 0 0 4px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 24px;
  line-height: 0;
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.bike-journal-close-glyph {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
}

.bike-journal-close-glyph::before,
.bike-journal-close-glyph::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transform-origin: center;
}

.bike-journal-close-glyph::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.bike-journal-close-glyph::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.bike-journal-close-btn::-moz-focus-inner {
  padding: 0;
  border: 0;
}

.bike-journal-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.bike-journal-stats {
  padding: 8px 14px 12px;
  font-size: 13px;
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bike-journal-stats-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.bike-journal-stats .bike-stat-label {
  font-weight: 600;
  color: #fff;
}

.bike-journal-stats a {
  color: #45818e;
  text-decoration: none;
}

.bike-journal-stats a:hover {
  color: #45818e;
  text-decoration: underline;
}

/* Markdown flows in document scroll (no inner scroll trap) */
.bike-journal-scroll {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  padding: 16px 18px 48px;
  line-height: 1.55;
}

.bike-journal-scroll img {
  display: block;
  width: 100%;
  height: auto;
  margin: 12px 0;
}

.bike-journal-scroll h1,
.bike-journal-scroll h2,
.bike-journal-scroll h3 {
  margin-top: 1.2em;
  margin-bottom: 0.5em;
}

@media (max-width: 767px) {
  body.bike-journal-open #map {
    flex: 0 0 auto;
    height: 25vh !important;
    min-height: 25vh;
  }

  body.bike-journal-open #bike-journal-immersive:not(.hidden) {
    min-height: 75vh;
    height: auto;
  }
}
