/* ── Public map — full viewport ─────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Custom markers — shared base ────────────────────────────────────────────── */

/* Outer wrapper: zero-size, transparent — Mapbox translates this element.
   Never put transitions or transforms on this layer. */
.tmd-marker {
  cursor: pointer;
  width: 0;
  height: 0;
}

/* Inner element: the visible dot. Safe to transition because Mapbox
   never touches this element directly. */
.tmd-marker-inner {
  display: block;
  transition: transform 0.15s ease;
  transform-origin: center center;
}

.tmd-marker:hover .tmd-marker-inner {
  transform: scale(1.35);
}

.tmd-marker:focus-visible .tmd-marker-inner {
  outline: 3px solid #0057b7;
  outline-offset: 3px;
}

/* ── Tier: standard — small red dot ──────────────────────────────────────────── */

.tmd-marker--standard .tmd-marker-inner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e03c31;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  /* Centre the dot on the coordinate point */
  margin-top: -8px;
  margin-left: -8px;
}

/* ── Tier: good — larger green dot ───────────────────────────────────────────── */

.tmd-marker--good .tmd-marker-inner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2ecc71;
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  margin-top: -11px;
  margin-left: -11px;
}

/* ── Tier: crash — skull emoji, no dot ───────────────────────────────────────── */

.tmd-marker--crash .tmd-marker-inner {
  font-size: 18px;
  line-height: 1;
  user-select: none;
  /* Centre the emoji on the coordinate point */
  margin-top: -9px;
  margin-left: -9px;
}

/* ── Video modal ─────────────────────────────────────────────────────────────── */

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.video-modal.hidden {
  display: none;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.video-modal-content {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.45);
  width: 100%;
  max-width: 720px;
  overflow: hidden;
}

.video-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid #e0e0e0;
}

.video-modal-meta {
  flex: 1;
  min-width: 0;
}

.video-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-modal-date {
  font-size: 0.82rem;
  color: #666;
  margin: 0 0 0.15rem;
}

.video-modal-video-title {
  font-size: 0.85rem;
  color: #444;
  margin: 0;
  font-style: italic;
}

.video-modal-close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #666;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: color 0.1s;
}

.video-modal-close:hover {
  color: #111;
}

.video-embed-wrap {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}

.video-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Mobile ─────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .video-modal {
    padding: 0;
    align-items: flex-end;
  }

  .video-modal-content {
    border-radius: 12px 12px 0 0;
    max-width: 100%;
  }
}
