.npfm {
    --npfm-card-bg: #FFFFFF;
    --npfm-card-border: #F3F4F6;
    --npfm-heading: #1F2937;
    --npfm-text: #1F2937;
    --npfm-muted: #6B7280;
    --npfm-accent: #3B82F6;
    --npfm-badge-free: #2DD4BF;
    --npfm-badge-pro: #1E3A8A;
    --npfm-btn-cta: #1E3A8A;
    --npfm-btn-primary: #2DD4BF;
    --npfm-btn-neutral: #F3F4F6;
    color: var(--npfm-text);
    font-size: 1rem;
    line-height: 1.5;
}

.npfm,
.npfm *,
.npfm *::before,
.npfm *::after {
    box-sizing: border-box;
}

.npfm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--npfm-min-card, 280px)), 1fr));
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.npfm-grid__item {
    min-width: 0;
}

.npfm-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--npfm-card-border);
    border-radius: 8px;
    background: var(--npfm-card-bg);
    color: var(--npfm-text);
    box-shadow: 0 8px 24px rgb(31 41 55 / 7%);
}

.npfm-card__header,
.npfm-card__body,
.npfm-card__actions {
    padding-inline: 1.5rem;
}

.npfm-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.5rem;
}

.npfm-card__logo-box {
    display: grid;
    width: 4rem;
    height: 4rem;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
}

.npfm-card__logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.npfm-card__logo-placeholder {
    color: var(--npfm-accent);
    font-size: 1.75rem;
}

.npfm-platform {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--npfm-accent);
}

.npfm-platform svg,
.npfm-platform img {
    display: block;
    width: 1.5rem;
    height: 1.5rem;
}

.npfm-card__body {
    flex: 1;
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

.npfm-card__title {
    margin: 0;
    color: var(--npfm-heading);
    font-size: 1.3rem;
    line-height: 1.25;
}

.npfm-card__title a {
    color: inherit;
    text-decoration: none;
}

.npfm-card__title a:hover,
.npfm-card__title a:focus-visible {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.15em;
}

.npfm-card__subtitle,
.npfm-card__description,
.npfm-card__price {
    margin: 0;
}

.npfm-card__subtitle {
    margin-top: 0.45rem;
    color: var(--npfm-muted);
    font-size: 0.95rem;
    font-weight: 600;
}

.npfm-card__description {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 0.75rem;
    color: var(--npfm-text);
    line-height: 1.55;
    /* Four full lines. The height is reserved so sibling cards align, and
       the clamp only fires as a guard when a description outgrows the field. */
    min-height: calc(4 * 1.55em);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.npfm-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.npfm-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    color: #FFFFFF;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
}

.npfm-badge--free {
    background: var(--npfm-badge-free);
    color: #123D3A;
}

.npfm-badge--pro {
    background: var(--npfm-badge-pro);
}

.npfm-card__price {
    margin-top: 0.85rem;
    color: var(--npfm-heading);
    font-size: 0.95rem;
    font-weight: 700;
}

.npfm-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding-bottom: 1.5rem;
}

.npfm-button {
    display: inline-flex;
    /* Share one line while both buttons fit; a wrapped button takes the
       full row instead of dangling at content width. */
    flex: 1 1 auto;
    min-height: 2.65rem;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    white-space: nowrap;
    padding: 0.65rem 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

.npfm-button__icon {
    flex: 0 0 auto;
    width: 1.1em;
    height: 1.1em;
}

.npfm-button:hover,
.npfm-button:focus-visible {
    filter: brightness(0.94);
    text-decoration: none;
}

.npfm-button--cta {
    background: var(--npfm-btn-cta);
    color: #FFFFFF;
}

.npfm-button--primary {
    background: var(--npfm-btn-primary);
    color: #1F2937;
}

.npfm-button--neutral {
    border-color: var(--npfm-card-border);
    background: var(--npfm-btn-neutral);
    color: var(--npfm-heading);
}

@media (max-width: 480px) {
    .npfm-card__header,
    .npfm-card__body,
    .npfm-card__actions {
        padding-inline: 1rem;
    }

    .npfm-card__actions .npfm-button {
        flex: 1 1 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .npfm-button {
        transition: none;
    }
}

.npfm-empty-notice {
    padding: 0.75rem 1rem;
    border: 1px dashed var(--npfm-muted);
    border-radius: 8px;
    color: var(--npfm-muted);
    font-size: 0.875rem;
}
