/* ═══════════════════════════════════════════════════
   Atomi — Marketplace Section
   8-element premium product cards
   3-layer hover: scale + shadow + border highlight
   ═══════════════════════════════════════════════════ */

.marketplace {
  position: relative;
  padding: clamp(var(--space-64), 10vh, var(--space-96)) clamp(var(--space-24), 5vw, var(--space-96));
  background:
    radial-gradient(ellipse 48% 44% at 82% 24%, oklch(0.72 0.16 294 / 0.05), transparent 62%),
    radial-gradient(ellipse 40% 36% at 14% 78%, oklch(0.84 0.12 72 / 0.07), transparent 54%),
    linear-gradient(180deg, var(--ivory) 0%, var(--ivory-clean) 50%, var(--rhythm-paper) 100%);
  overflow: hidden;
}

.marketplace-inner {
  position: relative;
  z-index: 1;
  width: min(1480px, 100%);
  margin: 0 auto;
}

.marketplace::after {
  content: "Atomi";
  position: absolute;
  right: clamp(32px, 4vw, 72px);
  top: 0;
  z-index: 0;
  writing-mode: vertical-rl;
  color: transparent;
  -webkit-text-stroke: 1px oklch(0.28 0.08 286 / 0.24);
  font-family: var(--font-display);
  font-size: clamp(10rem, 16vw, 18rem);
  font-weight: 700;
  line-height: 0.8;
  pointer-events: none;
  opacity: 1;
}

.marketplace .section-head {
  margin-bottom: clamp(var(--space-48), 6vh, var(--space-64));
}

/* ── Grid ─────────────────────────────────────────── */
.mkt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: clamp(var(--space-16), 2vw, var(--space-32));
}

/* ── Card shell ───────────────────────────────────── */
.mkt-card {
  position: relative;
  border: 1px solid oklch(0.78 0.04 76 / 0.18);
  border-radius: var(--radius-card);
  background:
    radial-gradient(circle at 14% 8%, oklch(0.99 0.01 84 / 0.52), transparent 32%),
    linear-gradient(158deg, oklch(0.994 0.01 82 / 0.58), oklch(0.966 0.018 76 / 0.16)),
    oklch(0.99 0.012 82 / 0.36);
  backdrop-filter: blur(18px) saturate(1.06);
  -webkit-backdrop-filter: blur(18px) saturate(1.06);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  transform: translateZ(0);
  will-change: transform;
  transition:
    transform 0.28s var(--ease),
    border-color 0.35s var(--ease);
}

.mkt-card:hover,
.mkt-card:focus-visible {
  transform: translateY(-3px) scale(1.01);
  border-color: oklch(0.82 0.12 74 / 0.48);
}

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

.mkt-card:hover .btn-arrow,
.mkt-card:focus-visible .btn-arrow {
  transform: translateX(4px);
}

/* ── Featured variant ─────────────────────────────── */
.mkt-card--featured {
  border-color: oklch(0.82 0.12 74 / 0.28);
}

.mkt-card--featured:hover {
  border-color: oklch(0.84 0.14 72 / 0.52);
}

/* ── Cover area ───────────────────────────────────── */
.mkt-cover {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: oklch(0.16 0.04 286);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.mkt-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Logo (top-left) ──────────────────────────────── */
.mkt-logo {
  position: absolute;
  top: 14px; left: 14px;
  z-index: 2;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: oklch(0.15 0.06 288 / 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid oklch(0.99 0.01 82 / 0.12);
  box-shadow: 0 4px 14px oklch(0.1 0.04 288 / 0.3);
  overflow: hidden;
}

.mkt-logo img {
  width: 28px; height: 28px;
  display: block;
}

.mkt-logo-initials {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 650;
  color: oklch(0.95 0.02 85);
  letter-spacing: 0.02em;
}

/* ── Verified badge (top-right) ───────────────────── */
.mkt-verified {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px 4px 8px;
  border-radius: var(--radius-full);
  background: oklch(0.15 0.06 288 / 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid oklch(0.99 0.01 82 / 0.14);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 620;
  color: oklch(0.95 0.02 85);
}

.mkt-verified svg {
  width: 14px; height: 14px;
  color: oklch(0.82 0.12 77);
  flex-shrink: 0;
}

/* ── New badge (below verified) ───────────────────── */
.mkt-card--new .mkt-cover::before {
  content: "New";
  position: absolute;
  top: 50px; right: 14px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: oklch(0.72 0.16 294 / 0.85);
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 650;
  color: oklch(0.99 0.01 82);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Card body ────────────────────────────────────── */
.mkt-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  flex: 1;
}

/* ── Meta row: service type + rating ──────────────── */
.mkt-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mkt-service-type {
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--violet);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: oklch(0.72 0.16 294 / 0.08);
  border: 1px solid oklch(0.72 0.16 294 / 0.1);
}

.mkt-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 560;
  color: var(--ink-soft);
  margin-left: auto;
}

.mkt-rating svg {
  width: 14px; height: 14px;
  color: oklch(0.78 0.11 77);
}

/* ── Product name ─────────────────────────────────── */
.mkt-name {
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.25;
}

/* ── Tags ─────────────────────────────────────────── */
.mkt-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 1.55rem;
  align-items: flex-start;
}

.mkt-tag {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: oklch(0.99 0.012 82 / 0.42);
  border: 1px solid oklch(0.78 0.04 76 / 0.12);
  white-space: nowrap;
}

/* ── Description ──────────────────────────────────── */
.mkt-desc {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-soft);
  flex: 1;
  min-height: calc(0.85rem * 1.5 * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Foot: delivery + price + CTA ─────────────────── */
.mkt-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid oklch(0.78 0.035 76 / 0.14);
}

.mkt-delivery {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  line-height: 1.25;
  white-space: normal;
}

.mkt-price {
  font-family: var(--font-ui);
  font-size: 1.02rem;
  font-weight: 620;
  color: var(--ink);
  flex: 1;
  min-width: max-content;
  white-space: nowrap;
}

.mkt-cta {
  flex-shrink: 0;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Marketplace RC freeze fixes: scoped responsive polish only. */
@media (max-width: 1280px) {
  .marketplace::after {
    opacity: 0.18;
    -webkit-text-stroke-color: oklch(0.28 0.08 286 / 0.12);
  }
}

@media (max-width: 1024px) {
  .marketplace {
    padding-top: clamp(46px, 6vw, 64px);
    padding-bottom: clamp(56px, 7vw, 80px);
  }

  .marketplace .section-head {
    margin-bottom: clamp(28px, 4vw, 40px);
  }
}

@media (max-width: 900px) {
  .marketplace .mkt-foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .marketplace .mkt-delivery {
    min-width: 0;
    white-space: normal;
    line-height: 1.28;
  }

  .marketplace .mkt-price {
    min-width: 0;
    justify-self: end;
    text-align: right;
    white-space: normal;
    line-height: 1.2;
  }

  .marketplace .mkt-cta {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .marketplace {
    padding-top: clamp(36px, 8vw, 48px);
  }

  .marketplace::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .marketplace {
    padding-top: 34px;
  }
}

/* Approved design alignment: denser product shelf without changing card structure. */
@media (min-width: 1121px) {
  .marketplace {
    padding: clamp(32px, 4.6vh, 48px) clamp(24px, 5vw, 96px) clamp(26px, 4vh, 38px);
    background:
      radial-gradient(ellipse 42% 40% at 76% 20%, oklch(0.72 0.16 294 / 0.04), transparent 62%),
      radial-gradient(ellipse 34% 34% at 16% 74%, oklch(0.84 0.12 72 / 0.06), transparent 54%),
      linear-gradient(180deg, var(--ivory) 0%, var(--ivory-clean) 48%, var(--rhythm-paper) 100%);
  }

  .marketplace-inner {
    width: min(1160px, 100%);
  }

  .marketplace::after {
    right: clamp(24px, 4vw, 58px);
    top: -18px;
    font-size: clamp(7rem, 10.5vw, 12rem);
    opacity: 0.3;
    -webkit-text-stroke-color: oklch(0.28 0.08 286 / 0.11);
  }

  .marketplace .section-head {
    display: flex;
    align-items: end;
    margin-bottom: 18px;
  }

  .marketplace .section-label {
    font-size: 0.62rem;
    letter-spacing: 0.24em;
  }

  .marketplace .section-title {
    max-width: 560px;
    font-size: clamp(1.92rem, 2.3vw, 2.46rem);
    line-height: 1.06;
  }

  .marketplace .section-note {
    max-width: 310px;
    font-size: 0.72rem;
    line-height: 1.44;
  }

  .mkt-grid {
    gap: 12px;
  }

  .mkt-card {
    border-radius: 13px;
    border-color: oklch(0.74 0.052 70 / 0.18);
    background:
      radial-gradient(circle at 16% 8%, oklch(0.99 0.01 84 / 0.5), transparent 32%),
      linear-gradient(158deg, oklch(0.994 0.01 82 / 0.5), oklch(0.968 0.018 76 / 0.17));
    backdrop-filter: blur(10px) saturate(1.02);
    -webkit-backdrop-filter: blur(10px) saturate(1.02);
    box-shadow:
      0 7px 18px oklch(0.34 0.04 286 / 0.035),
      inset 0 1px 0 oklch(0.99 0.01 82 / 0.46);
    transition:
      transform 0.24s var(--ease),
      border-color 0.28s var(--ease),
      box-shadow 0.28s var(--ease);
  }

  .mkt-card:hover,
  .mkt-card:focus-visible {
    transform: translateY(-2px);
    box-shadow:
      0 11px 26px oklch(0.34 0.04 286 / 0.058),
      inset 0 1px 0 oklch(0.99 0.01 82 / 0.54);
  }

  .mkt-cover {
    height: 112px;
    border-radius: 13px 13px 0 0;
  }

  .mkt-cover-img {
    object-position: center 38%;
  }

  .mkt-logo {
    top: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .mkt-logo img {
    width: 21px;
    height: 21px;
  }

  .mkt-verified {
    top: 10px;
    right: 10px;
    padding: 3px 9px 3px 6px;
    font-size: 0.58rem;
  }

  .mkt-card--new .mkt-cover::before {
    top: 37px;
    right: 10px;
    font-size: 0.52rem;
  }

  .mkt-body {
    padding: 11px 13px 13px;
    gap: 5px;
  }

  .mkt-service-type {
    padding: 2px 8px;
    font-size: 0.58rem;
    letter-spacing: 0.11em;
  }

  .mkt-rating {
    font-size: 0.66rem;
  }

  .mkt-name {
    font-size: 0.92rem;
    line-height: 1.18;
  }

  .mkt-tags {
    min-height: 1.14rem;
    gap: 5px;
  }

  .mkt-tag {
    padding: 2px 6px;
    font-size: 0.56rem;
  }

  .mkt-desc {
    min-height: calc(0.66rem * 1.34 * 2);
    font-size: 0.66rem;
    line-height: 1.34;
  }

  .mkt-foot {
    gap: 7px;
    padding-top: 8px;
  }

  .mkt-delivery {
    font-size: 0.6rem;
  }

  .mkt-price {
    font-size: 0.8rem;
  }

  .mkt-cta {
    font-size: 0.68rem;
  }
}
