/**
 * Recipe Index Page — /recipes/
 *
 * Styles for the recipe discovery page: hero, chips, browse sections,
 * filter bar, filter panel, results, and mobile bottom sheet.
 *
 * Card styles (.kf-card-minimal, .kf-collection-grid, .kf-collection-show-more,
 * .kf-card-reveal) live in recipe-refinements.css — do NOT duplicate here.
 */


/* ==========================================================================
   1. Hero
   ========================================================================== */

.kf-recipe-hero {
    background: linear-gradient(135deg, #2B354F 0%, #3d4a6b 100%);
    border-bottom: 3px solid #c4714b;
    padding: 40px 0 36px;
    text-align: center;
}

.kf-recipe-hero-title {
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.kf-recipe-hero-tagline {
    color: rgba(255,255,255,0.75);
    font-size: 15px;
    margin-bottom: 24px;
}

.kf-recipe-search-wrap {
    max-width: 560px;
    margin: 0 auto;
    position: relative;
}

.kf-recipe-search {
    width: 100%;
    background: #fff;
    border: none;
    border-radius: 20px;
    padding: 12px 16px 12px 44px;
    font-size: 15px;
    color: #3a3f4b;
    outline: none;
}

.kf-recipe-search:focus {
    box-shadow: 0 0 0 2px rgba(196,113,75,0.4);
}

.kf-recipe-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}


/* ==========================================================================
   2. Chips Bar
   ========================================================================== */

.kf-chips-bar {
    background: #fdf9f5;
    border-bottom: 1px solid #e8e2d9;
    padding: 16px 0;
}

.kf-chips-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.kf-chip {
    background: #f5f0ea;
    color: #6b5e4b;
    border: 1px solid #e8e2d9;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 16px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.kf-chip:hover {
    background: #efe9e0;
    color: #2B354F;
}

.kf-chip.active {
    background: #2B354F;
    color: #fff;
    border-color: #2B354F;
}


/* ==========================================================================
   3. Section Labels
   ========================================================================== */

.kf-section-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #8a7e6e;
    margin-bottom: 20px;
}


/* ==========================================================================
   4. Browse Sections
   ========================================================================== */

.kf-browse-section {
    padding: 32px 0;
}

.kf-browse-section + .kf-browse-section {
    padding-top: 0;
}


/* ==========================================================================
   5. Course Tiles Grid
   ========================================================================== */

.kf-courses-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.kf-course-tile {
    position: relative;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4/3;
    text-decoration: none;
    background: #4a5568;
}

.kf-course-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.kf-course-tile:hover img {
    transform: scale(1.03);
}

.kf-course-tile:hover {
    box-shadow: 0 8px 24px rgba(120,90,50,0.12);
}

.kf-course-tile-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 16px;
    text-align: center;
}

.kf-course-tile-name {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}

.kf-course-tile-count {
    color: rgba(255,255,255,0.75);
    font-size: 12px;
}


/* ==========================================================================
   6. Featured Collection Banner
   ========================================================================== */

.kf-featured-banner {
    background: #f8f5f0;
    border-radius: 12px;
    border: 1px solid #e8e2d9;
    padding: 28px 32px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.kf-featured-info {
    flex: 1;
}

.kf-featured-title {
    font-size: 18px;
    font-weight: 700;
    color: #2B354F;
    margin: 8px 0;
}

.kf-featured-desc {
    font-size: 14px;
    color: #3a3f4b;
    margin-bottom: 12px;
}

.kf-featured-link {
    color: #c4714b;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
}

.kf-featured-link:hover {
    text-decoration: underline;
}

.kf-featured-cards {
    display: flex;
    gap: 16px;
}

.kf-featured-card {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
}

.kf-featured-card img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.kf-featured-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #2B354F;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ==========================================================================
   7. Filter Bar (sticky)
   ========================================================================== */

.kf-filter-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e8e2d9;
    box-shadow: 0 2px 8px rgba(120,90,50,0.05);
    padding: 12px 0;
}

.kf-filter-bar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kf-active-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.kf-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #2B354F;
    color: #fff;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 600;
}

.kf-active-chip-remove {
    cursor: pointer;
    opacity: 0.7;
    font-size: 14px;
    line-height: 1;
}

.kf-active-chip-remove:hover {
    opacity: 1;
}

.kf-more-filters-btn {
    background: #f5f0ea;
    color: #6b5e4b;
    border: 1px solid #e8e2d9;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.kf-more-filters-btn:hover {
    background: #efe9e0;
}

.kf-sort-wrap {
    position: relative;
    margin-left: auto;
}

.kf-sort-btn {
    background: #f5f0ea;
    color: #6b5e4b;
    border: 1px solid #e8e2d9;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.kf-sort-btn:hover {
    background: #efe9e0;
}

.kf-sort-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #e8e2d9;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(120,90,50,0.12);
    padding: 4px 0;
    z-index: 110;
    min-width: 180px;
}

.kf-sort-option {
    display: block;
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    font-size: 14px;
    color: #3a3f4b;
    background: none;
    border: none;
    cursor: pointer;
}

.kf-sort-option:hover {
    background: #f8f5f0;
}

.kf-sort-option.active {
    color: #2B354F;
    font-weight: 700;
}


/* ==========================================================================
   8. Filter Panel
   ========================================================================== */

.kf-filter-panel {
    background: #fdf9f5;
    border-bottom: 1px solid #e8e2d9;
    padding: 0;
}

.kf-filter-panel > .container {
    display: flex;
    flex-direction: column;
    max-height: 420px;
}

.kf-filter-panel-inner {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
    overflow-y: auto;
    padding: 24px 0 0;
    flex: 1;
    min-height: 0;
}

.kf-filter-group-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    color: #8a7e6e;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.kf-filter-group-scrollable .kf-filter-list {
    max-height: 200px;
    overflow-y: auto;
}

.kf-filter-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e8e2d9;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 8px;
    background: #fff;
}

/* Custom checkboxes */
.kf-filter-checkbox,
.kf-filter-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    cursor: pointer;
    font-size: 13px;
    color: #3a3f4b;
    touch-action: manipulation;
}

.kf-filter-checkbox input,
.kf-filter-radio input {
    display: none;
}

.kf-filter-check {
    width: 16px;
    height: 16px;
    border: 2px solid #c8c0b4;
    border-radius: 3px;
    flex-shrink: 0;
    transition: all 0.15s;
}

.kf-filter-checkbox input:checked ~ .kf-filter-check {
    background: #2B354F;
    border-color: #2B354F;
}

.kf-filter-radio .kf-filter-check {
    border-radius: 50%;
}

.kf-filter-radio input:checked ~ .kf-filter-check {
    border-color: #2B354F;
    box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 6px #2B354F;
}

.kf-filter-count {
    color: #b0a89c;
    font-size: 12px;
    margin-left: auto;
}

/* Filter panel footer */
.kf-filter-panel-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid #e8e2d9;
    flex-shrink: 0;
}

.kf-filter-live-count {
    font-size: 14px;
    color: #3a3f4b;
    flex: 1;
}

.kf-filter-clear {
    color: #c4714b;
    font-weight: 600;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
}

.kf-filter-apply {
    background: linear-gradient(135deg, #2B354F 0%, #3d4a6b 100%);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.kf-filter-apply:hover {
    opacity: 0.9;
}


/* ==========================================================================
   9. Results Count
   ========================================================================== */

.kf-results-count {
    font-size: 13px;
    color: #8a7e6e;
    margin-bottom: 16px;
}


/* ==========================================================================
   10. Empty State
   ========================================================================== */

.kf-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #8a7e6e;
}

.kf-empty-state p {
    font-size: 15px;
    margin-bottom: 16px;
}

.kf-empty-clear {
    color: #c4714b;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}


/* ==========================================================================
   11. Mode Transitions
   ========================================================================== */

.kf-browse-mode,
.kf-filter-mode {
    transition: opacity 0.2s ease;
}

.kf-browse-mode.hiding,
.kf-filter-mode.hiding {
    opacity: 0;
}


/* ==========================================================================
   12. Mobile Bottom Sheet
   ========================================================================== */

.kf-bottom-sheet {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: none;
}

/* Hide Mediavine sticky ads when a bottom sheet is open */
body.kf-sheet-open #fixed_container_bottom,
body.kf-sheet-open [data-adhesion],
body.kf-sheet-open .mv-ad-sticky,
body.kf-sheet-open .adunitwrapper[style*="fixed"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.kf-bottom-sheet.active {
    display: block;
}

.kf-bottom-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
}

.kf-bottom-sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 70vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px; /* clear Mediavine sticky footer ad */
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.kf-bottom-sheet.active .kf-bottom-sheet-content {
    transform: translateY(0);
}

.kf-bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.kf-bottom-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f5f0ea;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* --- Mobile Filter/Sort Buttons (default hidden, shown in mobile media query) --- */
.kf-mobile-filter-btns {
    display: none;
    gap: 8px;
}

/* ==========================================================================
   13. Responsive — Mobile (<576px)
   ========================================================================== */

@media (max-width: 575.98px) {
    /* Hero: full-bleed */
    .kf-recipe-hero {
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
        padding: 28px 16px 24px;
    }

    .kf-recipe-hero-title {
        font-size: 22px;
    }

    /* Chips: horizontal scroll */
    .kf-chips-bar {
        position: relative;
    }

    .kf-chips-scroll {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding-bottom: 4px;
    }

    .kf-chips-bar::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 40px;
        background: linear-gradient(to left, #fdf9f5 0%, transparent 100%);
        pointer-events: none;
    }

    /* Course tiles: 2 columns */
    .kf-courses-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Featured collection: stack vertically */
    .kf-featured-banner {
        flex-direction: column;
        padding: 20px;
    }

    .kf-featured-cards {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Filter panel: stack groups */
    .kf-filter-panel-inner {
        grid-template-columns: 1fr;
    }

    /* Show mobile buttons, hide desktop filter controls */
    .kf-mobile-filter-btns { display: flex; }
    .kf-more-filters-btn { display: none; }
    .kf-sort-wrap { display: none; }
    .kf-active-chips { display: none; }
}


/* ==========================================================================
   13b. Responsive — Tablet (576–991px)
   ========================================================================== */

@media (min-width: 576px) and (max-width: 991.98px) {
    .kf-courses-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .kf-filter-panel-inner {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* ==========================================================================
   13c. Mobile Filter/Sort Buttons & Bottom Sheet Components
   ========================================================================== */

/* --- Mobile Filter/Sort Buttons (hidden on desktop, shown via mobile media query) --- */

.kf-mobile-filter-btn,
.kf-mobile-sort-btn {
    background: #f5f0ea;
    color: #6b5e4b;
    border: 1px solid #e8e2d9;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.kf-mobile-filter-count {
    background: #c4714b;
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 11px;
    min-width: 18px;
    text-align: center;
}

.kf-mobile-filter-count:empty { display: none; }

/* --- Bottom Sheet Footer --- */
.kf-bottom-sheet-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 16px 0 0;
    border-top: 1px solid #e8e2d9;
    margin-top: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.kf-sheet-clear {
    color: #c4714b;
    font-weight: 600;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 0;
}

.kf-sheet-apply {
    flex: 1;
    background: linear-gradient(135deg, #2B354F 0%, #3d4a6b 100%);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* --- Sort Sheet Options --- */
.kf-sheet-sort-options {
    padding: 8px 0;
}

.kf-sheet-sort-option {
    display: block;
    width: 100%;
    padding: 12px 0;
    text-align: left;
    font-size: 15px;
    color: #3a3f4b;
    background: none;
    border: none;
    border-bottom: 1px solid #f5f0ea;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.kf-sheet-sort-option.active {
    color: #2B354F;
    font-weight: 700;
}

/* --- Sheet Filter Groups (Accordion) --- */
.kf-sheet-accordion {
    border-bottom: 1px solid #e8e2d9;
}

.kf-sheet-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    font-size: 14px;
    font-weight: 700;
    color: #2B354F;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.kf-sheet-accordion-header svg {
    transition: transform 0.2s;
}

.kf-sheet-accordion-header.open svg {
    transform: rotate(180deg);
}

.kf-sheet-accordion-body {
    display: none;
    padding-bottom: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.kf-sheet-accordion-body.open {
    display: block;
}


/* ==========================================================================
   14. Accessibility — Focus Rings
   ========================================================================== */

.kf-chip:focus-visible,
.kf-recipe-search:focus-visible,
.kf-sort-btn:focus-visible,
.kf-more-filters-btn:focus-visible,
.kf-filter-apply:focus-visible,
.kf-filter-clear:focus-visible,
#kf-load-more:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(196,113,75,0.4);
}


/* ==========================================================================
   15. Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .kf-browse-mode,
    .kf-filter-mode,
    .kf-course-tile img,
    .kf-chip,
    .kf-bottom-sheet-content {
        transition: none !important;
    }
}
