/* Forum post editor (resources/views/forum/_editor.php + js/editor.js), the create thread
   page (.compose) and the content of posts (.post-body), in the forum's parchment colours. */

/* ---------- Create thread page ---------- */
.compose {
  color: #3b2e1a;
  font-size: 13px;
}

.compose a {
  color: #063677;
}

.compose a:hover {
  color: #0058c6;
}

.compose__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 14px;
  border-bottom: 1px solid rgba(165, 122, 54, 0.35);
}

.compose__icon {
  flex: none;
  border: 1px solid #a57a36;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(60, 35, 5, 0.25);
}

.compose__kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8a5a14;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.compose__title {
  margin: 2px 0 0;
  color: #660000;
  font: 24px/1.2 Georgia, "Times New Roman", serif;
}

.compose__desc {
  margin: 3px 0 0;
  color: #5c4726;
  font-size: 12px;
}

.compose__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  margin-top: 16px;
}

.compose__field {
  margin-bottom: 16px;
}

.compose__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.compose__label {
  color: #4a3010;
  font-size: 13px;
  font-weight: 700;
}

.compose__count {
  color: #8a7350;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.compose__count.is-near {
  color: #a3361f;
}

.compose__input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c8a46a;
  border-radius: 6px;
  background: #fffdf6;
  color: #2b2010;
  font: 15px/1.3 inherit;
  font-family: inherit;
  box-shadow: inset 0 1px 2px rgba(80, 50, 10, 0.08);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.compose__input::placeholder {
  color: #a8956f;
}

.compose__input:focus {
  outline: none;
  border-color: #a57a36;
  box-shadow: 0 0 0 3px rgba(214, 160, 60, 0.28);
}

.compose__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(165, 122, 54, 0.35);
}

.compose__as {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #5c4726;
  font-size: 12px;
}

.compose__as select {
  max-width: 260px;
  padding: 6px 8px;
  border: 1px solid #c8a46a;
  border-radius: 5px;
  background: #fffdf6;
  color: #2b2010;
  font: 13px inherit;
  font-family: inherit;
}

.compose__as select:focus {
  outline: 2px solid #0058c6;
  outline-offset: 1px;
}

.compose__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.compose__actions .ui-btn.is-busy {
  opacity: 0.7;
  cursor: progress;
}

.compose__aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compose__tip {
  padding: 12px 14px;
  border: 1px solid #c8913a;
  border-radius: 6px;
  background: linear-gradient(to bottom, #f8f0d4, #efe0b0);
}

.compose__tip h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
  color: #660000;
  font-size: 13px;
}

.compose__tip h4 i {
  color: #a57a36;
}

.compose__tip ul {
  margin: 0;
  padding-left: 16px;
}

.compose__tip li,
.compose__tip p {
  margin: 0 0 5px;
  color: #4a3a22;
  font-size: 12px;
  line-height: 1.45;
}

.compose__keys {
  display: grid;
  gap: 4px;
  margin: 8px 0;
}

.compose__keys div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
}

.compose__keys dt {
  color: #4a3a22;
  white-space: nowrap;
}

.compose__keys dd {
  margin: 0;
  color: #6b5430;
}

.compose kbd {
  display: inline-block;
  min-width: 14px;
  padding: 0 4px;
  border: 1px solid #b89458;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #fffaf0;
  color: #3b2e1a;
  font: 10.5px/16px Consolas, Menlo, monospace;
  text-align: center;
}

.compose__tip .compose__note {
  margin: 8px 0 0;
  color: #6b5430;
  font-size: 11px;
}

@media (max-width: 760px) {
  .compose__form {
    grid-template-columns: 1fr;
  }

  .compose__head {
    align-items: flex-start;
  }
}

/* ---------- Editor ---------- */
.fx-editor {
  position: relative;
  border: 1px solid #c8a46a;
  border-radius: 7px;
  background: #fffdf6;
  box-shadow: inset 0 1px 2px rgba(80, 50, 10, 0.06);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.fx-editor:not(.is-ready) {
  border: 0;
  background: none;
  box-shadow: none;
}

.fx-editor.is-ready:focus-within {
  border-color: #a57a36;
  box-shadow: 0 0 0 3px rgba(214, 160, 60, 0.28);
}

.fx-editor.is-over {
  border-color: #a3361f;
}

/* without JavaScript: a plain textarea */
.fx-editor__source {
  box-sizing: border-box;
  width: 100%;
  min-height: 220px;
  padding: 10px 12px;
  border: 1px solid #c8a46a;
  border-radius: 6px;
  background: #fffdf6;
  font: 14px/1.5 inherit;
  font-family: inherit;
  resize: vertical;
}

.fx-editor__toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 2px;
  padding: 6px 8px;
  border-bottom: 1px solid #dcc394;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(to bottom, #f9f1d8, #efdfb2);
}

.fx-editor__toolbar[hidden] {
  display: none;
}

.fx-tb-group {
  display: flex;
  align-items: center;
  gap: 1px;
  padding-right: 6px;
  margin-right: 4px;
  border-right: 1px solid rgba(165, 122, 54, 0.35);
}

.fx-tb-group:last-child,
.fx-tb-group--end {
  padding-right: 0;
  margin-right: 0;
  border-right: 0;
}

.fx-tb-group--end {
  margin-left: auto;
}

.fx-editor__toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 29px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #5c4021;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.fx-editor__toolbar button:hover {
  border-color: rgba(165, 122, 54, 0.4);
  background: rgba(255, 255, 255, 0.55);
  color: #2e1c08;
}

.fx-editor__toolbar button[aria-pressed="true"],
.fx-editor__toolbar button[aria-expanded="true"] {
  border-color: #b8893e;
  background: #ecd49a;
  color: #3a2108;
  box-shadow: inset 0 1px 2px rgba(90, 55, 10, 0.2);
}

.fx-editor__toolbar button:focus-visible,
.fx-tb-select:focus-visible {
  outline: 2px solid #0058c6;
  outline-offset: 1px;
}

.fx-editor__toolbar .fa-youtube {
  color: #c4302b;
}

.fx-tb-select {
  height: 30px;
  padding: 0 6px;
  border: 1px solid rgba(165, 122, 54, 0.45);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.6);
  color: #3b2e1a;
  font: 12.5px inherit;
  font-family: inherit;
  cursor: pointer;
}

.fx-editor__area {
  min-height: 260px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 14px 16px;
  color: #2b2010;
  outline: none;
  cursor: text;
}

.fx-editor--compact .fx-editor__area {
  min-height: 140px;
}

.fx-editor__area[hidden] {
  display: none;
}

.fx-editor__area.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  color: #a8956f;
  pointer-events: none;
}

.fx-editor__area a {
  cursor: text;
}

.fx-editor__error {
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid #e0b7a8;
  background: #fbe9e3;
  color: #8f2b1e;
  font-size: 12px;
}

.fx-editor__error[hidden] {
  display: none;
}

.fx-editor__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 26px;
  padding: 3px 10px;
  border-top: 1px solid #eadbb8;
  border-radius: 0 0 7px 7px;
  background: #fbf5e4;
  color: #8a7350;
  font-size: 11px;
}

.fx-editor__status[hidden] {
  display: none;
}

.fx-editor__discard {
  padding: 0;
  border: 0;
  background: none;
  color: #063677;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.fx-editor__size {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.fx-editor__meter {
  width: 60px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: #eadbb8;
}

.fx-editor__meter span {
  display: block;
  width: 0;
  height: 100%;
  background: #b8893e;
  transition: width 0.2s;
}

.fx-editor.is-near .fx-editor__meter span {
  background: #d07a1a;
}

.fx-editor.is-over .fx-editor__meter span,
.fx-editor.is-over [data-count] {
  background: #a3361f;
  color: #a3361f;
}

.fx-editor.is-over [data-count] {
  background: none;
  font-weight: 700;
}

/* YouTube card while editing */
.fx-video {
  position: relative;
  display: block;
  width: 320px;
  max-width: 100%;
  margin: 6px 0 10px;
  overflow: hidden;
  border: 1px solid #c8a46a;
  border-radius: 7px;
  background: #1b1208;
  aspect-ratio: 16 / 9;
  user-select: none;
}

.fx-video img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

.fx-video__label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
}

.fx-video__label .fa-youtube {
  color: #ff4e45;
}

.fx-video__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
}

.fx-video__remove:hover {
  background: #a3361f;
}

/* Popovers: link, image, video, character, smileys, colours */
.fx-pop {
  position: absolute;
  z-index: 5;
  box-sizing: border-box;
  width: 300px;
  max-width: calc(100% - 8px);
  padding: 12px;
  border: 1px solid #b8893e;
  border-radius: 8px;
  background: #fffaf0;
  box-shadow: 0 8px 24px rgba(60, 35, 5, 0.25);
}

.fx-pop[hidden] {
  display: none;
}

.fx-pop[data-kind="smiley"],
.fx-pop[data-kind="color"] {
  width: auto;
}

.fx-pop__field {
  display: block;
  margin-bottom: 8px;
}

.fx-pop__field span {
  display: block;
  margin-bottom: 3px;
  color: #4a3010;
  font-size: 11.5px;
  font-weight: 700;
}

.fx-pop__field input {
  box-sizing: border-box;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #c8a46a;
  border-radius: 5px;
  background: #fff;
  color: #2b2010;
  font: 13px inherit;
  font-family: inherit;
}

.fx-pop__field input:focus {
  outline: none;
  border-color: #a57a36;
  box-shadow: 0 0 0 3px rgba(214, 160, 60, 0.28);
}

.fx-pop__hint {
  margin: 0 0 8px;
  color: #6b5430;
  font-size: 11.5px;
  line-height: 1.4;
}

.fx-pop__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.fx-pop__msg {
  flex: 1;
  color: #8f2b1e;
  font-size: 11px;
  line-height: 1.3;
}

.fx-pop__list {
  margin: -4px 0 8px;
  padding: 3px;
  list-style: none;
  border: 1px solid #dcc394;
  border-radius: 5px;
  background: #fff;
}

.fx-pop__list[hidden] {
  display: none;
}

.fx-pop__list li {
  padding: 5px 8px;
  border-radius: 4px;
  color: #2b2010;
  cursor: pointer;
}

.fx-pop__list li:hover {
  background: #f3e5c2;
}

.fx-pop__list small {
  color: #8a7350;
}

.fx-pop__grid {
  display: grid;
  grid-template-columns: repeat(5, 34px);
  gap: 3px;
}

.fx-pop__grid button,
.fx-pop__swatches button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.fx-pop__grid button:hover,
.fx-pop__grid button:focus-visible {
  border-color: #c8a46a;
  background: #f3e5c2;
  outline: none;
}

.fx-pop__swatches {
  display: grid;
  grid-template-columns: repeat(9, 24px);
  gap: 5px;
}

.fx-pop__swatches button {
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #c8a46a;
}

.fx-pop__swatches button:hover,
.fx-pop__swatches button:focus-visible {
  box-shadow: 0 0 0 2px #3b2e1a;
  outline: none;
}

.fx-pop__swatches .is-default {
  background: linear-gradient(135deg, #fff 45%, #a3361f 45%, #a3361f 55%, #fff 55%);
}

/* ---------- Post content (thread view and the editor) ---------- */
.post-body {
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.post-body > :first-child {
  margin-top: 0;
}

.post-body p {
  margin: 0 0 10px;
}

.post-body h2,
.post-body h3,
.post-body h4 {
  margin: 16px 0 8px;
  color: #660000;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1.25;
}

.post-body h2 {
  font-size: 21px;
}

.post-body h3 {
  font-size: 17px;
}

.post-body h4 {
  font-size: 15px;
}

.post-body ul,
.post-body ol {
  margin: 0 0 10px;
  padding-left: 24px;
}

.post-body li {
  margin: 2px 0;
}

.post-body li > p {
  margin: 0;
}

.post-body a {
  color: #063677;
  text-decoration: underline;
  text-decoration-color: rgba(6, 54, 119, 0.35);
}

.post-body a:hover {
  color: #0058c6;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  vertical-align: middle;
}

.post-body img.smiley {
  border-radius: 0;
}

.post-body blockquote {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid #dcc394;
  border-left: 4px solid #b8893e;
  border-radius: 4px;
  background: rgba(240, 222, 176, 0.45);
  color: #3b2e1a;
}

.post-body blockquote[data-author]::before {
  content: attr(data-author) " wrote:";
  display: block;
  margin-bottom: 4px;
  color: #8a5a14;
  font-size: 12px;
  font-weight: 700;
}

.post-body blockquote > :last-child {
  margin-bottom: 0;
}

.post-body pre {
  margin: 0 0 12px;
  padding: 10px 12px;
  overflow-x: auto;
  border: 1px solid #3a2a14;
  border-radius: 5px;
  background: #2a1f12;
  color: #f3e7cc;
  font: 12.5px/1.5 Consolas, Menlo, monospace;
  white-space: pre-wrap;
}

.post-body code {
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(165, 122, 54, 0.18);
  font: 12.5px Consolas, Menlo, monospace;
}

.post-body pre code {
  padding: 0;
  background: none;
}

.post-body hr {
  margin: 14px 0;
  border: 0;
  border-top: 1px solid rgba(165, 122, 54, 0.45);
}

.post-video {
  position: relative;
  max-width: 560px;
  margin: 0 0 12px;
  aspect-ratio: 16 / 9;
}

.post-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 6px;
}

/* ---------- Edit post / quick reply wrappers ---------- */
.compose--edit .compose__form {
  grid-template-columns: 1fr;
}

.reply-box {
  margin-top: 14px;
  padding: 14px 16px 16px;
  border: 1px solid #c8913a;
  border-radius: 8px;
  background: linear-gradient(to bottom, #f8f0d4, #f1e3b8);
}

.reply-box__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.reply-box .reply-box__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #660000;
  font: 18px Georgia, "Times New Roman", serif;
}

.reply-box__title i {
  color: #a57a36;
  font-size: 15px;
}

.reply-box .compose__footer {
  margin-top: 12px;
  padding-top: 0;
  border-top: 0;
}

/* Flash messages of the forum layout */
.alert-success,
.alert-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

.alert-success::before,
.alert-error::before {
  font: 900 13px "Font Awesome 5 Free";
}

.alert-success {
  border-color: #7fae6a;
  background: #e9f3dc;
  color: #2f5a1c;
}

.alert-success::before {
  content: "\f00c";
}

.alert-error {
  border-color: #d29a85;
  background: #fbe9e3;
  color: #8f2b1e;
}

.alert-error::before {
  content: "\f071";
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
