/* ─── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --accent: #a855f7;
    --bg: #0a0a0a;
    --glass: rgba(255,255,255,0.06);
    --border: rgba(255,255,255,0.1);
}

html, body {
    height: 100%;
    background: var(--bg);
    color: #fff;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    overscroll-behavior: none;
}

/* ─── Feed Container ──────────────────────────────────────────────────────── */
#feed {
    height: 100dvh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
#feed::-webkit-scrollbar { display: none; }

/* ─── Post Slide ──────────────────────────────────────────────────────────── */
.post-slide {
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}

/* ─── Media ───────────────────────────────────────────────────────────────── */
.post-media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-media img,
.post-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Text post background — gradient set via inline style from db */
.post-text-bg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: linear-gradient(135deg, #1a0533 0%, #0a0a0a 60%); /* fallback */
}

.post-text-content {
    font-size: clamp(1.25rem, 5vw, 2rem);
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    color: #fff;
    word-break: break-word;
    white-space: pre-wrap;
}

/* ─── Gradient Overlays ───────────────────────────────────────────────────── */
.post-overlay-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 30%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
    pointer-events: none;
}

.post-overlay-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    pointer-events: none;
}

/* ─── Stories Strip ───────────────────────────────────────────────────────── */
#stories-strip {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 16px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, black 80%, transparent 100%);
    mask-image: linear-gradient(to right, black 80%, transparent 100%);
}
#stories-strip::-webkit-scrollbar { display: none; }

.story-avatar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    text-decoration: none;
}

.story-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 2.5px;
    background: conic-gradient(var(--accent), #ec4899, #f59e0b, var(--accent));
    animation: spin 4s linear infinite;
}

@keyframes spin {
    from { filter: hue-rotate(0deg); }
    to   { filter: hue-rotate(360deg); }
}

.story-ring img,
.story-ring .story-ring-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2.5px solid var(--bg);
    object-fit: cover;
    display: block;
}

.story-ring-inner {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
}

.story-label {
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    max-width: 52px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Post Info (bottom left) ─────────────────────────────────────────────── */
.post-info {
    position: absolute;
    bottom: 90px;
    left: 16px;
    right: 90px;
    z-index: 10;
}

.post-username {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-caption {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #fff;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
}

.post-caption.expanded {
    -webkit-line-clamp: unset;
    display: block;
}

.post-time {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
}

/* ─── Action Bar (right side) ─────────────────────────────────────────────── */
.post-actions {
    position: absolute;
    right: 14px;
    bottom: 90px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    background: none;
    border: none;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: transform 0.15s;
}

.action-btn:active { transform: scale(0.85); }

.action-emoji {
    font-size: 1.65rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.action-btn.reacted .action-emoji {
    transform: scale(1.3);
}

.action-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    min-width: 20px;
    text-align: center;
}

.action-btn.share-btn .action-emoji { font-size: 1.3rem; }

/* ─── Mute button ─────────────────────────────────────────────────────────── */
.mute-btn {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    border: none;
    color: #fff;
    font-size: 0.75rem;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.mute-btn.visible { opacity: 1; }

/* ─── Double-tap heart ────────────────────────────────────────────────────── */
.doubletap-heart {
    position: fixed;
    pointer-events: none;
    font-size: 5rem;
    z-index: 9999;
    transform: translate(-50%, -50%) scale(0);
    animation: heartPop 0.8s ease forwards;
}

@keyframes heartPop {
    0%   { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    40%  { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    70%  { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}

/* ─── Reaction burst ──────────────────────────────────────────────────────── */
.burst-emoji {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    user-select: none;
    font-size: 1.5rem;
}

/* ─── Bottom Nav Bar ──────────────────────────────────────────────────────── */
#bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    background: rgba(10,10,10,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0 max(10px, env(safe-area-inset-bottom));
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: rgba(255,255,255,0.5);
    font-size: 0.65rem;
    font-weight: 500;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nav-item.active, .nav-item:hover { color: #fff; }

.nav-icon { font-size: 1.4rem; line-height: 1; }

.nav-new {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 300;
    color: #fff;
    text-decoration: none;
    margin-top: -6px;
    background: var(--accent);
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.2s, transform 0.1s;
}
.nav-new:active { transform: scale(0.92); opacity: 0.85; }

/* ─── Empty feed ──────────────────────────────────────────────────────────── */
#empty-feed {
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255,255,255,0.3);
}

/* ─── Copied toast ────────────────────────────────────────────────────────── */
#toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 20px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    white-space: nowrap;
}
#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Video play indicator ────────────────────────────────────────────────── */
.play-indicator {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.play-indicator.show { opacity: 1; animation: fadeIndicator 0.6s ease forwards; }
@keyframes fadeIndicator {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.4); }
}
.play-indicator-inner {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}
