/*
 * FavoriteList — heart button, bottom-right toast, grouped list.
 * Bootstrap-friendly, no dependency. Override --fl-accent to match a brand.
 */

:root {
    --fl-accent: #66736b;
    --fl-accent-contrast: #ffffff;
    --fl-toast-bg: #1c1c1e;
    --fl-toast-fg: #ffffff;
}

/* ── Heart button ──────────────────────────────────────────────────────── */

.fl-btn {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.94);
    color: var(--fl-accent);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.fl-btn:hover {
    transform: scale(1.08);
}

.fl-btn:focus-visible {
    outline: 3px solid var(--fl-accent);
    outline-offset: 2px;
}

.fl-btn__icon {
    display: inline-flex;
}

.fl-btn svg {
    width: 1.125rem;
    height: 1.125rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

.fl-btn.is-active {
    background: var(--fl-accent);
    color: var(--fl-accent-contrast);
}

.fl-btn.is-active svg {
    fill: var(--fl-accent);
}

.fl-btn.is-active svg path {
    animation: fl-heart-pop 0.35s ease;
}

.fl-btn.is-busy {
    opacity: 0.65;
    pointer-events: none;
}

/* Standalone placement (shortcode inside post content). */
.fl-btn-wrap {
    position: relative;
    display: inline-block;
}

.fl-btn-wrap .fl-btn {
    position: static;
    vertical-align: middle;
}

@keyframes fl-heart-pop {
    0% {
        transform: scale(0.65);
    }

    60% {
        transform: scale(1.18);
    }

    100% {
        transform: scale(1);
    }
}

/* ── Toast: bottom-right, rises from the bottom edge ────────────────────── */

.fl-toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1080;
    min-width: 16rem;
    max-width: calc(100vw - 2.5rem);
    padding: 0.85rem 1.1rem;
    border-radius: 0.5rem;
    background: var(--fl-toast-bg);
    color: var(--fl-toast-fg);
    font-size: 0.9375rem;
    line-height: 1.35;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translateY(140%);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.28s ease;
    pointer-events: none;
}

.fl-toast--in {
    opacity: 1;
    transform: translateY(0);
}

/* ── Badge / count ─────────────────────────────────────────────────────── */

/* Floating Favorite List Badge */
.fl-badge {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1050;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;

    width: 52px;
    height: 52px;
    padding: 0;

    color: #fff;
    background: var(--fl-accent);
    border-radius: 50%;

    text-decoration: none;

    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease;
}

/* Hide the floating button when there are no favorites */
.fl-badge:has(.fl-badge__count[hidden]) {
    display: none;
}

.fl-badge:hover {
    color: #fff;
    text-decoration: none;
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.fl-badge:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 3px;
}

.fl-badge__icon {
    width: 24px;
    height: 24px;

    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.fl-badge__text {
    display: none;
}

.fl-badge__count {
    position: absolute;
    top: -5px;
    right: -5px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 22px;
    height: 22px;
    padding: 0 5px;

    border-radius: 999px;

    background: var(--fl-accent);
    color: var(--fl-accent-contrast);

    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;

    border: 2px solid #fff;
}

/* Mobile */
@media (max-width: 575.98px) {
    .fl-badge {
        right: 15px;
        bottom: 15px;

        width: 48px;
        height: 48px;
    }

    .fl-badge__icon {
        width: 22px;
        height: 22px;
    }

    .fl-badge__count {
        min-width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }
}

/* ── Grouped list ──────────────────────────────────────────────────────── */

.fl-group__title {
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    font-size: 0.8125rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.fl-group__count {
    opacity: 0.6;
}

.fl-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.fl-list[data-fl-columns="1"] .fl-grid {
    grid-template-columns: 1fr;
}

.fl-list[data-fl-columns="2"] .fl-grid {
    grid-template-columns: repeat(2, 1fr);
}

.fl-list[data-fl-columns="3"] .fl-grid {
    grid-template-columns: repeat(3, 1fr);
}

.fl-list[data-fl-columns="4"] .fl-grid {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 992px) {
    .fl-list[data-fl-columns="3"] .fl-grid,
    .fl-list[data-fl-columns="4"] .fl-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .fl-grid {
        grid-template-columns: 1fr;
    }
}

/* Favorites cards container */
.fl-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

/* Card */
.fl-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.35rem;
    background: #fff;
}

/* Image */
.fl-card__media {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.fl-card__image,
.fl-card__image--placeholder {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.06);
}

/* Card content */
.fl-card__body {
    padding: 0.9rem;
}

.fl-card__title {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
    line-height: 1.3;
}

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

.fl-card__title a:hover {
    text-decoration: underline;
}

.fl-card__excerpt {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.75;
}

/* Tablet */
@media (max-width: 900px) {
    .fl-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile: 2 columns */
@media (max-width: 600px) {
    .fl-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .fl-card__body {
        padding: 0.7rem;
    }

    .fl-card__title {
        font-size: 0.95rem;
    }

    .fl-card__excerpt {
        font-size: 0.8rem;
    }
}

.fl-empty {
    padding: 3rem 0;
    text-align: center;
}

.fl-empty__link {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.55rem 1.25rem;
    border-radius: 0.25rem;
    background: #1c1c1e;
    color: #fff;
    text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
    .fl-btn,
    .fl-toast {
        transition-duration: 0.01ms;
    }

    .fl-btn.is-active svg path {
        animation: none;
    }
}
