/* ==========================================================================
   LaunchVidz — vertical feed
   One launch fills the screen at a time, snap-scrolled like a short-form
   video app. Desktop gets a phone-proportioned card (this is a vertical/
   mobile format, so we don't pretend otherwise on a wide monitor); phones
   get true edge-to-edge full-bleed.
   ========================================================================== */

:root {
    --lv-bg: #0F172A;
    --lv-surface: #1E293B;
    --lv-text: #F1F5F9;
    --lv-text-dim: #94A3B8;
    --lv-purple: #8B5CF6;
    --lv-pink: #EC4899;
    --lv-green: #10B981;
    --lv-gradient: linear-gradient(135deg, #8B5CF6, #EC4899);

    /* Category accents */
    --cat-saas: #8B5CF6;
    --cat-app: #EC4899;
    --cat-ai: #10B981;
    --cat-design: #F59E0B;
    --cat-hardware: #38BDF8;
    --cat-other: #64748B;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    background: var(--lv-bg);
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--lv-text);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---------- Top bar ---------- */

.feed-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.65), transparent);
    pointer-events: none;
}

.feed-topbar > * {
    pointer-events: auto;
}

.feed-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.feed-logo-mark {
    font-size: 1.1rem;
}

.feed-logo-text {
    font-size: 1.05rem;
}

.feed-submit-btn {
    background: var(--lv-gradient);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 9px 16px;
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
    transition: transform 0.15s ease;
}

.feed-submit-btn:hover {
    transform: translateY(-1px) scale(1.02);
}

/* ---------- Feed scroller ---------- */

.feed {
    height: 100dvh;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.feed::-webkit-scrollbar {
    display: none;
}

.feed-slide {
    height: 100dvh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lv-bg);
}

/* Ambient per-category glow behind the card */
.feed-slide::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 30% 20%, color-mix(in srgb, var(--slide-accent, var(--lv-purple)) 30%, transparent), transparent 70%),
        radial-gradient(ellipse 60% 40% at 70% 85%, color-mix(in srgb, var(--slide-accent, var(--lv-pink)) 22%, transparent), transparent 70%);
    opacity: 0.55;
    pointer-events: none;
}

.feed-card {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 640px) {
    .feed-slide {
        padding: 32px 0;
    }
    .feed-card {
        width: min(430px, 92vw);
        height: min(88vh, 900px);
        border-radius: 28px;
        box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.07);
    }
}

/* ---------- Media (video) ---------- */

.feed-media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-media iframe,
.feed-media video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    background: #000;
}

.feed-media video {
    height: 100%;
    object-fit: contain;
}

.feed-thumb-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(2px) brightness(0.55);
    transition: opacity 0.3s ease;
}

.feed-card.is-active .feed-thumb-fallback {
    opacity: 0;
    pointer-events: none;
}

/* Tap-to-pause feedback icon */
.feed-tap-flash {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.feed-tap-flash.flash {
    animation: tapFlash 0.55s ease forwards;
}

@keyframes tapFlash {
    0% { opacity: 0; transform: scale(0.7); }
    30% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.05); }
}

/* Bottom gradient for caption legibility */
.feed-scrim {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 45%;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.75) 70%);
    pointer-events: none;
}

/* ---------- Caption ---------- */

.feed-caption {
    position: absolute;
    left: 18px;
    right: 84px;
    bottom: 22px;
    z-index: 5;
}

.feed-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--slide-accent, var(--lv-purple)) 30%, rgba(255,255,255,0.08));
    color: #fff;
    margin-bottom: 10px;
}

.feed-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.feed-tagline {
    font-size: 0.9rem;
    color: rgba(241, 245, 249, 0.88);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.feed-maker {
    font-size: 0.8rem;
    color: var(--lv-text-dim);
}

/* ---------- Action rail ---------- */

.feed-rail {
    position: absolute;
    right: 12px;
    bottom: 22px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.rail-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #fff;
}

.rail-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    transition: transform 0.15s ease, background 0.15s ease;
}

.rail-btn:hover .rail-icon,
.rail-btn:active .rail-icon {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.2);
}

.rail-btn.upvoted .rail-icon {
    background: var(--lv-gradient);
}

.rail-btn.upvote-pulse .rail-icon {
    animation: railPulse 0.4s ease;
}

@keyframes railPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.rail-count,
.rail-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* ---------- Progress bar ---------- */

.feed-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 6;
}

.feed-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--lv-gradient);
}

/* ---------- Feed position indicator ---------- */

.feed-position {
    position: fixed;
    top: 16px;
    right: 18px;
    z-index: 40;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--lv-text-dim);
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    padding: 5px 11px;
    border-radius: 999px;
}

/* ---------- Loading / error / empty states ---------- */

.feed-status {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 24px;
    background: var(--lv-bg);
    z-index: 30;
}

/* `display: flex` above beats the UA's default `[hidden]{display:none}`
   (author styles win over user-agent styles on the same property even at
   equal specificity), so it needs restating here or the hidden attribute
   is silently ignored. */
.feed-status[hidden] {
    display: none;
}

.feed-status-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.feed-status-body {
    color: var(--lv-text-dim);
    font-size: 0.9rem;
    max-width: 320px;
}

.feed-status-btn {
    background: var(--lv-gradient);
    color: #fff;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 999px;
}

.feed-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(139, 92, 246, 0.25);
    border-top-color: var(--lv-purple);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- End-of-feed slide ---------- */

.feed-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    padding: 40px 28px;
    height: 100%;
    width: 100%;
    background: linear-gradient(160deg, var(--lv-surface), var(--lv-bg));
}

.feed-end-mark {
    font-size: 2.5rem;
}

.feed-end-title {
    font-size: 1.35rem;
    font-weight: 800;
}

.feed-end-body {
    color: var(--lv-text-dim);
    font-size: 0.9rem;
    max-width: 300px;
}

.feed-end-cta {
    background: var(--lv-gradient);
    color: #fff;
    font-weight: 700;
    padding: 12px 26px;
    border-radius: 999px;
    margin-top: 6px;
}

.feed-end-links {
    display: flex;
    gap: 18px;
    margin-top: 18px;
    font-size: 0.82rem;
    color: var(--lv-text-dim);
}

.feed-end-links a:hover {
    color: var(--lv-text);
}

.feed-end-copyright {
    margin-top: 22px;
    font-size: 0.72rem;
    color: var(--lv-text-dim);
    opacity: 0.7;
}

/* ---------- Toast ---------- */

.feed-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(10px);
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--lv-text);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: 999px;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.feed-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .feed {
        scroll-behavior: auto;
    }
    .feed-tap-flash.flash,
    .rail-btn.upvote-pulse .rail-icon,
    .feed-spinner {
        animation: none;
    }
}
