/**
 * Fund Me — marketplace overhaul
 * Scoped under body.orbit-page-fundme
 */

body.orbit-page-fundme {
  --fm-accent: #9b8cff;
  --fm-accent-soft: rgba(155, 140, 255, 0.14);
  --fm-accent-line: rgba(155, 140, 255, 0.45);
  --fm-surface: rgba(16, 18, 28, 0.72);
  --fm-surface-2: rgba(22, 24, 36, 0.9);
  --fm-muted: rgba(244, 241, 234, 0.58);
  --fm-line: rgba(255, 255, 255, 0.1);
}

/* —— Hero —— */
body.orbit-page-fundme .fm-hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 2rem;
  align-items: end;
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--fm-line);
}

body.orbit-page-fundme .fm-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fm-accent);
  margin-bottom: 0.75rem;
}

body.orbit-page-fundme .fm-hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem) !important;
  line-height: 0.95;
  margin: 0 0 0.85rem;
  letter-spacing: -0.04em !important;
}

body.orbit-page-fundme .fm-hero-lead {
  max-width: 34rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--fm-muted);
  margin: 0 0 1.25rem;
}

body.orbit-page-fundme .fm-hero-lead strong {
  color: #f4f1ea;
  font-weight: 600;
}

body.orbit-page-fundme .fm-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

body.orbit-page-fundme .fm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--fm-accent-line);
  background: rgba(155, 140, 255, 0.12);
  color: #f4f1ea;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}

body.orbit-page-fundme .fm-btn:hover {
  background: rgba(155, 140, 255, 0.22);
  border-color: var(--fm-accent);
  transform: translateY(-1px);
}

body.orbit-page-fundme .fm-btn-primary {
  background: linear-gradient(135deg, rgba(155, 140, 255, 0.35), rgba(126, 200, 227, 0.12));
  border-color: var(--fm-accent);
}

body.orbit-page-fundme .fm-btn-ghost {
  background: transparent;
  border-color: var(--fm-line);
  color: var(--fm-muted);
}

body.orbit-page-fundme .fm-btn-ghost:hover {
  color: #f4f1ea;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

body.orbit-page-fundme .fm-hero-panel {
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
  border-radius: 18px;
  padding: 1.25rem 1.35rem;
  backdrop-filter: blur(14px);
}

body.orbit-page-fundme .fm-hero-panel h3 {
  font-size: 0.95rem;
  margin: 0 0 0.85rem;
}

body.orbit-page-fundme .fm-split-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

body.orbit-page-fundme .fm-split-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.88rem;
  color: var(--fm-muted);
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.orbit-page-fundme .fm-split-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

body.orbit-page-fundme .fm-split-list strong {
  color: #f4f1ea;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

body.orbit-page-fundme .fm-note {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: rgba(126, 200, 227, 0.9);
  line-height: 1.45;
}

/* —— Metrics —— */
body.orbit-page-fundme .fm-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

body.orbit-page-fundme .fm-metric {
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
  border-radius: 14px;
  padding: 0.95rem 1rem;
}

body.orbit-page-fundme .fm-metric span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fm-muted);
  margin-bottom: 0.35rem;
}

body.orbit-page-fundme .fm-metric strong {
  font-family: var(--hub-display-font), Syne, system-ui, sans-serif;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  color: #fff;
  font-weight: 700;
}

/* —— Browse toolbar —— */
body.orbit-page-fundme .fm-browse-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

body.orbit-page-fundme .fm-browse-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

body.orbit-page-fundme .fm-browse-head p {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: var(--fm-muted);
}

body.orbit-page-fundme .filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  margin-bottom: 1.5rem;
}

body.orbit-page-fundme .filter-buttons-container {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.15rem;
}

body.orbit-page-fundme .filter-buttons-container::-webkit-scrollbar {
  display: none;
}

body.orbit-page-fundme .filter-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--fm-line);
  background: transparent;
  color: var(--fm-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

body.orbit-page-fundme .filter-btn:hover {
  color: #f4f1ea;
  border-color: rgba(255, 255, 255, 0.2);
}

body.orbit-page-fundme .filter-btn.active {
  color: #0b0c10;
  background: var(--fm-accent);
  border-color: var(--fm-accent);
}

body.orbit-page-fundme .filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

body.orbit-page-fundme .filter-controls select,
body.orbit-page-fundme .filter-controls input {
  flex: 1 1 160px;
  min-height: 40px;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--fm-line);
  background: var(--fm-surface-2);
  color: #f4f1ea;
  font-size: 0.88rem;
}

body.orbit-page-fundme .filter-controls input:focus,
body.orbit-page-fundme .filter-controls select:focus {
  outline: none;
  border-color: var(--fm-accent-line);
}

/* —— Cards —— */
body.orbit-page-fundme #sponsorshipGrid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.15rem;
  margin: 0 0 2rem;
}

body.orbit-page-fundme .sponsor-card {
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.18s, background 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
}

body.orbit-page-fundme .sponsor-card:hover {
  border-color: var(--fm-accent-line);
  transform: translateY(-3px);
  background: rgba(22, 24, 38, 0.92);
}

body.orbit-page-fundme .sponsor-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 0;
  margin: 0;
}

body.orbit-page-fundme .sponsor-card-body {
  padding: 1.1rem 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

body.orbit-page-fundme .sponsor-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  font-size: 0.78rem;
  color: var(--fm-muted);
}

body.orbit-page-fundme .sponsor-card-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
  color: #fff !important;
}

body.orbit-page-fundme .story-text {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--fm-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.orbit-page-fundme .progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.35rem 0 0;
}

body.orbit-page-fundme .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--fm-accent), #7ec8e3);
  border-radius: 999px;
}

body.orbit-page-fundme .sponsor-card-funding {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.84rem;
  color: #f4f1ea;
  margin-top: 0.15rem;
}

body.orbit-page-fundme .sponsor-card-funding strong {
  font-variant-numeric: tabular-nums;
}

body.orbit-page-fundme .sponsor-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-size: 0.78rem;
  color: var(--fm-muted);
}

body.orbit-page-fundme .verified-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: auto;
  background: rgba(61, 222, 140, 0.92);
  color: #06140c;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 2;
}

body.orbit-page-fundme .sponsor-tier {
  align-self: flex-start;
  margin-top: auto;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--fm-line);
  color: var(--fm-muted);
}

body.orbit-page-fundme .tier-bronze { border-color: rgba(205, 127, 50, 0.45); color: #d4a574; }
body.orbit-page-fundme .tier-silver { border-color: rgba(192, 192, 192, 0.45); color: #c8c8c8; }
body.orbit-page-fundme .tier-gold { border-color: rgba(255, 176, 32, 0.5); color: #ffb020; }
body.orbit-page-fundme .tier-platinum { border-color: var(--fm-accent-line); color: var(--fm-accent); }

/* —— Modals —— */
body.orbit-page-fundme .modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 10, 0.82);
  backdrop-filter: blur(8px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

body.orbit-page-fundme .modal.active {
  display: flex;
}

body.orbit-page-fundme .modal-content {
  background: #10121c;
  border: 1px solid var(--fm-line);
  border-radius: 20px;
  padding: 1.5rem 1.35rem 1.75rem;
  max-width: 640px;
  width: 100%;
  max-height: min(90vh, 860px);
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

body.orbit-page-fundme .modal-content.fm-modal-wide {
  max-width: 820px;
}

body.orbit-page-fundme .modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--fm-line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fm-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

body.orbit-page-fundme .modal-close:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

body.orbit-page-fundme .fm-modal-title {
  margin: 0 2rem 0.35rem 0;
  font-size: 1.45rem;
  color: #fff !important;
}

body.orbit-page-fundme .fm-modal-sub {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--fm-muted);
}

body.orbit-page-fundme .fm-form-section {
  margin-bottom: 1.25rem;
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--fm-line);
  background: rgba(255, 255, 255, 0.02);
}

body.orbit-page-fundme .fm-form-section h3 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
}

body.orbit-page-fundme .fm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

body.orbit-page-fundme .form-group {
  margin-bottom: 0.85rem;
}

body.orbit-page-fundme .form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fm-muted) !important;
}

body.orbit-page-fundme .form-input,
body.orbit-page-fundme .form-select,
body.orbit-page-fundme .form-textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--fm-line);
  background: var(--fm-surface-2);
  color: #f4f1ea;
  font-size: 0.92rem;
}

body.orbit-page-fundme .form-input:focus,
body.orbit-page-fundme .form-select:focus,
body.orbit-page-fundme .form-textarea:focus {
  outline: none;
  border-color: var(--fm-accent-line);
}

body.orbit-page-fundme .fm-terms {
  background: var(--fm-accent-soft);
  border: 1px solid var(--fm-accent-line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin: 1rem 0 1.25rem;
}

body.orbit-page-fundme .fm-terms h4 {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  color: var(--fm-accent) !important;
}

body.orbit-page-fundme .fm-terms p,
body.orbit-page-fundme .fm-terms li {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--fm-muted);
}

body.orbit-page-fundme .fundme-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: auto;
  min-height: 44px;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--fm-accent-line);
  background: rgba(155, 140, 255, 0.18);
  color: #f4f1ea;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

body.orbit-page-fundme .fundme-btn-primary:hover {
  background: rgba(155, 140, 255, 0.28);
  border-color: var(--fm-accent);
  color: #fff;
}

/* Detail modal blocks built by JS */
body.orbit-page-fundme .fm-detail-hero {
  text-align: center;
  margin-bottom: 1.25rem;
}

body.orbit-page-fundme .fm-detail-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--fm-accent-line);
  margin-bottom: 0.75rem;
}

body.orbit-page-fundme .fm-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  text-align: center;
  padding: 1rem;
  border-radius: 14px;
  background: var(--fm-accent-soft);
  border: 1px solid var(--fm-accent-line);
  margin: 1rem 0;
}

body.orbit-page-fundme .fm-stat-grid strong {
  display: block;
  font-size: 1.35rem;
  color: var(--fm-accent);
  font-variant-numeric: tabular-nums;
}

body.orbit-page-fundme .fm-stat-grid span {
  font-size: 0.78rem;
  color: var(--fm-muted);
}

body.orbit-page-fundme .fm-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

body.orbit-page-fundme .fm-detail-actions .fundme-btn-primary {
  flex: 1 1 140px;
}

body.orbit-page-fundme .fm-supporter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--fm-line);
}

body.orbit-page-fundme .fm-supporter-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

body.orbit-page-fundme .fm-supporter-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--fm-accent);
  color: #0b0c10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Hide legacy page-header chrome when using fm-hero */
body.orbit-page-fundme .page-header {
  display: none;
}

body.orbit-page-fundme .stats-grid {
  display: none;
}

@media (max-width: 900px) {
  body.orbit-page-fundme .fm-hero {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  body.orbit-page-fundme .fm-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  body.orbit-page-fundme .fm-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  body.orbit-page-fundme .fm-metrics {
    grid-template-columns: 1fr 1fr;
  }

  body.orbit-page-fundme .fm-hero h1 {
    font-size: 2.2rem !important;
  }

  body.orbit-page-fundme .sponsor-card-image {
    height: 160px;
  }

  body.orbit-page-fundme .modal-content {
    padding: 1.25rem 1rem 1.4rem;
    border-radius: 16px;
  }
}
