/*
 * Styles for the plugin list/card output (shortcode, block, and the
 * oEmbed card, which inlines this file since it renders in an isolated
 * sandbox with no access to enqueued stylesheets). Colors mostly derive
 * from currentColor via color-mix() rather than hardcoded values, so the
 * layout adapts to whatever theme it's dropped into, light or dark.
 */

.trmnl-showcase {
    margin: 1.5em 0;
}

.trmnl-showcase-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75em;
    margin-bottom: 1em;
}

.trmnl-showcase-sort-wrap {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.trmnl-showcase-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.trmnl-showcase-select-wrap .trmnl-showcase-chevron {
    position: absolute;
    right: 0.7em;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.trmnl-showcase-sort,
.trmnl-showcase-filter-toggle,
.trmnl-showcase-search-toggle {
    box-sizing: border-box;
    height: 2.5em;
}

.trmnl-showcase-sort {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font: inherit;
    color: inherit;
    background-color: transparent;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    border-radius: 999px;
    padding: 0 1.9em 0 0.9em;
    cursor: pointer;
}

.trmnl-showcase-sort:hover {
    border-color: color-mix(in srgb, currentColor 30%, transparent);
}

.trmnl-showcase-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font: inherit;
    color: inherit;
    background: transparent;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    border-radius: 999px;
    padding: 0 0.9em;
    cursor: pointer;
}

.trmnl-showcase-filter-toggle:hover {
    border-color: color-mix(in srgb, currentColor 30%, transparent);
}

.trmnl-showcase-chevron {
    transition: transform 0.15s ease;
}

.trmnl-showcase-filter-toggle[aria-expanded="true"] .trmnl-showcase-chevron {
    transform: rotate(180deg);
}

.trmnl-showcase-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-bottom: 1em;
}

.trmnl-showcase-filters[hidden] {
    display: none;
}

.trmnl-showcase-filter-pill {
    font: inherit;
    font-size: 0.9em;
    color: inherit;
    background: transparent;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    border-radius: 999px;
    padding: 0.3em 0.8em;
    cursor: pointer;
}

.trmnl-showcase-filter-pill:hover {
    border-color: color-mix(in srgb, currentColor 30%, transparent);
}

.trmnl-showcase-filter-pill.is-active {
    background: color-mix(in srgb, currentColor 15%, transparent);
    border-color: currentColor;
    font-weight: 600;
}

.trmnl-showcase-list {
    display: flex;
    flex-direction: column;
    gap: 0.75em;
}

.trmnl-showcase-row {
    display: flex;
    align-items: center;
    gap: 0.75em;
    padding: 0.6em 0.8em;
    border: 1px solid color-mix(in srgb, currentColor 10%, transparent);
    border-radius: 6px;
}

.trmnl-showcase-row-main {
    display: flex;
    align-items: center;
    gap: 0.75em;
    flex: 1 1 auto;
    min-width: 0;
}

.trmnl-showcase-row-meta {
    display: flex;
    align-items: center;
    gap: 0.75em;
    flex: 0 0 auto;
}

.trmnl-showcase-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 40px;
    overflow: hidden;
    border-radius: 4px;
    background: color-mix(in srgb, currentColor 5%, transparent);
}

.trmnl-showcase-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.trmnl-showcase-icon {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.trmnl-showcase-info {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.trmnl-showcase-title {
    font-weight: 600;
}

.trmnl-showcase-desc {
    font-size: 0.85em;
    opacity: 0.75;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trmnl-showcase-installs {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    flex: 0 0 auto;
    font-size: 0.85em;
    opacity: 0.75;
    white-space: nowrap;
}

.trmnl-showcase-installs-icon {
    flex: 0 0 auto;
}

.trmnl-showcase-link {
    flex: 0 0 auto;
    white-space: nowrap;
    text-decoration: none;
}

@media (max-width: 480px) {
    .trmnl-showcase-row {
        flex-direction: column;
        align-items: stretch;
    }

    .trmnl-showcase-row-meta {
        justify-content: space-between;
    }

    .trmnl-showcase-desc {
        white-space: normal;
    }
}

/* Featured layout */

.trmnl-showcase--featured .trmnl-showcase-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25em;
}

.trmnl-showcase-card {
    display: flex;
    flex-direction: column;
    border: 1px solid color-mix(in srgb, currentColor 10%, transparent);
    border-radius: 8px;
    overflow: hidden;
}

.trmnl-showcase-card-screenshot img {
    display: block;
    width: 100%;
    height: auto;
}

.trmnl-showcase-card-header {
    display: flex;
    align-items: center;
    gap: 0.6em;
    padding: 0.8em 0.9em 0;
}

.trmnl-showcase-card-titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.trmnl-showcase-subtitle {
    font-size: 0.85em;
    opacity: 0.75;
}

.trmnl-showcase-card-description {
    margin: 0.6em 0.9em;
    font-size: 0.9em;
    opacity: 0.85;
}

.trmnl-showcase-card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75em;
    padding: 0 0.9em 0.9em;
}

/* Badge layout */

.trmnl-showcase--badge .trmnl-showcase-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.trmnl-showcase-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.3em 0.7em 0.3em 0.4em;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.9em;
    line-height: 1.2;
}

.trmnl-showcase-badge img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 50%;
}

/* Search box */

.trmnl-showcase-search-wrap {
    display: inline-flex;
    align-items: center;
}

.trmnl-showcase-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5em;
    font: inherit;
    color: inherit;
    background: transparent;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    border-radius: 999px;
    padding: 0;
    cursor: pointer;
}

.trmnl-showcase-search-toggle:hover {
    border-color: color-mix(in srgb, currentColor 30%, transparent);
}

.trmnl-showcase-search {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.4em;
    height: 2.5em;
    font: inherit;
    color: inherit;
    background: transparent;
    border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
    border-radius: 999px;
    padding: 0 0.9em;
    min-width: 12em;
}

.trmnl-showcase-search[hidden],
.trmnl-showcase-search-toggle[hidden] {
    display: none;
}

.trmnl-showcase-search:focus-within {
    border-color: color-mix(in srgb, currentColor 40%, transparent);
}

.trmnl-showcase-search input {
    font: inherit;
    color: inherit;
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    padding: 0;
}

/*
 * The layout above already adapts to the surrounding theme via currentColor,
 * so it works whether the theme is light or dark. Only the couple of spots
 * with a genuinely solid, non-text color (icon-less thumbnails) get an
 * explicit dark-mode tweak here, since a browser-level dark preference and
 * the page's actual (theme-controlled) background aren't the same thing.
 */
@media (prefers-color-scheme: dark) {
    .trmnl-showcase-thumb {
        background: color-mix(in srgb, currentColor 12%, transparent);
    }
}
