@font-face { font-family: Inter; src: url('../../fonts/Inter-Latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
:root { overscroll-behavior-x: none; --green: #bbff29; --black: #0b0d08; --white: #f8f9f2; --muted: #cbd0c2; }
* { box-sizing: border-box; }
html:has(.product-detail) { overscroll-behavior-y: none; }
body { margin: 0; background: var(--green); color: var(--black); font: 16px/1.45 Inter, Arial, sans-serif; }
main {
  --market-top: 24px;
  --market-gutter: max(36px, calc((100% - 1212px) / 2));
  min-height: 100svh;
  padding-block: var(--market-top);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}
main:has(.empty-panel) { align-content: safe center; }
main[data-search-start]:not(:has(.empty-panel)) { align-content: start; padding-block-start: max(var(--market-top), calc(50svh - 27px)); }
#marketplace-results { min-width: 0; padding-inline: var(--market-gutter); }
.market-frame:has(.listing-carousel, .product-detail) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-block-size: calc(100dvh - 2 * var(--market-top));
}
.market-frame:has(.listing-carousel, .product-detail) #marketplace-results {
  display: grid;
  align-content: safe center;
}

h1, h2, h3, p, figure, dl, dd { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.screen-reader { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.market-header { position: relative; z-index: 1; margin-inline: var(--market-gutter); display: grid; grid-template-columns: minmax(0, 1fr) minmax(345px, 493px); align-items: center; gap: 18px; padding: 0 0 17px 3px; }
.action { display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 7px 14px; border: 0; border-radius: 999px; background: var(--white); color: var(--black); font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.action:is(:hover, :focus-visible) { background: var(--green); }
.product-detail { display: grid; grid-template-columns: minmax(0, .60fr) minmax(0, 1fr); padding: 14px; border-radius: 29px; background: var(--black); color: var(--white); }
.product-photo { position: relative; min-width: 0; min-height: min(540px, 68dvh); }
.product-photo img { position: absolute; inset: 0; }
.product-copy { min-width: 0; display: grid; grid-template-rows: auto auto auto auto minmax(54px, 1fr); gap: 13px; padding-block: clamp(16px, calc(12dvh - 65px), 44px); padding-inline: 28px clamp(24px, 5.625vw, 72px); }
.product-brand { color: var(--muted); font-size: 13px; }
.product-copy h1 { max-width: 22ch; overflow-wrap: anywhere; font-size: clamp(26px, 3.3vw, 41px); letter-spacing: -.065em; line-height: 1; }
.product-price { margin-top: 8px; color: var(--green); font-size: 28px; font-weight: 720; letter-spacing: -.055em; line-height: 1; }
.product-heading { min-width: 0; }
.product-heading .result-thumbs { margin-top: 10px; }
.product-facts, .analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 17px; }
.product-facts { margin-top: 28px; }
.product-facts > div, .analysis-grid > div { padding-top: 7px; border-top: 1px solid #45493c; }
.product-copy dt { font-size: 12px; font-weight: 700; }
.product-copy dd { color: var(--muted); font-size: 12px; }
.product-analysis { padding-top: 11px; border-top: 1px solid #606854; }
.product-analysis summary { font-size: 14px; font-weight: 700; cursor: pointer; }
.product-analysis[open] summary { margin-bottom: 7px; }
.analysis-grid dt { display: flex; justify-content: space-between; gap: 5px; }
.analysis-grid dt span { color: var(--green); font-size: 10px; font-weight: 500; }
.buy { align-self: end; background: #fff; }
.listing-carousel { min-width: 0; padding: 14px; border-radius: 29px; background: var(--black); color: var(--white); }
body:has(.listing-dots) { overscroll-behavior-x: none; touch-action: pan-y pinch-zoom; }
body:has(.listing-dots) .result-track { touch-action: pan-y pinch-zoom; }
.result-track { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow: hidden; border-radius: 17px; }
.result-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); min-width: 0; }
.result-media { position: relative; width: 100%; min-width: 0; }
.result-media::before { content: ""; display: block; aspect-ratio: 1; }
.result-photo { position: absolute; inset: 0; }
.result-photo, .product-photo img { --photo-radius: 17px; display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--photo-radius); }
.photo-expand { position: absolute; right: 10px; bottom: 10px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 9px; background: var(--white); color: var(--black); font-size: 22px; }
.photo-expand:hover { background: var(--green); }
.result-copy { align-self: center; display: grid; gap: 10px; padding: clamp(18px, 4vw, 58px); min-width: 0; }
.result-copy h2 { max-width: 20ch; font-size: clamp(25px, 4vw, 52px); line-height: 1; letter-spacing: -.06em; overflow-wrap: anywhere; }
.result-seller { font-size: 13px; color: var(--muted); }
.result-copy strong { font-size: 25px; color: var(--green); }
.result-open { justify-content: space-between; margin-top: 8px; padding-inline: 17px; }
.result-thumbs { display: flex; gap: 7px; overflow-x: auto; overscroll-behavior-x: contain; padding: 4px; scrollbar-width: thin; }
.result-thumbs[hidden] { display: none; }
.result-thumbs button { flex: 0 0 46px; height: 46px; overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 8px; background: transparent; }
.result-thumbs button[aria-pressed="true"] { border-color: var(--green); }
.result-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.listing-dots { padding-top: 4px; }
.photo-dialog { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 56px 16px 16px; border: 0; background: transparent; }
.photo-dialog[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); place-items: center; gap: 8px; }
.photo-dialog::backdrop { background: #0b0d0833; backdrop-filter: blur(20px); }
.photo-dialog > img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  background: transparent;
  border-radius: 17px;
}
.photo-dialog .result-thumbs { width: max-content; max-width: 100%; }
.photo-dialog .photo-expand { top: 8px; bottom: auto; }
body:has(.photo-dialog[open]) { overflow: hidden; }
.empty-query { margin-bottom: 12px; font-size: clamp(34px, 5vw, 64px); letter-spacing: -.07em; }
.empty-panel { display: grid; grid-template-columns: minmax(0, .73fr) minmax(0, 1.27fr); gap: 15px; padding: 13px; border-radius: 29px; background: var(--black); color: var(--white); }
.empty-copy { align-self: center; padding: 12px 15px; }
.empty-copy h2 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 52px); line-height: .95; letter-spacing: -.07em; }
.empty-copy p { color: var(--muted); }
.browse-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.browse-photos a { overflow: hidden; border-radius: 17px; }
.browse-photos img { display: block; width: 100%; height: 310px; object-fit: cover; }
@media (max-width: 680px) {
  main { --market-top: 16px; --market-gutter: 12px; }
  main[data-search-start]:not(:has(.empty-panel)) { padding-block-start: max(var(--market-top), calc(50svh - 26px)); }
  .market-header { grid-template-columns: auto minmax(0, 1fr); gap: 0; padding: 0; margin-bottom: 12px; border-radius: 999px; background: var(--black); }
  .market-header .back-arrow { width: 44px; height: 44px; margin-left: 5px; border: 1px solid var(--green); }
  .market-header .market-search {
    justify-self: end;
    width: calc(100% - 8px);
    background: transparent;
  }
  .market-header .market-search[data-typing="center"] .search-field input { padding-inline-start: 18px; text-align: center; }
  .market-header .market-search[data-typing="center"] input:placeholder-shown { padding-inline: 18px; }
  .empty-query { display: none; }
  .result-photo { --photo-radius: 13px; }
  .result-track, .photo-dialog img { border-radius: 13px; }
  .listing-carousel { padding: 9px; border-radius: 20px; }
  .result-card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .result-media::before { max-block-size: 40dvh; }
  .result-copy {
    align-self: stretch;
    grid-template-rows: auto auto 1fr minmax(54px, auto) auto;
    padding: 15px 8px 5px;
  }
  .result-copy h2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    max-block-size: 3lh;
    overflow: hidden;
  }
  .result-copy strong { align-self: start; font-size: 21px; }
  .result-open { grid-row: 5; align-self: end; margin-top: 2px; }
  .empty-panel { grid-template-columns: 1fr; }
  .browse-photos img { height: 123px; }
}


@media (width < 960px) {
  .product-detail { grid-template-columns: 1fr; padding: 9px; border-radius: 20px; }
  .product-photo {
    width: 100%;
    min-height: 0;
    max-height: 26.5dvh;
    aspect-ratio: 3 / 2;
  }
  .product-photo img { --photo-radius: 13px; }
  .product-copy { grid-template-rows: auto auto auto auto auto; gap: 7px; padding: 10px 6px 6px; }
  .product-copy h1 { max-width: none; }
  .product-heading .result-thumbs { margin-top: 7px; }
  .product-facts { margin-top: 4px; }
  .product-copy .buy { margin-top: 13px; }
  .analysis-grid { gap: 6px 18px; }
  .analysis-grid dt span { margin-inline-end: 6px; }

}

@media (width < 480px) {
  main { --market-top: 12px; }
  .product-photo { max-height: 16.5dvh; }
  .product-copy { gap: 5px; }
  .product-facts { margin-top: 2px; }
  .analysis-grid dt { flex-wrap: wrap; gap: 0 5px; }
}

@media (width > 680px) and (prefers-reduced-motion: no-preference) {
  .market-header-entering { isolation: isolate; }
  .market-header-entering::before {
    content: '';
    position: absolute;
    top: 0;
    left: 26px;
    width: var(--market-back-travel);
    height: 54px;
    border-radius: 999px;
    background: var(--black);
    pointer-events: none;
    z-index: -1;
    animation: market-header-bridge 240ms ease-in-out both;
  }
  .market-header-entering .back-arrow { animation: market-back-separate 240ms cubic-bezier(.22,.8,.25,1) both; }
  .market-header-entering .market-search { transform-origin: right; animation: market-search-stretch 240ms cubic-bezier(.22,.8,.25,1) both; }
}
@keyframes market-back-separate { from { transform: translateX(var(--market-back-travel)); } }
@keyframes market-search-stretch { from { transform: scaleX(.94); } }
@media (max-width: 680px) {
  .market-frame:has(.listing-carousel, .product-detail) {
    margin-inline: var(--market-gutter);
    border-radius: 26px;
    background: var(--black);
  }
  .market-frame:has(.listing-carousel) {
    block-size: calc(100dvh - 2 * var(--market-top));
  }
  .market-frame:has(.listing-carousel, .product-detail) .market-header {
    margin: 0;
    padding-block-end: 0;
  }
  .market-frame:has(.product-detail) #marketplace-results {
    padding: 9px 0 0;
    align-content: stretch;
  }
  .product-detail {
    grid-template-rows: auto 1fr;
    border-radius: 0 0 26px 26px;
    padding-block-start: 0;
  }
  .product-detail .product-copy {
    grid-template-rows: auto auto auto auto minmax(54px, 1fr);
  }
  .product-detail .buy { margin-top: 8px; }
  .product-detail .product-photo {
    max-height: none;
    height: clamp(160px, 37dvh, 360px);
    aspect-ratio: auto;
    border-radius: 13px;
    background: #141710;
  }
  .product-analysis summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    list-style: none;
    min-height: 34px;
  }
  .product-analysis summary::-webkit-details-marker { display: none; }
  .product-analysis summary::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 5px;
    border: solid var(--green);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
  }
  .product-analysis[open] summary::after { transform: rotate(225deg); }
  .market-frame:has(.listing-carousel) #marketplace-results {
    min-block-size: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: stretch;
    padding: 9px 0 4px;
    overflow: clip;
  }
  #marketplace-results :is(h1, h2)[tabindex="-1"]:focus { outline: none; }
  .listing-carousel { display: grid; grid-template-rows: minmax(0, 1fr); padding-block: 0; }
  .result-card { grid-template-rows: minmax(0, 1fr) auto; }
  .result-media::before { display: none; }
  .result-copy { grid-template-rows: auto auto auto auto; gap: clamp(5px, 1.3dvh, 10px); padding-bottom: 8px; }
  .result-open { grid-row: auto; }
  .listing-dots { padding-block: 4px; color: var(--green); }
  html:has(.listing-carousel) { overflow-y: hidden; overscroll-behavior-y: none; }
}

@media (max-width: 680px) and (max-height: 590px) {
  .result-copy { padding-top: 8px; }
  .result-copy h2 { font-size: clamp(20px, 5.5vw, 25px); }
  .result-thumbs button { flex-basis: 38px; height: 38px; }
}

@keyframes market-header-bridge {
  0% { clip-path: inset(0 0 0 96% round 999px); }
  50% { clip-path: inset(10px 0 10px 12% round 999px); }
  100% { clip-path: inset(27px 0 27px 100% round 999px); }
}

:root { view-transition-name: none; }
#marketplace-results[data-panel-direction] { view-transition-name: market-results; }
:root:has([data-panel-direction])::view-transition { pointer-events: none; overflow: clip; }
::view-transition-group(market-results) {
  overflow: visible;
  transform-origin: top left;
  animation-duration: 160ms;
  animation-timing-function: cubic-bezier(.22,.8,.25,1);
}
::view-transition-image-pair(market-results) { overflow: visible; }
::view-transition-old(market-results),
::view-transition-new(market-results) {
  mix-blend-mode: normal;
  animation: none;
}
::view-transition-old(market-results) { animation: market-panel-out 130ms cubic-bezier(.22,.8,.25,1) both; }
:root:has([data-panel-direction="back"])::view-transition-old(market-results) { animation-name: market-panel-out-back; }
::view-transition-new(market-results) { animation: market-panel-forward 160ms cubic-bezier(.22,.8,.25,1) both; }
:root:has([data-panel-direction="back"])::view-transition-new(market-results) {
  animation-name: market-panel-back;
}
@keyframes market-panel-forward { from { transform: translateX(100%); } }
@keyframes market-panel-back { from { transform: translateX(-100%); } }
@keyframes market-panel-out { to { transform: translateX(-100%); } }
@keyframes market-panel-out-back { to { transform: translateX(100%); } }

/* Keep desktop Marketplace cards within the viewport, including the carousel dots. */
@media (width > 680px) and (height >= 650px) {
  html { overflow-y: hidden; overscroll-behavior-y: none; }
  main { min-height: 100dvh; }
  .result-media::before { max-block-size: calc(100dvh - 200px); }
  .result-copy { padding-block: clamp(12px, 4dvh, 42px); }
  .result-copy h2 { font-size: clamp(25px, min(4vw, 6dvh), 52px); }
}
@media (680px < width < 960px) and (height >= 650px) {
  .product-photo { max-height: min(26.5dvh, calc(100dvh - 585px)); }
}
@media (width > 680px) and (650px <= height < 720px) {
  main { --market-top: 12px; }
  .product-copy { gap: 6px; }
  .product-copy h1 { max-width: none; font-size: clamp(24px, 3vw, 32px); }
  .product-facts { margin-top: 5px; }
}

@media (prefers-reduced-motion: no-preference) {
  .marketplace-from-world { overflow-x: clip; }
  .marketplace-from-world .market-frame {
    animation: marketplace-pull-in 390ms cubic-bezier(.22,.8,.25,1) both;
  }
}
@keyframes marketplace-pull-in { from { transform: translateX(100vw); } }

.market-header .search-entry .search-submit:is(:active, [data-touch-pressed]),
.market-header .back-arrow:is(:active, [data-touch-pressed]) {
  background: var(--green);
  color: var(--black);
  transition-delay: 0s;
}
