/* Card-grid discovery browse (HouseSwapp-style, not TikTok reels) */

.discover-page {
    padding: calc(var(--header-h) + 1rem) 0 3rem;
}

.discover-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.discover-head h1 {
    margin: 0.35rem 0 0.25rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.15;
}

.discover-head-actions {
    flex-shrink: 0;
}

.discover-toolbar {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.discover-search-wrap {
    position: relative;
}

.discover-search-wrap input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.7rem 1rem;
    font: inherit;
    background: var(--surface);
}

.discover-suggestions {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 1200;
    max-height: min(320px, 50vh);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 0.35rem;
}

.discover-suggestion {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    border: 0;
    border-radius: calc(var(--radius-lg) - 4px);
    padding: 0.55rem 0.65rem;
    background: transparent;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.discover-suggestion:hover,
.discover-suggestion.is-active {
    background: var(--brand-soft);
}

.discover-suggestion__icon {
    flex-shrink: 0;
    width: 1.75rem;
    text-align: center;
    font-size: 1rem;
}

.discover-suggestion__text {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.discover-suggestion__text strong {
    font-size: 0.88rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discover-suggestion__text span {
    font-size: 0.72rem;
    color: var(--muted);
}

.discover-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.discover-filters select {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.55rem 0.85rem;
    font: inherit;
    background: var(--surface);
    min-height: var(--touch-min);
}

.discover-results-meta {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 700;
}

.discover-results-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.discover-view-toggle {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.2rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
}

.discover-view-toggle__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 0;
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.discover-view-toggle__btn.is-active {
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--shadow-sm);
}

.discover-page[data-view="grid"] .discover-deck {
    display: none;
}

.discover-page[data-view="swipe"] .discover-grid-panel {
    display: none;
}

.discover-page[data-view="swipe"] .discover-deck {
    display: block;
    max-width: 440px;
    margin: 0 auto 1rem;
}

@media (min-width: 900px) {
    .discover-page[data-view="swipe"] .discover-deck__arena {
        height: min(72vh, 620px);
    }
}

.discover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.discover-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.discover-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.discover-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.discover-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--brand-soft);
}

.discover-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.discover-card:hover .discover-card__media img {
    transform: scale(1.03);
}

.discover-card__live {
    position: absolute;
    top: 0.55rem;
    left: 0.55rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(16, 185, 129, 0.92);
    color: #fff;
}

.discover-card__body {
    padding: 0.85rem 0.9rem 1rem;
}

.discover-card__body h2 {
    margin: 0.35rem 0 0.25rem;
    font-size: 0.98rem;
    line-height: 1.25;
}

.discover-card__stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.55rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.discover-card__stats strong {
    color: var(--brand);
    font-size: 0.82rem;
}

.discover-empty {
    text-align: center;
}

.discover-pagination {
    margin-top: 1.5rem;
}

/* Mobile swipe deck (HouseSwapp-style) */
.discover-deck {
    margin-bottom: 1rem;
}

.discover-deck__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.discover-deck__counter {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--muted);
}

.discover-deck__hint {
    margin: 0;
    font-size: 0.72rem;
    color: var(--muted);
    text-align: right;
}

.discover-deck__arena {
    position: relative;
    height: min(68vh, 560px);
    touch-action: pan-y;
}

.discover-deck-card {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    user-select: none;
    touch-action: none;
    will-change: transform;
}

.discover-deck-card[data-stack="0"] { z-index: 3; }
.discover-deck-card[data-stack="1"] {
    z-index: 2;
    transform: scale(0.96) translateY(10px);
    opacity: 0.92;
}
.discover-deck-card[data-stack="2"] {
    z-index: 1;
    transform: scale(0.92) translateY(20px);
    opacity: 0.78;
}

.discover-deck-card__photo {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.discover-deck-card__photo--empty {
    background: linear-gradient(145deg, var(--brand-soft), var(--surface));
}

.discover-deck-card__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.72) 100%);
}

.discover-deck-card__top {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 2;
}

.discover-deck-card__live {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(16, 185, 129, 0.92);
    color: #fff;
}

.discover-deck-card__saved {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #e11d48;
    font-size: 1rem;
}

.discover-deck-card__body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 1rem 1rem 1.1rem;
    color: #fff;
}

.discover-deck-card__chip {
    display: inline-block;
    margin-bottom: 0.35rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.18);
}

.discover-deck-card__body h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
    line-height: 1.2;
}

.discover-deck-card__city {
    margin: 0;
    font-size: 0.82rem;
    opacity: 0.9;
}

.discover-deck-card__stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.55rem;
    font-size: 0.76rem;
}

.discover-deck-card__stats strong {
    color: #fff;
    font-size: 0.82rem;
}

.discover-deck-stamp {
    position: absolute;
    top: 2.5rem;
    z-index: 4;
    padding: 0.35rem 0.75rem;
    border: 3px solid;
    border-radius: 0.35rem;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    opacity: 0;
    pointer-events: none;
}

.discover-deck-stamp--save {
    right: 1rem;
    color: #22c55e;
    border-color: #22c55e;
    transform: rotate(12deg);
}

.discover-deck-stamp--pass {
    left: 1rem;
    color: #f43f5e;
    border-color: #f43f5e;
    transform: rotate(-12deg);
}

.discover-deck__footer {
    margin-top: 0.85rem;
}

.discover-deck__guest {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    background: var(--brand-soft);
    font-size: 0.78rem;
}

.discover-deck__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.discover-deck__action {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    display: grid;
    place-items: center;
    color: inherit;
    cursor: pointer;
}

.discover-deck__action--pass {
    color: #f43f5e;
}

.discover-deck__action--save {
    width: 4rem;
    height: 4rem;
    color: #e11d48;
    border-color: rgba(225, 29, 72, 0.25);
}

.discover-deck__empty {
    margin-top: 0.75rem;
    text-align: center;
}

@media (min-width: 768px) {
    .discover-toolbar {
        grid-template-columns: 1.2fr 1fr;
        align-items: center;
    }
}
