:root {
  --market-ink: #131713;
  --market-paper: #f5f6f4;
  --market-surface: #ffffff;
  --market-line: #d8ddd9;
  --market-green: #217a4c;
  --market-coral: #e7614b;
  --market-muted: #626960;
}

.marketplace-page {
  min-height: 100vh;
  margin: 0;
  background: var(--market-paper);
  color: var(--market-ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.marketplace-header {
  border-bottom: 1px solid rgba(19, 23, 19, 0.1);
  background: rgba(245, 246, 244, 0.94);
  color: var(--market-ink);
  box-shadow: 0 10px 32px rgba(19, 23, 19, 0.06);
}

.marketplace-header :is(.site-nav, .header-actions) {
  color: var(--market-muted);
}

.marketplace-header :is(.site-nav a, .header-actions a):hover,
.marketplace-header :is(.site-nav a, .header-actions a):focus-visible {
  color: var(--market-ink);
}

.marketplace-header .header-cta {
  background: var(--market-ink);
  color: #fff !important;
}

.marketplace-header .header-cta:hover,
.marketplace-header .header-cta:focus-visible {
  background: var(--market-green);
  color: #fff;
}

.marketplace-header .site-mobile-nav summary {
  border-color: rgba(19, 23, 19, 0.16);
  background: rgba(19, 23, 19, 0.04);
  color: var(--market-ink);
}

.marketplace-header .site-mobile-nav-menu {
  border-color: rgba(19, 23, 19, 0.12);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 64px rgba(19, 23, 19, 0.16);
}

.marketplace-header .site-mobile-nav-menu a {
  color: var(--market-muted);
}

.marketplace-header .site-mobile-nav-menu a:hover,
.marketplace-header .site-mobile-nav-menu a:focus-visible {
  background: rgba(19, 23, 19, 0.06);
  color: var(--market-ink);
}

.marketplace-header .site-mobile-nav-menu a:last-child {
  background: var(--market-ink);
  color: #fff;
}

.marketplace-main {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 112px;
}

.marketplace-intro {
  max-width: 820px;
  padding: 42px 0 56px;
}

.marketplace-intro.compact {
  padding-bottom: 42px;
}

.marketplace-kicker,
.template-card-body > div > p {
  margin: 0 0 12px;
  color: var(--market-green);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

.marketplace-intro h1,
.template-detail-heading h1,
.creator-profile-heading h1 {
  max-width: 960px;
  margin: 0;
  font-size: clamp(48px, 5.4vw, 68px);
  font-weight: 650;
  line-height: 1.02;
}

.marketplace-intro > p:last-child,
.template-detail-heading > div > p,
.creator-profile-heading > div > p {
  max-width: 720px;
  margin: 28px 0 0;
  color: var(--market-muted);
  font-size: 19px;
  line-height: 1.6;
}

.marketplace-filters {
  padding: 20px 0 34px;
  border-top: 1px solid var(--market-line);
  border-bottom: 1px solid var(--market-line);
}

.marketplace-filter-panel > summary {
  display: none;
}

.marketplace-filter-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.marketplace-filter-panel:not([open]) > .marketplace-filter-fields {
  display: grid;
}

.marketplace-filter-search {
  grid-column: span 2;
}

.marketplace-filters button {
  justify-self: start;
}

.marketplace-filters label {
  display: grid;
  gap: 7px;
  color: var(--market-muted);
  font-size: 12px;
}

.marketplace-filters :is(input, select) {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--market-line);
  border-radius: 8px;
  background: var(--market-surface);
  color: var(--market-ink);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
}

.marketplace-filters button,
.template-purchase-panel button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--market-ink);
  color: #fff;
  cursor: pointer;
  padding: 0 20px;
  font: inherit;
  font-weight: 620;
}

.marketplace-filters button:hover,
.template-purchase-panel button:hover {
  background: var(--market-green);
}

.marketplace-results,
.marketplace-related {
  padding-top: 46px;
}

.marketplace-results-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.marketplace-results-heading h2,
.template-live-preview h2,
.template-details-grid h2 {
  margin: 0;
  font-size: 36px;
  font-weight: 640;
}

.marketplace-results-heading a,
.template-live-preview > a,
.creator-profile-heading a {
  color: var(--market-green);
  text-underline-offset: 4px;
}

.marketplace-results-heading > div {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.marketplace-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 22px;
}

.marketplace-template-card {
  min-width: 0;
}

.template-card-media {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
  background: #e4e6dd;
  color: var(--market-green);
  font-size: 52px;
  font-weight: 650;
  text-decoration: none;
}

.template-card-placeholder {
  position: relative;
  z-index: 1;
}

.template-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.template-card-media:hover img {
  transform: scale(1.025);
}

.template-card-capabilities {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
}

.template-card-capabilities span,
.template-capabilities span {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(19, 23, 19, 0.84);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
}

.template-card-capabilities span {
  padding: 7px 9px;
  backdrop-filter: blur(10px);
}

.template-card-body {
  padding-top: 15px;
}

.template-card-body > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.template-card-body > div > p {
  margin-bottom: 6px;
}

.template-card-body > div > span {
  color: var(--market-coral);
  font-size: 13px;
  font-weight: 650;
}

.template-card-body h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 640;
}

.template-card-body h3 a {
  color: inherit;
  text-decoration: none;
}

.template-card-body > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 9px 0;
  color: var(--market-muted);
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.template-creator-link {
  color: var(--market-muted);
  font-size: 13px;
  text-underline-offset: 3px;
}

.marketplace-pagination {
  display: flex;
  justify-content: center;
  gap: 20px;
  align-items: center;
  padding-top: 48px;
}

.marketplace-pagination a {
  color: var(--market-green);
}

.marketplace-breadcrumbs {
  display: flex;
  gap: 10px;
  margin-bottom: 48px;
  color: var(--market-muted);
  font-size: 14px;
}

.marketplace-breadcrumbs a {
  color: inherit;
}

.template-detail-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 80px;
  align-items: end;
}

.template-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.template-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.template-capabilities span {
  border-color: rgba(33, 122, 76, 0.22);
  background: rgba(33, 122, 76, 0.09);
  color: var(--market-green);
  padding: 8px 10px;
}

.template-tags span {
  border: 1px solid var(--market-line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--market-muted);
  font-size: 12px;
}

.template-purchase-panel {
  padding: 24px 0 0;
  border-top: 1px solid var(--market-ink);
}

.template-price {
  margin: 0 0 18px;
  font-size: 34px;
  font-weight: 650;
}

.template-purchase-panel button {
  width: 100%;
}

.template-purchase-panel button.secondary {
  margin-top: 8px;
  border: 1px solid var(--market-line);
  background: transparent;
  color: var(--market-ink);
}

.marketplace-downloads {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.marketplace-downloads a {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--market-line);
  color: var(--market-ink);
  font-size: 13px;
  text-decoration: none;
}

.marketplace-downloads a:hover {
  color: var(--market-green);
}

.template-purchase-panel > p:not(.template-price) {
  color: var(--market-muted);
  font-size: 13px;
  line-height: 1.5;
}

.marketplace-action-status:not(:empty) {
  color: var(--market-green) !important;
}

.template-report {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--market-line);
}

.template-report summary {
  cursor: pointer;
  color: var(--market-muted);
  font-size: 13px;
}

.template-report form,
.template-report label {
  display: grid;
  gap: 7px;
}

.template-report form {
  gap: 12px;
  padding-top: 14px;
}

.template-report label {
  color: var(--market-muted);
  font-size: 12px;
}

.template-report :is(select, textarea) {
  width: 100%;
  border: 1px solid var(--market-line);
  border-radius: 8px;
  background: var(--market-surface);
  color: var(--market-ink);
  padding: 10px;
  font: inherit;
}

.template-live-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: end;
  margin-top: 90px;
}

.template-live-preview iframe {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--market-line);
  border-radius: 8px;
  background: #fff;
}

.template-details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 80px;
  padding: 90px 0 30px;
}

.template-details-grid > div > p:last-child {
  max-width: 640px;
  color: var(--market-muted);
  font-size: 18px;
  line-height: 1.65;
}

.template-details-grid dl {
  margin: 0;
  border-top: 1px solid var(--market-line);
}

.template-details-grid dl > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 20px;
  padding: 17px 0;
  border-bottom: 1px solid var(--market-line);
}

.template-details-grid dt {
  color: var(--market-muted);
}

.template-details-grid dd {
  margin: 0;
}

.template-details-grid dd a {
  color: var(--market-green);
}

.creator-directory {
  border-top: 1px solid var(--market-line);
}

.creator-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--market-line);
}

.creator-monogram {
  display: grid;
  width: 52px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: var(--market-green);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
}

.creator-monogram img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creator-monogram.large {
  width: 104px;
  font-size: 26px;
}

.creator-row h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 590;
}

.creator-row h2 a {
  color: inherit;
  text-decoration: none;
}

.creator-row p,
.creator-row > span {
  margin: 0;
  color: var(--market-muted);
  line-height: 1.5;
}

.creator-profile-heading {
  display: grid;
  grid-template-columns: 130px minmax(0, 760px);
  gap: 30px;
  align-items: start;
  padding: 40px 0 70px;
}

.marketplace-empty {
  grid-column: 1 / -1;
  padding: 44px 0;
  color: var(--market-muted);
}

.marketplace-empty h3 {
  margin: 0 0 8px;
  color: var(--market-ink);
  font-size: 22px;
  font-weight: 580;
}

.marketplace-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 30px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 34px max(24px, calc((100% - 1240px) / 2)) 48px;
  border-top: 1px solid var(--market-line);
  color: var(--market-muted);
  font-size: 13px;
}

.marketplace-footer .brand {
  color: var(--market-ink);
  text-decoration: none;
}

.marketplace-footer nav {
  display: flex;
  gap: 18px;
}

.marketplace-footer nav a {
  color: inherit;
}

@media (max-width: 900px) {
  .marketplace-filter-fields {
    grid-template-columns: 1fr 1fr;
  }

  .marketplace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-detail-heading,
  .template-details-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .template-purchase-panel {
    max-width: 420px;
  }

  .marketplace-footer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .marketplace-main,
  .marketplace-footer {
    width: min(100% - 28px, 1240px);
  }

  .marketplace-footer {
    width: 100%;
    padding-right: 14px;
    padding-left: 14px;
  }

  .marketplace-main {
    padding-top: 64px;
  }

  .marketplace-intro h1,
  .template-detail-heading h1,
  .creator-profile-heading h1 {
    font-size: 40px;
  }

  .marketplace-grid {
    grid-template-columns: 1fr;
  }

  .marketplace-filters {
    padding: 14px 0;
  }

  .marketplace-filter-panel > summary {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 650;
    list-style: none;
  }

  .marketplace-filter-panel > summary::-webkit-details-marker {
    display: none;
  }

  .marketplace-filter-panel > summary::after {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    content: "";
    transform: rotate(45deg) translateY(-2px);
    transition: transform 180ms ease;
  }

  .marketplace-filter-panel[open] > summary::after {
    transform: rotate(225deg) translate(-2px, -2px);
  }

  .marketplace-filter-panel > summary small {
    margin-left: auto;
    color: var(--market-muted);
    font-size: 12px;
    font-weight: 450;
  }

  .marketplace-filter-panel:not([open]) > .marketplace-filter-fields {
    display: none;
  }

  .marketplace-filter-fields {
    grid-template-columns: 1fr;
    padding: 8px 0 12px;
  }

  .marketplace-filter-search {
    grid-column: auto;
  }

  .marketplace-results-heading,
  .template-live-preview {
    display: grid;
    grid-template-columns: 1fr;
  }

  .marketplace-results-heading > div {
    gap: 14px;
  }

  .template-live-preview iframe {
    min-height: 560px;
  }

  .creator-row {
    grid-template-columns: 52px 1fr;
  }

  .creator-row > span {
    grid-column: 2;
  }

  .creator-profile-heading {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .template-card-media img {
    transition: none;
  }
}
