/* Host site shell + Mars map panel (see index.html) */
html {
  --map-panel-w: 0px;
}

:root {
  --host-bg: #0f1218;
  --host-text: #e4e8f0;
  --host-muted: #8a93a3;
  --gutter: #1e2430;
  --launcher: #1a1f2a;
}

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

body.host-embed {
  margin: 0;
  min-height: 100vh;
  background: var(--host-bg);
  color: var(--host-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  transition: padding-left 0.2s ease;
  padding-left: var(--map-panel-w);
  overflow-x: hidden;
}

/* MER (Spirit / Opportunity): no traverse map in this host — panel width 0, no chevron */
body.host-embed--mer-no-map {
  /* Snap layout immediately; avoid animating padding with the mission overlay fade */
  transition: padding-left 0s;
}
body.host-embed--mer-no-map .map-panel {
  transition: width 0s, box-shadow 0s;
}
body.host-embed--mer-no-map .map-launcher {
  display: none;
}

/* Main area: panorama iframe (or placeholder if URL not set) — below the fixed map (map has z-index). */
.host-main {
  min-height: 100vh;
  max-width: none;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 0;
}

.host-pano__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  display: block;
  /* Shows behind the pano while it loads; matches pano inner chrome. */
  background: #000;
}

.host-pano__placeholder {
  min-height: 100vh;
  max-width: 40rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  color: var(--host-muted);
}

.host-pano__placeholder p {
  margin: 0 0 1rem;
  max-width: 40em;
}

.host-pano__placeholder code {
  color: #c5ccd8;
  font-size: 0.9em;
}

.host-pano__hint {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* Fixed left map + gutter. Grid (not flex) so the map iframe always gets a real height. */
.map-panel {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12px;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  width: var(--map-panel-w);
  min-width: 0;
  max-width: 100vw;
  background: #12151c;
  box-shadow: 6px 0 32px rgba(0, 0, 0, 0.35);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: width 0.22s ease, box-shadow 0.2s;
}

body.is-dragging-map .map-panel {
  transition: none;
}

body.is-dragging-map {
  transition: none;
}

.map-panel[hidden] {
  display: none;
}

.map-panel__frame {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0a0d12;
}

.map-panel__gutter {
  flex: 0 0 12px;
  background: var(--gutter);
  cursor: col-resize;
  touch-action: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8b95a8;
  font-size: 0.7rem;
  line-height: 1;
  user-select: none;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.map-panel__gutter:hover,
.map-panel__gutter:focus-visible {
  background: #2a303c;
  color: #c5ccd8;
  outline: none;
}

/* Chevron in gutter */
.map-panel__gutter::after {
  content: "‹";
  font-size: 1.1rem;
  opacity: 0.7;
  pointer-events: none;
}

/* Open / show launcher: JS toggles [hidden] and aria */
.map-launcher {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  width: 36px;
  min-height: 100px;
  height: auto;
  padding: 0.5rem 0.25rem;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: var(--launcher);
  color: #f0a636;
  font-size: 1rem;
  line-height: 1.1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.35);
  transition: background 0.15s, color 0.15s, opacity 0.2s, visibility 0.2s;
}

.map-launcher:hover {
  background: #252a38;
  color: #ffc266;
}

.map-launcher[hidden] {
  display: none;
}

/* Hit area: dragging uses gutter; launcher repositions when panel 0 */
@media (max-width: 480px) {
  .map-launcher {
    width: 32px;
    min-height: 80px;
  }
}
