/* Mellow Finance article — clean, Wikipedia-inspired, white background */

:root {
  --text: #1c1c1c;
  --muted: #4a4a4a;
  --link: #0645ad;
  --link-visited: #0b0080;
  --border: #e4e4e4;
  --rule: #d8d8d8;
  --toc-bg: #ffffff;
  --toc-active: #f0f4ff;
  --accent: #0b57d0;
  --max-content: 820px;
  --toc-width: 300px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: "Georgia", "Times New Roman", "Liberation Serif", serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---------- Layout ---------- */
.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 40px;
}

/* ---------- Sticky Table of Contents ---------- */
.toc {
  position: sticky;
  top: 0;
  flex: 0 0 var(--toc-width);
  width: var(--toc-width);
  max-height: 100vh;
  overflow-y: auto;
  padding: 28px 18px 40px 0;
  border-right: 1px solid var(--border);
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.toc__title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

.toc nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc nav > ol > li {
  counter-increment: toc;
}

.toc nav a {
  display: block;
  padding: 5px 10px 5px 12px;
  color: #24292f;
  border-left: 3px solid transparent;
  border-radius: 0 3px 3px 0;
}

.toc nav > ol > li > a::before {
  content: counter(toc) ". ";
  color: var(--muted);
}

.toc nav a:hover {
  background: #f6f8fa;
  text-decoration: none;
}

.toc nav a.is-active {
  background: var(--toc-active);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Main content ---------- */
.content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--max-content);
  padding: 32px 0 96px;
}

.content h1 {
  font-size: 2.15rem;
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.lead {
  font-size: 1.05rem;
  color: var(--text);
}

.content h2 {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 2.2em 0 0.5em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 20px;
}

.content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.6em 0 0.4em;
  scroll-margin-top: 20px;
}

.content p {
  margin: 0 0 1.1em;
}

.content ul,
.content ol {
  margin: 0 0 1.2em;
  padding-left: 1.5em;
}

.content li {
  margin-bottom: 0.5em;
}

.content strong {
  font-weight: 700;
}

/* Wikipedia-style info panel */
.infobox {
  float: right;
  width: 300px;
  margin: 6px 0 20px 24px;
  border: 1px solid var(--border);
  background: #f8f9fa;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
}

.infobox__title {
  background: #eaecf0;
  text-align: center;
  font-weight: 700;
  padding: 10px 12px;
  font-size: 15px;
}

.infobox table {
  width: 100%;
  border-collapse: collapse;
}

.infobox th,
.infobox td {
  text-align: left;
  vertical-align: top;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
}

.infobox th {
  width: 42%;
  color: var(--muted);
  font-weight: 600;
}

/* Figures */
figure {
  margin: 1.4em 0;
  border: 1px solid var(--border);
  background: #f8f9fa;
  padding: 8px;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
}

figcaption {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 4px 2px;
}

/* Key-fact callout */
.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: #f8f9fa;
  padding: 14px 18px;
  margin: 1.4em 0;
  font-size: 0.97rem;
}

/* FAQ */
.faq h3 {
  margin-top: 1.4em;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 40px;
  padding-top: 18px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  color: var(--muted);
}

/* Back-to-top */
.back-to-top {
  display: inline-block;
  margin-top: 10px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
}

/* Mobile TOC toggle */
.toc__toggle {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout {
    flex-direction: column;
    gap: 0;
    padding: 0 18px;
  }

  .toc {
    position: static;
    width: 100%;
    flex-basis: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
  }

  .toc__list {
    display: none;
  }

  .toc__list.is-open {
    display: block;
  }

  .toc__toggle {
    display: block;
    width: 100%;
    text-align: left;
    background: #f6f8fa;
    border: 1px solid var(--border);
    padding: 10px 14px;
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
  }

  .infobox {
    float: none;
    width: 100%;
    margin: 0 0 20px;
  }

  .content {
    max-width: 100%;
    padding-top: 20px;
  }

  .content h1 {
    font-size: 1.8rem;
  }
}
