/* Shared marketplace listing card. Used by the browse grid and publish review.
   Restrained treatment: byline below title, inline metadata tags, kebab on
   hover, suppressed zero-stat row. The featured-hero slot is the only one
   wearing the full amber bracket frame; cards stay quiet so the hero stands
   out. */

.marketplace-card {
    border: 1px solid var(--surface-3);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    position: relative;
    transition: border-color 150ms ease, transform 150ms ease;
}

.marketplace-card:hover {
    border-color: var(--surface-5);
}

.marketplace-card[data-href] { cursor: pointer; }
.marketplace-card[data-href]:hover { border-color: var(--accent); }
.marketplace-card[data-href]:hover .marketplace-card-title { color: var(--accent-bright); }

/* The card clips its contents (cover zoom) by default, which would also clip
   the absolutely-positioned actions dropdown. On mobile the card is a short
   row and the menu always overruns its bottom edge, so let the menu escape
   only while it's open, and lift the card so the dropdown paints above
   neighbours. */
.marketplace-card:has(.marketplace-card-menu-btn[aria-expanded="true"]) {
    overflow: visible;
    z-index: 5;
}

.marketplace-card--preview {
    max-width: 360px;
    margin: 0 auto;
}

.marketplace-card-topbar {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 10px;
    color: var(--text-mute);
    font-size: 11px;
    letter-spacing: 0.08em;
}

.marketplace-card-time {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-mute);
}

.marketplace-card-menu {
    color: var(--text-mute);
    font-size: 16px;
    line-height: 1;
}

.marketplace-card-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.marketplace-card-menu-btn {
    width: 26px;
    height: 26px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.marketplace-card-menu-btn:hover,
.marketplace-card-menu-btn:focus-visible,
.marketplace-card-menu-btn[aria-expanded="true"] {
    border-color: var(--surface-5);
    background: var(--surface-1);
    color: var(--accent);
    outline: none;
}

.marketplace-card-actions-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 4;
    min-width: 170px;
    border: 1px solid var(--hairline);
    background: var(--bg-void);
    box-shadow: 0 12px 30px var(--shadow-strong);
    padding: 5px;
}

.marketplace-card-actions-menu a,
.marketplace-card-actions-menu button {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 10px;
    font: inherit;
    font-size: 12px;
    line-height: 1.2;
    text-align: left;
    text-decoration: none;
    padding: 9px 10px;
    cursor: pointer;
}

.marketplace-card-actions-menu a:hover,
.marketplace-card-actions-menu button:hover,
.marketplace-card-actions-menu a:focus-visible,
.marketplace-card-actions-menu button:focus-visible {
    background: var(--surface-0);
    color: var(--accent);
    outline: none;
}

.marketplace-card-cover {
    aspect-ratio: 16 / 10;
    background: var(--bg-void);
    display: block;
    overflow: hidden;
    position: relative;
}

.marketplace-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 320ms ease;
}

.marketplace-card:hover .marketplace-card-cover img { transform: scale(1.03); }

.marketplace-card-body {
    border-top: 1px solid var(--bg-tertiary);
    background: var(--bg-elevated);
    padding: 14px 14px 16px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Title + kebab on one row: title grows, the menu sits flush right and does
   not shrink. */
.marketplace-card-titlerow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.marketplace-card-titlerow .marketplace-card-menu-wrap {
    flex: 0 0 auto;
}

.marketplace-card-title {
    color: var(--accent);
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-weight: normal;
    font-size: 19px;
    line-height: 1.18;
    margin: 0;
    overflow-wrap: anywhere;
}

.marketplace-card-titlerow .marketplace-card-title {
    flex: 1 1 auto;
    min-width: 0;
}

/* Byline now lives below the title. Artwork + identity lead; recency is meta. */
.marketplace-card-byline {
    color: var(--text-mute);
    font-size: 11px;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: -2px 0 2px;
    min-width: 0;
}

.marketplace-card-author {
    color: var(--mute-grey);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.marketplace-card-byline-sep {
    color: var(--surface-5);
}

.marketplace-card-summary {
    color: var(--mute-grey);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

/* Inline metadata: no border, divider separator. Single line, clipped when
   the card is too narrow; visually distinct from filter pills above the
   grid. */
.marketplace-card-tags {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    min-width: 0;
    overflow: hidden;
}

.marketplace-card-tag {
    color: var(--text-dim);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 0;
    border: none;
}

.marketplace-card-tag + .marketplace-card-tag {
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid var(--hairline);
}

/* One row: tags left, stats pinned right (margin-left auto on the stats, so
   a stats-only foot still lands right), everything on the same vertical
   center line under a dashed rule. renderCard always has the heart in the
   foot; the legacy render() emits the foot only when it has content, so the
   rule never dangles on an empty card. */
.marketplace-card-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--bg-tertiary);
}

.marketplace-card-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-dim);
    font-size: 12px;
    flex-shrink: 0;
    margin-left: auto;
}

.marketplace-card-stats .stat-likes,
.marketplace-card-stats .stat-forks {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.marketplace-card-stats[hidden] { display: none; }

/* Like heart. Shared with the listing detail page (.mp-listing-stats .heart in
   marketplace_listing_page.css); the button lives on the card, so its base
   styling lives here in the card component, not the page CSS. */
.marketplace-card .heart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid var(--text-dim);
    color: var(--text-dim);
    cursor: pointer;
    font: inherit;
}

.marketplace-card .heart.heart-filled {
    color: var(--accent);
    border-color: var(--accent);
}

.marketplace-card .heart[disabled] {
    opacity: 0.6;
    cursor: wait;
}

/* Mobile list-row layout. Cover square on the left, title + tight meta on the
   right. Topbar (kebab), summary, and stats are hidden so each row stays
   compact and a single screen can show many. */
@media (max-width: 640px) {
    .marketplace-card {
        flex-direction: row;
        align-items: stretch;
    }
    .marketplace-card-topbar { display: none; }

    .marketplace-card-cover {
        aspect-ratio: auto;
        width: 96px;
        height: auto;
        flex-shrink: 0;
        align-self: stretch;
        border-right: 1px solid var(--bg-tertiary);
    }
    .marketplace-card:hover .marketplace-card-cover img { transform: none; }

    .marketplace-card-body {
        border-top: 0;
        padding: 10px 12px 10px 12px;
        gap: 4px;
        min-width: 0;
    }
    .marketplace-card-title {
        font-size: 15px;
        line-height: 1.2;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .marketplace-card-byline {
        font-size: 10px;
        margin: 0;
    }
    .marketplace-card-summary {
        font-size: 11.5px;
        line-height: 1.4;
        color: var(--text-dim);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .marketplace-card-foot {
        padding-top: 2px;
        gap: 8px;
        border-top: 0;
    }
    .marketplace-card-stats {
        gap: 10px;
        font-size: 10.5px;
        color: var(--text-mute);
    }
    /* Compact pill heart for the list row; the desktop 44px tap target would
       double the row's height. Rounded (FAB-style) so it reads as a like
       affordance rather than a boxy stat chip. The extra-specific selector
       (0,3,0) is needed to beat base.css's global
       `button:not(...):not(...)` 44px touch-target rule (0,2,1). */
    .marketplace-card-foot .marketplace-card-stats .heart {
        min-width: 0;
        min-height: 26px;
        padding: 0 8px;
        gap: 3px;
        border-radius: 999px;
    }
    .marketplace-card-tag {
        font-size: 10px;
        letter-spacing: 0.06em;
    }
}
