/* =========================================================================
   Communauté — fil social (artistes & galeries)
   ========================================================================= */

body.page-community {
    background: var(--museum-gray);
}

.comm-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(600px, 100%) minmax(0, 1fr);
    gap: 0;
    min-height: calc(100vh - 73px);
}

.comm-sidebar {
    padding: 24px var(--gutter);
    position: sticky;
    top: 73px;
    align-self: start;
    max-height: calc(100vh - 73px);
    overflow-y: auto;
}
.comm-sidebar--right {
    border-left: 1px solid var(--border);
}
.comm-sidebar h2 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.1rem;
    margin: 0 0 16px;
}
.comm-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.comm-sidebar-nav a {
    padding: 10px 12px;
    font-weight: 500;
    font-size: .9rem;
    color: var(--museum-black);
    text-decoration: none;
}
.comm-sidebar-nav a:hover,
.comm-sidebar-nav a.is-active {
    background: var(--museum-white);
}
.comm-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.comm-feed-col {
    background: var(--museum-white);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    min-height: calc(100vh - 73px);
}

.comm-feed-header {
    position: sticky;
    top: 73px;
    z-index: 10;
    background: var(--museum-white);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.comm-feed-header h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.25rem;
    margin: 0;
}
.comm-feed-header .btn { flex-shrink: 0; }

.comm-feed {
    padding-bottom: 48px;
}

/* —— Carte publication (style feed) —— */
.comm-post {
    border-bottom: 1px solid var(--border);
    background: var(--museum-white);
}
.comm-post:last-child { border-bottom: none; }

.comm-post-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}
.comm-post-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: var(--museum-gray);
    overflow: hidden;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--museum-black);
}
.comm-post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comm-post-author {
    flex: 1;
    min-width: 0;
}
.comm-post-author a {
    font-weight: 600;
    font-size: .92rem;
    color: var(--museum-black);
    text-decoration: none;
}
.comm-post-author a:hover { text-decoration: underline; }
.comm-post-meta {
    font-size: .78rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.comm-type-pill {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 2px 6px;
    background: var(--museum-gray);
    color: var(--museum-black);
}
.comm-type-pill--open { background: var(--museum-black); color: var(--museum-white); }

.comm-post-media {
    display: block;
    width: 100%;
    background: var(--museum-gray);
    position: relative;
    aspect-ratio: 4 / 5;
    max-height: min(72vh, 720px);
    overflow: hidden;
}
.comm-post-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.comm-post-media--text {
    aspect-ratio: auto;
    min-height: 200px;
    max-height: none;
    padding: 32px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.comm-post-media--text p {
    font-family: var(--font-display);
    font-size: 1.15rem;
    line-height: 1.5;
    color: var(--museum-black);
    margin: 0;
    max-width: 40ch;
}

.comm-post-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px 4px;
}
.comm-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 500;
    color: var(--museum-black);
    font-family: inherit;
    text-decoration: none;
}
.comm-action-btn:hover { background: var(--museum-gray); }
.comm-action-btn.is-liked { color: var(--museum-gold); }
.comm-action-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.comm-post-body {
    padding: 0 16px 12px;
}
.comm-post-title {
    font-weight: 600;
    font-size: .95rem;
    margin: 0 0 6px;
    color: var(--museum-black);
}
.comm-post-title a {
    color: inherit;
    text-decoration: none;
}
.comm-post-title a:hover { text-decoration: underline; }
.comm-post-text {
    font-size: .9rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0;
    white-space: pre-wrap;
}
.comm-post-text--clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.comm-post-extra {
    padding: 0 16px 8px;
    font-size: .82rem;
    color: var(--text-muted);
}

.comm-post-comments-preview {
    padding: 0 16px 16px;
    font-size: .88rem;
}
.comm-post-comments-preview a {
    color: var(--text-muted);
    font-weight: 500;
}
.comm-post-comments-preview a:hover { color: var(--museum-black); }

/* —— Page détail —— */
.comm-detail {
    max-width: 600px;
    margin: 0 auto;
    background: var(--museum-white);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    min-height: calc(100vh - 73px);
}

.comm-comments-section {
    padding: 16px;
    border-top: 1px solid var(--border);
}
.comm-comments-section h2 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.1rem;
    margin: 0 0 16px;
}

.comm-comment-form {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.comm-comment-form textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    resize: vertical;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    font-family: inherit;
    font-size: .9rem;
}
.comm-comment-form button {
    flex-shrink: 0;
    align-self: flex-end;
}

.comm-comment-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.comm-comment {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.comm-comment-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: var(--museum-gray);
    overflow: hidden;
    display: grid;
    place-items: center;
    font-size: .85rem;
}
.comm-comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comm-comment-bubble {
    flex: 1;
    min-width: 0;
    background: var(--museum-gray);
    padding: 10px 14px;
}
.comm-comment-bubble strong {
    font-size: .85rem;
    margin-right: 8px;
}
.comm-comment-bubble time {
    font-size: .72rem;
    color: var(--text-muted);
}
.comm-comment-bubble p {
    margin: 6px 0 0;
    font-size: .9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.comm-empty {
    text-align: center;
    padding: 80px 24px;
}
.comm-empty p { color: var(--text-muted); margin-bottom: 16px; }

/* Create form */
.comm-create-wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 48px var(--gutter) 80px;
}
.comm-image-preview {
    margin-top: 12px;
    max-width: 100%;
    aspect-ratio: 4/5;
    background: var(--museum-gray);
    overflow: hidden;
}
.comm-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comm-image-preview:empty { display: none; }

@media (max-width: 1100px) {
    .comm-layout {
        grid-template-columns: 1fr;
    }
    .comm-sidebar { display: none; }
    .comm-feed-col,
    .comm-detail {
        border-left: none;
        border-right: none;
    }
}

@media (max-width: 640px) {
    .comm-post-media {
        max-height: 85vw;
        aspect-ratio: 1;
    }
}

/* =========================================================================
   Composer trigger : barre cliquable type "Quoi de neuf ?" + modal publish
   ========================================================================= */
.comm-feed-header-text { display: flex; flex-direction: column; gap: 6px; }
.comm-feed-header-lead { margin: 4px 0 0 0; }

.comm-composer {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    margin: 18px 0 22px;
    background: var(--museum-white, #fff);
    border: 1px solid var(--border, #e6e6e6);
    color: var(--museum-black, #0a0a0a);
    text-align: left;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}
.comm-composer:hover,
.comm-composer:focus-visible {
    border-color: var(--museum-gold, #c9a86a);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    outline: none;
}
.comm-composer-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--museum-gray, #f5f5f5);
    color: var(--museum-black, #0a0a0a);
    font-weight: 700;
    font-size: 0.95rem;
    overflow: hidden;
}
.comm-composer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comm-composer-prompt {
    flex: 1;
    color: color-mix(in srgb, var(--museum-black, #0a0a0a) 55%, transparent);
    font-size: 0.95rem;
}
.comm-composer-cta {
    flex-shrink: 0;
    padding: 6px 14px;
    background: var(--museum-black, #0a0a0a);
    color: var(--museum-white, #fff);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.comm-composer:hover .comm-composer-cta,
.comm-composer:focus-visible .comm-composer-cta {
    background: var(--museum-gold, #c9a86a);
    color: var(--museum-black, #0a0a0a);
}
.comm-composer--login {
    border-style: dashed;
}

/* ----- Modal de publication ----- */
.comm-publish-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.comm-publish-modal[hidden] { display: none; }
.comm-publish-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.comm-publish-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--museum-white, #fff);
    border: 1px solid var(--border, #e6e6e6);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
.comm-publish-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--border, #e6e6e6);
}
.comm-publish-head h2 {
    font-family: var(--font-display, "Cormorant Garamond", serif);
    font-weight: 400;
    font-size: clamp(1.4rem, 2.4vw, 1.8rem);
    margin: 6px 0 0 0;
}
.comm-publish-close {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border, #e6e6e6);
    color: var(--museum-black, #0a0a0a);
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, border-color .2s;
}
.comm-publish-close:hover {
    background: var(--museum-gray, #f5f5f5);
    border-color: var(--museum-gold, #c9a86a);
}

.comm-publish-form {
    padding: 18px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.comm-publish-author {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
}
.comm-publish-author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--museum-gray, #f5f5f5);
    color: var(--museum-black, #0a0a0a);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.comm-publish-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comm-publish-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.comm-publish-feedback {
    padding: 12px 14px;
    font-size: 0.92rem;
    border: 1px solid;
}
.comm-publish-feedback.is-ok {
    background: color-mix(in srgb, var(--museum-gold, #c9a86a) 14%, var(--museum-white, #fff));
    border-color: var(--museum-gold, #c9a86a);
    color: var(--museum-black, #0a0a0a);
}
.comm-publish-feedback.is-error {
    background: color-mix(in srgb, #d23 12%, var(--museum-white, #fff));
    border-color: #d23;
    color: #a91e1e;
}

[data-comm-publish-counter] { transition: color .2s; }
[data-comm-publish-counter].is-ok { color: var(--museum-gold, #c9a86a); }

.comm-publish-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

@media (max-width: 600px) {
    .comm-publish-modal { padding: 0; }
    .comm-publish-card {
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border: none;
    }
}
