/* ---- Feed main: full-width content in main column, single scroll ---- */
.main.feed-page {
    padding: 0;
    padding-bottom: 72px;
    max-width: 100%;
    background: var(--background);
}

.feed-header {
    position: static;
    top: auto;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(90, 138, 255, 0.22), transparent 55%),
        radial-gradient(120% 120% at 100% 0%, rgba(31, 111, 95, 0.3), transparent 60%),
        rgba(17, 27, 33, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    color: #ffffff;
}

.feed-brand {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: #ffffff;
}

/* ---- Feed tabs: My Feed | News | Events | Alerts ---- */
.feed-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    justify-content: flex-end;
}

.feed-header .notification-bell-mobile {
    margin-left: 10px;
    flex-shrink: 0;
}

.feed-tab {
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--motion-fast), color var(--motion-fast);
    white-space: nowrap;
}

.feed-tab:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.feed-tab.active {
    background: linear-gradient(135deg, rgba(67, 140, 255, 0.5), rgba(31, 111, 95, 0.65));
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.feed-panel {
    display: block;
}

.feed-panel.hidden {
    display: none !important;
}

.feed-sort-wrap {
    padding: 8px 14px 4px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
}

.feed-sort {
    display: flex;
    gap: 4px;
}

.feed-sort-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--motion-fast), color var(--motion-fast);
}

.feed-sort-btn:hover {
    background: var(--hover);
    color: #ffffff;
}

.feed-sort-btn.active {
    background: rgba(31, 111, 95, 0.35);
    color: #ffffff;
}

/* ---- Continuous list: rows in a stream, minimal weight ---- */
.post {
    max-width: 640px;
    margin: 0 auto;
    padding: 8px 12px 10px;
    background: var(--surface);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0;
    box-shadow: none;
    transition: background var(--motion-fast);
}

.post:hover {
    background: rgba(0, 0, 0, 0.02);
}

.post-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.post-head .avatar {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.post-head .post-head-avatar-img {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.post-head .avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.post-head-text {
    flex: 1;
    min-width: 0;
}

.post-author-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.post-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.85;
}

.post-sending-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-left: auto;
    opacity: 0.9;
}

/* Text is the star: left-aligned, good line height, clipped in feed */
.post-content {
    font-size: 0.94rem;
    line-height: 1.5;
    margin-bottom: 6px;
    white-space: pre-wrap;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
    color: var(--text);
}

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

/* Images compact: support the post, don't dominate */
.post-media-wrap {
    margin: 4px 0 6px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.04);
    max-height: 140px;
}

.post-media-wrap img {
    max-width: 100%;
    max-height: 140px;
    width: auto;
    height: auto;
    object-fit: cover;
    display: block;
}

.post-media-wrap a {
    display: block;
    padding: 6px 8px;
    color: var(--primary-dark);
    font-size: 0.8rem;
}

/* ---- Vote strip: voting primary, count tied to arrows; comment as info; actions in menu ---- */
.post-vote-strip {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 6px;
}

.post-vote-group {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.post-vote-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--motion-fast), color var(--motion-fast);
}

.post-vote-btn:hover {
    background: var(--hover);
    color: var(--text);
}

.post-vote-btn.up.active { color: var(--primary-dark); }
.post-vote-btn.down.active { color: var(--danger); }

.post-vote-score {
    min-width: 22px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}

.post-vote-score.positive { color: var(--primary-dark); }
.post-vote-score.negative { color: var(--danger); }

/* Comment count: click to view/add comments */
.post-comment-count {
    margin-left: 10px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    opacity: 0.9;
    cursor: pointer;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 4px;
}

.post-comment-count:hover {
    color: var(--text);
    background: var(--hover);
}

.post-more-wrap {
    position: relative;
    margin-left: auto;
}

.post-more-menu {
    padding: 2px 6px;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    border-radius: 4px;
    opacity: 0.8;
}

.post-more-menu:hover {
    background: var(--hover);
    opacity: 1;
}

.post-more-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 2px;
    min-width: 120px;
    padding: 4px 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 30;
}

.post-more-dropdown.hidden {
    display: none !important;
}

.post-more-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    font-size: 0.85rem;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.post-more-item:hover {
    background: var(--hover);
}

.post-more-item.post-more-delete {
    color: var(--danger);
}

/* ---- Comments (expand below post) ---- */
.post-comments-wrap {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.post-comments-list {
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.88rem;
}

.post-comment {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.post-comment:last-child {
    border-bottom: none;
}

.post-comment-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.post-comment-body .muted {
    font-size: 0.78rem;
}

.post-comment-delete {
    margin-left: auto;
    padding: 2px 6px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 4px;
}

.post-comment-delete:hover {
    color: var(--danger);
    background: rgba(220, 53, 69, 0.1);
}

.post-comment .muted {
    margin-left: 6px;
    font-size: 0.78rem;
}

.post-comment-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.post-comment-form .post-comment-input {
    flex: 1 1 100%;
    min-height: 56px;
    resize: vertical;
    font-size: 0.88rem;
}

.post-comment-anon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.post-comment-anon input {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

/* ---- Compose modal (FAB) ---- */
.feed-compose-modal {
    position: fixed;
    inset: 0;
    z-index: 140;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
}

.feed-compose-modal:not(.hidden) {
    pointer-events: auto;
}

.feed-compose-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(67, 140, 255, 0.22), transparent 55%),
        radial-gradient(120% 120% at 100% 100%, rgba(31, 111, 95, 0.22), transparent 60%),
        rgba(8, 13, 17, 0.58);
    backdrop-filter: blur(4px);
}

.feed-compose-panel {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: min(90vh, 840px);
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 24px 50px rgba(12, 20, 27, 0.28);
    overflow: auto;
    animation: compose-in var(--motion-base) var(--ease-out);
}

@keyframes compose-in {
    from { transform: translateY(26px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.feed-compose-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(67, 140, 255, 0.08), rgba(67, 140, 255, 0));
}

.feed-compose-header h2 {
    font-size: 1.08rem;
    font-weight: 700;
}

.feed-compose-close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
}

.feed-compose-close:hover {
    background: var(--hover);
    color: var(--text);
}

.feed-compose-form {
    display: grid;
    gap: 14px;
    padding: 16px 18px 18px;
}

.feed-compose-field {
    display: grid;
    gap: 8px;
}

.feed-compose-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.feed-compose-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 140px;
    max-height: 360px;
    padding: 13px 14px;
    border: 1px solid rgba(26, 88, 76, 0.25);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.54));
    font-size: 0.96rem;
    line-height: 1.45;
}

.feed-compose-form textarea:focus {
    outline: none;
    border-color: rgba(31, 111, 95, 0.55);
    box-shadow: 0 0 0 3px rgba(31, 111, 95, 0.14);
}

.feed-compose-helper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 18px;
}

.feed-compose-count {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.feed-media-input {
    border: 1px dashed rgba(26, 88, 76, 0.38);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(31, 111, 95, 0.06), rgba(31, 111, 95, 0.02));
    padding: 10px 12px;
    font-size: 0.85rem;
}

.feed-media-input::file-selector-button {
    margin-right: 10px;
    padding: 7px 11px;
    border: 1px solid rgba(26, 88, 76, 0.25);
    border-radius: 9px;
    background: #ffffff;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.feed-media-meta {
    margin: 0;
    min-height: 18px;
    font-size: 0.8rem;
}

.feed-compose-actions {
    margin-top: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.feed-compose-actions .input,
.feed-compose-actions .btn {
    height: 38px;
    border-radius: 10px;
}

.feed-compose-anon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-alt);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.feed-compose-anon input {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

.feed-compose-actions .visibility-select,
.feed-compose-actions .group-select-input,
.feed-compose-actions .group-uuid-input {
    min-width: 136px;
}

.feed-compose-actions .group-uuid-input {
    flex: 1;
    min-width: 200px;
}

.feed-compose-actions .btn-primary {
    margin-left: auto;
    min-width: 102px;
}

.group-uuid-input.visible,
.group-select-input.visible {
    display: inline-block;
}

.group-uuid-input:not(.visible),
.group-select-input:not(.visible) {
    display: none;
}

@media (max-width: 760px) {
    .feed-compose-modal {
        align-items: flex-end;
        padding: 0;
    }

    .feed-compose-panel {
        max-width: none;
        border-radius: 16px 16px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    .feed-compose-actions .btn-primary {
        width: 100%;
        margin-left: 0;
    }
}

.feed-fab {
    position: fixed;
    bottom: calc(72px + 12px);
    right: 16px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: var(--white);
    font-size: 0;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(31, 111, 95, 0.25);
    z-index: 50;
    transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}

.feed-fab .ui-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.feed-fab:hover {
    transform: scale(1.04);
    box-shadow: 0 3px 12px rgba(31, 111, 95, 0.3);
}

.feed-fab.hidden {
    display: none !important;
}

/* Desktop only: main column has sidebar; reduce bottom padding, position FAB */
@media (min-width: 1025px) {
    .main.feed-page {
        padding-bottom: 24px;
    }

    .feed-fab {
        bottom: 24px;
        right: 24px;
    }
}

/* ---- What's happening near you (Local Pulse) ---- */
.local-pulse-section {
    background:
        linear-gradient(180deg, rgba(67, 140, 255, 0.06) 0%, rgba(67, 140, 255, 0) 40%),
        var(--surface);
    border: 1px solid var(--border);
    padding: 16px;
    max-width: 980px;
    margin: 12px auto 0;
    border-radius: 14px;
    box-shadow: 0 12px 24px rgba(17, 27, 33, 0.06);
}

.local-pulse-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.local-pulse-near {
    font-size: 0.85rem;
    margin: 0;
}

.local-pulse-approximate {
    font-size: 0.7rem;
    opacity: 0.85;
    margin-left: 4px;
}

.local-pulse-heading {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}

.local-pulse-intro {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.local-pulse-location {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.local-pulse-btn {
    flex-shrink: 0;
}

.local-pulse-input {
    width: 260px;
    min-width: 120px;
    flex-grow: 1;
    padding: 6px 10px;
    font-size: 0.88rem;
}

.local-pulse-chips {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.local-pulse-chip {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast);
}

.local-pulse-chip:hover {
    background: var(--hover);
    color: var(--text);
}

.local-pulse-chip.active {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.local-pulse-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.local-pulse-card {
    display: block;
    padding: 12px 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2)), var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: background var(--motion-fast), border-color var(--motion-fast);
}

.local-pulse-card:hover {
    background: var(--hover);
    border-color: var(--primary);
}

.local-pulse-card-image-wrap {
    width: 100%;
    margin: -10px -12px 10px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.04);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.local-pulse-card-image {
    width: 100%;
    height: auto;
    min-height: 120px;
    max-height: 200px;
    object-fit: cover;
    display: block;
    vertical-align: top;
}

.local-pulse-card-image-wrap.local-pulse-card-image-failed {
    display: none;
}

.local-pulse-card-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary-dark);
    background: var(--primary-soft);
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.local-pulse-card-title {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.local-pulse-card-snippet {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.local-pulse-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px;
}

.local-pulse-card-source {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.local-pulse-card-source-link {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.local-pulse-card-source-link:hover {
    text-decoration: underline;
}

.local-pulse-card-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.local-pulse-card-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--primary);
    margin-top: 8px;
}

.local-pulse-see-all {
    margin-top: 12px;
    text-align: center;
}

.local-pulse-see-all.hidden {
    display: none;
}

.local-pulse-stream {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 12px 8px;
}

.local-pulse-stream .local-pulse-card {
    margin-bottom: 8px;
}

@media (min-width: 900px) {
    .local-pulse-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* News cards: auto-fit viewport, no horizontal overflow */
.local-pulse-section {
    width: 100%;
    max-width: min(980px, 100vw);
    box-sizing: border-box;
}

.local-pulse-cards {
    width: 100%;
    min-width: 0;
}

.local-pulse-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.local-pulse-card-title,
.local-pulse-card-snippet {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.local-pulse-card-image-wrap {
    max-width: 100%;
}

.local-pulse-card-image {
    max-width: 100%;
    width: 100%;
    object-fit: cover;
}

.merged-feed-inner {
    min-height: 1px;
}

/* ---- Article modal (iframe + fallback) ---- */
.article-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.article-modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

body.article-modal-open {
    overflow: hidden;
}

.article-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.article-modal-panel {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    max-height: 90dvh;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

@media (max-width: 640px) {
    .article-modal {
        padding: 0;
        align-items: stretch;
    }
    .article-modal-panel {
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }
    .article-modal-reader {
        padding-left: calc(16px + env(safe-area-inset-left, 0));
        padding-right: calc(16px + env(safe-area-inset-right, 0));
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
    }
    .article-modal-header {
        align-items: flex-start;
    }
    .article-modal-header-actions {
        gap: 6px;
    }
    .article-modal-nav-btn {
        min-width: 54px;
    }
}

.article-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.article-modal-header-main {
    min-width: 0;
    flex: 1;
}

.article-modal-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.article-modal-meta {
    margin: 4px 0 0;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-modal-title {
    font-family: "Georgia", "Times New Roman", Times, serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    min-width: 0;
    white-space: normal;
    overflow-wrap: break-word;
}

.article-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: 8px;
}

.article-modal-close:hover {
    background: var(--hover);
    color: var(--text);
}

.article-modal-nav-btn {
    min-width: 58px;
}

.article-modal-nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.article-modal-progress-wrap {
    height: 3px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.article-modal-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #1f6f5f, #438cff);
    transition: width 0.12s linear;
}

.article-modal-body {
    flex: 1;
    min-height: 300px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.article-modal-loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.article-modal-loading.hidden {
    display: none !important;
}

.article-modal-reader {
    flex: 1;
    overflow: auto;
    padding: 0 20px 24px;
    min-height: 200px;
    -webkit-overflow-scrolling: touch;
}

.article-modal-reader.hidden {
    display: none !important;
}

/* News-style article typography */
.article-modal-reader-content {
    font-family: "Georgia", "Times New Roman", Times, serif;
    font-size: 1.1rem;
    line-height: 1.75;
    color: var(--text);
    max-width: 42em;
    margin: 0 auto;
}

.article-modal-reader-content p {
    margin: 0 0 1.25em;
    text-align: left;
}

.article-modal-reader-content p:last-child {
    margin-bottom: 0;
}

.article-reader-stay-msg {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 1em 0;
}

/* Lead image (hero) */
.article-lead-figure {
    margin: 0 -20px 1.5em;
    max-width: none;
}

.article-lead-img {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: cover;
    display: block;
    background: rgba(0, 0, 0, 0.06);
}

/* In-article images */
.article-figure {
    margin: 1.5em 0;
}

.article-img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.04);
}

.article-figcaption {
    font-family: var(--font-sans, system-ui, sans-serif);
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5em;
    padding: 0 4px;
}

.article-figcaption:empty {
    display: none;
}

.article-modal-open-external-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 20px 0 8px;
}

.article-modal-open-external {
    margin-top: 0;
    flex-shrink: 0;
}

.article-modal-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: var(--surface);
}

.article-modal-fallback.hidden {
    display: none;
}

.article-modal-fallback-msg {
    margin: 0;
    color: var(--text-secondary);
}

/* ---- Feed list: single scroll ---- */
.feed-list {
    position: relative;
    min-height: 60vh;
}

.posts-inner {
    min-height: 1px;
}

.post[data-post-id] {
    cursor: pointer;
}

.feed-sentinel {
    height: 1px;
    width: 100%;
    pointer-events: none;
    visibility: hidden;
}

.feed-load-more {
    text-align: center;
    padding: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.feed-load-more.hidden {
    display: none;
}

.new-posts-banner {
    position: fixed;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    padding: 8px 16px;
    background: var(--primary);
    color: var(--white);
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.new-posts-banner:hover {
    opacity: 0.95;
    transform: translateX(-50%) scale(1.02);
}

.new-posts-banner.hidden {
    display: none;
}

/* ---- Skeleton (first load) ---- */
.feed-skeleton {
    max-width: 640px;
    margin: 0 auto;
}

.feed-skeleton.hidden {
    display: none;
}

.post-skeleton {
    padding: 8px 12px 10px;
    margin-bottom: 0;
    background: var(--surface);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0;
}

.post-skeleton-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.post-skeleton-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-alt);
}

.post-skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.post-skeleton-line {
    height: 8px;
    border-radius: 3px;
    background: var(--surface-alt);
}

.post-skeleton-line.name {
    width: 40%;
}

.post-skeleton-line.meta {
    width: 25%;
}

.post-skeleton-line.content {
    width: 100%;
}

.post-skeleton-line.content.short {
    width: 70%;
}

.hidden {
    display: none !important;
}

.post-more {
    color: var(--text-secondary);
    font-size: 0.88em;
}

.feed-empty {
    padding: 32px 16px;
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
}

/* ---- Group feed view (Yik Yak: inside groups page) ---- */
.main:has(.group-feed-view:not(.hidden)) {
    padding: 0;
    padding-bottom: 72px;
}

.group-feed-view .feed-list {
    min-height: 60vh;
}

.group-feed-header .feed-back-btn {
    margin-right: 8px;
    padding: 6px 10px;
    border: none;
    background: none;
    font-size: 1.2rem;
    color: var(--text);
    cursor: pointer;
    border-radius: 6px;
}

.group-feed-header .feed-back-btn:hover {
    background: var(--hover);
}

.post-vote-btn .ui-icon,
.post-more-menu .ui-icon,
.group-more-btn .ui-icon,
.event-rsvp-btn .ui-icon {
    width: 0.95rem;
    height: 0.95rem;
}

/* Groups list: row clickable -> feed; more menu for actions */
.groups-main .groups-list-view {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 14px 22px;
}

.groups-main .topbar {
    position: static;
    top: auto;
    z-index: 15;
    margin: 0 -14px 12px;
    padding: 12px 14px;
    background: linear-gradient(180deg, rgba(17, 27, 33, 0.97), rgba(17, 27, 33, 0.92));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.groups-main .section-title {
    margin: 16px 4px 10px;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.groups-main .channel-create-card {
    margin-bottom: 10px;
    border-radius: 14px;
    box-shadow: 0 10px 22px rgba(16, 24, 30, 0.08);
}

.groups-main .group-form-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.groups-main .group-form-row .input {
    border-radius: 12px;
}

.groups-main .group-form-row .btn {
    min-width: 92px;
    border-radius: 12px;
}

.groups-main .group-list {
    gap: 8px;
}

.group-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 14px !important;
    padding: 12px 12px !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none !important;
    transform: none !important;
}

.group-row-click {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    border-radius: 10px;
    padding: 2px;
}

.group-row-actions {
    flex-shrink: 0;
}

.groups-main .group-item .avatar {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(0, 168, 132, 0.2), rgba(0, 168, 132, 0.04));
    color: #0a473b;
    font-weight: 700;
}

.group-main-copy {
    min-width: 0;
}

.group-row-title {
    font-size: 0.98rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-row-sub {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.groups-main .group-more-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 10px;
    padding: 0;
    font-size: 1rem;
}

.groups-main .group-join-btn {
    min-width: 84px;
    border-radius: 10px;
}

.group-empty {
    list-style: none;
    padding: 12px;
}

.group-action-sheet {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.group-action-sheet.hidden {
    display: none !important;
}

.group-action-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
}

.group-action-sheet-panel {
    position: relative;
    width: min(520px, 100%);
    max-height: 82vh;
    overflow: auto;
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 12px;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.2);
}

.group-action-sheet-title {
    font-weight: 700;
    margin: 4px 4px 10px;
}

.group-action-sheet-actions {
    display: grid;
    gap: 8px;
}

.group-action-sheet-btn,
.group-action-sheet-cancel {
    width: 100%;
    justify-content: flex-start;
    border-radius: 10px;
}

.group-action-sheet-cancel {
    margin-top: 10px;
}

@media (max-width: 1024px) {
    .groups-main .groups-list-view {
        padding: 0 0 18px;
    }

    .groups-main .topbar {
        margin: 0 0 12px;
    }
}

/* ---- Professional feed: collapsible highlights (connection + endorsement) ---- */
.feed-highlights-card {
    margin-bottom: 12px;
    padding: 0;
    overflow: hidden;
}

.feed-highlights-summary {
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    list-style: none;
}

.feed-highlights-summary::-webkit-details-marker {
    display: none;
}

.feed-highlights-summary::before {
    content: "> ";
    margin-right: 4px;
    opacity: 0.7;
}

.feed-highlights-card[open] .feed-highlights-summary::before {
    content: "v ";
}

.feed-highlights-list {
    list-style: none;
    padding: 0 14px 12px;
    margin: 0;
    border-top: 1px solid var(--border);
}

.feed-highlight-item {
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.feed-highlight-item .feed-highlight-text {
    color: var(--text);
}

.feed-job-card,
.feed-event-card {
    margin-bottom: 12px;
}

/* Professional feed filter row (All | Jobs | Events | Posts | Network) */
.pro-feed-filter-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--background);
}

.pro-feed-filter-btn {
    font-weight: 600;
}

.pro-feed-filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.feed-sort-wrap-pro {
    margin-bottom: 0;
}
/* ---- Feed polish: professional visual refresh (no feature changes) ---- */
.main.feed-page {
    background:
        radial-gradient(120% 120% at 0% -20%, rgba(67, 140, 255, 0.08), transparent 52%),
        radial-gradient(120% 120% at 100% -35%, rgba(31, 111, 95, 0.12), transparent 54%),
        var(--background);
    padding-bottom: 92px;
}

.feed-header {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
}

.feed-brand {
    font-family: "Manrope", "Trebuchet MS", sans-serif;
    font-size: 1.06rem;
    letter-spacing: 0.01em;
}

.feed-tabs {
    gap: 8px;
    justify-content: flex-end;
}

.feed-tab {
    border-radius: 10px;
    border-color: rgba(255, 255, 255, 0.2);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.feed-tab.active {
    background: linear-gradient(135deg, rgba(0, 168, 132, 0.5), rgba(0, 168, 132, 0.3));
    border-color: rgba(0, 168, 132, 0.5);
}

.feed-sort-wrap,
.pro-feed-filter-wrap {
    position: static;
    top: auto;
    z-index: 16;
    padding: 10px 18px 8px;
    background: rgba(11, 20, 26, 0.9);
    backdrop-filter: blur(8px);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.feed-sort {
    gap: 8px;
}

.feed-sort-btn,
.pro-feed-filter-btn {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 7px 13px;
    background: rgba(32, 44, 51, 0.6);
    color: rgba(233, 237, 239, 0.9);
    font-weight: 700;
    font-size: 0.78rem;
}

.feed-sort-btn.active,
.pro-feed-filter-btn.active {
    background: rgba(0, 168, 132, 0.22);
    border-color: rgba(0, 168, 132, 0.55);
    color: #d7fff5;
}

.feed-list,
.feed-skeleton,
.local-pulse-section {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.feed-list {
    padding: 14px 14px 20px;
}

.posts-inner {
    display: grid;
    gap: 12px;
}

.post {
    max-width: none;
    margin: 0;
    padding: 14px 15px 12px;
    background: linear-gradient(180deg, rgba(32, 44, 51, 0.96), rgba(20, 30, 36, 0.97));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(5, 12, 16, 0.22);
}

.post:hover {
    background: linear-gradient(180deg, rgba(36, 49, 57, 0.96), rgba(24, 35, 42, 0.97));
    border-color: rgba(0, 168, 132, 0.25);
}

.post-head {
    gap: 10px;
    margin-bottom: 7px;
}

.post-head .avatar,
.post-head .post-head-avatar-img {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
}

.post-author-name {
    font-size: 0.92rem;
    letter-spacing: 0.01em;
}

.post-meta,
.post-sending-label {
    font-size: 0.74rem;
}

.post-content {
    font-size: 0.95rem;
    line-height: 1.52;
    margin-bottom: 8px;
}

.post-media-wrap {
    margin: 6px 0 9px;
    border-radius: 10px;
    max-height: 220px;
    background: rgba(8, 14, 18, 0.45);
}

.post-media-wrap img {
    max-height: 220px;
    width: 100%;
    object-fit: cover;
}

.post-vote-strip {
    margin-top: 8px;
}

.post-vote-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.post-vote-score {
    min-width: 24px;
    font-size: 0.9rem;
}

.post-comment-count,
.post-more-menu {
    border-radius: 8px;
}

.post-comments-wrap {
    margin-top: 12px;
    padding-top: 12px;
    border-top-color: rgba(255, 255, 255, 0.1);
}

.post-comment {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.post-comment-form .post-comment-input {
    min-height: 64px;
}

.feed-compose-backdrop {
    background: rgba(5, 10, 13, 0.7);
}

.feed-compose-panel {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 60px rgba(2, 8, 12, 0.45);
    background: linear-gradient(180deg, rgba(17, 27, 33, 0.98), rgba(11, 20, 26, 0.99));
}

.feed-compose-header {
    padding: 14px 16px;
    background: rgba(0, 168, 132, 0.08);
}

.feed-compose-form {
    padding: 14px 16px 16px;
}

.feed-compose-form textarea {
    min-height: 150px;
    background: rgba(32, 44, 51, 0.85);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--text);
}

.feed-media-input {
    border-color: rgba(0, 168, 132, 0.35);
    background: rgba(32, 44, 51, 0.7);
}

.feed-compose-anon {
    background: rgba(32, 44, 51, 0.8);
    border-color: rgba(255, 255, 255, 0.14);
}

.feed-compose-actions {
    border-top-color: rgba(255, 255, 255, 0.12);
}

.feed-fab {
    width: 56px;
    height: 56px;
    border: 1px solid rgba(0, 168, 132, 0.55);
    background: linear-gradient(180deg, #00a884, #058e70);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
}

.feed-fab:hover {
    transform: translateY(-1px) scale(1.03);
}

.local-pulse-section {
    margin-top: 14px;
    padding: 14px;
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(32, 44, 51, 0.95), rgba(16, 26, 31, 0.96));
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}

.local-pulse-card {
    background: rgba(24, 37, 44, 0.92);
    border-color: rgba(255, 255, 255, 0.11);
    border-radius: 12px;
}

.local-pulse-card:hover {
    border-color: rgba(0, 168, 132, 0.45);
    background: rgba(30, 44, 52, 0.96);
}

.local-pulse-card-title {
    font-size: 1rem;
}

.article-modal-panel {
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: linear-gradient(180deg, rgba(17, 27, 33, 0.98), rgba(11, 20, 26, 0.98));
}

.article-modal-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.article-modal-reader-content {
    font-size: 1.02rem;
    line-height: 1.72;
}

.feed-skeleton {
    max-width: 820px;
    padding: 14px 14px 20px;
}

.post-skeleton {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    background: rgba(24, 36, 43, 0.95);
    margin-bottom: 12px;
}

.new-posts-banner {
    top: 70px;
    background: #00a884;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

@media (max-width: 1024px) {
    .feed-header {
        padding: calc(10px + env(safe-area-inset-top, 0)) 12px 10px;
    }

    .feed-sort-wrap,
    .pro-feed-filter-wrap {
        top: 58px;
        padding: 8px 12px 6px;
    }

    .feed-list,
    .feed-skeleton {
        padding: 10px 10px 14px;
    }

    .posts-inner {
        gap: 10px;
    }

    .post {
        padding: 12px;
        border-radius: 12px;
    }

    .local-pulse-section {
        margin-top: 10px;
        padding: 10px;
        border-radius: 12px;
    }

    .feed-fab {
        width: 52px;
        height: 52px;
    }

    .new-posts-banner {
        top: 62px;
    }
}
