:root {
  --t4n-surface: rgba(247, 251, 248, 0.92);
  --t4n-surface-strong: rgba(255, 255, 255, 0.94);
  --t4n-border: rgba(20, 70, 63, 0.12);
  --t4n-ink: #173b39;
  --t4n-ink-soft: #4d6764;
  --t4n-accent: #ef6a61;
  --t4n-accent-secondary: #7c5cff;
  --t4n-map-bg: rgb(199, 242, 239);
  --t4n-shadow: 0 20px 60px rgba(16, 53, 51, 0.18);
}

.t4n-map {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(290px, 360px) 1fr;
  min-height: var(--t4n-map-height, 720px);
  overflow: hidden;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(142, 216, 199, 0.55), transparent 28%),
    linear-gradient(135deg, #edf7f3 0%, #d4eee8 100%);
  box-shadow: var(--t4n-shadow);
}

.t4n-map__sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px 22px 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(242, 249, 246, 0.76));
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--t4n-border);
}

.t4n-map__sidebar-head {
  display: grid;
  gap: 12px;
}

.t4n-map__eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #3a7069;
}

.t4n-map__title {
  margin: 0;
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2.2rem);
  line-height: 1;
  color: var(--t4n-ink);
}

.t4n-map__search {
  box-sizing: border-box;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(23, 59, 57, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--t4n-ink);
  font-size: 15px;
  font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.t4n-map__search::placeholder {
  color: var(--t4n-ink-soft) !important;
  opacity: 1;
}

.t4n-map .t4n-map__search:focus,
.t4n-map .t4n-map__search:not(:placeholder-shown) {
  color: var(--t4n-ink) !important;
}

.t4n-map__search:focus {
  outline: 2px solid rgba(31, 122, 108, 0.35);
  outline-offset: 2px;
}

.t4n-map__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.t4n-map__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(23, 59, 57, 0.1);
  color: var(--t4n-ink);
  font-size: 13px;
}

.t4n-map__legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--marker-color, var(--t4n-accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--marker-color, var(--t4n-accent)) 18%, white);
}

.t4n-map__results {
  display: grid;
  gap: 12px;
  min-height: 120px;
  max-height: calc(var(--t4n-map-height, 720px) - 280px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.t4n-map__results::-webkit-scrollbar {
  width: 4px;
}

.t4n-map__results::-webkit-scrollbar-track {
  background: transparent;
}

.t4n-map__results::-webkit-scrollbar-thumb {
  background: rgba(20, 70, 63, 0.25);
  border-radius: 999px;
}

.t4n-map__results::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 70, 63, 0.45);
}

.t4n-map__site-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(23, 59, 57, 0.08);
  border-radius: 18px;
  background: var(--t4n-surface-strong);
  color: var(--t4n-ink);
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.t4n-map__site-card:hover,
.t4n-map__site-card:focus-visible,
.t4n-map__site-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(31, 122, 108, 0.2);
  box-shadow: 0 16px 30px rgba(21, 58, 56, 0.12);
}

.t4n-map__site-thumb {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(31, 122, 108, 0.1), rgba(124, 92, 255, 0.16));
}

.t4n-map__site-copy {
  display: grid;
  gap: 4px;
}

.t4n-map__site-kicker,
.t4n-map__site-status {
  font-size: 12px;
  color: var(--t4n-ink-soft);
}

.t4n-map__site-title {
  font-size: 14px;
  line-height: 1.35;
}

.t4n-map__empty {
  margin: 0;
  color: var(--t4n-ink-soft);
}

.t4n-map__canvas-wrap {
  position: relative;
  min-width: 0;
  background: var(--t4n-map-bg);
}

.t4n-map__canvas {
  height: 100%;
  min-height: var(--t4n-map-height, 720px);
}

.t4n-map__map-meta {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 500;
  display: grid;
  justify-items: end;
  gap: 8px;
  color: var(--t4n-ink);
}

.t4n-map__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(23, 59, 57, 0.1);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.t4n-map__footer {
  position: absolute;
  right: 18px;
  bottom: 14px;
  left: 18px;
  z-index: 450;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
  color: var(--t4n-ink-soft);
  font-size: 11px;
  line-height: 1.5;
}

.leaflet-tile-pane {
  filter: grayscale(1) url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%3Cfilter%20id%3D't4ncm'%20color-interpolation-filters%3D'sRGB'%3E%3CfeColorMatrix%20type%3D'matrix'%20values%3D'-1.316%200%200%200%201.868%200%20-1.358%200%200%202.072%200%200%20-2.6%200%203.087%200%200%200%201%200'%2F%3E%3C%2Ffilter%3E%3C%2Fsvg%3E#t4ncm");
}

.t4n-map__marker-icon {
  background: transparent;
  border: 0;
}

.t4n-map__marker-shadow {
  position: absolute;
  bottom: 0;
  left: 3px;
  right: 3px;
  height: 8px;
  border-radius: 999px;
  background: rgba(18, 54, 51, 0.28);
  filter: blur(4px);
}

.t4n-map__marker-pin {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--marker-color, var(--t4n-accent));
  transform: none;
  box-shadow: 0 4px 14px rgba(18, 54, 51, 0.35);
  border: 2.5px solid rgba(255, 255, 255, 0.65);
}

.t4n-map__marker-core {
  position: absolute;
  inset: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
}

.t4n-map__leaflet-popup .leaflet-popup-content-wrapper {
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(19, 55, 53, 0.22);
}

.t4n-map__popup {
  overflow: hidden;
  width: min(280px, 76vw);
}

.t4n-map__popup-image img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.t4n-map__popup-body {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.t4n-map__popup-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #356c64;
}

.t4n-map__popup-title {
  margin: 0;
  font-size: 18px;
  color: var(--t4n-ink);
}

.t4n-map__popup-meta,
.t4n-map__popup-copy {
  margin: 0;
  color: var(--t4n-ink-soft);
}

.t4n-map .t4n-map__popup-link,
.t4n-map .t4n-map__popup-link:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  background: linear-gradient(160deg, #2a5c58 0%, #173b39 100%);
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none !important;
  box-shadow: 0 3px 10px rgba(23, 59, 57, 0.30);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.t4n-map .t4n-map__popup-link:hover,
.t4n-map .t4n-map__popup-link:focus-visible {
  background: linear-gradient(160deg, #3a7069 0%, #2a5c58 100%);
  box-shadow: 0 6px 18px rgba(23, 59, 57, 0.35);
  transform: translateY(-1px);
  color: #ffffff !important;
  text-decoration: none !important;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .t4n-map {
    grid-template-columns: 1fr;
  }

  .t4n-map__sidebar {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--t4n-border);
  }

  .t4n-map__canvas {
    min-height: 55vh;
  }

  .t4n-map__results {
    max-height: 320px;
  }
}

@media (max-width: 640px) {
  .t4n-map {
    min-height: auto;
    border-radius: 16px;
  }

  .t4n-map__canvas {
    min-height: 58vh;
  }

  .t4n-map__sidebar {
    padding: 16px;
    gap: 14px;
  }

  .t4n-map__title {
    font-size: 1.5rem;
  }

  .t4n-map__eyebrow {
    font-size: 10px;
  }

  .t4n-map__legend {
    gap: 6px;
  }

  .t4n-map__legend-item {
    font-size: 12px;
    padding: 6px 10px;
  }

  .t4n-map__site-card {
    grid-template-columns: 52px 1fr;
    gap: 10px;
    padding: 8px;
    border-radius: 14px;
  }

  .t4n-map__site-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
  }

  .t4n-map__map-meta {
    top: 10px;
    right: 10px;
    gap: 6px;
  }

  .t4n-map__badge {
    font-size: 10px;
    padding: 6px 10px;
  }

  .t4n-map__footer {
    right: 10px;
    bottom: 10px;
    left: 10px;
    font-size: 10px;
    padding: 8px 12px;
  }

  .t4n-map__popup {
    width: min(260px, 84vw);
  }

  .t4n-map__popup-image img {
    height: 110px;
  }

  .t4n-map__popup-body {
    padding: 12px;
    gap: 6px;
  }

  .t4n-map__popup-title {
    font-size: 16px;
  }

  .t4n-map__results {
    max-height: 240px;
  }
}