/* Post Detail Page */
.post-detail {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.75rem 3rem 3rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Post Type Badge */
.post-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.post-type-normal {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.post-type-blog {
    background: rgba(30, 64, 175, 0.15);
    color: #3b82f6;
}

.post-type-work {
    background: rgba(190, 18, 60, 0.15);
    color: #f43f5e;
}

.post-type-collab {
    background: rgba(21, 128, 61, 0.15);
    color: #22c55e;
}

.post-type-notice {
    background: rgba(180, 83, 9, 0.15);
    color: #f59e0b;
}

/* Tags in Detail */
.post-tags-section {
    position: relative;
    margin-top: 1rem;
    text-align: left;
}

.post-tags-detail {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    max-width: 100%;
}

.post-tags-detail.is-collapsed {
    max-height: 103px;
    overflow: hidden;
}

.post-tags-detail.is-collapsed.has-overflow {
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 82%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 82%, transparent 100%);
}

.post-tags-detail.is-expanded {
    max-height: none;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
}

.post-tags-toggle {
    min-width: 44px;
    min-height: 28px;
    margin: 0.35rem 0 0;
    padding: 0.2rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.post-tags-toggle:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.post-tags-toggle[hidden] {
    display: none;
}

/* 
   Improved Action Bar (List / Edit / Delete)
*/
.post-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    /* border-top: 1px solid var(--border-light); Removed as per request */
    margin-top: 2rem;
}

.action-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
}

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

.action-link.edit {
    color: var(--primary-color, #007aff);
}

.action-link.delete {
    color: var(--error, #ef4444);
}

.action-link.delete:hover {
    background: #fef2f2;
}

.action-right {
    display: flex;
    gap: 8px;
}

/* Post Header */
.post-header {
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
}

.post-title {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.3;
    margin: 0.1rem 0;
    color: var(--text-primary);
}

.post-meta-detail {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-top: 1rem;
    min-width: 0;
}

.post-author-row,
.post-stats-row {
    width: 100%;
    min-width: 0;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: inherit;
    text-decoration: none;
}

.post-author img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex: 0 0 auto;
    object-fit: cover;
}

.post-author-identity {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    white-space: nowrap;
}

.post-author-name {
    max-width: min(48vw, 360px);
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    font-weight: 650;
}

.post-stats-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding-left: 0;
    font-size: 0.8125rem;
}

.post-stats-row time,
.post-stats-row > span:not(.post-meta-separator) {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.post-meta-separator {
    opacity: 0.65;
}

/* Post Content */
.post-content {
    /* 편집기와 같은 본문 리듬 변수를 쓴다. 값이 갈라지면 "쓴 대로 안 보인다". */
    font-size: var(--content-font-size);
    line-height: var(--content-line-height);
    color: var(--text-primary);
    margin-bottom: 2rem;
    min-height: 200px;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--content-media-radius);
    margin: var(--content-media-gap) 0;
}

/* Headings within content */
.post-content h1,
.post-content h2,
.post-content h3 {
    font-weight: 700;
    margin: var(--content-section-gap) 0 var(--content-gap);
    line-height: 1.35;
    color: var(--text-primary);
}

.post-content h1 {
    font-size: var(--content-h1);
}

.post-content h2 {
    font-size: var(--content-h2);
}

.post-content h3 {
    font-size: var(--content-h3);
}

.post-content p {
    margin: var(--content-gap) 0;
}

.post-content ul,
.post-content ol {
    margin: var(--content-gap) 0;
    padding-left: 1.5rem;
    list-style-position: inside;
}

.post-content blockquote {
    position: relative;
    margin: var(--content-media-gap) auto;
    padding: 0.5rem 1.25rem;
    max-width: 88%;
    border: none;
    background: transparent;

    font-family: 'Times New Roman', serif;
    /* Emotional Serif Look */
    font-style: italic;
    color: var(--text-primary);
    font-size: calc(var(--content-font-size) * 1.18);
    line-height: 1.55;
    text-align: center;
    box-shadow: none;
}

/* Remove decorative quotes entirely as requested */
.post-content blockquote::before,
.post-content blockquote::after {
    content: none;
}

[data-theme="dark"] .post-content blockquote {
    background: transparent;
    color: var(--text-primary);
}

.blockquote-footer {
    display: none;
}

/* ========================================
   Embed Styles (YouTube, SoundCloud)
   ======================================== */
.embed-wrapper {
    margin: 2rem auto;
    width: 100%;
    max-width: 640px;
}

/* 16:9 Responsive Video Container */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* SoundCloud Fixed Height */
.embed-soundcloud iframe {
    width: 100%;
    height: 166px;
    /* Standard Slim Player */
    border-radius: 12px;
    border: none;
}

/* Hide Captions */
.embed-caption {
    display: none;
}

/* Code Blocks */
.post-content pre {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: #1e1e1e;
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.post-content pre code {
    font-family: monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #d4d4d4;
}

/* Comments Section */
.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.comments-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.comments-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.comment-count {
    background: var(--primary-color, #007aff);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-round);
    font-size: 0.875rem;
    font-weight: 600;
}

/* Comment Form - Messenger Style (inline send button) */
.comment-form {
    margin-bottom: 2rem;
}

.comment-input-wrapper {
    background: var(--bg-card, #ffffff);
    border: 2px solid var(--border-light, #e9ecef);
    border-radius: 24px;
    padding: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    overflow: hidden;
    position: relative;
}

[data-theme="dark"] .comment-input-wrapper {
    background: var(--bg-card, #1e1e1e);
    border-color: var(--border-medium, #3a3a3a);
}

.comment-input-wrapper:focus-within {
    border-color: var(--primary-color, #007aff);
    box-shadow: 0 0 0 3px var(--primary-bg-light, rgba(0, 122, 255, 0.08));
}

[data-theme="dark"] .comment-input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.comment-input {
    width: 100%;
    min-height: 40px;
    max-height: 160px;
    border: none;
    background: transparent;
    resize: none;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary, #1a1a1a);
    padding: 0.625rem 0 0.625rem 1.25rem;
    font-family: inherit;
    flex: 1;
    overflow-y: auto;
}

[data-theme="dark"] .comment-input {
    color: var(--text-primary, #e5e5e5);
}

.comment-input:focus {
    outline: none;
}

.comment-input::placeholder {
    color: var(--text-muted, #999999);
    font-weight: 400;
}

[data-theme="dark"] .comment-input::placeholder {
    color: var(--text-muted, #888888);
}

.comment-input-wrapper .btn-primary {
    flex-shrink: 0;
    margin: 0 0.5rem 0.375rem 0.25rem;
    padding: 0.375rem 1rem;
    border-radius: 18px;
    font-weight: 600;
    font-size: 0.8125rem;
    background: var(--primary-color, #007aff) !important;
    color: white !important;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 56px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
    height: 32px;
    box-shadow: none;
    letter-spacing: 0.01em;
}

.comment-input-wrapper .btn-primary:hover {
    background: var(--primary-hover, #0051cc) !important;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

.comment-input-wrapper .btn-primary:active {
    transform: scale(0.96);
}

.comment-input-wrapper .btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Reply Form - also messenger style */
.reply-form {
    margin-top: 0.75rem;
    margin-left: 0;
    padding: 0.65rem;
    border: 1px solid var(--border-light, #e9ecef);
    border-radius: 16px;
    background: var(--bg-secondary);
}

[data-theme="dark"] .reply-form {
    border-left-color: var(--border-medium, #3a3a3a);
}

.reply-form .comment-input-wrapper {
    margin-top: 0.25rem;
    border-radius: 20px;
}

.reply-form .comment-input {
    min-height: 36px;
    max-height: 120px;
    padding: 0.5rem 0 0.5rem 1rem;
    font-size: 0.875rem;
}

.reply-form .btn-primary {
    margin: 0 0.375rem 0.25rem 0.25rem;
    padding: 0.3rem 0.875rem;
    font-size: 0.8125rem;
    min-width: 52px;
    height: 28px;
}

/* =============================================
   Comment List - Community Style (DC/Reddit)
   ============================================= */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.comment-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light, #f0f0f0);
    position: relative;
    min-width: 0;
}

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

/* 대댓글 들여쓰기 (실제 모양은 아래 compact 섹션에서 마무리) */
.comment-item.is-reply {
    margin-left: calc(var(--comment-depth, 0) * 2.25rem);
    border-bottom: none;
}

.comment-item.is-deleted {
    opacity: 0.5;
}

.comment-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

/* 상단: 이름 · 날짜 · 수정/삭제 */
.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 22px;
}

.comment-author-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.comment-author {
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--text-primary);
    text-decoration: none;
    max-width: min(44vw, 300px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comment-submeta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.1rem;
}

.comment-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-actions {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.comment-item:hover .comment-actions {
    opacity: 1;
}

.comment-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.comment-action-btn:hover {
    color: var(--primary-color, #007aff);
    background: var(--bg-secondary);
}

.comment-action-btn.comment-action-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.06);
}

/* 본문 */
.comment-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0.5rem 0 0;
}

.comment-text.deleted-text {
    font-style: italic;
    color: var(--text-muted);
}

.comment-link {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
}

.comment-link:hover {
    text-decoration: underline;
}

/* 영상 링크 미리보기 - 썸네일을 눌러야 실제 플레이어가 붙는다 */
.comment-embeds {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.comment-embed {
    position: relative;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-light);
}

.comment-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.comment-embed-play {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    display: block;
}

.comment-embed-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.comment-embed-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding-left: 3px;
}

.comment-embed-play:hover .comment-embed-icon {
    background: rgba(0, 0, 0, 0.8);
}

.comment-embed-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.375rem 0.5rem;
    font-size: 0.6875rem;
    color: #fff;
    text-align: left;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}

/* 수정 폼 - 본문과 동일 크기 */
.comment-text .edit-form {
    margin: 0;
}

.comment-text .edit-form textarea {
    font-size: 0.9375rem;
    line-height: 1.6;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    width: 100%;
    resize: none;
    font-family: inherit;
    min-height: 0;
    max-height: 200px;
}

.comment-text .edit-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-bg-light, rgba(0, 122, 255, 0.08));
}

.edit-actions {
    display: flex;
    gap: 0.375rem;
    margin-top: 0.375rem;
    justify-content: flex-end;
}

.edit-actions button {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all 0.15s;
}

.edit-actions button[data-action="submit-edit"] {
    background: var(--primary-color, #007aff);
    color: white;
    border-color: var(--primary-color, #007aff);
}

.edit-actions button[data-action="submit-edit"]:hover {
    opacity: 0.9;
}

.edit-actions button[data-action="cancel-edit"]:hover {
    background: var(--bg-secondary);
}

/* 하단: 하트 + 리액션 버블 + 답글 */
.comment-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

/* 댓글 반응: 반응 없을 땐 하트만, 있으면 이모지+개수 영역 */
.comment-reaction-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    position: relative;
}

.comment-reaction-area:not(.has-reactions) .comment-reaction-bubbles {
    display: none;
}

.comment-reaction-bubbles.comment-reaction-trigger {
    cursor: pointer;
    padding: 0.125rem 0.25rem;
    border-radius: 12px;
    transition: background 0.15s;
}

.comment-reaction-bubbles.comment-reaction-trigger:hover {
    background: var(--bg-secondary);
}

.comment-heart-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    min-height: 32px;
    padding: 0.3rem 0.65rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s;
    line-height: 1.2;
    font-family: inherit;
    font-weight: 650;
}

.comment-heart-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.comment-heart-btn .heart-emoji {
    font-size: 0.9375rem;
    line-height: 1;
}

/* 이모지 피커 (하트 위로 팝업) */
.comment-reaction-picker {
    position: absolute;
    bottom: calc(100% + 6px);
    left: -8px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 28px;
    padding: 0.375rem 0.5rem;
    display: flex;
    gap: 0.125rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(4px);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    z-index: 100;
}

[data-theme="dark"] .comment-reaction-picker {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border-color: var(--border-medium);
}

.comment-reaction-picker.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.comment-picker-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: transform 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-picker-btn:hover {
    transform: scale(1.3);
    background: var(--bg-secondary);
}

/* 리액션 버블 (댓글용 작은 pill - 영역 클릭 시 피커) */
.comment-reaction-bubbles {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.comment-reaction-bubbles .reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    padding: 0.125rem 0.375rem;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.6875rem;
    color: var(--text-secondary);
    line-height: 1;
}

.comment-reaction-bubbles .reaction-pill.my-reaction {
    background: var(--primary-bg-light, rgba(0, 122, 255, 0.1));
    border-color: var(--primary-color, #007aff);
    color: var(--primary-color, #007aff);
}

.comment-reaction-bubbles .reaction-pill .pill-emoji {
    font-size: 0.75rem;
}

.comment-reaction-bubbles .reaction-pill .pill-count {
    font-weight: 600;
}

/* 답글 버튼 */
.comment-reply-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    min-height: 32px;
    padding: 0.3rem 0.65rem;
    transition: color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: inherit;
}

.comment-reply-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

/* 빈 댓글 */
.comment-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* Responsive: touch targets, readability, images */
@media (max-width: 768px) {
    /* 모바일: 카드(배경·radius·그림자) 없이 본문이 페이지에 바로 이어지도록.
       좌우 여백은 main/content-wrapper의 1단계만 남김 */
    .post-detail {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        padding: 0.75rem 0 1.5rem;
    }

    .post-header {
        overflow: hidden;
    }

    .post-title {
        font-size: clamp(1.2rem, 5.5vw, 1.55rem);
        line-height: 1.38;
        overflow-wrap: anywhere;
    }

    .post-meta-detail {
        gap: 0.5rem;
    }

    .post-author {
        gap: 0.4rem;
    }

    .post-author img {
        width: 32px;
        height: 32px;
    }

    .post-author-identity {
        gap: 0.35rem;
    }

    .post-author-name {
        max-width: 58vw;
        font-size: 0.875rem;
    }

    .post-author .user-level-badge {
        margin-left: 0;
        padding: 1px 5px;
        font-size: 0.625rem;
    }

    .post-stats-row {
        padding-left: 48px;
        gap: 0.4rem;
    }

    .post-tags-section {
        margin-top: 1.1rem;
    }

    .post-detail img,
    .post-body img,
    .post-content img {
        max-width: 100%;
        height: auto;
    }

    .post-body iframe,
    .post-content iframe {
        max-width: 100%;
    }

    .reaction-main-btn {
        min-height: 44px;
        padding: 12px 20px;
    }

    #reactionsContainer.has-reactions .reaction-main-btn,
    #reactionsContainer[data-has-reactions="true"] .reaction-main-btn {
        display: none !important;
        visibility: hidden !important;
    }

    .action-link {
        min-height: 44px;
        padding: 10px 18px;
        display: inline-flex;
        align-items: center;
    }

    .comment-input,
    .comment-input-wrapper textarea {
        min-height: 40px;
    }

    .comment-input-wrapper .btn-primary {
        min-height: 36px;
    }

    .comment-add-reaction-btn,
    .comment-reply-btn {
        min-height: 32px;
        min-width: 32px;
        padding: 4px 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Show actions always on touch (no hover) */
    .comment-actions {
        opacity: 1;
    }

    .comment-avatar {
        width: 34px;
        height: 34px;
    }

    .comment-author {
        max-width: 45vw;
    }

    .comment-reaction-picker {
        max-width: calc(100vw - 32px);
        overflow-x: auto;
        overscroll-behavior-x: contain;
    }
}

@media (max-width: 600px) {
    .post-action-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .action-right {
        justify-content: flex-end;
    }

    .comment-input-wrapper {
        border-radius: 20px;
    }

    .comment-input {
        min-height: 36px;
        padding: 0.5rem 0 0.5rem 1rem;
        font-size: 0.9375rem;
    }

    .comment-input-wrapper .btn-primary {
        margin: 0 0.375rem 0.25rem 0.25rem;
        height: 32px;
        min-width: 52px;
    }

    .reply-form {
        margin-left: 0;
        padding: 0.55rem;
    }

    .reply-form .comment-input {
        padding: 0.5rem 0 0.5rem 0.75rem;
    }

    .reply-form .btn-primary {
        margin: 0 0.375rem 0.25rem 0.25rem;
    }
}

.post-detail-wrapper {
    margin-top: 0;
}

@media (max-width: 768px) {
    .post-detail-wrapper {
        margin-top: 0;
    }
}

/* 좁은 데스크톱·태블릿·모바일 공통: 작성자와 통계 정보를 세로로 분리한다.
   일부 태블릿 브라우저는 CSS viewport가 769~1024px로 잡히므로 모바일 규칙을
   768px에서만 끝내면 예전 3열 메타 레이아웃이 다시 살아날 수 있다. */
@media (max-width: 1024px) {
    .post-meta-detail {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        gap: 0.55rem;
        width: 100%;
    }

    .post-author-row,
    .post-stats-row {
        width: 100%;
        min-width: 0;
    }

    .post-author-row {
        display: block;
    }

    .post-stats-row {
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.45rem 0.65rem;
        padding-left: 0 !important;
        white-space: normal;
    }

    .post-stats-row time,
    .post-stats-row > span:not(.post-meta-separator) {
        white-space: nowrap;
    }

    .post-tags-section {
        margin-top: 0.85rem;
        text-align: left;
    }

    .post-tags-detail {
        justify-content: flex-start;
        gap: 0.4rem;
        padding-inline: 0;
    }
}

/* Compact community comments (shared by desktop and mobile)
   댓글과 대댓글은 하나의 스레드로 읽히게 한다. 대댓글은 카드/테두리 없이
   들여쓰기 + 옅은 가이드 선만 쓰고, 구분선은 최상위 댓글 사이에만 둔다. */
.comment-list {
    gap: 0;
}

.comment-item {
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.1rem;
    border-bottom: none;
}

/* 구분선은 스레드(최상위 댓글) 시작점에만 */
.comment-item:not(.is-reply) + .comment-item:not(.is-reply),
.comment-item.is-reply + .comment-item:not(.is-reply) {
    border-top: 1px solid color-mix(in srgb, var(--border-light, #f0f0f0) 60%, transparent);
    margin-top: 0.4rem;
    padding-top: 1rem;
}

.comment-item.is-reply {
    margin: 0 0 0 calc(var(--comment-depth, 0) * 1.9rem);
    padding: 0.5rem 0.1rem 0.5rem 0.85rem;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
}

/* 들여쓴 대댓글 왼쪽의 옅은 스레드 가이드 선 */
.comment-item.is-reply::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.1rem;
    bottom: 0.1rem;
    width: 2px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--border-light, #e5e5e5) 85%, transparent);
}

[data-theme="dark"] .comment-item.is-reply::before {
    background: color-mix(in srgb, var(--border-medium, #3a3a3a) 80%, transparent);
}

.comment-avatar {
    width: 32px;
    height: 32px;
}

.comment-item.is-reply .comment-avatar {
    width: 28px;
    height: 28px;
}

.comment-header {
    min-height: 18px;
    gap: 0.35rem;
}

.comment-author-line {
    gap: 0.3rem;
}

.comment-author {
    font-size: 0.78rem;
}

.comment-submeta {
    gap: 0.35rem;
    margin-top: 0;
}

.comment-date {
    font-size: 0.68rem;
}

.comment-text {
    margin-top: 0.3rem;
    font-size: 0.9rem;
    line-height: 1.45;
}

.comment-footer {
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.comment-heart-btn,
.comment-reply-btn {
    min-height: 29px;
    padding: 0.2rem 0.5rem;
    gap: 0.25rem;
    font-size: 0.7rem;
}

.comment-reaction-bubbles {
    gap: 0.18rem;
}

.comment-reaction-bubbles .reaction-pill {
    min-height: 24px;
    padding: 0.1rem 0.3rem;
    font-size: 0.63rem;
}

.reply-form {
    margin-top: 0.45rem;
    padding: 0.5rem;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .comment-item {
        gap: 0.55rem;
        padding: 0.58rem 0;
    }

    .comment-item.is-reply {
        margin-left: calc(var(--comment-depth, 0) * 1.15rem);
        padding: 0.45rem 0 0.45rem 0.7rem;
    }

    .comment-avatar {
        width: 30px;
        height: 30px;
    }

    .comment-item.is-reply .comment-avatar {
        width: 26px;
        height: 26px;
    }

    .comment-text {
        font-size: 0.85rem;
    }
}

/* Post sharing: the button stays on the date/view row on every viewport. */
.post-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    min-height: 30px;
    margin-left: auto;
    padding: 0.25rem 0.65rem;
    border: 1px solid color-mix(in srgb, var(--primary-color, #1976d2) 30%, var(--border-light, #e5e7eb));
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-card, #fff) 88%, var(--primary-color, #1976d2));
    color: var(--primary-color, #1976d2);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.post-share-button:hover,
.post-share-button:focus-visible {
    border-color: var(--primary-color, #1976d2);
    background: color-mix(in srgb, var(--primary-color, #1976d2) 12%, var(--bg-card, #fff));
    outline: none;
}

.post-share-button:active {
    transform: scale(0.96);
}

.post-share-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483645;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(9, 12, 18, 0.58);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s ease;
}

.post-share-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.post-share-dialog {
    width: min(100%, 430px);
    padding: 1.1rem;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 22px;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #111827);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.18s ease;
}

.post-share-overlay.is-open .post-share-dialog {
    transform: translateY(0) scale(1);
}

.post-share-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.post-share-dialog-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.post-share-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: var(--bg-secondary, #f3f4f6);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
}

.post-share-close:hover,
.post-share-close:focus-visible {
    color: var(--text-primary, #111827);
    outline: 2px solid color-mix(in srgb, var(--primary-color, #1976d2) 48%, transparent);
    outline-offset: 2px;
}

.post-share-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.65rem;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 15px;
    background: var(--bg-secondary, #f8fafc);
}

.post-share-preview img {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    border-radius: 11px;
    object-fit: cover;
    background: var(--bg-card, #fff);
}

.post-share-preview-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.post-share-preview-copy strong {
    overflow: hidden;
    color: var(--text-primary, #111827);
    font-size: 0.875rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-share-preview-copy span {
    color: var(--text-muted, #94a3b8);
    font-size: 0.72rem;
}

.post-share-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.post-share-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 82px;
    padding: 0.7rem 0.5rem;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 15px;
    background: var(--bg-card, #fff);
    color: var(--text-secondary, #475569);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.post-share-action i {
    font-size: 1.1rem;
    color: var(--primary-color, #1976d2);
}

.post-share-action small {
    color: var(--text-muted, #94a3b8);
    font-size: 0.65rem;
    font-weight: 600;
}

.post-share-action:hover,
.post-share-action:focus-visible,
.post-share-action.is-copied {
    border-color: color-mix(in srgb, var(--primary-color, #1976d2) 52%, var(--border-light, #e5e7eb));
    background: color-mix(in srgb, var(--primary-color, #1976d2) 8%, var(--bg-card, #fff));
    outline: none;
}

.post-share-action:active {
    transform: scale(0.97);
}

.post-share-action.is-unavailable {
    opacity: 0.56;
}

.post-share-status {
    min-height: 1.1em;
    margin: 0.75rem 0 0;
    color: var(--text-muted, #94a3b8);
    font-size: 0.75rem;
    text-align: center;
}

body.post-share-open {
    overflow: hidden;
}

[data-theme="dark"] .post-share-dialog {
    border-color: var(--border-medium, #374151);
}

@media (max-width: 600px) {
    .post-share-button {
        min-height: 29px;
        padding-inline: 0.55rem;
    }

    .post-share-button span {
        font-size: 0.7rem;
    }

    .post-share-overlay {
        align-items: flex-end;
        padding: 0.55rem;
    }

    .post-share-dialog {
        width: 100%;
        border-radius: 20px;
        padding: 0.95rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .post-share-overlay,
    .post-share-dialog,
    .post-share-button,
    .post-share-action {
        transition: none;
    }
}
