/* # Written by Codex */

.table-of-contents #toc .nav .nav {
  /* Override pkgdown's important rule that collapses inactive subsections. */
  display: block !important;
}

/* Keep the README navigation visible beside long examples on desktop. */
@media (min-width: 768px) {
  .row > aside:has(> .table-of-contents) {
    position: sticky;
    top: 4.5rem;
    align-self: flex-start;
    max-height: calc(100vh - 5.5rem);
    overflow-y: auto;
  }

  .row > aside:has(> .table-of-contents) #toc {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

html:has(.cd-map-fallback),
body:has(.cd-map-fallback),
#htmlwidget_container:has(.cd-map-fallback) {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body:has(.cd-map-fallback) {
  overflow: auto;
}

html[data-cd-map-state="loading"] body:has(.cd-map-fallback),
html[data-cd-map-state="ready"] body:has(.cd-map-fallback) {
  overflow: hidden;
}

html:has(.cd-map-fallback) .mapboxgl.html-widget {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  visibility: hidden;
}

.cd-map-fallback {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: white;
}

.cd-map-fallback img,
.cd-map-outer-fallback img {
  display: block;
  flex: 0 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: top;
}

.cd-map-fallback figcaption,
.cd-map-outer-fallback figcaption {
  padding: 8px 12px;
  border-top: 1px solid #dce0e5;
  background: #f6f7f9;
  color: #444;
  font: 12px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cd-map-loading,
.cd-map-frame-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: white;
  color: #555;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cd-map-loading[hidden],
.cd-map-frame-loading[hidden] {
  display: none;
}

html[data-cd-map-state="loading"] .cd-map-fallback,
html[data-cd-map-state="ready"] .cd-map-fallback {
  display: none;
}

html:has(.cd-map-fallback)[data-cd-map-state="ready"] .mapboxgl.html-widget {
  visibility: visible;
}

.cd-map-frame {
  position: relative;
  width: 100%;
}

.cd-map-frame[data-cd-map-state="loading"],
.cd-map-frame[data-cd-map-state="ready"] {
  min-height: 650px;
}

.cd-map-frame .cd-map-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 650px;
  border: 0;
  visibility: hidden;
}

.cd-map-outer-fallback {
  display: flex;
  flex-direction: column;
  margin: 0;
  background: white;
}

.cd-map-frame[data-cd-map-state="loading"] .cd-map-outer-fallback,
.cd-map-frame[data-cd-map-state="ready"] .cd-map-outer-fallback {
  display: none;
}

.cd-map-frame[data-cd-map-state="loading"] .cd-map-iframe,
.cd-map-frame[data-cd-map-state="ready"] .cd-map-iframe {
  visibility: visible;
}

.cd-map-frame-loading {
  z-index: 1;
}
