/* =========================================================
   Figure page works — books / quotes / excerpts
   Scoped under .fig-works
   ========================================================= */

.fig-works {
    --fw-accent: var(--first-color, #008375);
    --fw-radius: 1.1rem;
    --fw-text: var(--title-color, #0f172a);
    --fw-muted: var(--text-color, #64748b);
    --fw-surface: var(--body-box-color, #fff);
    --fw-border: rgba(15, 23, 42, 0.08);
    --fw-soft: color-mix(in srgb, var(--fw-accent) 8%, transparent);
    margin-top: 1.5rem;
}

body.dark-theme .fig-works {
    --fw-border: rgba(255, 255, 255, 0.08);
}

.fig-works__section {
    margin-bottom: 2rem;
    padding: 1.15rem 1.1rem 1.35rem;
    border-radius: var(--fw-radius);
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

body.dark-theme .fig-works__section {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.fig-works__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--fw-border);
}

.fig-works__head h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 750;
    color: var(--fw-accent);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.fig-works__head h3 i {
    font-size: 1.15rem;
}

.fig-works__count {
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--fw-accent);
    background: var(--fw-soft);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
}

.fig-works__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
}

@media (min-width: 576px) {
    .fig-works__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .fig-works__grid.is-quotes,
    .fig-works__grid.is-excerpts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .fig-works__grid.is-books {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ---- Quote / excerpt cards ---- */
.fig-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    padding: 1rem 1.05rem;
    border-radius: 0.95rem;
    background: color-mix(in srgb, var(--fw-surface) 92%, var(--fw-accent));
    border: 1px solid var(--fw-border);
    border-right: 3px solid var(--fw-accent);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body.dark-theme .fig-card {
    background: rgba(255, 255, 255, 0.03);
}

.fig-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
    border-color: color-mix(in srgb, var(--fw-accent) 35%, var(--fw-border));
}

.fig-card__meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
    font-size: 0.82rem;
    font-weight: 650;
    color: var(--fw-accent);
}

.fig-card__meta a {
    color: inherit;
    text-decoration: none;
}

.fig-card__meta a:hover {
    text-decoration: underline;
}

.fig-card__body {
    flex: 1;
    margin: 0 0 0.85rem;
    color: var(--fw-text);
    font-size: 0.92rem;
    line-height: 1.85;
    text-align: justify;
}

.fig-card__body p {
    margin: 0;
}

.fig-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.7rem;
    border-top: 1px solid var(--fw-border);
}

.fig-card__footer .copy-btn,
.fig-card__footer .like-btn {
    cursor: pointer;
    background: transparent;
    border: 0;
    color: var(--fw-muted);
    font-size: 1.05rem;
    padding: 0.2rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.fig-card__footer .copy-btn:hover,
.fig-card__footer .like-btn:hover {
    color: var(--fw-accent);
    transform: scale(1.08);
}

.fig-card__footer .like-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.fig-card__footer .like-count {
    font-size: 0.8rem;
    color: var(--fw-muted);
}

.fig-card__footer .like-btn.liked {
    color: #e11d48;
}

/* ---- Books ---- */
.fig-book {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
    min-width: 0;
    border-radius: 1rem;
    overflow: hidden;
    background: var(--fw-surface);
    border: 1px solid var(--fw-border);
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.fig-book:hover,
.fig-book:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
    border-color: color-mix(in srgb, var(--fw-accent) 40%, var(--fw-border));
    outline: none;
    color: inherit;
}

.fig-book__cover {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: var(--fw-soft);
}

.fig-book__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.fig-book:hover .fig-book__cover img {
    transform: scale(1.06);
}

.fig-book__overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 1.6rem 0.75rem 0.75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
    color: #fff;
}

.fig-book__title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fig-book__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    font-weight: 650;
    opacity: 0.9;
}

@media (prefers-reduced-motion: reduce) {
    .fig-card,
    .fig-book,
    .fig-book__cover img,
    .fig-suggest__card {
        transition: none !important;
    }
}

/* ---------- Suggested figures sidebar ---------- */
.fig-suggest {
    padding: 1rem;
    border-radius: 1.1rem;
    background: var(--body-box-color, #fff);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

body.dark-theme .fig-suggest {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.fig-suggest__head {
    margin-bottom: 0.85rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

body.dark-theme .fig-suggest__head {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.fig-suggest__head h3 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 750;
    color: var(--first-color, #008375);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.fig-suggest__head p {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    color: var(--text-color, #64748b);
    line-height: 1.5;
}

.fig-suggest__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.fig-suggest__card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.6rem;
    border-radius: 0.85rem;
    text-decoration: none;
    color: inherit;
    background: color-mix(in srgb, var(--first-color, #008375) 6%, transparent);
    border: 1px solid transparent;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.fig-suggest__card:hover,
.fig-suggest__card:focus-visible {
    background: color-mix(in srgb, var(--first-color, #008375) 12%, transparent);
    border-color: color-mix(in srgb, var(--first-color, #008375) 28%, transparent);
    transform: translateX(-2px);
    outline: none;
    color: inherit;
}

.fig-suggest__card img {
    width: 3.05rem;
    height: 3.05rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.08);
}

.fig-suggest__meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}

.fig-suggest__meta strong {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--title-color, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-theme .fig-suggest__meta strong {
    color: #f1f5f9;
}

.fig-suggest__meta small {
    font-size: 0.74rem;
    color: var(--text-color, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fig-suggest__arrow {
    color: var(--first-color, #008375);
    opacity: 0.7;
    flex-shrink: 0;
}

.fig-suggest__more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    margin-top: 0.85rem;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 650;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--first-color, #008375), #00a085);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.fig-suggest__more:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    color: #fff;
}

@media (max-width: 991.98px) {
    .fig-suggest {
        margin-top: 1rem;
        position: static !important;
    }
}
