/* ================================================================================
   STYLESHEET: home.css
   CREATED:    2026-03-15
   MODIFIED:   2026-03-15
   PURPOSE:    Home/splash page styles — category card grid, topbar, search, filters
   ================================================================================ */

/* ========== HOME / SPLASH PAGE ========== */
/* 2026-02-25 - Category card grid landing page */
#page-home {
    display: flex;
    flex-direction: column;
    /* 2026-02-27 - Scrollable when content overflows on narrow screens */
    overflow-y: auto;
    overflow-x: hidden;
}
/* 2026-03-05 - Hide home content until data loads, then fade in smoothly */
#page-home > * {
    opacity: 0;
    transition: opacity 0.4s ease;
}
#page-home.home-ready > * {
    opacity: 1;
}

/* 2026-03-06 - Unified home topbar matching gallery pattern */
.home-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 72px;
    padding: 14px var(--app-padding);
    background: rgba(250, 250, 252, 0.75);
    backdrop-filter: blur(40px) saturate(1.8);
    -webkit-backdrop-filter: blur(40px) saturate(1.8);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: visible;
}
/* 3-dot menu button — round 44px icon */
.home-menu-wrap {
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}
.home-menu-btn {
    display: flex;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ececee;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #999;
    align-items: center;
    justify-content: center;
}
/* 2026-03-10 - Consistent 50% icon-to-button ratio across all icon buttons */
.home-menu-btn svg, .home-filter-btn svg,
.gallery-filter-btn svg, .gallery-menu-btn svg {
    width: 22px;
    height: 22px;
}
.card-badge svg {
    width: 13px;
    height: 13px;
}
/* 2026-03-06 - Dropdown positioned under 3-dot button, left-aligned */
.home-menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    padding: 6px 0;
    z-index: 1000;
    width: 220px;
}
.home-menu-dropdown.open {
    display: block;
}
/* 2026-03-06 - Filter items always visible in 3-dot menu */
.home-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-family);
}
.home-menu-item:hover {
    background: #f5f5f5;
}
.home-menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}
.home-menu-divider {
    height: 1px;
    background: #e8e8e8;
    margin: 4px 0;
}
/* 2026-03-06 - Home search button hidden at all widths; search via title dropdown */
.home-search-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    background: #ececee;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
}
.home-search-btn:active {
    opacity: 0.5;
}
/* 2026-03-06 - Title pill (matches gallery breadcrumb pill) */
/* 2026-03-06 - Absolute-centered pill, same as gallery */
.home-title-pill {
    display: flex;
    align-items: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    min-width: 375px;
    max-width: 400px;
    height: 44px;
    background: #ececee;
    border-radius: 22px;
    padding: 0 16px;
    cursor: default;
}
.home-title-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    text-align: center;
}
/* 2026-03-08 - Search icon on left of title, clickable to open search */
.home-title-search-icon {
    flex-shrink: 0;
    color: var(--text-tertiary);
    margin-right: 6px;
    padding: 4px;
}
/* 2026-03-08 - Whole pill is clickable → opens search + category dropdown */
.home-title-pill { cursor: pointer; }
.home-title-pill:active { opacity: 0.7; }
/* 2026-03-09 - Pill in search mode: white bg, elevated above backdrop */
.home-title-pill.searching {
    background: #fff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
/* Raise topbar above backdrop when searching */
.home-topbar.searching {
    z-index: 200;
}
/* 2026-03-09 - Stronger shadow on dropdowns when backdrop is dimmed */
.home-cat-dropdown.open {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.1);
}
.home-creator-dropdown.open {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.1);
}
/* 2026-03-09 - Creator icon button elevated when dropdown open */
.home-creator-btn.active {
    background: #fff;
    color: #333;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
/* 2026-03-09 - Dim backdrop when search is open */
.home-search-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
}
.home-search-backdrop.open { display: block; }
/* 2026-03-08 - Category dropdown from title pill */
/* 2026-03-09 - Fixed position, same level as creator menu */
.home-cat-dropdown {
    display: none;
    position: fixed;
    top: 88px;
    left: 50%;
    transform: translateX(-50%);
    width: 432px;
    box-sizing: border-box;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d9d9dd;
    border-radius: 22px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 201;
    padding: 4px 0;
}
.home-cat-dropdown.open { display: block; }
.home-cat-dropdown .bc-item { cursor: pointer; transition: background 0.1s ease; }
.home-cat-dropdown .bc-item:hover { background: #f5f5f7; }
/* Cancel button inside search mode */
.home-search-cancel {
    flex-shrink: 0;
    border: none;
    background: none;
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--accent-color);
    cursor: pointer;
    padding: 0 4px;
    font-weight: 500;
}
/* 2026-03-07 - Filter button (next to 3-dot menu) */
.home-filter-wrap {
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}
.home-filter-btn {
    display: flex;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ececee;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #999;
    align-items: center;
    justify-content: center;
}
.home-filter-btn.active {
    background: var(--accent-color);
    color: #fff;
}
.home-filter-popover {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    padding: 6px 0;
    z-index: 200;
    min-width: 200px;
}
.home-filter-popover.open {
    display: block;
}
.home-filter-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    font-family: var(--font-family);
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    gap: 8px;
}
.home-filter-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}
.home-filter-item:hover {
    background: #f5f5f7;
}
.home-filter-item.on {
    color: var(--text-primary);
}
.home-filter-item .home-filter-item-state {
    font-weight: 600;
    color: #999;
    margin-left: auto;
}
.home-filter-item.on .home-filter-item-state {
    color: #22994f;
}
.home-filter-item.not .home-filter-item-state {
    color: #e04040;
}
.home-filter-divider {
    height: 1px;
    background: #e8e8e8;
    margin: 4px 0;
}
/* 2026-03-07 - Filter section in 3-dot menu (hidden by default, shown via JS) */
.menu-filter-section {
    display: none;
}
/* Inline search inside title pill */
.home-pill-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.home-pill-search svg {
    flex-shrink: 0;
    color: var(--text-tertiary);
}
.home-pill-search-input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: var(--font-family);
    color: var(--text-primary);
}
.home-pill-search-input::placeholder {
    color: var(--text-tertiary);
}
/* 2026-03-06 - Hide native clear button; we use our own SVG X icon */
.home-pill-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    display: none;
}

/* 2026-02-26 - Wrapper provides layout + colored backdrop in filter mode */
/* 2026-03-09 - Removed max-width cap to allow 3+ columns */
.home-grid-wrapper {
    padding: 32px var(--app-padding) 16px;
    margin: 0 auto;
    width: 100%;
    padding-left: 70px;
    padding-right: 70px;
    flex-shrink: 0;
    box-sizing: border-box;
    border-radius: 20px;
    transition: background 0.3s ease, padding 0.3s ease;
}
/* 2026-03-09 - Fixed max column width + centered grid */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 380px));
    justify-content: center;
    gap: 20px;
    width: 100%;
}

/* 2026-03-07 - Empty state when filters match nothing */
.home-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 8px;
}
.home-empty-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}
.home-empty-subtitle {
    font-size: 15px;
    color: var(--text-tertiary, #999);
}
.home-empty-clear {
    margin-top: 16px;
    padding: 8px 20px;
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font-family);
    color: var(--accent-color);
    background: none;
    border: 1.5px solid var(--accent-color);
    border-radius: 20px;
    cursor: pointer;
}
.home-empty-clear:active {
    opacity: 0.6;
}

/* 2026-03-16 - overflow: visible so badges can hang off card edge; img clips via border-radius */
.home-card {
    position: relative;
    border-radius: 14px;
    overflow: visible;
    cursor: pointer;
    aspect-ratio: 4 / 3;
    background: #ddd;
    /* 2026-02-26 - Removed hover movement, kept shadow for visual depth */
    transition: box-shadow 0.2s ease;
}
.home-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.home-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 14px;
}

/* Dark gradient overlay at bottom for text legibility */
.home-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0 0 14px 14px;
    padding: 40px 18px 16px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.65) 0%,
        rgba(0, 0, 0, 0) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    /* 2026-03-10 - Let info panel buttons receive events through transparent area */
    z-index: 1;
}
.home-card-name {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.2px;
}
.home-card-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 2px;
}
/* 2026-03-09 - Selected home card highlight (matches gallery card-selected) */
.home-card.home-card-selected {
    outline: 2px solid #555;
}
/* 2026-03-10 - Home card info panel (horizontal row at top of card) */
/* 2026-03-16 - Repositioned to upper-left, hanging off card border like badges */
.home-info-panel {
    display: none;
    position: absolute;
    top: -10px;
    left: -10px;
    z-index: 5;
    padding: 0;
}
.home-info-panel.open {
    display: flex;
    justify-content: flex-start;
}
.home-info-card {
    display: flex;
}
.home-info-rows {
    display: flex;
    flex-direction: row;
    gap: 6px;
}
/* 2026-03-10 - Each button is a 44px colored circle with count inside (Apple HIG) */
/* Built as divs in JS with explicit event listeners for reliable pointer handling */
.home-info-row-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    /* 2026-03-16 - Solid colors + stronger shadow so badges pop */
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    z-index: 10;
}
.home-info-row-btn:hover {
    transform: scale(1.1);
}
.home-info-row-btn:active {
    transform: scale(0.95);
}
.home-info-row-all { background: rgb(120, 120, 128); }
.home-info-row-pin { background: rgb(250, 36, 59); }
.home-info-row-review { background: rgb(123, 97, 194); }
.home-info-row-checked { background: rgb(52, 199, 89); }

/* 2026-03-05 - Unified home toolbar: search + filter segments in one pill */


/* 2026-02-26 - Colored bubble backdrop for filtered home grid */
/* 2026-02-27 - Maintain card padding inside colored bubble */
.home-grid-wrapper.filter-active {
    padding: 24px 32px 28px;
    margin-top: 4px;
}
.home-grid-wrapper.filter-pinned {
    background: rgba(212, 30, 50, 0.15);
}
.home-grid-wrapper.filter-review {
    background: rgba(106, 90, 138, 0.15);
}
