.forum-page {
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

/* A post or category overlay is as wide as the column it carries, plus the
   card's own padding — the 1100px of `.page-overlay-card` are for a whole team
   page and left an empty strip either side of the forum on a desktop. */
.page-overlay-card.forum-sheet {
    max-width: min(100%, calc(720px + 2 * var(--bs-card-spacer-x)));
}

.forum-notice {
    font-size: 0.9rem;
}

.forum-notice i {
    margin-right: 0.4rem;
}

.forum-category-item:hover,
.forum-category-item:active,
.forum-post-item:hover,
.forum-post-item:active {
    transform: none;
}

.forum-category-item h6 {
    margin-bottom: 0.25rem;
}

.forum-category-meta {
    font-size: 0.85rem;
    min-width: 0;
}

.forum-post-item {
    position: relative;
}

.forum-post-item h6 {
    color: var(--bs-primary);
}

.forum-post-item:hover h6 {
    text-decoration: underline;
}

.forum-post-preview {
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.forum-meta {
    font-size: 0.85rem;
}

.forum-team-link {
    color: var(--bs-primary);
    text-decoration: none;
}

.forum-team-link:hover {
    text-decoration: underline;
}

.forum-post-text {
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

#forum-comment-input {
    resize: vertical;
}

.forum-comment-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    justify-content: flex-end;
}

.forum-comment {
    font-size: 0.95rem;
}

/* Comments — and the post above them — created today get a subtle highlight;
   add padding + rounding so the background reads as intentional rather than a
   flush stripe. */
.forum-post.bg-warning-subtle,
.forum-comment.bg-warning-subtle {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border-bottom: none;
}

.forum-comment-images {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.forum-comment-thumb {
    height: 100px;
    border-radius: 4px;
    cursor: pointer;
    object-fit: contain;
    max-width: 100%;
}

.forum-comment-thumb:hover {
    opacity: 0.8;
}

.forum-image-preview {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.forum-preview-item {
    position: relative;
    display: inline-block;
}

/* Bootstrap parks `.btn-close` in the corner of a dismissible alert. Since
   #706 the X is a `CloseButton` instead, so the corner has to be given to it
   by name — otherwise it sits in the middle of the sentence it dismisses. */
.forum-notice.alert-dismissible .btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

/* The X on a picked image is a `CloseButton` in the danger role since #706 —
   what is left here is the corner it hangs in and how small it has to be to
   leave the thumbnail visible. */
.forum-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    padding: 0;
    font-size: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.forum-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--app-black-rgb), 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
}

.forum-image-overlay img {
    max-height: 80vh;
    max-height: 80dvh;
    max-width: 80vw;
    object-fit: contain;
    border-radius: 4px;
}

.forum-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--app-ink-on-accent);
    padding: 0.15em 0.5em;
    border-radius: 0.25rem;
    vertical-align: middle;
    line-height: 1.2;
}

.forum-badge-admin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.forum-badge-form {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.forum-badge-form .form-control-color {
    width: 2.5rem;
    padding: 0.2rem;
}

.forum-badge-color-swatches {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.forum-badge-color-swatch {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(var(--app-black-rgb), 0.15);
    transition: transform 0.1s ease-in-out, border-color 0.1s ease-in-out;
}

.forum-badge-color-swatch:hover {
    transform: scale(1.1);
}

.forum-badge-color-swatch.is-selected {
    border-color: var(--bs-light);
    box-shadow: 0 0 0 2px var(--bs-primary);
}

.forum-post-item--archived {
    opacity: 0.65;
}

.forum-archived-indicator {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bs-secondary);
    border: 1px solid var(--bs-secondary);
    padding: 0.05em 0.4em;
    border-radius: 0.25rem;
    vertical-align: middle;
}

.forum-badge-filter-select {
    width: auto;
    min-width: 10rem;
}

.forum-mention-item {
    border-left: 3px solid var(--bs-info);
}

.forum-mention-tag {
    color: var(--bs-info);
    font-weight: 600;
    background: rgba(var(--bs-info-rgb), 0.1);
    padding: 0 0.2em;
    border-radius: 0.2rem;
}

.mention-autocomplete {
    position: absolute;
    z-index: 1080;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    box-shadow: 0 4px 10px rgba(var(--app-black-rgb), 0.15);
    max-height: 14rem;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.mention-autocomplete-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--bs-body-color);
}

.mention-autocomplete-item:hover,
.mention-autocomplete-item.is-active {
    background: var(--bs-info);
    color: var(--app-ink-on-accent);
}

.mention-autocomplete-empty {
    padding: 0.5rem 0.75rem;
    color: var(--bs-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

.forum-latest-comments-title {
    color: var(--bs-secondary);
}

.forum-latest-comment-item:hover,
.forum-latest-comment-item:active {
    transform: none;
}

.forum-latest-comment-title {
    color: var(--bs-primary);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
}

.forum-latest-comment-item:hover .forum-latest-comment-title {
    text-decoration: underline;
}

.forum-author-actions {
    display: inline-flex;
    flex-direction: column;
    gap: 0.66rem;
    flex-shrink: 0;
}

.forum-post-header {
    display: flex;
    justify-content: space-between;
    align-items: first baseline;
    gap: 0.5rem;
}

.forum-post-header h5 {
    min-width: 0;
    overflow-wrap: anywhere;
}

.forum-post-header .btn {
    flex-shrink: 0;
}

.forum-post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.forum-post-footer--end {
    justify-content: flex-end;
}

.forum-post-actions {
    display: inline-flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.forum-icon-btn {
    padding: 0.15rem 0.4rem;
    color: var(--bs-secondary);
    text-decoration: none;
    line-height: 1;
}

.forum-icon-btn:hover {
    color: var(--bs-primary);
}

.forum-icon-btn-danger:hover {
    color: var(--bs-danger);
}

.forum-edit-form textarea,
.forum-edit-form input {
    font-size: 0.95rem;
}
