/*
 * Simple Theme — Clean, GitHub-inspired Markdown styling
 * Targets #preview content only
 */

/* ===== Typography ===== */
#preview {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  word-wrap: break-word;
}

/* ===== Headings ===== */
#preview h1,
#preview h2,
#preview h3,
#preview h4,
#preview h5,
#preview h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
}

#preview h1 {
  font-size: 2em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}

#preview h2 {
  font-size: 1.5em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--border);
}

#preview h3 {
  font-size: 1.25em;
}

#preview h4 {
  font-size: 1em;
}

#preview h5 {
  font-size: 0.875em;
}

#preview h6 {
  font-size: 0.85em;
  opacity: 0.7;
}

#preview h1:first-child,
#preview h2:first-child,
#preview h3:first-child {
  margin-top: 0;
}

/* ===== Paragraphs & Text ===== */
#preview p {
  margin-top: 0;
  margin-bottom: 16px;
}

#preview strong {
  font-weight: 600;
}

#preview em {
  font-style: italic;
}

#preview del {
  text-decoration: line-through;
  opacity: 0.65;
}

/* ===== Links ===== */
#preview a {
  color: #0969da;
  text-decoration: none;
}

#preview a:hover {
  text-decoration: underline;
}

body.dark #preview a {
  color: #58a6ff;
}

/* ===== Lists ===== */
#preview ul,
#preview ol {
  margin-top: 0;
  margin-bottom: 16px;
  padding-left: 2em;
}

#preview li {
  margin-bottom: 4px;
}

#preview li + li {
  margin-top: 4px;
}

#preview li > p {
  margin-top: 16px;
}

#preview ul ul,
#preview ul ol,
#preview ol ul,
#preview ol ol {
  margin-bottom: 0;
}

/* ===== Task Lists ===== */
#preview input[type="checkbox"] {
  margin-right: 6px;
  vertical-align: middle;
}

/* ===== Blockquotes ===== */
#preview blockquote {
  margin: 0 0 16px 0;
  padding: 0 16px;
  border-left: 4px solid var(--border);
  color: inherit;
  opacity: 0.75;
}

#preview blockquote > :first-child {
  margin-top: 0;
}

#preview blockquote > :last-child {
  margin-bottom: 0;
}

/* ===== Code ===== */
#preview code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.875em;
  background: rgba(175, 184, 193, 0.2);
  border-radius: 4px;
  padding: 0.2em 0.4em;
}

#preview pre {
  margin-top: 0;
  margin-bottom: 16px;
  padding: 16px;
  overflow-x: auto;
  font-size: 0.875em;
  line-height: 1.5;
  background: #f6f8fa;
  border-radius: 6px;
  border: 1px solid var(--border);
}

body.dark #preview pre {
  background: #161b22;
}

#preview pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* ===== Horizontal Rule ===== */
#preview hr {
  border: none;
  height: 2px;
  background: var(--border);
  margin: 24px 0;
}

/* ===== Tables ===== */
#preview table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  margin-bottom: 16px;
  overflow: auto;
  font-size: 0.9em;
}

#preview table th,
#preview table td {
  padding: 8px 13px;
  border: 1px solid var(--border);
  text-align: left;
}

#preview table th {
  font-weight: 600;
  background: rgba(175, 184, 193, 0.1);
}

#preview table tr:nth-child(2n) {
  background: rgba(175, 184, 193, 0.06);
}

body.dark #preview table th {
  background: rgba(110, 118, 129, 0.15);
}

body.dark #preview table tr:nth-child(2n) {
  background: rgba(110, 118, 129, 0.08);
}

/* ===== Definition Lists ===== */
#preview dt {
  font-weight: 600;
  margin-top: 16px;
}

#preview dd {
  margin-left: 2em;
  margin-bottom: 8px;
}

/* ===== Keyboard Input ===== */
#preview kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.8em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
}
