.hidden {
    display: none;
}

.off-stage {
    position: absolute;
    left: -9999px;
}

a.danger {
    color: rgb(217, 53, 38);
    text-decoration-color: rgb(217, 53, 38);
}

/** Layout **/

header {
    text-align: center;
}

header h1 {
    border-bottom: 2px solid var(--pico-muted-color);
    padding-bottom: calc(var(--pico-typography-spacing-vertical) / 2);
    margin-bottom: calc(var(--pico-typography-spacing-vertical) / 2);
}

header h1 a {
    --pico-text-decoration: none;
    color: var(--pico-h1-color);
}

header h1 a:hover {
    --pico-text-decoration: none;
}

/** Index **/

section.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

@media (max-width: 600px) {
    section.gallery {
        grid-template-columns: 1fr 1fr;
    }
}

section.gallery img {
    width: auto;
    height: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 5px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

section.chats {
    margin-bottom: 2rem;
}

div.chat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (max-width: 600px) {
    div.chat-grid {
        grid-template-columns: 1fr;
    }
}

a.chat-card {
    text-decoration: none;
}

a.chat-card article {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

a.chat-card p.error {
    color: var(--pico-secondary);
}

a.chat-card p {
    color: var(--pico-h2-color);
}

a.chat-card img {
    max-height: 150px;
    width: auto;
    border-radius: 5px;
}

/** Chat List **/

.chat-item {
    padding-block: 1rem;
    border-bottom: var(--pico-border-width) solid var(--pico-table-border-color);
}

.chat-item:nth-child(even) {
    background-color: var(--pico-table-row-stripped-background-color);
}

.chat-actions,
.asset-actions {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
}

/** Message page */

#chat-messages {
    margin-bottom: 2rem;
}

.message {
    padding-block: 1rem;
    border-bottom: var(--pico-border-width) solid var(--pico-table-border-color);
}

.message:nth-child(even) {
    background-color: var(--pico-table-row-stripped-background-color);
}

.message p:only-child {
    margin-bottom: 0;
}

.message .attachments {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.message .attachments img {
    max-width: 200px;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 5px;
}

.post-message-attachments {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.post-message-attachments .attachment {
    display: inline-block;
    max-width: 100px;
}

.post-message-attachments img.attachment {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 5px;
}

.chat-message-entry {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.chat-message-entry textarea {
    height: 10rem;
}

.chat-message-actions {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/** Assets */

.asset-preview {
    margin-block-start: 1rem;
    display: flex;
    align-items: center;
}

.asset-preview img {
    max-width: calc(min(800px, 100%));
    margin-inline: auto;
}