/* ============================================================
   Discover — full-screen swipeable theme discovery
   Works for logged-in and logged-out users.
   ============================================================ */

body.discover-page {
    overflow: hidden;
    overscroll-behavior: none;
}

.discover-section {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding:
        calc(74px + env(safe-area-inset-top)) 16px
        calc(96px + env(safe-area-inset-bottom));
    overflow: hidden;
}

/* ---------- Heading ---------- */
.discover-head {
    width: 100%;
    max-width: 460px;
    text-align: center;
    margin: 0 auto .5rem;
    flex-shrink: 0;
}

.discover-head h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-red));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.discover-head p {
    color: var(--text-secondary);
    font-size: .8rem;
    margin: .15rem 0 0;
}

/* ---------- Card stage ---------- */
.discover-stage-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    min-height: 0;
}

.discover-stage {
    position: relative;
    height: 100%;
    aspect-ratio: 3 / 4;     /* match the themes grid ratio — far less cropping */
    max-width: 100%;
}

.disc-card {
    position: absolute;
    inset: 0;
    border-radius: 26px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid rgba(179, 0, 255, .25);
    box-shadow:
        0 18px 50px rgba(0, 0, 0, .55),
        0 0 40px rgba(179, 0, 255, .12);
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    will-change: transform;
    transition: transform .35s cubic-bezier(.2, .7, .3, 1);
}

.disc-card.dragging {
    transition: none !important;
    cursor: grabbing;
}

.disc-card__media {
    position: absolute;
    inset: 0;
}

.disc-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.disc-card__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
        rgba(0, 0, 0, .92) 0%,
        rgba(0, 0, 0, .55) 28%,
        rgba(0, 0, 0, 0) 55%);
}

/* Category chip */
.disc-card__cat {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    padding: .35rem .8rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    color: #fff;
    background: rgba(20, 20, 31, .6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .18);
}

/* Info block */
.disc-card__info {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 1.5rem 1.35rem 1.6rem;
}

.disc-card__title {
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1.15;
    color: #fff;
    margin: 0 0 .5rem;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}

.disc-card__desc {
    font-size: .9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, .85);
    margin: 0 0 .85rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}

.disc-card__meta {
    display: flex;
    gap: 1.1rem;
    font-size: .82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .9);
}

.disc-card__meta span {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

/* Swipe stamps */
.disc-stamp {
    position: absolute;
    top: 26px;
    z-index: 3;
    padding: .35rem 1rem;
    border-radius: 12px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 2px;
    opacity: 0;
    pointer-events: none;
}

.disc-stamp--view {
    right: 22px;
    color: #22c55e;
    border: 3px solid #22c55e;
    transform: rotate(14deg);
    text-shadow: 0 0 14px rgba(34, 197, 94, .5);
}

.disc-stamp--skip {
    left: 22px;
    color: #ef4444;
    border: 3px solid #ef4444;
    transform: rotate(-14deg);
    text-shadow: 0 0 14px rgba(239, 68, 68, .5);
}

/* ---------- Controls ---------- */
.discover-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    margin-top: 1rem;
    flex-shrink: 0;
}

.disc-btn {
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.disc-btn:active {
    transform: scale(.9);
}

.disc-btn svg {
    width: 24px;
    height: 24px;
}

.disc-btn--undo {
    width: 48px;
    height: 48px;
    background: rgba(42, 42, 63, .7);
    border: 1px solid var(--border-color);
    color: #f5b301;
}

.disc-btn--skip {
    width: 62px;
    height: 62px;
    background: rgba(42, 42, 63, .7);
    border: 2px solid #ef4444;
    color: #ef4444;
}

.disc-btn--skip svg { width: 28px; height: 28px; }

.disc-btn--view {
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-red));
    box-shadow: 0 8px 24px rgba(179, 0, 255, .45);
}

.disc-btn--view svg { width: 28px; height: 28px; }

.disc-btn--skip:active { background: rgba(239, 68, 68, .15); }

/* ---------- Progress ---------- */
.discover-progress {
    margin-top: .75rem;
    font-size: .78rem;
    color: var(--text-secondary);
    letter-spacing: .5px;
    flex-shrink: 0;
}

.discover-progress b { color: var(--text-primary); }

/* ---------- End / empty state ---------- */
.discover-end {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    border-radius: 26px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.discover-end.show { display: flex; }

.discover-end .end-icon { font-size: 3rem; margin-bottom: .75rem; }
.discover-end h2 { font-size: 1.3rem; margin: 0 0 .4rem; color: var(--text-primary); }
.discover-end p { color: var(--text-secondary); font-size: .9rem; margin: 0 0 1.5rem; }
.discover-end .end-actions { display: flex; flex-direction: column; gap: .6rem; width: 100%; max-width: 240px; }

.discover-hint {
    margin-top: .5rem;
    font-size: .72rem;
    color: var(--text-secondary);
    opacity: .7;
    flex-shrink: 0;
}

/* ---------- Desktop tweaks ---------- */
@media (min-width: 768px) {
    .discover-section {
        padding-top: 96px;
        padding-bottom: 28px;
    }
    .discover-head h1 { font-size: 1.5rem; }
    .disc-card__title { font-size: 1.7rem; }
}
