/* Community — per-kitchen forum (topics → threads → replies).
   Design language: warm & approachable, native to the public kitchen pages.
   Uses the global --or-* tokens from shell.css. Depth strategy: borders-only
   with surface shifts (cards on the bone-white canvas); no drop shadows. */

/* ---------- page frame ---------- */
.cm-wrap { max-width: 760px; }
.cm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 26px 0 4px; }
.cm-title { font-family: var(--or-serif); font-weight: 600; font-size: 1.5rem; letter-spacing: -0.015em; color: var(--or-ink); margin: 0; }
.cm-sub { color: var(--or-muted); font-size: .92rem; margin: 2px 0 0; }

/* ---------- topic pills ---------- */
.cm-topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.cm-pill {
  display: inline-flex; align-items: center; white-space: nowrap;
  padding: 7px 14px; border-radius: 999px; font-size: .86rem; font-weight: 600;
  color: var(--or-muted); background: var(--or-surface);
  border: 1px solid var(--or-line); cursor: pointer; text-decoration: none;
  transition: color 150ms cubic-bezier(0.25, 1, 0.5, 1), background 150ms cubic-bezier(0.25, 1, 0.5, 1);
}
.cm-pill:hover { color: var(--or-ink); background: var(--or-soft); }
.cm-pill.active { color: #fff; background: var(--or-accent); border-color: var(--or-accent); }

/* ---------- composer (start a thread / reply) ---------- */
.cm-composer { margin: 0 0 24px; }
.cm-composer > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: .9rem; color: #fff; background: var(--or-accent);
  border: 1px solid var(--or-accent-dark); user-select: none;
}
.cm-composer > summary::-webkit-details-marker { display: none; }
.cm-composer > summary:hover { background: var(--or-accent-dark); }
.cm-composer[open] > summary { display: none; }
.cm-form {
  background: var(--or-surface); border: 1px solid var(--or-line);
  border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.cm-input, .cm-textarea, .cm-select {
  width: 100%; font: inherit; font-size: .95rem; color: var(--or-ink);
  background: var(--or-paper); border: 1px solid var(--or-line);
  border-radius: 8px; padding: 10px 12px; box-sizing: border-box;
}
.cm-input:focus, .cm-textarea:focus, .cm-select:focus {
  outline: none; border-color: var(--or-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--or-accent) 14%, transparent);
}
.cm-textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.cm-form-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cm-form-row .cm-select { width: auto; min-width: 180px; }
.cm-form-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.cm-hint { font-size: .78rem; color: var(--or-muted); margin-right: auto; }
.cm-btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border-radius: 999px; padding: 9px 18px; font-weight: 700; font-size: .88rem;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
}
.cm-btn-primary { background: var(--or-accent); color: #fff; border-color: var(--or-accent-dark); }
.cm-btn-primary:hover { background: var(--or-accent-dark); }
.cm-btn-quiet { background: transparent; color: var(--or-muted); border-color: var(--or-line); }
.cm-btn-quiet:hover { color: var(--or-ink); background: var(--or-soft); }
.cm-form-error { color: #a83232; font-size: .85rem; padding: 6px 2px; }

/* ---------- thread list ---------- */
.cm-list { background: var(--or-surface); border: 1px solid var(--or-line); border-radius: 12px; overflow: hidden; }
.cm-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px; text-decoration: none; }
.cm-row + .cm-row { border-top: 1px solid var(--or-line); }
.cm-row:hover { background: var(--or-soft); }
.cm-row.pinned { background: color-mix(in oklab, var(--or-cream-soft) 55%, var(--or-surface)); }
.cm-row.pinned:hover { background: var(--or-cream-soft); }
.cm-row-main { flex: 1; min-width: 0; }
.cm-row-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1rem; color: var(--or-ink); margin: 0 0 3px; }
.cm-row-title .pin { color: var(--or-coral); flex: none; }
.cm-row-snippet { color: var(--or-muted); font-size: .88rem; line-height: 1.45; margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cm-row-meta { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--or-muted); flex-wrap: wrap; }
.cm-row-meta .dot::before { content: "·"; }
.cm-topic-tag {
  font-size: .72rem; font-weight: 700; letter-spacing: .02em; color: var(--or-celadon-deep);
  background: var(--or-celadon-soft); border-radius: 999px; padding: 2px 9px;
}
.cm-row-counts { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  font-size: .8rem; color: var(--or-muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.cm-count { display: inline-flex; align-items: center; gap: 5px; }
.cm-count svg { width: 14px; height: 14px; }

/* ---------- avatars & identity ---------- */
.cm-av {
  width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--or-celadon-soft); color: var(--or-celadon-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}
.cm-av.sm { width: 28px; height: 28px; font-size: .78rem; }
.cm-author { font-weight: 600; color: var(--or-ink); }
.cm-chip-creator {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--or-coral); background: var(--or-coral-soft);
  border: 1px solid var(--or-coral-line); border-radius: 999px; padding: 1px 8px;
}
.cm-edited { font-size: .76rem; color: var(--or-muted); font-style: italic; }

/* ---------- thread page ---------- */
.cm-back { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 600;
  color: var(--or-muted); text-decoration: none; margin: 22px 0 14px; }
.cm-back:hover { color: var(--or-ink); }
.cm-thread { background: var(--or-surface); border: 1px solid var(--or-line); border-radius: 12px; padding: 24px; }
.cm-thread-title { font-family: var(--or-serif); font-weight: 600; font-size: 1.55rem;
  letter-spacing: -0.015em; line-height: 1.15; color: var(--or-ink); margin: 0 0 12px;
  display: flex; align-items: baseline; gap: 10px; }
.cm-thread-title .pin { color: var(--or-coral); font-size: 1rem; flex: none; }
.cm-byline { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: .86rem; color: var(--or-muted); }
.cm-body { font-size: .98rem; line-height: 1.65; color: var(--or-ink); overflow-wrap: break-word; }
.cm-body a { color: var(--or-accent); text-decoration: underline; }
.cm-thread-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--or-line); }
.cm-tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.cm-tool {
  font: inherit; font-size: .8rem; font-weight: 600; color: var(--or-muted);
  background: none; border: none; border-radius: 8px; padding: 6px 10px;
  cursor: pointer; text-decoration: none;
}
.cm-tool:hover { color: var(--or-ink); background: var(--or-soft); }
.cm-tool.danger:hover { color: #a83232; background: #fbf0f0; }

/* like button */
.cm-like-form { display: inline-flex; margin: 0; }
.cm-like {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font: inherit; font-size: .84rem; font-weight: 600; color: var(--or-muted);
  background: var(--or-paper); border: 1px solid var(--or-line);
  border-radius: 999px; padding: 6px 13px; cursor: pointer; text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: color 150ms cubic-bezier(0.25, 1, 0.5, 1), border-color 150ms cubic-bezier(0.25, 1, 0.5, 1);
}
.cm-like svg { width: 15px; height: 15px; }
.cm-like:hover { color: var(--or-coral); border-color: var(--or-coral-line); }
.cm-like.liked { color: var(--or-coral); background: var(--or-coral-soft); border-color: var(--or-coral-line); }
.cm-like.passive { cursor: default; }
.cm-like.passive:hover { color: var(--or-muted); border-color: var(--or-line); }

/* ---------- replies ---------- */
.cm-replies-head { font-family: var(--or-serif); font-weight: 600; font-size: 1.1rem;
  color: var(--or-ink); margin: 28px 0 12px; }
.cm-reply { background: var(--or-surface); border: 1px solid var(--or-line); border-radius: 12px;
  padding: 16px; margin: 0 0 10px; }
.cm-reply-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cm-reply-head .meta { font-size: .8rem; color: var(--or-muted); }
.cm-reply .cm-body { font-size: .93rem; }
.cm-reply-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.cm-children { margin: 10px 0 0 22px; padding-left: 18px; border-left: 2px solid var(--or-soft); }
.cm-children:empty { display: none; }
.cm-children .cm-reply { padding: 13px 14px; margin-bottom: 8px; }
.cm-reply-inline { margin: 8px 0 0; }
.cm-reply-inline > summary { list-style: none; display: inline; }
.cm-reply-inline > summary::-webkit-details-marker { display: none; }
.cm-reply-inline .cm-form { margin-top: 8px; padding: 12px; }
.cm-reply-inline .cm-textarea { min-height: 60px; }

/* edit-in-place */
.cm-edit { margin: 0; }
.cm-edit > summary { list-style: none; display: inline; }
.cm-edit > summary::-webkit-details-marker { display: none; }
.cm-edit .cm-form { margin-top: 12px; }

/* ---------- reply composer (bottom) ---------- */
.cm-composer-fixed { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; }
.cm-composer-fixed .cm-form { flex: 1; }

/* ---------- gate / empty / disabled panels ---------- */
.cm-panel {
  background: var(--or-surface); border: 1px solid var(--or-line); border-radius: 12px;
  padding: 32px; text-align: center; margin: 0 0 24px;
}
.cm-panel-icon { font-size: 1.6rem; margin-bottom: 10px; }
.cm-panel-title { font-family: var(--or-serif); font-weight: 600; font-size: 1.15rem;
  color: var(--or-ink); margin: 0 0 6px; }
.cm-panel-text { color: var(--or-muted); font-size: .9rem; line-height: 1.55; margin: 0 auto 16px; max-width: 42ch; }
.cm-panel .cm-btn { margin: 0 4px; }
.cm-gate {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: color-mix(in oklab, var(--or-cream-soft) 60%, var(--or-surface));
  border: 1px solid var(--or-cream-line); border-radius: 12px;
  padding: 16px; margin: 0 0 24px;
}
.cm-gate-icon { font-size: 1.25rem; flex: none; }
.cm-gate-text { flex: 1; font-size: .9rem; color: var(--or-ink); line-height: 1.45; }
.cm-gate-text .muted { color: var(--or-muted); }

/* ---------- polls ---------- */
.cm-poll { margin-top: 16px; padding: 16px; background: var(--or-paper);
  border: 1px solid var(--or-line); border-radius: 12px; }
.cm-poll-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cm-poll-kicker { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--or-celadon-deep); background: var(--or-celadon-soft); border-radius: 999px; padding: 2px 9px; }
.cm-poll-meta { margin-left: auto; font-size: .8rem; color: var(--or-muted); font-variant-numeric: tabular-nums; }
.cm-closed-badge { font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  color: var(--or-coral); background: var(--or-coral-soft);
  border: 1px solid var(--or-coral-line); border-radius: 999px; padding: 1px 8px; }
.cm-voted-tick { font-size: .76rem; font-weight: 700; color: var(--or-accent); }
.cm-poll-option { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 0 0 4px;
  background: var(--or-surface); border: 1px solid var(--or-line); border-radius: 8px;
  font-size: .93rem; color: var(--or-ink); cursor: pointer;
  transition: border-color 150ms cubic-bezier(0.25, 1, 0.5, 1); }
.cm-poll-option:hover { border-color: var(--or-accent); }
.cm-poll-option.readonly { cursor: default; }
.cm-poll-option.readonly:hover { border-color: var(--or-line); }
.cm-poll-option.chosen { border-color: var(--or-accent); background: var(--or-soft); }
.cm-poll-option input[type="radio"] { accent-color: var(--or-accent); margin: 0; flex: none; }
.cm-poll-label { flex: 1; min-width: 0; }
.cm-poll-count { font-size: .8rem; color: var(--or-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cm-bar-track { height: 6px; border-radius: 999px; background: var(--or-soft); margin: -1px 2px 10px; overflow: hidden; }
.cm-bar-fill { height: 100%; border-radius: 999px; background: var(--or-celadon);
  transition: width 250ms cubic-bezier(0.25, 1, 0.5, 1); }
.cm-poll-gate { margin: 10px 2px 0; font-size: .84rem; color: var(--or-muted); }
.cm-poll-gate a { color: var(--or-accent); font-weight: 600; }
.cm-poll-options-edit { display: flex; flex-direction: column; gap: 8px; }

/* ---------- recipe requests ---------- */
.cm-upvote {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  flex: none; min-width: 44px; padding: 7px 8px; white-space: nowrap;
  font: inherit; font-size: .82rem; font-weight: 700; color: var(--or-muted);
  background: var(--or-paper); border: 1px solid var(--or-line);
  border-radius: 10px; cursor: pointer; text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: color 150ms cubic-bezier(0.25, 1, 0.5, 1), border-color 150ms cubic-bezier(0.25, 1, 0.5, 1);
}
.cm-upvote svg { width: 15px; height: 15px; }
.cm-upvote:hover { color: var(--or-accent); border-color: var(--or-accent); }
.cm-upvote.liked { color: var(--or-accent); background: var(--or-soft); border-color: var(--or-accent); }
.cm-upvote.passive { cursor: default; }
.cm-upvote.passive:hover { color: var(--or-muted); border-color: var(--or-line); }
.cm-row-request { align-items: center; }
.cm-row-request .cm-row-main { text-decoration: none; color: inherit; display: block; }
.cm-made-badge {
  flex: none; font-size: .68rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--or-celadon-deep); background: var(--or-celadon-soft);
  border-radius: 999px; padding: 2px 9px; vertical-align: middle;
}
.cm-made-link { color: var(--or-accent); font-weight: 600; }
.cm-made-callout {
  display: block; margin-top: 14px; padding: 12px 16px; font-size: .92rem;
  color: var(--or-celadon-deep); background: var(--or-soft);
  border: 1px solid var(--or-celadon-soft); border-radius: 10px; text-decoration: none;
}
.cm-made-callout:hover { border-color: var(--or-celadon); }

/* ---------- activity + comments ---------- */
.cm-row.cm-unread { background: color-mix(in oklab, var(--or-soft) 55%, var(--or-surface)); }
.cm-reply.cm-hidden { opacity: .55; }
.cm-reply.cm-hidden .cm-body { text-decoration: line-through; }
.cm-hidden-tag { font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--or-muted); background: var(--or-soft); border-radius: 999px; padding: 1px 8px; }

/* ---------- pagination ---------- */
.cm-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 20px 0; }
.cm-pager-info { font-size: .82rem; color: var(--or-muted); font-variant-numeric: tabular-nums; }

/* ---------- mobile touch targets (44px minimum, phone widths only) ---------- */
@media (max-width: 767.98px) {
  .cm-tool { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
  .cm-like { min-height: 44px; }
  .cm-btn { min-height: 44px; }
  .cm-input { min-height: 44px; }
  .cm-poll-option { min-height: 44px; }

  /* Community mobile pages (community/mobile/*.html): the compact .mk-head
     kitchen header sits above .cm-wrap, so trim the frame and let the section
     title/subtitle stack full-width instead of the desktop baseline row. */
  .cm-wrap { max-width: none; }
  .cm-head { flex-direction: column; align-items: stretch; gap: 8px; margin: 20px 0 4px; }
  .cm-head .cm-tool { align-self: flex-start; }

  /* Filter pills: single horizontal-scroll strip (mirrors the recipe vault's
     .mk-chips) so topics / sort tabs never wrap onto a second cramped row. */
  .cm-topics { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); }
  .cm-topics::-webkit-scrollbar { display: none; }
  .cm-pill { flex: none; min-height: 44px; }
}
