/* ======================================
   SEARCH HERO — Dark Navy Modern
   ====================================== */

.search-command {
    position: relative;
    z-index: 10;
    margin: 2rem 0 3.5rem;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

/* Hero banner with logo */
.search-top-bar {
    width: 100%;
    height: 0.15cm;
    background: #000;
    border-radius: 0.5rem 0.5rem 0 0;
    margin-bottom: 0;
}
.search-tags-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.3rem 1rem;
    background: #000;
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 8px;
}
.search-tag-link {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}
.search-tag-link:hover,
.search-tag-link.active {
    color: #fff;
}
.search-tags-sep {
    color: rgba(255,255,255,0.3);
    font-size: 0.75rem;
}
.search-hero-banner {
    position: relative;
    background-color: #fff;
    padding: 1rem 2rem 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    aspect-ratio: 16 / 3.5;
    max-height: 220px;
    border-radius: 0 0 0.75rem 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.08);
}
.hero-banner-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 35%;
    transition: opacity 0.6s ease;
}
.search-hero-banner::before {
    display: none;
    pointer-events: none;
}
.search-hero-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.06;
    pointer-events: none;
    z-index: 1;
}

/* Search bar — floats on bottom edge of banner */
.search-bottom-area {
    position: relative;
    z-index: 5;
    margin-top: -28px;
    padding: 0 2rem;
}

/* Active filter chips — below search bar */
.search-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin-top: 0.75rem;
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeSlideDown 0.3s ease-out;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem 0.35rem 0.85rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    font-size: 0.8rem;
    color: #1e3a5f;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
html[dir="rtl"] .filter-chip {
    padding: 0.35rem 0.85rem 0.35rem 0.5rem;
}
.filter-chip:hover {
    border-color: #2563eb;
    color: #2563eb;
}
.chip-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    text-decoration: none;
    font-size: 0.75rem;
    line-height: 1;
    transition: all 0.15s;
}
.chip-dismiss:hover { background: #ef4444; color: #fff; }
.filter-clear-all {
    font-size: 0.78rem;
    color: #64748b;
    text-decoration: none;
    margin-inline-start: 0.25rem;
    padding: 0.3rem 0.75rem;
    border-radius: 2rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
    font-weight: 500;
}
.filter-clear-all:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

/* Search controls row */
.search-controls-row {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 820px;
    margin: 0 auto;
    background: rgba(0,0,0,0.77);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 24px -4px rgba(0,0,0,0.25);
}
.search-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    padding: 0 1rem;
}
.search-input-wrap .search-icon {
    width: 18px; height: 18px;
    color: rgba(255,255,255,0.4);
    flex-shrink: 0;
    transition: color 0.25s;
}
.search-input-wrap:focus-within .search-icon {
    color: rgba(255,255,255,0.8);
}
.search-hero-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: #fff;
    padding: 0.85rem 0.6rem;
    outline: none;
    font-family: var(--font-main);
}
.search-hero-input::placeholder {
    color: rgba(255,255,255,0.7);
    font-weight: 400;
}

/* Result count badge */
.search-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px; height: 24px;
    padding: 0 0.4rem;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 2rem;
    font-family: var(--font-main);
    flex-shrink: 0;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.search-count-badge.is-visible {
    opacity: 1;
    transform: scale(1);
}
.search-count-badge:empty { display: none; }

/* Divider between input sections */
.search-controls-row .search-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.12);
    flex-shrink: 0;
}

/* Filter selects in the row */
.search-filter-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.85rem 2rem 0.85rem 1rem;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    font-family: var(--font-main);
    cursor: pointer;
    transition: color 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    min-width: 110px;
}
html[dir="rtl"] .search-filter-select {
    padding: 0.85rem 1rem 0.85rem 2rem;
    background-position: left 0.5rem center;
}
.search-filter-select:focus {
    outline: none;
    color: #fff;
}
.search-filter-select option {
    background: #111;
    color: #fff;
}

/* Search button */
.search-discover-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.85rem 1.5rem;
    background: #2563eb;
    color: #fff;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.search-discover-btn:hover {
    background: #3b82f6;
}
.search-discover-btn:active {
    background: #1d4ed8;
}
.search-discover-btn svg {
    width: 16px; height: 16px;
}


@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 600px) {
    .search-command {
        margin: 1rem 0 2.5rem;
    }
    .search-top-bar {
        display: none;
    }
    .search-tags-row {
        display: none;
    }
    .search-hero-banner {
        background: transparent !important;
        min-height: 0;
        padding: 1rem 1rem 1.5rem;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
    .search-hero-banner::before,
    .search-hero-banner::after {
        display: none;
    }
    .search-bottom-area {
        padding: 0 1rem;
    }
    .search-controls-row {
        flex-wrap: wrap;
        border-radius: 0.5rem;
    }
    .search-input-wrap {
        width: 100%;
        flex: 1 1 100%;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .search-controls-row .search-divider { display: none; }
    .search-filter-select {
        flex: 1;
        min-width: 0;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .search-discover-btn {
        width: 100%;
        justify-content: center;
        padding: 0.9rem;
    }
    .filter-chip { font-size: 0.75rem; }
}
@media (max-width: 899px) {
    .search-hero-banner {
        background-image: none !important;
        min-height: 0;
        aspect-ratio: unset;
        max-height: none;
    }
}
@media (min-width: 900px) {
    .search-command {
        margin: 2.5rem 0 3.5rem;
    }
    .search-hero-banner {
        min-height: 260px;
        aspect-ratio: 16 / 4;
        max-height: 340px;
        padding: 1.25rem 2.5rem 3rem;
        border-radius: 0 0 0.75rem 0.75rem;
    }
    .search-bottom-area {
        margin-top: -30px;
    }
    .search-hero-input {
        font-size: 1rem;
        padding: 1rem 0.6rem;
    }
    .search-filter-select {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    .search-discover-btn {
        padding: 1rem 2rem;
        font-size: 0.9rem;
    }
}

/* --- GALLERY TILES --- */
.gallery-tile.clean-tile {
    border: 1px solid var(--c-border);
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    border-radius: 0.75rem;
    position: relative;
    isolation: isolate;
}
.gallery-tile.clean-tile .tile-img-wrap {
    border-radius: 0.75rem;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}
.gallery-tile.clean-tile img {
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.gallery-tile.clean-tile:hover img {
    transform: scale(1.05);
}
.gallery-tile.clean-tile:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: #fff;
}
.gallery-tile.clean-tile .tile-overlay {
    display: none !important;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(37, 99, 235, 0.15);
    border-radius: 50%;
    border-top-color: #2563eb;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* FEATURED STYLE */
.featured-section { margin: 0 0 3rem; padding: 0; }
.featured-section:not(.behind-section) {
    background: #f7f7f8;
    padding: 2.5rem 1.5rem;
    border-radius: 1rem;
    border: 1px solid #dde0e4;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.featured-slot {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 16px -4px rgba(0,0,0,0.08);
    overflow: hidden;
}
.featured-section:not(.behind-section) > .featured-slot {
    border-color: #d0d4da;
}
.top-banner { margin: 0 0 1.5rem; }
.top-banner-inner { background: transparent; border: 0; padding: 0; box-shadow: none; overflow: hidden; }
.top-banner-inner img { max-width: 100%; height: auto; display: block; border-radius: 0.75rem; }
.feat-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.feat-card { position: relative; aspect-ratio: 2/3; overflow: hidden; border-radius: 0.75rem; text-decoration: none; isolation: isolate; border: 1px solid var(--c-border); box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.feat-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 2; }
.feat-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.feat-card:hover .feat-img { transform: scale(1.05); }
@media(min-width: 500px) { .feat-grid { grid-template-columns: repeat(2, 1fr); } }
@media(min-width: 900px) { .feat-grid { grid-template-columns: repeat(4, 1fr); } }

/* BEHIND STORY STYLE */
html[dir="rtl"] .behind-hero h2 { letter-spacing: 0; }
html[dir="rtl"] .behind-title { letter-spacing: 0; }
html[dir="rtl"] .behind-hero .behind-kicker { letter-spacing: 0.18em; }

.behind-section { margin: 0 0 3rem; padding: 0; }
.behind-hero {
    border-radius: 0.75rem;
    padding: 2rem 1.5rem;
    background: #f8fafc;
    border: 1px solid var(--c-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}
.behind-hero h2 {
    margin: 0;
    font-weight: 900;
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    letter-spacing: 0.02em;
    color: var(--c-text);
}
.behind-hero .behind-kicker {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-text-muted);
}
.behind-hero p {
    margin: 0.9rem 0 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--c-text-muted);
}
.behind-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-top: 1.5rem; }
@media(min-width: 500px) { .behind-grid { grid-template-columns: repeat(2, 1fr); } }
@media(min-width: 900px) { .behind-grid { grid-template-columns: repeat(3, 1fr); } }

.behind-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 0.75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.behind-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: var(--c-primary);
}

.behind-media { display: block; aspect-ratio: 16/10; overflow: hidden; }
.behind-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.behind-card:hover .behind-media img { transform: scale(1.04); }

.behind-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.behind-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--c-text); line-height: 1.3; }
.behind-excerpt {
    margin: 0;
    color: var(--c-text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.behind-actions { margin-top: auto; }
.behind-actions .btn {
    width: 100%;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid var(--c-border);
    color: var(--c-text);
    border-radius: 0.5rem;
    transition: all 0.2s;
}
.behind-actions .btn:hover {
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(37, 99, 235, 0.3);
    color: #2563eb;
}

/* ======== HOMEPAGE MOBILE REDESIGN ======== */
@media (max-width: 600px) {

    /* — Header: slightly compact on mobile (homepage only) — */
    :root { --header-h: 58px; }
    .brand-logo-img { height: 26px; max-width: 140px; }

    /* — Hero area: hide banner image on mobile, less wasted space — */
    .search-command { margin: 0.5rem 0 1.5rem; }
    .search-hero-banner { display: none !important; }
    .search-bottom-area { margin-top: 0; }

    /* — Search controls: tighter, refined — */
    .search-bottom-area { padding: 0 0.75rem; margin-top: -16px; }
    .search-controls-row {
        border-radius: 0.75rem;
        background: rgba(0,0,0,0.85);
        box-shadow: 0 2px 16px rgba(0,0,0,0.15);
    }
    .search-input-wrap { padding: 0 0.85rem; }
    .search-hero-input { font-size: 0.9rem; padding: 0.72rem 0.5rem; }
    .search-filter-select { padding-top: 0.65rem; padding-bottom: 0.65rem; font-size: 0.82rem; }
    .search-discover-btn { padding: 0.75rem; font-size: 0.83rem; }
    .search-active-filters { margin-top: 0.5rem; }
    .filter-chip { font-size: 0.72rem; }

    /* — Section title ("בחירת העורכים"): less vertical waste — */
    .modern-section-title { margin: 2.5rem 0 1.5rem; }
    .modern-section-title h2 { font-size: 2rem; }

    /* — Featured section: flatten nested boxes, 2-column grid — */
    .featured-section:not(.behind-section) {
        padding: 0.75rem;
        margin-bottom: 2rem;
        border-radius: 0.75rem;
        box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    }
    .featured-slot {
        padding: 0.5rem;
        border-radius: 0.6rem;
        box-shadow: none;
        border-color: transparent;
    }
    .top-banner { margin-bottom: 0.75rem; }
    .feat-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.6rem; }
    .feat-card { border-radius: 0.6rem; }

    /* — Behind section: compact — */
    .behind-section { margin-bottom: 2rem; }
    .behind-slot { padding: 0.75rem; }
    .behind-hero { padding: 1.25rem 1rem; border-radius: 0.6rem; }
    .behind-hero h2 { font-size: 1.4rem; }
    .behind-hero p { font-size: 0.88rem; margin-top: 0.5rem; }
    .behind-grid { gap: 0.75rem; margin-top: 1rem; }
    .behind-body { padding: 1rem; gap: 0.35rem; }
    .behind-title { font-size: 0.95rem; }
    .behind-excerpt { font-size: 0.85rem; }

    /* — Gallery grid: tighter spacing — */
    .gallery-grid { gap: 0.65rem; }
    .gallery-tile.clean-tile,
    .gallery-tile.clean-tile .tile-img-wrap { border-radius: 0.5rem; }

    /* — Footer: hide color palette on mobile — */
    .footer-bar { height: 30px; }
    .footer-color-search { display: none; }
}

/* — Small phone refinements — */
@media (max-width: 380px) {
    .search-bottom-area { padding: 0 0.5rem; }
    .search-hero-input { font-size: 0.85rem; padding: 0.65rem 0.4rem; }
    .search-filter-select { font-size: 0.78rem; }
    .modern-section-title { margin: 2rem 0 1.25rem; }
    .modern-section-title h2 { font-size: 1.75rem; }
    .featured-section:not(.behind-section) { padding: 0.5rem; }
    .featured-slot { padding: 0.35rem; }
    .feat-grid { gap: 0.45rem; }
    .behind-hero { padding: 1rem 0.85rem; }
    .behind-hero h2 { font-size: 1.25rem; }
}
