/* The room under a page.
   Same materials as the page: monospace, the site's orange for anything that is a control, hairline
   rules instead of boxes, and no animation that pretends to be progress. The mining indicator is text
   because it is a number, not a mood. */

/* This page scales its root font with the viewport — `html { font-size: calc(1vw + 1vh + 0.5vmin) }`,
   which is ~34px on a desktop window. So `rem` here is not 16px, and a room sized in rem came out
   1563px wide: a full-bleed strip instead of a column. Everything below is px on purpose. */
.room {
    /* The column is fixed in px (see above) but the type is not: this page's body is ~34px, and a 16px
       room beside it read like fine print. 0.58rem tracks the page's scale, clamped so it never gets
       tiny on a phone or absurd on a television. */
    font-size: clamp(15px, 0.58rem, 21px);
    margin: 32px auto 0;
    max-width: 720px;
    width: calc(100% - 32px);
    text-align: left;
    color: var(--room-ink, #fff);
}

.room__header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--room-rule, #333);
    padding-bottom: 8px;
}

.room__title {
    font-weight: bold;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 12.8px;
}

.room__meta,
.room__count {
    font-size: 11.52px;
    opacity: 0.65;
}

.room__count {
    margin-left: auto;
}

.room__list {
    padding: 12px 0 4px;
}

.room__empty,
.room__error {
    font-size: 12.8px;
    opacity: 0.7;
    padding: 8px 0;
}

.room__error {
    color: #ff6b6b;
    opacity: 1;
}

.room__message {
    padding: 8.8px 0 10.4px;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.12);
}

.room__message-head {
    display: flex;
    align-items: baseline;
    gap: 9.6px;
    font-size: 10.88px;
    letter-spacing: 0.05em;
    opacity: 0.75;
    margin-bottom: 4px;
}

.room__author {
    color: var(--room-accent, #ff6600);
}

.room__pow {
    margin-left: auto;
    opacity: 0.6;
}

.room__text {
    font-size: 13.76px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.room__composer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--room-rule, #333);
    padding-top: 12px;
    margin-top: 8px;
}

.room__input {
    width: 100%;
    resize: vertical;
    background: transparent;
    color: inherit;
    border: 1px solid var(--room-rule, #333);
    border-radius: 0;
    padding: 8px 9.6px;
    font-family: inherit;
    font-size: 13.76px;
    line-height: 1.45;
}

.room__input:focus-visible {
    outline: 2px solid var(--room-accent, #ff6600);
    outline-offset: 1px;
}

.room__send {
    align-self: flex-start;
    background: transparent;
    color: var(--room-accent, #ff6600);
    border: 1px solid var(--room-accent, #ff6600);
    border-radius: 0;
    padding: 6.4px 14.4px;
    font-family: inherit;
    font-size: 11.52px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
}

.room__send:hover:not(:disabled),
.room__send:focus-visible:not(:disabled) {
    background: var(--room-accent, #ff6600);
    color: #000;
}

.room__send:disabled {
    opacity: 0.45;
    cursor: progress;
}

.room__status {
    font-size: 11.52px;
    min-height: 1.1em;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
}

/* The white theme, when the page is in it: the room follows the page, not the other way round. */
[data-theme="light"] .room {
    --room-ink: #000;
    --room-rule: #d4d4d4;
    --room-accent: #b34700;
}

[data-theme="light"] .room__message {
    border-bottom-color: rgba(0, 0, 0, 0.12);
}

@media (max-width: 640px) {
    .room {
        margin-top: 20px;
    }

    .room__meta {
        flex-basis: 100%;
    }

    .room__count {
        margin-left: 0;
    }

    .room__pow {
        display: none;
    }
}

/* Sorting: New (chronological) or Top (most upvotes). Two small buttons rather than a dropdown, because
   the room is a chat and a chat's order should be one press away from changing. */
.room__sorting {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
}

.room__sort {
    background: none;
    border: 1px solid transparent;
    color: inherit;
    font: inherit;
    font-size: 0.68em;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 3px;
    opacity: 0.55;
    cursor: pointer;
}

.room__sort:hover,
.room__sort:focus-visible {
    opacity: 1;
}

.room__sort.is-on {
    opacity: 1;
    color: #00ff55;
    border-color: rgba(0, 255, 85, 0.45);
}

.room__count {
    margin-left: 0.5em;
}

/* Votes on a note. The count is the number of people, not the sum: two up and one down reads "2 / 1",
   which is what a reader can check, where "+1" hides how many disagreed. */
.room__votes {
    display: inline-flex;
    gap: 4px;
    margin-left: auto;
}

.room__vote {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    color: inherit;
    font: inherit;
    /* a thumb is an emoji and needs a font that has one, or the button shows a box */
    font-family: inherit, "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Twemoji Mozilla", sans-serif;
    font-size: 0.78em;
    line-height: 1;
    /* 34px tall: a thumb on a phone is a tap target, not a glyph */
    min-width: 46px;
    min-height: 30px;
    padding: 5px 9px;
    cursor: pointer;
    opacity: 0.75;
}

.room__vote:hover,
.room__vote:focus-visible {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.4);
}

.room__vote.is-mine {
    opacity: 1;
    border-color: rgba(255, 102, 0, 0.75);
    color: #ff6600;
}

/* The note's own id and text are copyable: a note is a Nostr event, and an event with no id to quote
   is a dead end. */
.room__note-id,
.room__copy {
    background: none;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    color: inherit;
    font: inherit;
    font-size: 0.64em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.02em;
    padding: 2px 5px;
    opacity: 0.6;
    cursor: pointer;
}

.room__note-id:hover,
.room__copy:hover,
.room__note-id:focus-visible,
.room__copy:focus-visible {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.45);
}

.room__copy.is-done {
    opacity: 1;
    color: #00ff55;
    border-color: rgba(0, 255, 85, 0.5);
}

.room__buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Mining is cancellable, and the cancel button says so in the same place the post button was. */
.room__cancel {
    background: none;
    border: 1px solid rgba(255, 107, 107, 0.6);
    border-radius: 3px;
    color: #ff6b6b;
    font: inherit;
    font-size: 0.72em;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 8px 14px;
    cursor: pointer;
}

.room__cancel:hover,
.room__cancel:focus-visible {
    background: rgba(255, 107, 107, 0.12);
}

.room__cancel:disabled {
    opacity: 0.45;
    cursor: default;
}
