/**
 * Fancy Font Generator – Plugin Styles
 * Theme-compatible: no forced backgrounds/colors.
 * Uses CSS custom properties that fall back gracefully.
 */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.ffg-wrap {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.ffg-h1 {
    margin-bottom: .3em;
}

.ffg-subtitle {
    margin-top: 0;
    margin-bottom: 1.2em;
    opacity: .7;
    font-size: 1.05em;
}

/* ── Input ────────────────────────────────────────────────────────────────── */
.ffg-input-wrap {
    margin-bottom: 1em;
}

.ffg-input {
    display: block;
    width: 100%;
    padding: .75em 1em;
    font-size: 1.1em;
    border: 2px solid currentColor;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
    transition: box-shadow .2s;
}

.ffg-input:focus {
    box-shadow: 0 0 0 3px rgba(128,128,128,.2);
}

/* ── Input meta row (char count + case toggle) ────────────────────────────── */
.ffg-input-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .4em;
    gap: .5em;
}

.ffg-char-count {
    font-size: .78em;
    opacity: .45;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

.ffg-char-count--warn {
    opacity: .8;
    font-weight: 600;
}

.ffg-case-btns {
    display: flex;
    gap: .3em;
}

.ffg-case-btn {
    padding: .2em .6em;
    border: 1px solid currentColor;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .78em;
    font-weight: 600;
    cursor: pointer;
    opacity: .4;
    transition: opacity .12s;
    line-height: 1.4;
}

.ffg-case-btn:hover {
    opacity: .7;
}

.ffg-case-btn--active {
    opacity: 1;
    border-width: 2px;
    font-weight: 700;
}

/* ── Controls row ─────────────────────────────────────────────────────────── */
.ffg-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5em;
    margin-bottom: 1.2em;
}

/* ── Filter tabs ──────────────────────────────────────────────────────────── */
.ffg-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .4em;
}

.ffg-tab {
    padding: .4em .95em;
    border: 2px solid currentColor;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .85em;
    cursor: pointer;
    opacity: .45;
    transition: opacity .15s;
    line-height: 1.4;
}

.ffg-tab:hover {
    opacity: .75;
}

/* Active: highlighted border using accent color */
.ffg-tab--active {
    opacity: 1;
    border-width: 3px;
    border-color: var(--ffg-accent, currentColor);
    color: var(--ffg-accent, inherit);
    font-weight: 700;
}

/* ── Search ───────────────────────────────────────────────────────────────── */
.ffg-search-wrap {
    flex: 1;
    min-width: 160px;
}

.ffg-search {
    width: 100%;
    padding: .42em .85em;
    border: 1px solid currentColor;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .9em;
    box-sizing: border-box;
    outline: none;
    opacity: .85;
    transition: opacity .15s, box-shadow .15s;
}

.ffg-search:focus {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(128,128,128,.2);
}

/* ── Size slider ──────────────────────────────────────────────────────────── */
.ffg-size-wrap {
    display: flex;
    align-items: center;
    gap: .4em;
    margin-left: auto;
}

.ffg-size-icon {
    font-size: .75em;
    opacity: .5;
    font-weight: 700;
    user-select: none;
    line-height: 1;
}

.ffg-size-icon--lg {
    font-size: 1.2em;
}

.ffg-size-range {
    width: 80px;
    accent-color: currentColor;
    cursor: pointer;
}

/* ── Results grid ─────────────────────────────────────────────────────────── */
.ffg-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1em;
}

/* ── Font card ────────────────────────────────────────────────────────────── */
.ffg-card {
    border: 1px solid rgba(0,0,0,.13);
    border-radius: 10px;
    padding: .85em 1em 1em;
    display: flex;
    flex-direction: column;
    gap: .5em;
    transition: box-shadow .18s;
}

@media (prefers-color-scheme: dark) {
    .ffg-card { border-color: rgba(255,255,255,.13); }
}

.ffg-card:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,.09);
}

.ffg-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4em;
}

.ffg-card__label {
    font-size: .78em;
    font-weight: 700;
    opacity: .6;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.ffg-card__cat {
    font-size: .7em;
    padding: .1em .45em;
    border-radius: 4px;
    border: 1px solid currentColor;
    opacity: .45;
    text-transform: capitalize;
    white-space: nowrap;
}

/* ── Preview text ─────────────────────────────────────────────────────────── */
.ffg-preview {
    word-break: break-word;
    overflow-wrap: anywhere;
    min-height: 1.8em;
    line-height: 1.5;
    flex: 1;
}

/* ── Copy button ──────────────────────────────────────────────────────────── */
.ffg-copy-btn {
    align-self: flex-end;
    padding: .35em 1em;
    border: 2px solid currentColor;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: .82em;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
    min-width: 5em;
    text-align: center;
}

.ffg-copy-btn:hover {
    opacity: .75;
    border-color: var(--ffg-accent, currentColor);
    color: var(--ffg-accent, inherit);
}

/* Copied state: accent border + color */
.ffg-copy-btn--copied {
    font-weight: 700;
    border-width: 3px;
    border-color: var(--ffg-accent, currentColor);
    color: var(--ffg-accent, inherit);
}

/* ── Load More ────────────────────────────────────────────────────────────── */
.ffg-loadmore-wrap {
    text-align: center;
    margin-top: 1.5em;
}

.ffg-loadmore-btn {
    display: inline-flex;
    align-items: center;
    padding: .55em 2em;
    border: 2px solid currentColor;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.ffg-loadmore-btn:hover {
    opacity: .7;
    border-color: var(--ffg-accent, currentColor);
    color: var(--ffg-accent, inherit);
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.ffg-empty {
    grid-column: 1 / -1;
    text-align: center;
    opacity: .5;
    padding: 2em;
}

/* ── Screen reader only ───────────────────────────────────────────────────── */
.screen-reader-text {
    border: 0;
    clip: rect(1px,1px,1px,1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   Content Sections (below generator)
   ════════════════════════════════════════════════════════════════════════════ */

.ffg-content-sections {
    margin-top: 3em;
}

.ffg-section {
    margin-bottom: 2.5em;
}

.ffg-section__h2 {
    margin-bottom: .65em;
}

.ffg-section__body {
    line-height: 1.8;
}

.ffg-section__body ol,
.ffg-section__body ul {
    padding-left: 1.4em;
}

.ffg-section__body li {
    margin-bottom: .4em;
}

/* ── FAQ ──────────────────────────────────────────────────────────────────── */
.ffg-faq-list {
    margin-top: 1em;
}

.ffg-faq-item {
    border-bottom: 1px solid rgba(0,0,0,.1);
    padding-bottom: 1em;
    margin-bottom: 1em;
}

@media (prefers-color-scheme: dark) {
    .ffg-faq-item { border-color: rgba(255,255,255,.1); }
}

.ffg-faq-item__q {
    margin: 0 0 .4em;
    font-size: 1em;
    font-weight: 700;
}

.ffg-faq-item__a {
    line-height: 1.7;
    opacity: .85;
}

/* ════════════════════════════════════════════════════════════════════════════
   EDD Freebies Section
   ════════════════════════════════════════════════════════════════════════════ */

.ffg-section--freebies {
    margin-top: 3em;
}

.ffg-freebies-header {
    margin-bottom: 1.4em;
}

.ffg-freebies-desc {
    margin-top: .3em;
    opacity: .7;
}

.ffg-freebies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.2em;
}

.ffg-freebie-card {
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
}

@media (prefers-color-scheme: dark) {
    .ffg-freebie-card { border-color: rgba(255,255,255,.12); }
}

.ffg-freebie-card:hover {
    box-shadow: 0 6px 22px rgba(0,0,0,.11);
    transform: translateY(-2px);
}

.ffg-freebie-card__thumb {
    display: block;
    overflow: hidden;
    aspect-ratio: 16/9;
    background: rgba(0,0,0,.04);
}

.ffg-freebie-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s;
}

.ffg-freebie-card:hover .ffg-freebie-card__thumb img {
    transform: scale(1.05);
}

.ffg-freebie-card__body {
    padding: .9em 1em 1em;
    display: flex;
    flex-direction: column;
    gap: .4em;
    flex: 1;
}

.ffg-freebie-card__title {
    margin: 0;
    font-size: .95em;
    line-height: 1.4;
}

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

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

.ffg-freebie-card__cat {
    font-size: .75em;
    opacity: .6;
}

.ffg-freebie-card__cat a {
    color: inherit;
    text-decoration: none;
}

.ffg-freebie-card__cat a:hover {
    text-decoration: underline;
}

/* Free Download CTA — uses theme's link/accent color if available */
.ffg-freebie-card__cta {
    display: inline-block;
    margin-top: auto;
    padding: .38em .9em;
    border: 2px solid currentColor;
    border-radius: 6px;
    font-size: .82em;
    font-weight: 700;
    text-decoration: none;
    color: inherit;
    transition: background .15s, color .15s, border-color .15s;
    align-self: flex-start;
}

.ffg-freebie-card__cta:hover {
    opacity: .7;
}

.ffg-freebies-footer {
    margin-top: 1.8em;
    text-align: center;
}

.ffg-view-all-btn {
    display: inline-flex;
    align-items: center;
    padding: .6em 2.2em;
    border: 2px solid currentColor;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    color: inherit;
    transition: background .15s, color .15s, border-color .15s;
}

.ffg-view-all-btn:hover {
    opacity: .7;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .ffg-results {
        grid-template-columns: 1fr;
    }
    .ffg-freebies-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ffg-size-wrap {
        margin-left: 0;
    }
    .ffg-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    .ffg-search-wrap {
        width: 100%;
    }
}

@media (max-width: 380px) {
    .ffg-freebies-grid {
        grid-template-columns: 1fr;
    }
}
