/* =========================
   Base reset
========================= */
* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  padding: 3rem 2.5rem;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;

  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
  color: #2b2b2b;
  background: #ffffff;
}

/* =========================
   Headings
========================= */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: #1f2937;
  page-break-after: avoid;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
  padding-bottom: 0.4rem;
  border-bottom: 3px solid #2563eb;
}

h2 {
  font-size: 1.5rem;
  margin-top: 2.2rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #d1d5db;
}

h3 {
  font-size: 1.2rem;
  margin-top: 1.8rem;
}

/* =========================
   Text
========================= */
p {
  margin: 0.7rem 0;
}

strong {
  font-weight: 600;
}

em {
  color: #4b5563;
}

/* =========================
   Links
========================= */
a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* =========================
   Code
========================= */
code {
  background: #f3f4f6;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
}

pre {
  background: #0f172a;
  color: #e5e7eb;
  padding: 1rem 1.2rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.2rem 0;
  page-break-inside: avoid;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
}

/* =========================
   Lists
========================= */

ul,
ol {
  margin: 0.8rem 0;
  padding-left: 1.6rem;              /* base indent */
  list-style-position: outside;
}

li {
  margin: 0.35rem 0;
}

/* Level 2 */
ul ul,
ol ol,
ul ol,
ol ul {
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
  padding-left: 1.6rem;              /* second-level indent */
}

/* Optional: visual hierarchy */
ul ul {
  list-style-type: circle;
}

ul ul ul {
  list-style-type: square;
}

/* =========================
   Tables
========================= */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.2rem 0;
  page-break-inside: avoid;
}

th, td {
  border: 1px solid #e5e7eb;
  padding: 0.6rem 0.8rem;
  text-align: left;
}

th {
  background: #f9fafb;
  font-weight: 600;
}

/* =========================
   Blockquotes
========================= */
blockquote {
  border-left: 4px solid #2563eb;
  margin: 1.2rem 0;
  padding-left: 1rem;
  color: #374151;
  font-style: italic;
}

/* =========================
   Images
========================= */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.2rem auto;
  page-break-inside: avoid;
}

/* =========================
   Mermaid
========================= */
.mermaid {
  text-align: center;
  margin: 2rem 0;
  page-break-inside: avoid;
}

/* =========================
   Print / PDF rules
========================= */
@media print {
  body {
    padding: 1.5cm;
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #6b7280;
  }
}

.section {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin: 2rem 0;
  page-break-inside: avoid;
}
