/**
 * ZCMS Rich Text Default Styles
 *
 * Import this file to apply default styles to rich text content:
 *   @import '@zcms/client/rich-text.css';
 *
 * Or override specific classes in your own CSS:
 *   .rt-link { color: #0066cc; }
 *   .rt-link:hover { color: #004499; }
 */

/* ===== Paragraph ===== */
.rt-paragraph {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
}

/* ===== Headings ===== */
.rt-heading1 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  color: #1a1a1a;
}

.rt-heading2 {
  margin-top: 1.25rem;
  margin-bottom: 0.625rem;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: #1a1a1a;
}

.rt-heading3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  color: #333333;
}

.rt-heading4 {
  margin-top: 0.75rem;
  margin-bottom: 0.375rem;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: #333333;
}

/* ===== Lists ===== */
.rt-bullet-list {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding-left: 1.5rem;
  list-style-type: disc;
}

.rt-ordered-list {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding-left: 1.5rem;
  list-style-type: decimal;
}

.rt-list-item {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  line-height: 1.6;
}

/* ===== Link ===== */
.rt-link {
  color: #6366f1;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.rt-link:hover {
  color: #4f46e5;
}

/* ===== Divider ===== */
.rt-divider {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  border: none;
  border-top: 1px solid #e5e5e5;
}

/* ===== Text Marks ===== */
.rt-bold {
  font-weight: 700;
}

.rt-italic {
  font-style: italic;
}

.rt-underline {
  text-decoration: underline;
}

.rt-strike {
  text-decoration: line-through;
}

/* ===== Table ===== */
.rt-table {
  display: grid;
  margin-top: 1rem;
  margin-bottom: 1rem;
  gap: 1px;
  overflow: hidden;
  border-radius: 0.5rem;
  background-color: #e5e5e5;
  outline: 1px solid #e5e5e5;
}

.rt-table-head {
  background-color: #f5f5f5;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: #333333;
}

.rt-table-cell {
  background-color: #ffffff;
  padding: 0.75rem 1rem;
}

/* ===== Image ===== */
.rt-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1rem;
  margin-bottom: 1rem;
  width: 100%;
}

.rt-image[data-align="left"] {
  align-items: flex-start;
}

.rt-image[data-align="right"] {
  align-items: flex-end;
}

.rt-image-media {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.rt-image-caption {
  margin-top: 0.5rem;
  font-size: 13px;
  color: #666666;
  text-align: center;
}

.rt-image[data-align="left"] .rt-image-caption {
  text-align: left;
}

.rt-image[data-align="right"] .rt-image-caption {
  text-align: right;
}

/* ===== Code Block ===== */
.rt-code-block {
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 0.5rem;
  background-color: #1e1e1e;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #d4d4d4;
}

/* ===== Blockquote ===== */
.rt-blockquote {
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid #6366f1;
  background-color: #f8f8f8;
  color: #444444;
}

/* ===== Layout ===== */
.rt-layout {
  display: flex;
  gap: 1px;
  margin-top: 1rem;
  margin-bottom: 1rem;
  overflow: hidden;
  border-radius: 0.5rem;
  background-color: #e5e5e5;
  outline: 1px solid #e5e5e5;
}

.rt-layout-child1,
.rt-layout-child2 {
  flex: 1;
  min-width: 0;
  padding: 1rem;
  background-color: #ffffff;
}

/* ===== Superscript ===== */
.rt-superscript {
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
}

/* ===== Citation ===== */
/* 脚注序号计数器在富文本字段根上归零，保证每个字段从 1 重新编号 */
.zcms-rich-text {
  counter-reset: rt-footnote;
}

.rt-citation {
  counter-increment: rt-footnote;
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  font-size: 12px;
  line-height: 1.6;
  color: #666666;
  border-top: 1px solid #e5e5e5;
}

.rt-citation::before {
  content: counter(rt-footnote);
  display: inline-block;
  min-width: 1.5em;
  margin-inline-end: 0.5em;
  font-weight: 600;
  text-align: center;
  color: #333333;
}

/* ===== Disclaimer ===== */
.rt-disclaimer {
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  font-size: 12px;
  line-height: 1.6;
  color: #999999;
  background-color: #f9f9f9;
  border-radius: 0.25rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .rt-heading1 {
    font-size: 24px;
  }

  .rt-heading2 {
    font-size: 20px;
  }

  .rt-heading3 {
    font-size: 16px;
  }

  .rt-layout {
    flex-direction: column;
  }

  .rt-code-block {
    font-size: 12px;
  }
}
