/* ============================================================
   composer.css —— 积木块：站内撰写图文（弹层）
   宽版双栏：左侧编辑（标题 / 标签 / Markdown），右侧预览 + 插图缩略图。
   ============================================================ */

.composer[hidden] {
  display: none;
}

.composer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.composer__mask {
  position: absolute;
  inset: 0;
  background: rgba(18, 23, 34, 0.5);
  backdrop-filter: blur(3px);
  animation: composer-fade 0.2s var(--ease);
}

.composer__dialog {
  position: relative;
  width: min(1120px, 100%);
  max-height: min(90vh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--c-card);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(15, 20, 30, 0.3);
  overflow: hidden;
  animation: composer-pop 0.24s var(--ease);
}

@keyframes composer-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes composer-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* —— 头部 —— */
.composer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 26px;
  border-bottom: 1px solid var(--c-line);
}

.composer__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: 0.01em;
}

.composer__subtitle {
  margin-left: 12px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--c-text-3);
}

.composer__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--c-text-3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.composer__close:hover {
  background: var(--c-card-soft);
  color: var(--c-text);
}

/* —— 主体 —— */
.composer__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px 26px;
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  gap: 24px;
}

.composer__col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field--grow {
  flex: 1;
  min-height: 0;
}

.field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.field__label {
  font-size: 13px;
  color: var(--c-text-2);
  font-weight: 500;
}

.field__input,
.field__textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-surface-soft);
  font-size: 14.5px;
  color: var(--c-text);
  outline: none;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}

.field__input--lg {
  height: 50px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.field__input:focus,
.field__textarea:focus {
  border-color: var(--c-accent);
  background: var(--c-surface-focus);
}

/* 卡片日期 + 时间：两个输入框并排 */
.composer__when {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.composer__when .field__input {
  height: 42px;
  padding: 0 12px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.composer__when input[type="date"] {
  font-family: inherit;
}

.composer__inline-tip {
  font-size: 12px;
  color: var(--c-text-3);
}

.field__textarea {
  flex: 1;
  min-height: 240px;
  resize: vertical;
  line-height: 1.8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13.5px;
}

/* —— 标签选择 —— */
.composer__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-surface-soft);
  min-height: 54px;
  align-items: center;
}

.composer__chip {
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-pill);
  background: var(--c-surface-focus);
  color: var(--c-text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}

.composer__chip:hover {
  border-color: var(--c-line-strong);
  color: var(--c-text);
}

.composer__chip.is-on {
  border-color: transparent;
  background: var(--c-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(20, 177, 239, 0.3);
}

.composer__chip--new {
  border-style: dashed;
  color: var(--c-accent-strong);
  background: transparent;
}

.composer__taginput {
  height: 30px;
  width: 130px;
  padding: 0 12px;
  border: 1px solid var(--c-accent);
  border-radius: var(--radius-pill);
  font-size: 13px;
  outline: none;
}

.composer__link {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12.5px;
  color: var(--c-accent-strong);
  cursor: pointer;
}

.composer__link:hover {
  text-decoration: underline;
}

/* —— 标签管理面板 —— */
.composer__tagpanel {
  border: 1px solid var(--c-line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--c-card-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
}

.composer__tagpanel[hidden] {
  display: none;
}

.composer__tagrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
}

.composer__tagrow:hover {
  background: var(--c-surface-focus);
}

.composer__tagname {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer__tagrow button {
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--c-line);
  border-radius: 5px;
  background: var(--c-surface-focus);
  color: var(--c-text-2);
  font-size: 12px;
  cursor: pointer;
  flex: none;
}

.composer__tagrow button:hover {
  color: var(--c-text);
  border-color: var(--c-line-strong);
}

.composer__tagrow button[data-act='deltag']:hover {
  color: var(--c-danger);
  border-color: var(--c-danger-line);
  background: var(--c-danger-bg);
}

.composer__tagrow input {
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--c-accent);
  border-radius: 5px;
  font-size: 12.5px;
  outline: none;
}

.composer__tagpanel-empty {
  padding: 8px 4px;
  font-size: 12.5px;
  color: var(--c-text-3);
}

/* —— 工具条 —— */
.composer__tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.composer__tools .btn {
  height: 36px;
  padding: 0 14px;
  font-size: 13.5px;
  border-radius: 8px;
}

.composer__tip {
  font-size: 12px;
  color: var(--c-text-3);
}

/* —— 预览 —— */
.composer__preview {
  flex: 1;
  padding: 18px 20px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-surface-soft);
  min-height: 300px;
  max-height: 520px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.85;
  color: var(--c-text);
}

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

.composer__preview h1,
.composer__preview h2,
.composer__preview h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--c-text);
}

.composer__preview p {
  margin: 0 0 12px;
  color: var(--c-text-2);
}

.composer__preview ul,
.composer__preview ol {
  margin: 0 0 12px;
  padding-left: 22px;
  list-style: disc;
}

.composer__preview li {
  color: var(--c-text-2);
}

.composer__preview blockquote {
  margin: 0 0 12px;
  padding: 8px 14px;
  border-left: 3px solid var(--c-accent);
  background: var(--c-accent-soft);
  color: var(--c-text-2);
}

.composer__preview img {
  border-radius: 8px;
  margin: 10px 0;
}

.composer__preview code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--c-code-bg);
  font-size: 12.5px;
}

.composer__preview pre {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--c-code-block);
  color: var(--c-code-block-text);
  overflow: auto;
  font-size: 12.5px;
}

.composer__preview pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.composer__preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 12.5px;
}

.composer__preview th,
.composer__preview td {
  border: 1px solid var(--c-line);
  padding: 7px 9px;
  text-align: left;
}

.composer__preview th {
  background: var(--c-card-soft);
}

.composer__preview .composer__raw {
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  color: var(--c-text-2);
}

/* —— 插图缩略图 —— */
.composer__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer__thumb {
  position: relative;
  width: 78px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--c-line);
  background: var(--c-card-soft);
}

.composer__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.composer__thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 20, 30, 0.66);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* —— 底部 —— */
.composer__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 26px;
  border-top: 1px solid var(--c-line);
  background: var(--c-surface-soft);
}

.composer__foot-tip {
  font-size: 12.5px;
  color: var(--c-text-3);
}

.composer__foot-actions {
  display: flex;
  gap: 12px;
}

.composer__foot .btn {
  height: 42px;
  padding: 0 22px;
  font-size: 14px;
}

@media (max-width: 900px) {
  .composer__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .composer__preview {
    min-height: 200px;
    max-height: 280px;
  }

  .composer__dialog {
    max-height: 94vh;
  }

  .composer__foot-tip {
    display: none;
  }

  .composer__subtitle {
    display: none;
  }
}
