/* Figure Finder - figure card grid
   Uses the --ff-* colour tokens from home-format.css, which every page that shows
   figure cards loads after this file. */

/* ---------- Grid ---------- */
.ff-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    padding: 16px 72px;
    margin: 0;
    list-style: none;
}

@media (max-width: 480px) {
    .ff-card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 12px;
    }
}

/* ---------- Card ---------- */
.ff-figure-card {
    position: relative;   /* keeps the price pill's screen-reader text inside the card,
                             so it can't stretch a scrolling row (or the page) sideways */
    display: flex;
    flex-direction: column;
    background: var(--ff-card);
    border: 1px solid var(--ff-card-border);
    border-radius: 12px;
    overflow: hidden;
    color: var(--ff-text);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.ff-figure-card:hover,
.ff-figure-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    border-color: var(--ff-gold);
    outline: none;
}

/* Image area: fixed portrait ratio, image letterboxed (never cropped) */
.ff-figure-card__media {
    position: relative;
    aspect-ratio: 3 / 4;
    background: rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ff-figure-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%; /* keeps heads in frame if any cropping happens */
    display: block;
}

/* Hover animation: figure zooms in slightly and a soft light sweeps across */
.ff-figure-card__media {
    overflow: hidden;
}

.ff-figure-card__media img {
    transition: transform 0.35s ease;
}

.ff-figure-card:hover .ff-figure-card__media img,
.ff-figure-card:focus-visible .ff-figure-card__media img {
    transform: scale(1.07);
}

.ff-figure-card__media::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    transform: skewX(-15deg);
    pointer-events: none;
}

.ff-figure-card:hover .ff-figure-card__media::after,
.ff-figure-card:focus-visible .ff-figure-card__media::after {
    left: 130%;
    transition: left 0.6s ease;
}

/* Small label in the corner of the image (product line, e.g. "Nendoroid") */
.ff-figure-card__tag {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ff-text);
    background: rgba(16, 17, 20, 0.72);
    border-radius: 999px;
}

/* ---------- Text ---------- */
.ff-figure-card__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 12px;
    flex: 1;
}

.ff-figure-card__series {
    font-size: 12px;
    color: var(--ff-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ff-figure-card__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    /* clamp to 2 lines so every card is the same height */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
}

.ff-figure-card__prices {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 8px;
    margin-top: auto;
    padding-top: 8px;
}

.ff-figure-card__rrp {
    font-size: 13px;
    color: var(--ff-text-secondary);
}

/* Market price vs RRP (createPricePill in figure-cards.js). Direction has its own
   colours, never the gold accent; all pass 4.5:1 on the dark pill. */
.ff-price-pill {
    display: inline-block;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--ff-text);
    background: var(--ff-pill-bg);
    border-radius: 999px;
}

.ff-price-pill--up   { color: var(--ff-up); }
.ff-price-pill--down { color: var(--ff-down); }
.ff-price-pill--none { color: var(--ff-neutral); font-weight: 600; }

/* ---------- Loading / empty states ---------- */
.ff-figure-card--skeleton {
    pointer-events: none;
}

.ff-figure-card--skeleton .ff-figure-card__media,
.ff-figure-card--skeleton .ff-skel-line {
    background: linear-gradient(90deg, var(--ff-track) 25%, var(--ff-card-border) 50%, var(--ff-track) 75%);
    background-size: 200% 100%;
    animation: ff-shimmer 1.2s infinite linear;
}

.ff-skel-line {
    height: 12px;
    border-radius: 6px;
}

.ff-skel-line--short {
    width: 55%;
}

@keyframes ff-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

.ff-grid-status {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px 0;
    color: var(--ff-text-secondary);
    font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
    .ff-figure-card:hover .ff-figure-card__media img,
    .ff-figure-card:focus-visible .ff-figure-card__media img {
        transform: none;
    }
    .ff-figure-card__media::after {
        display: none;
    }
    .ff-figure-card,
    .ff-figure-card--skeleton .ff-figure-card__media,
    .ff-figure-card--skeleton .ff-skel-line {
        transition: none;
        animation: none;
    }
}