/* CRUD8 Discover — nav + search are one sticky chrome; cards scroll under. */

:root {
  --header-height: 70px;
  --discover-chrome-offset: var(--header-height);
}

/* clip (not hidden) so horizontal bleed is cut without creating a body/html
   scrollport that would un-stick .discover-chrome. */
html:has(body.page-discover) {
  overflow-x: clip;
}

/* overflow-x: clip on html makes position:fixed descendants sit inside
   Discover instead of the viewport. Drop the clip while the store is open. */
html.crud8-modal-open:has(body.page-discover),
html.crud8-modal-open:has(body.page-discover) body,
html.crud8-terminal-glitch:has(body.page-discover),
html.crud8-terminal-glitch:has(body.page-discover) body,
html.crud8-atomic-wedgie:has(body.page-discover),
html.crud8-atomic-wedgie:has(body.page-discover) body,
html.crud8-combat-open:has(body.page-discover),
html.crud8-combat-open:has(body.page-discover) body {
  overflow: hidden !important;
}

/* overflow-x: clip contains position:fixed. Lift it so the ticker
   sits on the viewport above the Discover shell. */
html.crud8-marquee-open:has(body.page-discover) {
  overflow-x: visible;
}

html.crud8-marquee-open .page-discover .discover-chrome {
  top: var(--crud8-marquee-offset, 0px) !important;
}

.page-discover .discover-chrome {
  position: sticky;
  top: 0 !important;
  z-index: 200;
  flex-shrink: 0;
  width: 100%;
  background: var(--c8-bg);
  padding-top: 0;
  margin: 0;
  margin-top: 0 !important;
}

/* Header lives inside the chrome, so it must not be independently sticky. */
.page-discover .discover-chrome .ct-header {
  position: relative !important;
  top: auto !important;
  margin-top: 0 !important;
}

.page-discover .main-content {
  padding-top: 0;
  padding-bottom: var(--space-6);
  min-height: 0;
  flex: 1 1 auto;
}

.page-discover .discover-toolbar {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
  background: var(--c8-bg);
  border-bottom: 1px solid var(--c8-navy, #14233C);
  box-shadow: none !important;
  padding: 0 0 8px;
  margin: 0;
  background-image: none !important;
}
.page-discover .search-bar-wrap,
.page-discover .search-bar,
.page-discover .page-tabs {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
}

.discover-toolbar .container,
.discover-sticky-header .container {
  max-width: 440px;
}

.search-bar-wrap {
  max-width: 440px;
  margin: 0 auto 8px;
}

.search-bar {
  height: 44px;
  padding: 0 var(--space-3);
  background: var(--c8-bg) !important;
  border: 1px solid var(--c8-cyan) !important;
  border-radius: 2px !important;
  box-shadow: none !important;
  filter: none;
  outline: none;
}
.search-bar:focus-within {
  border-color: var(--c8-accent, #04cefc) !important;
  box-shadow: none !important;
  outline: none;
}
.search-bar input,
.search-bar input:focus {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  color: var(--c8-text) !important;
  font-family: var(--font-body);
  font-size: 1rem;
}
.search-bar input::placeholder { color: var(--c8-muted); }
.search-icon, .search-clear { color: var(--c8-accent, #04cefc); }
.search-clear:hover { color: var(--c8-accent, #04cefc); }

/* Tabs: flat neon underline, no box, no glow, no gradient bar. */
.page-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  border-bottom: 1px solid var(--c8-navy, #14233C);
  margin: 0;
}
.tab-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: var(--space-2) 2px var(--space-3);
  margin: 0;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--c8-muted);
  font-family: var(--font-header);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
  overflow: visible;
  white-space: nowrap;
}
.tab-btn::after {
  content: none !important;
  display: none !important;
}
.tab-btn.active {
  color: var(--c8-pink) !important;
  border-bottom-color: var(--c8-pink) !important;
  box-shadow: none !important;
}
.tab-btn:hover {
  color: var(--c8-text);
}
#tab-messages.has-unread #tab-messages-heart {
  color: var(--c8-pink);
  animation: pulse-heart 1s ease-in-out infinite alternate;
}
.tab-note-count {
  display: inline-block;
  min-width: 1.1rem;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--c8-pink);
  color: #000;
  font-size: 0.78rem;
}
.tab-note-count[hidden] { display: none !important; }
#tab-notifications.has-unread { color: var(--c8-pink); }

.page-discover .container.discover-body {
  max-width: 440px;
  padding: var(--space-4) var(--space-4) var(--space-6);
}

.card-stack,
.card-stack .discover-card {
  scroll-margin-top: calc(var(--discover-chrome-offset, var(--header-height, 70px)) + 8px);
}

.card-stack {
  max-width: 440px;
  margin: 0 auto;
  position: relative;
}

/* Profile card: 1px neon, no glow, no hover lift, no wireframe. */
.discover-card,
.search-result-card {
  background: var(--c8-panel);
  border: 1px solid var(--c8-cyan);
  border-radius: 2px;
  box-shadow: none !important;
  filter: none;
  padding: var(--space-4);
  gap: var(--space-4);
  transform: none;
}
.discover-card:hover,
.search-result-card:hover {
  transform: none;
  box-shadow: none !important;
  border-color: var(--c8-accent, #04cefc);
}
.power-user-card {
  border-color: var(--c8-pink) !important;
  box-shadow: none !important;
}

.discover-card .user-name {
  font-family: var(--font-header);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--c8-text);
}
.dc-headline, .dc-location, .discover-card .user-bio {
  color: var(--c8-muted);
  font-size: 1.05rem;
  line-height: 1.5;
}
.section-label {
  font-family: var(--font-header);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--c8-muted);
  margin-bottom: var(--space-2);
}

.user-header {
  gap: var(--space-2);
  margin-bottom: var(--space-1);
  flex-wrap: wrap;
}
.user-header .tier-badge,
.user-header .compile-badge,
.user-header .power-badge {
  align-self: flex-start;
}

/* Tier / compile / elite: flat neon, no glow. */
.tier-badge,
.compile-badge,
.power-badge,
.discover-card .power-badge,
.search-result-card .power-badge {
  background: transparent !important;
  color: var(--c8-muted) !important;
  border: 1px solid var(--c8-navy, #14233C) !important;
  box-shadow: none !important;
  text-shadow: none !important;
  font-family: var(--font-header);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
}
.tier-badge.senior,
.tier-badge.graduate,
.power-badge {
  color: var(--c8-muted) !important;
  border-color: var(--c8-navy, #14233C) !important;
}

/* Stats row: flat chips, no glow. */
.discover-hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.credit-hud {
  margin-top: 0;
  width: 100%;
  font-family: var(--font-mono, "Share Tech Mono", monospace);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #04cefc;
  white-space: nowrap;
}
#btn-purchase-actions {
  background: #14233C;
  color: #fff;
  border: none;
  min-height: 40px;
  padding: 0 14px;
  flex: 0 0 auto;
}
#btn-launch-rocket {
  background: #14233C;
  color: #fff;
  border: none;
  min-height: 40px;
  padding: 0 14px;
  flex: 0 0 auto;
}
#btn-launch-rocket:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dc-gh-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
}
.dc-gh-stats span,
.stat-chip {
  border: 1px solid var(--c8-navy, #14233C);
  color: var(--c8-muted);
  background: transparent;
  border-radius: 2px;
  padding: 0.15rem 0.45rem;
  box-shadow: none !important;
  text-shadow: none;
}

/* Skills: flat neon pills, no glow. */
.skill-tags, .sc-skills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.skill-tag, .sc-skill {
  background: transparent !important;
  color: var(--c8-muted) !important;
  border: 1px solid var(--c8-navy, #14233C) !important;
  border-radius: 999px;
  box-shadow: none !important;
  text-shadow: none;
  padding: 0.2rem 0.65rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
}

.card-view-profile {
  color: var(--c8-muted);
  font-family: var(--font-body);
  font-size: 0.92rem;
}

.card-actions-inline {
  border-top: 1px solid var(--c8-navy, #14233C);
  padding-top: var(--space-3);
  gap: var(--space-4);
}
.discover-card .btn {
  box-shadow: none !important;
  filter: none;
  border-radius: 2px;
}
.discover-card .btn:hover,
.discover-card .btn-primary:hover:not(:disabled),
.discover-card .btn-secondary:hover:not(:disabled) {
  box-shadow: none !important;
}
.discover-card .btn-icon {
  border-radius: 2px;
  width: 48px;
  height: 48px;
}
.cta-build { width: 100%; margin-top: 0; }

.swipe-hint {
  color: var(--c8-muted);
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.swipe-nav-arrow { color: #fff; }

.match-item,
.convo-item,
.notice-item,
.command-row {
  background: var(--c8-panel);
  border: 1px solid var(--c8-cyan);
  border-radius: 2px;
  box-shadow: none !important;
}
.command-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  text-decoration: none;
  color: inherit;
}
.match-avatar-wrap,
.chat-profile-btn {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  position: relative;
}
.match-msg-btn {
  color: var(--c8-pink);
  text-decoration: none;
  font-size: 1.4rem;
  padding: 4px 8px;
}
.convo-body {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.convo-preview,
.notice-body,
.notice-time,
.notice-guided,
.match-skills {
  color: var(--c8-muted);
  font-size: 0.95rem;
}
.notice-guided {
  color: var(--c8-pink);
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.chem-row {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chem-bar {
  flex: 0 0 48px;
  height: 4px;
  border-radius: 2px;
  background: #14233C;
  overflow: hidden;
}
.chem-fill {
  display: block;
  height: 100%;
  background: #fc2ab2;
}
.notice-item.is-unread .match-name,
.convo-item.has-unread .match-name {
  color: var(--c8-pink);
}
.match-item:hover {
  transform: none;
  box-shadow: none !important;
  border-color: var(--c8-accent, #04cefc);
}
.match-card-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}
.match-card-btn .match-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.match-card-btn .match-name {
  display: block;
}
.match-message-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fc2ab2;
  text-decoration: none;
  font-size: 1.35rem;
  border: 1px solid #14233C;
  background: #14233C;
  border-radius: 2px;
}
.unread-count {
  background: var(--c8-pink);
  color: #000;
  box-shadow: none;
}
.unread-heart {
  color: var(--c8-pink);
  -webkit-text-stroke: 0;
  text-shadow: none;
  animation: none;
}

.search-result-card {
  align-items: flex-start;
}
.sc-name {
  font-family: var(--font-header);
  color: var(--c8-text);
}

.match-toast {
  display: none;
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  background: var(--c8-bg);
  color: var(--c8-pink);
  border: 1px solid var(--c8-pink);
  border-radius: 2px;
  padding: 0.7rem 1.1rem;
  font-family: var(--font-header);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: none;
  z-index: 200;
  white-space: nowrap;
}

.empty-state {
  padding: var(--space-6) var(--space-4);
}
.empty-state .crud8-logo-lg {
  width: min(160px, 48vw);
  max-height: 18vh;
}

@media (max-width: 380px) {
  .tab-btn {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    padding-left: 2px;
    padding-right: 2px;
  }
}

@media (max-width: 720px) {
  .page-discover .discover-toolbar {
    padding: 0 0 8px;
  }
  .page-discover .container.discover-body {
    padding: var(--space-4) var(--space-4) var(--space-5);
  }
  .discover-card,
  .search-result-card {
    padding: 1.125rem;
    gap: var(--space-4);
  }
}
