/* WO-357 / WO-357A / WO-360 Atlas Map Framework
 * Pin card + map shell + Featured Adventures panel + progressive merch
 */

/* Mount root must reserve height before/after JS (homepage title+empty box regression) */
[data-atlas-mount],
#atlas-map {
  min-height: 500px;
  width: 100%;
}

.atlas-map-root {
  --atlas-blue: #1e3a8a;
  --atlas-red: #dc2626;
  --atlas-ink: #0f172a;
  --atlas-muted: #64748b;
  --atlas-panel: #f8fafc;
  --atlas-border: #e2e8f0;
  --atlas-accent: #0369a1;
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 500px;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--atlas-border);
  z-index: 0;
}

.atlas-map-status { order: 1; }
.atlas-pin-panel { order: 2; }
.atlas-map-canvas { order: 3; }

@media (min-width: 900px) {
  .atlas-map-root {
    grid-template-columns: minmax(280px, 340px) 1fr;
    grid-template-rows: auto 1fr;
  }
  .atlas-map-status {
    grid-column: 1 / -1;
    order: 0;
  }
  .atlas-pin-panel {
    grid-row: 2;
    grid-column: 1;
    order: 0;
  }
  .atlas-map-canvas {
    grid-row: 2;
    grid-column: 2;
    order: 0;
  }
}

.atlas-map-status {
  margin: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--atlas-blue);
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
}

.atlas-map-canvas {
  min-height: 420px;
  height: 500px;
  width: 100%;
  background: #e2e8f0;
  position: relative;
  z-index: 0;
}

.atlas-map-canvas.leaflet-container,
.atlas-map-root .leaflet-container {
  width: 100%;
  height: 100%;
  min-height: 420px;
  background: #e2e8f0;
  z-index: 0;
}

/*
 * Tailwind Preflight sets img { max-width: 100%; height: auto }.
 * WO-357A: restore Leaflet sizing inside Atlas only.
 */
.atlas-map-root .leaflet-container img,
.atlas-map-root .leaflet-tile,
.atlas-map-root .leaflet-marker-icon,
.atlas-map-root .leaflet-marker-shadow,
.atlas-map-root .leaflet-image-layer {
  max-width: none !important;
  max-height: none !important;
}

.atlas-pin-panel {
  background: var(--atlas-panel);
  border-bottom: 1px solid var(--atlas-border);
  max-height: 420px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 900px) {
  .atlas-pin-panel {
    border-bottom: 0;
    border-right: 1px solid var(--atlas-border);
    max-height: 500px;
  }
}

.atlas-pin-idle {
  padding: 1.25rem;
  color: var(--atlas-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  font-weight: 500;
}

.atlas-pin-error {
  color: #991b1b;
}

/* —— Calm custom markers (no continuous bounce) —— */
.atlas-marker-wrap {
  background: transparent !important;
  border: 0 !important;
}

.atlas-marker-enter {
  animation: atlas-pin-in 0.45s ease-out both;
}

@keyframes atlas-pin-in {
  from {
    opacity: 0;
    transform: scale(0.55);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.atlas-marker {
  display: block;
  width: 16px;
  height: 16px;
  margin: 3px;
  border-radius: 50%;
  background: var(--atlas-blue);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.atlas-marker--selected {
  background: var(--atlas-red);
  transform: scale(1.28);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.28), 0 2px 6px rgba(15, 23, 42, 0.4);
}

/* —— Compact Featured Adventures (replaces idle instructional copy) —— */
.atlas-fa {
  padding: 0.75rem 0.85rem 1rem;
}

.atlas-fa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.atlas-fa-head h3 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--atlas-blue);
}

.atlas-fa-nav {
  display: flex;
  gap: 0.25rem;
}

.atlas-fa-btn {
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.4rem;
  background: #fff;
  color: var(--atlas-blue);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  font-weight: 700;
}

.atlas-fa-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.atlas-fa-btn:not(:disabled):hover {
  background: #eff6ff;
}

.atlas-fa-viewport {
  overflow: hidden;
  outline: none;
}

.atlas-fa-viewport:focus-visible {
  box-shadow: 0 0 0 2px #93c5fd;
  border-radius: 0.5rem;
}

.atlas-fa-track {
  display: flex;
  transition: transform 0.28s ease;
  will-change: transform;
}

.atlas-fa-card {
  flex: 0 0 100%;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  text-align: left;
  padding: 0.5rem;
  margin: 0;
  border: 1px solid var(--atlas-border);
  border-radius: 0.65rem;
  background: #fff;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.atlas-fa-card:hover,
.atlas-fa-card:focus-visible {
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  outline: none;
}

.atlas-fa-card.is-selected {
  border-color: var(--atlas-red);
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2);
}

.atlas-fa-thumb {
  flex: 0 0 88px;
  width: 88px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 0.4rem;
  background: #0f172a;
}

.atlas-fa-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.atlas-fa-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.atlas-fa-name {
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--atlas-ink);
  line-height: 1.25;
}

.atlas-fa-where {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--atlas-muted);
}

.atlas-fa-hint {
  margin: 0.55rem 0 0;
  font-size: 0.6875rem;
  color: var(--atlas-muted);
  font-weight: 500;
}

.atlas-fa-empty {
  color: var(--atlas-muted);
  font-size: 0.875rem;
}

/* —— Place panel —— */
.atlas-pin-card {
  position: relative;
  display: flex;
  flex-direction: column;
}

.atlas-pin-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.atlas-pin-close:hover {
  background: rgba(15, 23, 42, 0.9);
}

.atlas-pin-hero {
  aspect-ratio: 16 / 9;
  background: #0f172a;
  overflow: hidden;
}

.atlas-pin-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.atlas-pin-body {
  padding: 0.85rem 1rem 1.15rem;
}

.atlas-pin-where {
  margin: 0 0 0.2rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--atlas-muted);
}

.atlas-pin-name {
  margin: 0 0 0.45rem;
  font-size: 1.125rem;
  font-weight: 900;
  color: var(--atlas-blue);
  line-height: 1.25;
}

.atlas-pin-summary {
  margin: 0 0 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #334155;
  font-weight: 500;
}

.atlas-pin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.atlas-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.atlas-btn-primary {
  background: var(--atlas-red);
  color: #fff;
}

.atlas-btn-primary:hover {
  background: #b91c1c;
  color: #fff;
}

.atlas-btn-secondary {
  background: var(--atlas-blue);
  color: #fff;
}

.atlas-btn-secondary:hover {
  background: #1e40af;
  color: #fff;
}

.atlas-btn-ghost {
  background: #fff;
  color: var(--atlas-blue);
  border: 1px solid #cbd5e1;
}

.atlas-btn-ghost:hover {
  background: #f1f5f9;
}

.atlas-meta-line {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: #334155;
}

.atlas-video-hub {
  margin-top: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--atlas-border);
}

.atlas-featured-video {
  display: block;
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: #fff;
}

.atlas-featured-video img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.atlas-featured-video span {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 800;
  background: rgba(15, 23, 42, 0.75);
  padding: 0.25rem 0.45rem;
  border-radius: 0.35rem;
}

.atlas-disclose {
  margin: 0.4rem 0;
  font-size: 0.75rem;
}

.atlas-disclose summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--atlas-accent);
  list-style: none;
}

.atlas-disclose summary::-webkit-details-marker {
  display: none;
}

.atlas-video-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.atlas-video-list a {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  text-decoration: none;
  color: var(--atlas-ink);
  font-weight: 600;
  font-size: 0.75rem;
}

.atlas-video-list img {
  width: 72px;
  height: 40px;
  object-fit: cover;
  border-radius: 0.3rem;
  background: #0f172a;
}

.atlas-playlist {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
}

.atlas-playlist a {
  font-weight: 800;
  color: var(--atlas-accent);
}

/* —— Progressive merchandising —— */
.atlas-merch {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--atlas-border);
}

.atlas-merch-label {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--atlas-blue);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.atlas-merch-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.atlas-merch-item {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.atlas-merch-item img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 0.4rem;
  border: 1px solid var(--atlas-border);
  background: #fff;
  flex: 0 0 52px;
}

.atlas-merch-name {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--atlas-ink);
  line-height: 1.3;
  margin-bottom: 0.2rem;
}

.atlas-merch-link {
  font-size: 0.6875rem;
  font-weight: 800;
  color: var(--atlas-accent);
  text-decoration: none;
}

.atlas-merch-link:hover {
  text-decoration: underline;
}

.atlas-merch-more,
.atlas-merch-rotate {
  margin: 0.25rem 0.35rem 0 0;
}

.atlas-merch-note {
  margin: 0.55rem 0 0;
  font-size: 0.625rem;
  color: var(--atlas-muted);
  line-height: 1.4;
}

.atlas-map-root .leaflet-popup-content-wrapper {
  border-radius: 12px;
  border: 2px solid var(--atlas-blue);
}

/* MarkerCluster (when loaded) — keep subtle */
.atlas-map-root .marker-cluster-small,
.atlas-map-root .marker-cluster-medium,
.atlas-map-root .marker-cluster-large {
  background-color: rgba(30, 58, 138, 0.22);
}

.atlas-map-root .marker-cluster-small div,
.atlas-map-root .marker-cluster-medium div,
.atlas-map-root .marker-cluster-large div {
  background-color: rgba(30, 58, 138, 0.85);
  color: #fff;
  font-weight: 800;
}
