/* community.css — the primitives that discussions and reports share
   (Tester-Portal-Redesign-Proposal-v1 §9): the member mark and team badge, the
   post item and its actions and More menu, the "Replying to" line, status
   pills, the "new" divider, the pager, the Composer (CPS), tombstones (FRM-R12),
   the attachment strip (ATT), blockquotes in user content, and the /leaving
   interstitial (LVI). Page layouts live in portal.css; the report form keeps
   feedback.css. Token roles only (TPR-R01); no box around a row, post, or pager
   (TPR-R02). */

/* ============================================================================
   Leaving interstitial (LVI-R02/R03) — one decision, nothing competing
   ========================================================================== */

.lvi {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: var(--surface-page);
}

.lvi__main {
    flex: 1;
    width: min(38rem, 100% - 2 * var(--container-pad));
    margin-inline: auto;
    padding-block: var(--space-2xl);
}

/* The full destination, wrapped so "in full" and no-horizontal-scroll hold
   together (F-R15/PF-R03): break-anywhere, scheme+host emphasized. */
.lvi__url {
    overflow-wrap: anywhere;
    word-break: break-all;
    color: var(--text-secondary);
    background-color: var(--surface-raised);
    padding: var(--space-sm) var(--space-md);
    border-inline-start: 3px solid var(--accent);
    font-family: var(--font-mono, monospace);
    font-size: var(--font-size--1);
}

.lvi__url strong {
    color: var(--text-primary);
}

/* ============================================================================
   Icons (TPR-R09): the attributes set the floor, CSS only aligns them
   ========================================================================== */

.ico {
    display: inline-block;
    flex: none;
    vertical-align: -0.125em;
}

/* ============================================================================
   Names, the team badge, and the member mark (TPR-R05, R06, §8.5)
   ========================================================================== */

/* A handle in running text (the account page's community line). */
.handle {
    color: var(--text-primary);
    font-weight: 600;
}

.author {
    color: var(--text-primary);
    font-weight: 650;
    text-decoration: none;
    overflow-wrap: anywhere;
}

a.author:hover {
    text-decoration: underline;
}

/* "former member" stays italic secondary (§8.5). */
.author--former {
    color: var(--text-secondary);
    font-weight: 400;
    font-style: italic;
}

.team-badge {
    display: inline-flex;
    align-items: center;
    padding-inline: var(--space-sm);
    border-radius: var(--radius-chip);
    background-color: var(--accent-surface);
    color: var(--accent);
    font-size: var(--font-size--2);
    font-weight: 650;
    line-height: var(--line-height-body);
    white-space: nowrap;
}

/* The mark: the handle's first letter in a circle. Decoration only; the handle
   beside it carries the identity. */
.mm {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-chip);
    background-color: color-mix(in oklab, var(--mm-hue, var(--divider)) 30%, var(--surface-raised));
    color: var(--text-primary);
    font-size: var(--font-size-0);
    font-weight: 650;
    line-height: 1;
}

.mm--24 {
    width: 24px;
    height: 24px;
    font-size: var(--font-size--2);
}

.mm--32 {
    width: 32px;
    height: 32px;
}

.mm--64 {
    width: 64px;
    height: 64px;
    font-size: var(--font-size-2);
}

/* Six hues from the data-viz series roles (§8.5, §16: borrowed, not new roles). */
.mm--h1 { --mm-hue: var(--viz-series-1); }
.mm--h2 { --mm-hue: var(--viz-series-2); }
.mm--h3 { --mm-hue: var(--viz-series-3); }
.mm--h4 { --mm-hue: var(--viz-series-4); }
.mm--h5 { --mm-hue: var(--viz-series-6); }
.mm--h6 { --mm-hue: var(--viz-series-7); }

/* The team mark: the site's own L·S monogram on the header surface. */
.mm--team {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-header);
    box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 45%, transparent);
    font-size: var(--font-size--1);
}

.mm--team.mm--24 {
    font-size: var(--font-size--2);
}

.mm--team.mm--64 {
    font-size: var(--font-size-1);
}

.mm__l { color: var(--accent-secondary); }
.mm__s { color: var(--accent); }

/* ============================================================================
   Posts (§8.3): one flat stream, no boxes; the author leads, the body reads at
   full size within the reading measure
   ========================================================================== */

.pst-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.pst {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: var(--space-md);
    padding-block: var(--space-lg);
    border-top: 1px solid var(--border-hairline);
    min-width: 0;
}

.pst-list > .pst:first-child {
    border-top: 0;
    padding-top: 0;
}

/* A team post: the official tint, one mechanism (FRM-R15), no extra border. */
.pst--team {
    padding-inline: var(--space-md);
    margin-inline: calc(-1 * var(--space-md));
    border-top-color: transparent;
    border-radius: var(--radius-container);
    background-color: color-mix(in oklab, var(--accent) 7%, var(--surface-page));
}

.pst-list > .pst--team:first-child {
    padding-top: var(--space-lg);
}

.pst--team + .pst {
    border-top-color: transparent;
}

/* FRM-R09: the permalink arrival highlight. */
.pst:target {
    animation: pst-arrive var(--motion-highlight) var(--motion-ease);
}

@keyframes pst-arrive {
    from { background-color: var(--accent-surface); }
    to { background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .pst:target { animation: none; }
}

.pst__main {
    min-width: 0;
}

.pst__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-xs) var(--space-sm);
    line-height: 1.5;
}

/* The time is the permalink (TPR-R24). */
.pst__time {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    text-decoration: none;
}

.pst__time:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.pst__edited {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    font-style: italic;
}

.pst__body {
    max-width: var(--measure-prose);
    margin-top: var(--space-xs);
    min-width: 0;
}

/* Tombstones keep their place as one muted line (FRM-R12, §8.3). */
.pst--tomb {
    display: block;
    padding-block: var(--space-md);
}

.pst--tomb .tomb {
    display: block;
}

/* The edit-in-place and delete-confirm slots keep the stream's grid. */
.pst--editing {
    display: block;
}

.pst__confirm {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-inline-start: 3px solid var(--status-danger-border);
    background-color: var(--surface-raised);
    border-radius: var(--radius-container);
}

.pst__confirm-line {
    color: var(--text-primary);
    font-weight: 600;
}

/* ---- "Replying to" (TPR-R25, M3) ----------------------------------------- */

.pst__replyto {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    max-width: 100%;
    margin-top: var(--space-xs);
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.pst__replyto a {
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}

.pst__replyto a:hover {
    color: var(--text-primary);
}

.pst__replyto b {
    color: var(--text-primary);
    font-weight: 600;
}

/* ---- Actions: Reply and More (TPR-R07: 32 px, 44 px below 768 px) -------- */

.pst__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    margin-inline-start: calc(-1 * var(--space-sm));
}

.act {
    display: inline-flex;
    align-items: center;
    gap: var(--label-gap);
    min-height: 32px;
    padding-inline: var(--space-sm);
    border: 1px solid transparent;
    border-radius: var(--radius-chip);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--font-size--1);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.act:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

/* The More menu: a native disclosure (TPR-R26); items appear only when
   available, never as disabled ghosts. */
.pmenu {
    position: relative;
}

.pmenu > summary {
    list-style: none;
    min-width: 32px;
    justify-content: center;
}

.pmenu > summary::-webkit-details-marker {
    display: none;
}

.pmenu[open] > summary {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.pmenu__list {
    position: absolute;
    inset-inline-start: 0;
    top: calc(100% + var(--space-xs));
    z-index: var(--z-overlay);
    min-width: 12rem;
    margin: 0;
    padding: var(--space-xs);
    list-style: none;
    background-color: var(--surface-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-container);
}

.pmenu__item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 32px;
    padding-inline: var(--space-sm);
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: var(--font-size--1);
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}

.pmenu__item:hover {
    background-color: var(--surface-hover);
}

.pmenu__note {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding-inline: var(--space-sm);
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    font-style: italic;
}

.pmenu__form {
    display: block;
}

/* ============================================================================
   Status pills (TPR-R36): one shape, a tone and a dot, the word always present
   ========================================================================== */

.st {
    display: inline-flex;
    align-items: center;
    gap: var(--label-gap);
    padding: 0 var(--space-sm);
    border-radius: var(--radius-chip);
    background-color: var(--surface-hover);
    color: var(--text-primary);
    font-size: var(--font-size--1);
    font-weight: 600;
    line-height: var(--line-height-body);
    white-space: nowrap;
}

.st::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: var(--radius-chip);
    background-color: currentColor;
}

.st--new { background-color: var(--status-info-surface); color: var(--status-info-text); }
.st--ack { background-color: var(--accent-surface); color: var(--accent); }
.st--progress { background-color: var(--status-warning-surface); color: var(--status-warning-text); }
.st--fixed { background-color: var(--status-success-surface); color: var(--status-success-text); }
.st--closed { color: var(--text-secondary); }

/* ============================================================================
   "New since your last visit" (§8.6) — the divider above the first new post
   ========================================================================== */

.newline {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-block: var(--space-sm);
    color: var(--accent);
    font-size: var(--font-size--1);
    font-weight: 650;
}

.newline::before,
.newline::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: color-mix(in oklab, var(--accent) 55%, transparent);
}

.newline + .pst {
    border-top: 0;
}

/* ============================================================================
   Pager (TPR-R27): the quiet line for the portal; the bar where it stays
   ========================================================================== */

.pgl {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    text-align: center;
}

.pgl__line {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-inline-start: -1.5em;
    clip-path: inset(0 0 0 1.5em);
}

/* Each part leads with its separator; the first one on every line falls in the
   clipped band, so a wrapped line never starts with a dot. */
.pgl__line > * {
    position: relative;
    padding-inline-start: 1.5em;
}

.pgl__line > *::before {
    content: "\00B7";
    position: absolute;
    inset-inline-start: 0;
    width: 1.5em;
    text-align: center;
    color: var(--divider);
}

.pgl a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.pgl a:hover {
    text-decoration: underline;
}

.pgr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    padding-block: var(--space-xs);
    border-block: 1px solid var(--border-hairline);
}

.pgr__group {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.pgr__btn {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding-inline: var(--space-sm);
    border-radius: var(--radius-control);
    color: var(--accent);
    text-decoration: none;
}

.pgr__btn:hover {
    background-color: var(--surface-hover);
}

/* Inert ends stay at full size so the bar never shifts (the recorded exception
   to absent-not-disabled). */
.pgr__btn--off {
    color: var(--disabled-text);
    cursor: not-allowed;
}

.pgr__btn--off:hover {
    background: transparent;
}

.pgr__count {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

/* ============================================================================
   Tombstones (FRM-R12) — muted text on surface-page with the divider treatment
   ========================================================================== */

.tomb {
    color: var(--text-secondary);
    background-color: var(--surface-page);
    border-block: 1px solid var(--border-hairline);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size--1);
}

/* ============================================================================
   User content: a visible blockquote (TPR-R03), which the site lacked
   ========================================================================== */

.mdv blockquote {
    margin: 0;
    padding: var(--space-xs) var(--space-md);
    border-inline-start: 3px solid var(--divider);
    color: var(--text-secondary);
}

.mdv blockquote > * + * {
    margin-top: var(--space-sm);
}

/* ============================================================================
   Composer (CPS, TPR-R28) — the one editor; states replace it, never disable it
   ========================================================================== */

.cps {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: var(--space-md);
}

.cps--bare {
    display: block;
}

.cps__box {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-width: 0;
}

.cps__body {
    width: 100%;
    min-height: 8rem;
    resize: vertical;
}

/* "Reply as tapehead": the box's label reads at body size. */
.cps__as label {
    font-weight: 600;
}

.cps__preview {
    background-color: var(--surface-raised);
    border-inline-start: 3px solid var(--accent);
    padding: var(--space-sm) var(--space-md);
}

.cps__preview-label {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    margin-block-end: var(--space-xs);
}

.cps__count,
.cps__quota,
.cps__refile {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.cps__rate {
    color: var(--text-primary);
    background-color: var(--surface-raised);
    border-inline-start: 3px solid var(--accent);
    padding: var(--space-sm) var(--space-md);
}

.cps__replaced {
    color: var(--text-secondary);
    background-color: var(--surface-raised);
    padding: var(--space-sm) var(--space-md);
}

.cps__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm) var(--space-md);
}

.cps__cancel {
    color: var(--text-secondary);
    align-self: center;
}

/* The "Replying to" chip and its remove control (24 by 24, §8.7). */
.cps__chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    align-self: flex-start;
    max-width: 100%;
    padding-block: var(--space-xs);
    padding-inline: var(--space-md) var(--space-xs);
    border-radius: var(--radius-chip);
    background-color: var(--accent-surface);
    color: var(--text-primary);
    font-size: var(--font-size--1);
}

.cps__chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cps__chip a {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-chip);
    color: var(--text-secondary);
}

.cps__chip a:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

/* Attach files: a styled label for the native input, so it works with no
   script. The native input stays beside it with its button hidden, so a
   script-off picker still names the chosen files; once the enhanced picker
   takes over (site.js marks it), its chips report instead. */
.cps__attach {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs) var(--space-sm);
    min-width: 0;
}

.cps__files {
    min-width: 0;
    max-width: 100%;
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.cps__files::file-selector-button {
    display: none;
}

.cps__files:focus-visible {
    outline: none;
}

.cps__files:focus-visible + .cps__attach-label,
.cps__attach-label:has(+ .cps__files:focus-visible) {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

[data-att-enhanced] .cps__files {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.cps__attach-hint {
    flex-basis: 100%;
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

/* "Formatting help" in a disclosure, in place of the always-visible line. */
.cps__help {
    margin-inline-start: auto;
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.cps__help > summary {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    cursor: pointer;
    text-decoration: underline;
}

.cps__help > p {
    max-width: var(--measure-prose);
    margin-top: var(--space-xs);
}

/* ============================================================================
   Attachment strip (ATT-R05/R09) — quiet tiles, expand-in-place, honest states
   ========================================================================== */

.att {
    list-style: none;
    padding: 0;
    margin: var(--space-sm) 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: flex-start;
}

.att__item {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-sm);
    align-items: center;
    min-width: 0;
    max-width: 100%;
}

/* A file row reads as one quiet tile (§8.3: the hairline, no fill). */
.att__item--file {
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-container);
}

/* Open tiles take the full row so the expanded image has the measure. */
.att__item--tile:has(details[open]) {
    flex-basis: 100%;
}

.att__thumb-wrap {
    cursor: pointer;
    list-style: none;
    display: inline-block;
    line-height: 0;
}

.att__thumb-wrap::-webkit-details-marker {
    display: none;
}

/* Fixed 120px tiles — nothing reflows on load (F-R22's principle). */
.att__thumb {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-container);
    background-color: var(--surface-raised);
}

.att__full {
    display: block;
    max-width: 100%;
    height: auto;
    margin-block-start: var(--space-xs);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-container);
}

.att__name {
    color: var(--text-primary);
    font-size: var(--font-size--1);
    overflow-wrap: anywhere;
}

.att__meta {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    white-space: nowrap;
}

.att__action {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    font-size: var(--font-size--1);
}

.att__chip {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    background-color: var(--surface-raised);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-chip);
}

/* Staged-upload chips (the ATT-R08 enhanced picker, injected by site.js). */
.att--staged {
    margin-block-start: var(--space-xs);
}

.att__remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    min-height: 24px;
}

/* ============================================================================
   Phone (below 768 px): marks shrink, frequent targets reach 44 px (TPR-R07)
   ========================================================================== */

@media (max-width: 767px) {
    .pst {
        grid-template-columns: 32px minmax(0, 1fr);
        column-gap: var(--space-sm);
    }

    .pst .mm--36 {
        width: 32px;
        height: 32px;
    }

    .act,
    .pmenu__item,
    .pmenu__note,
    .cps__help > summary {
        min-height: 44px;
    }

    .pmenu > summary {
        min-width: 44px;
    }

    /* In flow on a phone, so the open menu can never run past the edge. */
    .pmenu__list {
        position: static;
        margin-top: var(--space-xs);
    }

    .pmenu[open] {
        flex-basis: 100%;
    }

    .cps {
        grid-template-columns: minmax(0, 1fr);
    }

    .cps > .mm {
        display: none;
    }

    .cps .btn {
        min-height: 44px;
    }

    .cps__help {
        margin-inline-start: 0;
    }

    .pgl a,
    .pgr__btn {
        min-height: 44px;
    }
}
