/* markdown-yo demo — minimal, modern styling */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --fg: #1a1a2e;
  --border: #d0d7de;
  --header-bg: #24292f;
  --header-fg: #ffffff;
  --pane-header-bg: #f6f8fa;
  --editor-bg: #ffffff;
  --preview-bg: #ffffff;
  --accent: #0969da;
  --code-bg: #f0f3f6;
  --render-time: #57ab5a;
  --options-bg: #f6f8fa;
  --group-label: #656d76;
  --mark-bg: #fff3bf;
  --admonition-note: #0969da;
  --admonition-warning: #d4a72c;
  --admonition-tip: #1a7f37;
  --admonition-danger: #cf222e;
  --callout-tip: #1a7f37;
  --callout-warning: #d4a72c;
  --callout-note: #0969da;
  --callout-important: #8250df;
  --callout-caution: #cf222e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --fg: #e6edf3;
    --border: #30363d;
    --header-bg: #161b22;
    --header-fg: #e6edf3;
    --pane-header-bg: #161b22;
    --editor-bg: #0d1117;
    --preview-bg: #0d1117;
    --accent: #58a6ff;
    --code-bg: #161b22;
    --render-time: #3fb950;
    --options-bg: #161b22;
    --group-label: #8b949e;
    --mark-bg: #5c4b00;
    --admonition-note: #58a6ff;
    --admonition-warning: #d29922;
    --admonition-tip: #3fb950;
    --admonition-danger: #f85149;
    --callout-tip: #3fb950;
    --callout-warning: #d29922;
    --callout-note: #58a6ff;
    --callout-important: #a371f7;
    --callout-caution: #f85149;
  }
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

header {
  background: var(--header-bg);
  color: var(--header-fg);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
}

.subtitle {
  font-size: 13px;
  opacity: 0.7;
}

.render-time {
  margin-left: auto;
  color: var(--render-time);
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  text-align: right;
  font-size: 13px;
}

/* Options bar */
.options-bar {
  background: var(--options-bg);
  border-bottom: 1px solid var(--border);
  padding: 6px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 12px;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-label {
  font-weight: 600;
  color: var(--group-label);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
  margin-right: 2px;
}

.options-bar label {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  white-space: nowrap;
}

.options-bar input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
}

main {
  display: flex;
  height: calc(100vh - 82px);
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-width: 0;
}

.pane:last-child { border-right: none; }

.pane-header {
  background: var(--pane-header-bg);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  opacity: 0.7;
}

#editor {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  padding: 16px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.6;
  background: var(--editor-bg);
  color: var(--fg);
  tab-size: 4;
}

.preview-content {
  flex: 1;
  padding: 16px 24px;
  overflow-y: auto;
  background: var(--preview-bg);
  line-height: 1.6;
  font-size: 15px;
}

/* Preview typography */
.preview-content h1, .preview-content h2, .preview-content h3,
.preview-content h4, .preview-content h5, .preview-content h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.preview-content h1 { font-size: 2em; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.preview-content h2 { font-size: 1.5em; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.preview-content h3 { font-size: 1.25em; }

.preview-content p { margin-bottom: 16px; }
.preview-content ul, .preview-content ol { margin-bottom: 16px; padding-left: 2em; }
.preview-content li { margin-bottom: 4px; }

.preview-content code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 85%;
}

.preview-content pre {
  background: var(--code-bg);
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.preview-content pre code {
  background: none;
  padding: 0;
  font-size: 85%;
}

.preview-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 4px 16px;
  margin: 0 0 16px 0;
  color: var(--fg);
  opacity: 0.8;
}

.preview-content table {
  border-collapse: collapse;
  margin-bottom: 16px;
  width: auto;
}

.preview-content th, .preview-content td {
  border: 1px solid var(--border);
  padding: 6px 13px;
}

.preview-content th {
  font-weight: 600;
  background: var(--pane-header-bg);
}

.preview-content hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 24px 0;
}

.preview-content a { color: var(--accent); text-decoration: none; }
.preview-content a:hover { text-decoration: underline; }

.preview-content img { max-width: 100%; height: auto; }

/* Mark / highlight */
.preview-content mark {
  background: var(--mark-bg);
  padding: 1px 4px;
  border-radius: 2px;
}

/* Subscript / superscript */
.preview-content sub { font-size: 75%; }
.preview-content sup { font-size: 75%; }

/* Definition list */
.preview-content dl { margin-bottom: 16px; }
.preview-content dt { font-weight: 600; margin-top: 12px; }
.preview-content dd { margin-left: 2em; margin-bottom: 4px; }

/* Footnotes */
.preview-content .footnotes-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.preview-content .footnotes {
  font-size: 85%;
  padding-top: 8px;
}

.preview-content .footnotes-list { padding-left: 2em; }
.preview-content .footnote-item { margin-bottom: 8px; }
.preview-content .footnote-ref a { font-size: 75%; vertical-align: super; text-decoration: none; color: var(--accent); }
.preview-content .footnote-backref { text-decoration: none; color: var(--accent); }

/* Admonition blocks */
.preview-content .admonition {
  border-left: 4px solid var(--admonition-note);
  background: color-mix(in srgb, var(--admonition-note) 8%, var(--bg));
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 0 6px 6px 0;
}

.preview-content .admonition-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.preview-content details.admonition > summary.admonition-title {
  cursor: pointer;
  list-style: none;
}

.preview-content details.admonition > summary.admonition-title::-webkit-details-marker {
  display: none;
}

.preview-content details.admonition > summary.admonition-title::before {
  content: "▶";
  display: inline-block;
  margin-right: 8px;
  font-size: 0.7em;
  transition: transform 0.15s ease;
}

.preview-content details.admonition[open] > summary.admonition-title::before {
  transform: rotate(90deg);
}

.preview-content .admonition.warning,
.preview-content .admonition.caution,
.preview-content .admonition.attention {
  border-left-color: var(--admonition-warning);
  background: color-mix(in srgb, var(--admonition-warning) 8%, var(--bg));
}

.preview-content .admonition.tip,
.preview-content .admonition.hint {
  border-left-color: var(--admonition-tip);
  background: color-mix(in srgb, var(--admonition-tip) 8%, var(--bg));
}

.preview-content .admonition.danger,
.preview-content .admonition.error {
  border-left-color: var(--admonition-danger);
  background: color-mix(in srgb, var(--admonition-danger) 8%, var(--bg));
}

/* Callout blocks (GitHub-style alerts) */
.preview-content .callout {
  border-left: 4px solid var(--callout-note);
  background: color-mix(in srgb, var(--callout-note) 8%, var(--bg));
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 0 6px 6px 0;
}

.preview-content .callout-title {
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: capitalize;
}

.preview-content .callout[data-callout="tip"] {
  border-left-color: var(--callout-tip);
  background: color-mix(in srgb, var(--callout-tip) 8%, var(--bg));
}

.preview-content .callout[data-callout="warning"] {
  border-left-color: var(--callout-warning);
  background: color-mix(in srgb, var(--callout-warning) 8%, var(--bg));
}

.preview-content .callout[data-callout="important"] {
  border-left-color: var(--callout-important);
  background: color-mix(in srgb, var(--callout-important) 8%, var(--bg));
}

.preview-content .callout[data-callout="caution"] {
  border-left-color: var(--callout-caution);
  background: color-mix(in srgb, var(--callout-caution) 8%, var(--bg));
}

/* Abbreviation underline */
.preview-content abbr {
  text-decoration: underline dotted;
  cursor: help;
}

/* Loading overlay */
.loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 18px;
  z-index: 100;
  transition: opacity 0.3s;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
  main { flex-direction: column; }
  .pane { border-right: none; border-bottom: 1px solid var(--border); }
  .pane:last-child { border-bottom: none; }
  .options-bar { font-size: 11px; gap: 4px 12px; }
}
