/* ---------- Rooms ---------- */

.RoomPage,
.RoomCard,
.RoomCard > a,
.InviteBox,
.RoomJoinPending {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.RoomPage { gap: 1rem; }
.RoomPage > *, .RoomCard > a > *, .InviteBox > * { margin-block: 0; }

.RoomCard,
.RoomJoinPending {
    background-color: var(--surface);
    background-image: var(--surface-image);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 1rem;
    box-shadow: var(--shadow-card);
}

.RoomCard > a { color: var(--ink); }
.RoomCard:focus-within, .RoomCard:hover { box-shadow: var(--shadow-pop); }
.RoomCardTitle { font-weight: 640; font-size: 1.2rem; }
.RoomCardTopic, .RoomTopic { white-space: pre-wrap; overflow-wrap: anywhere; }
.RoomCardTitle, .RoomJoinRequestName { overflow-wrap: anywhere; }
.RoomCardVisibility, .RoomMessageTime { color: var(--muted); font-size: 0.8125rem; }

/* ---------- Messages ---------- */

.RoomMessageList,
.RoomJoinRequestList,
.RoomListCard {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.RoomMessageList > li { min-width: 0; }

.RoomMessage {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: fit-content;
    max-width: 78%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    border-end-start-radius: 0.25rem;
    background-color: var(--surface);
    background-image: var(--surface-image);
    box-shadow: var(--shadow-card);
}

.RoomMessageSender { font-weight: 600; overflow-wrap: anywhere; }
.RoomMessageBody { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.RoomMessageTime { align-self: flex-end; }

/* ---------- Composer ---------- */

.RoomComposeForm {
    position: fixed;
    inset-inline: var(--content-padding-inline);
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 10;
    margin: 0;
    background-color: var(--glass);
    box-shadow: var(--shadow-pop);
}

main:has(.RoomComposeForm) {
    padding-bottom: calc(var(--composer-height, 13rem) + 2rem + env(safe-area-inset-bottom));
}

body:has(.RoomComposeForm) .ScrollToTopButton {
    bottom: calc(var(--composer-height, 13rem) + 2rem + env(safe-area-inset-bottom));
}

.RoomComposeForm fieldset { border: 0; padding: 0; }
.RoomComposeForm legend { float: none; }

/* ---------- Invitations and membership ---------- */

.InviteBox { gap: 1rem; }
.InviteURL { overflow-wrap: anywhere; }
.InviteGrid { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.InviteMethodButton { flex: 1 1 8rem; text-align: center; }
.InviteBox > .Button { align-self: flex-start; }
.InviteMessage { resize: vertical; }
.InviteQR { max-width: 100%; }
.InviteQR canvas, .InviteQR svg, .InviteQR img { display: block; max-width: 100%; height: auto; }

.RoomJoinRequest {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
}

/* ---------- Small screens ---------- */

@media (max-width: 48rem), (max-height: 32rem) {
    .RoomMessage { max-width: 95%; }
    .RoomComposeForm { padding: 0.5rem; }
    .RoomComposeForm fieldset { flex: 1; }
    .RoomComposeForm { flex-direction: row; align-items: flex-end; }
    .RoomComposeForm > .SubmitButton { flex: none; }
}
