/* The Remarks tab: composer, remark cards, replies, Markdown, lightbox (RM-1 – RM-5). */

.remarks {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 820px;
}

.remarks__note {
  margin: 0;
}

/* ------------------------------------------------------------------ composer */

.composer {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.composer--inline {
  padding: 0;
  background: none;
  box-shadow: none;
}

.composer > .avatar {
  flex: none;
}

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

.composer__box {
  display: flex;
  flex-direction: column;
  border-radius: calc(14px * var(--r));
  background: oklch(var(--l975) calc(.006 * var(--c)) var(--h));
  overflow: hidden;
}

.composer__box--dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.composer__toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--rule);
}

.composer__modes {
  display: flex;
  gap: 2px;
  margin-right: 8px;
}

.composer__modes button,
.composer__tool {
  height: 30px;
  border: none;
  border-radius: calc(9px * var(--r));
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.composer__modes button {
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: var(--w-semibold);
}

.composer__modes button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: var(--w-bold);
}

.composer__tool {
  width: 30px;
  display: grid;
  place-items: center;
}

.composer__tool:hover,
.composer__modes button:hover {
  background: var(--hover);
}

.composer__tool:disabled {
  opacity: .4;
}

.serif {
  font-family: Georgia, serif;
}

.composer__text {
  width: 100%;
  min-height: 84px;
  padding: 12px 14px;
  border: none;
  outline: none;
  resize: vertical;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}

.composer__preview {
  min-height: 84px;
  padding: 12px 14px;
}

.composer__files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 10px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: calc(9px * var(--r));
  background: var(--surface);
  font-size: 12px;
}

.file-chip button {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

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

.composer__hint {
  font-size: 12px;
  color: var(--muted);
}

.composer__spacer {
  flex: 1;
}

/* ------------------------------------------------------------------ remarks and replies */

.remark {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.remark > .avatar {
  flex: none;
}

.remark--deleted {
  background: transparent;
  box-shadow: 0 0 0 1px var(--ring);
}

.remark__gone {
  margin: 0;
  font-style: italic;
}

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

.remark__who {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.remark__spacer {
  flex: 1;
}

.remark__when {
  font-size: 12px;
  color: var(--muted);
}

.remark__edited,
.remark__reply {
  font-size: 12px;
}

.remark__reply {
  align-self: flex-start;
  font-size: 12.5px;
}

.reply {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: calc(14px * var(--r));
  background: oklch(var(--l975) calc(.006 * var(--c)) var(--h));
}

.reply > .avatar {
  flex: none;
}

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

.reply .md {
  font-size: 13.5px;
}

.reply-box__input {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: calc(12px * var(--r));
  outline: 2px solid oklch(var(--l850) calc(.06 * var(--c)) var(--h));
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.reply-box__input:focus {
  outline-color: var(--focus);
}

.history {
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: calc(12px * var(--r));
  background: var(--tint);
}

.history__head {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

/* ------------------------------------------------------------------ rendered Markdown */

.md {
  line-height: 1.6;
  overflow-wrap: anywhere;
}

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

/* A clamped excerpt is exactly n lines: no gaps between blocks that would show a sliver of line n+1. */
.latest__clamp.md > * + * {
  margin-top: 0;
}

.md p,
.md ul,
.md ol,
.md pre,
.md blockquote,
.md table {
  margin-block: 0;
}

.md ul,
.md ol {
  padding-left: 22px;
}

.md h1,
.md h2,
.md h3,
.md h4,
.md h5,
.md h6 {
  margin: 10px 0 0;
  font-size: 15px;
}

.md code {
  padding: 1px 5px;
  border-radius: calc(5px * var(--r));
  background: var(--tint);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .9em;
}

.md pre {
  padding: 10px 12px;
  border-radius: calc(9px * var(--r));
  background: var(--tint);
  overflow-x: auto;
}

.md pre code {
  padding: 0;
  background: none;
}

.md blockquote {
  margin-left: 0;
  padding-left: 12px;
  border-left: 3px solid var(--ring-strong);
  color: var(--muted);
}

.md a {
  color: var(--link);
}

.md img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: calc(9px * var(--r));
  box-shadow: 0 0 0 1px var(--ring);
  cursor: zoom-in;
}

.md a img {
  cursor: pointer;
}

.md table {
  border-collapse: collapse;
}

.md th,
.md td {
  padding: 4px 8px;
  border: 1px solid var(--ring-strong);
}

.md .mention {
  padding: 0 4px;
  border-radius: calc(5px * var(--r));
  background: var(--selected);
  color: var(--selected-ink);
  font-weight: var(--w-bold);
}

.md .project-ref {
  font-weight: var(--w-bold);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: oklch(.15 .01 285 / .82);
  cursor: zoom-out;
}

.lightbox__image {
  max-width: min(94vw, 1600px);
  max-height: 90vh;
  border-radius: calc(12px * var(--r));
  background: var(--surface);
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 22px;
}
