/* Surprising Maps — shared chrome for /upside-down and /inverted.
   Both pages are a full-bleed map plus a floating title, a control cluster and
   one explanatory panel, so the layout lives here once under the `sm-` prefix. */

.sm-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* The map element also carries `hejmap-map`, which is what map-engine.css uses
   to stretch the MapLibre canvas to the container. */

/* ── Title block ───────────────────────────────────────────────────────────── */
/* Named with the site-wide `-map-title` suffix so build-og-screenshots.mjs
   picks it up as the caption for the social card. */

.sm-map-title {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  box-shadow: var(--popup-shadow);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.sm-map-title-icon {
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--accent);
}

.sm-map-title-label {
  font-size: 0.68rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sm-map-title-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

/* ── Control cluster ───────────────────────────────────────────────────────── */

.sm-controls {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  box-shadow: var(--popup-shadow);
  backdrop-filter: blur(8px);
}

.sm-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.sm-btn:hover { filter: brightness(1.07); }
.sm-btn:active { transform: scale(0.97); }
.sm-btn:disabled { opacity: 0.55; cursor: default; }

.sm-btn--ghost {
  background: var(--bg-warm);
  color: var(--ink);
}

.sm-btn-icon { width: 17px; height: 17px; flex: none; }

.sm-readout {
  padding: 0 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.sm-readout b { color: var(--ink); }

/* ── Map buttons (zoom / reset) ────────────────────────────────────────────── */

.sm-map-controls {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sm-map-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--ink);
  box-shadow: var(--popup-shadow);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.sm-map-btn:hover { color: var(--accent); }
.sm-map-btn svg { width: 16px; height: 16px; }

/* ── Hover tooltip ─────────────────────────────────────────────────────────── */

.sm-tooltip {
  position: absolute;
  z-index: 6;
  padding: 6px 11px;
  border-radius: 9px;
  background: var(--popup-bg);
  color: var(--ink);
  box-shadow: var(--popup-shadow);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.sm-tooltip.is-visible { opacity: 1; }
.sm-tooltip small {
  display: block;
  font-weight: 500;
  font-size: 0.74rem;
  color: var(--ink-faint);
}

/* ── Explanatory panel ─────────────────────────────────────────────────────── */

.sm-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  width: 340px;
  max-width: 86vw;
  padding: 26px 24px 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  box-shadow: -18px 0 50px -30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.sm-panel.is-open { transform: none; }

.sm-panel h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  color: var(--ink);
}

.sm-panel h3 {
  margin: 22px 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.sm-panel p {
  margin: 0 0 12px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.sm-panel-sub {
  margin: 0 0 16px;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.sm-panel-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--bg-warm);
  color: var(--ink-soft);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.sm-panel-close:hover { color: var(--accent); }

.sm-facts {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.sm-facts li {
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.sm-facts b {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
}

.sm-source {
  margin-top: 22px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* Panel opener sits with the map buttons so it never collides with the title. */
.sm-panel-open {
  position: absolute;
  top: 18px;
  right: 62px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--ink);
  box-shadow: var(--popup-shadow);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.sm-panel-open:hover { color: var(--accent); }

/* ── On-map labels for the inverted world ──────────────────────────────────── */
/* Positioned by maplibregl.Marker, which writes its own inline transform, so
   these rules only cover appearance. */

.sm-sea-label {
  padding: 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sm-sea-label.is-land {
  color: rgba(38, 28, 12, 0.82);
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.55);
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .sm-map-title { top: 12px; left: 12px; padding: 8px 13px 8px 10px; }
  .sm-map-title-icon { width: 26px; height: 26px; }
  .sm-map-title-text { font-size: 0.92rem; }
  .sm-controls { bottom: 14px; gap: 7px; padding: 8px 9px; }
  .sm-btn { padding: 8px 14px; font-size: 0.84rem; }
  .sm-readout { display: none; }
  .sm-panel-open { top: 12px; right: 56px; padding: 7px 12px; font-size: 0.76rem; }
  .sm-map-controls { top: 12px; right: 12px; }
  .sm-panel { width: 100%; max-width: none; padding: 22px 18px 36px; }
}
