/* ==========================================================================
   community.css — the community: the ideas feed (community.html), one
   idea with its discussion (idea.html) and the editor page (write.html),
   plus the block editor and its "/" menu (js/editor.js), which the idea
   page uses for comments too. Same bones as the rest of the site: rows
   divided by hairlines, a vote button on the left, the page's tokens.
   ========================================================================== */

.community,
.idea,
.write {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 880px;
  padding-bottom: 64px;
}

.community .breadcrumbs,
.idea .breadcrumbs,
.write .breadcrumbs {
  margin-bottom: -16px;
}

.page-title {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.page-lede {
  margin-top: 8px;
  max-width: 560px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg-2);
  text-wrap: pretty;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

/* ---------- Shared small things ---------- */

/* hidden wins over the display a class sets (flex, inline-flex) */
.community [hidden],
.idea [hidden],
.write [hidden] {
  display: none !important;
}

.stance {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--gridline);
  color: var(--fg-2);
}

.stance-long {
  color: var(--up);
  background: color-mix(in srgb, var(--up) 12%, transparent);
}

.stance-short {
  color: var(--down);
  background: color-mix(in srgb, var(--down) 12%, transparent);
}

.company-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--gridline);
  color: var(--fg);
  font-size: 12px;
}

.company-tag:hover {
  background: var(--hover);
  text-decoration: none;
}

.company-tag-ticker {
  font-weight: 500;
}

.company-tag-name {
  color: var(--fg-2);
}

.idea-tag {
  color: var(--fg-2);
  font-size: 12px;
}

.idea-tag::before {
  content: "#";
  opacity: 0.7;
}

.idea-tag:hover {
  color: var(--fg);
  text-decoration: none;
}

.avatar-static {
  width: 24px;
  height: 24px;
  font-size: 10px;
  cursor: default;
}

/* the up-only vote: an arrow with the count under it */
.vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 56px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-2);
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

.vote:hover {
  background: var(--hover);
  color: var(--fg);
}

.vote[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.vote:disabled {
  opacity: 0.6;
}

/* a small inline vote (comments) */
.vote-small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-2);
  font-size: 12px;
}

.vote-small:hover {
  background: var(--hover);
  color: var(--fg);
}

.vote-small[aria-pressed="true"] {
  color: var(--accent);
}

/* ---------- The feed ---------- */

.feed-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.feed-tools .search {
  flex: 1 1 240px;
  max-width: 320px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: transparent;
  color: var(--fg-2);
  font-size: 12px;
  white-space: nowrap;
}

.chip:hover {
  background: var(--hover);
  color: var(--fg);
  text-decoration: none;
}

.chip[aria-pressed="true"] {
  border-color: var(--fg);
  color: var(--fg);
}

.chip .count {
  margin-left: 5px;
  color: var(--fg-3);
}

.feed-rows {
  display: flex;
  flex-direction: column;
}

.feed-rows > :last-child {
  border-bottom: 1px solid var(--border);
}

.idea-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.idea-row-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.idea-row-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.idea-row-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.3;
  text-wrap: pretty;
}

.idea-row-title:hover {
  text-decoration: underline;
}

.idea-row-excerpt {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idea-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
  color: var(--fg-3);
}

.idea-row-meta a {
  color: inherit;
}

.feed-empty {
  padding: 40px 0;
  text-align: center;
  color: var(--fg-2);
  font-size: 14px;
}

.feed-more {
  align-self: center;
}

.feed-note {
  font-size: 12px;
  color: var(--fg-3);
}

/* ---------- One idea ---------- */

.idea-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.idea-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.idea-title {
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: pretty;
}

.idea-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 13px;
  color: var(--fg-2);
}

.idea-byline .author {
  color: var(--fg);
  font-weight: 500;
}

.idea-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.idea-actions .vote {
  flex-direction: row;
  gap: 6px;
  width: auto;
  height: 32px;
  padding: 0 12px;
}

.idea-actions .spacer {
  flex: 1;
}

.idea-actions .button-quiet {
  color: var(--fg-2);
}

.idea-actions .button-danger:hover {
  color: var(--down);
}

/* the body: the editor's blocks, published */
.blocks {
  font-size: 16px;
  line-height: 1.65;
  max-width: 720px;
}

.blocks > * + * {
  margin-top: 14px;
}

.blocks h2 {
  margin-top: 32px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.blocks h3 {
  margin-top: 24px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
}

.blocks ul,
.blocks ol {
  padding-left: 24px;
}

.blocks li + li {
  margin-top: 4px;
}

.blocks blockquote {
  margin: 20px 0;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--fg-3);
  color: var(--fg-2);
}

.blocks hr {
  margin: 28px 0;
  border: none;
  border-top: 1px solid var(--border);
}

.blocks a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* a chart in the flow of the text */
.idea-chart,
.blk-chart .chart-block {
  margin: 24px 0;
  padding: 16px 16px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
}

.blocks .idea-chart {
  max-width: none;
}

.idea-chart .chart-plot,
.blk-chart .chart-plot {
  height: 240px;
}

.idea-chart .chart-value,
.blk-chart .chart-value {
  font-size: 32px;
}

.idea-chart .chart-top,
.blk-chart .chart-top {
  flex-wrap: wrap;
  row-gap: 8px;
}

/* ---------- The discussion ---------- */

.discussion {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.discussion h2 {
  font-size: 15px;
  font-weight: 500;
}

.comment-list {
  display: flex;
  flex-direction: column;
}

.comment {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.comment .replies .comment {
  border-top: none;
  padding: 12px 0 0;
}

.comment-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.comment-meta .author {
  font-weight: 500;
}

.comment-meta .when {
  font-size: 12px;
  color: var(--fg-3);
}

.comment .blocks {
  font-size: 14px;
  line-height: 1.55;
}

.comment .blocks > * + * {
  margin-top: 8px;
}

.comment .blocks h2 {
  font-size: 16px;
  margin-top: 12px;
}

.comment .idea-chart {
  margin: 12px 0;
}

.comment .idea-chart .chart-plot {
  height: 200px;
}

.comment-deleted {
  font-size: 13px;
  color: var(--fg-3);
  font-style: italic;
}

.comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-left: -8px;
}

.comment-actions .link-button {
  height: 24px;
  padding: 0 8px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-2);
  font-size: 12px;
}

.comment-actions .link-button:hover {
  background: var(--hover);
  color: var(--fg);
}

.replies {
  margin-top: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

/* a reply box, or the comment box at the end */
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
}

.comment-form:focus-within {
  border-color: var(--accent);
}

.comment-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-form-hint {
  font-size: 12px;
  color: var(--fg-3);
}

.comment-form-buttons {
  display: flex;
  gap: 8px;
}

.discussion-signin {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--fg-2);
}

/* ---------- The editor page ---------- */

.write-bar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.write-status {
  font-size: 12px;
  color: var(--fg-3);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.write-status.problem {
  color: var(--down);
}

.write-title {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  outline: none;
}

.write-title::placeholder {
  color: var(--fg-3);
  opacity: 0.6;
}

/* the properties under the title: company, stance, tags */
.write-props {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px 16px;
  align-items: center;
  font-size: 13px;
}

.write-props > label,
.write-props > .prop-label {
  color: var(--fg-3);
}

.prop-company {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.company-pick {
  position: relative;
  flex: 1 1 220px;
  max-width: 320px;
}

.company-pick[hidden] {
  display: none;
}

.prop-company .company-tag {
  font-size: 13px;
  padding: 4px 9px;
}

.prop-company .clear {
  border: none;
  background: transparent;
  color: var(--fg-3);
  font-size: 12px;
  padding: 0 4px;
}

.prop-company .clear:hover {
  color: var(--fg);
}

.tags-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.tags-field .tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 4px 0 8px;
  border-radius: 12px;
  background: var(--gridline);
  font-size: 12px;
}

.tags-field .tag-chip button {
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-3);
  font-size: 12px;
  line-height: 1;
}

.tags-field .tag-chip button:hover {
  color: var(--fg);
  background: var(--hover);
}

.tags-field input {
  flex: 1 1 160px;
  min-width: 120px;
  height: 28px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
}

.tags-field input::placeholder {
  color: var(--fg-3);
}

.write-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-3);
}

.write-hint kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.write-signed-out {
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--fg-2);
}

/* ---------- The block editor ---------- */

.editor {
  position: relative;
  min-height: 240px;
  padding-bottom: 80px; /* room to click below the last block */
  font-size: 16px;
  line-height: 1.65;
  max-width: 720px;
  cursor: text;
}

.editor-compact {
  min-height: 48px;
  padding-bottom: 8px;
  font-size: 14px;
  line-height: 1.55;
}

/* the editor's own placeholder, while it holds one empty paragraph */
.editor:has(> .blk:only-child > .blk-text:empty)::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 0;
  left: 0;
  color: var(--fg-3);
  pointer-events: none;
  opacity: 0.7;
}

.blk {
  position: relative;
  margin: 0 0 6px;
}

.blk-text {
  outline: none;
  min-height: 1.65em;
  white-space: pre-wrap;
  word-break: break-word;
}

/* a nudge in any empty block that has the focus (not the first, which
   has the editor's placeholder) */
.editor > .blk:not(:only-child) > .blk-text:empty:focus::before {
  content: "Type / for a chart or a block";
  color: var(--fg-3);
  opacity: 0.6;
  pointer-events: none;
}

.blk-h2 {
  margin-top: 26px;
}

.blk-h2 .blk-text {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.blk-h3 {
  margin-top: 18px;
}

.blk-h3 .blk-text {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
}

.blk-bullet,
.blk-number {
  padding-left: 24px;
}

.blk-bullet::before {
  content: "•";
  position: absolute;
  left: 8px;
  top: 0;
  color: var(--fg-2);
}

.editor {
  counter-reset: item;
}

.blk-number {
  counter-increment: item;
}

.blk-number::before {
  content: counter(item) ".";
  position: absolute;
  left: 2px;
  top: 0;
  min-width: 18px;
  text-align: right;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

/* a block that isn't a number starts a new count */
.blk:not(.blk-number) + .blk-number {
  counter-reset: item;
}

.blk-quote {
  margin: 12px 0;
  padding-left: 16px;
  border-left: 2px solid var(--fg-3);
}

.blk-quote .blk-text {
  color: var(--fg-2);
}

.blk-divider {
  padding: 10px 0;
  border-radius: var(--radius);
  outline: none;
}

.blk-divider hr {
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
}

.blk-divider:focus {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.blk-chart {
  outline: none;
  border-radius: 8px;
}

.blk-chart:focus .chart-block {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.blk-chart .chart-block {
  margin: 12px 0 0;
}

.blk-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--fg-3);
}

.blk-tools-label {
  font-weight: 500;
  color: var(--fg-2);
}

.blk-metric {
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field);
  font-size: 12px;
}

.blk-remove {
  margin-left: auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.blk-remove:hover {
  background: var(--hover);
  color: var(--fg);
}

.blk-remove svg,
.slash-icon svg,
.slash-back svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- The "/" menu ---------- */

.slash-menu {
  position: fixed;
  z-index: 60;
  width: 360px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  overflow: hidden;
}

.slash-menu[hidden] {
  display: none;
}

.slash-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
}

.slash-back {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.slash-back:hover {
  background: var(--hover);
  color: var(--fg);
}

.slash-search {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
}

.slash-search::-webkit-search-cancel-button {
  display: none;
}

.slash-list {
  overflow-y: auto;
  padding: 4px;
}

.slash-group {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.slash-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  text-align: left;
}

.slash-item[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 14%, var(--field));
}

.slash-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.slash-item[aria-selected="true"] .slash-icon {
  color: var(--accent);
}

.slash-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.slash-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slash-hint {
  font-size: 12px;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slash-empty {
  padding: 16px 10px;
  color: var(--fg-3);
}

/* ---------- Phone ---------- */

@media (max-width: 640px) {
  .page-title {
    font-size: 28px;
  }

  .idea-title,
  .write-title {
    font-size: 28px;
  }

  .idea-row {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
  }

  .vote {
    width: 48px;
    height: 48px;
  }

  .write-props {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .write-props > label,
  .write-props > .prop-label {
    margin-top: 8px;
  }

  .write-bar {
    margin: 0 calc(-1 * var(--gutter));
  }

  .idea-chart,
  .blk-chart .chart-block {
    padding: 12px 10px 8px;
  }

  .idea-chart .chart-plot,
  .blk-chart .chart-plot {
    height: 200px;
  }
}
