/* Marketplace v5 — desktop ≥1024px listing: hero card, result bar, spotlight cards, list rows, empty state.
 * Tokens come from market-v5.css (body.mkt-v5). The listing card is styled in market-v5-card.css;
 * list rows: MK5.renderRow.
 * Loading skeletons and the end-of-list line (infinite scroll) are in market-scroll.css. */

@media (min-width: 1024px) {
    /* ---- Hero card: an even 1px hairline (the outer box's padding) around a flat, near-black surface ---- */
    #mk5 .mk5-hero {
        display: block; position: relative; z-index: 1; margin-top: 8px; padding: 1px; border-radius: 24px;
        background: rgb(var(--mk-fg) / 0.1);
    }
    #mk5 .mk5-hero__in {
        position: relative; overflow: hidden; border-radius: 23px;
        background: linear-gradient(180deg, rgb(var(--mk-s1)) 0%, rgb(var(--mk-s2)) 100%);
    }
    #mk5 .mk5-hero__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px; padding: 22px 28px 20px; }
    #mk5 .mk5-hero__head { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
    #mk5 .mk5-crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: rgb(var(--mk-fg) / calc(0.45 * var(--mk-tk))); }
    #mk5 .mk5-crumb a { color: inherit; text-decoration: none; transition: color .2s ease; }
    #mk5 .mk5-crumb a:hover { color: rgb(var(--mk-fg)); }
    #mk5 .mk5-crumb [aria-current] { color: rgb(var(--mk-fg) / calc(0.8 * var(--mk-tk))); }
    #mk5 .mk5-crumb__sep { font-size: 8px; opacity: .6; }
    html[dir="rtl"] #mk5 .mk5-crumb__sep { transform: scaleX(-1); }
    #mk5 .mk5-title {
        margin: 0; display: flex; align-items: center; gap: 16px; font-family: inherit; font-size: clamp(30px, 3.2vw, 46px); font-weight: 500;
        line-height: 1; letter-spacing: -0.045em; color: rgb(var(--mk-fg));
    }
    #mk5 .mk5-title__ico { width: 1.15em; height: 1.15em; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 30%; background: rgb(var(--mk-fg)); color: rgb(var(--mk-on)); font-size: 0.5em; letter-spacing: 0; }
    #mk5 .mk5-title__txt { min-width: 0; text-wrap: balance; }
    #mk5 .mk5-title__accent { background: var(--mk-grad); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
    #mk5 .mk5-count { margin: 0; font-size: 14px; font-weight: 500; color: rgb(var(--mk-fg) / calc(0.5 * var(--mk-tk))); }
    #mk5 .mk5-count b { color: rgb(var(--mk-fg)); font-weight: 700; font-variant-numeric: tabular-nums; }

    #mk5 .mk5-search {
        flex: 1 1 340px; max-width: 460px; height: 50px; display: flex; align-items: center; gap: 12px; margin: 0; padding-inline: 16px 5px; border-radius: 14px;
        border: 1px solid rgb(var(--mk-fg) / 0.12); background: var(--mk-well); cursor: text; transition: border-color .2s ease;
    }
    #mk5 .mk5-search:hover, #mk5 .mk5-search:focus-within { border-color: rgb(var(--mk-fg) / 0.25); }
    #mk5 .mk5-search__ico { flex-shrink: 0; font-size: 13px; color: rgb(var(--mk-fg) / calc(0.5 * var(--mk-tk))); }
    #mk5 .mk5-search__input {
        flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; outline: 0; background: transparent; box-shadow: none;
        color: rgb(var(--mk-fg)); font: inherit; font-size: 14.5px; -webkit-appearance: none; appearance: none;
    }
    #mk5 .mk5-search__input:focus-visible { outline: 0 !important; }
    #mk5 .mk5-search__input::placeholder { color: rgb(var(--mk-fg) / calc(0.45 * var(--mk-tk))); opacity: 1; }
    #mk5 .mk5-search__input::-webkit-search-cancel-button, #mk5 .mk5-search__input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
    #mk5 .mk5-search__clear { flex-shrink: 0; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 0; background: transparent; color: rgb(var(--mk-fg) / 0.5); cursor: pointer; }
    #mk5 .mk5-search__clear:hover { color: rgb(var(--mk-fg)); background: rgb(var(--mk-fg) / 0.06); }
    #mk5 .mk5-search__clear.hidden { display: none; }
    #mk5 .mk5-search__btn { flex-shrink: 0; height: 38px; padding: 0 16px; border: 0; border-radius: 10px; background: rgb(var(--mk-acc)); color: rgb(var(--mk-on-acc)); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: opacity .2s ease; }
    #mk5 .mk5-search__btn:hover { opacity: .88; }

    #mk5 .mk5-tabs { display: flex; flex-wrap: wrap; gap: 0 4px; padding: 0 16px; border-top: 1px solid rgb(var(--mk-fg) / 0.07); }
    #mk5 .mk5-tab {
        position: relative; display: flex; align-items: center; gap: 8px; height: 50px; margin: 0; padding: 0 12px; border: 0; background: none; cursor: pointer;
        color: rgb(var(--mk-fg) / calc(0.55 * var(--mk-tk))); font: inherit; font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: color .2s ease;
    }
    #mk5 .mk5-tab:hover, #mk5 .mk5-tab.is-active { color: rgb(var(--mk-fg)); }
    #mk5 .mk5-tab i { font-size: 12px; }
    #mk5 .mk5-tab__n {
        min-width: 22px; height: 20px; padding: 0 7px; display: flex; align-items: center; justify-content: center; border-radius: 999px;
        background: rgb(var(--mk-fg) / 0.06); color: rgb(var(--mk-fg) / calc(0.5 * var(--mk-tk))); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
    }
    #mk5 .mk5-tab.is-active .mk5-tab__n { background: rgb(var(--mk-acc)); color: rgb(var(--mk-on-acc)); }
    #mk5 .mk5-tab::after { content: ''; position: absolute; inset-inline: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: rgb(var(--mk-acc)); opacity: 0; transition: opacity .2s ease; }
    #mk5 .mk5-tab.is-active::after { opacity: 1; }

    /* ---- Result bar ---- */
    #mk5 .mk5-bar { flex-wrap: wrap; gap: 12px 16px; margin: 20px 0 16px; padding-bottom: 14px; border-bottom: 1px solid rgb(var(--mk-fg) / 0.07); }
    #mk5 .mk5-bar__count { display: flex; align-items: baseline; gap: 8px; margin: 0; }
    #mk5 #resultCountDesktop { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: rgb(var(--mk-fg)); }
    #mk5 .mk5-bar__label { font-size: 14px; font-weight: 500; color: rgb(var(--mk-fg) / calc(0.5 * var(--mk-tk))); }
    #mk5 .mk5-bar .mk5-view { display: flex; gap: 2px; padding: 3px; border-radius: 11px; border: 1px solid rgb(var(--mk-fg) / 0.09) !important; background: rgb(var(--mk-fg) / 0.02) !important; box-shadow: none !important; }
    /* theme-light / theme-light-mono paint these controls with !important; the v5 values are restated the same way. */
    #mk5 .mk5-bar .mk5-view .dash-view-btn { width: 36px; height: 32px; border: 0; border-radius: 8px; background: transparent !important; box-shadow: none !important; color: rgb(var(--mk-fg) / calc(0.5 * var(--mk-tk))) !important; font-size: 12px; }
    #mk5 .mk5-bar .mk5-view .dash-view-btn:hover { color: rgb(var(--mk-fg)) !important; }
    #mk5 .mk5-bar .mk5-view .dash-view-btn.active { background: rgb(var(--mk-fg) / 0.1) !important; color: rgb(var(--mk-fg)) !important; }
    #mk5 .mk5-bar .mk5-view .dash-view-btn i { color: inherit !important; }
    #mk5 #mk5Bar .mk5-addall {
        display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid rgb(var(--mk-fg) / 0.14) !important;
        background: rgb(var(--mk-fg) / 0.03) !important; box-shadow: none !important; color: rgb(var(--mk-fg)) !important; font-family: inherit; font-size: 13.5px; font-weight: 600; transition: all .2s ease;
    }
    #mk5 #mk5Bar .mk5-addall:hover:not(:disabled) { background: rgb(var(--mk-acc)) !important; border-color: rgb(var(--mk-acc)) !important; color: rgb(var(--mk-on-acc)) !important; }
    #mk5 #mk5Bar .mk5-addall :is(i, span) { color: inherit !important; }
    #mk5 #mk5Bar .mk5-addall i { font-size: 12px; width: auto; }

    /* ---- Card grid (the card itself: market-v5-card.css) ---- */
    #mk5 #productGrid:not(.dash-compact-grid) { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(230px, calc((100% - 42px) / 4)), 1fr)); gap: 14px; margin-bottom: 16px; }
    #mk5 #productGrid > .dash-card { display: none; }
    @media (hover: hover) {
        #mk5 .mk5-row:hover { background: rgb(var(--mk-fg) / 0.22); }
    }

    /* ---- List view rows (MK5.renderRow): the cards' surface and rim on one line, up to 3 columns ---- */
    #mk5 #productGrid.dash-compact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(300px, calc((100% - 20px) / 3)), 1fr)); gap: 10px; }
    #mk5 .mk5-row {
        min-width: 0; padding: 1px; border-radius: 15px;
        background: rgb(var(--mk-fg) / 0.1); transition: background-color .2s ease;
    }
    #mk5 .mk5-row__in {
        display: flex; align-items: center; gap: 12px; height: 100%; min-height: 62px; padding-block: 10px; padding-inline: 12px 10px; border-radius: 14px;
        background: linear-gradient(180deg, rgb(var(--mk-c1)) 0%, rgb(var(--mk-c2)) 100%);
    }
    #mk5 .mk5-row__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: rgb(var(--mk-fg)); text-decoration: none; }
    /* As tall as the handle + tag beside it, so the platform reads at a glance. */
    #mk5 .mk5-row__ico { width: 36px; height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 11px; background: rgb(var(--mk-fg) / 0.07); color: rgb(var(--mk-fg)); font-size: 16px; }
    /* Handle over its tag, as on the cards: the handle gets the row's whole flexible width before it truncates. */
    #mk5 .mk5-row__id { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
    #mk5 .mk5-row__user { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 600; line-height: 1.2; unicode-bidi: isolate; }
    #mk5 .mk5-row__main:hover .mk5-row__user { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: rgb(var(--mk-fg) / 0.35); }
    #mk5 .mk5-row__tag {
        display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 999px; border: 1px solid rgb(var(--mk-fg) / 0.12);
        font-size: 10.5px; font-weight: 600; line-height: 1; white-space: nowrap; color: rgb(var(--mk-fg) / calc(0.6 * var(--mk-tk)));
    }
    /* Prices line up on the edge next to the Buy pill (dir="ltr" on the price, so RTL flips it by hand). */
    #mk5 .mk5-row__price { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 16px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: rgb(var(--mk-fg)); unicode-bidi: isolate; }
    html[dir="rtl"] #mk5 .mk5-row__price { align-items: flex-start; }
    #mk5 .mk5-row__old { font-size: 11px; font-weight: 500; letter-spacing: 0; color: rgb(var(--mk-fg) / calc(0.4 * var(--mk-tk))); text-decoration-color: rgb(var(--mk-fg) / 0.4); }
    #mk5 .mk5-row__buy {
        flex-shrink: 0; display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 15px; border-radius: 999px;
        border: 1px solid rgb(var(--mk-fg) / 0.16); background: rgb(var(--mk-fg) / 0.1); color: rgb(var(--mk-fg));
        font-size: 13px; font-weight: 700; white-space: nowrap; text-decoration: none;
        transition: transform .3s var(--mk-ease), background-color .2s ease, border-color .2s ease, color .2s ease;
    }
    #mk5 .mk5-row__buy:hover { border-color: rgb(var(--mk-acc)); background: rgb(var(--mk-acc)); color: rgb(var(--mk-on-acc)); transform: translateY(-1px); }
    #mk5 .mk5-row__buy:active { transform: none; }
    #mk5 .mk5-row__buy i { font-size: 10px; }

    /* ---- Empty state ---- */
    #mk5 #noResults { padding: 72px 24px; border-radius: 20px; border: 1px solid rgb(var(--mk-fg) / 0.1) !important; background: linear-gradient(160deg, rgb(var(--mk-c1)) 0%, rgb(var(--mk-c2)) 100%) !important; color: rgb(var(--mk-fg)); }
    #mk5 #noResults h3 { color: rgb(var(--mk-fg)); }
    #mk5 #noResults :is(p, i) { color: rgb(var(--mk-fg) / calc(0.5 * var(--mk-tk))); }
    #mk5 #noResults a { color: rgb(var(--mk-fg)); }

    @media (prefers-reduced-motion: reduce) {
        #mk5 .mk5-row__buy { transition: none; }
        #mk5 .mk5-row__buy:hover { transform: none; }
    }
}
