/* portal.css — the tester portal's page layouts (Tester-Portal-Redesign-Proposal-v1
   §5 to §8): the portal bar, the page shell, sections and the few cards, rows,
   the Community home's pieces, spaces, topics, Feedback's views, the report
   page, and the profile. Primitives both discussions and reports use (marks,
   posts, pills, the pager, the Composer) live in community.css. Token roles
   only (TPR-R01); rows separate by the hairline, never a box (TPR-R02). Dark
   only for now (D9): every value is a role, so a light set can follow. */

/* ============================================================================
   Portal bar (TPR-R04, §5.3) — under the site header, never sticky
   ========================================================================== */

.ptl-bar {
    background-color: var(--surface-page);
    border-bottom: 1px solid var(--border-hairline);
}

.ptl-bar__inner {
    display: flex;
    align-items: stretch;
    gap: var(--space-lg);
    min-height: 52px;
}

.ptl-tabs {
    display: flex;
    align-items: stretch;
    gap: var(--space-xs);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ptl-tabs > li {
    display: flex;
}

.ptl-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 44px;
    padding-inline: var(--space-md);
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.ptl-tab:hover {
    color: var(--text-primary);
}

/* The current place: weight and an underline, never color alone (LNK-R01). */
.ptl-tab[aria-current="page"] {
    color: var(--text-primary);
    font-weight: 650;
    border-bottom-color: var(--accent);
}

.ptl-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding-inline: var(--label-gap);
    border-radius: var(--radius-chip);
    background-color: var(--accent);
    color: var(--accent-contrast-text);
    font-size: var(--font-size--2);
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.ptl-bar__actions {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* The page-head Send feedback: shown below 768 px, where the bar drops it. */
.ptl-phone-only {
    display: none;
}

/* ============================================================================
   Page shell — portal pages sit close to the bar, not in a marketing band
   ========================================================================== */

.ptl-main {
    padding-block: var(--space-2xl) var(--space-3xl);
    min-width: 0;
}

.ptl-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
    min-width: 0;
}

.ptl-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-md) var(--space-lg);
    flex-wrap: wrap;
}

.ptl-head h1,
.ptl-title {
    font-size: var(--font-size-3);
    line-height: 1.25;
}

.ptl-head__text {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.ptl-lede {
    color: var(--text-secondary);
    max-width: var(--measure-prose);
}

.ptl-lede .author {
    font-weight: 600;
}

.ptl-lede a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.ptl-lede a:hover {
    text-decoration: underline;
}

.ptl-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.ptl-crumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.ptl-crumbs a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* The tester gate (P2F-R11): one copy, in the shell. */
.ptl-gate__line {
    color: var(--text-primary);
    font-size: var(--font-size-1);
}

/* Two columns from 1024 px: the content, and a narrow side column. */
.ptl-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--space-3xl);
    align-items: start;
}

.ptl-split--narrow-side {
    grid-template-columns: minmax(0, 1fr) 280px;
}

.ptl-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
    min-width: 0;
}

.ptl-col--tight {
    gap: var(--space-xl);
}

.ptl-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    min-width: 0;
}

/* A one-column page reads at the main column's width, not the frame's (the
   new-topic form; the report page until its side column lands in M4). */
.ptl-form {
    max-width: 44rem;
    min-width: 0;
}

.rpt-page {
    max-width: 52rem;
}

/* ============================================================================
   Sections, quiet lines, and the one card treatment (§8.4)
   ========================================================================== */

.ptl-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-width: 0;
}

.ptl-section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-md);
}

.ptl-section__head h2 {
    font-size: var(--font-size-1);
}

.ptl-section__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-xs) var(--space-lg);
}

.ptl-section__head a,
.ptl-more {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--accent);
    font-size: var(--font-size--1);
    font-weight: 600;
    text-decoration: none;
}

.ptl-section__head a:hover,
.ptl-more:hover {
    text-decoration: underline;
}

/* A one-line link-button inside a section head (Mark all as read is a POST). */
.ptl-linkbtn {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: var(--font-size--1);
    font-weight: 600;
    cursor: pointer;
}

.ptl-linkbtn:hover {
    text-decoration: underline;
}

.ptl-quiet {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.ptl-quiet a {
    color: var(--text-secondary);
}

/* Calm in-page lines: locked (FRM-R13), archived (FRM-R01), the edit refusal,
   and the draft-drift line — states in the page's voice, not warnings. */
.ptl-note {
    max-width: var(--measure-prose-max);
    padding: var(--space-sm) var(--space-md);
    border-inline-start: 3px solid var(--accent);
    background-color: var(--surface-raised);
    color: var(--text-primary);
    font-size: var(--font-size--1);
}

.ptl-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-container);
    background-color: var(--surface-raised);
    min-width: 0;
}

.ptl-card h2,
.ptl-card h3 {
    font-size: var(--font-size-0);
    font-weight: 650;
}

.ptl-card p {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

/* The pinned-announcement card: the one emphasized surface on the home (D6). */
.ptl-announce {
    gap: var(--space-md);
    padding: var(--space-xl);
    background:
        linear-gradient(180deg, var(--accent-surface), transparent 70%),
        var(--surface-raised);
    border-color: color-mix(in oklab, var(--accent) 35%, var(--border-hairline));
}

.ptl-announce__kicker {
    color: var(--accent);
    font-size: var(--font-size--1);
    font-weight: 650;
}

.ptl-announce h2 {
    font-size: var(--font-size-2);
    line-height: 1.2;
}

.ptl-announce h2 a {
    color: inherit;
    text-decoration: none;
}

.ptl-announce h2 a:hover {
    text-decoration: underline;
}

.ptl-announce .ptl-card__text {
    max-width: var(--measure-prose);
    color: var(--text-secondary);
    font-size: var(--font-size-0);
}

.ptl-signed {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs) var(--space-sm);
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

/* ============================================================================
   Rows (§8.3) — the hairline and padding separate them; the whole row is one
   link (the single-destination rule)
   ========================================================================== */

.ptl-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ptl-list > li + li {
    border-top: 1px solid var(--border-hairline);
}

.ptl-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: var(--space-md);
    align-items: start;
    min-height: 48px;
    padding: var(--space-md) var(--space-sm);
    margin-inline: calc(-1 * var(--space-sm));
    border-radius: var(--radius-control);
    color: var(--text-primary);
    text-decoration: none;
}

a.ptl-row:hover {
    background-color: var(--surface-hover);
}

.ptl-row--mark {
    grid-template-columns: 24px minmax(0, 1fr) auto;
}

.ptl-row--mark > .mm {
    margin-top: var(--space-xs);
}

.ptl-row--plain {
    grid-template-columns: minmax(0, 1fr) auto;
}

.ptl-row__body {
    min-width: 0;
}

.ptl-row__title {
    display: block;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* The meta line: each item leads with its separator, and the first one on
   every line falls in the clipped band, so a wrapped line never starts with a
   dot (§8.3). The dot sits in the item's own padding, so text that wraps
   inside an item is never clipped. */
.ptl-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: var(--space-xs);
    margin-top: var(--space-xs);
    margin-inline-start: -1.5em;
    clip-path: inset(0 0 0 1.5em);
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.ptl-row__meta > * {
    position: relative;
    padding-inline-start: 1.5em;
    overflow-wrap: anywhere;
}

.ptl-row__meta > *::before {
    content: "\00B7";
    position: absolute;
    inset-inline-start: 0;
    width: 1.5em;
    text-align: center;
    color: var(--divider);
}

.ptl-row__meta .author {
    font-weight: 600;
}

.ptl-row__end {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-xs);
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    white-space: nowrap;
}

/* New since the reader's last visit: a dot, heavier weight, and real text for
   assistive tech, never color alone (TPR-R08). */
.ptl-row--new .ptl-row__title {
    font-weight: 650;
}

.ptl-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-inline-end: var(--space-sm);
    border-radius: var(--radius-chip);
    background-color: var(--accent);
    vertical-align: 0.1em;
}

.ptl-newcount {
    color: var(--accent);
    font-weight: 650;
}

/* Kind tile: the icon square at the start of an update or space row. */
.ptl-kind {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-container);
    background-color: var(--surface-hover);
    color: var(--icon-active);
}

.ptl-kind--reply { background-color: var(--accent-surface); color: var(--accent); }
.ptl-kind--fixed { background-color: var(--status-success-surface); color: var(--status-success-text); }
.ptl-kind--build { background-color: var(--status-warning-surface); color: var(--status-warning-text); }
.ptl-kind--status { background-color: var(--status-info-surface); color: var(--status-info-text); }

/* The group label above a space's pinned topics (TPR-R17). */
.ptl-group {
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    font-weight: 650;
}

/* An honest empty state with at most one action (TPR-R15). */
.ptl-empty {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-xs) var(--space-md);
    color: var(--text-secondary);
}

/* ============================================================================
   The Community home's side pieces (§5.1)
   ========================================================================== */

.ptl-tally {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-sm);
    margin: 0;
}

.ptl-tally > div {
    display: flex;
    flex-direction: column;
}

.ptl-tally dt {
    order: 2;
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.ptl-tally dd {
    order: 1;
    margin: 0;
    font-size: var(--font-size-2);
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.ptl-builds {
    display: grid;
    gap: var(--space-sm);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--font-size--1);
}

.ptl-builds li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-xs) var(--space-sm);
}

.ptl-builds b,
.ptl-builds a {
    color: var(--text-primary);
    font-weight: 600;
}

.ptl-builds a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    text-decoration: none;
}

.ptl-builds a:hover {
    text-decoration: underline;
}

/* A section in the side column reads one step quieter than the main column's. */
.ptl-side__section {
    padding-inline: var(--space-xs);
}

.ptl-side__section .ptl-section__head h2 {
    font-size: var(--font-size-0);
}

/* The welcome line points to the guide where it is: beside the content while
   the columns sit side by side, below it once they stack (the 1023 px rule). */
.ptl-when-stacked {
    display: none;
}

/* A one-button form inside a line of links (Mark all as read). */
.ptl-inlineform {
    display: inline-flex;
}

/* ============================================================================
   A member's profile (WF-77) — the large mark beside the handle, then two lists
   ========================================================================== */

.ptl-profile {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: var(--space-lg);
    align-items: center;
}

.ptl-profile__text {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    min-width: 0;
}

.ptl-profile__text .ptl-title {
    overflow-wrap: anywhere;
}

.ptl-taglist {
    margin: var(--space-xs) 0 0;
    padding: 0;
    list-style: none;
}

/* Shared reports beside recent topics; one column below 768 px. */
.ptl-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3xl);
    align-items: start;
}

.ptl-builds span {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ============================================================================
   Topics (§6.3) — the head, the jump, the reply zone
   ========================================================================== */

.ptl-lockctl {
    display: inline;
}

/* An administrator's topic controls: close or reopen, and pin or unpin, in one row. */
.ptl-modctl {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-md);
}

.ptl-replyzone {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-hairline);
}

/* ============================================================================
   Feedback (§6.4) — Mine and Shared, the filters
   ========================================================================== */

.ptl-views {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin: 0;
    padding: 0;
    list-style: none;
    border-bottom: 1px solid var(--border-hairline);
}

.ptl-views a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-inline: var(--space-md);
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    text-decoration: none;
}

.ptl-views a:hover {
    color: var(--text-primary);
}

/* The current view: weight and a rule, never color alone. */
.ptl-views a[aria-current="page"] {
    color: var(--text-primary);
    font-weight: 650;
    border-bottom-color: var(--accent);
}

.ptl-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.ptl-filters__group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
}

/* Filter chips are links (shareable views): no underline, and a 24 px floor (TPR-R07). */
.ptl-filters .chp {
    min-height: 24px;
    text-decoration: none;
}

.ptl-filters__label {
    min-width: 4.5rem;
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

/* ============================================================================
   The report page (§6.4) — tags, the report's own text, signals, controls
   ========================================================================== */

.ptl-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs) var(--space-sm);
}

.ptl-tag {
    display: inline-flex;
    align-items: center;
    padding: 0 var(--space-sm);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-chip);
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    line-height: var(--line-height-body);
    white-space: nowrap;
}

.ptl-tag a {
    color: inherit;
}

/* The author line keeps its mark beside the words on a phone; the words wrap. */
.rpt-by {
    flex-wrap: nowrap;
    font-size: var(--font-size-0);
}

.rpt-by > span:last-child {
    min-width: 0;
}

.rpt-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: var(--measure-prose);
    min-width: 0;
}

/* The author's own controls: a quiet line under the report text (TPR-R44). */
.rpt-own {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs) var(--space-md);
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.rpt-own a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--text-secondary);
}

.rpt-vis > summary {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    color: var(--text-secondary);
    font-size: var(--font-size--1);
    cursor: pointer;
}

.rpt-vis__body {
    margin-top: var(--space-sm);
    padding: var(--space-md);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-container);
    background-color: var(--surface-raised);
}

/* The signal block (§8.4's third card): where a tester acts on a report. Its
   relabeling and setup prefill are M4; the block keeps today's controls. */
.sig {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-lg);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-container);
    background-color: var(--surface-raised);
}

.sig__form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.sig__pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
}

.sig__pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 40px;
    padding-inline: var(--space-lg);
    border: 1px solid var(--divider);
    border-radius: var(--radius-chip);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
}

button.sig__pill {
    cursor: pointer;
}

button.sig__pill:hover {
    background-color: var(--surface-hover);
}

/* Pressed reads by fill, border, and aria-pressed, not color alone. */
.sig__pill--pressed {
    background-color: var(--accent-surface);
    border-color: var(--accent);
    color: var(--accent);
}

.sig__pill--static {
    min-height: 32px;
    color: var(--text-secondary);
    font-weight: 500;
}

.sig__retract {
    min-height: 24px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--font-size--1);
    text-decoration: underline;
    cursor: pointer;
}

.sig__lines {
    display: grid;
    gap: var(--space-sm);
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--text-secondary);
    font-size: var(--font-size--1);
}

.sig__lines li {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: var(--space-sm);
    align-items: center;
}

.sig__lines .author {
    font-weight: 600;
}

/* ============================================================================
   Tablet and phone
   ========================================================================== */

@media (max-width: 1023px) {
    .ptl-split,
    .ptl-split--narrow-side {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-2xl);
    }

    .ptl-when-split {
        display: none;
    }

    .ptl-when-stacked {
        display: inline;
    }
}

@media (max-width: 767px) {
    .ptl-bar__inner {
        gap: 0;
    }

    /* The three tabs share the bar's width equally, 44 px tall (§5.3). */
    .ptl-tabs {
        flex: 1;
        gap: 0;
    }

    .ptl-tabs > li {
        flex: 1 1 0;
        min-width: 0;
    }

    .ptl-tab {
        width: 100%;
        justify-content: center;
        gap: var(--space-xs);
        padding-inline: var(--space-xs);
    }

    .ptl-bar__actions {
        display: none; /* Send feedback moves into the page head (TPR-R04) */
    }

    .ptl-phone-only {
        display: inline-flex;
    }

    .ptl-main {
        padding-block: var(--space-xl) var(--space-2xl);
    }

    .ptl-head h1,
    .ptl-title {
        font-size: var(--font-size-2);
    }

    /* Each page's primary button runs full width at 44 px (§8.7). */
    .ptl-head .btn {
        width: 100%;
        min-height: 44px;
    }

    /* An earlier page's Reply, and every action the reply zone holds (TPR-R07). */
    .ptl-replyzone .btn,
    .pst__confirm .btn,
    .rpt-vis__body .btn {
        min-height: 44px;
    }

    .ptl-announce {
        padding: var(--space-lg);
    }

    .ptl-announce h2 {
        font-size: var(--font-size-1);
    }

    .ptl-announce .action-row .btn {
        flex: 1 1 100%;
        min-height: 44px;
    }

    /* A pill at a row's end drops under the title; a short time stays right. */
    .ptl-row--plain {
        grid-template-columns: minmax(0, 1fr);
    }

    .ptl-row--plain .ptl-row__end {
        grid-column: 1;
        flex-direction: row;
        align-items: center;
    }

    /* A row whose end is a short time keeps it at the right (a profile's topics). */
    .ptl-row--plain.ptl-row--timed {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .ptl-row--plain.ptl-row--timed .ptl-row__end {
        grid-column: auto;
        flex-direction: column;
        align-items: flex-end;
    }

    .ptl-pair {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-2xl);
    }

    .ptl-profile {
        grid-template-columns: 48px minmax(0, 1fr);
        gap: var(--space-md);
    }

    .ptl-profile .mm--64 {
        width: 48px;
        height: 48px;
        font-size: var(--font-size-1);
    }

    .ptl-views a,
    .ptl-filters .chp {
        min-height: 44px;
    }

    .ptl-filters__label {
        flex-basis: 100%;
    }

    .sig__pill {
        min-height: 44px;
    }

    .ptl-section__head a,
    .ptl-more,
    .ptl-linkbtn,
    .rpt-own a,
    .rpt-vis > summary {
        min-height: 44px;
    }
}
