/* prepstack-markdown-html v0.2.0 */
:root {
  color-scheme: light dark;
  --page: #f7f8fb;
  --surface: #ffffff;
  --surface-soft: #f0f3f8;
  --ink: #182033;
  --muted: #5d687d;
  --line: #d8dee9;
  --accent: #2457d6;
  --accent-soft: #e8efff;
  --code: #111827;
  --code-ink: #eef2ff;
  --note: #3974d8;
  --tip: #087e75;
  --warning: #9a5b00;
  --danger: #ad2d3b;
  --example: #7147b8;
  --radius: 0.8rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d1320;
    --surface: #151d2c;
    --surface-soft: #1d2738;
    --ink: #edf2fb;
    --muted: #adb8ca;
    --line: #344056;
    --accent: #90b4ff;
    --accent-soft: #1d315f;
    --code: #080d17;
    --code-ink: #eff4ff;
    --note: #82aefb;
    --tip: #5bd2c3;
    --warning: #f1b85a;
    --danger: #ff8c98;
    --example: #c3a0ff;
  }
}

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

html {
  font-size: clamp(16px, 1.1vw + 12px, 19px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-feature-settings: "kern" 1, "liga" 1;
  line-height: 1.42;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.55rem 0.8rem;
  border-radius: 0.4rem;
  color: var(--surface);
  background: var(--ink);
  transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.page {
  width: min(100% - 2rem, 76rem);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) 0;
}

.document-header,
.prose {
  max-width: 68ch;
  margin-right: auto;
  margin-left: auto;
}

.document-kicker {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.document-header h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.65rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.metadata {
  margin: 1.25rem 0 2.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.metadata summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent);
  font-weight: 650;
}

.metadata dl {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 0.35rem 0.85rem;
  margin: 0.8rem 0 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metadata dt { font-weight: 700; }
.metadata dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }

.prose { overflow-wrap: anywhere; }
.prose p { margin: 0 0 0.78em; }

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  line-height: 1.16;
  hyphens: none;
  page-break-after: avoid;
}

.prose h1 { margin: 2.25em 0 0.48em; font-size: 1.55em; }
.prose h2 { margin: 2em 0 0.42em; font-size: 1.28em; }
.prose h3 { margin: 1.65em 0 0.36em; font-size: 1.12em; }
.prose h4,
.prose h5,
.prose h6 { margin: 1.45em 0 0.3em; font-size: 1em; }
a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.2rem;
}

strong { font-weight: 720; }
em { font-style: italic; }
mark { padding: 0.06em 0.18em; color: #1d2433; background: #ffe58c; }

ul, ol { margin: 0 0 1em; padding-left: 1.45em; }
li { margin: 0.28em 0; }
li::marker { color: var(--muted); }
.task-list { padding-left: 0; list-style: none; }
.task-item { display: flex; align-items: flex-start; gap: 0.55rem; }
.task-item input { flex: 0 0 auto; width: 1rem; height: 1rem; margin: 0.23rem 0 0; accent-color: var(--accent); }

code,
pre {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-variant-ligatures: none;
}

code {
  padding: 0.1em 0.32em;
  border-radius: 0.3rem;
  background: var(--surface-soft);
  font-size: 0.88em;
}

pre {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.1rem;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--line), transparent 20%);
  border-radius: var(--radius);
  color: var(--code-ink);
  background: var(--code);
  line-height: 1.5;
  tab-size: 4;
}

pre code { padding: 0; color: inherit; background: transparent; font-size: 0.84rem; }

.table-wrap {
  width: min(100%, 76rem);
  margin: 1.15rem 0 1.6rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table { width: 100%; border-collapse: collapse; font-size: 0.91rem; }
th, td { padding: 0.64rem 0.8rem; border: 0; text-align: left; vertical-align: top; }
thead th { border-bottom: 1.5px solid var(--ink); font-weight: 700; }
tbody tr + tr td { border-top: 1px solid var(--line); }
td { font-variant-numeric: tabular-nums lining-nums; }
.align-center { text-align: center; }
.align-right { text-align: right; }

blockquote {
  margin: 1.25rem 0 1.5rem 1.2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.94em;
}

.callout,
.base-fallback,
.embed-fallback {
  margin: 1.2rem 0 1.5rem;
  padding: 0.95rem 1rem;
  border: 1px solid color-mix(in srgb, var(--callout-color, var(--note)), transparent 50%);
  border-left: 0.28rem solid var(--callout-color, var(--note));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--callout-color, var(--note)), transparent 92%);
}

.callout-title,
.callout > summary { margin: 0; color: var(--callout-color, var(--note)); font-weight: 720; }
.callout-body { margin-top: 0.55rem; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-note, .callout-info, .callout-abstract { --callout-color: var(--note); }
.callout-tip, .callout-success { --callout-color: var(--tip); }
.callout-warning, .callout-question { --callout-color: var(--warning); }
.callout-danger, .callout-error, .callout-failure, .callout-bug { --callout-color: var(--danger); }
.callout-example { --callout-color: var(--example); }

.base-fallback,
.embed-fallback { --callout-color: var(--example); }
.fallback-title { display: block; margin-bottom: 0.25rem; color: var(--example); font-weight: 720; }
.fallback-copy { margin: 0; color: var(--muted); }
.unresolved-link, .blocked-link { color: var(--danger); border-bottom: 1px dotted currentColor; }

hr { margin: 2rem 0; border: 0; border-top: 1px solid var(--line); }
.block-anchor { position: relative; top: -1rem; }

@media (max-width: 42rem) {
  .page { width: min(100% - 1.25rem, 76rem); padding-top: 2rem; }
  .metadata dl { grid-template-columns: 1fr; }
  .metadata dd + dt { margin-top: 0.35rem; }
  th, td { padding: 0.52rem 0.62rem; }
  blockquote { margin-left: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  :root { color-scheme: light; }
  body { color: #111; background: #fff; font-size: 11pt; }
  .page { width: auto; padding: 0; }
  .skip-link, .metadata { display: none; }
  .document-header, .prose { max-width: none; }
  p { orphans: 2; widows: 2; }
  pre { white-space: pre-wrap; }
}
