/* --------------------------------------------------------------------------
   Community page styles aligned with the site's art direction
   -------------------------------------------------------------------------- */

#content {
    max-height: none;
    margin: 0;
}

/* Neutralise flex behaviour applied globally on other sections */
#site-content {
    display: block;
}

#customize-main:not(.customize-layout):not(.hub-layout) {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: calc(100dvh - var(--header-height, 88px));
}

#customize-main:not(.customize-layout):not(.hub-layout) > #content {
    flex: 1 1 auto;
    display: flex;
    width: 100%;
}

#customize-main:not(.customize-layout):not(.hub-layout) > #content > .community-page {
    flex: 1 1 auto;
}

.community-page {
    --community-accent: var(--color-brand-400, #2bd879);
    --community-accent-strong: var(--color-brand-500, #1fb86c);
    --community-accent-soft: rgba(43, 216, 121, 0.14);
    --community-border: rgba(43, 216, 121, 0.28);
    --community-surface: linear-gradient(
        155deg,
        rgba(26, 30, 32, 0.92) 0%,
        rgba(16, 18, 20, 0.9) 55%,
        rgba(7, 9, 10, 0.88) 100%
    );

    position: relative;
    display: flex;
    flex-direction: column;
    gap: clamp(24px, 4vw, 40px);
    width: 100%;
    min-height: calc(100dvh - var(--header-height, 88px));
    padding: clamp(24px, 4vw, 48px);
    box-sizing: border-box;
    background:
        radial-gradient(circle at top right, rgba(43, 216, 121, 0.08), transparent 58%),
        radial-gradient(circle at bottom left, rgba(20, 133, 86, 0.14), transparent 60%),
        rgba(10, 12, 14, 0.94);
    color: var(--color-text, #f5f5f5);
    overflow-y: auto;
}

.community-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 3vw, 32px);
    padding: clamp(24px, 4vw, 48px);
    border-radius: 28px;
    border: 1px solid var(--community-border);
    background: var(--community-surface);
    box-shadow: 0 28px 58px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(14px);
    isolation: isolate;
}

.community-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(43, 216, 121, 0.08), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.community-hero {
    overflow: hidden;
}

.community-hero::after {
    content: "";
    position: absolute;
    width: clamp(260px, 45vw, 420px);
    height: clamp(260px, 45vw, 420px);
    bottom: -30%;
    right: -18%;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(43, 216, 121, 0.24), transparent 65%);
    filter: blur(0.4px);
    opacity: 0.6;
    pointer-events: none;
}

.community-hero__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 500px);
    gap: clamp(24px, 4vw, 48px);
    align-items: start;
}

.community-hero__left {
    display: flex;
    flex-direction: column;
    gap: clamp(24px, 3vw, 32px);
}

.community-hero__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: clamp(20px, 5vw, 40px);
}

.community-hero__intro {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: min(580px, 100%);
}

.community-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid rgba(43, 216, 121, 0.36);
    background: var(--community-accent-soft);
    color: var(--community-accent);
    text-transform: uppercase;
    letter-spacing: 0.24em;
    font-size: 0.72rem;
}

.community-hero__title {
    margin: 0;
    font-size: clamp(1.6rem, 3.2vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: rgba(246, 246, 246, 0.96);
}

.community-hero__description {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.7;
    color: rgba(220, 220, 220, 0.82);
}

.community-hero__profile {
    flex: 0 0 auto;
    max-width: min(320px, 100%);
    min-width: 220px;
}

.community-profile-back {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(246, 246, 246, 0.08);
    background: transparent;
    color: rgba(246, 246, 246, 0.9);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.community-profile-back i {
    font-size: 0.9rem;
}

.community-profile-back:hover,
.community-profile-back:focus {
    background: rgba(43, 216, 121, 0.12);
    color: rgba(246, 246, 246, 1);
}

.community-profile-back:focus-visible {
    outline: 2px solid rgba(43, 216, 121, 0.85);
    outline-offset: 4px;
}

#community-user-profile {
    background: rgba(8, 10, 12, 0.75);
    padding: 24px;
    border-radius: 22px;
    border: 1px solid rgba(43, 216, 121, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: none;
}

#community-user-profile-content {
    display: flex;
    align-items: center;
    gap: 18px;
}

.community-user-logo {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(160deg, rgba(43, 216, 121, 0.2), rgba(9, 12, 12, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    color: #fff;
    flex: 0 0 88px;
    aspect-ratio: 1 / 1;
}

.community-user-logo--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.community-user-logo--fallback {
    font-size: 1.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.community-user-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.community-user-info .community-user-name {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
    color: rgba(246, 246, 246, 0.96);
}

.community-user-info .community-user-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.95rem;
    color: rgba(215, 215, 215, 0.82);
}

.community-user-info .community-user-stats p {
    margin: 0;
}

.community-hero__toolbar {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: clamp(12px, 2vw, 20px);
}

.community-hero__search {
    align-self: stretch;
    display: flex;
    gap: 16px;
}

.community-profile-loading {
    color: rgba(220, 220, 220, 0.82);
    font-size: 0.98rem;
}

.community-page--profile .community-hero__intro {
    display: none;
}

.community-page--profile .community-profile-back {
    display: inline-flex;
}

.community-page--profile .community-hero__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
}

.community-page--profile .community-hero__profile {
    max-width: none;
    width: 100%;
}

.community-page--profile #community-user-profile {
    display: block;
}

.sorting-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
}

.sorting-container button {
    position: relative;
    border: none;
    background: transparent;
    padding: 10px 20px;
    border-radius: 999px;
    color: rgba(230, 230, 230, 0.78);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.sorting-container button:hover,
.sorting-container button:focus-visible {
    color: #ffffff;
}

.sorting-container button.active {
    background: linear-gradient(135deg, rgba(43, 216, 121, 0.42), rgba(31, 184, 108, 0.65));
    color: #ffffff;
    box-shadow: 0 14px 32px rgba(43, 216, 121, 0.28);
}

.search-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    flex: 1 1 420px;
    width: 100%;
    justify-content: flex-end;
}

.search-container__field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    width: 100%;
}

#search-input {
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 0.95rem;
    min-width: 220px;
    padding: 6px 4px;
    flex: 1 1 auto;
    width: 100%;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#search-input:focus {
    outline: none;
}

#search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--community-accent-strong), var(--community-accent));
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(43, 216, 121, 0.32);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#search-button i {
    margin: 0;
}

#search-button:hover,
#search-button:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 20px 36px rgba(43, 216, 121, 0.4);
}

.community-gallery {
    gap: clamp(24px, 4vw, 36px);
    min-height: 0;
}


.community-gallery .content-container {
    width: 100%;
    min-height: 0;
}

#image-container {
    width: 100%;
    min-height: 0;
}

.community-gallery__placeholders {
    display: none;
    width: 100%;
    gap: clamp(8px, 1.5vw, 14px);
    margin-bottom: clamp(12px, 1.75vw, 18px);
}

.community-gallery__placeholders.is-visible {
    display: flex;
}

.community-gallery__placeholder-column {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    gap: clamp(9px, 1.5vw, 14px);
    min-width: 0;
}

.community-gallery__placeholder {
    position: relative;
    padding-top: 125%;
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(40, 42, 48, 0.85), rgba(22, 24, 30, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 36px rgba(6, 7, 12, 0.48);
    overflow: hidden;
}

.community-gallery__placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
    transform: translateX(-100%);
    animation: community-skeleton 1.8s ease-in-out infinite;
}

.image-container {
    display: flex;
    align-items: flex-start;
    gap: clamp(8px, 1.5vw, 14px);
    width: 100%;
    box-sizing: border-box;
}

.image-container .image-column {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
}

.imageContainer {
    position: relative;
    margin-bottom: clamp(9px, 1.5vw, 14px);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.45);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.55);
    transition: box-shadow 0.3s ease;
}

.imageContainer::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    pointer-events: none;
}

@keyframes community-skeleton {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(0%);
    }

    100% {
        transform: translateX(100%);
    }
}

.imageContainer:hover,
.imageContainer:focus-within {
    box-shadow: 0 28px 54px rgba(0, 0, 0, 0.6);
}

.imageContainer:hover::after,
.imageContainer:focus-within::after {
    background: rgba(0, 0, 0, 0.12);
}

.imageContainer img {
    width: 100%;
    height: auto;
    display: block;
}

.image-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 2px 6px;
    background: rgba(10, 10, 10, 0.9);
}


.image-meta__user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #f5f5f5;
    text-decoration: none;
    font-size: 0.95rem;
}

.image-meta__user:hover,
.image-meta__user:focus {
    color: var(--community-accent, #ff6b6b);
}

.image-meta__avatar {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.image-meta__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-meta__avatar--fallback {
    background: transparent;
    border-color: var(--community-accent-soft, rgba(255, 107, 107, 0.35));
}

.image-meta__avatar--fallback i {
    color: var(--community-accent-soft, rgba(255, 107, 107, 0.8));
    font-size: 0.75rem;
}

.image-meta__likes {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 999px;
    transition: background 0.3s ease, color 0.3s ease;
}

.image-meta__likes:hover,
.image-meta__likes:focus {
    background: rgba(255, 107, 107, 0.12);
    color: #ff6b6b;
}

.like-icon {
    color: currentColor;
    transition: color 0.3s ease;
}

.like-icon.liked {
    color: #ff6b6b;
}

.like-count {
    font-weight: 600;
    font-size: 0.75rem;
}

.community-gallery__loading {
    align-self: center;
    padding: 10px 24px;
    border-radius: 999px;
    background: var(--community-accent-soft);
    border: 1px solid var(--community-border);
    color: rgba(240, 240, 240, 0.9);
    font-size: 0.95rem;
    display: none;
}

#load-more-trigger {
    height: 1px;
}

#imageModal.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

#imageModal .modal-content {
    max-width: min(100%, 920px);
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}

#caption {
    margin-top: 16px;
    color: rgba(240, 240, 240, 0.85);
    text-align: center;
    font-size: 0.95rem;
}

.scroll-to-top {
    position: fixed;
    right: clamp(16px, 3vw, 32px);
    bottom: clamp(18px, 4vw, 36px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 999px;
    background: var(--community-accent-strong, #1fb86c);
    color: #07120c;
    cursor: pointer;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
    transition: opacity 0.25s ease, transform 0.25s ease;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    z-index: 24;
}

.scroll-to-top i {
    font-size: 1.15rem;
}

.scroll-to-top:focus-visible {
    outline: 2px solid rgba(43, 216, 121, 0.85);
    outline-offset: 4px;
}

.scroll-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.community-gallery__empty {
    display: none;
    margin: 24px 0 0;
    padding: 24px;
    border-radius: 18px;
    background: rgba(12, 16, 18, 0.82);
    border: 1px solid rgba(43, 216, 121, 0.14);
    color: rgba(220, 220, 220, 0.88);
    text-align: center;
    font-size: 1.02rem;
}

/* --------------------------------------------------------------------------
   Recherche — panneau de suggestions
   -------------------------------------------------------------------------- */

.community-search-panel {
    margin-bottom: 20px;
    width: 100%;
    border-radius: 20px;
    background: rgba(12, 16, 18, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    color: #f5f8f7;
    padding: clamp(20px, 4vw, 28px);
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: min(72vh, 640px);
    overflow-y: auto;
    backdrop-filter: blur(6px);
}

.community-search-panel[hidden] {
    display: none;
}

.community-search-panel__section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.community-search-panel__section-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(245, 245, 245, 0.66);
}

.community-search-panel__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.community-search-result {
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: rgba(17, 22, 24, 0.72);
    padding: 14px 18px;
    color: inherit;
    gap: 14px;
    cursor: pointer;
    text-align: left;
    transition: border 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.community-search-result:hover,
.community-search-result:focus-visible {
    border-color: var(--community-accent);
    transform: translateY(-2px);
    background: rgba(27, 36, 38, 0.92);
}

.community-search-result__avatar {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: rgba(245, 245, 245, 0.92);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.community-search-result__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.community-search-result__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
}

.community-search-result__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #f5f5f5;
}

.community-search-result__subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(245, 245, 245, 0.64);
}

.community-search-result__keyword {
    flex: 0 0 auto;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(43, 216, 121, 0.16);
    color: var(--community-accent);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.community-search-panel__empty {
    margin: 0;
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    background: rgba(17, 22, 24, 0.72);
    text-align: center;
    font-size: 0.95rem;
    color: rgba(245, 245, 245, 0.72);
}

.community-search-panel__section[hidden],
.community-search-panel__empty[hidden] {
    display: none;
}

@media (max-width: 1200px) {
    .community-page {
        padding: clamp(20px, 6vw, 40px);
    }

    .community-card {
        padding: clamp(20px, 6vw, 40px);
    }

    #search-input {
        min-width: 180px;
    }
}

@media (max-width: 960px) {
    .community-hero__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .community-hero__profile {
        width: 100%;
        min-width: 0;
    }

    #community-user-profile {
        width: 100%;
    }

    .search-and-sort-container {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        width: 100%;
    }

    #search-input {
        flex: 1 1 auto;
        min-width: 0;
    }

    .image-container {
        gap: 18px;
    }
}

@media (max-width: 720px) {
    .community-page {
        padding: 20px;
    }

    .community-card {
        padding: 24px;
        border-radius: 24px;
    }

    .community-search-panel {
        max-height: none;
        width: 100%;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    }

    .sorting-container {
        width: 100%;
        justify-content: space-between;
    }

    .sorting-container button {
        flex: 1 1 0;
        text-align: center;
    }

    .image-container {
        flex-direction: column;
    }
}

@media (max-width: 540px) {
    .community-card {
        padding: 20px;
    }

    .community-hero__title {
        font-size: clamp(1.45rem, 6.8vw, 2.1rem);
    }

    .community-hero__description {
        font-size: 0.98rem;
    }

    .search-container__field {
        padding: 6px 12px;
    }

    #search-button {
        width: 38px;
        height: 38px;
    }
}
