/*
 * TechCraft CZ/SK - forum stylesheet
 * Imported from main.css. Everything that belongs to the discussion forum
 * lives here: section cards, thread lists, posts, reactions, the BBCode
 * editor and the markup produced by the server side renderer.
 *
 * The palette, the radii and the typography come from the custom properties
 * declared in the :root block of main.css - never redeclare them here.
 */

/* ------------------------------------------------------------- Forum hero */

.forum-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
    padding: 1.35rem 1.5rem;
    background: linear-gradient(180deg, var(--panel-alt), var(--panel));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.forum-hero > div {
    min-width: 0;
}

.forum-hero h1,
.forum-hero h2 {
    margin: 0;
    font-size: 1.5rem;
}

.forum-hero p {
    margin: 0.35rem 0 0 0;
    max-width: 62ch;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.forum-hero__stats {
    display: flex;
    align-items: stretch;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.forum-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.1rem;
    min-width: 6.5rem;
    padding: 0.6rem 0.9rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.forum-stats {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.forum-stat--accent {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.forum-stat__value {
    color: var(--text-strong);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
}

.forum-stat--accent .forum-stat__value {
    color: var(--accent);
}

.forum-stat__label {
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ---------------------------------------------------------- Section cards */

/*
 * Standalone cards in the same rhythm as the dashboard stream instead of one
 * long table. The internal section is marked by its badge only, it used to
 * shout with a dashed accent frame.
 */
.forum-sections {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.forum-section-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) minmax(0, 17rem);
    gap: 1rem 1.35rem;
    align-items: center;
    padding: 1.15rem 1.35rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.forum-section-card:hover {
    border-color: var(--accent);
    background: var(--panel-hover);
}

.forum-section-card.is-locked .forum-section-card__name {
    color: var(--text-dim);
}

.forum-section-card__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.forum-section-card__last-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.forum-section-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    border: 1px solid rgba(227, 79, 14, 0.35);
    color: var(--accent);
    flex: none;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.forum-section-card__icon svg {
    width: 22px;
    height: 22px;
}

.forum-section-card:hover .forum-section-card__icon {
    transform: translateY(-2px);
    background: rgba(227, 79, 14, 0.22);
}

.forum-section-card__body {
    min-width: 0;
}

.forum-section-card__name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--text-strong);
    font-size: 1.03rem;
    font-weight: 600;
    line-height: 1.35;
}

a.forum-section-card__name:hover {
    color: var(--accent);
}

.forum-section-card__desc {
    margin-top: 0.15rem;
    color: var(--text-dim);
    font-size: 0.87rem;
}

.forum-section-card__counts {
    display: flex;
    align-items: center;
    gap: 0.35rem 0.9rem;
    flex-wrap: wrap;
    margin-top: 0.45rem;
    color: var(--text-dim);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.forum-section-card__counts span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.forum-section-card__counts strong {
    color: var(--text-strong);
    font-weight: 700;
}

.forum-section-card__last {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    padding-left: 1.25rem;
    border-left: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.78rem;
    line-height: 1.5;
}

.forum-section-card__last a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forum-section-card__last .avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius);
    image-rendering: pixelated;
    flex: none;
}

.forum-section-card__last-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    color: var(--text);
    font-weight: 600;
}

.forum-section-card__last-link:hover {
    color: var(--accent);
}

.forum-section-card__last-link > span {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.35;
    overflow: hidden;
}

.forum-section-card__last-link strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    font-weight: 600;
}

.forum-section-card__last-link small {
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.forum-section-card__excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0.35rem 0 0 0;
    overflow: hidden;
    color: var(--text-dim);
    font-size: 0.76rem;
    font-style: italic;
    line-height: 1.45;
}

/* Legacy markup - the original three column section row. */

.forum-section {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.forum-section:last-child {
    border-bottom: 0;
}

.forum-section:hover {
    background: rgba(255, 255, 255, 0.02);
}

.forum-section__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent);
}

.forum-section__icon svg {
    width: 20px;
    height: 20px;
}

.forum-section__name {
    display: block;
    color: var(--text-strong);
    font-size: 1.02rem;
    font-weight: 600;
}

.forum-section__desc {
    color: var(--text-dim);
    font-size: 0.86rem;
}

.forum-section__meta {
    min-width: 190px;
    color: var(--text-dim);
    font-size: 0.78rem;
    text-align: right;
}

/* ------------------------------------------------------------ Thread list */

.thread-list {
    display: flex;
    flex-direction: column;
}

.thread-list .empty-state {
    padding: 2.5rem 1.25rem;
}

.thread-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 0.4rem 1rem;
    align-items: center;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.thread-item:last-child {
    border-bottom: 0;
}

.thread-item:hover {
    background: rgba(255, 255, 255, 0.025);
}

.thread-item__avatar {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--panel-alt);
    image-rendering: pixelated;
    overflow: hidden;
    flex: none;
}

.thread-item__avatar img,
.thread-item__avatar .avatar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    image-rendering: pixelated;
}

.thread-item__main {
    min-width: 0;
}

.thread-item__title {
    display: block;
    margin: 0;
    color: var(--text-strong);
    font-size: 0.99rem;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.thread-item__title a {
    color: inherit;
}

.thread-item__title a:hover,
a.thread-item__title:hover {
    color: var(--accent);
}

.thread-item__badges {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
}

.thread-item__badges:empty {
    display: none;
}

.thread-item__meta {
    display: flex;
    align-items: center;
    gap: 0.3rem 0.4rem;
    flex-wrap: wrap;
    margin: 0.2rem 0 0 0;
    color: var(--text-dim);
    font-size: 0.78rem;
}

.thread-item__meta strong {
    color: var(--text);
    font-weight: 600;
}

.thread-item__stats {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    justify-self: end;
    color: var(--text-dim);
    text-align: right;
}

.thread-item__stat {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-strong);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.thread-item__stat svg {
    color: var(--text-dim);
    flex: none;
}

.thread-item__stat small {
    color: var(--text-dim);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.thread-item.is-pinned {
    border-left-color: var(--accent);
    background: rgba(227, 79, 14, 0.04);
}

.thread-item.is-locked {
    color: var(--text-dim);
}

.thread-item.is-locked .thread-item__title {
    color: var(--text-dim);
}

.thread-item.is-hidden {
    border-style: dashed;
    border-color: var(--border-strong);
    opacity: 0.55;
}

/* Legacy markup - the original two column thread row. */

.thread-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.thread-row:last-child {
    border-bottom: 0;
}

.thread-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.thread-row__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--text-strong);
    font-weight: 600;
}

.thread-row__meta {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.thread-row__stats {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-align: right;
    white-space: nowrap;
}

/* ----------------------------------------------------------- Forum posts */

.forum-post {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    margin-bottom: 1.1rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    scroll-margin-top: calc(var(--header-height) + 1rem);
}

.forum-post.is-hidden {
    border-style: dashed;
    opacity: 0.55;
}

.forum-post:target {
    border-color: var(--accent);
    animation: forum-post-glow 2.8s ease-out 1;
}

@keyframes forum-post-glow {
    0% {
        box-shadow: 0 0 0 3px var(--accent-soft), 0 0 30px rgba(227, 79, 14, 0.45);
    }

    70% {
        box-shadow: 0 0 0 2px var(--accent-soft), 0 0 16px rgba(227, 79, 14, 0.2);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(227, 79, 14, 0);
    }
}

.forum-post__aside {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.25rem 1rem;
    background: var(--panel-alt);
    border-right: 1px solid var(--border);
    text-align: center;
    min-width: 0;
}

.forum-post__avatar-link {
    display: block;
    flex: none;
    line-height: 0;
    border-radius: var(--radius);
}

.forum-post__avatar-link:hover .forum-post__avatar {
    border-color: var(--accent);
}

.forum-post__avatar {
    display: block;
    width: 96px;
    height: 96px;
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-alt);
    image-rendering: pixelated;
    flex: none;
    transition: border-color 0.2s ease;
}

.forum-post__aside .forum-post__author,
.forum-post__aside a.forum-post__author {
    display: block;
    color: var(--text-strong);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.forum-post__aside a.forum-post__author:hover {
    color: var(--accent);
}

.forum-post__role {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.forum-post__stats {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    margin-top: 0.35rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.72rem;
    line-height: 1.5;
}

.forum-post__stats span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

/* Legacy markup - the aside used to be `.forum-post__author`. */

.forum-post > .forum-post__author {
    padding: 1.25rem 1rem;
    background: var(--panel-alt);
    border-right: 1px solid var(--border);
    text-align: center;
}

.forum-post > .forum-post__author img {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    background: var(--bg-alt);
    image-rendering: pixelated;
}

.forum-post__author-name {
    display: block;
    margin-top: 0.6rem;
    color: var(--text-strong);
    font-weight: 700;
}

.forum-post__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.1rem 1.25rem;
}

.forum-post__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    flex-wrap: wrap;
    padding-bottom: 0.7rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.8rem;
}

.forum-post__number {
    margin-left: auto;
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 0.78rem;
    text-align: right;
    white-space: nowrap;
}

.forum-post__number:hover {
    color: var(--accent);
}

.forum-post__body {
    flex: 1;
    min-width: 0;
    line-height: 1.7;
    word-break: break-word;
    overflow-wrap: anywhere;
}

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

.forum-post__body p {
    margin: 0 0 0.9rem 0;
}

.forum-post__body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.forum-post__signature {
    margin-top: 1rem;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--border);
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
}

.forum-post__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

.forum-post__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

.forum-post__footer .forum-post__actions {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.forum-post__actions form {
    display: inline-flex;
    margin: 0;
}

/* ------------------------------------------------------------- Reactions */

.reaction-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Every reaction is submitted by its own tiny form. */
.reaction-form,
.reaction-picker form {
    display: inline-flex;
    margin: 0;
}

/*
 * Reactions nobody left yet stay in the markup so that a click can update
 * them in place, they are only revealed once the visitor opens the bar.
 */
.reaction-form:has(> .reaction[hidden]) {
    display: none;
}

.reaction-form:has(> .reaction.is-empty) {
    display: none;
}

.reaction-bar.is-open .reaction-form:has(> .reaction.is-empty) {
    display: inline-flex;
    animation: reaction-in 0.15s ease;
}

.reaction-bar.is-open .reaction.is-empty {
    border-style: dashed;
    color: var(--text-dim);
}

@keyframes reaction-in {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
}

.reaction {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    height: 32px;
    min-width: 2.6rem;
    padding: 0 0.6rem;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.reaction:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: var(--panel-hover);
    color: var(--text-strong);
}

.reaction:active {
    transform: none;
}

.reaction[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.reaction.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.reaction__emoji {
    font-size: 1rem;
    line-height: 1;
}

.reaction__count {
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
}

/* Stands on its own, the button carries no `reaction` class of its own. */
.reaction-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    min-width: 2.2rem;
    padding: 0 0.55rem;
    background: transparent;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-dim);
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.reaction-add:hover {
    transform: translateY(-2px);
    background: var(--panel-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.reaction-add[aria-expanded="true"] {
    border-style: solid;
    border-color: var(--accent);
    color: var(--accent);
}

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

.reaction-picker {
    position: absolute;
    left: 0;
    bottom: calc(100% + 0.45rem);
    z-index: 30;
    display: none;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    max-width: min(20rem, calc(100vw - 3rem));
    padding: 0.4rem;
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.reaction-picker.is-open {
    display: flex;
}

.reaction-picker .reaction {
    height: 34px;
    min-width: 34px;
    padding: 0 0.4rem;
    background: transparent;
    border-color: transparent;
}

.reaction-picker .reaction:hover {
    background: var(--panel-hover);
    border-color: var(--accent);
}

:where(.reaction-bar, .forum-post__footer, .forum-post__actions):has(> .reaction-picker) {
    position: relative;
}

/* ---------------------------------------------------------------- Editor */

.editor {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.editor:focus-within {
    border-color: var(--accent);
}

.editor__toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: wrap;
    padding: 0.4rem 0.5rem;
    background: var(--panel-alt);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}

.editor__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.editor__button svg {
    width: 16px;
    height: 16px;
}

.editor__button:hover {
    background: var(--panel-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.editor__button.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

/*
 * A question asked inside a post.
 *
 * Set apart from the words around it with a panel of its own, because it is
 * the one part of a post which asks something of the reader rather than
 * telling them something.
 */
.poll {
    margin: 1.25rem 0;
    padding: 1rem 1.1rem;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.poll__question {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: var(--text-strong);
    font-size: 0.98rem;
}

.poll__terms {
    margin: 0.3rem 0 0;
    color: var(--text-dim);
    font-size: 0.78rem;
}

.poll__options {
    margin: 0.9rem 0 0;
    padding: 0;
    list-style: none;
}

.poll__options li + li {
    margin-top: 0.35rem;
}

/* The whole row answers to the pointer, not the twelve pixels of the box. */
.poll__option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.65rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.poll__option:hover {
    border-color: var(--border-strong);
}

.poll__option input {
    flex: none;
    accent-color: var(--accent);
}

.poll__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.9rem;
}

/* The sentence gives up the room first, so the button never wraps under it. */
.poll__actions .field__hint {
    flex: 1 1 12rem;
    margin: 0;
}

.poll__results {
    margin: 0.9rem 0 0;
    padding: 0;
    list-style: none;
}

.poll__result + .poll__result {
    margin-top: 0.65rem;
}

.poll__line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.85rem;
}

.poll__text {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text);
}

/* What this reader picked, marked so they can find their own answer again. */
.poll__result.is-mine .poll__text {
    color: var(--text-strong);
    font-weight: 600;
}

.poll__count {
    flex: none;
    color: var(--text-dim);
    font-size: 0.78rem;
    white-space: nowrap;
}

.poll__bar {
    display: block;
    height: 6px;
    margin-top: 0.3rem;
    overflow: hidden;
    background: var(--border);
    border-radius: 999px;
}

.poll__bar span {
    display: block;
    width: var(--share, 0%);
    height: 100%;
    background: var(--brand-grey);
    border-radius: inherit;
}

.poll__result.is-mine .poll__bar span {
    background: var(--accent);
}

.poll__quiet,
.poll__foot {
    margin: 0.9rem 0 0;
    color: var(--text-dim);
    font-size: 0.78rem;
}

.poll__foot {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border);
}

/* The question mark, drawn at the size the symbols beside it are drawn at. */
.editor__mark {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

/* The rows of the window which writes one. */
.poll-editor__row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.poll-editor__row + .poll-editor__row {
    margin-top: 0.4rem;
}

.poll-editor__row input {
    flex: 1 1 auto;
}

.poll-editor__drop {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    color: var(--text-dim);
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.poll-editor__drop:hover {
    color: var(--danger);
    border-color: var(--danger);
}


.editor__divider {
    width: 1px;
    height: 20px;
    margin: 0 0.3rem;
    background: var(--border-strong);
    flex: none;
}

.editor__tabs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.editor__tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 32px;
    padding: 0 0.7rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.editor__tab:hover {
    color: var(--text-strong);
    border-color: var(--border);
}

.editor__tab.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.editor__area {
    display: block;
    width: 100%;
    min-height: 12rem;
    padding: 1rem 1.1rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: var(--text-strong);
    font-family: var(--mono);
    font-size: 0.88rem;
    line-height: 1.65;
    resize: vertical;
}

.editor__area:focus {
    outline: none;
    border: 0;
    box-shadow: none;
}

.editor__preview {
    display: none;
    min-height: 12rem;
    padding: 1rem 1.1rem;
    border-top: 1px solid var(--border);
    line-height: 1.7;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/*
 * The contract asks for `.is-visible`; the script instead removes the
 * `hidden` attribute when the preview tab is selected - support both.
 */
.editor__preview.is-visible,
.editor.is-preview .editor__preview:not([hidden]),
.editor__preview:not([hidden]) {
    display: block;
}

.editor.is-preview .editor__area {
    display: none;
}

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

.editor__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.7rem 0.9rem;
    background: var(--panel-alt);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
}

.editor__hint {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin: 0;
    color: var(--text-dim);
    font-size: 0.74rem;
    line-height: 1.7;
}

/* Standalone hint strip at the bottom of the panel. */
.editor > .editor__hint {
    padding: 0.6rem 0.9rem;
    background: var(--panel-alt);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
}

.editor__hint code {
    padding: 0.05rem 0.35rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.72rem;
    white-space: nowrap;
}

.editor__hint kbd {
    display: inline-block;
    min-width: 1.4rem;
    padding: 0.05rem 0.35rem;
    background: var(--bg-alt);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: var(--radius);
    color: var(--text-strong);
    font-family: var(--mono);
    font-size: 0.7rem;
    text-align: center;
}

/* ---------------------------------------------------- BBCode markup output */

.markup-quote {
    margin: 0 0 1rem 0;
    padding: 0.7rem 1rem;
    background: var(--panel-alt);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text);
    font-size: 0.94rem;
}

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

.markup-quote__author {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--accent);
    font-size: 0.7rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.markup-quote .markup-quote {
    background: rgba(255, 255, 255, 0.03);
}

.markup-code {
    margin: 0 0 1rem 0;
    padding: 0.85rem 1rem;
    max-width: 100%;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-strong);
    font-family: var(--mono);
    font-size: 0.84rem;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    tab-size: 4;
}

.markup-list {
    margin: 0 0 1rem 0;
    padding-left: 1.4rem;
}

.markup-list li {
    margin-bottom: 0.3rem;
}

.markup-list li::marker {
    color: var(--accent);
}

.markup-heading {
    margin: 1.4rem 0 0.6rem 0;
    color: var(--text-strong);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.markup-heading:first-child {
    margin-top: 0;
}

.markup-spoiler {
    margin: 0 0 1rem 0;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.markup-spoiler > summary {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.9rem;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    list-style: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.markup-spoiler > summary::-webkit-details-marker {
    display: none;
}

.markup-spoiler > summary::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 6px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.2s ease;
}

.markup-spoiler[open] > summary::before {
    transform: rotate(90deg);
}

.markup-spoiler > summary:hover {
    background: var(--panel-hover);
    color: var(--accent);
}

.markup-spoiler__body {
    padding: 0.85rem 0.9rem;
    border-top: 1px solid var(--border);
    color: var(--text);
    font-size: 0.94rem;
}

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

.markup-underline {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.markup-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0.35rem 0;
    border-radius: var(--radius);
    transition: opacity 0.2s ease;
}

.markup-image:hover {
    opacity: 0.85;
}

/*
 * A name pointed at with an at sign: the face, then the name, as one link
 * to the profile - the at sign stays in what was typed, the face says it is
 * a person. Set in a small box of its own rather than underlined like the
 * links around it, so a sentence which names three people reads as three
 * people rather than three addresses. Its corners are the square-ish ones of
 * the rest of the portal, and so are the corners of the face.
 *
 * Written against the body it sits in because main.css comes after this
 * file and says what every link and every picture of a post looks like - a
 * face drawn as a block with a margin would break the line it is part of.
 */
:is(.post-body, .editor__preview) .mention {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.05rem 0.4rem 0.05rem 0.15rem;
    vertical-align: -0.2em;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent);
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    white-space: nowrap;
    transition:
        border-color 0.15s ease,
        color 0.15s ease;
}

:is(.post-body, .editor__preview) .mention:hover {
    border-color: var(--accent);
    color: var(--text-strong);
}

:is(.post-body, .editor__preview) .mention__face {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin: 0;
    border-radius: 2px;
}

/*
 * The list of accounts an at sign opens, which stands at the caret.
 *
 * A caption says what the list is and a line underneath says how it is
 * used, both small and quiet: the people in between are what it is for, and
 * only the people scroll.
 */
.mention-menu {
    min-width: 13rem;
    max-width: 17rem;
    padding: 0;
    overflow: hidden;
}

.mention-menu__head {
    flex: none;
    padding: 0.45rem 0.7rem 0.35rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.mention-menu__options {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.3rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mention-menu__options .select__option.is-active {
    color: var(--text-strong);
}

.mention-menu__hint {
    flex: none;
    padding: 0.35rem 0.7rem 0.4rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.7rem;
    white-space: nowrap;
}

/* ------------------------------------------------------------ Responsive */

@media screen and (max-width: 1024px) {
    .forum-section-card {
        grid-template-columns: 52px minmax(0, 1fr) 210px;
    }
}

@media screen and (max-width: 860px) {
    .forum-hero {
        padding: 1.1rem 1.1rem;
    }

    .forum-hero__stats {
        width: 100%;
    }

    .forum-stat {
        flex: 1 1 6.5rem;
    }

    .forum-section-card {
        grid-template-columns: 52px minmax(0, 1fr);
        gap: 0.75rem 1rem;
    }

    .forum-section-card__last {
        grid-column: 1 / -1;
        padding-left: 0;
        padding-top: 0.7rem;
        border-left: 0;
        border-top: 1px solid var(--border);
    }

    .forum-section,
    .forum-section-card--legacy {
        grid-template-columns: 40px 1fr;
    }

    .forum-section__meta {
        grid-column: 1 / -1;
        min-width: 0;
        text-align: left;
    }

    .forum-post {
        grid-template-columns: minmax(0, 1fr);
    }

    .forum-post__aside,
    .forum-post > .forum-post__author {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        flex-wrap: wrap;
        padding: 0.7rem 1rem;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        text-align: left;
    }

    .forum-post__avatar {
        width: 44px;
        height: 44px;
    }

    .forum-post > .forum-post__author img {
        width: 42px;
        height: 42px;
    }

    .forum-post__author-name {
        margin-top: 0;
    }

    .forum-post__stats {
        width: auto;
        flex-direction: row;
        gap: 0.75rem;
        margin: 0 0 0 auto;
        padding-top: 0;
        border-top: 0;
    }
}

@media screen and (max-width: 640px) {
    .forum-section-card,
    .forum-section {
        padding: 0.9rem 1rem;
    }

    .forum-section-card__icon {
        width: 44px;
        height: 44px;
    }

    .forum-section-card {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .thread-item {
        grid-template-columns: 40px minmax(0, 1fr);
        padding: 0.85rem 1rem;
    }

    .thread-item__stats {
        grid-column: 1 / -1;
        justify-self: start;
        gap: 1.25rem;
        padding-top: 0.5rem;
        border-top: 1px dashed var(--border);
        width: 100%;
    }

    .thread-item__stat {
        flex-direction: row;
        align-items: baseline;
        gap: 0.3rem;
        min-width: 0;
    }

    .thread-row {
        grid-template-columns: 1fr;
    }

    .thread-row__stats {
        text-align: left;
    }

    .forum-post__main {
        padding: 0.9rem 1rem;
    }

    .editor__area,
    .editor__preview {
        padding: 0.8rem 0.9rem;
    }

    .editor__tabs {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    /* Anchor the popover to the button so that it cannot leave the post. */
    .reaction-picker {
        left: auto;
        right: 0;
    }
}

/* Coarse pointers need comfortable tap targets in the toolbars and bars. */

@media (hover: none), (pointer: coarse), screen and (max-width: 640px) {
    .reaction,
    .reaction-add,
    .editor__button,
    .editor__tab {
        min-height: 40px;
        min-width: 40px;
    }

    .reaction-picker .reaction {
        height: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .forum-post:target {
        animation: none;
        box-shadow: 0 0 0 2px var(--accent-soft);
    }

    .reaction:hover,
    .forum-section-card:hover .forum-section-card__icon {
        transform: none;
    }
}

/* ------------------------------------------------------- Editor counter */

/*
 * Inside the editor the counter is a strip of its own between the text and
 * the formatting hint, it used to be squeezed against the left edge right
 * under the textarea.
 */
.editor > .char-counter {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    margin: 0;
    padding: 0.4rem 0.9rem;
    background: var(--panel-alt);
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.74rem;
}

.editor > .char-counter.is-invalid {
    color: var(--danger);
}

/* ---------------------------------------------------- Thread moderation */

/*
 * The moderation of a thread reads like a small control panel: one row of
 * cards, each one a single decision. Three of them are yes or no and are
 * drawn as the plain checkbox the rest of the portal uses; the fourth is
 * where the thread belongs, and stands beside them because it is the same
 * kind of thing - something about this thread which a moderator may change.
 *
 * Deleting is not among them. It is the one act here which cannot be undone,
 * so it sits in the head of the panel where every other screen keeps what it
 * can do, out of the reach of a hand aiming for a checkbox.
 */
.moderation {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    padding: 1.1rem 1.25rem;
    background: linear-gradient(180deg, var(--panel-alt), var(--panel));
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/*
 * The cards live in a row of their own rather than in a grid shared with the
 * heading. A heading spanning every column keeps the empty columns from
 * collapsing, and four cards then sit in six tracks with the right-hand
 * third of the panel empty behind them.
 */
.moderation__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: 0.85rem;
    align-items: stretch;
}

.moderation__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    flex-wrap: wrap;
}

.moderation__intro {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.moderation__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    color: var(--text-strong);
    font-size: 0.95rem;
}

.moderation__title .icon {
    color: var(--accent);
}

.moderation__hint {
    max-width: 62ch;
    margin: 0;
    color: var(--text-dim);
    font-size: 0.78rem;
    line-height: 1.5;
}

/*
 * One card of the row. The switch and the chooser share it so that the four
 * of them line up whatever the wording under each does, and so that a row
 * which wraps on a narrow screen wraps as four equal things.
 */
.moderation__toggle,
.moderation__move {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 5.1rem;
    padding: 0.35rem 0.9rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.moderation__toggle:hover,
.moderation__move:hover {
    border-color: var(--border-strong);
    background: var(--panel-hover);
}

.moderation__toggle .checkbox {
    flex: 1;
    min-width: 0;
}

.moderation__toggle .checkbox span {
    color: var(--text-strong);
    font-size: 0.86rem;
    font-weight: 600;
}

.moderation__toggle .checkbox span small {
    font-weight: 400;
}

/* The chooser stacks its label over the control, which is the only way a
   select and a checkbox come out the same height. */
.moderation__move {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 0.9rem;
}

.moderation__move > label {
    color: var(--text-strong);
    font-size: 0.86rem;
    font-weight: 600;
}

.moderation__move .select__button,
.moderation__move select {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    font-size: 0.86rem;
}
