/* The community forum, on its own site (docs/community.md). Its elements are Motor's, from app.css
   and console.css: buttons, fields, links, problems, and toasts. This file lays out the forum's
   own parts (the header, the menu of topics, the lists of threads, and the posts) from the same
   tokens. */

body.community {
    max-width: none;
    padding: 0;
}

.clip {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The header: the mark with "Motor Community", search, and the person's New thread and avatar. */
.community-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    /* Not the site header's space under it (app.css). */
    margin-bottom: 0;
    padding: 0.625rem 1.25rem;
    border-bottom: 2px solid var(--color-text);
}

.community-home {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: 17.5rem;
    color: var(--color-text);
    text-decoration: none;
}

/* The forum's mark: the rotors print over each other like inks, and each turns about its center,
   slowly, the middle one against the others, unless the person asked for less motion. */
.community-mark {
    display: block;
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
}

.community-mark g {
    mix-blend-mode: multiply;
    animation: rotor-turn linear infinite;
}

.community-mark .rotor-yellow {
    fill: var(--color-cadmium-yellow);
    transform-origin: 165px 225px;
    animation-duration: 40s;
}

.community-mark .rotor-cobalt {
    fill: var(--color-cobalt);
    transform-origin: 262px 160px;
    animation-duration: 28s;
    animation-direction: reverse;
}

.community-mark .rotor-rose {
    fill: var(--color-rose-madder);
    transform-origin: 270px 285px;
    animation-duration: 18s;
}

@keyframes rotor-turn {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .community-mark g {
        animation: none;
    }
}

.community-home span {
    font-family: var(--font-display);
    font-size: 1.3125rem;
    font-weight: 500;
}

.community-search {
    position: relative;
    flex: 1 1 15rem;
    max-width: 32.5rem;
}

.community-search svg,
.search-field svg {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    width: 1rem;
    height: 1rem;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--color-faint);
    stroke-width: 2;
    pointer-events: none;
}

.community-search input {
    width: 100%;
    padding-left: 2.25rem;
}

.community-you {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-left: auto;
}

.avatar {
    display: grid;
    flex: none;
    place-items: center;
    box-sizing: border-box;
    width: var(--field-height);
    height: var(--field-height);
    border: 2px solid var(--color-text);
    background: var(--color-cadmium-yellow);
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 700;
}

/* The menu at the left, and the page at its right. On a phone, the menu goes above the page. */
.community-frame {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.community-frame > main {
    flex: 999 1 35rem;
    min-width: 0;
    max-width: 60rem;
    box-sizing: border-box;
    padding: 1rem 1.5rem 3rem;
}

.community-menu {
    flex: 1 1 13.75rem;
    max-width: 16.25rem;
    box-sizing: border-box;
    min-height: calc(100vh - 3.75rem);
    padding: 0.75rem 0.625rem 2rem;
    border-right: 1px solid var(--color-line);
}

.community-menu h2 {
    display: flex;
    align-items: center;
    margin: 1.125rem 0 0.25rem;
    padding: 0 0.625rem;
    font-family: var(--font-sans);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--color-muted);
}

.community-menu h2 .link {
    margin-left: auto;
    padding: 0;
    font-size: 0.8125rem;
    letter-spacing: normal;
    text-transform: none;
}

.menu-link,
.menu-thread {
    display: flex;
    align-items: center;
    gap: 0.5625rem;
    min-height: 2rem;
    padding: 0 0.625rem;
    color: var(--color-text);
    font-size: 0.9375rem;
    font-weight: 400;
    text-decoration: none;
}

.menu-link:hover,
.menu-thread:hover {
    background: var(--color-surface);
}

.menu-link[aria-current="page"] {
    background: var(--color-surface);
    font-weight: 600;
}

.menu-topic summary {
    display: flex;
    align-items: center;
    list-style: none;
    cursor: pointer;
}

.menu-topic summary::-webkit-details-marker {
    display: none;
}

.menu-topic summary .menu-link {
    flex: 1;
    min-width: 0;
    padding-left: 0.125rem;
}

.chevron {
    display: grid;
    flex: none;
    place-items: center;
    width: 1.5rem;
    height: 2rem;
    color: var(--color-faint);
}

.chevron svg {
    width: 0.875rem;
    height: 0.875rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
}

.menu-topic summary:hover .chevron {
    color: var(--color-text);
}

.menu-topic[open] .chevron svg {
    transform: rotate(90deg);
}

.menu-topic[open] {
    margin-bottom: 0.375rem;
}

.menu-thread {
    min-height: 1.75rem;
    padding-left: 2.5625rem;
    font-size: 0.875rem;
}

.menu-thread.more {
    color: var(--color-muted);
    font-size: 0.8125rem;
}

.menu-note {
    margin: 0.125rem 0.625rem 0.125rem 2.5625rem;
    font-size: 0.8125rem;
    color: var(--color-faint);
}

/* The icons of the topics: the products' signs, and default ones, in the palette. */
.topic-icon {
    display: inline-flex;
    flex: none;
}

.topic-icon .icon {
    width: 0.875rem;
    height: 0.875rem;
}

.topic-icon .sign {
    fill: var(--fill);
}

.topic-icon .hole {
    fill: var(--color-background);
}

.topic-icon .hole-line {
    fill: none;
    stroke: var(--color-background);
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topic-icon .saw {
    stroke-linejoin: miter;
}

.topic-icon .ring {
    fill: none;
    stroke: var(--fill);
    stroke-width: 2.5;
}

.t-amp      { --fill: var(--color-cobalt); }
.t-gauss    { --fill: var(--color-vermilion); }
.t-piston   { --fill: var(--color-violet); }
.t-admin    { --fill: var(--color-turquoise); }
.t-meta     { --fill: var(--color-rose-madder); }
.t-demos    { --fill: var(--color-cadmium-yellow-line); }
.t-links    { --fill: var(--color-muted); }
.t-security { --fill: var(--color-text); }

/* The heading of a page. */
.page-heading {
    margin-bottom: 1.25rem;
}

.page-heading h1,
.thread-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.625rem;
    line-height: 1.2;
}

.page-heading h1 .icon {
    width: 1.375rem;
    height: 1.375rem;
}

.topic-note {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: var(--color-muted);
}

/* A list of threads: a row for each, with its topic, its title and latest reply, and when. */
.threads {
    margin-bottom: 1.375rem;
}

.threads-head,
.thread-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 8.25rem;
    align-items: center;
    gap: 0 1rem;
}

.threads-head.with-topic,
.thread-row.with-topic {
    grid-template-columns: 9.375rem minmax(0, 1fr) 8.25rem;
}

.threads-head {
    margin: 0;
    padding: 0 0.75rem 0.375rem;
    border-bottom: 2px solid var(--color-text);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--color-faint);
}

.thread-row {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-line);
    color: var(--color-text);
    font-weight: 400;
    text-decoration: none;
}

.thread-row:hover {
    background: var(--color-surface);
}

.row-topic {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    font-size: 0.875rem;
    color: var(--color-muted);
}

.row-main {
    min-width: 0;
}

.row-title {
    display: block;
    font-size: 1rem;
}

.row-last {
    display: block;
    font-size: 0.875rem;
    color: var(--color-muted);
}

.row-last strong {
    color: var(--color-text);
    font-weight: 600;
}

.row-when {
    font-size: 0.875rem;
    color: var(--color-muted);
    text-align: right;
    white-space: nowrap;
}

.threads-head .row-when {
    font-size: 0.75rem;
    color: var(--color-faint);
}

@media (max-width: 47.5rem) {
    .thread-row.with-topic,
    .thread-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .thread-row .row-topic {
        grid-column: 1 / -1;
    }

    .threads-head.with-topic {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .threads-head.with-topic > :first-child {
        display: none;
    }
}

.empty {
    padding: 0.75rem;
    color: var(--color-muted);
}

.list-foot {
    display: flex;
    gap: 1.5rem;
    margin: -0.625rem 0.75rem 1.375rem;
    padding-top: 0.875rem;
    font-size: 0.875rem;
    color: var(--color-muted);
}

.list-foot .older {
    margin-left: auto;
}

.sign-in-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-top: 1.125rem;
    padding: 0.875rem 1.125rem;
    border: 2px solid var(--color-frame);
}

.sign-in-note p {
    flex: 1 1 20rem;
    margin: 0;
    font-size: 0.9375rem;
}

/* A thread: its topic and starter, its title, and its posts. */
.thread-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.625rem;
    font-size: 0.875rem;
    color: var(--color-muted);
}

.thread-topic {
    display: flex;
    align-items: center;
    gap: 0.4375rem;
    color: var(--color-muted);
}

.thread-title {
    margin-top: 0.5rem;
}

.posts {
    margin-top: 1.25rem;
    border-top: 2px solid var(--color-text);
}

.post {
    display: grid;
    grid-template-columns: 2.125rem minmax(0, 1fr);
    gap: 0 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-line);
}

.post .avatar {
    width: 2.125rem;
    height: 2.125rem;
    background: var(--color-surface);
    font-size: 0.8125rem;
}

.post .avatar.agent {
    border-style: dashed;
    border-color: var(--color-violet);
    background: var(--color-background);
    color: var(--color-violet);
}

.who {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.5rem;
    font-size: 0.9375rem;
}

.who .flair {
    font-size: 0.875rem;
    color: var(--color-muted);
}

.who .when {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--color-faint);
    text-decoration: none;
}

.who .when:hover {
    text-decoration: underline;
}

/* A small mark after a name: OP, for the person who started the thread, and Agent. */
.mark {
    padding: 0 0.25rem;
    border: 1px solid var(--color-faint);
    color: var(--color-muted);
    font-size: 0.6875rem;
    font-weight: 700;
}

.mark.agent {
    border-style: dashed;
    border-color: var(--color-violet);
    color: var(--color-violet);
    text-transform: uppercase;
}

/* The rotor after the name of Motor staff, 3px after it everywhere. */
.rotor {
    flex: none;
    width: 0.8125rem;
    height: 0.8125rem;
    margin-left: 3px;
    fill: var(--color-text);
    vertical-align: -1px;
}

/* A post's Markdown. */
.prose {
    overflow-wrap: anywhere;
}

.prose > :first-child {
    margin-top: 0.25rem;
}

.prose > :last-child {
    margin-bottom: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote {
    margin: 0.5rem 0 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    margin: 0.75rem 0 0;
    font-size: 1.125rem;
}

.prose pre {
    margin: 0.5rem 0 0;
    padding: 0.625rem 0.875rem;
    overflow-x: auto;
    border-left: 4px solid var(--color-text);
    background: var(--color-surface);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.prose pre code {
    font-size: inherit;
}

.prose :not(pre) > code {
    padding: 0.0625rem 0.25rem;
    background: var(--color-surface);
}

.prose blockquote {
    padding-left: 0.875rem;
    border-left: 4px solid var(--color-line);
    color: var(--color-muted);
}

.prose table {
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.prose th,
.prose td {
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--color-line);
    text-align: left;
}

.prose img {
    max-width: 100%;
}

/* The reply form, and the form of a new thread. */
.reply {
    margin-top: 1.125rem;
}

.reply textarea,
.new-thread textarea {
    display: block;
    width: 100%;
    resize: vertical;
}

.new-thread {
    max-width: 47.5rem;
}

.new-thread .field.short select {
    width: 100%;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Search: a page of its own, with a way back, the topics at the left, and the results. */
.community-search-page {
    max-width: 77.5rem;
    margin: 0 auto;
    padding: 1rem 1.25rem 3rem;
    box-sizing: border-box;
}

.search-field {
    position: relative;
}

.search-field input {
    width: 100%;
    padding: 0 3rem 0 2.5rem;
    font-size: 1.125rem;
}

.search-field svg {
    width: 1.125rem;
    height: 1.125rem;
    left: 0.875rem;
}

/* The field's own ✕ goes back too, so the browser's clear button would be a second one. */
.search-field input::-webkit-search-cancel-button {
    appearance: none;
}

.search-field .clear {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    transform: translateY(-50%);
    color: var(--color-muted);
    font-size: 1.125rem;
    font-weight: 400;
    text-decoration: none;
}

.search-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.25rem 2rem;
    margin-top: 1rem;
}

.search-layout aside {
    flex: 1 1 12.5rem;
    max-width: 13.75rem;
}

.search-topics h2 {
    margin: 0 0 0.375rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--color-muted);
}

.search-topics a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2rem;
    padding: 0 0.5rem;
    color: var(--color-text);
    font-size: 0.9375rem;
    font-weight: 400;
    text-decoration: none;
}

.search-topics a:hover,
.search-topics a[aria-current] {
    background: var(--color-surface);
}

.search-topics a[aria-current] {
    font-weight: 600;
}

.results {
    flex: 999 1 35rem;
    min-width: 0;
}

.result {
    display: block;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--color-line);
    color: var(--color-text);
    font-weight: 400;
    text-decoration: none;
}

.result:hover {
    background: var(--color-surface);
}

.result-title,
.result-snippet {
    display: block;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.125rem 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-muted);
}

.result-meta > span:last-child {
    margin-left: 0.25rem;
    color: var(--color-faint);
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
}

.result-snippet {
    font-size: 0.875rem;
    color: var(--color-muted);
}

mark {
    padding: 0 0.125rem;
    background: var(--color-cadmium-yellow);
    color: var(--color-text);
}

/* The Edit of a person's own post, and its form in place of the post. */
.post-edit {
    font-size: 0.8125rem;
}

.post-edit-form {
    margin-top: 0.375rem;
}

.post-edit-form textarea {
    display: block;
    width: 100%;
    resize: vertical;
}

/* A thread's Move and Delete, for its starter and admins, small, at the right of the line above
   its title, and their forms. */
.thread-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.button.tiny {
    min-height: 1.75rem;
    padding: 0 0.625rem;
    border-width: 1.5px;
    box-shadow: 2px 2px 0 var(--color-line);
    font-size: 0.8125rem;
}

.thread-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.625rem 0.75rem;
    margin-top: 0.75rem;
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-faint);
}

.thread-panel .field {
    flex: 0 1 16.25rem;
    margin: 0;
}

.thread-panel .field select {
    width: 100%;
}

.thread-panel > a {
    align-self: center;
    font-size: 0.875rem;
}

.thread-panel.danger {
    align-items: center;
    border-color: var(--color-danger);
    background: var(--color-danger-surface);
}

.thread-panel.danger p {
    flex: 1 1 20rem;
    margin: 0;
}

.thread-panel .problem {
    flex: 1 0 100%;
}

.deleted-note {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--color-faint);
}

/* A badge that admins awarded keeps its own colours (docs/community.md). */
.community-badge {
    display: inline-block;
    padding: 0 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.125rem;
}

.b-ai_native_elder {
    background: var(--color-cadmium-yellow);
    color: #111;
}

.b-first_landing {
    background: var(--color-turquoise);
    color: #fff;
}

.b-bug_whisperer {
    background: var(--color-rose-madder);
    color: #fff;
}

.b-demo_day {
    background: var(--color-violet);
    color: #fff;
}

/* A post's reactions: a pill for each, pressed when it's the reader's, and the picker. */
.reactions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.reactions > form {
    display: contents;
}

.reaction {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    box-sizing: border-box;
    min-height: 1.75rem;
    padding: 0 0.5rem;
    border: 1px solid var(--color-line);
    background: var(--color-background);
    color: var(--color-text);
    font: inherit;
    font-size: 0.875rem;
}

button.reaction,
summary.reaction {
    cursor: pointer;
}

button.reaction:hover,
summary.reaction:hover {
    border-color: var(--color-text);
}

.reaction.mine {
    border-color: var(--color-cobalt);
    background: #e8eef8;
}

.reaction-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.reaction-picker > summary {
    list-style: none;
    color: var(--color-muted);
}

.reaction-picker > summary::-webkit-details-marker {
    display: none;
}

.reaction-picker svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* The picker floats below the button, from its left edge, over what's under it. */
.picker {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    z-index: 10;
    display: inline-flex;
    border: 1px solid var(--color-text);
    background: var(--color-background);
    box-shadow: var(--shadow);
}

.picker button {
    min-width: 2rem;
    min-height: 1.75rem;
    border: 0;
    background: transparent;
    font-size: 1rem;
    cursor: pointer;
}

.picker button:hover {
    background: var(--color-surface);
}

/* The avatar in the header opens the person's profile. */
a.avatar {
    text-decoration: none;
}

a.avatar:hover {
    background: var(--color-background);
}

/* The console's link to the page above (console.css), with more room under it. */
.community-narrow .crumbs,
.community-search-page .crumbs {
    margin-bottom: 1rem;
}

/* The profile: how the person appears on posts, and the form that changes it. */
.community-narrow {
    max-width: 47.5rem;
    margin: 0 auto;
    padding: 1rem 1.25rem 3rem;
    box-sizing: border-box;
}

.section-label {
    margin: 0 0 0.5rem;
    font: 500 0.8125rem var(--font-display);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
}

.profile-preview {
    margin-bottom: 1.5rem;
}

.profile-preview .post {
    border-top: 2px solid var(--color-text);
}

.profile-form input[type="text"] {
    width: 100%;
}

.badge-choices {
    display: grid;
    gap: 0.5rem;
    margin: 1.25rem 0;
    padding: 0;
    border: 0;
}

.badge-choices .hint {
    margin: 0 0 0.25rem;
}

.badge-choice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.625rem;
    cursor: pointer;
}

/* The admins' page: the topics, a topic's form, and the badges. */
.manage-section {
    margin-bottom: 2.5rem;
}

.manage-section > h2 {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
}

.manage-topic {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.manage-form {
    max-width: 47.5rem;
    margin-top: 1.5rem;
}

.manage-form h3 {
    margin: 0 0 0.75rem;
}

.manage-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0 1rem;
}

.manage-fields .field.wide {
    grid-column: 1 / -1;
}

.manage-fields input,
.manage-fields select {
    width: 100%;
}

.manage-delete {
    margin-left: auto;
}

.manage-badge {
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--color-line);
}

.manage-badge-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
}

.manage-badge-head .count {
    margin-left: auto;
    font-size: 0.875rem;
}

.manage-badge .holders {
    margin: 0.375rem 0 0;
    font-size: 0.875rem;
    color: var(--color-muted);
}

.award {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    margin-top: 0.625rem;
}

.award .field {
    flex: 0 1 20rem;
    margin: 0;
}

.award .field input {
    width: 100%;
}

.award .problem {
    flex: 1 0 100%;
}
