/* Server detail page. Colours come from the tokens of site.css */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 24px 0 12px;
    color: var(--muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--text);
}


.server-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.server-head .server-title {
    flex-wrap: wrap;
}

/* ---- gallery ---- */
.media-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.media-item {
    margin: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.media-frame {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--bg3);
}

.media-frame iframe,
.media-open {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.media-open {
    padding: 0;
    background: none;
    cursor: zoom-in;
}

.media-open img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-open:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
}

.media-caption {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px 12px;
    font-size: 14px;
}

.media-caption-text {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.media-caption-text.empty,
.media-meta {
    color: var(--muted);
}

.media-meta {
    font-size: 13px;
}

.media-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.media-actions .card-action-btn {
    padding: 4px 10px;
}

.media-edit textarea {
    width: 100%;
}

/* ---- lightbox ---- */
.lightbox-content {
    background: var(--bg2);
    border: 1px solid var(--border);
    padding: 12px;
    align-items: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.lightbox-close {
    align-self: flex-end;
    margin-bottom: 8px;
}

.lightbox-caption {
    margin: 10px 0 0;
    text-align: center;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.lightbox-caption:empty {
    display: none;
}

/* ---- add dialog ---- */
#media-picker .server-picker-item[aria-pressed="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.empty-note {
    color: var(--muted);
}

/* ---- files ---- */
[data-tab-panel][hidden] {
    display: none;
}

.file-list {
    list-style: none;
    margin: 0 0 32px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-row {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.file-main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.file-icon {
    font-size: 1.6rem;
    color: var(--muted);
}

.file-info {
    flex: 1 1 240px;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.file-meta {
    color: var(--muted);
    font-size: 13px;
}

.file-description {
    margin-top: 6px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.file-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.file-actions .card-action-btn {
    padding: 4px 10px;
}

.file-edit textarea,
.comment-form textarea {
    width: 100%;
}

.file-comments {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.comment-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.comment-text {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.comment-form {
    margin-top: 12px;
}

@media (max-width: 768px) {
    .file-actions {
        width: 100%;
    }
}
