/**
 * FontFinder - Styles
 */

:root {
    --ff-editor-text: #FFECD9;
    --ff-editor-bg: #11110F;
}

/* scrollbar-gutter géré dynamiquement par JS (updateScrollbarGutter) */

/* Preview Component */
.fontfinder-preview {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
}

.fontfinder-preview__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid #e5e5e5;
    background: #fafafa;
}

.fontfinder-preview__control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fontfinder-preview__control label {
    font-size: 14px;
    color: #666;
}

.fontfinder-preview__control select {
    padding: 6px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.fontfinder-preview__control select:focus {
    outline: none;
    border-color: #171717;
}

.fontfinder-preview__input {
    width: 100%;
    min-height: 200px;
    padding: 32px;
    border: none;
    resize: none;
    font-size: 48px;
    line-height: 1.4;
    color: #171717;
}

.fontfinder-preview__input:focus {
    outline: none;
}

.fontfinder-preview__input::placeholder {
    color: #a3a3a3;
}

.fontfinder-preview__notice {
    padding: 12px 16px;
    margin: 0;
    background: #fafafa;
    border-top: 1px solid #f5f5f5;
    font-size: 12px;
    color: #666;
}

/* Price Badges */
.font-price {
    font-size: 14px;
    color: #525252;
}

.font-price strong {
    color: #171717;
}

.font-price--free {
    color: #16a34a;
    font-weight: 600;
}

.font-price--subscription {
    color: #737373;
}

/* Virtual Scroll Container */
#ff-listing {
    position: relative;
    overflow: hidden;
}

#ff-pool {
    position: absolute;
    top: 0;
    left: 0;
    right: 2px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(max(400px, 25%), 1fr));
    gap: 0;
    will-change: transform;
}

.ff-card {
    opacity: 0;
    transition: opacity 0.15s;
}

.ff-card.ff-visible {
    opacity: 1;
}

.ff-card.ff-empty {
    opacity: 1;
    pointer-events: none;
    cursor: default;
}

.ff-card.ff-empty .font-card__preview,
.ff-card.ff-empty .font-card__info,
.ff-card.ff-empty .font-card__designer,
.ff-card.ff-empty .ff-alt-bar {
    display: none;
}

/* Reveal global : on cache uniquement le CONTENU des cartes (pas les bordures)
   jusqu'a ce que le viewport soit pret, puis on revele d'un bloc.
   Filter/sort change uniquement. */
#ff-pool.ff-pool-pending .font-card__preview,
#ff-pool.ff-pool-pending .font-card__info,
#ff-pool.ff-pool-pending .font-card__designer,
#ff-pool.ff-pool-pending .ff-alt-bar {
    opacity: 0;
}



/* No results */
.ff-no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    width: 100%;
}

.ff-no-results__title {
    font-size: 24px;
    color: #fff;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    margin: 0;
}

/* Filter Sidebar */
.fontfinder-filters {
    width: 256px;
    flex-shrink: 0;
}

.fontfinder-filters__section {
    margin-bottom: 24px;
}

.fontfinder-filters__title {
    font-size: 14px;
    font-weight: 500;
    color: #525252;
    margin: 0 0 12px 0;
}

.fontfinder-filters__option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

.fontfinder-filters__option input[type="checkbox"],
.fontfinder-filters__option input[type="radio"] {
    accent-color: #171717;
}

.fontfinder-filters__option label {
    font-size: 14px;
    color: #525252;
    cursor: pointer;
}

/* Utilities */
.badge-indie {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    background: #f5f5f5;
    color: #525252;
    border-radius: 4px;
    margin-left: 8px;
}

/* ============================================
   VUE DÉTAIL
   ============================================ */

/* Sidebar détail — cachée par défaut */
#ff-detail-sidebar {
    display: none;
}

/* Masquer le contenu listing de la sidebar quand en vue détail */
body.ff-detail-active #ff-detail-sidebar {
    display: block;
}
body.ff-detail-active #ff-sidebar > *:not(#ff-detail-sidebar):not(#ff-logo):not(#brxe-izyldm):not(#brxe-cnrbht) {
    display: none !important;
}
/* Pas de transition opacity sur la sidebar — affichage instantané */

/* Empêcher le scroll de la sidebar gauche de se propager au listing */
#ff-sidebar {
    overscroll-behavior: contain;
}

/* Listing — fade out quand vue détail active */
#ff-listing {
    transition: opacity 0.3s ease;
}
body.ff-detail-active #ff-listing {
    pointer-events: none;
}

/* Overlay de transition (carte qui s'agrandit) */
.ff-hero-overlay {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    overflow: hidden;
    will-change: width, height, top, left;
    transition: top 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                left 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
}
.ff-hero-overlay.ff-hero-fade-border {
    transition: border-color 0.25s ease, opacity 0.3s ease;
}

/* Éditeur — caché par défaut, affiché quand détail actif */
#ff-editor {
    display: none;
    width: 100%;
    min-height: 100vh;
}
body.ff-detail-active #ff-editor {
    display: flex;
    align-items: center;
    justify-content: center;
}

#ff-editor-textarea {
    width: 100%;
    height: 100vh;
    background: transparent;
    border: none;
    outline: none;
    font-size: 48px;
    color: #fff;
    padding: 60px 40px 40px 80px;
    resize: none;
    line-height: 1.4;
    font-family: inherit;
    transition: opacity 0.1s ease;
}

#ff-editor-textarea::placeholder {
    color: #444;
}

/* Loading state : swap instantane, pas de fade */

/* Back button : visible uniquement quand une carte est ouverte */
body:not(.ff-detail-active) #ff-back-btn {
    display: none !important;
}

/* ================================================================
   MOBILE (<= 767px)
   ================================================================ */
@media (max-width: 767px) {
    /* Cacher la sidebar desktop */
    #ff-sidebar {
        display: none !important;
    }

    /* Le listing prend toute la largeur */
    #ff-main {
        width: 100% !important;
    }

    /* Grille 1 colonne */
    #ff-pool {
        grid-template-columns: 1fr;
    }

    /* Cacher le listing desktop */
    #ff-listing {
        display: none !important;
    }
}

/* Grille mobile JS */
#ffm-listing {
    display: none;
}

@media (max-width: 767px) {
    #ffm-listing {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
    }

    #ff-anim-toggle {
        display: none !important;
    }

    /* Menu hamburger : éléments pleine largeur */
    #brxe-bszhag {
        align-items: stretch !important;
    }
}


/* ============================================
   LEGAL PAGES POPUP MODAL
   ============================================ */
.ff-legal-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
}
.ff-legal-modal.ff-legal-modal--open {
    display: flex;
}
.ff-legal-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    cursor: pointer;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.ff-legal-modal__container {
    position: relative;
    width: 90vw;
    max-width: 800px;
    height: 85vh;
    max-height: 85vh;
    overflow: hidden;
    border-radius: 8px;
    z-index: 1;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    background: #11110F;
    visibility: hidden;
}
.ff-legal-modal--ready .ff-legal-modal__container {
    visibility: visible;
}
.ff-legal-modal__iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #11110F;
}

/* Hide page chrome (header/footer/etc) when loaded in modal mode */
body.ff-modal-mode #brx-header,
body.ff-modal-mode header.brx-header,
body.ff-modal-mode > header,
body.ff-modal-mode #brx-footer,
body.ff-modal-mode footer.brx-footer,
body.ff-modal-mode > footer {
    display: none !important;
}
body.ff-modal-mode::before {
    display: none !important;
}
body.ff-modal-mode {
    margin: 0 !important;
}
html.ff-modal-mode,
html.ff-modal-mode body {
    scrollbar-width: thin;
    scrollbar-color: #FFECD9 transparent;
    height: auto !important;
    min-height: 0 !important;
}
html.ff-modal-mode #brx-content,
html.ff-modal-mode main {
    min-height: 0 !important;
}


/* ============================================
   MOBILE — Star + Alt badge layout (mobile only)
   ============================================
   Card reserves 50px top padding for star + alt badge row.
   Star and alt-bar are both absolutely positioned in that area:
   star at top-left, alt-bar at top-right.
   This keeps title spacing consistent regardless of alt-bar visibility. */
#ffm-listing .font-card {
    padding-top: 50px;
}
#ffm-listing .ff-fav-btn {
    top: 20px !important;
    left: 36px !important;
}
#ffm-listing .ff-alt-bar {
    position: absolute;
    top: 24px;
    right: 40px;
    left: auto !important;
    padding: 0 !important;
    margin: 0;
    width: auto;
}
#ffm-listing .font-card__preview {
    padding: 0 40px 10px 40px !important;
    height: auto !important;
    min-height: 80px;
}

/* Mobile favorites widget: hide dropdown menu when not open */
#ffm-fav-widget.ff-fav-search .ff-fav-list {
    display: none !important;
}
#ffm-fav-widget.ff-fav-search.ff-dropdown--open .ff-fav-list {
    display: block !important;
}

/* Remove the blue focus outline / tap highlight on the Bricks toggle buttons */
.brxe-toggle {
    -webkit-tap-highlight-color: transparent;
}
.brxe-toggle:focus,
.brxe-toggle:active {
    outline: none;
    box-shadow: none;
}

/* Prevent horizontal rubber-band scroll on mobile */
@media (max-width: 767px) {
    html, body {
        overflow-x: hidden;
        overscroll-behavior-x: none;
    }
}

/* Multi-select dropdown items: keep wrapped text aligned with the first
   line of text (not below the fake ::before checkbox).
   Bricks Custom CSS hides the real input and renders the visual checkbox
   as a ::before pseudo on the span. We use text-indent to pull the first
   line back so the pseudo sits at x=0 and wrapped lines align with text. */
.ff-multi__item > span,
.ffm-multi__item > span {
    display: block;
    padding-left: 24px;
    text-indent: -24px;
}

/* Mobile filter menu overlay: dimmed background that captures clicks to
   close the menu (also prevents accidentally opening a card while the
   menu is visible). Visibility tied to the Bricks toggle's .is-active class. */
.ff-mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
@media (max-width: 767px) {
    body:has(.brxe-toggle.is-active) .ff-mobile-menu-overlay {
        opacity: 1;
        pointer-events: auto;
    }
    /* Hide the fixed pagination while the mobile menu is open */
    body:has(.brxe-toggle.is-active) #ffm-pagination {
        display: none;
    }
}

html.ff-modal-mode::-webkit-scrollbar,
html.ff-modal-mode body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
html.ff-modal-mode::-webkit-scrollbar-track,
html.ff-modal-mode body::-webkit-scrollbar-track {
    background: transparent;
}
html.ff-modal-mode::-webkit-scrollbar-thumb,
html.ff-modal-mode body::-webkit-scrollbar-thumb {
    background: #FFECD9;
    border-radius: 4px;
}
.ff-legal-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: #FFECD9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    z-index: 10;
}
.ff-legal-modal__content {
    min-height: 80px;
}
.ff-legal-modal__content.is-loading {
    background: #11110F;
    color: #FFECD9;
}
.ff-legal-modal__content.is-loading::before {
    content: "Loading...";
    display: block;
    text-align: center;
    padding: 60px 0;
    opacity: 0.5;
    font-size: 14px;
}
@media (max-width: 600px) {
    .ff-legal-modal__container {
        width: 95vw;
        max-height: 90vh;
    }
}
/* Scroll on the body is locked via JS (event preventDefault) instead of CSS,
   to avoid breaking position:sticky descendants. */
body.ff-legal-modal-open {
    overscroll-behavior: none;
}
html.ff-modal-mode,
html.ff-modal-mode body {
    overscroll-behavior: contain;
}


