/* =====================================================
   MOTIONSTYLES ALGOLIA BROWSE STYLES
   Unified styles for Graphics, Video, AI, and Fonts pages
   ===================================================== */


[data-tool-filter].is-active .tool-wrapper {
    border: 1px solid var(--base-color-neutral--neutral);
    box-shadow: inset 0 0 0 1px var(--base-color-neutral--neutral);
}

.new-badge {
    position: absolute;
    top: 10px;
    right: 15px;
    z-index: 2;
    background-color: #fff;
    color: #000000;
    font-size: 12px;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 5px;
    margin-left: 5px;
    line-height: normal;
}

/* ========== CONTAINER ========== */
#algolia-search-container {
    width: 100%;
    padding: 2rem 0;
    position: relative;
}

.algolia-main-container {
    display: flex;
    gap: 32px;
    width: 100%;
    max-width: 100%;
}

/* ========== SIDEBAR STYLES ========== */
.algolia-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    padding: 0 20px 24px 10px;
    height: auto;
}

.algolia-sidebar.hidden {
    display: none;
}

.algolia-sidebar::-webkit-scrollbar {
    width: 6px;
}

.algolia-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.algolia-sidebar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
}

.algolia-sidebar:hover {
    scrollbar-width: thin;
}

.algolia-sidebar:hover::-webkit-scrollbar-thumb {
    background: #ccc;
}

.algolia-sidebar:hover::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.sidebar-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
}

.hide-filters-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.hide-filters-btn:hover {
    border-color: #999;
}

.filter-icon {
    font-size: 16px;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sidebar-section-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
}

/* Hide tools section if empty (for Fonts) */
#tools-refinement:empty {
    display: none;
}

#tools-section:has(#tools-refinement:empty) {
    display: none;
}

/* ========== ACTIVE FILTERS ========== */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: #0000;
    border: 2px solid var(--base-color-neutral--neutral);
    border-radius: 10px;
    font-size: .8rem;
    color: #222;
    font-weight: 500;
    cursor: pointer;
}

.active-filter-tag:hover {
    border-color: var(--base-color-neutral--neutral-darkest);
}

.active-filter-tag .remove-filter {
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: #666;
    margin-left: 2px;
}

.active-filter-tag .remove-filter:hover {
    color: #000;
}

/* ========== REFINEMENT LISTS ========== */
.ais-RefinementList-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ais-RefinementList-list::-webkit-scrollbar {
    width: 6px;
}

.ais-RefinementList-list::-webkit-scrollbar-track {
    background: transparent;
}

.ais-RefinementList-list::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
}

.ais-RefinementList-list:hover {
    scrollbar-width: thin;
}

.ais-RefinementList-list:hover::-webkit-scrollbar-thumb {
    background: #ccc;
}

.ais-RefinementList-list:hover::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.ais-RefinementList-item {
    margin: 0;
}

.ais-RefinementList-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 2px 0;
    font-size: 14px;
    color: #555;
    transition: color 0.2s;
}

.ais-RefinementList-label:hover {
    color: #000;
}

.ais-RefinementList-checkbox {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    position: relative;
    vertical-align: middle;
}

.ais-RefinementList-checkbox:checked {
    background: #444;
    border-color: #444;
}

.ais-RefinementList-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 3px;
    width: 3px;
    height: 7px;
    border: solid white;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.ais-RefinementList-checkbox:hover {
    border-color: #999;
}

.ais-RefinementList-labelText {
    flex: 1;
}

.ais-RefinementList-count {
    display: none;
}

.ais-RefinementList-showMore {
    display: none;
}

/* ========== CUSTOM CHECKBOXES ========== */
.filter-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: color 0.2s;
}

.filter-checkbox-label:hover {
    color: #000;
}

.filter-checkbox {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    position: relative;
    vertical-align: middle;
}

.filter-checkbox:checked {
    background: #444;
    border-color: #444;
}

.filter-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 3px;
    width: 3px;
    height: 7px;
    border: solid white;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.filter-checkbox:hover {
    border-color: #999;
}

/* ========== CUSTOM RADIO LABELS (matching refinement list style) ========== */
.filter-radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 2px 0;
    font-size: 14px;
    color: #555;
    transition: color 0.2s;
}

.filter-radio-label:not(:last-of-type) {
    margin-bottom: 4px;
}

.filter-radio-label:hover {
    color: #000;
}

.filter-radio {
    margin-right: 8px;
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: white;
    position: relative;
    vertical-align: middle;
}

.filter-radio:checked {
    background: #444;
    border-color: #444;
}

.filter-radio:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 5px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.filter-radio:hover {
    border-color: #999;
}

/* ========== MAIN CONTENT ========== */
.algolia-main-content {
    flex: 1;
    min-width: 0;
    padding: 0 20px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 -10px 24px;
    padding-bottom: 0;
    border-bottom: none;
    flex-wrap: wrap;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.search-wrapper {
    flex: 0 1 240px;
    min-width: 150px;
    max-width: 240px;
}

.search-wrapper .ais-SearchBox-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.search-wrapper .ais-SearchBox-input:focus {
    outline: none;
    border-color: #999;
}

.search-wrapper .ais-SearchBox-submit,
.search-wrapper .ais-SearchBox-reset {
    display: none;
}

.show-filters-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.show-filters-btn.visible {
    display: flex;
}

.show-filters-btn:hover {
    border-color: #999;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.sort-dropdown {
    padding: 8px 36px 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23666' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.sort-dropdown:hover {
    border-color: #999;
}

/* ========== RESULTS GRID ========== */
#algolia-hits,
#algolia-drafts-hits {
    grid-column-gap: 0;
    grid-row-gap: 0;
    grid-template-rows: auto;
    grid-template-columns: 1fr 1fr 1fr;
    grid-auto-columns: 1fr;
    grid-auto-flow: row dense;
    display: grid;
    margin: 0 -22px;
    counter-reset: item-rank;
}

/* Compact item for "all" tab - tight grid with no padding */
.item-compact {
    padding: 0;
    margin: 0;
}

.item-compact .item-link {
    display: block;
    padding: 0;
}

/* Video-specific grid */
#algolia-hits.item-list-video {
    margin: 0 -22px;
}

.flex-vertical {
    z-index: 3;
    flex-flow: column;
    align-items: flex-start;
    width: 100%;
    min-width: 0;
    display: flex;
    position: relative;
    overflow: hidden;
}

.flex-space-between {
    display: flex;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
}

.flex-align-top {
    align-items: flex-start;
}

.item-title-wrapper {
    opacity: 1;
    flex-flow: row;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
    min-width: 0;
    padding-top: 3px;
    display: flex;
}

#algolia-hits.hide-titles .item-title-wrapper {
    display: none;
}

#algolia-hits.hide-titles {
    gap: 7px;
    margin: 0;
}

#algolia-hits.hide-titles .item-compact {
    margin: 0;
}

#algolia-hits.hide-titles .item-compact .item-link {
    padding: 0;
    font-size: 0; /* Eliminate inline-block whitespace */
    line-height: 0;
}

/* Override Webflow's inline-block which causes extra spacing */
#algolia-hits.hide-titles .item-compact .item-link > a {
    display: block;
}

.item-title {
    color: var(--base-color-neutral--neutral-darkest, #1a1a1a);
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    overflow: hidden;
}

.item-title:hover {
    text-decoration: underline;
}

.item-category {
    color: var(--base-color-neutral--neutral, #666);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-category:hover {
    text-decoration: underline;
}

.item-category:active {
    color: var(--base-color-neutral--neutral-dark, #333);
}

/* ========== FREE BADGE ========== */
.free-link {
    z-index: 3;
    color: #3173c3;
    background-color: #eff5fc;
    border-radius: 5px;
    margin-left: 5px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    flex-shrink: 0;
}

.free-link:hover {
    background-color: #e0eaf7;
    text-decoration: underline;
}

.free-link:active {
    background-color: #d4e7fd;
}

.free-text {
    padding: 2px 9px;
}

/* ========== RANK NUMBERS ========== */
.top-10-item {
    counter-increment: item-rank;
}

.top-10-item .item-title-wrapper {
    display: flex;
    gap: 8px;
}

.item-number {
    line-height: 30px;
}

.item-number::before {
    content: counter(item-rank);
    font-weight: bold;
    font-size: 2.25rem;
    line-height: inherit;
    color: var(--base-color-neutral--neutral-dark, #333);
}

/* ========== PAGINATION ========== */
#algolia-pagination {
    display: flex;
    justify-content: center;
    margin: 48px 0;
}

.ais-Pagination-list {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.ais-Pagination-item {
    display: block;
}

.ais-Pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
    cursor: pointer;
}

.ais-Pagination-link:hover {
    border-color: #999;
    background: #f5f5f5;
}

.ais-Pagination-item--selected .ais-Pagination-link {
    background: #000;
    color: white;
    border-color: #000;
}

.ais-Pagination-item--disabled .ais-Pagination-link {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.ais-Pagination-item--ellipsis .ais-Pagination-link {
    border: none;
    background: none;
    cursor: default;
    pointer-events: none;
}

#algolia-pagination.hide-pagination {
    display: none;
}

/* ========== RESPONSIVE ========== */
@media (min-width: 1920px) {
    #algolia-hits {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }

    .algolia-sidebar.hidden~.algolia-main-content #algolia-hits.item-list-video {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }

    #algolia-hits .item:nth-child(n+29),
    #algolia-hits .item-compact:nth-child(n+29) {
        display: none;
    }

    #algolia-hits.show-all-items .item:nth-child(n+29),
    #algolia-hits.show-all-items .item-compact:nth-child(n+29) {
        display: block;
    }

    /* Creator page: 5 columns for non-video, 4 for video */
    #algolia-hits.creator-browse,
    #algolia-drafts-hits {
        grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    }

    #algolia-hits.creator-browse.item-list-video {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }

    /* Creator page: 5 columns - show 30 items (6 rows) */
    #algolia-hits.creator-browse .item:nth-child(n+31) {
        display: none;
    }

    /* Creator page video: 4 columns - show 28 items (7 rows) */
    #algolia-hits.creator-browse.item-list-video .item:nth-child(n+29) {
        display: none;
    }
}

@media (min-width: 1440px) and (max-width: 1919px) {
    #algolia-hits {
        grid-template-columns: 1fr 1fr 1fr;
    }

    #algolia-hits.item-list-video {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .algolia-sidebar.hidden~.algolia-main-content #algolia-hits.item-list-video {
        grid-template-columns: 1fr 1fr 1fr;
    }

    /* Creator page: 4 columns for non-video, 3 for video */
    #algolia-hits.creator-browse,
    #algolia-drafts-hits {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }

    #algolia-hits.creator-browse.item-list-video {
        grid-template-columns: 1fr 1fr 1fr;
    }

    /* Creator page: 4 columns - show 28 items (7 rows) */
    #algolia-hits.creator-browse .item:nth-child(n+29) {
        display: none;
    }

    /* Creator page video: 3 columns - show 30 items (10 rows) */
    #algolia-hits.creator-browse.item-list-video .item:nth-child(n+29) {
        display: block;
    }
    #algolia-hits.creator-browse.item-list-video .item:nth-child(n+31) {
        display: none;
    }
}

@media (min-width: 992px) and (max-width: 1439px) {
    #algolia-hits {
        grid-template-columns: 1fr 1fr;
    }

    #algolia-hits.item-list-video {
        grid-template-columns: 1fr 1fr;
    }

    .algolia-sidebar.hidden~.algolia-main-content #algolia-hits.item-list-video {
        grid-template-columns: 1fr 1fr 1fr;
    }

    /* Creator page: 3 columns for non-video, 2 for video */
    #algolia-hits.creator-browse,
    #algolia-drafts-hits {
        grid-template-columns: 1fr 1fr 1fr;
    }

    #algolia-hits.creator-browse.item-list-video {
        grid-template-columns: 1fr 1fr;
    }

    /* Creator page: 3 columns - show 30 items (10 rows) */
    #algolia-hits.creator-browse .item:nth-child(n+31) {
        display: none;
    }

    /* Creator page video: 2 columns - show 30 items (15 rows) */
    #algolia-hits.creator-browse.item-list-video .item:nth-child(n+31) {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .algolia-sidebar {
        width: 240px;
    }

    #algolia-hits,
    #algolia-drafts-hits {
        grid-template-columns: 1fr 1fr;
    }

    /* Creator page: 2 columns - show 30 items (15 rows) */
    #algolia-hits.creator-browse .item:nth-child(n+31) {
        display: none;
    }
}

@media (max-width: 767px) {
    .algolia-main-container {
        flex-direction: column;
    }

    .algolia-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 70% !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        z-index: 1000 !important;
        background: white !important;
        box-shadow: 2px 0 16px rgba(0, 0, 0, 0.1) !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-top: 16px !important;
    }

    .algolia-sidebar.visible {
        transform: translateX(0) !important;
        display: block !important;
    }

    .algolia-sidebar.hidden {
        display: block;
        transform: translateX(-100%);
    }

    .algolia-main-content {
        padding: 0 16px;
        /* Prevent layout shift on mobile scroll */
        contain: layout style;
    }

    .content-header {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-template-rows: auto auto auto !important;
        gap: 12px !important;
        align-items: center !important;
    }

    .header-left {
        display: contents !important;
    }

    .header-left .show-filters-btn {
        display: flex !important;
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }

    .show-filters-btn.visible {
        display: flex !important;
    }

    .sort-controls {
        grid-column: 2 !important;
        grid-row: 1 !important;
        width: auto !important;
    }

    .header-left .search-wrapper {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .header-left .active-filters {
        grid-column: 1 / -1 !important;
        grid-row: 3 !important;
    }

    #algolia-hits,
    #algolia-drafts-hits {
        grid-template-columns: 1fr 1fr;
        /* Prevent grid from resizing on mobile scroll */
        contain: layout;
    }

    /* Ensure grid items have stable sizing on mobile */
    .item-compact,
    .item,
    .skeleton-item {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .item-image {
        width: 100%;
        max-width: 100%;
    }

    .search-wrapper {
        flex: 0 1 !important;
    }

    .search-wrapper .ais-SearchBox-input {
        font-size: 16px;
    }
}

@media (max-width: 479px) {
    #algolia-hits,
    #algolia-drafts-hits {
        grid-template-columns: 1fr 1fr;
    }
}

/* ========== FONT LAYOUT TOGGLE ========== */
.layout-toggle {
    display: flex;
    gap: 4px;
    margin-right: 16px;
}

.layout-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    color: #999;
    transition: all 0.2s;
}

.layout-toggle-btn:hover {
    border-color: #999;
    color: #666;
}

.layout-toggle-btn.active {
    background: #333;
    border-color: #333;
    color: white;
}

/* ========== FONT PREVIEW CONTROLS ========== */
.font-preview-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    margin: 0 -10px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.font-preview-select {
    flex-shrink: 0;
}

.font-preview-select select {
    padding: 10px 32px 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    font-family: inherit;
    width: 235px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23666' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
}

.font-preview-select select:hover {
    border-color: #999;
}

.font-preview-select select:focus {
    outline: none;
    border-color: #999;
}

.font-preview-text-input {
    flex: 1;
    min-width: 150px;
    max-width: 400px;
}

.font-preview-text-input input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.font-preview-text-input input:focus {
    outline: none;
    border-color: #999;
}

.font-size-toggles {
    display: flex;
    gap: 4px;
}

.size-toggle-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    background: white;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #bbb;
    transition: all 0.2s;
    font-size: 10px;
    font-family: inherit;
}

.size-toggle-btn:hover {
    color: #666;
}

.size-toggle-btn.active {
    color: #333;
}

.size-toggle-btn span {
    line-height: 1;
}

/* ========== FONT CARD LAYOUT (Preview Mode) ========== */
#algolia-hits.font-preview-mode {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
}

.font-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.font-card:last-child {
    border-bottom: none;
}

.font-card-thumb {
    position: relative;
    width: 225px;
    aspect-ratio: 3 / 2;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.font-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.font-card-rank {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    z-index: 2;
}

.font-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.font-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
}

.font-card-title:hover {
    text-decoration: underline;
}

.font-card-meta {
    font-size: 13px;
    color: #666;
}

.font-card-creator {
    color: #666;
}

.font-card-category {
    color: #666;
    text-decoration: none;
}

.font-card-category:hover {
    text-decoration: underline;
}

.font-card-preview {
    display: block;
    margin-top: 8px;
    overflow: hidden;
    text-decoration: none;
    position: relative;
}

.font-card-preview::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(to right, transparent, white);
    pointer-events: none;
}

.font-card-preview img {
    display: block;
    height: auto;
    max-width: none;
}

.font-preview-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f0f0f0;
    border-top-color: #999;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.font-preview-unavailable {
    font-size: 13px;
    color: #bbb;
    font-style: italic;
}

/* ========== FONT CARD RESPONSIVE ========== */
@media (max-width: 767px) {
    .font-preview-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .font-preview-text-input {
        max-width: 100%;
    }

    .font-size-toggles {
        justify-content: flex-start;
    }

    .font-card-thumb {
        width: 150px;
    }

    .font-card {
        gap: 12px;
        padding: 16px 0;
    }

    .layout-toggle {
        margin-right: 8px;
    }
}

/* ========== SKELETON LOADING ========== */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e8e8e8 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

/* Grid skeleton item */
.skeleton-item {
    width: 100%;
    min-width: 0;
}

.skeleton-item .item-link {
    display: block;
    width: 100%;
    padding: 0;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 3 / 2;
    border-radius: 8px;
}

/* Video skeleton uses 16:9 aspect ratio */
#algolia-hits.item-list-video .skeleton-image {
    aspect-ratio: 16 / 9;
}

.skeleton-title-wrapper {
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-title {
    height: 14px;
    width: 75%;
    border-radius: 4px;
}

.skeleton-category {
    height: 12px;
    width: 50%;
    border-radius: 4px;
}

/* Hide skeleton title wrapper when titles are hidden */
#algolia-hits.hide-titles .skeleton-title-wrapper {
    display: none;
}

/* Font preview mode skeleton */
.skeleton-font-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
}

.skeleton-font-card:last-child {
    border-bottom: none;
}

.skeleton-font-thumb {
    width: 225px;
    aspect-ratio: 3 / 2;
    flex-shrink: 0;
    border-radius: 8px;
}

.skeleton-font-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
}

.skeleton-font-title {
    height: 16px;
    width: 40%;
    border-radius: 4px;
}

.skeleton-font-meta {
    height: 13px;
    width: 30%;
    border-radius: 4px;
}

.skeleton-font-preview {
    height: 60px;
    width: 100%;
    margin-top: 8px;
    border-radius: 4px;
}

/* Skeleton responsive */
@media (max-width: 767px) {
    .skeleton-font-thumb {
        width: 150px;
    }

    .skeleton-font-card {
        gap: 12px;
        padding: 16px 0;
    }
}

/* ========== MUSIC/SFX SKELETON ========== */
/* Matches the audio-item horizontal list layout */
.skeleton-audio-item {
    display: grid;
    grid-template-columns: 60px 40px minmax(100px, 160px) 180px 60px 1fr 140px;
    gap: 12px;
    column-gap: 16px;
    align-items: center;
    padding: 12px 5px;
}

.skeleton-audio-thumb {
    width: 60px;
    height: 60px;
    border-radius: 4px;
}

.skeleton-audio-play {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-audio-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.skeleton-audio-title {
    height: 14px;
    width: 90%;
    border-radius: 4px;
}

.skeleton-audio-author {
    height: 12px;
    width: 60%;
    border-radius: 4px;
}

.skeleton-audio-tags {
    width: 120px;
    height: 24px;
    border-radius: 4px;
}

.skeleton-audio-variants {
    width: 50px;
    height: 24px;
    border-radius: 4px;
}

.skeleton-audio-waveform {
    height: 40px;
    width: 100%;
    border-radius: 4px;
}

.skeleton-audio-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.skeleton-audio-duration {
    width: 40px;
    height: 12px;
    border-radius: 4px;
}

.skeleton-audio-bpm {
    width: 50px;
    height: 12px;
    border-radius: 4px;
}

.skeleton-audio-download {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

/* Music skeleton responsive - 1400px */
@media (max-width: 1400px) {
    .skeleton-audio-item {
        grid-template-columns: 60px 40px minmax(100px, 160px) 60px 1fr 140px;
    }

    .skeleton-audio-tags {
        display: none;
    }
}

/* Music skeleton responsive - 1100px */
@media (max-width: 1100px) {
    .skeleton-audio-item {
        grid-template-columns: 50px 36px minmax(80px, 120px) 50px 1fr 120px;
        gap: 10px;
    }

    .skeleton-audio-thumb {
        width: 50px;
        height: 50px;
    }

    .skeleton-audio-play {
        width: 36px;
        height: 36px;
    }
}

/* Music skeleton responsive - 900px */
@media (max-width: 900px) {
    .skeleton-audio-item {
        grid-template-columns: 50px 36px minmax(80px, 120px) 50px 1fr 100px;
        gap: 10px;
        padding: 10px 5px;
    }

    .skeleton-audio-bpm {
        display: none;
    }
}

/* Music skeleton responsive - 640px (mobile) */
@media (max-width: 640px) {
    .skeleton-audio-item {
        grid-template-columns: 36px minmax(80px, 120px) 40px 1fr auto;
        gap: 8px;
        padding: 8px 5px;
    }

    .skeleton-audio-thumb {
        display: none;
    }

    .skeleton-audio-download {
        display: none;
    }

    .skeleton-audio-meta {
        min-width: auto;
    }

    .skeleton-audio-play {
        width: 36px;
        height: 36px;
    }
}

/* ========== IMAGE FADE-IN ========== */
.item-image {
    background-color: #f0f0f0;
    border-radius: 8px;
    aspect-ratio: 3 / 2;
}

/* Video items use 16:9 aspect ratio */
#algolia-hits.item-list-video .item-image {
    aspect-ratio: 16 / 9;
}

/* Audio items (music/sfx) use 1:1 square aspect ratio for album covers in drafts */
/* Override the parent wrapper aspect ratio for audio items */
#algolia-drafts-hits.has-audio-items .item-img-wrapper {
    aspect-ratio: 1 / 1 !important;
}

#algolia-drafts-hits .item-image.aspect-ratio-square,
.item-image.aspect-ratio-square {
    aspect-ratio: 1 / 1 !important;
}

#algolia-drafts-hits .item-image.aspect-ratio-square img,
.item-image.aspect-ratio-square img {
    object-fit: cover !important;
}

/* Drafts grid with audio items - more columns for square covers */
#algolia-drafts-hits.has-audio-items {
    grid-template-columns: repeat(6, 1fr) !important;
}

@media (min-width: 1920px) {
    #algolia-drafts-hits.has-audio-items {
        grid-template-columns: repeat(8, 1fr) !important;
    }
}

@media (min-width: 1440px) and (max-width: 1919px) {
    #algolia-drafts-hits.has-audio-items {
        grid-template-columns: repeat(6, 1fr) !important;
    }
}

@media (min-width: 992px) and (max-width: 1439px) {
    #algolia-drafts-hits.has-audio-items {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    #algolia-drafts-hits.has-audio-items {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 767px) {
    #algolia-drafts-hits.has-audio-items {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

.item-image img {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.item-image img.loaded {
    opacity: 1;
}

/* Font card thumbnails */
.font-card-thumb {
    background-color: #f0f0f0;
}

.font-card-thumb img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.font-card-thumb img.loaded {
    opacity: 1;
}

/* ========== TEMPO/DURATION FILTER STYLES ========== */
#tempo-filter,
#duration-filter {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tempo-option,
.duration-option {
    padding: 2px 0;
}

/* ========== SHOW MORE BUTTON ========== */
.ais-RefinementList-showMore {
    display: block;
    margin-top: 8px;
    padding: 0;
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.ais-RefinementList-showMore:hover {
    color: #333;
}

.ais-RefinementList-showMore--disabled {
    display: none;
}

/* ========== VIDEO CATEGORY SECTIONS ========== */
.video-category-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.video-category-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.video-category-header {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
}

.video-section-show-more {
    display: block;
    margin-top: 8px;
    padding: 0;
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.video-section-show-more:hover {
    color: #333;
}

/* Video options sections - styled like sidebar-section */
/* Resolution comes first, then Other Options below */
.video-resolution-section {
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 16px;
}

.video-other-options-section {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}