/* ---- Community board (Oct 23): one box to start a thread or reply, with emoji, GIFs and pictures;
   chat-style replies with faces and names that lead to people's pages; any emoji as a reaction. ---- */

/* The box: words on top, a slim row of tools under them. */
.cb-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}
.cb-box:focus-within {
  border-color: var(--purple);
}
.cb-box textarea {
  width: 100%;
  min-height: 24px;
  max-height: 260px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
}
.cb-box textarea:focus,
.cb-start-title:focus {
  outline: none;
}
.cb-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cb-gap {
  flex: 1;
}
.cb-tool,
.cb-emoji > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.cb-emoji > summary {
  font-size: 19px;
  font-weight: 400;
}
.cb-tool:hover,
.cb-tool[aria-expanded='true'],
.cb-emoji > summary:hover,
.cb-emoji[open] > summary {
  background: var(--soft);
  color: var(--ink);
}
.cb-tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
/* The emoji picker opens under the box, so it never runs off the top of the page. */
.cb-emoji .emoji-tray-pick {
  top: calc(100% + 4px);
  bottom: auto;
}
.cb-gif-panel {
  margin: 0;
}

/* What's attached before sending: a GIF or pictures as small tiles with a remove button. */
.cb-attached {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cb-thumb {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}
.cb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cb-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #141615cc;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
}
.cb-thumb.is-busy img {
  opacity: 0.5;
}
.cb-thumb i {
  position: absolute;
  inset: auto 0 6px;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 2px #000;
}

/* Start a thread: a title line that opens into the full box. */
.cb-start {
  margin: 0 0 14px;
  padding: 12px 14px;
}
.cb-start-title {
  width: 100%;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 650;
}
.cb-start.is-closed {
  cursor: text;
}
.cb-start:not(.is-closed) .cb-start-title {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}
.cb-kinds {
  margin: 2px 0 0;
}
.cb-kinds .chip {
  font-size: 12px;
}
a.cb-signin {
  display: block;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}
a.cb-signin:hover {
  border-color: var(--purple);
  color: var(--ink);
}

/* Show one kind of thread. */
.cb-filter {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0 0 4px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.cb-filter .chip {
  flex: 0 0 auto;
  font-size: 12px;
}

/* Thread rows: a picture on the right when the thread has one. */
.thread-card.has-pic {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.cb-card-text {
  flex: 1;
  min-width: 0;
}
.cb-card-pic {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--line);
}

/* The open thread: who started it, then the talk. */
.cb-op {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.cb-op .thread-meta {
  margin: 0;
}
.cb-op-body p {
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}
.cb-count {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.thread-open .thread-replies {
  margin-top: 8px;
}

/* Replies read like a chat: a face, a name that leads to their page, the words. */
.news-reply.cb-msg {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
}
.news-reply.cb-msg.gone {
  display: block;
}
.cb-msg-main {
  flex: 1;
  min-width: 0;
}
.cb-msg .news-reply-head small {
  margin-left: auto;
}
.cb-avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}
.cb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cb-name {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
a.cb-name:hover {
  text-decoration: underline;
}
.cb-msg .message-gif {
  max-width: min(240px, 100%);
}
.cb-msg .news-reply-tools {
  gap: 10px;
  margin-top: 6px;
}
.cb-msg .news-reply-tools .text-button {
  font-size: 12px;
  color: var(--muted);
}
@media (hover: hover) {
  .cb-msg .news-reply-tools .text-button {
    opacity: 0;
    transition: opacity 0.15s;
  }
  .cb-msg:hover .news-reply-tools .text-button,
  .cb-msg:focus-within .news-reply-tools .text-button {
    opacity: 1;
  }
}
.cb-reacts {
  margin-top: 0;
}
.cb-reacts .reaction-pick {
  left: 0;
}
.news-tools .cb-reacts .reaction-add > summary,
.cb-msg .reaction-add > summary {
  opacity: 1;
}

/* Pictures in a post or reply: one big, or a tidy grid of two to four. */
.cb-pics {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  max-width: 420px;
}
.cb-pics.n-2,
.cb-pics.n-4 {
  grid-template-columns: 1fr 1fr;
}
.cb-pics.n-3 {
  grid-template-columns: 2fr 1fr;
}
.cb-pics.n-3 a:first-child {
  grid-row: span 2;
}
.cb-pics a {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: var(--line);
}
.cb-pics img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 420px;
  object-fit: cover;
}
.cb-pics:not(.n-1) img {
  aspect-ratio: 1;
}

@media (max-width: 600px) {
  .cb-avatar {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
  .news-reply.cb-msg {
    padding: 10px;
  }
  .cb-card-pic {
    width: 56px;
    height: 56px;
  }
}

/* Two tabs across the top of Community (Oct 23), Discussions first. Replaces the side rail. */
.cb-layout {
  max-width: 760px;
  margin: 0 auto;
}
.cb-tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.cb-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 12px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.cb-tab:hover {
  color: var(--ink);
  text-decoration: none;
}
.cb-tab[aria-current='page'] {
  border-bottom-color: var(--ink);
  color: var(--ink);
}
.cb-tab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.cb-tab-count {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
[data-theme='dark'] .cb-tab-count {
  color: #141615;
}
.cb-tab:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: -2px;
}

/* Desktop gets a wider, roomier board (Bryan, Oct 23: "its so slim"). Phones keep the layout above. */
@media (min-width: 900px) {
  #announcements-view .announcements {
    max-width: 1120px;
  }
  .cb-layout {
    width: 100%;
    max-width: none;
  }
  .cb-tab {
    min-height: 56px;
    font-size: 17px;
  }
  .cb-start {
    padding: 16px 20px;
  }
  .cb-start-title {
    font-size: 18px;
  }
  .cb-start:not(.is-closed) .cb-start-title {
    font-size: 21px;
  }
  .cb-box textarea {
    font-size: 16px;
  }
  .thread-list {
    gap: 12px;
  }
  .thread-card {
    padding: 20px 24px;
  }
  .thread-card h3 {
    font-size: 21px;
    margin: 10px 0 6px;
  }
  .thread-snippet {
    font-size: 15px;
  }
  .thread-meta {
    font-size: 13px;
  }
  .cb-card-pic {
    width: 112px;
    height: 112px;
    border-radius: 12px;
  }
  .thread-open {
    padding: 32px 36px;
  }
  .thread-open h2 {
    font-size: 34px;
  }
  .cb-op-body {
    font-size: 17px;
  }
  .cb-pics {
    max-width: 680px;
  }
  .news-reply.cb-msg {
    gap: 14px;
    padding: 14px 18px;
  }
  .cb-msg p {
    font-size: 16px;
  }
  .cb-avatar {
    width: 42px;
    height: 42px;
    font-size: 16px;
  }
  .cb-msg .message-gif {
    max-width: 320px;
  }
}
/* The tall first picture of three fills its whole cell. */
.cb-pics.n-3 a:first-child img {
  aspect-ratio: auto;
  height: 100%;
  max-height: none;
}
