/* Community pages: parts marketplace, Q&A forum, friends & creators, member pages.
   Builds on style.css (palette, masthead, panels, buttons, pick cards). */

[hidden] { display: none !important; }

textarea, input[type="search"] {
  font: inherit;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  background: var(--asphalt);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}
textarea { resize: vertical; line-height: 1.45; }
textarea:hover, input[type="search"]:hover { border-color: var(--ink-soft); }
textarea:focus-visible { outline: 2px solid var(--hazard); outline-offset: 3px; }

.panel a, .sub a, .note a, .cm-byline a { color: var(--hazard); }

/* ---- Shared pieces ------------------------------------------------------------- */

.cm-query { max-width: 520px; }
.cm-form { display: flex; flex-direction: column; gap: 14px; }
.cm-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.cm-form-title {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 500; margin: 0;
}

.cm-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  background: var(--hazard);
  color: var(--hazard-ink);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 17px;
  transform: skewX(-10deg);
}
.cm-avatar.big { width: 84px; height: 84px; font-size: 36px; }

.cm-member { color: var(--ink); font-weight: 600; text-decoration: none; }
.cm-member:hover { color: var(--hazard); text-decoration: underline; }
.cm-byline { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.cm-car { margin: 0 0 10px; font-family: var(--font-mono); font-size: 13px; color: var(--hazard); }
.cm-body p { margin: 0 0 10px; max-width: 72ch; overflow-wrap: anywhere; }

.cm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cm-card {
  display: flex;
  gap: 16px;
  background: var(--carbon);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule);
  padding: 14px 16px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.cm-card-main { min-width: 0; flex: 1; }
.cm-card-title {
  font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: 21px;
  line-height: 1.1; text-transform: uppercase; margin: 4px 0 6px; text-wrap: balance;
}
.cm-card-title a { color: var(--ink); text-decoration: none; }
.cm-card-title a:hover { color: var(--hazard); }
.cm-card .pick-note { margin: 0 0 4px; overflow-wrap: anywhere; }
.cm-tools { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.cm-pager { margin-top: 16px; }

/* ---- Parts marketplace --------------------------------------------------------------- */

.parts-search { margin-bottom: 24px; }
.parts-form { margin-bottom: 14px; }
.part-card { cursor: pointer; }
.part-card:hover { border-color: var(--ink-soft); }
.part-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.part-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.part-tag.product { color: var(--hazard-ink); background: var(--hazard); border-color: var(--hazard); }
.part-tag.warn { color: var(--signal); border-color: var(--signal); }
.part-card-price { margin: 0; font-family: var(--font-mono); color: var(--hazard); }
.parts-note { margin-top: 18px; }
.part-detail { margin-top: 24px; }
.part-close { margin-bottom: 14px; }
.part-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1;
  text-transform: uppercase;
  margin: 4px 0 8px;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.part-title:focus { outline: none; }
.part-price { margin: 0 0 16px; font-family: var(--font-mono); color: var(--hazard); }
.part-want { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 18px; }
.part-want .status { flex-basis: 100%; margin: 0; }
.part-want .btn[aria-pressed="true"] { border-color: var(--hazard); color: var(--hazard); }
.part-section { margin: 0 0 18px; max-width: 72ch; }
.part-section h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
  margin: 0 0 6px;
}
.part-section p { margin: 0 0 6px; }
.part-specs { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 4px 16px; margin: 0; }
.part-specs dt { color: var(--ink-soft); }
.part-specs dd { margin: 0; }
.part-install { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.part-hours { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.part-proscons { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 24px; }
.part-proscons h4 { margin: 0 0 4px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.part-proscons ul, .part-also { margin: 0; padding-left: 1.2em; }
.part-proscons li, .part-also li { margin: 0 0 4px; }
.part-pros li::marker { content: "+  "; color: var(--hazard); }
.part-cons li::marker { content: "−  "; color: var(--signal); }
.part-alert { border-left: 3px solid var(--signal); padding-left: 10px; }
.part-fits, .part-related { list-style: none; margin: 0; padding: 0; columns: 2 240px; column-gap: 24px; }
.part-fits li, .part-related li { break-inside: avoid; margin: 0 0 10px; }
.part-fits a, .part-related a { color: var(--ink); }
.part-fits a:hover, .part-related a:hover { color: var(--hazard); }
.part-fits .sub { font-size: 14px; }
.fit-yes .part-meta { color: var(--hazard); }
.fit-no .part-meta { color: var(--signal); }

/* ---- Forum ------------------------------------------------------------------------------- */

.forum-tools { margin-bottom: 18px; display: flex; flex-direction: column; gap: 14px; }
.forum-tools-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.forum-tools-row form { flex: 1 1 280px; }
.cm-sort { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.cm-tab {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--asphalt);
  border: 1px solid var(--rule);
  padding: 7px 14px;
  cursor: pointer;
  transform: skewX(-10deg);
}
.cm-tab:hover { color: var(--ink); border-color: var(--ink-soft); }
.cm-tab[aria-pressed="true"] { color: var(--hazard-ink); background: var(--hazard); border-color: var(--hazard); }
.cm-tab:focus-visible { outline: 2px solid var(--hazard); outline-offset: 3px; }
.forum-ask { margin-bottom: 18px; }

.cm-count {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--hazard);
  color: var(--hazard);
}
.cm-count strong { font-family: var(--font-display); font-style: italic; font-size: 26px; line-height: 1; }
.cm-count span { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.cm-count.none { border-color: var(--rule); color: var(--ink-soft); }
.question-card.solved { border-left-color: var(--hazard); }
.question-card.solved .cm-count { background: var(--hazard); color: var(--hazard-ink); }

.forum-question > .btn.quiet { display: inline-block; margin-bottom: 12px; }
.question-panel { border-left: 3px solid var(--hazard); margin-bottom: 24px; }
.cm-answers-title { margin-top: 8px; }
.forum-question .cm-list { margin-bottom: 24px; }
.answer-card.accepted { border-left-color: var(--hazard); }

.cm-vote { flex: none; }
.cm-vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 52px;
  padding: 8px 0;
  background: var(--asphalt);
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
}
.cm-vote-btn strong { font-family: var(--font-mono); font-size: 16px; color: var(--ink); }
.cm-vote-btn:hover:not(:disabled) { border-color: var(--hazard); color: var(--hazard); }
.cm-vote-btn[aria-pressed="true"] { border-color: var(--hazard); color: var(--hazard); }
.cm-vote-btn:disabled { cursor: default; opacity: 0.6; }
.cm-vote-btn:focus-visible { outline: 2px solid var(--hazard); outline-offset: 3px; }

/* ---- Social: one page, tabs for Friends / Creators / My page ------------------------- */

/* Friends | Creators | My page: a tab bar, the active tab underlined in hazard yellow. */
.social-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}
.social-tabs::-webkit-scrollbar { display: none; }
.social-tabs [role="tab"] {
  flex: 1 1 0;
  min-width: max-content;
  padding: 12px 18px 10px;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  color: var(--ink-soft);
  font: italic 800 18px/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.social-tabs [role="tab"]:hover { color: var(--ink); }
.social-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--hazard); }
.social-tabs [role="tab"]:focus-visible { outline: 2px solid var(--hazard); outline-offset: -2px; }

.social-guest { margin-bottom: 24px; }
.social-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 32px;
  align-items: start;
}
.social-wants { grid-column: 1 / -1; }
@media (max-width: 820px) { .social-grid { grid-template-columns: minmax(0, 1fr); } }

.cm-people { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cm-people:empty { display: none; }
.cm-person { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cm-person-who { flex: 1 1 140px; min-width: 0; }
.cm-person-who .cm-member { overflow-wrap: anywhere; }
.cm-person-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cm-person-actions .btn:not(.quiet) { padding: 7px 14px; font-size: 15px; }

.cm-wants { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cm-want-card { background: var(--asphalt); border: 1px solid var(--rule); padding: 14px; }
.cm-want-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cm-want-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.cm-want-list a { color: var(--ink); }
.cm-want-list a:hover { color: var(--hazard); }
.cm-want-list .cm-byline { margin: 0; }

.cm-creators {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.cm-creator {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--carbon);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--hazard);
  padding: 14px 16px 16px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}
.cm-creator-line { margin: 0; overflow-wrap: anywhere; }
.cm-creator .pick-open { margin-top: auto; text-decoration: none; }

.cm-video { position: relative; aspect-ratio: 16 / 9; background: var(--asphalt); border: 1px solid var(--rule); }
.cm-video iframe, .cm-video-play { display: block; width: 100%; height: 100%; border: 0; }
.cm-video-play { position: relative; padding: 0; background: none; cursor: pointer; }
.cm-video-play img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cm-video-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 40px;
  margin: -20px 0 0 -29px;
  background: var(--hazard);
  transform: skewX(-10deg);
}
.cm-video-icon::after {
  content: "";
  position: absolute;
  left: 23px;
  top: 11px;
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent var(--hazard-ink);
}
.cm-video-play:hover .cm-video-icon { background: #ffd52e; }
.cm-video-play:focus-visible { outline: 2px solid var(--hazard); outline-offset: 3px; }

/* ---- Member page --------------------------------------------------------------------------- */

.member-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 22px; }
.member-head-text { flex: 1 1 260px; min-width: 0; position: relative; z-index: 1; }
.member-head h1 { overflow-wrap: anywhere; }
.member-actions { position: relative; z-index: 1; }
.member-edit { margin-bottom: 28px; display: flex; flex-direction: column; gap: 18px; }
.member-edit .note { margin: 0; }
.member-edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.member-section { margin-bottom: 30px; }
.member-section .pick-card .btn.quiet { align-self: flex-start; }
.part-fits .part-try { margin: 6px 0 0; text-decoration: none; }
.cm-wanted-build .btn { margin-left: 8px; }

/* Social feeds (static/social.js): posts down the middle, people in a rail to the side. */
.feed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.feed-rail { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.feed-rail .panel { margin: 0; }
.cm-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; max-width: 680px; }
.cm-post { background: var(--carbon); border: 1px solid var(--rule); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.cm-post-build { display: flex; flex-direction: column; gap: 6px; }
.cm-post-build .pick-name { margin: 0; }
.cm-post-head { display: flex; align-items: center; gap: 10px; }
.cm-post-who { margin: 0; flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--ink-soft); }
.cm-post-who .cm-member { font-weight: 600; }
.cm-post-when { white-space: nowrap; }
.cm-post-text { margin: 0; overflow-wrap: anywhere; }
.cm-post-want .cm-post-text a, .cm-post-wantedBuild .pick-name { font-weight: 600; }
.cm-mod-chips { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cm-mod-chips li { font-family: var(--font-mono); font-size: 12px; padding: 3px 8px; border: 1px solid var(--rule); background: var(--asphalt); color: var(--ink); }
.cm-mod-chips li.more { color: var(--ink-soft); }
.cm-post-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.cm-post-actions .btn { text-decoration: none; }
.cm-rail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cm-rail-person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--rule); background: var(--asphalt); color: var(--ink); text-decoration: none; flex-wrap: wrap; }
.cm-rail-person:hover, .cm-rail-person:focus-visible { border-color: var(--hazard); }
.cm-rail-person .cm-person-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cm-rail-person strong { overflow-wrap: anywhere; }
.cm-rail-latest { flex-basis: 100%; font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }

/* Narrow screens: the rail comes first; creator boxes scroll sideways like stories. */
@media (max-width: 900px) {
  .feed-layout { grid-template-columns: minmax(0, 1fr); }
  .feed-rail { position: static; max-height: none; overflow: visible; order: -1; }
  .cm-creator-boxes { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .cm-creator-boxes li { flex: 0 0 200px; scroll-snap-align: start; }
  .cm-creator-boxes .cm-rail-person { height: 100%; align-items: flex-start; }
}

/* A build's car in a feed post (static/feed3d.js). */
.cm-post-3d { position: relative; aspect-ratio: 16 / 9; background: radial-gradient(ellipse at 50% 70%, var(--asphalt), var(--carbon)); border: 1px solid var(--rule); overflow: hidden; }
.cm-post-3d .feed3d-shot { display: block; width: 100%; height: 100%; object-fit: cover; cursor: grab; opacity: 0; transition: opacity 0.3s; }
.cm-post-3d.ready .feed3d-shot { opacity: 1; }
.cm-post-3d .feed3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.cm-post-3d.live .feed3d-shot, .cm-post-3d.live .feed3d-spin { visibility: hidden; }
.cm-post-3d .feed3d-spin {
  position: absolute; right: 10px; bottom: 10px; font: 500 12px var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink); background: rgba(10, 12, 15, 0.7); border: 1px solid var(--rule); padding: 6px 10px; cursor: pointer;
}
.cm-post-3d .feed3d-spin:hover, .cm-post-3d .feed3d-spin:focus-visible { border-color: var(--hazard); color: var(--hazard); }
.cm-post-3d.loading .feed3d-spin::after { content: "…"; }
.cm-post-3d .feed3d-note { position: absolute; inset: auto 10px 10px 10px; margin: 0; font-size: 13px; color: var(--ink-soft); }
.cm-post-3d.failed .feed3d-spin { display: none; }
.member-dream-card { max-width: 760px; }
.member-dream-price { margin: 2px 0 0; font-family: var(--font-mono); font-size: 14px; color: var(--hazard); }
.cm-wishlist + .cm-form-title { margin-top: 16px; }

/* Verified creators, works in progress and recommended parts. */
.cm-verified {
  display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 5px; border-radius: 50%;
  background: var(--hazard); color: var(--hazard-ink); font: 700 11px/1 var(--font-body); vertical-align: 1px; text-decoration: none;
}
.cm-verified.big { width: 26px; height: 26px; font-size: 16px; vertical-align: 6px; }
.cm-wip-tag { align-self: flex-start; }
.cm-next-up { margin: 0; font-size: 14px; color: var(--ink); border-left: 3px solid var(--signal); padding-left: 8px; }
.cm-pick-note { margin: 0; font-style: italic; color: var(--ink-soft); overflow-wrap: anywhere; }
.cm-post-pick { display: flex; flex-direction: column; gap: 4px; }
.cm-post-pick .pick-name { color: var(--ink); text-decoration: none; }
.cm-post-pick .pick-name:hover { color: var(--hazard); }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check-row input { accent-color: var(--hazard); }
.pick-card .cm-post-3d { margin: -4px -4px 4px; }
