/*
 * The public After Hours community (js/community.js). Every rule here styles a
 * class js/community.js adds (all start with .ahc-), so a parity run, where the
 * script stands down, renders the design untouched. Colours are the design's
 * tokens (styles.css), so light and dark follow [data-theme] on their own;
 * bullish and bearish reuse the board's .positive and .negative.
 */

/* ---------------------------------------------------------------- the feed */

.ahc{margin-top:26px}
.ahc-toolbar{display:flex;align-items:flex-end;justify-content:space-between;gap:14px 24px;flex-wrap:wrap;border-bottom:1px solid var(--rule)}
.ahc-sorts{display:flex;gap:26px;flex-wrap:wrap}
.ahc-sorts button{font:600 22px/1 var(--display);letter-spacing:-.005em;color:var(--muted);padding:10px 0 12px;min-height:44px;border-bottom:2px solid transparent;margin-bottom:-1px}
.ahc-sorts button:hover{color:var(--ink)}
.ahc-sorts button[aria-pressed=true]{color:var(--ink);border-bottom-color:var(--accent)}
.ahc-window{display:flex;align-items:center;margin-right:auto;padding-bottom:9px}
.ahc-window[hidden]{display:none}
.ahc-window select{font:12px var(--sans);min-height:38px;padding:8px 30px 8px 12px;border:1px solid var(--rule);background:var(--panel);border-radius:0;max-width:100%}
.ahc-start{margin-bottom:12px}

.ahc-search{margin:20px 0 0}
.ahc-search input{width:100%;min-height:48px;padding:13px 15px;font-size:14px;border:1px solid var(--rule);background:var(--panel);border-radius:0}
.ahc-search input::placeholder{color:var(--muted)}

.ahc-spaces{display:flex;flex-wrap:wrap;gap:6px;margin:16px 0 4px}
.ahc-spaces button{font:10px/1.2 var(--mono);padding:8px 9px;min-height:34px;border:1px solid var(--rule);background:transparent;white-space:nowrap}
.ahc-spaces button:hover{border-color:var(--ink)}
.ahc-spaces button[aria-pressed=true]{background:var(--ink);border-color:var(--ink);color:var(--paper)}

.ahc-filter{display:flex;align-items:center;gap:6px 16px;flex-wrap:wrap;margin:14px 0 0;padding:10px 14px;background:var(--wash);font-size:13px;max-width:none}
.ahc-filter[hidden]{display:none}
.ahc-filter strong{font-weight:600}
.ahc-filter .text-button{padding:4px 0}
.ahc-status{margin:16px 0 10px}
.ahc-status.is-offline{color:var(--accent)}
.ahc-thread-page .ahc-status{margin:18px 0 30px}

/* "N new posts": rides at the top of the screen while the reader is down the list */
.ahc-new-wrap{position:sticky;top:94px;z-index:6;height:0;display:flex;justify-content:center;pointer-events:none}
.ahc-new{pointer-events:auto;margin-top:10px;font:11px var(--mono);letter-spacing:.02em;padding:11px 18px;min-height:40px;background:var(--ink);color:var(--paper);box-shadow:0 8px 24px rgb(0 0 0 / .18)}
.ahc-new:hover{background:var(--accent)}
.ahc-new[hidden]{display:none}

.ahc-list{outline:0}
.ahc-list.is-updating{opacity:.55}
.ahc-post{display:grid;grid-template-columns:44px minmax(0,1fr);gap:20px;padding:24px 0 20px;border-top:1px solid var(--rule)}
.ahc-list>.ahc-post:first-child{border-top-color:var(--ink)}
.ahc-list>.ahc-post:last-child{border-bottom:1px solid var(--rule)}
.ahc-post-body{min-width:0}
.ahc-title{font:600 30px/1.04 var(--display);letter-spacing:-.012em;margin:9px 0 8px;overflow-wrap:anywhere}
.ahc-title a:hover{color:var(--accent)}
.ahc-preview{font-size:14px;line-height:1.6;color:var(--muted);max-width:72ch;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}

/* meta line: space · $TICKER · view · @member · time */
.ahc-meta{display:flex;flex-wrap:wrap;align-items:center;gap:5px 14px;font-size:12px;line-height:1.4;color:var(--muted);max-width:none}
.ahc-sep{color:var(--rule)}
.ahc-space{font:inherit;color:var(--ink);padding:2px 0}
button.ahc-space:hover{color:var(--accent)}
.ahc-ticker{font:12px var(--mono);color:var(--ink);border-bottom:1px solid var(--rule);padding-bottom:1px}
.ahc-ticker:hover{border-bottom-color:currentColor}
.ahc-user{color:var(--ink);font-weight:600}
.ahc-user.is-deleted{color:var(--muted);font-weight:400}
.ahc-tag{display:inline-block;font:10px/1 var(--mono);letter-spacing:.06em;text-transform:uppercase;padding:4px 6px 3px;border:1px solid currentColor}
.ahc-tag-hidden{color:var(--muted)}
.ahc-meta time{white-space:nowrap}

/* actions: comments · share · report · delete */
.ahc-actions{display:flex;flex-wrap:wrap;align-items:center;gap:2px 22px;margin-top:12px}
.ahc-action{font:12px var(--sans);color:var(--muted);min-height:34px;padding:6px 0;display:inline-flex;align-items:center}
a.ahc-action:hover,button.ahc-action:hover{color:var(--accent)}
.ahc-action.is-static{color:var(--ink)}

/* vote rail */
.ahc-rail{display:flex;flex-direction:column;align-items:center;gap:1px;align-self:start}
.ahc-vote{width:38px;height:38px;display:grid;place-items:center;color:var(--muted);border:1px solid transparent}
.ahc-vote svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linejoin:round}
.ahc-vote:hover{color:var(--ink);background:var(--wash)}
.ahc-vote:focus-visible{outline-offset:1px}
.ahc-up[aria-pressed=true]{color:var(--accent)}
.ahc-down[aria-pressed=true]{color:var(--ink)}
.ahc-vote[aria-pressed=true] svg{fill:currentColor}
.ahc-score{font:600 21px/1 var(--display);font-variant-numeric:tabular-nums;min-width:2ch;text-align:center;padding:2px 0}
.ahc-rail[data-current="1"] .ahc-score{color:var(--accent)}
.ahc-rail.is-inline{flex-direction:row;gap:0;margin-right:6px}
.ahc-rail.is-inline .ahc-vote{width:32px;height:32px}
.ahc-rail.is-inline .ahc-vote svg{width:14px;height:14px}
.ahc-rail.is-inline .ahc-score{font:600 13px/1 var(--sans);padding:0 3px}
.ahc-rail.is-large .ahc-vote{width:44px;height:44px}
.ahc-rail.is-large .ahc-vote svg{width:20px;height:20px}
.ahc-rail.is-large .ahc-score{font-size:28px;padding:4px 0}

/* loading, empty and offline states */
.ahc-skeleton{display:grid;gap:12px;padding:26px 0 26px 64px;border-top:1px solid var(--rule)}
.ahc-skeleton span{display:block;height:12px;background:var(--wash);width:28%}
.ahc-skeleton span:nth-child(2){height:26px;width:72%}
.ahc-skeleton span:nth-child(3){width:54%}
.ahc-skeleton-lg{padding-left:0;border:0}
.ahc-skeleton-lg span:nth-child(2){height:54px}
.ahc-empty{padding:34px 0 36px;border-top:1px solid var(--ink)}
.ahc-empty h2,.ahc-empty h3{font:600 34px/1.02 var(--display);letter-spacing:-.012em;max-width:24ch}
.ahc-empty p{margin:14px 0 0;font-size:14px;line-height:1.65;color:var(--muted);max-width:52ch}
.ahc-empty-actions{display:flex;align-items:center;gap:12px 22px;flex-wrap:wrap;margin-top:22px}
.ahc-more{display:flex;justify-content:center;padding:26px 0 6px}
.ahc-more[hidden]{display:none}

/* ------------------------------------------------------------- the thread */

.ahc-detail{margin-top:8px}
.ahc-op{display:grid;grid-template-columns:52px minmax(0,1fr);gap:26px}
.ahc-op .ahc-rail{position:sticky;top:112px;padding-top:2px}
.ahc-op-body{min-width:0}
.ahc-op-heading h1{overflow-wrap:anywhere}
.ahc-op-text{padding:4px 0 26px;overflow-wrap:anywhere}
.ahc-op-text a,.ahc-c-text a{text-decoration:underline;text-underline-offset:3px;overflow-wrap:anywhere}
.ahc-op .ahc-actions{border-top:1px solid var(--rule);margin-top:0;padding-top:8px}
.ahc-missing h2{font-size:42px}

.ahc-comments{margin-top:44px;border-top:1px solid var(--ink);padding-top:26px}
.ahc-comments[hidden]{display:none}
.ahc-comments-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px 24px;flex-wrap:wrap}
.ahc-comments-head h2{font:600 38px/1 var(--display);letter-spacing:-.012em;outline:0}
.ahc-count{color:var(--muted);margin-left:6px}
.ahc-reply-sorts button{font-size:18px;padding:6px 0 8px;min-height:40px}
.ahc-comment-box{margin:22px 0 26px}
.ahc-reply-form{display:grid;gap:10px}
.ahc-reply-form label{font-size:12px;color:var(--muted)}
.ahc-reply-form label strong{color:var(--ink);font-weight:600}
.ahc-reply-form textarea{width:100%;min-height:118px;padding:13px 14px;font-size:15px;line-height:1.6;border:1px solid var(--rule);background:var(--panel);border-radius:0;resize:vertical}
.ahc-inline-reply{margin:10px 0 6px}
.ahc-inline-reply textarea{min-height:96px}
.ahc-form-row{display:flex;align-items:center;gap:10px 18px;flex-wrap:wrap}
.ahc-form-row .form-status{flex:1 1 220px}
.ahc-signin-prompt{padding:20px 22px;background:var(--wash)}
.ahc-signin-prompt p{font-size:14px;line-height:1.6}
.ahc-signin-prompt .ahc-empty-actions{margin-top:14px}
.ahc-tree-empty{padding:26px 0;border-top:1px solid var(--rule);color:var(--muted);font-size:14px}
/* "Showing the newest replies": a polite live region, always present, folded away while empty */
.ahc-truncated{margin:0 0 14px;padding:11px 14px;background:var(--wash);font-size:13px;line-height:1.6;color:var(--muted);max-width:none}
.ahc-truncated:empty{margin:0;padding:0;background:none}

/* nested comments: each level indents, with a guide line that folds the branch */
.ahc-tree{border-top:1px solid var(--rule);padding-top:6px}
.ahc-c{position:relative;padding:14px 0 2px 34px;outline:0}
.ahc-c .ahc-c{padding-top:12px}
.ahc-c-head{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;min-height:28px;font-size:12px;color:var(--muted);margin-left:-34px}
.ahc-c-toggle{flex:none;width:24px;height:24px;margin-right:6px;display:grid;place-items:center;border:1px solid var(--rule);font:14px/1 var(--mono);color:var(--muted)}
.ahc-c-toggle:hover{border-color:var(--ink);color:var(--ink)}
.ahc-c-guide{position:absolute;left:5px;top:44px;bottom:0;width:14px;cursor:pointer;background:linear-gradient(var(--rule),var(--rule)) center/1px 100% no-repeat}
.ahc-c-guide:hover{background-image:linear-gradient(var(--accent),var(--accent));background-size:2px 100%}
.ahc-c.is-collapsed>.ahc-c-guide{display:none}
.ahc-c-folded{color:var(--muted)}
.ahc-c-folded:before{content:'·';margin-right:8px;color:var(--rule)}
.ahc-c-folded[hidden]{display:none}
.ahc-op-badge{font:10px/1 var(--mono);letter-spacing:.06em;color:var(--accent);border:1px solid currentColor;padding:3px 5px 2px}
.ahc-c-text{font-size:15px;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere;max-width:72ch;margin:6px 0 2px}
.ahc-c-text.is-deleted{color:var(--muted);font-style:italic}
.ahc-c-actions{display:flex;align-items:center;flex-wrap:wrap;gap:0 16px;margin-left:-6px}
.ahc-c-actions .ahc-action{min-height:32px}
.ahc-new-tag{font:10px/1 var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--paper);background:var(--accent);padding:4px 6px 3px}
.ahc-c.is-target>.ahc-c-head,.ahc-c.is-target>.ahc-c-body>.ahc-c-self{background:var(--wash)}
@media(prefers-reduced-motion:no-preference){
  .ahc-c.is-new>.ahc-c-head,.ahc-c.is-new>.ahc-c-body>.ahc-c-self{animation:ahc-arrive 2.4s ease-out}
  .ahc-new{animation:ahc-drop .25s ease-out}
  .ahc-list{transition:opacity .2s}
}
@keyframes ahc-arrive{from{background:var(--wash)}to{background:transparent}}
@keyframes ahc-drop{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}

/* --------------------------------------------------------------- account */

.ahc-me{display:inline-flex;align-items:baseline;gap:10px;font-size:13px;font-weight:600;padding:10px 0}
.ahc-me:hover{color:var(--accent)}
.ahc-karma{font-weight:400;font-size:12px;color:var(--muted)}

/* --------------------------------------------------------------- dialogs */

.ahc-dialog{width:min(580px,calc(100% - 32px));padding:28px 30px 30px}
.ahc-dialog .dialog-heading{margin-bottom:20px}
.ahc-dialog .dialog-heading h2{font:600 34px/1 var(--display);letter-spacing:-.012em;overflow-wrap:anywhere}
.ahc-close{flex:none}
.ahc-public-note{padding:13px 15px;background:var(--wash);border-left:2px solid var(--accent);font-size:13px;line-height:1.6;margin-bottom:20px;max-width:none}
.ahc-gate-note,.ahc-reconnect-note,.ahc-draft-note{font-size:13px;line-height:1.6;color:var(--muted);margin-bottom:18px;max-width:none}
.ahc-reconnect-note{color:var(--accent)}
.ahc-draft-note .text-button{padding:0}
.ahc-compose-row{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:14px}
.ahc-compose-actions{display:flex;align-items:center;gap:10px 22px;flex-wrap:wrap}
.ahc-compose textarea{min-height:170px}
.ahc-draft-state{margin-top:-6px}

/* Bullish / Bearish / No view, as one segmented control */
.ahc-seg{border:0;padding:0;margin:0;min-width:0}
.ahc-seg legend{font-size:12px;padding:0;margin-bottom:8px}
.ahc-seg-options{display:flex;flex-wrap:wrap}
.form-stack .ahc-seg label{position:relative;display:inline-flex;align-items:center;gap:0;min-height:42px;padding:0 16px;margin-left:-1px;border:1px solid var(--rule);background:var(--panel);font-size:13px;cursor:pointer}
.form-stack .ahc-seg label:first-child{margin-left:0}
.form-stack .ahc-seg input{position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;opacity:0;cursor:pointer}
.form-stack .ahc-seg label:has(input:checked){background:var(--ink);border-color:var(--ink);color:var(--paper);z-index:1}
.form-stack .ahc-seg label:focus-within{outline:2px solid var(--accent);outline-offset:2px;z-index:2}

/* report reasons */
.ahc-reasons{border:0;padding:0;margin:0;display:grid;gap:4px;min-width:0}
.ahc-reasons legend{font-size:12px;padding:0;margin-bottom:8px}
.form-stack .ahc-reasons label{display:flex;align-items:center;gap:12px;font-size:14px;min-height:38px;cursor:pointer}
.form-stack .ahc-reasons input{flex:none;width:18px;height:18px;margin:0;padding:0;accent-color:var(--accent)}
.ahc-done{font-size:16px;line-height:1.6;margin-bottom:22px}
.ahc-share-input{width:100%;padding:13px;border:1px solid var(--rule);background:var(--panel);font:13px var(--mono);border-radius:0}

/* profiles */
.ahc-profile-joined{font-size:13px;color:var(--muted)}
.ahc-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin:18px 0 26px;border-top:1px solid var(--ink);border-bottom:1px solid var(--rule)}
.ahc-stats div{padding:14px 0 12px}
.ahc-stats div+div{padding-left:16px;border-left:1px solid var(--rule)}
.ahc-stats dt{font-size:12px;color:var(--muted)}
.ahc-stats dd{margin:6px 0 0;font:600 36px/1 var(--display);font-variant-numeric:tabular-nums}
.ahc-profile-heading{font:600 22px/1.1 var(--display);margin-bottom:6px}
.ahc-profile-list{list-style:none;margin:0;padding:0}
.ahc-profile-list li{display:grid;gap:5px;padding:13px 0;border-top:1px solid var(--rule)}
.ahc-profile-list a{font:600 20px/1.1 var(--display);overflow-wrap:anywhere}
.ahc-profile-meta{font-size:12px;color:var(--muted)}
.ahc-profile .ahc-skeleton{padding-left:0;border:0}

/* ----------------------------------------------------------------- phone */

@media(max-width:800px){
  .ahc-new-wrap{top:82px}
  .ahc-op .ahc-rail{top:96px}
}
@media(max-width:640px){
  .ahc{margin-top:18px}
  .ahc-toolbar{gap:4px 16px}
  .ahc-sorts{gap:20px;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  .ahc-sorts::-webkit-scrollbar{display:none}
  .ahc-sorts button{font-size:19px;white-space:nowrap}
  .ahc-window{order:3;padding:10px 0 12px}
  .ahc-start{order:4;width:100%;margin:6px 0 14px}
  .ahc-search{margin-top:16px}
  .ahc-search input{font-size:16px}
  .ahc-spaces{flex-wrap:nowrap;overflow-x:auto;margin:14px -20px 2px;padding:0 20px 4px;scrollbar-width:none}
  .ahc-spaces::-webkit-scrollbar{display:none}
  .ahc-post{grid-template-columns:34px minmax(0,1fr);gap:12px;padding:20px 0 16px}
  .ahc-vote{width:34px;height:34px}
  .ahc-score{font-size:18px}
  .ahc-title{font-size:24px;margin:7px 0 6px}
  .ahc-preview{font-size:13px}
  .ahc-actions{gap:0 18px;margin-top:8px}
  .ahc-skeleton{padding-left:46px}
  .ahc-empty h2,.ahc-empty h3{font-size:28px}
  .ahc-op{grid-template-columns:40px minmax(0,1fr);gap:12px}
  .ahc-op .ahc-rail{position:static}
  .ahc-rail.is-large .ahc-vote{width:38px;height:38px}
  .ahc-rail.is-large .ahc-score{font-size:22px}
  .ahc-op-heading h1{font-size:36px;margin:16px 0 18px}
  .ahc-op-text{font-size:16px}
  .ahc-comments{margin-top:34px}
  .ahc-comments-head h2{font-size:32px}
  .ahc-c{padding-left:16px}
  .ahc-c-head{margin-left:-16px}
  .ahc-c-guide{left:-2px;top:42px;width:12px}
  .ahc-c-toggle{width:22px;height:22px;margin-right:4px}
  .ahc-c-text{font-size:15px}
  .ahc-c-actions{gap:0 12px}
  .ahc-dialog{width:calc(100% - 20px);max-height:calc(100svh - 20px);padding:20px 18px 22px}
  .ahc-dialog .dialog-heading h2{font-size:28px}
  .ahc-compose-row{grid-template-columns:1fr}
  .ahc-stats dd{font-size:30px}
}
