/* /community: the forum (post list, post page, composer). Tokens, nav, buttons, cards, dialogs and the footer
   come from home.css. Colours are tokens or translucent neutrals only; motion is transform and opacity only. */

.cm-hero { padding-block: clamp(44px, 6vw, 88px) clamp(40px, 5vw, 64px); }
.cm-hero-copy { position: relative; display: grid; justify-items: start; gap: 20px; max-width: 760px; }
.cm-hero-copy::before {
  content: '';
  position: absolute;
  inset: -18% -22%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(8, 10, 15, 0.66), rgba(8, 10, 15, 0));
  pointer-events: none;
}
.cm-title { font-size: clamp(2.4rem, 1.2rem + 4vw, 4.5rem); line-height: 1.02; text-wrap: balance; }
.cm-hero .lead { color: var(--fg-1); max-width: 60ch; }
.cm-hero-actions { gap: 10px; }

/* Signed-in strip under the hero buttons */
.cm-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  min-height: 44px;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--veil-1);
  font-size: 13.5px;
  color: var(--fg-2);
}
.cm-account-name { color: var(--fg-0); font-weight: 650; overflow-wrap: anywhere; }
.cm-account .btn { margin-left: 4px; }

/* Layout: posts on the left, places and rules on the right */
.cm-board { padding-block: clamp(32px, 4vw, 56px) var(--section-y); }
.cm-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: clamp(24px, 3.2vw, 48px); align-items: start; }
.cm-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.cm-side { position: sticky; top: calc(var(--nav-h) + 20px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.cm-side > .meta { margin-bottom: 2px; }

.cm-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--amber-line);
  border-radius: var(--r-2);
  background: var(--amber-wash);
  color: var(--fg-1);
  font-size: 13.5px;
  line-height: 1.55;
}
.cm-notice .icon { flex: none; margin-top: 2px; color: var(--amber); }

/* Toolbar: title, sort, section tabs */
#cm-list-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.cm-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.cm-h2 { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem); font-weight: 750; line-height: 1.2; letter-spacing: -0.025em; color: var(--fg-0); }
.cm-h2:focus { outline: none; }
.cm-sort { display: inline-flex; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: var(--bg-2); }
.cm-seg {
  height: 30px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 600;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.cm-seg:hover { color: var(--fg-0); }
.cm-seg[aria-pressed="true"] { background: var(--bg-4); color: var(--fg-0); }

.cm-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--veil-1);
  color: var(--fg-2);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-1) ease, border-color var(--dur-1) ease, color var(--dur-1) ease;
}
.cm-tab:hover { border-color: var(--line-3); color: var(--fg-0); }
.cm-tab[aria-current="true"] { border-color: var(--fg-1); background: var(--fg-0); color: var(--bg-1); }
.cm-tab-count { font-family: var(--font-mono); font-size: 11px; font-weight: 700; opacity: 0.7; }

/* Post list */
.cm-posts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 0; }
.cm-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 6px 14px;
  padding: 18px 20px;
  border: 1px solid var(--line-1);
  border-radius: var(--r-3);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur-2) ease, transform var(--dur-3) var(--ease), box-shadow var(--dur-3) var(--ease);
}
.cm-card:hover, .cm-card:focus-within { border-color: var(--line-2); box-shadow: var(--shadow-2); transform: translate3d(0, -2px, 0); }
.cm-card.is-pinned { border-color: var(--cobalt-line); }
.cm-card > .cm-avatar { grid-row: 1 / span 3; }
.cm-card > :not(.cm-avatar):not(.cm-card-thumb) { grid-column: 2; }
.cm-card-title { font-size: 17px; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; color: var(--fg-0); overflow-wrap: anywhere; }
.cm-card-title a { color: inherit; text-decoration: none; }
.cm-card-title a::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.cm-card-title a:focus-visible { outline: none; }
.cm-card-title a:focus-visible::after { outline: 2px solid var(--cobalt-2); outline-offset: 2px; }
.cm-card-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  color: var(--fg-2);
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.cm-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-top: 4px; }

.cm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; color: var(--fg-2); font-size: 13px; line-height: 1.4; }
.cm-meta-name { color: var(--fg-1); font-weight: 650; overflow-wrap: anywhere; }
.cm-dot { display: inline-flex; align-items: center; gap: 8px; }
.cm-dot::before { content: ''; flex: none; width: 3px; height: 3px; border-radius: 50%; background: var(--fg-3); }
.cm-meta .tag.is-staff { border-color: var(--cobalt-line); background: var(--cobalt-wash); color: var(--cobalt-2); }
.cm-flag { display: inline-flex; align-items: center; gap: 5px; color: var(--fg-2); font-size: 12.5px; font-weight: 600; }
.cm-flag .icon { width: 13px; height: 13px; color: var(--cobalt-2); }

.cm-stats { display: flex; align-items: center; gap: 14px; color: var(--fg-2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cm-stat { display: inline-flex; align-items: center; gap: 6px; }
.cm-stat .icon { width: 15px; height: 15px; }
.cm-stat.is-liked { color: var(--fg-0); }
.cm-stat.is-liked .icon { fill: currentColor; }

/* Avatars: Steam picture, or the first letter of the name */
.cm-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--r-2);
  background: var(--bg-3);
  color: var(--fg-1);
  font-size: 16px;
  font-weight: 750;
  text-transform: uppercase;
  user-select: none;
}
.cm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cm-avatar.is-sm { width: 32px; height: 32px; border-radius: var(--r-1); font-size: 13px; }

/* Loading, empty and error states */
.cm-skel { pointer-events: none; }
.cm-skel-line { height: 12px; border-radius: var(--r-pill); background: var(--bg-4); }
.cm-skel-line.is-title { width: min(62%, 420px); height: 16px; }
.cm-skel-line.is-wide { width: 92%; }
.cm-skel-line.is-short { width: 38%; }
.cm-skel .cm-avatar { border-color: transparent; background: var(--bg-4); }
.cm-state { display: grid; justify-items: start; gap: 10px; padding: clamp(24px, 4vw, 40px); }
.cm-state-title { font-size: var(--fs-h3); font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; color: var(--fg-0); }
.cm-state-text { max-width: 56ch; color: var(--fg-2); font-size: 14.5px; line-height: 1.6; }
.cm-state .btn { margin-top: 6px; }

.cm-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cm-pager-info { color: var(--fg-2); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

/* Side column */
.cm-place {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 12px;
  padding: 14px;
  color: var(--fg-1);
  text-decoration: none;
  transition: border-color var(--dur-2) ease, transform var(--dur-3) var(--ease);
}
.cm-place:hover { border-color: var(--line-3); transform: translate3d(0, -2px, 0); }
.cm-place-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--bg-3); color: var(--fg-0); }
.cm-place-body { display: grid; gap: 2px; min-width: 0; }
.cm-place-title { color: var(--fg-0); font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.cm-place-text { color: var(--fg-2); font-size: 13px; line-height: 1.45; }
.cm-place-go { color: var(--fg-3); transition: color var(--dur-1) ease, transform var(--dur-2) var(--ease); }
.cm-place:hover .cm-place-go { color: var(--fg-0); transform: translate3d(2px, 0, 0); }
.cm-rules { display: grid; gap: 12px; padding: 18px; }
.cm-rules-title { font-size: 14.5px; font-weight: 700; color: var(--fg-0); }
.cm-rules-list { display: grid; gap: 8px; margin: 0; color: var(--fg-1); font-size: 13.5px; line-height: 1.5; }
.cm-rules-list li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 9px; }
.cm-rules-list .icon { margin-top: 4px; color: var(--cobalt-2); }
.cm-rules-text { color: var(--fg-2); font-size: 13px; line-height: 1.55; }

/* Post page */
.cm-thread { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.cm-back { justify-self: start; }
.cm-back .icon { transform: rotate(180deg); }
.cm-post { display: grid; gap: 18px; padding: clamp(20px, 3vw, 32px); }
.cm-post-head { display: grid; gap: 12px; }
.cm-post-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.cm-post-title { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); font-weight: 780; line-height: 1.12; letter-spacing: -0.03em; color: var(--fg-0); overflow-wrap: anywhere; text-wrap: balance; }
.cm-post-title:focus { outline: none; }
.cm-byline { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cm-text { max-width: 72ch; color: var(--fg-1); font-size: 15.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-text a { color: var(--cobalt-2); text-decoration: underline; text-decoration-color: var(--cobalt-line); text-underline-offset: 3px; }
.cm-text a:hover { text-decoration-color: var(--cobalt-2); }
.cm-text.is-removed { color: var(--fg-2); font-style: italic; }
.cm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line-1); }
.cm-actions-end { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.cm-like[aria-pressed="true"] { border-color: var(--fg-1); color: var(--fg-0); }
.cm-like[aria-pressed="true"] .icon { fill: currentColor; }
.cm-like .cm-like-count { font-variant-numeric: tabular-nums; }

.cm-replies-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 6px; }
.cm-replies { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 0; }
.cm-reply { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 8px 12px; padding: 16px 18px; }
.cm-reply > .cm-avatar { grid-row: 1 / span 3; }
.cm-reply .cm-text { font-size: 15px; }
.cm-reply-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -8px; }
.cm-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-1);
  color: var(--fg-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: background-color var(--dur-1) ease, color var(--dur-1) ease;
}
.cm-link-btn:hover { background: var(--veil-1); color: var(--fg-0); }
.cm-link-btn .icon { width: 13px; height: 13px; }

.cm-reply-form { display: grid; gap: 12px; padding: 18px; }
.cm-reply-form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.cm-edit-form { display: grid; gap: 10px; }
.cm-edit-form-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.cm-gate { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 18px; }
.cm-gate p { color: var(--fg-1); font-size: 14.5px; }

/* Composer */
.cm-composer { width: min(640px, calc(100% - 32px)); }
.cm-fieldset { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.cm-fieldset[disabled] { opacity: 0.6; }
.cm-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.cm-choice-item { position: relative; display: inline-flex; }
.cm-choice-item input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cm-choice-item span {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--veil-1);
  color: var(--fg-2);
  font-size: 13.5px;
  font-weight: 600;
  transition: background-color var(--dur-1) ease, border-color var(--dur-1) ease, color var(--dur-1) ease;
}
.cm-choice-item:hover span { border-color: var(--line-3); color: var(--fg-0); }
.cm-choice-item input:checked + span { border-color: var(--fg-1); background: var(--fg-0); color: var(--bg-1); }
.cm-choice-item input:focus-visible + span { outline: 2px solid var(--cobalt-2); outline-offset: 2px; }
.cm-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cm-label-row .hint { font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.cm-label-row .hint[data-over="true"] { color: var(--amber); }
.cm-textarea { height: auto; min-height: 140px; padding: 12px 14px; line-height: 1.6; resize: vertical; }
.cm-textarea.is-reply { min-height: 96px; }

/* Pictures: thumbnail on a list card, gallery on a post, upload tiles in the composer, full view */
.cm-card.has-thumb { grid-template-columns: 44px minmax(0, 1fr) 96px; }
.cm-card-thumb { grid-column: 3; grid-row: 1 / span 3; align-self: start; width: 96px; height: 72px; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--bg-3); object-fit: cover; }
.cm-shots { display: grid; gap: 10px; }
.cm-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 72ch; }
.cm-gallery[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.cm-shot-wrap { display: grid; align-content: start; gap: 8px; min-width: 0; }
.cm-shot { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--bg-3); cursor: zoom-in; transition: border-color var(--dur-1) ease, transform var(--dur-3) var(--ease); }
.cm-shot:hover { border-color: var(--line-3); transform: translate3d(0, -2px, 0); }
.cm-shot img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: cover; }
.cm-gallery:not([data-count="1"]) .cm-shot img { aspect-ratio: 4 / 3; height: 100%; }
.cm-shot-badge { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid var(--amber-line); border-radius: var(--r-pill); background: rgba(8, 10, 15, 0.86); color: var(--fg-0); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.cm-shot-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cm-shot-tools .input { flex: 1 1 200px; height: 34px; font-size: 13.5px; }
.cm-waiting { display: flex; align-items: center; gap: 8px; color: var(--fg-2); font-size: 13.5px; }
.cm-waiting .icon { flex: none; color: var(--amber); }
.cm-uploads { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.cm-uploads:empty { display: none; }
.cm-upload { position: relative; width: 88px; height: 66px; overflow: hidden; border: 1px solid var(--line-2); border-radius: var(--r-1); background: var(--bg-3); }
.cm-upload img { width: 100%; height: 100%; object-fit: cover; }
.cm-upload[data-state="uploading"] img { opacity: 0.45; }
.cm-upload[data-state="error"] { border-color: var(--amber-line); }
.cm-upload-remove { position: absolute; right: 3px; top: 3px; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line-2); border-radius: 50%; background: rgba(8, 10, 15, 0.86); color: var(--fg-0); }
.cm-upload-remove:hover { border-color: var(--line-3); }
.cm-upload-state { position: absolute; inset: auto 0 0 0; padding: 2px 4px; background: rgba(8, 10, 15, 0.86); color: var(--fg-1); font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-align: center; text-transform: uppercase; }
.cm-add-image { justify-self: start; cursor: pointer; }
.cm-add-image[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
#cm-file:focus-visible + .cm-add-image { outline: 2px solid var(--cobalt-2); outline-offset: 2px; }
.cm-lightbox { max-width: min(96vw, 1400px); max-height: 94vh; max-height: 94dvh; margin: auto; padding: 0; overflow: visible; border: 0; background: transparent; }
.cm-lightbox::backdrop { background: rgba(5, 7, 11, 0.9); }
.cm-lightbox-img { display: block; max-width: min(96vw, 1400px); max-height: 94vh; max-height: 94dvh; width: auto; height: auto; border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--bg-2); }
.cm-lightbox-close { position: absolute; right: 10px; top: 10px; background: rgba(8, 10, 15, 0.86); }

/* Help: the reply that solved it */
.cm-reply.is-answer { border-color: var(--cobalt-line); }
.cm-meta .tag.is-answer { border-color: var(--cobalt-line); background: var(--cobalt-wash); color: var(--cobalt-2); }

/* Moderators: pictures that wait for a check */
.cm-queue { display: grid; gap: 10px; padding: 16px 18px; border-color: var(--amber-line); }
.cm-queue-title { color: var(--fg-0); font-size: 14.5px; font-weight: 700; }
.cm-inbox { border-color: var(--cobalt-line); }
.cm-link-btn[data-armed="1"], .btn[data-armed="1"] { color: var(--amber); }
.cm-queue-list { display: grid; gap: 6px; margin: 0; font-size: 13.5px; }
.cm-queue-list a { color: var(--cobalt-2); text-decoration: underline; text-decoration-color: var(--cobalt-line); text-underline-offset: 3px; }

@media (max-width: 979px) {
  .cm-layout { grid-template-columns: minmax(0, 1fr); }
  .cm-side { position: static; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
  .cm-side > .meta, .cm-rules { grid-column: 1 / -1; }
}
@media (max-width: 639px) {
  .cm-hero-actions .btn { flex: 1 1 auto; }
  .cm-card { grid-template-columns: 36px minmax(0, 1fr); gap: 6px 12px; padding: 16px; }
  .cm-card > .cm-avatar { width: 36px; height: 36px; }
  .cm-card.has-thumb { grid-template-columns: 36px minmax(0, 1fr) 72px; }
  .cm-card-thumb { width: 72px; height: 54px; }
  .cm-tabs { flex-wrap: nowrap; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); overflow-x: auto; scrollbar-width: none; }
  .cm-tabs::-webkit-scrollbar { display: none; }
  .cm-reply { padding: 14px; }
  .cm-actions-end { margin-left: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .cm-hero-copy > * { animation: cm-rise 420ms var(--ease) both; }
  .cm-hero-copy > :nth-child(2) { animation-delay: 50ms; }
  .cm-hero-copy > :nth-child(3) { animation-delay: 110ms; }
  .cm-hero-copy > :nth-child(4) { animation-delay: 160ms; }
  .cm-card.is-in, .cm-reply.is-in { animation: cm-rise 380ms var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
  .cm-skel-line, .cm-skel .cm-avatar { animation: cm-pulse 1.4s ease-in-out infinite alternate; }
}
/* List to post and back: a short cross-fade (community.js starts it only when motion is allowed). */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; animation-timing-function: var(--ease); }
@keyframes cm-rise { from { opacity: 0; transform: translate3d(0, 14px, 0); } }
@keyframes cm-pulse { from { opacity: 0.45; } to { opacity: 1; } }
