/* ── MARKETPLACE ── */
.mkt-section {
  padding: 96px 0 96px;
  position: relative;
  overflow: hidden;
  background: var(--white);
}

.mkt-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 70% 80% at 50% -20%,
    oklch(94% 0.06 192 / 0.55) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.mkt-section::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(
    ellipse 70% 80% at 50% 30%,
    black 20%,
    transparent 75%
  );
  opacity: 0.4;
  pointer-events: none;
}

.mkt-section > .section-inner {
  position: relative;
  z-index: 1;
}

.mkt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.mkt-title {
  font-family: var(--ff-display);
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.15;
  color: var(--ink);
  text-wrap: pretty;
}

.mkt-search {
  position: relative;
  width: 320px;
  max-width: 100%;
}

.mkt-search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.mkt-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  font-family: var(--ff-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mkt-search input:focus {
  outline: none;
  border-color: var(--teal);
}

.mkt-status,
.mkt-empty {
  font-family: var(--ff-body);
  font-size: 15px;
  color: var(--muted);
  padding: 24px 0;
}

/* minmax(0, …) keeps columns equal: a long, non-wrapping app name would
   otherwise widen its own column past the others */
.mkt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 900px) {
  .mkt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .mkt-grid {
    grid-template-columns: 1fr;
  }
}

.mkt-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease;
}

.mkt-card:hover {
  box-shadow: 0 12px 24px oklch(0% 0 0 / 0.12);
  transform: translateY(-2px);
  border-color: var(--ink);
}

.mkt-card[hidden] {
  display: none;
}

.mkt-badge {
  position: absolute;
  top: 0;
  right: 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #80521f;
  background: #fdecd1;
  padding: 4px 10px;
  border-radius: 0 0 4px 4px;
  line-height: 1.2;
}

.mkt-card-content {
  display: block;
  width: 100%;
  padding-top: 20px;
  padding-right: 8px;
  padding-left: 8px;
  padding-bottom: 20px;
  font: inherit;
  text-align: left;
  color: inherit;
  background: none;
  border: none;
  border-radius: inherit;
  cursor: pointer;
}

.mkt-card-content:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.mkt-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 0;
  align-items: start;
}

.mkt-body.has-logo {
  grid-template-columns: 65px minmax(0, 1fr);
}

.mkt-info {
  min-width: 0;
}

.mkt-logo-cell {
  display: flex;
  justify-content: center;
}

.mkt-logo {
  width: 65px;
  height: 65px;
  object-fit: contain;
}

.mkt-name {
  font-family: var(--ff-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mkt-provider {
  font-family: var(--ff-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
}

.mkt-desc {
  font-family: var(--ff-body);
  font-size: 13.5px;
  font-weight: 300;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mkt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.mkt-tag {
  font-family: var(--ff-body);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── DETAIL DIALOG ── */
.mkt-dialog {
  width: min(900px, calc(100% - 48px));
  max-height: min(880px, calc(100vh - 64px));
  /* the global `* { margin: 0 }` reset would otherwise defeat dialog centering */
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 14px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--ff-body);
  overflow: hidden;
}

.mkt-dialog::backdrop {
  background: oklch(0% 0 0 / 0.45);
}

.mkt-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: min(880px, calc(100vh - 64px));
}

.mkt-dialog-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 64px 22px 24px;
  background: linear-gradient(
    135deg,
    oklch(94% 0.04 192 / 0.35) 0%,
    oklch(90% 0.05 192 / 0.55) 100%
  );
}

.mkt-dialog-logo {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: contain;
  padding: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mkt-dialog-title {
  font-family: var(--ff-display);
  font-size: 26px;
  line-height: 1.25;
  color: var(--ink);
}

.mkt-dialog-provider {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

.mkt-dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  padding: 8px;
  color: var(--ink);
  background: oklch(0% 0 0 / 0.06);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.mkt-dialog-close:hover {
  background: oklch(0% 0 0 / 0.12);
}

.mkt-dialog-draft {
  padding: 12px 24px;
  background: #fdecd1;
  color: #80521f;
  border-top: 1px solid #ecd8b6;
  border-bottom: 1px solid #ecd8b6;
  font-size: 14px;
  font-weight: 700;
}

.mkt-dialog-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 24px;
  overflow-y: auto;
}

.mkt-dialog-desc {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.7;
  color: var(--muted);
  white-space: pre-line;
}

.mkt-overline {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.mkt-caption {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.mkt-divider {
  height: 1px;
  border: none;
  background: var(--border);
  margin: 0;
}

.mkt-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.mkt-shot {
  width: 160px;
  height: 110px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.mkt-shot:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 16px oklch(0% 0 0 / 0.16);
}

.mkt-panel {
  background: var(--bg);
  border-radius: 8px;
  padding: 20px;
}

.mkt-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 620px) {
  .mkt-field-grid {
    grid-template-columns: 1fr;
  }
}

.mkt-field-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.mkt-field-value {
  font-size: 14px;
  color: var(--ink);
}

.mkt-field-value.is-indented {
  padding-left: 21px;
}

.mkt-icon {
  flex-shrink: 0;
}

.mkt-icon.is-success {
  color: oklch(58% 0.14 150);
}

.mkt-icon.is-pending {
  color: var(--orange);
}

.mkt-icon.is-error {
  color: oklch(58% 0.16 25);
}

.mkt-status-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mkt-muted {
  color: var(--muted);
}

.mkt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mkt-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}

.mkt-evidence {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-line;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
}

.mkt-panel .mkt-divider {
  margin: 20px 0;
}

.mkt-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
}

.mkt-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--teal-dark);
  text-decoration: none;
}

.mkt-link:hover {
  text-decoration: underline;
}

.mkt-dialog-actions {
  display: flex;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.mkt-dialog-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}

.mkt-dialog-btn:hover {
  background: var(--bg);
}

/* ── SCREENSHOT LIGHTBOX ── */
.mkt-lightbox {
  margin: auto;
  padding: 0;
  border: none;
  background: none;
  max-width: 94vw;
  max-height: 94vh;
  overflow: visible;
}

.mkt-lightbox::backdrop {
  background: oklch(0% 0 0 / 0.75);
}

.mkt-lightbox img {
  display: block;
  max-width: 94vw;
  max-height: 94vh;
  border-radius: 6px;
}

.mkt-lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  padding: 8px;
  color: var(--white);
  background: oklch(0% 0 0 / 0.55);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.mkt-lightbox-close:hover {
  background: oklch(0% 0 0 / 0.75);
}
