/**
 * Explore public hub — collector-first discovery layout.
 */

/* Build 467 — match lab-nav injected body chrome from first paint (avoid inject reflow). */
body.xrpl-home-explore {
  padding-top: calc(64px + env(safe-area-inset-top, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* Fixed from frame one so shell mount does not remove an in-flow header (double-space → jump). */
body.xrpl-home-explore #labGlobalHeader.appbar {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  min-height: 64px;
  box-sizing: border-box;
  z-index: 9000;
  overflow-x: clip;
  padding-top: env(safe-area-inset-top, 0px);
}

body.xrpl-home-explore .explore-hero-block {
  min-height: 88px;
}

body.xrpl-home-explore .explore-hero-title {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 1000;
  color: var(--mint, #00ff99);
  line-height: 1.15;
  min-height: calc(1.65rem * 1.15);
}

body.xrpl-home-explore .explore-hero-block .sub {
  margin-top: 6px;
  margin-bottom: 0;
  line-height: 1.35;
  min-height: calc(1.35em * 2);
}

body.xrpl-home-explore #discModeHint {
  min-height: 2.7em;
  line-height: 1.35;
  margin-top: 10px;
  margin-bottom: 0;
}

body.xrpl-home-explore .explore-tabs {
  min-height: 28px;
  margin-top: 12px;
}

body.xrpl-home-explore #secExploreCollections {
  /* Keep section top edge stable once hub/hero geometry is reserved */
  contain: layout;
}

body.xrpl-home-explore #secExploreCollections .disc-head {
  min-height: 55px;
  align-items: center;
}

body.xrpl-home-explore #collectionsCountHint {
  min-height: 1.35em;
  min-width: 8ch;
  display: inline-block;
}

body.xrpl-home-explore #emptyCollections.explore-empty-reserved {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
}

body.xrpl-home-explore #emptyCollections.explore-empty-reserved.is-visible {
  min-height: 1.4em;
  margin: 8px 0 4px;
  padding: 0;
}

body.xrpl-home-explore main.wrap {
  /* Match lab-shell max-width from first paint (avoids 1120→1100 horizontal CLS). */
  width: 100%;
  max-width: min(1100px, 100%);
  margin-left: auto;
  margin-right: auto;
  margin-top: 0;
  padding-top: 18px;
  box-sizing: border-box;
}

.explore-hero-title {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 1000;
  color: var(--mint, #00ff99);
  line-height: 1.15;
}

.explore-mode-chips-hidden {
  display: none !important;
}

.explore-internal-tags-hidden {
  display: none !important;
}

/*
 * Stable hub chrome: always search row + actions row.
 * Prevents 1-row ↔ 2-row flex-wrap CLS (~117px ↔ ~46px).
 */
.explore-hub-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
  margin-top: 12px;
  min-height: 102px;
}

.explore-hub-controls .explore-search-wrap,
.explore-hub-controls .controlRow.explore-search-wrap {
  flex: none;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
}

.explore-hub-controls .explore-hub-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#exploreHubCategory {
  min-width: 180px;
}

#exploreTypeFilter {
  min-width: 168px;
}

/* Keep physical subfilter in flow; collapse without display:none (Build 467). */
#explorePhysicalSubFilter {
  min-width: 168px;
  box-sizing: border-box;
}

#explorePhysicalSubFilter.is-collapsed {
  visibility: hidden;
  pointer-events: none;
  flex: 0 0 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  margin: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  border-width: 0 !important;
  opacity: 0;
  overflow: hidden;
}

#exploreMarketHandoff {
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
}

/* Hard hide unless explicitly visible — beats UA [hidden] races and late mode UI. */
#exploreMarketHandoff:not(.is-visible) {
  display: none !important;
  margin: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#exploreMarketHandoff.is-visible {
  display: flex !important;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
  visibility: visible !important;
}

.disc-gallery-physical-badges {
  margin-top: 6px;
}

.disc-gallery-physical-badges .physical-coa-badges {
  margin: 0;
}

/* Premium collection grid — single flat grid, no nested lanes */
.disc-grid,
#gridCollections.disc-grid,
#gridArtists.disc-grid,
#gridMints.disc-grid {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#gridCollections.disc-grid {
  align-items: start;
}

@media (min-width: 1440px) {
  .disc-grid,
  #gridCollections.disc-grid,
  #gridArtists.disc-grid,
  #gridMints.disc-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .disc-grid,
  #gridCollections.disc-grid,
  #gridArtists.disc-grid,
  #gridMints.disc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .disc-grid,
  #gridCollections.disc-grid,
  #gridArtists.disc-grid,
  #gridMints.disc-grid {
    grid-template-columns: 1fr;
  }
}

#gridCollections.disc-grid > .disc-card,
#gridArtists.disc-grid > .disc-card,
#gridMints.disc-grid > .disc-card {
  min-width: 0;
}

/* Collector-first collection cards — gallery layout (Build 310) */
.explore-gallery-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  min-height: 400px;
}

.explore-gallery-card .disc-card-link,
.explore-gallery-card .disc-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  text-decoration: none;
  color: inherit;
}

.explore-gallery-card .cov-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  width: 100%;
}

.explore-gallery-card .cov,
.explore-gallery-card .disc-cover-simple.cov {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Keep generated/fallback covers square inside reserved media wrappers. */
.explore-gallery-card .cov-wrap > .disc-cover-preview,
.explore-gallery-card .cov-wrap > .disc-cover-fallback,
.explore-gallery-card .cov-wrap > .disc-cover-simple {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  min-height: 0;
}

.explore-gallery-card .disc-gallery-meta {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  min-height: 152px;
}

.explore-gallery-card .disc-gallery-floor {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--mint, #00ff99);
  margin-top: 2px;
  min-height: 20px;
}

.explore-gallery-card .disc-gallery-label-row {
  margin-bottom: 2px;
  min-height: 40px;
}

.explore-gallery-card .disc-gallery-label {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--teal, #00ffcc);
}

.explore-gallery-card .disc-gallery-label--rewards {
  margin-right: 6px;
  color: #ffd54f;
}

.explore-gallery-card .disc-gallery-reason-wrap {
  margin-top: 4px;
}

.explore-gallery-card .disc-gallery-reason {
  font-size: 0.72rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.62);
}

.explore-gallery-card .disc-gallery-search-tag .tag {
  font-size: 0.68rem;
}

.explore-gallery-card .t {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
  line-height: 1.35;
}

.explore-gallery-card .by-creator {
  min-height: 22px;
}

.explore-gallery-card .disc-gallery-category,
.explore-gallery-card .disc-gallery-physical-badges,
.explore-gallery-card .disc-gallery-search-tag {
  min-height: 22px;
}

.explore-grid-skeleton {
  pointer-events: none;
}

.explore-progressive-shell {
  pointer-events: none;
}

.explore-grid-skeleton .disc-card-link,
.explore-progressive-shell .disc-card-link {
  pointer-events: none;
}

.explore-gallery-card .explore-cover-pending {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(15, 18, 36, 0.94) 0%, rgba(30, 36, 64, 0.62) 45%, rgba(15, 18, 36, 0.94) 100%);
  background-size: 200% 100%;
  animation: xh-gallery-sk 1.1s linear infinite;
}

.explore-grid-skeleton .cov-wrap {
  background: transparent;
}

.explore-grid-skeleton .disc-gallery-meta {
  gap: 2px;
}

.explore-grid-skeleton .disc-gallery-shell {
  display: block;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(15, 18, 36, 0.94) 0%, rgba(30, 36, 64, 0.62) 45%, rgba(15, 18, 36, 0.94) 100%);
  background-size: 200% 100%;
  animation: xh-gallery-sk 1.1s linear infinite;
}

.explore-grid-skeleton .disc-gallery-shell--label {
  height: 14px;
  width: 58%;
  margin-top: 2px;
}

.explore-grid-skeleton .disc-gallery-shell--title {
  height: 17px;
  border-radius: 10px;
}

.explore-grid-skeleton .disc-gallery-shell--title + .disc-gallery-shell--title {
  width: 78%;
}

.explore-grid-skeleton .disc-gallery-shell--byline {
  height: 14px;
  width: 66%;
}

.explore-grid-skeleton .disc-gallery-shell--floor {
  height: 14px;
  width: 44%;
}

.explore-buyer-card .t.t-fallback::after {
  content: none;
}

.explore-buyer-card .disc-meta--buyer {
  margin-top: 2px;
}

.disc-cover-simple.cov {
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  background: linear-gradient(145deg, #101010 0%, #171717 55%, #0b0b0b 100%);
  border: 1px solid #00ffcc33;
}

.disc-cover-simple-title {
  font-weight: 900;
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--mint, #00ff99);
}

.disc-mint-card .mint-status {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--teal, #00ffcc);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.disc-mint-card .mint-meta {
  font-size: 0.76rem;
  opacity: 0.78;
  line-height: 1.35;
}

/* Add to Index panel */
.explore-index-panel {
  margin-top: 18px;
}

.explore-index-details {
  border-radius: 12px;
}

.explore-index-summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--mint, #00ff99);
  list-style: none;
}

.explore-index-summary::-webkit-details-marker {
  display: none;
}

.explore-index-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.explore-index-copy {
  margin: 0;
  line-height: 1.45;
}

.explore-index-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.explore-index-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 800;
}

.explore-index-field span em {
  font-style: normal;
  opacity: 0.7;
  font-weight: 700;
}

.explore-index-field input {
  width: 100%;
  min-width: 0;
}

.explore-index-actions {
  grid-column: 1 / -1;
}

.explore-index-status {
  margin: 0;
}

@media (max-width: 720px) {
  .explore-index-form {
    grid-template-columns: 1fr;
  }
}

/* Explore E1 chrome */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.explore-hero-block {
  max-width: 42rem;
}

.explore-hero-kicker {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9bb6ff;
}

.explore-hero-title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #f4f7ff;
}

.explore-hero-sub {
  margin: 10px 0 0;
  font-size: 1rem;
  line-height: 1.45;
  color: #c5d0ef;
  max-width: 36rem;
}

.explore-hub-controls {
  min-height: 0;
  gap: 14px;
  margin-top: 18px;
}

.explore-search-wrap {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  width: 100%;
}

.explore-search-icon {
  position: absolute;
  left: 14px;
  z-index: 1;
  color: #9bb6ff;
  font-size: 1.05rem;
  pointer-events: none;
}

.explore-search-input,
#q.explore-search-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 48px 12px 40px;
  border-radius: 14px;
  border: 1px solid rgba(140, 160, 255, 0.35);
  background: linear-gradient(180deg, #121933 0%, #0b1024 100%);
  color: #f4f7ff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  -webkit-appearance: none;
  appearance: none;
}

.explore-search-input::placeholder,
#q.explore-search-input::placeholder {
  color: #8fa0c8;
  font-weight: 500;
}

.explore-search-input:focus,
#q.explore-search-input:focus {
  border-color: #7b8cff;
  box-shadow: 0 0 0 3px rgba(123, 140, 255, 0.28);
}

.explore-refresh-btn {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(140, 160, 255, 0.25);
  background: rgba(18, 25, 51, 0.9);
  color: #c5d0ef;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.explore-refresh-btn:hover,
.explore-refresh-btn:focus-visible {
  border-color: #7b8cff;
  color: #fff;
  outline: none;
}

.explore-discover-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
}

.explore-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(140, 160, 255, 0.28);
  background: rgba(18, 25, 51, 0.92);
  color: #e8eeff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.explore-chip:hover,
.explore-chip:focus-visible {
  border-color: #7b8cff;
  outline: none;
}

.explore-chip.is-active {
  background: linear-gradient(135deg, rgba(98, 84, 255, 0.55), rgba(40, 120, 255, 0.45));
  border-color: rgba(160, 170, 255, 0.65);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(123, 140, 255, 0.25);
}

.explore-chip--limited .explore-chip-note {
  margin-left: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}

.explore-hub-actions--secondary {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 44px;
}

.explore-select,
.explore-hub-actions select,
#exploreTypeFilter,
#exploreHubCategory,
#explorePhysicalSubFilter {
  min-height: 44px;
  min-width: 148px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(140, 160, 255, 0.28);
  background: #121933;
  color: #e8eeff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  -webkit-appearance: none;
  appearance: none;
}

.explore-select:focus,
.explore-hub-actions select:focus {
  border-color: #7b8cff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(123, 140, 255, 0.22);
}

.explore-tabs {
  margin-top: 4px;
  gap: 6px;
}

.explore-tab {
  min-height: 40px;
  border-radius: 10px;
  font-weight: 700;
}

.explore-mode-hint {
  margin-top: 10px;
  color: #9aa8cc;
}

/* Artwork-first cards: soften technical meta */
.explore-gallery-card .disc-gallery-search-tag,
.explore-gallery-card .disc-gallery-label:not(.disc-gallery-label--rewards) {
  opacity: 0.72;
  font-size: 0.72rem;
}

.explore-gallery-card .cov-wrap {
  border-radius: 14px;
  overflow: hidden;
}

.explore-gallery-card .t {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}

.explore-gallery-card .by-creator {
  opacity: 0.9;
}

.explore-gallery-card .btn {
  min-height: 40px;
}

/* Phone: prefer one strong card column through ~560px */
@media (max-width: 560px) {
  .disc-grid,
  #gridCollections.disc-grid,
  #gridArtists.disc-grid,
  #gridMints.disc-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  .explore-hero-sub {
    font-size: 0.95rem;
  }

  .explore-hub-actions--secondary {
    padding-bottom: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .explore-chip,
  .explore-search-input,
  .explore-refresh-btn {
    transition: none !important;
  }
}
