/* MDJ Swap: marketplace list, posting form, and listing detail. */

:root.swap-page {
  color-scheme: dark;
  --bg: #141413;
  --bg-soft: #141413;
  --surface: rgba(232, 230, 220, 0.08);
  --surface-strong: rgba(232, 230, 220, 0.13);
  --line: rgba(250, 249, 245, 0.16);
  --text: #faf9f5;
  --muted: #b0aea5;
  --subtle: color-mix(in srgb, #b0aea5 72%, #141413);
  --red: #d97757;
  --red-bright: #d97757;
  --gold: #d97757;
  --silver: #e8e6dc;
  --shadow: 0 20px 60px rgba(20, 20, 19, 0.34);
  --swap-primary: #faf9f5;
  --swap-primary-ink: #141413;
  --swap-primary-hover: #e8e6dc;
}

:root.swap-page[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9f5;
  --bg-soft: #faf9f5;
  --surface: rgba(232, 230, 220, 0.58);
  --surface-strong: rgba(250, 249, 245, 0.94);
  --line: rgba(20, 20, 19, 0.14);
  --text: #141413;
  --muted: color-mix(in srgb, #141413 68%, #faf9f5);
  --subtle: color-mix(in srgb, #141413 52%, #faf9f5);
  --red: #d97757;
  --red-bright: #d97757;
  --gold: #d97757;
  --silver: #b0aea5;
  --shadow: 0 18px 56px rgba(20, 20, 19, 0.12);
  --swap-primary: #141413;
  --swap-primary-ink: #faf9f5;
  --swap-primary-hover: color-mix(in srgb, #141413 88%, #d97757);
}

.swap-page .button.primary {
  color: var(--swap-primary-ink);
  border-color: var(--swap-primary);
  background: var(--swap-primary);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--swap-primary) 18%, transparent);
}

.swap-page .lang-menu__item[aria-current="true"] {
  color: #141413;
  background: #d97757;
}

.swap-page .account-avatar {
  color: #141413;
  background: #d97757;
}

.swap-market-page,
.swap-publish-page,
.swap-detail-page {
  width: min(1520px, 100%);
  padding-inline: clamp(14px, 3.2vw, 50px);
}

.swap-market-page [hidden],
.swap-publish-page [hidden],
.swap-detail-page [hidden] {
  display: none !important;
}

.swap-market-page {
  --swap-accent: var(--red-bright);
  --swap-accent-dark: var(--red);
  --swap-control: color-mix(in srgb, var(--surface-strong) 82%, transparent);
}

.swap-kicker {
  margin: 0 0 10px;
  color: var(--swap-accent, var(--red-bright));
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.swap-market-hero {
  padding: 20px 0 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  align-items: end;
  gap: clamp(28px, 6vw, 84px);
  border-bottom: 1px solid var(--line);
}

.swap-market-hero h1,
.swap-page-heading h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(2.6rem, 5.2vw, 5.2rem);
  letter-spacing: -0.055em;
  line-height: 0.96;
}

.swap-market-hero > div > p:last-child,
.swap-page-heading > p:last-child {
  max-width: 55ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.25vw, 1.1rem);
  line-height: 1.6;
}

.swap-market-hero__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 13px;
}

.swap-market-hero__actions p {
  max-width: 38ch;
  margin: 0;
  color: var(--subtle);
  font-size: 0.78rem;
  line-height: 1.55;
}

.swap-publish-button {
  min-width: 180px;
  white-space: nowrap;
}

.swap-publish-button > span:first-child {
  margin-top: -2px;
  font-size: 1.35rem;
  font-weight: 500;
}

.swap-commerce {
  padding: 26px 0 28px;
}

.swap-search {
  display: grid;
  gap: 8px;
}

.swap-search > label,
.swap-field > label {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 850;
}

.swap-search__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px) auto;
  gap: 10px;
}

.swap-search input,
.swap-search select,
.swap-field input,
.swap-field select,
.swap-field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 15px;
  color: var(--text);
  background: var(--swap-control, color-mix(in srgb, var(--surface-strong) 82%, transparent));
  font: inherit;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.swap-field textarea {
  min-height: 168px;
  padding-block: 13px;
  line-height: 1.58;
  resize: vertical;
}

.swap-search input::placeholder,
.swap-field input::placeholder,
.swap-field textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  opacity: 1;
}

.swap-search input:focus,
.swap-search select:focus,
.swap-field input:focus,
.swap-field select:focus,
.swap-field textarea:focus {
  border-color: color-mix(in srgb, var(--red-bright) 70%, var(--line));
  background: var(--surface-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red-bright) 16%, transparent);
}

.swap-search__submit {
  min-height: 48px;
  border: 1px solid color-mix(in srgb, var(--red-bright) 62%, var(--line));
  border-radius: 24px;
  padding: 0 24px;
  color: var(--swap-primary-ink);
  background: var(--swap-primary);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.swap-search__submit:hover { background: var(--swap-primary-hover); }
.swap-search__submit:active { transform: translateY(1px); }

.swap-category-bar {
  margin-top: 15px;
  padding-bottom: 3px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.swap-category-bar button {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0 15px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.swap-category-bar button:hover,
.swap-category-bar button:focus-visible {
  color: var(--text);
  border-color: color-mix(in srgb, var(--red-bright) 44%, var(--line));
}

.swap-category-bar button.is-active {
  color: var(--swap-primary-ink);
  border-color: var(--swap-primary);
  background: var(--swap-primary);
}

.swap-category-bar button:active { transform: translateY(1px); }

.swap-results-heading {
  min-height: 28px;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--subtle);
  font-size: 0.77rem;
}

.swap-results-heading p {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.swap-product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.35vw, 18px);
}

.swap-card,
.swap-card-skeleton {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-soft) 86%, transparent);
  box-shadow: 0 12px 36px color-mix(in srgb, var(--bg) 72%, transparent);
}

.swap-card {
  overflow: hidden;
  color: var(--text);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), border-color 220ms ease, box-shadow 220ms ease;
}

.swap-card:hover,
.swap-card:focus-within {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--red-bright) 45%, var(--line));
  box-shadow: 0 24px 56px color-mix(in srgb, var(--bg) 62%, transparent);
}

.swap-card__link {
  min-width: 0;
  display: block;
  color: inherit;
}

.swap-card__media,
.swap-detail-gallery__main,
.swap-detail-gallery__thumb {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-soft);
}

.swap-photo {
  position: absolute;
  inset: 0 auto 0 0;
  width: 300%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transform: translateX(0);
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.swap-photo--1 { transform: translateX(-33.3333%); }
.swap-photo--2 { transform: translateX(-66.6667%); }

.swap-card__media {
  aspect-ratio: 1.12 / 1;
  border-bottom: 1px solid var(--line);
}

.swap-card__media::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 32%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.24), transparent);
  pointer-events: none;
}

.swap-card__dots {
  position: absolute;
  right: 10px;
  bottom: 9px;
  z-index: 1;
  display: flex;
  gap: 4px;
}

.swap-card__dots span {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.48);
  transition: background 160ms ease, width 160ms ease;
}

.swap-card__dots span.is-active {
  width: 22px;
  background: #f7f4ef;
}

.swap-card__body {
  padding: 13px 14px 15px;
}

.swap-card__title {
  min-height: 2.75em;
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 780;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.swap-card__price-row {
  margin-top: 11px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.swap-card__price {
  color: var(--red-bright);
  font-size: clamp(1.18rem, 1.8vw, 1.48rem);
  font-weight: 900;
  letter-spacing: -0.035em;
}

.swap-card__price small {
  margin-right: 2px;
  font-size: 0.66em;
}

.swap-card__location {
  overflow: hidden;
  color: var(--subtle);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swap-card__details {
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(7px);
  transition: max-height 260ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms ease, transform 220ms ease, margin 220ms ease;
}

.swap-card:hover .swap-card__details,
.swap-card:focus-within .swap-card__details {
  max-height: 96px;
  margin-top: 11px;
  opacity: 1;
  transform: none;
}

.swap-card__details strong {
  display: block;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 850;
}

.swap-card__details p {
  margin: 4px 0 0;
  display: -webkit-box;
  overflow: hidden;
  color: var(--subtle);
  font-size: 0.7rem;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.swap-card__seller {
  margin-top: 12px;
  padding-top: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.73rem;
}

.swap-card__seller strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swap-card-skeleton {
  min-height: 372px;
  overflow: hidden;
  background:
    linear-gradient(100deg, transparent 25%, color-mix(in srgb, var(--surface-strong) 64%, transparent) 44%, transparent 63%) 0 0 / 220% 100%,
    color-mix(in srgb, var(--surface) 75%, transparent);
}

.swap-empty {
  padding: 74px 20px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  text-align: center;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.swap-empty h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.3rem); }
.swap-empty p { margin: 10px auto 24px; color: var(--muted); }
.swap-empty .button { width: auto; }

/* Posting page */

.swap-page-heading {
  max-width: 940px;
  padding: 18px 0 36px;
}

.swap-page-heading h1 { max-width: none; }

.swap-auth-notice {
  margin-bottom: 20px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid color-mix(in srgb, var(--red-bright) 42%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--red-bright) 8%, var(--surface));
}

.swap-auth-notice strong { font-size: 0.98rem; }
.swap-auth-notice p { margin: 5px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

.swap-publish-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  align-items: start;
  gap: 20px;
}

.swap-publish-main {
  display: grid;
  gap: 18px;
}

.swap-form-section,
.swap-publish-summary__card,
.swap-publish-success {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-soft) 86%, transparent);
  box-shadow: 0 14px 42px color-mix(in srgb, var(--bg) 72%, transparent);
}

.swap-form-section {
  padding: clamp(20px, 3vw, 32px);
}

.swap-form-section__heading {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.swap-form-section__heading > span {
  flex: 0 0 auto;
  color: var(--red-bright);
  font-size: 0.72rem;
  font-weight: 900;
}

.swap-form-section__heading h2 {
  margin: -4px 0 0;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
}

.swap-form-section__heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.swap-upload {
  min-height: 170px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px dashed color-mix(in srgb, var(--red-bright) 48%, var(--line));
  border-radius: 18px;
  color: var(--text);
  background: color-mix(in srgb, var(--red-bright) 5%, var(--surface));
  text-align: center;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.swap-upload:hover {
  border-color: var(--red-bright);
  background: color-mix(in srgb, var(--red-bright) 9%, var(--surface));
}

.swap-upload:active { transform: scale(0.995); }
.swap-upload input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
.swap-upload strong { font-size: 1rem; }
.swap-upload span { color: var(--muted); font-size: 0.78rem; }

.swap-upload-previews {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.swap-upload-preview {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

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

.swap-upload-preview span {
  position: absolute;
  inset: auto 6px 6px;
  overflow: hidden;
  color: #fff;
  font-size: 0.64rem;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.swap-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}

.swap-field {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.swap-field--wide { grid-column: 1 / -1; }
.swap-field-help { color: var(--subtle); font-size: 0.71rem; line-height: 1.45; }
.swap-field-error { min-height: 1.2em; margin: 0; color: #e8626f; font-size: 0.72rem; }
.swap-field.is-invalid input,
.swap-field.is-invalid select,
.swap-field.is-invalid textarea { border-color: #e8626f; }

.swap-template-chips {
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.swap-template-chips span {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 7px 11px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.7rem;
  font-weight: 750;
}

.swap-check {
  margin-top: 20px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.swap-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--red-bright);
}

.swap-publish-summary {
  position: sticky;
  top: calc(var(--mdj-header-safe-offset) + 14px);
  display: grid;
  gap: 14px;
}

.swap-publish-summary__card,
.swap-publish-success {
  padding: 24px;
}

.swap-publish-summary h2,
.swap-publish-success h2 { margin: 0; font-size: 1.2rem; }

.swap-publish-summary ul {
  margin: 18px 0 22px;
  padding-left: 18px;
  display: grid;
  gap: 11px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.swap-draft-status {
  margin-bottom: 13px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.73rem;
}

.swap-publish-summary .button { width: 100%; white-space: nowrap; }

.swap-text-link {
  margin-top: 14px;
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  text-align: center;
}

.swap-text-link:hover { color: var(--text); }

.swap-publish-success .ui-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  padding: 7px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--red-bright) 15%, var(--surface));
}

.swap-publish-success p { margin: 9px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }

/* Listing detail */

.swap-detail-loading {
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 20px;
}

.swap-detail-loading > div {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(100deg, transparent 25%, color-mix(in srgb, var(--surface-strong) 60%, transparent) 44%, transparent 63%) 0 0 / 220% 100%,
    color-mix(in srgb, var(--surface) 75%, transparent);
}

.swap-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(340px, 0.82fr);
  align-items: start;
  gap: 20px;
}

.swap-detail-gallery {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.swap-detail-gallery__main {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.swap-detail-gallery__controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.swap-detail-gallery__thumb {
  aspect-ratio: 1.38 / 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.swap-detail-gallery__thumb:hover { transform: translateY(-2px); }
.swap-detail-gallery__thumb[aria-current="true"] { border-color: var(--red-bright); }
.swap-detail-gallery__thumb:not([aria-current="true"]) { opacity: 0.62; }

.swap-detail-panel {
  position: sticky;
  top: calc(var(--mdj-header-safe-offset) + 14px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-soft) 90%, transparent);
  box-shadow: var(--shadow);
}

.swap-detail-panel__main { padding: clamp(22px, 3vw, 34px); }

.swap-detail-panel h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.75rem);
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.swap-detail-price {
  margin-top: 18px;
  color: var(--red-bright);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.055em;
}

.swap-detail-price small { margin-right: 3px; font-size: 0.52em; }

.swap-detail-summary {
  margin: 11px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.swap-detail-actions {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.swap-detail-actions .button { white-space: nowrap; }

.swap-save-button {
  min-width: 88px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0 17px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.swap-save-button[aria-pressed="true"] {
  color: var(--swap-primary-ink);
  border-color: var(--swap-primary);
  background: var(--swap-primary);
}

.swap-spec-groups {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.swap-spec-card {
  min-width: 0;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface);
}

.swap-spec-card span {
  display: block;
  color: var(--subtle);
  font-size: 0.68rem;
  font-weight: 750;
}

.swap-spec-card strong {
  margin-top: 5px;
  display: block;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.4;
}

.swap-seller-card,
.swap-contact-card,
.swap-safety-note {
  margin: 0 clamp(22px, 3vw, 34px);
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.swap-seller-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 13px;
}

.swap-seller-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #141413;
  background: var(--red-bright);
  font-size: 0.78rem;
  font-weight: 900;
}

.swap-seller-card h2 { margin: 0; font-size: 0.96rem; }
.swap-seller-card p { margin: 4px 0 0; color: var(--muted); font-size: 0.74rem; }

.swap-contact-card h2 { margin: 0; font-size: 0.94rem; }
.swap-contact-card p { margin: 7px 0 14px; color: var(--muted); font-size: 0.77rem; line-height: 1.5; }
.swap-contact-card .button { width: 100%; }

.swap-contact-revealed {
  padding: 14px;
  display: grid;
  gap: 6px;
  border-radius: 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--red-bright) 9%, var(--surface));
}

.swap-contact-revealed span { color: var(--muted); font-size: 0.7rem; }
.swap-contact-revealed strong { font-size: 0.95rem; overflow-wrap: anywhere; }

.swap-safety-note {
  color: var(--subtle);
  font-size: 0.7rem;
  line-height: 1.55;
}

.swap-detail-description {
  margin-top: 20px;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg-soft) 86%, transparent);
}

.swap-detail-description h2 { margin: 0; font-size: clamp(1.35rem, 2vw, 1.8rem); }
.swap-detail-description p { margin: 12px 0 0; color: var(--muted); line-height: 1.75; white-space: pre-line; }

.swap-detail-error {
  min-height: 520px;
  display: grid;
  place-content: center;
  justify-items: start;
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 40px;
}

.swap-detail-error h1 { max-width: 14ch; margin: 0; font-size: clamp(2rem, 5vw, 4rem); }
.swap-detail-error p { max-width: 46ch; margin: 14px 0 24px; color: var(--muted); line-height: 1.6; }

@media (min-width: 1500px) {
  .swap-product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .swap-market-page,
  .swap-publish-page,
  .swap-detail-page { padding-inline: 20px; }
  .swap-publish-layout { grid-template-columns: minmax(0, 1fr) 286px; }
  .swap-detail-layout { grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr); }
}

@media (max-width: 980px) and (orientation: portrait) {
  .swap-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .swap-publish-layout,
  .swap-detail-layout { grid-template-columns: 1fr; }
  .swap-publish-summary,
  .swap-detail-panel { position: static; }
  .swap-detail-panel { grid-row: 1; }
}

@media (max-width: 780px) {
  .swap-market-hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 24px;
  }
  .swap-market-hero h1,
  .swap-page-heading h1 { font-size: clamp(2.45rem, 10vw, 4.3rem); }
  .swap-search__row { grid-template-columns: minmax(0, 1fr) minmax(130px, 0.45fr); }
  .swap-search__submit { grid-column: 1 / -1; }
  .swap-results-heading > span { display: none; }
  .swap-auth-notice { align-items: flex-start; flex-direction: column; }
  .swap-form-grid { grid-template-columns: 1fr; }
  .swap-field--wide { grid-column: auto; }
  .swap-upload-previews { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .swap-detail-actions { grid-template-columns: 1fr; }
}

@media (max-width: 620px) and (orientation: portrait) {
  .swap-market-page,
  .swap-publish-page,
  .swap-detail-page { padding-inline: 10px; }
  .swap-market-hero { padding-top: 10px; }
  .swap-market-hero__actions { width: 100%; }
  .swap-market-hero__actions .button { width: 100%; }
  .swap-search__row { grid-template-columns: 1fr; }
  .swap-search__submit { grid-column: auto; }
  .swap-category-bar { margin-inline: -10px; padding-inline: 10px; }
  .swap-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .swap-card__media { aspect-ratio: 1 / 1; }
  .swap-card__body { padding: 10px 10px 12px; }
  .swap-card__title { min-height: 2.7em; font-size: 0.8rem; }
  .swap-card__price { font-size: 1.12rem; }
  .swap-card__location { display: none; }
  .swap-card__details { display: none; }
  .swap-card__seller { margin-top: 9px; padding-top: 9px; font-size: 0.65rem; }
  .swap-card__seller span { display: none; }
  .swap-card__dots span { width: 9px; }
  .swap-card__dots span.is-active { width: 15px; }
  .swap-card-skeleton { min-height: 260px; }
  .swap-form-section { padding: 20px 16px; }
  .swap-upload-previews { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .swap-detail-gallery__main { aspect-ratio: 1 / 1; }
  .swap-detail-panel__main,
  .swap-publish-summary__card,
  .swap-publish-success { padding: 20px 16px; }
  .swap-seller-card,
  .swap-contact-card,
  .swap-safety-note { margin-inline: 16px; }
  .swap-spec-groups { grid-template-columns: 1fr; }
  .swap-detail-description { padding: 20px 16px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .swap-product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .swap-card__body { padding: 9px 10px 10px; }
  .swap-card__title { min-height: 2.55em; font-size: 0.76rem; }
  .swap-card__details { display: none; }
  .swap-card__seller { font-size: 0.64rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .swap-card-skeleton,
  .swap-detail-loading > div { animation: swap-skeleton 1.35s linear infinite; }
}

@keyframes swap-skeleton {
  to { background-position: -220% 0, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .swap-card,
  .swap-photo,
  .swap-card__details,
  .swap-category-bar button,
  .swap-search__submit,
  .swap-detail-gallery__thumb,
  .swap-upload { transition: none; }
  .swap-card:hover,
  .swap-card:focus-within,
  .swap-detail-gallery__thumb:hover { transform: none; }
}
