/* 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. A card is the photo tile with plain text under
   it, no box: the price line is what matters, so it's set in tabular figures. */

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

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

/* ---------- Card ---------- */
.ff-figure-card {
    position: relative;   /* keeps the price's screen-reader text inside the card,
                             so it can't stretch a scrolling row (or the page) sideways */
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--ff-text);
    text-decoration: none;
}

.ff-figure-card:focus-visible {
    outline: 2px solid var(--ff-gold);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Photo tile: product photos have white backgrounds, so the tile is light too */
.ff-figure-card__media {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: var(--ff-photo);
    border-radius: 4px;
}

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

/* Hover: a thin outline on the tile and the title underlined; nothing moves */
.ff-figure-card__media::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    border-radius: inherit;
    pointer-events: none;
    transition: border-color 0.15s ease;
}

.ff-figure-card:hover .ff-figure-card__media::after {
    border-color: rgba(14, 15, 17, 0.35);
}

.ff-figure-card:hover .ff-figure-card__title {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Small label in the corner of the photo (product line, e.g. "Nendoroid") */
.ff-figure-card__tag {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ff-text);
    background: var(--ff-pill-bg);
    border-radius: 3px;
}

/* ---------- Text ---------- */
.ff-figure-card__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.ff-figure-card__title {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    /* clamp to 2 lines so the price lines up across a row */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}

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

.ff-figure-card__prices {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 10px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--ff-line);
}

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

/* Market price against RRP (createPricePill in figure-cards.js): plain coloured text
   with an arrow, never the gold accent. Also used over the dark page on the figure page. */
.ff-price-pill {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--ff-text);
}

.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: 400; }

/* ---------- 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-card) 25%, var(--ff-track) 50%, var(--ff-card) 75%);
    background-size: 200% 100%;
    animation: ff-shimmer 1.2s infinite linear;
}

.ff-skel-line {
    height: 11px;
    border-radius: 3px;
}

.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__media::after {
        transition: none;
    }
    .ff-figure-card--skeleton .ff-figure-card__media,
    .ff-figure-card--skeleton .ff-skel-line {
        animation: none;
    }
}
