/* ============================================
   Overland Expo — Structural CSS only.
   Text, colors, spacing handled by ultralight Tailwind in components.
   This file covers: scrollytelling layout, animations, mapbox overrides.
   Dark overland theme adapted from superbloom.css.
   ============================================ */

/* Force dark theme — override tokens with dark surface values */
.overlandexpo {
  --surface: #1C1C19;
  --raised: #252520;
  --emphasis: #FAF9F6;
  --divider: #333330;
  --border: #333330;
  --focus: #FAF9F6;
  --content: #FAF9F6;
  --muted: #908E7F;
  --header-h: 57px;
  color-scheme: dark;
}

/* Hero gradient — dark fade so it blends into the map section */
.overlandexpo-hero {
  position: relative;
  z-index: 0;
  background: linear-gradient(180deg, #1A1A16 0%, #252520 50%, #1C1C19 100%);
}

/* Scroll cue bounce animation */
.overlandexpo-scroll-cue {
  animation: overlandexpo-bob 2s ease-in-out infinite;
}

@keyframes overlandexpo-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ============================================
   SCROLLYTELLING LAYOUT
   ============================================ */

.overlandexpo #scrolly {
  position: relative;
  background: #1C1C19;
}

.overlandexpo #scrolly-map {
  position: sticky;
  top: var(--header-h);
  width: 100%;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  z-index: 1;
  background: #1C1C19;
}

.overlandexpo #scrolly-map > div:first-child {
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

.overlandexpo #scrolly-map::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #252520;
  animation: overlandexpo-skeleton-pulse 1.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.overlandexpo #scrolly-map.is-loaded > div:first-child {
  opacity: 1;
}

.overlandexpo #scrolly-map.is-loaded::before {
  display: none;
}

@media (min-width: 769px) {
  .overlandexpo #scrolly-map {
    padding: 24px;
    background: var(--surface);
  }

  .overlandexpo #scrolly-map > div:first-child {
    border-radius: 24px;
    overflow: hidden;
  }

  .overlandexpo #scrolly-map::before {
    inset: 24px;
    border-radius: 24px;
  }
}

/* ============================================
   STEPPER — bottom right of map
   (replaces superbloom-timeline, dark glass pill)
   ============================================ */

.overlandexpo-stepper {
  position: absolute;
  bottom: 48px;
  right: 48px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.5s ease-out;
  display: flex;
  align-items: flex-start;
  background: rgba(28, 28, 25, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 9999px;
  padding: 12px 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.overlandexpo-stepper.is-visible {
  opacity: 1;
}

/* Each item: optional line segment + dot/label */
.overlandexpo-stepper-item {
  display: flex;
  align-items: flex-start;
}

/* Line segment between dots — sits in the flex flow */
.overlandexpo-stepper-seg {
  width: 24px;
  height: 2px;
  background: rgba(250, 249, 246, 0.3);
  margin-top: 5px;
  flex-shrink: 0;
  transition: background 0.3s;
}

.overlandexpo-stepper-seg.is-filled {
  background: #FF6B35;
  opacity: 0.5;
}

.overlandexpo-stepper-point {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.overlandexpo-stepper-point:hover .overlandexpo-stepper-dot {
  transform: scale(1.3);
}

.overlandexpo-stepper-point:hover .overlandexpo-stepper-label {
  transform: scale(1.05);
}

.overlandexpo-stepper-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(250, 249, 246, 0.3);
  border: 2px solid rgba(250, 249, 246, 0.3);
  transition: all 0.3s;
  flex-shrink: 0;
}

.overlandexpo-stepper-point.is-past .overlandexpo-stepper-dot {
  background: #FF6B35;
  border-color: #FF6B35;
  opacity: 0.5;
}

.overlandexpo-stepper-point.is-active .overlandexpo-stepper-dot {
  background: #FF6B35;
  border-color: #FF6B35;
  opacity: 1;
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.overlandexpo-stepper-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--emphasis);
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: all 0.3s;
}

.overlandexpo-stepper-point.is-active .overlandexpo-stepper-label {
  color: #FF6B35;
}

@media (max-width: 768px) {
  .overlandexpo-stepper {
    padding: 10px 12px;
    bottom: auto;
    top: 24px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }

  .overlandexpo-stepper-seg {
    width: 12px;
  }

  .overlandexpo-stepper-label {
    font-size: 0.55rem;
  }
}

/* ============================================
   SCROLLY TEXT COLUMN
   ============================================ */

/* Scrolling text column — overlaps map with negative margin */
.overlandexpo #scrolly-text {
  position: relative;
  z-index: 2;
  width: 500px;
  margin-top: calc(-100vh + var(--header-h));
  margin-top: calc(-100dvh + var(--header-h));
  pointer-events: none;
}

.overlandexpo .step {
  min-height: 80vh;
  display: flex;
  align-items: center;
  padding: 60px 48px;
  pointer-events: none;
  scroll-margin-top: var(--header-h);
}

.overlandexpo .step:first-of-type {
  min-height: calc(140vh - var(--header-h));
  padding-bottom: 50vh;
}

.overlandexpo .step:first-of-type .step-card {
  scroll-margin-top: calc(var(--header-h) + 48px);
}

.overlandexpo .step[data-chapter-id="full"] {
  min-height: 200vh;
  padding-top: calc(100vh - var(--header-h) + 60px);
  align-items: flex-start;
}

.overlandexpo .step[data-chapter-id="full"] .step-card {
  scroll-margin-top: calc(var(--header-h) + 48px);
}

/* ============================================
   STEP CARDS
   ============================================ */

/* Desktop step cards — dark surface with border */
.overlandexpo .step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  border-radius: 1rem;
  padding: 28px 28px 24px;
  max-width: 440px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.overlandexpo .step.is-active .step-card {
  opacity: 1;
  transform: translateY(0);
}

/* Hold cards hidden until map is loaded */
.overlandexpo:not(.map-ready) .step.is-active .step-card {
  opacity: 0;
}

.overlandexpo .step-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--content);
}

.overlandexpo .step-card p {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--muted);
}

/* Step type badge — e.g. "Event", "Drive", "Camp" */
.overlandexpo .step-type {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.overlandexpo .step-type-event {
  background: rgba(255, 107, 53, 0.15);
  color: #FF6B35;
}

.overlandexpo .step-type-waypoint {
  background: rgba(144, 142, 127, 0.15);
  color: var(--muted);
}

/* Step dates — text link below title for events */
.overlandexpo .step-dates {
  display: block;
  margin-top: -4px;
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 0.15s;
}

.overlandexpo a.step-dates:hover {
  color: #FF6B35;
}

.overlandexpo .step-info {
  font-size: 0.78rem !important;
  font-weight: 500;
  color: var(--muted) !important;
  margin-top: 12px;
  letter-spacing: 0.02em;
}

/* ============================================
   STEP CTAs
   ============================================ */

.overlandexpo .step-cta-wrap {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.overlandexpo .step-cta {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 9999px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.overlandexpo .step-cta:hover {
  opacity: 0.9;
}

/* Primary CTA — warm orange accent for dark theme */
.overlandexpo .step-cta-primary {
  background: #FF6B35;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.overlandexpo .step-cta-outline {
  background: transparent;
  color: var(--content);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.overlandexpo .step-cta-ghost {
  background: transparent;
  color: var(--content);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.overlandexpo .step-cta-circle {
  background: #FF6B35;
  color: #fff;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.overlandexpo .step-cta-spacer {
  flex: 1;
}

/* ============================================
   MAPBOX GL OVERRIDES — dark canvas
   ============================================ */

.overlandexpo .mapboxgl-canvas {
  background: #1C1C19 !important;
}

.overlandexpo .mapboxgl-ctrl-attrib {
  font-size: 10px !important;
  background: rgba(28, 28, 25, 0.7) !important;
  color: var(--muted) !important;
}

/* Navigation control — dark glass, hidden until explore mode */
.overlandexpo .mapboxgl-ctrl-top-right {
  top: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.overlandexpo .mapboxgl-ctrl-top-right .mapboxgl-ctrl {
  margin-top: 0 !important;
}

.overlandexpo.user-exploring .mapboxgl-ctrl-top-right {
  opacity: 1;
  pointer-events: auto;
}

.overlandexpo .mapboxgl-ctrl-group {
  background: rgba(28, 28, 25, 0.88) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(250, 249, 246, 0.12) !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3) !important;
  overflow: hidden;
}

.overlandexpo .mapboxgl-ctrl-group button {
  width: 28px !important;
  height: 28px !important;
  background: transparent !important;
  border-bottom: none !important;
}

.overlandexpo .mapboxgl-ctrl-group button + button {
  border-top: 1px solid rgba(250, 249, 246, 0.08) !important;
}

.overlandexpo .mapboxgl-ctrl-group button .mapboxgl-ctrl-icon {
  filter: invert(1);
}

.overlandexpo .mapboxgl-ctrl-group button:hover {
  background: rgba(250, 249, 246, 0.1) !important;
}

/* ============================================
   RETURN TO ROUTE PILL — dark glass pill (matches stepper + mapbox controls)
   ============================================ */

.overlandexpo-return-pill {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  background: rgba(28, 28, 25, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #FAF9F6;
  border: 1px solid rgba(250, 249, 246, 0.12);
  border-radius: 9999px;
  padding: 10px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.overlandexpo-return-pill.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.overlandexpo-return-pill:hover {
  background: rgba(28, 28, 25, 0.96);
}

/* Hide stepper when user is freely exploring the map */
.overlandexpo.user-exploring .overlandexpo-stepper {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ============================================
   LISTING PINS & CARDS
   Matches ultralight MapPinPrice + CardSquare
   ============================================ */

/* Pin — content bg, surface text (matches UL MapPinPrice) */
.overlandexpo-listing-pin {
  background: var(--content);
  color: var(--surface);
  border: none;
  border-radius: 9999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease-out;
}

.overlandexpo-listing-pin:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Active state — inverted (surface bg, content text) */
.overlandexpo-listing-pin[data-active] {
  background: var(--surface);
  color: var(--content);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Card pop-in animation — on inner div so it doesn't conflict with positioning transform */
.overlandexpo-listing-card-anim {
  pointer-events: auto;
  animation: overlandexpo-card-pop-in 0.15s ease-out both;
}

@keyframes overlandexpo-card-pop-in {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

/* Skeleton shimmer for loading images — dark base */
@keyframes overlandexpo-skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Card — dark surface, rounded, shadow */
.overlandexpo-listing-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

/* Photo wrapper — holds both shimmer photo area and close button */
.overlandexpo-listing-card-photo-wrap {
  position: relative;
  margin-bottom: 10px;
}

/* Photo skeleton — dark raised color (#252520) */
.overlandexpo-listing-card-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--raised);
}

.overlandexpo-listing-card-photo.is-loading {
  animation: overlandexpo-skeleton-pulse 1.5s ease-in-out infinite;
}

.overlandexpo-listing-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.overlandexpo-listing-card-photo img.is-loaded {
  opacity: 1;
}

/* Close button — top-right, outside shimmer scope */
.overlandexpo-listing-card-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--content);
  color: var(--surface);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.15s;
}

.overlandexpo-listing-card-close:hover {
  transform: scale(1.1);
}

.overlandexpo-listing-card-body {
  min-width: 0;
}

/* Title */
.overlandexpo-listing-card-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--content);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Meta — all-caps monospace (matches UL text-label) */
.overlandexpo-listing-card-meta {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* Hide scrollytelling card when listing card is in focus or map is tapped */
.overlandexpo.has-listing-card .step.is-active .step-card,
.overlandexpo.has-stop-card .step.is-active .step-card,
.overlandexpo.scrolly-hidden .step.is-active .step-card {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .overlandexpo .overlandexpo-scroll-cue { animation: none; }
  .overlandexpo .step-card { transition: none; }
}

/* ============================================
   MOBILE — scrollytelling overrides only
   ============================================ */

@media (max-width: 768px) {
  .overlandexpo #scrolly-text {
    width: 100%;
    margin-top: calc(-100vh + var(--header-h));
    margin-top: calc(-100dvh + var(--header-h));
  }

  .overlandexpo .step {
    min-height: 100vh;
    min-height: 100svh;
    align-items: flex-end;
    padding: 0 12px 24px;
  }

  .overlandexpo .step:first-of-type {
    min-height: 100vh;
    min-height: 100svh;
    padding-bottom: 24px;
  }

  .overlandexpo .step[data-chapter-id="full"] {
    min-height: 200vh;
    min-height: 200svh;
  }

  /* Mobile step cards — dark glass effect */
  .overlandexpo .step-card {
    max-width: none;
    width: 100%;
    background: rgba(28, 28, 25, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 16px 16px;
    border-radius: 1rem;
    border: none;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  }

  .overlandexpo .step.is-active .step-card {
    opacity: 1;
    transform: translateY(0);
  }

  .overlandexpo .step-card h2 {
    font-size: 1.15rem;
  }

  .overlandexpo .step-card p {
    font-size: 0.85rem;
    line-height: 1.5;
  }

  .overlandexpo .summary-table-wrap {
    margin: 0 -24px;
    padding: 0 24px;
  }

  .overlandexpo .summary-table {
    min-width: 600px;
  }

  .overlandexpo-return-pill {
    top: 24px;
  }

}

/* Desktop step cards — override mobile glass, use solid surface */
@media (min-width: 769px) {
  .overlandexpo .step-card {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: none;
  }
}
