.post-editor {
  width: 100%;
  min-width: 0;
  margin: 12px 0;
  color: #222;
  font:
    14px Arial,
    Helvetica,
    sans-serif;
}
.post-editor [hidden] {
  display: none !important;
}
.post-article-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  font-weight: normal;
}
.post-article-toggle input {
  width: auto;
  margin: 0;
}
.post-format-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 8px;
  background: #f7f7f7;
  border: 1px solid #ccc;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}
.post-format-toolbar button,
.post-format-toolbar select {
  min-height: 32px;
  padding: 5px 9px;
  font: inherit;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
  color: #111;
  cursor: pointer;
}
.post-format-toolbar button:hover {
  background: #eee;
}
.post-color-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-weight: normal;
}
.post-color-control input[type='color'] {
  width: 32px;
  height: 30px;
  padding: 2px;
  margin: 0;
  border: 1px solid #ccc;
  background: white;
  border-radius: 3px;
}
.post-editor textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 110px;
  max-height: 70vh;
  margin: 0;
  padding: 12px;
  font:
    16px/1.5 Arial,
    Helvetica,
    sans-serif;
  border: 1px solid #ccc;
  border-radius: 0 0 3px 3px;
  background: #fff;
  color: #111;
}
.post-editor textarea[aria-invalid='true'] {
  border-color: #b42318;
}
.post-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
}
.post-editor-attach {
  display: flex;
  gap: 6px;
  margin-right: auto;
}
.post-editor-attach button {
  padding: 5px 10px;
  font-size: 12px;
}
/* Chosen images and video, numbered in upload order. */
.post-editor-media {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.post-editor-file {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 88px;
  font-size: 12px;
}
.post-editor-file img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border: 1px solid #ddd;
  border-radius: 3px;
}
.post-editor-file-number {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 18px;
  padding: 1px 4px;
  box-sizing: border-box;
  background: black;
  color: white;
  border-radius: 3px;
  text-align: center;
}
.post-editor-file button {
  padding: 3px 6px;
  font-size: 12px;
}
.post-editor-video {
  width: auto;
  max-width: 220px;
  justify-content: space-between;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
  overflow-wrap: anywhere;
}
.gif-dialog {
  max-width: 560px;
}
.gif-dialog input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
}
.gif-dialog-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
}
.gif-dialog-choice {
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #f2f2f2;
  cursor: pointer;
}
.gif-dialog-choice img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
}
.post-editor-count {
  color: #666;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.post-editor-count.over-limit {
  color: #b42318;
}
.post-preview-toggle {
  padding: 5px 10px;
  font-size: 12px;
}
.post-editor-preview {
  max-height: 55vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid #ddd;
  border-radius: 3px;
}
.post-editor-empty,
.post-format-help {
  color: #666;
  font-size: 12px;
}
.post-format-help summary {
  cursor: pointer;
}
.post-format-help p {
  margin: 7px 0;
  line-height: 1.5;
}
.post-rich-text {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.6;
  text-align: left;
}
.post-rich-text > :first-child {
  margin-top: 0;
}
.post-rich-text > :last-child {
  margin-bottom: 0;
}
.post-rich-text p {
  margin: 0 0 10px;
}
.post-rich-text h1,
.post-rich-text h2,
.post-rich-text h3,
.post-rich-text h4,
.post-rich-text h5,
.post-rich-text h6 {
  color: inherit;
  line-height: 1.25;
  margin: 20px 0 10px;
}
.post-rich-text h1 {
  font-size: 1.9em;
}
.post-rich-text h2 {
  font-size: 1.55em;
}
.post-rich-text h3 {
  font-size: 1.3em;
}
.post-rich-text ul,
.post-rich-text ol {
  padding-left: 26px;
  margin: 8px 0 12px;
}
.post-rich-text li {
  margin: 4px 0;
}
.post-rich-text blockquote {
  margin: 12px 0;
  padding: 2px 14px;
  border-left: 3px solid #bbb;
  color: inherit;
}
.post-rich-text pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 12px;
  margin: 12px 0;
  background: #f5f5f5;
  color: #111;
  border: 1px solid #ddd;
  border-radius: 3px;
  white-space: pre;
}
.post-rich-text code {
  font:
    0.9em/1.5 Consolas,
    Monaco,
    monospace;
  padding: 1px 4px;
  background: #f5f5f5;
  color: #111;
  border-radius: 3px;
}
.post-rich-text pre code {
  padding: 0;
  background: transparent;
}
.post-rich-text table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 12px 0;
}
.post-rich-text td,
.post-rich-text th {
  padding: 6px 10px;
  border: 1px solid #ccc;
  text-align: left;
}
.post-rich-text hr {
  border: 0;
  border-top: 1px solid #ccc;
  margin: 16px 0;
}
.post-rich-text .post-size-12 {
  font-size: 12px;
}
.post-rich-text .post-size-16 {
  font-size: 16px;
}
.post-rich-text .post-size-20 {
  font-size: 20px;
}
.post-rich-text .post-size-24 {
  font-size: 24px;
}
.post-rich-text .post-size-32 {
  font-size: 32px;
}
.post-article-label {
  display: block;
  margin-bottom: 7px;
  color: #666;
  font-size: 12px;
  font-weight: bold;
  white-space: normal;
}
.post-article-preview {
  white-space: normal;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.post-read-more {
  box-sizing: border-box;
  text-decoration: none;
  display: inline-block;
  margin-top: 8px;
  font-weight: bold;
  font-size: 14px;
}
@media (max-width: 760px) {
  .post-format-toolbar button,
  .post-format-toolbar select,
  .post-preview-toggle,
  .post-color-control input[type='color'] {
    min-height: 44px;
  }
  .post-article-toggle {
    min-height: 44px;
  }
}

/* Uploaded images under a post: 2-4 share one 16:9 frame; articles with more keep wrapping. */
.post-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 8px;
  border-radius: 3px;
  overflow: hidden;
}
.post-gallery-2,
.post-gallery-3,
.post-gallery-4 {
  aspect-ratio: 16 / 9;
  grid-auto-rows: 1fr;
}
.post-gallery-1 {
  grid-template-columns: 1fr;
}
.post-gallery img,
.post-content .post-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  object-fit: cover;
  background: #f2f2f2;
}
.post-gallery-1 img,
.post-content .post-gallery-1 img {
  max-height: 520px;
  object-fit: contain;
}
.post-gallery-many img,
.post-content .post-gallery-many img {
  aspect-ratio: 4 / 3;
}
.post-gallery-3 img:first-child {
  grid-row: span 2;
}
.post-video {
  display: block;
  width: 100%;
  max-height: 520px;
  margin-top: 8px;
  border-radius: 3px;
  background: black;
}
/* Images and GIFs an article places between its words. */
.post-rich-text .post-inline-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: 3px;
}
