/* ============================================
   Superbloom — Structural CSS only.
   Text, colors, spacing handled by ultralight Tailwind in components.
   This file covers: scrollytelling layout, animations, mapbox overrides.
   ============================================ */

/* Force light theme — override dark mode tokens */
.superbloom {
  --surface: var(--white);
  --raised: var(--neutral-100);
  --emphasis: var(--neutral-500);
  --divider: var(--neutral-100);
  --border: var(--neutral-100);
  --focus: var(--neutral-700);
  --content: var(--neutral-700);
  --muted: var(--neutral-400);
  --header-h: 57px;
  color-scheme: light;
}

/* Hero gradient — warm to white so it blends into the map section */
.superbloom-hero {
  position: relative;
  z-index: 0;
  background: linear-gradient(180deg, #f7d9b8 0%, #fce8d5 30%, #fdf4e8 60%, #ffffff 100%);
}

/* Flower icons — staggered fade-in */
.superbloom-flower {
  animation: superbloom-flower-in 1.4s ease-out both;
}

@keyframes superbloom-flower-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

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

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

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

.superbloom #scrolly {
  position: relative;
  background: #fff;
}

.superbloom #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: #fff;
}

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

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

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

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

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

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

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

/* Timeline — bottom center of map */
.superbloom-timeline {
  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(255, 255, 255, 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.12);
  pointer-events: auto;
}

.superbloom-timeline.is-visible {
  opacity: 1;
}

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

/* Line segment between dots — sits in the flex flow */
.superbloom-timeline-seg {
  width: 24px;
  height: 2px;
  background: var(--neutral-200);
  margin-top: 5px;
  flex-shrink: 0;
  transition: background 0.3s;
}

.superbloom-timeline-seg.is-filled {
  background: var(--primary);
  opacity: 0.5;
}

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

.superbloom-timeline-point:hover .superbloom-timeline-dot {
  transform: scale(1.3);
}

.superbloom-timeline-point:hover .superbloom-timeline-label {
  transform: scale(1.05);
}

.superbloom-timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--neutral-200);
  border: 2px solid var(--neutral-300);
  transition: all 0.3s;
  flex-shrink: 0;
}

.superbloom-timeline-point.is-past .superbloom-timeline-dot {
  background: var(--primary);
  border-color: var(--primary);
  opacity: 0.5;
}

.superbloom-timeline-point.is-active .superbloom-timeline-dot {
  background: var(--primary);
  border-color: var(--primary);
  opacity: 1;
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 3px rgba(236, 80, 23, 0.2);
}

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

.superbloom-timeline-point.is-active .superbloom-timeline-label {
  color: var(--primary);
}

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

  .superbloom-timeline-seg {
    width: 12px;
  }

  .superbloom-timeline-label {
    font-size: 0.55rem;
  }
}

/* Scrolling text column — overlaps map with negative margin */
.superbloom #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;
}

.superbloom .step {
  min-height: 80vh;
  display: flex;
  align-items: center;
  padding: 60px 48px;
  pointer-events: none;
}

.superbloom .step:first-child {
  min-height: calc(140vh - var(--header-h));
  padding-top: calc(100vh - var(--header-h));
}

.superbloom .step:last-child {
  min-height: calc(60vh - var(--header-h));
  padding-bottom: calc(100vh - var(--header-h));
}

/* Step cards — scroll-driven opacity/transform transition */
.superbloom .step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  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);
}

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

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

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

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

.superbloom .step-card .step-date {
  display: block;
  margin-bottom: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

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

.superbloom .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;
}

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

.superbloom .step-cta-primary {
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.superbloom .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%;
}

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

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

/* ============================================
   MAPBOX GL OVERRIDES
   ============================================ */

.superbloom .mapboxgl-canvas {
  background: #fff !important;
}

.superbloom .mapboxgl-ctrl-attrib {
  font-size: 10px !important;
  background: rgba(255, 255, 255, 0.7) !important;
}

.superbloom .obs-popup .mapboxgl-popup-content {
  padding: 0 !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
  overflow: hidden;
}

.superbloom .obs-popup .mapboxgl-popup-tip {
  border-top-color: #fff !important;
}

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

/* Pin — content bg, surface text (matches UL MapPinPrice) */
.superbloom-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;
}

.superbloom-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) */
.superbloom-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 */
.superbloom-listing-card-anim {
  pointer-events: auto;
  animation: superbloom-card-pop-in 0.15s ease-out both;
}

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

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

/* Card — matches UL CardSquare: surface bg, rounded, shadow, p-3 */
.superbloom-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 */
.superbloom-listing-card-photo-wrap {
  position: relative;
  margin-bottom: 10px;
}

.superbloom-listing-card-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--neutral-100);
}

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

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

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

/* Close button — top-right, outside shimmer scope */
.superbloom-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;
}

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

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

/* Title */
.superbloom-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) */
.superbloom-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 */
.superbloom.has-listing-card .step.is-active .step-card,
.superbloom.scrolly-hidden .step.is-active .step-card {
  opacity: 0 !important;
  pointer-events: none !important;
}

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

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

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

@media (max-width: 768px) {
  .superbloom-flower:not(.superbloom-flower-mobile) {
    display: none;
  }

  .superbloom #scrolly-text {
    width: 100%;
    margin-top: calc(-100vh + var(--header-h));
    margin-top: calc(-100dvh + var(--header-h));
  }

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

  .superbloom .step:first-child {
    min-height: 70vh;
    min-height: 70svh;
  }

  .superbloom .step:last-child {
    min-height: 80vh;
    min-height: 80svh;
  }

  .superbloom .step-card {
    max-width: none;
    width: 100%;
    background: rgba(255, 255, 255, 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.14);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  }

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

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

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

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

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

