/*
 * MeetBack feed presentation
 *
 * This layer keeps the existing feed DOM and JavaScript contracts intact while
 * applying the shared MeetBack design tokens to cards, menus, the detail modal,
 * editing controls, comments, pagination, and responsive layouts.
 */

.page-feed-list {
    --feed-primary-tint: color-mix(in srgb, var(--mb-primary) 9.4%, transparent);
    --feed-primary-soft: color-mix(in srgb, var(--mb-primary) 18%, transparent);
    --feed-accent-tint: color-mix(in srgb, var(--mb-accent) 9.4%, transparent);
    --feed-border-active: color-mix(in srgb, var(--mb-primary) 34%, var(--mb-border));

    min-width: 320px;
    color: var(--mb-foreground);
    background: var(--mb-background);
    font-family: var(--mb-font);
}

.page-feed-list .feed-page {
    width: 100%;
    max-width: var(--mb-content-width);
    margin: 0 auto;
    padding: 100px 24px 96px;
}

.page-feed-list .feed-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.page-feed-list .feed-page-header h1 {
    margin: 0;
    color: var(--mb-foreground);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.03em;
}

.page-feed-list .feed-navigation {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-feed-list .feed-navigation a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid var(--mb-border);
    border-radius: var(--mb-radius);
    color: var(--mb-primary);
    background: var(--feed-primary-tint);
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.page-feed-list .feed-navigation a:first-child {
    border-color: transparent;
    color: var(--mb-accent-foreground);
    background: var(--mb-accent);
}

.page-feed-list .feed-navigation a:hover {
    border-color: var(--feed-border-active);
    color: var(--mb-primary);
    background: var(--mb-secondary);
    transform: translateY(-1px);
}

.page-feed-list .feed-navigation a:first-child:hover {
    border-color: transparent;
    color: var(--mb-accent-foreground);
    background: var(--mb-accent);
    filter: brightness(0.96);
}

.page-feed-list .feed-message {
    min-height: 42px;
    margin: 0 0 24px;
    padding: 11px 14px;
    border: 1px solid var(--mb-border);
    border-radius: 12px;
    color: var(--mb-muted-foreground);
    background: var(--mb-muted);
    font-size: 0.875rem;
    line-height: 1.45;
}

.page-feed-list .feed-message:empty {
    display: none;
}

/* Feed card grid */

.page-feed-list #feedContainer {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: stretch;
    gap: 16px;
}

.page-feed-list .feed-summary-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--mb-border);
    border-radius: var(--mb-radius-card);
    color: var(--mb-foreground);
    background: var(--mb-card);
    box-shadow: var(--mb-shadow-card);
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.page-feed-list .feed-summary-card:hover {
    border-color: var(--feed-border-active);
    box-shadow: var(--mb-shadow-card);
    transform: translateY(-2px);
}

.page-feed-list .feed-summary-image-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--mb-muted);
}

.page-feed-list .feed-summary-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 220ms ease;
}

.page-feed-list .feed-summary-card:hover .feed-summary-image {
    transform: scale(1.015);
}

.page-feed-list .feed-summary-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--mb-muted-foreground);
    background: var(--mb-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.page-feed-list .feed-summary-image-count,
.page-feed-list .feed-image-count {
    min-width: 32px;
    padding: 5px 9px;
    border: 0;
    border-radius: 999px;
    color: #FFFFFF;
    background: rgba(15, 15, 28, 0.72);
    font-family: var(--mb-font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.page-feed-list .feed-summary-image-count {
    top: 12px;
    right: 12px;
}

.page-feed-list .feed-summary-body {
    padding: 20px;
}

.page-feed-list .feed-summary-title {
    display: -webkit-box;
    margin: 0 0 8px;
    overflow: hidden;
    color: var(--mb-foreground);
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.015em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.page-feed-list .feed-summary-content {
    display: -webkit-box;
    min-height: 42px;
    margin: 0 0 16px;
    overflow: hidden;
    color: var(--mb-muted-foreground);
    font-size: 0.8125rem;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.page-feed-list .feed-summary-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--mb-border);
}

.page-feed-list .feed-summary-profile,
.page-feed-list .profile-initial {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--mb-primary);
    background: var(--feed-primary-soft);
    font-weight: 700;
}

.page-feed-list .feed-summary-profile {
    width: 36px;
    height: 36px;
    font-size: 0.8125rem;
}

.page-feed-list .feed-summary-nickname {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    color: var(--mb-foreground);
    font-size: 0.75rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-feed-list .feed-summary-like {
    flex: 0 0 auto;
    color: var(--mb-accent);
    font-family: var(--mb-font-mono);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Card and detail menus */

.page-feed-list .feed-summary-menu-area {
    top: 10px;
    left: 10px;
    z-index: 20;
}

body.page-feed-list .feed-summary-menu-button,
body.page-feed-list .feed-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mb-border);
    color: var(--mb-foreground);
    background: color-mix(in srgb, var(--mb-card) 90%, transparent);
    box-shadow: var(--mb-shadow-card);
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.page-feed-list .feed-summary-menu-button {
    width: 34px;
    height: 34px;
    padding: 0 0 8px;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
}

.page-feed-list .feed-menu-area {
    position: relative;
    margin-left: auto;
}

.page-feed-list .feed-menu-button {
    width: 36px;
    height: 36px;
    padding: 0 0 9px;
    border-radius: 10px;
    font-size: 1.375rem;
    line-height: 1;
}

body.page-feed-list .feed-summary-menu-button:hover,
body.page-feed-list .feed-menu-button:hover {
    color: var(--mb-primary);
    background: var(--mb-secondary);
}

.page-feed-list .feed-menu-popup {
    top: calc(100% + 8px);
    right: 0;
    min-width: 140px;
    overflow: hidden;
    border: 1px solid var(--mb-border);
    border-radius: 12px;
    color: var(--mb-foreground);
    background: var(--mb-card);
    box-shadow: var(--mb-shadow-dialog);
    z-index: 5000;
}

.page-feed-list .feed-summary-menu-area .feed-menu-popup {
    right: auto;
    left: 0;
}

.page-feed-list .feed-menu-popup button {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 10px 14px;
    border: 0;
    border-radius: 0;
    color: var(--mb-foreground);
    background: var(--mb-card);
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.page-feed-list .feed-menu-popup button + button {
    border-top: 1px solid var(--mb-border);
    color: var(--mb-danger);
}

.page-feed-list .feed-menu-popup button:hover {
    background: var(--mb-muted);
}

/* Detail modal */

.page-feed-list .feed-detail-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.50);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 3000;
}

.page-feed-list .feed-detail-modal.open {
    display: flex;
}

.page-feed-list .feed-detail-dialog {
    position: relative;
    width: min(100%, 760px);
    max-width: 760px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    border: 1px solid var(--mb-border);
    border-radius: var(--mb-radius-dialog);
    color: var(--mb-foreground);
    background: var(--mb-card);
    box-shadow: var(--mb-shadow-dialog);
    overscroll-behavior: contain;
}

body.page-feed-list .feed-detail-close {
    position: static;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    margin: 0 0 0 8px;
    padding: 0 0 2px;
    border: 1px solid var(--mb-border);
    border-radius: 10px;
    color: var(--mb-foreground);
    background: color-mix(in srgb, var(--mb-card) 90%, transparent);
    box-shadow: var(--mb-shadow-card);
    font-size: 1.25rem;
    line-height: 1;
    overflow-wrap: normal;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.page-feed-list .feed-detail-close:hover {
    color: var(--mb-primary);
    background: var(--mb-secondary);
}

.page-feed-list .feed-detail-card {
    overflow: hidden;
    color: var(--mb-foreground);
    background: var(--mb-card);
}

.page-feed-list .feed-header {
    display: flex;
    align-items: center;
    min-height: 68px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--mb-border);
}

.page-feed-list .profile-initial {
    width: 40px;
    height: 40px;
    margin-right: 10px;
    font-size: 0.875rem;
}

.page-feed-list .feed-nickname {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    color: var(--mb-foreground);
    font-size: 0.875rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-feed-list .feed-image-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: min(600px, 68vh);
    overflow: hidden;
    background: #0F0F1C;
}

.page-feed-list .feed-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.page-feed-list .feed-image-count {
    top: 12px;
    right: 12px;
    z-index: 5;
}

body.page-feed-list .feed-slide-button {
    position: absolute;
    top: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0 0 3px;
    border: 1px solid var(--mb-border);
    border-radius: 50%;
    color: var(--mb-foreground);
    background: color-mix(in srgb, var(--mb-card) 88%, transparent);
    box-shadow: var(--mb-shadow-card);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5;
}

body.page-feed-list .feed-slide-button:hover {
    color: var(--mb-primary);
    background: var(--mb-card);
}

.page-feed-list .feed-previous-button {
    left: 12px;
}

.page-feed-list .feed-next-button {
    right: 12px;
}

.page-feed-list .feed-indicator-container {
    display: flex;
    justify-content: center;
    gap: 6px;
    min-height: 25px;
    padding: 9px;
    background: var(--mb-card);
}

.page-feed-list .feed-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mb-switch);
}

.page-feed-list .feed-indicator.active {
    background: var(--mb-primary);
}

.page-feed-list .feed-like-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px 0;
}

body.page-feed-list .feed-like-button {
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border: 0;
    color: var(--mb-accent);
    background: transparent;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

body.page-feed-list .feed-like-button:hover {
    color: var(--mb-accent);
    background: var(--feed-accent-tint);
}

.page-feed-list .feed-like-count {
    color: var(--mb-foreground);
    font-family: var(--mb-font-mono);
    font-size: 0.75rem;
    font-weight: 500;
}

.page-feed-list .feed-body {
    padding: 16px 20px 20px;
}

.page-feed-list .feed-title {
    margin: 0 0 10px;
    color: var(--mb-foreground);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.02em;
    word-break: break-word;
}

.page-feed-list .feed-content {
    margin: 0 0 14px;
    color: var(--mb-foreground);
    font-size: 0.875rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.page-feed-list .feed-created-at {
    color: var(--mb-muted-foreground);
    font-family: var(--mb-font-mono);
    font-size: 0.6875rem;
}

/* Inline editing */

.page-feed-list .feed-edit-title,
.page-feed-list .feed-edit-content,
.page-feed-list .feed-comment-input,
.page-feed-list .feed-comment-edit-input {
    border: 1px solid var(--mb-border);
    border-radius: 12px;
    color: var(--mb-foreground);
    background: var(--mb-input);
}

.page-feed-list .feed-edit-title {
    width: 100%;
    margin-bottom: 10px;
    padding: 11px 13px;
    font-size: 0.875rem;
    font-weight: 600;
}

.page-feed-list .feed-edit-content {
    width: 100%;
    min-height: 150px;
    padding: 11px 13px;
    resize: vertical;
    font-size: 0.875rem;
    line-height: 1.6;
}

.page-feed-list .feed-edit-image-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--mb-border);
}

.page-feed-list .feed-edit-image-title {
    margin-bottom: 8px;
    color: var(--mb-foreground);
    font-size: 0.8125rem;
    font-weight: 700;
}

.page-feed-list .feed-edit-current-images,
.page-feed-list .feed-edit-new-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.page-feed-list .feed-edit-image-item,
.page-feed-list .feed-edit-current-image {
    width: 84px;
    height: 84px;
}

.page-feed-list .feed-edit-image-item {
    position: relative;
}

.page-feed-list .feed-edit-current-image {
    display: block;
    object-fit: cover;
    border: 1px solid var(--mb-border);
    border-radius: 12px;
    background: var(--mb-muted);
}

.page-feed-list .feed-edit-image-delete {
    position: absolute;
    top: -7px;
    right: -7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0 0 2px;
    border: 2px solid var(--mb-card);
    border-radius: 50%;
    color: var(--mb-danger-foreground);
    background: var(--mb-danger);
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
}

.page-feed-list .feed-edit-image-input {
    width: 100%;
    margin-top: 5px;
    color: var(--mb-muted-foreground);
    font-size: 0.75rem;
}

.page-feed-list .feed-edit-image-help {
    margin-top: 8px;
    color: var(--mb-muted-foreground);
    font-size: 0.6875rem;
    line-height: 1.55;
}

.page-feed-list .feed-edit-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.page-feed-list .feed-edit-buttons button,
body.page-feed-list .feed-comment-submit {
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: var(--mb-radius);
    color: var(--mb-primary-foreground);
    background: var(--mb-primary);
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
}

.page-feed-list .feed-edit-buttons button:last-child {
    border-color: var(--mb-border);
    color: var(--mb-muted-foreground);
    background: var(--mb-muted);
}

.page-feed-list .feed-edit-buttons button:hover,
body.page-feed-list .feed-comment-submit:hover {
    filter: brightness(0.96);
}

/* Comments */

.page-feed-list .feed-comment-area {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--mb-border);
    color: var(--mb-foreground);
    background: color-mix(in srgb, var(--mb-muted) 42%, var(--mb-card));
    font-size: 0.75rem;
}

.page-feed-list .feed-comment-count {
    margin-bottom: 10px;
    color: var(--mb-muted-foreground);
    font-weight: 700;
}

.page-feed-list .feed-comment-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 14px;
}

.page-feed-list .feed-comment-item {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 9px 10px;
    border: 1px solid var(--mb-border);
    border-radius: 10px;
    background: var(--mb-card);
    line-height: 1.5;
}

.page-feed-list .feed-comment-nickname {
    flex: 0 0 auto;
    color: var(--mb-primary);
    font-weight: 700;
}

.page-feed-list .feed-comment-content {
    min-width: 0;
    flex: 1;
    color: var(--mb-foreground);
    white-space: pre-wrap;
    word-break: break-word;
}

.page-feed-list .feed-comment-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.page-feed-list .feed-comment-actions button {
    min-height: 24px;
    padding: 2px 5px;
    border: 0;
    color: var(--mb-muted-foreground);
    background: transparent;
    font-size: 0.625rem;
    font-weight: 600;
    cursor: pointer;
}

.page-feed-list .feed-comment-actions button:hover {
    color: var(--mb-primary);
    background: var(--feed-primary-tint);
}

.page-feed-list .feed-comment-empty {
    padding: 12px;
    color: var(--mb-muted-foreground);
    text-align: center;
}

.page-feed-list .feed-comment-form {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.page-feed-list .feed-comment-input,
.page-feed-list .feed-comment-edit-input {
    min-width: 0;
    flex: 1;
    padding: 9px 11px;
    font-size: 0.75rem;
}

.page-feed-list .feed-comment-submit {
    flex: 0 0 auto;
    min-width: 64px;
}

/* Pagination */

.page-feed-list .feed-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 32px 0 0;
}

.page-feed-list .feed-pagination button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--mb-border);
    border-radius: 10px;
    color: var(--mb-muted-foreground);
    background: var(--mb-card);
    box-shadow: none;
    font-family: var(--mb-font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}

.page-feed-list .feed-pagination button:hover:not(:disabled),
.page-feed-list .feed-pagination button.active {
    border-color: var(--feed-border-active);
    color: var(--mb-primary);
    background: var(--feed-primary-tint);
}

.page-feed-list .feed-pagination button.active {
    font-weight: 700;
}

.page-feed-list .feed-pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

@media (max-width: 1023px) {
    .page-feed-list #feedContainer {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .page-feed-list .feed-page {
        padding: 80px 16px 96px;
    }

    .page-feed-list .feed-page-header {
        align-items: flex-start;
        gap: 14px;
    }

    .page-feed-list .feed-page-header h1 {
        padding-top: 5px;
        font-size: 1.125rem;
    }

    .page-feed-list .feed-navigation {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .page-feed-list .feed-navigation a {
        min-height: 36px;
        padding: 7px 11px;
        font-size: 0.75rem;
    }

    .page-feed-list #feedContainer {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .page-feed-list .feed-summary-body {
        padding: 16px;
    }

    .page-feed-list .feed-detail-modal {
        padding: 0;
    }

    .page-feed-list .feed-detail-dialog {
        width: 100%;
        max-width: none;
        height: 100dvh;
        max-height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .page-feed-list .feed-header {
        padding: 14px 16px;
    }

    .page-feed-list .feed-image-area {
        height: min(100vw, 430px);
    }

    .page-feed-list .feed-like-area,
    .page-feed-list .feed-body,
    .page-feed-list .feed-comment-area {
        padding-right: 16px;
        padding-left: 16px;
    }

    .page-feed-list .feed-comment-form {
        align-items: stretch;
    }

    .page-feed-list .feed-comment-submit {
        min-width: 58px;
        padding-right: 10px;
        padding-left: 10px;
    }
}

@media (hover: none) {
    .page-feed-list .feed-summary-card:hover,
    .page-feed-list .feed-navigation a:hover {
        transform: none;
    }

    .page-feed-list .feed-summary-card:hover .feed-summary-image {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-feed-list .feed-summary-card,
    .page-feed-list .feed-summary-image,
    .page-feed-list .feed-navigation a {
        transition: none;
    }
}

@media (max-width: 767px) {
    .mb-has-site-header.page-feed-list .feed-page {
        padding-top: 126px;
    }
}