/* ================================================
   COMMUNITY WALL v2 (pages/community.php)
   ================================================
   Loaded after css/subpages.css, which holds the original .wall-* rules this builds on
   (.wall-post, .wall-takeover and friends). Every rule here is scoped to the wall, so
   loading it can change nothing else on the site.

   Two constraints shaped it:
   - Phones first. The audience checks in at 3am from bed. Inputs are 16px (iOS zooms
     anything smaller on focus), tap targets are at least 40px, and nothing is wider
     than the screen at 360px.
   - The safety cards must be the loudest thing on the page, so nothing else uses red. */

.wall-section {
    padding: 2.5rem 0 3.5rem;
    background: var(--bg-secondary);
}

/* ---------- Live strip ---------- */

.wall-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr));
    gap: 0.75rem;
    margin: 0 0 0.5rem;
}

@media (min-width: 1024px) {
    .wall-strip {
        grid-template-columns: repeat(3, minmax(0, 17rem));
    }
}

/* Two to a row on a phone; a third card takes the row rather than sitting half-empty. */
@media (max-width: 1023px) {
    .wall-stat:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

.wall-stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.9rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.wall-stat-label {
    font-size: 0.72rem;
    font-weight: var(--weight-bold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.wall-stat-num {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.9rem;
    line-height: 1.1;
    color: var(--slate-dark);
    font-variant-numeric: tabular-nums;
}

.wall-stat-num.wall-stat-text {
    font-size: 1.15rem;
    line-height: 1.3;
}

.wall-stat-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.wall-strip-note {
    margin: 0 0 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.wall-jump {
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.wall-jump a {
    color: #8A5420;
    font-weight: var(--weight-bold);
}

/* ---------- Layout ---------- */

.wall-grid,
.wall-col {
    display: grid;
    gap: 1.5rem;
    align-content: start;
    min-width: 0;
}

@media (min-width: 1024px) {
    .wall-grid {
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
        align-items: start;
    }
}

/* ---------- Panels ---------- */

.wall-panel {
    min-width: 0;
    padding: 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* subpages.css gives the compose box its own width, margin and grey: inside the grid
   it is one panel among others. */
.wall-compose {
    max-width: none;
    margin: 0;
    background: var(--bg-primary);
}

.wall-panel-title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--slate-dark);
}

.wall-panel-note {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ---------- Fields and buttons ---------- */

.wall-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.wall-field {
    display: flex;
    flex: 1 1 8rem;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.wall-field-label {
    font-size: 0.8rem;
    font-weight: var(--weight-bold);
    color: var(--text-secondary);
}

.wall-control {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 16px;
}

.wall-control:focus-visible,
.wall-input:focus-visible {
    outline: 2px solid var(--bronze);
    outline-offset: 1px;
}

/* iOS zooms the page into any input under 16px. */
.wall-input {
    font-size: 16px;
}

.wall-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    margin-top: 0.9rem;
}

.wall-btn {
    min-height: 44px;
    padding: 0.55rem 1rem;
    border: 1px solid var(--bronze);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: #8A5420;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: var(--weight-bold);
    cursor: pointer;
}

.wall-btn:hover {
    background: rgba(184, 115, 51, 0.08);
}

.wall-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.wall-linkbtn {
    min-height: 36px;
    padding: 0.25rem 0;
    border: 0;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

.wall-linkbtn:hover {
    color: var(--text-primary);
}

.wall-readout {
    margin: 0.9rem 0 0;
    padding: 0.7rem 0.85rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-weight: var(--weight-medium);
    color: var(--slate-dark);
    font-variant-numeric: tabular-nums;
}

/* ---------- Chips ---------- */

.wall-scale,
.wall-tagset {
    min-width: 0;
    margin: 1rem 0 0;
    padding: 0;
    border: 0;
}

.wall-scale legend,
.wall-tagset legend {
    margin-bottom: 0.45rem;
    padding: 0;
    font-size: 0.88rem;
    font-weight: var(--weight-bold);
    color: var(--text-primary);
}

.wall-hint {
    font-size: 0.8rem;
    font-weight: var(--weight-normal);
    color: var(--text-muted);
}

.wall-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.wall-chip {
    position: relative;
    display: inline-flex;
}

/* The real input stays focusable and in the accessibility tree; the span is its face. */
.wall-chip input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.wall-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 40px;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.2;
    user-select: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.wall-scale .wall-chip span {
    padding: 0.35rem 0.6rem;
    font-variant-numeric: tabular-nums;
}

.wall-chip input:checked + span {
    border-color: var(--slate-dark);
    background: var(--slate-dark);
    color: #FFFFFF;
}

.wall-chip.is-symptom input:checked + span {
    border-color: #7A4A12;
    background: #7A4A12;
}

.wall-chip input:focus-visible + span {
    outline: 2px solid var(--bronze);
    outline-offset: 2px;
}

/* ---------- Note, disclosure, ticks ---------- */

.wall-label {
    margin-top: 1.1rem;
}

.wall-count {
    margin: 0.3rem 0 0;
    font-size: 0.8rem;
    text-align: right;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.wall-count.is-near {
    color: var(--burnt-sienna);
}

/* The honeypot: off-screen rather than display:none, which some bots skip. */
.wall-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.wall-disclose {
    margin: 1.1rem 0 0.6rem;
    padding: 0.8rem 0.9rem;
    border-left: 3px solid var(--bronze);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: rgba(184, 115, 51, 0.07);
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.wall-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0.6rem 0 0;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text-primary);
    cursor: pointer;
}

.wall-check input {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: var(--slate-dark);
}

.wall-check a {
    color: #8A5420;
    font-weight: var(--weight-bold);
}

.wall-check.is-missing span {
    color: #9B3A14;
    font-weight: var(--weight-medium);
}

.wall-compose-row {
    margin-top: 1.1rem;
}

.wall-send {
    width: 100%;
    margin-left: 0;
}

@media (min-width: 560px) {
    .wall-send {
        width: auto;
    }
}

.wall-status.is-error {
    color: #9B3A14;
}

.wall-safety {
    margin: 0.5rem 0 0;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    background: #FFF7EE;
    color: #7A4A12;
    font-size: 0.88rem;
    line-height: 1.45;
}

/* ---------- Safety cards (999 / support) ---------- */
/* subpages.css draws .wall-takeover; these add the heading, the call buttons and the
   calmer support variant. */

.wall-takeover {
    margin: 0;
}

.wall-takeover:focus {
    outline: 3px solid #C0221B;
    outline-offset: 2px;
}

.wall-takeover h3 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    color: #7F1410;
}

.wall-takeover.is-support {
    border-color: #2D4E8A;
    border-left-color: #2D4E8A;
    background: #F1F5FF;
    color: #0E1B33;
}

.wall-takeover.is-support h3 {
    color: #2D4E8A;
}

.wall-takeover.is-support:focus {
    outline-color: #2D4E8A;
}

.wall-calls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.9rem 0 0;
}

.wall-call {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 48px;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-md);
    background: #C0221B;
    color: #FFFFFF;
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
}

.wall-call:hover,
.wall-call:focus {
    color: #FFFFFF;
    background: #9E1A14;
}

.wall-takeover.is-support .wall-call {
    background: #2D4E8A;
}

.wall-takeover.is-support .wall-call:hover {
    background: #213C6C;
}

.wall-takeover .wall-takeover-note {
    margin-top: 0.8rem;
    font-size: 0.88rem;
    font-weight: var(--weight-normal);
}

/* ---------- Group fasts ---------- */

.wall-group {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.wall-group:first-of-type {
    margin-top: 0.25rem;
    padding-top: 0;
    border-top: 0;
}

.wall-group-title {
    margin: 0 0 0.25rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--slate-dark);
}

.wall-group-when {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.45;
    font-weight: var(--weight-medium);
    color: var(--text-primary);
}

.wall-group-note {
    margin: 0.4rem 0 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.wall-group-meta {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.wall-countdown {
    font-weight: var(--weight-bold);
    color: var(--slate-dark);
    font-variant-numeric: tabular-nums;
}

.wall-join-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
}

.wall-join-btn[aria-pressed="true"] {
    background: var(--slate-dark);
    color: #FFFFFF;
}

.wall-join-btn[aria-pressed="true"]::before {
    content: "\2713\00a0";
}

.wall-group-sms {
    font-size: 0.9rem;
    font-weight: var(--weight-bold);
    color: #8A5420;
}

.wall-group-status {
    margin: 0.5rem 0 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.wall-group-status:empty {
    display: none;
}

/* ---------- The feed ---------- */

/* styles.css pads every <section> by 6rem; this one is a column inside the wall. */
.wall-read {
    padding: 0;
}

.wall-read .wall-title {
    font-size: 1.6rem;
}

.wall-read .wall-lede {
    margin-bottom: 1rem;
}

.wall-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 1rem;
}

.wall-filter {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: var(--weight-medium);
    text-decoration: none;
}

.wall-filter:hover {
    border-color: var(--slate-dark);
    color: var(--text-primary);
}

.wall-filter[aria-current="true"] {
    border-color: var(--slate-dark);
    background: var(--slate-dark);
    color: #FFFFFF;
}

.wall-feed {
    max-width: none;
}

.wall-feed.is-loading {
    opacity: 0.55;
}

.wall-post {
    box-shadow: var(--shadow-sm);
    overflow-wrap: anywhere;
}

.wall-daytag {
    font-size: 0.75rem;
    font-weight: var(--weight-medium);
    color: var(--text-muted);
}

.wall-metrics,
.wall-taglist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
}

.wall-metrics li {
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.wall-metrics b {
    color: var(--slate-dark);
}

.wall-taglist li {
    padding: 0.1rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.wall-taglist li.is-symptom {
    border-color: #E7C9A6;
    background: #FFF7EE;
    color: #7A4A12;
}

.wall-body {
    margin-top: 0.6rem;
    color: var(--text-primary);
    white-space: pre-line;
}

.wall-soft {
    margin: 0.6rem 0 0;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    background: #FFF7EE;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #7A4A12;
}

.wall-post-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
    margin-top: 0.5rem;
}

.wall-post-foot:empty {
    display: none;
}

.wall-post.is-mine {
    border-left-color: var(--bronze);
}

.wall-post.is-held {
    border-left-color: var(--deep-gold);
    background: #FFFBF3;
}

.wall-mine-badge {
    font-size: 0.78rem;
    font-weight: var(--weight-bold);
    color: #8A5420;
}

.wall-reportbox {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
}

.wall-reportbox-label {
    width: 100%;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.wall-reportbox button {
    min-height: 36px;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.wall-reportbox button:hover {
    border-color: var(--slate-dark);
}

.wall-post-note {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.wall-post.is-withdrawn > :not(.wall-post-head):not(.wall-post-foot) {
    display: none;
}

.wall-empty {
    border: 1px dashed var(--border-color);
    background: var(--bg-primary);
}

.wall-more {
    margin-top: 1rem;
}

/* ---------- House rules ---------- */

.wall-rules-section {
    padding: 0 0 4rem;
    background: var(--bg-secondary);
}

.wall-rules {
    max-width: 52rem;
    margin: 0 auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.wall-rules summary {
    padding: 1.1rem 1.25rem;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--slate-dark);
    cursor: pointer;
}

.wall-rules[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.wall-rules-body {
    padding: 0.25rem 1.25rem 1.4rem;
}

.wall-rules-body h3 {
    margin: 1.1rem 0 0.3rem;
    font-size: 1rem;
    color: var(--slate-dark);
}

.wall-rules-body p {
    margin: 0;
    line-height: 1.65;
    color: var(--text-secondary);
}

.wall-rules-body a {
    color: #8A5420;
    font-weight: var(--weight-bold);
}

/* The phone header is taller than the 100px scroll-padding styles.css allows for, so
   "Leave a check-in" and the jump links would land under it. */
@media (max-width: 768px) {
    #wall,
    #myfast,
    #wall-form,
    #groups,
    #wall-title,
    #rules,
    .wall-post {
        scroll-margin-top: 48px;
    }
}

@media (max-width: 480px) {
    .wall-section {
        padding-top: 1.75rem;
    }

    .wall-panel {
        padding: 1rem;
    }

    .wall-stat-num {
        font-size: 1.6rem;
    }

    .wall-rules summary,
    .wall-rules-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
