/* ========================================
   Petlito Posts Page — Twitter/X Style
   ======================================== */

html {
    scroll-behavior: smooth;
}

/* Page layout */
.posts-page {
    min-height: 100vh;
    padding-top: 80px;
    background: var(--bg-primary);
}

.posts-container {
    max-width: 620px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ========================================
   Timeline
   ======================================== */
.timeline {
    display: flex;
    flex-direction: column;
}

/* ========================================
   Tweet / Post Card
   ======================================== */
.tweet {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
    margin: 0 -16px;
}

.tweet:hover {
    background: var(--bg-secondary);
}

/* Avatar */
.tweet-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-tertiary);
}

/* Content */
.tweet-content {
    flex: 1;
    min-width: 0;
}

/* Author line */
.tweet-author {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.tweet-displayname {
    font-weight: 700;
    font-size: 0.938rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.tweet-username {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.tweet-dot {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.tweet-time {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* Pet tag */
.tweet-pet-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 123, 95, 0.1);
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    margin-bottom: 6px;
    max-width: fit-content;
}

.tweet-pet-tag svg {
    width: 13px;
    height: 13px;
}

/* Text */
.tweet-text {
    font-size: 0.938rem;
    line-height: 1.55;
    color: var(--text-primary);
    margin-bottom: 10px;
    word-break: break-word;
    white-space: pre-wrap;
}

/* Media */
.tweet-media {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
    position: relative;
    cursor: pointer;
}

.tweet-media img {
    width: 100%;
    display: block;
    max-height: 520px;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.tweet-media img:hover {
    opacity: 0.92;
}

.tweet-media video {
    width: 100%;
    display: block;
    max-height: 520px;
    object-fit: cover;
    cursor: pointer;
}

.tweet-media-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.tweet-media-badge svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.tweet-media-count {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}

/* ========================================
   Action Buttons (Like, Comment, Repost)
   ======================================== */
.tweet-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 400px;
    margin-top: 2px;
}

.tweet-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: none;
    font-family: inherit;
    text-decoration: none;
    line-height: 1;
}

.tweet-action svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

/* Comment — blue hover */
.tweet-action.action-comment:hover {
    color: #1d9bf0;
    background: rgba(29, 155, 240, 0.1);
}
.tweet-action.action-comment:hover svg {
    transform: scale(1.15);
}

/* Repost — green hover */
.tweet-action.action-repost:hover {
    color: #00ba7c;
    background: rgba(0, 186, 124, 0.1);
}
.tweet-action.action-repost:hover svg {
    transform: scale(1.15);
}

/* Like — red/pink hover */
.tweet-action.action-like:hover {
    color: #f91880;
    background: rgba(249, 24, 128, 0.1);
}
.tweet-action.action-like:hover svg {
    transform: scale(1.2);
}

/* Share — blue hover */
.tweet-action.action-share:hover {
    color: #1d9bf0;
    background: rgba(29, 155, 240, 0.1);
}
.tweet-action.action-share:hover svg {
    transform: scale(1.15);
}

/* ========================================
   Image Lightbox
   ======================================== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-close svg {
    width: 22px;
    height: 22px;
    color: #fff;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

/* ========================================
   Download Gate Modal
   ======================================== */
.download-gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.download-gate-card {
    background: var(--bg-primary);
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
    animation: gate-pop 0.35s ease;
}

@keyframes gate-pop {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.download-gate-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.download-gate-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.download-gate-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
}

.download-gate-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.download-gate-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--gradient-primary);
    color: #fff;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 123, 95, 0.3);
}

.download-gate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 123, 95, 0.5);
}

.download-gate-btn svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   Skeleton Loader
   ======================================== */
.tweet-skeleton {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    margin: 0 -16px;
}

.skeleton-pulse {
    background: linear-gradient(90deg,
            var(--bg-secondary) 25%,
            var(--bg-tertiary) 50%,
            var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-name { height: 14px; width: 40%; }
.skeleton-text-1 { height: 14px; width: 90%; }
.skeleton-text-2 { height: 14px; width: 60%; }
.skeleton-media { height: 200px; border-radius: 16px; }

.skeleton-actions {
    display: flex;
    gap: 40px;
    margin-top: 4px;
}

.skeleton-action-item {
    height: 14px;
    width: 40px;
    border-radius: 4px;
}

/* ========================================
   Timeline Loader (infinite scroll)
   ======================================== */
.timeline-loader {
    display: flex;
    justify-content: center;
    padding: 32px 0;
}

.timeline-loader.hidden {
    display: none;
}

.loader-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* End of timeline */
.timeline-end {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

.timeline-end p {
    margin-bottom: 16px;
}

.posts-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: var(--gradient-primary);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 123, 95, 0.3);
    text-decoration: none;
}

.posts-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 123, 95, 0.45);
}

/* ========================================
   Fade-in animation for posts
   ======================================== */
.tweet {
    opacity: 0;
    transform: translateY(12px);
    animation: tweet-in 0.4s ease forwards;
}

@keyframes tweet-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 680px) {
    .posts-container {
        max-width: 100%;
        padding: 0 0;
    }

    .tweet {
        padding: 14px 16px;
        margin: 0;
    }

    .tweet-skeleton {
        padding: 14px 16px;
        margin: 0;
    }

    .tweet-avatar {
        width: 42px;
        height: 42px;
    }

    .tweet-displayname {
        max-width: 140px;
    }

    .tweet-media {
        border-radius: 12px;
    }

    .tweet-action {
        padding: 8px 8px;
    }

    .download-gate-card {
        padding: 36px 24px;
    }
}

@media (max-width: 380px) {
    .tweet-actions {
        gap: 0;
    }

    .tweet-action span {
        display: none;
    }

    .tweet-displayname {
        max-width: 110px;
        font-size: 0.875rem;
    }

    .tweet-username {
        font-size: 0.78rem;
    }
}
