/*
 * Post Styles - Modern Twitter-Style Design
 * Extracted from feed-modern.html for global use
 * Used on: feed, profile, explore, search, post-detail pages
 */

/* ========================================
   POST CARD - FULL WIDTH
   ======================================== */

.post-card,
.post {
    background: var(--bg-primary);
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-light);
    margin: 0;
    padding: 0;
    transition: all var(--transition-fast);
    width: 100%;
    max-width: 100%;
    /* Never create a scroll container on the card (overflow-x:hidden
       promotes overflow-y to auto and makes short posts scrollable). */
    overflow: visible;
}

.post-card:hover,
.post:hover {
    background: var(--bg-primary);
}

/* Desktop: rounded cards that float on the warm beige background */
@media (min-width: 1024px) {

    .post-card,
    .post {
        border-radius: 8px;
        border: 1px solid var(--border-light);
        margin: 0 0 8px 0;
        box-shadow: var(--shadow-sm);
    }

    .post-card:hover,
    .post:hover {
        border-color: var(--border-color);
        box-shadow: var(--shadow-md);
    }
}

/* ========================================
   POST HEADER
   ======================================== */

.post-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 0.75rem;
    position: relative;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

@media (max-width: 768px) {
    .post-avatar {
        width: 36px;
        height: 36px;
    }
}

.post-author-info {
    flex: 1;
    min-width: 0;
}

.post-author-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.post-author-name:hover {
    text-decoration: underline;
}

.verified-badge {
    color: var(--primary);
    font-size: 1rem;
}

.post-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.post-meta i {
    font-size: 0.75rem;
}

.post-menu-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.post-menu-btn:hover {
    background: var(--bg-hover);
}

/* Post Menu Dropdown */
.post-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 200px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    overflow: hidden;
}

.post-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.post-menu-dropdown .menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.post-menu-dropdown .menu-item:hover {
    background: var(--bg-hover);
}

.post-menu-dropdown .menu-item i {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* ========================================
   POST CONTENT
   ======================================== */

.post-content {
    padding: 0;
    overflow: visible;
    max-width: 100%;
}

.post-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    padding: 0 1.25rem;
    position: relative;
    overflow: visible;
    max-height: none;
}

.post-text.truncated {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    overflow: hidden;
    max-height: none;
}

.post-text.truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1.25rem;
    right: 1.25rem;
    height: 56px;
    background: linear-gradient(to bottom, transparent, var(--bg-primary));
    pointer-events: none;
}

.see-more-btn {
    display: inline-block;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 1.25rem 0.5rem;
    margin-top: -0.35rem;
    margin-bottom: 0.35rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-family: inherit;
    transition: color var(--transition-fast);
}

.see-more-btn:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.post-text .hashtag {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.post-text .hashtag:hover {
    text-decoration: underline;
}

.post-text .mention-link,
.comment-text-detail .mention-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.post-text .mention-link:hover,
.comment-text-detail .mention-link:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

/* ========================================
   POST POLL
   ======================================== */

.post-poll {
    margin: 0.75rem 1.25rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.poll-question {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.poll-option {
    position: relative;
    padding: 0.875rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
    width: 100%;
    text-align: left;
    font: inherit;
    display: block;
}

.poll-option.is-selected {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.poll-option:disabled,
.poll-option[aria-disabled="true"] {
    cursor: default;
    opacity: 1;
}

.poll-option:disabled:hover {
    border-color: var(--border-light);
}

.post-poll[data-can-vote="1"] .poll-option:not(:disabled):hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.poll-option.is-correct {
    border-color: #16a34a;
    box-shadow: inset 0 0 0 1px #16a34a;
}

.poll-question-block + .poll-question-block {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-light);
}

.poll-question-index {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.poll-lock-gate {
    text-align: center;
    padding: 1rem 0.5rem;
}

.poll-lock-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
}

.poll-lock-hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.85rem;
}

.poll-open-btn {
    border: 0;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
}

.poll-session-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.poll-session-countdown {
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.poll-anon-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.poll-reselect-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.poll-score {
    font-weight: 700;
    color: var(--primary);
}

.post-text .mention,
.post-text .mention-campus {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.post-text .mention:hover,
.post-text .mention-campus:hover {
    text-decoration: underline;
}

.post-feeling {
    margin: 0 1.25rem 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.poll-option:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.poll-option-text {
    position: relative;
    z-index: 2;
    color: var(--text-primary);
    font-weight: 500;
}

.poll-option-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--primary);
    opacity: 0.15;
    transition: width 0.3s ease;
    z-index: 1;
}

.poll-option-percentage {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    font-weight: 600;
    color: var(--primary);
}

.poll-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

/* ========================================
   POST MEDIA - FULL WIDTH
   ======================================== */

.post-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: contain;
    border-radius: 0;
    margin: 0.5rem 0 0;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    display: block;
    background: var(--bg-secondary);
}

.post-image:hover {
    opacity: 0.95;
}

.post-images-grid {
    display: grid;
    gap: 0.25rem;
    margin: 0.75rem 0;
    border-radius: 0;
    overflow: hidden;
    width: 100%;
}

.post-images-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.post-images-grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
}

.post-images-grid.grid-3 .grid-item:first-child {
    grid-column: span 2;
}

.post-images-grid.grid-4,
.post-images-grid[class*="grid-"] {
    grid-template-columns: repeat(2, 1fr);
}

.grid-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    background: #000;
}

.grid-item img,
.grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base), opacity var(--transition-fast);
}

.grid-item:hover img,
.grid-item:hover video {
    transform: scale(1.05);
    opacity: 0.95;
}

/* More media overlay */
.more-media-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    backdrop-filter: blur(2px);
}

/* Video play overlay */
.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.video-item:hover .video-play-overlay {
    opacity: 1;
}

.video-play-overlay i {
    font-size: 3rem;
    color: white;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

/* Video Badge Indicator */
.video-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    z-index: 2;
}

.video-badge i {
    font-size: 0.875rem;
}

/* Video Player - Intelligent Aspect-Ratio Scaling */
.post-video-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0.5rem 0 0;
    border-radius: 0;
    overflow: hidden;
    background: #000;
}

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

.video-controls-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.5) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-base);
    cursor: pointer;
}

.post-video-container:hover .video-controls-overlay {
    opacity: 1;
}

.video-play-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.95);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.video-play-btn:hover {
    transform: scale(1.1);
    background: white;
}

.video-play-btn i {
    font-size: 1.5rem;
    color: var(--primary);
    margin-left: 3px;
}

.video-duration {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
}

.video-mute-btn {
    position: absolute;
    bottom: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.video-mute-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.video-fullscreen-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    z-index: 10;
}

.video-fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.05);
}

/* ========================================
   POST ACTIONS - TWITTER STYLE
   ======================================== */

.post-actions {
    display: flex !important;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-light);
}

.post-action {
    flex: 1 1 0 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.post-action:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.post-action i {
    font-size: 1.25rem;
}

.post-action span {
    font-size: 0.875rem;
    line-height: 1;
    min-width: 1ch;
    font-weight: 700;
}

.post-action .action-count {
    font-size: 0.875rem;
    line-height: 1;
    min-width: 1ch;
    font-weight: 700;
}

.post-action.liked {
    color: var(--primary, #4f46e5) !important;
}

.post-action.liked i {
    color: var(--primary, #4f46e5) !important;
    animation: thumbsUpPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Fired via JS when un-liking */
.post-action.thumb-unlike i {
    animation: thumbsDropPop 0.3s ease-out forwards;
}

.post-action.saved {
    color: var(--primary) !important;
}

.post-action.saved i {
    color: var(--primary) !important;
    animation: thumbsUpPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Like animations ───────────────────── */
@keyframes thumbsUpPop {
    0% {
        transform: scale(1) rotate(0deg);
    }

    15% {
        transform: scale(0.78) rotate(-12deg);
    }

    50% {
        transform: scale(1.55) rotate(10deg);
    }

    72% {
        transform: scale(1.15) rotate(-5deg);
    }

    88% {
        transform: scale(1.06) rotate(2deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

@keyframes thumbsDropPop {
    0% {
        transform: scale(1) rotate(0deg);
    }

    35% {
        transform: scale(0.8) rotate(18deg);
    }

    70% {
        transform: scale(1.05) rotate(-4deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Count bump when incrementing */
@keyframes countBump {
    0% {
        transform: translateY(0) scale(1);
    }

    40% {
        transform: translateY(-4px) scale(1.25);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

.post-action .action-count.increment {
    animation: countBump 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reusable animation trigger classes (video modal, etc.) */
.thumb-pop-like {
    animation: thumbsUpPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.thumb-pop-unlike {
    animation: thumbsDropPop 0.3s ease-out forwards;
}

/* ========================================
   COMMENT ACTIONS
   ======================================== */

.comment-footer {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.comment-action {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.comment-action:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.comment-action.liked {
    color: #1d9bf0;
    /* Blue for liked - Twitter style */
}

.comment-action.liked i {
    animation: like 0.3s ease;
}

.comment-action i {
    font-size: 1rem;
}

.comment-action .action-count {
    font-size: 0.8125rem;
    line-height: 1;
    min-width: 1ch;
}

/* ========================================
   MEDIA GALLERY MODAL
   ======================================== */

.media-gallery-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.media-gallery-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.gallery-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.gallery-media {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Gallery Controls */
.gallery-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10001;
}

.gallery-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10001;
}

.gallery-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav-btn.prev {
    left: 2rem;
}

.gallery-nav-btn.next {
    right: 2rem;
}

.gallery-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Gallery Counter */
.gallery-counter {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10001;
}

/* Gallery Thumbnails */
.gallery-thumbnails {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    max-width: 90vw;
    overflow-x: auto;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    z-index: 10001;
}

.gallery-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.gallery-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    border: 2px solid transparent;
}

.gallery-thumb:hover {
    opacity: 0.8;
}

.gallery-thumb.active {
    opacity: 1;
    border-color: white;
}

.gallery-thumb img,
.gallery-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   POST DETAIL SIDEBAR
   ======================================== */

.post-detail-sidebar {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.post-detail-sidebar.active {
    right: 0;
}

.post-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.post-detail-overlay.active {
    opacity: 1;
    visibility: visible;
}

.post-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.post-detail-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.close-detail-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.close-detail-btn:hover {
    background: var(--bg-hover);
    transform: rotate(90deg);
}

.post-detail-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.post-detail-content {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.detail-post-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.detail-post-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.detail-post-author-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.detail-post-author-info p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
}

.detail-post-text {
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.detail-post-stats {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-light);
    font-size: 0.875rem;
}

.detail-stat {
    color: var(--text-secondary);
}

.detail-stat strong {
    color: var(--text-primary);
    font-weight: 600;
}

.detail-post-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-light);
}

.detail-action-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.detail-action-btn:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.detail-action-btn.liked {
    color: #1d9bf0;
    border-color: #1d9bf0;
}

.detail-action-btn.saved {
    color: #1d9bf0;
    border-color: #1d9bf0;
}

/* Comments Section */
.comments-section {
    flex: 1;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
}

.comments-section-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 5;
}

.comments-section-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-count-badge {
    background: var(--primary);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ========================================
   CUSTOM SCROLLBAR — applied globally
   ======================================== */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

*::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 99px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ========================================
   COMMENTS LIST CONTAINER
   ======================================== */

.comments-list-detail {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem;
}

/* ========================================
   THREAD COMMENT (Twitter-style)
   ======================================== */

.cmt-thread {
    display: grid;
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.75rem;
    padding: 0.75rem 0;
    position: relative;
}

/* Reply: slightly indented and uses a smaller avatar */
.cmt-thread.cmt-reply {
    padding-left: 0.5rem;
    grid-template-columns: 32px 1fr;
}

.cmt-thread.cmt-reply .cmt-avatar {
    width: 32px;
    height: 32px;
}

/* ── Left column ── */
.cmt-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    grid-column: 1;
    grid-row: 1 / 3;
}

.cmt-avatar-wrap {
    display: block;
    flex-shrink: 0;
    text-decoration: none;
}

.cmt-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* Vertical connector line joining parent → replies */
.cmt-vline {
    flex: 1;
    width: 2px;
    margin-top: 4px;
    background: var(--border-light);
    border-radius: 99px;
    min-height: 16px;
}

/* ── Right column (body) ── */
.cmt-body {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    padding-bottom: 0.25rem;
}

/* Header row: name/handle/time + three-dot menu */
.cmt-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.cmt-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.4rem;
    min-width: 0;
}

.cmt-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.cmt-name:hover {
    text-decoration: underline;
    color: var(--primary);
}

.cmt-handle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.cmt-sep {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

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

/* "Replying to @x" label */
.cmt-replying-to {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.cmt-replying-to a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* Comment text */
.cmt-text {
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-primary);
    word-break: break-word;
    margin-bottom: 0.5rem;
}

.cmt-text p {
    margin: 0 0 0.25rem 0;
}

/* ── Comment media: post-style grid ────────────────────────────
   Multi reuses .post-images-grid.grid-N; this wrapper adds context.
   ─────────────────────────────────────────────────────────────── */
.cmt-images-grid {
    margin: 0.5rem 0 0.25rem;
    max-width: 380px;
    border-radius: 12px;
    overflow: hidden;
}

.cmt-grid-single {
    display: inline-block;
    max-width: min(340px, 100%);
}

.cmt-grid-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-secondary, #f2f2f2);
    border-radius: 12px;
    transition: opacity .15s;
}

/* Multi-item grids crop to square cells; single items keep intrinsic ratio. */
.post-images-grid .cmt-grid-item,
.post-images-grid .grid-item {
    aspect-ratio: 1;
}

.post-images-grid .cmt-grid-item img,
.post-images-grid .cmt-grid-item video,
.cmt-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .15s;
}

.cmt-grid-single .cmt-grid-item img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
    transition: transform .15s;
}

.cmt-grid-single .cmt-grid-item video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 320px;
    object-fit: cover;
    transition: transform .15s;
}

.cmt-grid-item:hover img,
.cmt-grid-item:hover video {
    transform: scale(1.03);
}

.cmt-grid-video .cmt-play-icon {
    font-size: 2.2rem;
}

/* Kept for legacy strip fallback */
.cmt-media-wrap {
    margin: 0.5rem 0 0.25rem;
}

/* Single media thumbnail */
.cmt-media-single-wrap .cmt-media-thumb {
    display: inline-block;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    max-width: 220px;
    max-height: 160px;
    transition: transform .15s;
}

.cmt-media-single-wrap .cmt-media-thumb:hover {
    transform: scale(1.02);
}

.cmt-thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 220px;
    max-height: 160px;
    object-fit: cover;
    border-radius: 10px;
    background: var(--bg-tertiary);
}

/* Multi media: horizontal strip */
.cmt-media-strip {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 3px;
    scrollbar-width: none;
}

.cmt-media-strip::-webkit-scrollbar {
    display: none;
}

.cmt-strip-item {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    background: var(--bg-tertiary);
    transition: transform .15s;
}

.cmt-strip-item:hover {
    transform: scale(1.04);
}

.cmt-strip-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video play overlay */
.cmt-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .28);
    color: #fff;
    font-size: 1.4rem;
    pointer-events: none;
}

.cmt-media-single-wrap .cmt-play-icon {
    font-size: 2rem;
}

/* "+N more" overlay */
.cmt-more-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: 8px;
}

/* ── Comment media gallery modal ─────────────────────────── */
#cmtGalleryModal {
    position: fixed;
    inset: 0;
    z-index: 110000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .94);
    backdrop-filter: blur(6px);
}

#cmtGalleryModal.open {
    display: flex;
}

.cmt-gallery-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .75rem;
}

.cmt-gallery-counter {
    position: absolute;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, .12);
    backdrop-filter: blur(8px);
    color: #fff;
    padding: .3rem 1rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    z-index: 2;
}

.cmt-gallery-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    z-index: 3;
}

.cmt-gallery-close:hover {
    background: rgba(255, 255, 255, .25);
}

.cmt-gallery-media-wrap {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmt-gallery-media-wrap img,
.cmt-gallery-media-wrap video {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.cmt-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    z-index: 3;
}

.cmt-gallery-nav:hover {
    background: rgba(255, 255, 255, .25);
}

.cmt-gallery-nav.prev {
    left: 1rem;
}

.cmt-gallery-nav.next {
    right: 1rem;
}

.cmt-gallery-nav:disabled {
    opacity: .3;
    cursor: default;
}

.cmt-gallery-thumbs {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    max-width: 90vw;
    overflow-x: auto;
    padding: 4px;
    background: rgba(0, 0, 0, .4);
    border-radius: 10px;
}

.cmt-gallery-thumbs::-webkit-scrollbar {
    display: none;
}

.cmt-gthumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: .5;
    border: 2px solid transparent;
    flex-shrink: 0;
    transition: opacity .15s, border-color .15s;
}

.cmt-gthumb.active {
    opacity: 1;
    border-color: #fff;
}

.cmt-gthumb img,
.cmt-gthumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Attached single media — legacy (kept for safety) */
.cmt-media-single {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    background: #000;
}

/* Actions row */
.cmt-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 0.375rem;
}

.cmt-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0;
    transition: color var(--transition-fast), transform var(--transition-fast);
    text-decoration: none;
}

.cmt-btn:hover {
    color: var(--primary);
}

.cmt-btn i {
    font-size: 0.9375rem;
    transition: transform 0.15s;
}

.cmt-btn:hover i {
    transform: scale(1.15);
}

.cmt-btn.cmt-like:hover {
    color: #1d9bf0;
}

.cmt-btn.cmt-like.liked {
    color: #1d9bf0;
}

.cmt-btn.cmt-like.liked i {
    animation: heartPop 0.25s ease;
}

@keyframes heartPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

/* ── Three-dot menu ── */
.cmt-menu-wrap {
    position: relative;
    flex-shrink: 0;
}

.cmt-menu-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: background var(--transition-fast), color var(--transition-fast);
    margin-top: 1px;
}

.cmt-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.cmt-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.cmt-dropdown.open {
    display: block;
}

.cmt-drop-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-fast);
}

.cmt-drop-item:hover {
    background: var(--bg-hover);
}

.cmt-drop-item.danger {
    color: var(--danger);
}

.cmt-drop-item i {
    font-size: 1rem;
    width: 18px;
    flex-shrink: 0;
}

/* ── Nested replies block ── */
.cmt-replies {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-left: 0;
    /* reply avatars align under the connector line */
}

/* reply-target highlight */
.cmt-thread.reply-target>.cmt-body {
    background: color-mix(in srgb, var(--primary) 6%, transparent);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    margin: -0.5rem;
}

.cmt-thread.reply-target>.cmt-left .cmt-avatar {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ========================================
   COMMENT INPUT
   ======================================== */

.comment-input-fixed {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--border-light);
    background: var(--bg-primary);
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.comment-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 0.75rem;
    transition: all var(--transition-fast);
}

.comment-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(4, 111, 173, 0.08);
    background: var(--bg-primary);
}

.comment-input-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity 0.2s, outline 0.2s;
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.comment-input-avatar:hover {
    opacity: 0.85;
}

.comment-input-avatar.anonymous-active {
    outline-color: var(--primary);
    opacity: 0.75;
}

.comment-input-field-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
}

.comment-textarea-detail {
    width: 100%;
    padding: 0.25rem 0;
    padding-bottom: 2.25rem;
    background: transparent;
    border: none;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary);
    resize: none;
    min-height: 20px;
    max-height: 120px;
    font-family: inherit;
}

.comment-textarea-detail::placeholder {
    color: var(--text-secondary);
}

.comment-textarea-detail:focus {
    outline: none;
}

.attach-media-btn {
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.attach-media-btn:hover {
    color: var(--primary);
}

.submit-comment-detail-btn {
    width: 34px;
    height: 34px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.submit-comment-detail-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.07);
}

.submit-comment-detail-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.comment-media-preview {
    padding: 0.5rem 0;
}

/* Reply context pill */
.reply-context-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.reply-context-indicator strong {
    color: var(--primary);
}

.no-comments-detail {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.no-comments-detail i {
    font-size: 3rem;
    opacity: 0.25;
    margin-bottom: 0.75rem;
    display: block;
}

.no-comments-detail p {
    font-size: 0.9375rem;
    margin: 0;
}

/* ========================================
   SKELETON LOADING
   ======================================== */

.post-skeleton {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.skeleton-header {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
}

.skeleton-text-group {
    flex: 1;
}

.skeleton-text {
    height: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    animation: shimmer 1.5s infinite;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-image {
    width: 100%;
    height: 300px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .post-detail-sidebar {
        width: 100%;
        right: -100%;
    }

    .cmt-thread.cmt-reply {
        margin-left: 0;
    }

    .gallery-nav-btn {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    .gallery-nav-btn.prev {
        left: 1rem;
    }

    .gallery-nav-btn.next {
        right: 1rem;
    }

    .gallery-close-btn {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    .gallery-thumbnails {
        display: none;
    }
}

@media (max-width: 640px) {
    .post-action {
        padding: 0.625rem 0.5rem;
    }

    .post-action span {
        display: none;
    }
}

/* ========================================
   COMMENT FORM WIDTH RESTRICTION (Desktop)
   ======================================== */

@media (min-width: 769px) {

    /* Comment form in post detail should match post width */
    .comment-form-container,
    .post-detail-comment-form,
    .fixed-comment-form,
    .comment-form-wrapper,
    form[action*="comments/add"] {
        max-width: var(--max-feed-width, 600px) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100% !important;
    }

    /* Fixed bottom comment form */
    .fixed-bottom-comment {
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: var(--max-feed-width, 600px) !important;
        width: 100% !important;
    }
}

/* WhatsApp-style comment highlight */
@keyframes cmtFlash {

    0%,
    100% {
        background: transparent;
    }

    25%,
    75% {
        background: color-mix(in srgb, var(--primary) 14%, transparent);
    }
}

.cmt-flash-highlight {
    animation: cmtFlash 1.8s ease;
    border-radius: 8px;
}

.cmt-replying-to {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    user-select: none;
}

.cmt-replying-to:hover span {
    text-decoration: underline;
}

/* ─────────────────────────────────────────────────────────────────
   Product Post Card  (.ppc-*)
   Shown when a Post has post.product set (social share of a product)
───────────────────────────────────────────────────────────────── */
.ppc-wrap {
    display: block;
    text-decoration: none;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    overflow: hidden;
    margin-top: .5rem;
    transition: box-shadow .2s, transform .2s;
    background: var(--bg-primary, #fff);
}

.ppc-wrap:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, .1);
    transform: translateY(-1px);
}

/* Single image */
.ppc-img-single {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--bg-secondary, #f5f5f5);
}

.ppc-img-single img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s;
}

.ppc-wrap:hover .ppc-img-single img {
    transform: scale(1.04);
}

/* Multi-image grid (2 columns, max 4 items) */
.ppc-img-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    background: var(--border-color, #e5e7eb);
}

.ppc-img-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-secondary, #f5f5f5);
}

.ppc-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}

.ppc-img-item:hover img {
    transform: scale(1.05);
}

/* Video badge overlay */
.ppc-video-badge {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.2rem;
    background: rgba(0, 0, 0, .25);
    pointer-events: none;
}

/* "+N more" overlay on 4th cell */
.ppc-more-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .52);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Info strip */
.ppc-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .65rem .85rem;
    gap: .75rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.ppc-details {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.ppc-condition {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--primary, #6366f1);
    padding: .1rem .45rem;
    background: color-mix(in srgb, var(--primary, #6366f1) 12%, transparent);
    border-radius: 20px;
    display: inline-block;
    width: fit-content;
    line-height: 1.6;
}

.ppc-title {
    font-size: .92rem;
    font-weight: 600;
    color: var(--text-primary, #111);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 200px;
}

.ppc-nego {
    font-size: .72rem;
    color: var(--text-muted, #888);
}

.ppc-meta {
    display: flex;
    align-items: center;
    gap: .25rem;
    font-size: .72rem;
    color: var(--text-muted, #888);
    max-width: 200px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ppc-meta i {
    font-size: .75rem;
    flex-shrink: 0;
}

.ppc-price-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    gap: .15rem;
}

.ppc-price {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary, #111);
    white-space: nowrap;
}

.ppc-cta {
    font-size: .75rem;
    font-weight: 600;
    color: var(--primary, #6366f1);
    display: flex;
    align-items: center;
    gap: .1rem;
}

/* ─── Event Post Card (epc-*) ── matches explore event-card exactly ── */
.epc-wrap {
    display: block;
    text-decoration: none;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    overflow: hidden;
    margin-top: .5rem;
    transition: transform .18s, box-shadow .18s, border-color .18s;
}

.epc-wrap:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .1);
    border-color: var(--primary, #046fad);
    text-decoration: none;
}

/* Cover — fixed height, gradient fallback */
.epc-cover {
    width: 100%;
    height: 150px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary, #046fad) 0%, #0a3d5e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.epc-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 1;
}

.epc-cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0, 0, 0, .35) 100%);
    z-index: 2;
    pointer-events: none;
}

.epc-cover-icon {
    font-size: 2.8rem;
    color: rgba(255, 255, 255, .3);
    position: absolute;
    z-index: 0;
}

.epc-cover img~.epc-cover-icon {
    display: none;
}

/* Type badge — bottom-left on cover */
.epc-type-badge {
    position: absolute;
    bottom: .5rem;
    left: .5rem;
    z-index: 3;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: .68rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 6px;
    text-transform: capitalize;
    max-width: calc(100% - 1rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status badges — top-right on cover */
.epc-status-badge {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 3;
    font-size: .65rem;
    font-weight: 700;
    padding: .2rem .45rem;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: .2rem;
}

.epc-status-badge.live {
    background: #ef4444;
    color: #fff;
}

.epc-status-badge.upcoming {
    background: var(--primary, #046fad);
    color: #fff;
}

.epc-status-badge.past {
    background: rgba(0, 0, 0, .45);
    color: #ddd;
}

@keyframes epc-pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .55
    }
}

.epc-status-badge.live {
    animation: epc-pulse 1.6s ease-in-out infinite;
}

/* Body */
.epc-body {
    padding: .7rem .75rem .75rem;
}

.epc-title {
    font-size: .875rem;
    font-weight: 700;
    color: var(--text-primary, #111);
    line-height: 1.35;
    margin: 0 0 .45rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
}

.epc-meta {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-bottom: .55rem;
}

.epc-meta-row {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .775rem;
    color: var(--text-secondary, #6b7280);
    overflow: hidden;
}

.epc-meta-row i {
    color: var(--primary, #046fad);
    font-size: .8rem;
    flex-shrink: 0;
}

.epc-meta-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Footer — price left, cta right */
.epc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding-top: .5rem;
    margin-top: .1rem;
}

.epc-price {
    font-size: .8125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .25rem;
}

.epc-price.free {
    color: var(--primary, #046fad);
}

.epc-price.paid {
    color: var(--primary, #046fad);
}

.epc-cta {
    font-size: .75rem;
    font-weight: 600;
    color: var(--primary, #046fad);
    display: flex;
    align-items: center;
    gap: .15rem;
}

/* ─────────────────────────────────────────────────────────────────
   Housing Post Card  (.hpc-*)
───────────────────────────────────────────────────────────────── */
.hpc-wrap {
    display: block;
    text-decoration: none;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
    overflow: hidden;
    margin-top: .5rem;
    transition: box-shadow .2s, transform .2s;
    background: var(--bg-primary, #fff);
}

.hpc-wrap:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, .1);
    transform: translateY(-1px);
}

.hpc-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-secondary, #f5f5f5);
}

.hpc-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hpc-cover-icon {
    position: absolute;
    inset: 0;
    margin: auto;
    font-size: 2.5rem;
    color: rgba(4, 111, 173, .25);
    pointer-events: none;
}

.hpc-cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0, 0, 0, .35));
    pointer-events: none;
}

.hpc-type-badge {
    position: absolute;
    bottom: .5rem;
    left: .5rem;
    background: var(--primary, #046fad);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.hpc-status-badge {
    position: absolute;
    top: .5rem;
    right: .5rem;
    font-size: .65rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 4px;
    color: #fff;
}

.hpc-status-badge.available { background: #16a34a; }
.hpc-status-badge.unavailable { background: #dc2626; }

.hpc-body { padding: .75rem .875rem .875rem; }

.hpc-title {
    font-size: .9375rem;
    font-weight: 700;
    margin: 0 0 .35rem;
    color: var(--text-primary, #111);
    line-height: 1.35;
}

.hpc-meta-row {
    display: flex;
    align-items: flex-start;
    gap: .35rem;
    font-size: .75rem;
    color: var(--text-secondary, #666);
    margin-bottom: .5rem;
}

.hpc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.hpc-price {
    font-size: .8125rem;
    font-weight: 700;
    color: var(--primary, #046fad);
}

.hpc-cta {
    font-size: .75rem;
    font-weight: 600;
    color: var(--primary, #046fad);
    display: flex;
    align-items: center;
    gap: .15rem;
}