/*
 * The written and generated pages (src/seo-pages.ts): guides, comparisons,
 * glossary, blog, the TAOCP and Crafting Interpreters hubs, the NeetCode list
 * and the study plan generator. Tokens from site.css. Everything has its size
 * up front so nothing shifts as the page loads.
 */
.sg-crumbs { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }
.sg-crumbs a { color: var(--text-dim); text-decoration: none; }
.sg-crumbs a:hover { color: var(--link); text-decoration: underline; }
.sg-crumbs [aria-current] { color: var(--text-body); }

.sg-lede { font-size: 18px; line-height: 1.7; color: var(--text-body); max-width: 44rem; }
.sg-lede p + p { margin-top: 12px; }
.sg-lede strong { color: var(--text); font-weight: 600; }
.sg-lede a, .sg-prose a, .sg-faq a { text-decoration: underline; text-decoration-color: var(--link-line); text-underline-offset: 4px; }
.sg-meta { margin: 12px 0 8px; }
.sg-meta a { color: inherit; }

.sg-h2 { font-size: 20px; line-height: 1.3; color: var(--text); margin: 40px 0 14px; letter-spacing: -0.01em; }
.sg-h2 .small { font-weight: 500; }
.sg-h3 { font-size: 16px; color: var(--text); margin: 0 0 8px; }

/* Long-form body: prose from site.css, plus what Markdown can produce. */
.sg-prose { margin-top: 8px; }
.sg-prose h2 { scroll-margin-top: 16px; }
.sg-prose h3 { font-size: 17px; color: var(--text); margin: 24px 0 8px; }
.sg-prose ol { padding-left: 22px; display: grid; gap: 8px; margin: 16px 0 0; }
.sg-prose p + ol, .sg-prose ol + p, .sg-prose ul + ol, .sg-prose .table-wrap + p, .sg-prose p + .table-wrap, .sg-prose pre + p, .sg-prose p + pre, .sg-prose blockquote + p, .sg-prose p + blockquote { margin-top: 16px; }
.sg-prose blockquote { border-left: 3px solid var(--line-strong); padding-left: 16px; color: var(--text); }
.sg-prose code, .sg-lede code, .md-table code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-muted); border-radius: 4px; padding: 1px 4px; }
.md-code { font-family: var(--mono); font-size: 14px; line-height: 1.55; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; color: var(--text); max-width: 44rem; }
.md-code code { background: none; padding: 0; font-size: inherit; }
.sg .table-wrap { margin-top: 16px; max-width: 100%; }
.md-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.md-table th, .md-table td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.md-table thead th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); background: var(--bg-soft); white-space: nowrap; }
.md-table tbody th { font-weight: 600; color: var(--text); }
.md-table tbody tr:last-child th, .md-table tbody tr:last-child td { border-bottom: 0; }
.md-table a { text-decoration: none; }
.md-table a:hover { text-decoration: underline; }
.sg-plan td:nth-child(2), .sg-plan th:first-child { white-space: nowrap; }

/* On this page */
.sg-toc { margin: 24px 0 8px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); max-width: 44rem; }
.sg-toc-h { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 6px; }
.sg-toc ol { margin: 0; padding-left: 20px; display: grid; gap: 2px; font-size: 14px; }
@media (min-width: 640px) { .sg-toc ol { grid-template-columns: 1fr 1fr; column-gap: 24px; } }

/* Cards: related pages, hub lists */
.sg-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .sg-cards { grid-template-columns: 1fr 1fr; } }
.sg-cards a { display: grid; gap: 4px; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); background: var(--bg); }
.sg-cards a:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.sg-cards strong { font-weight: 600; }

/* Numbers strip on the book pages */
.sg-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0 8px; max-width: 44rem; }
@media (min-width: 640px) { .sg-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sg-stats div { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.sg-stats strong { font-size: 24px; letter-spacing: -0.02em; color: var(--text); }
.sg-stats span { font-size: 13px; color: var(--text-dim); }
.sg-list { padding-left: 20px; display: grid; gap: 6px; color: var(--text-body); max-width: 44rem; }

/* Questions, sources, call to action */
.sg-faq-item { padding: 16px 0; border-bottom: 1px solid var(--line); max-width: 44rem; }
.sg-faq-item h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.sg-faq-item p { color: var(--text-body); line-height: 1.7; }
.sg-sources ul { padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.sg-cta { margin: 40px 0 8px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--primary-soft); max-width: 44rem; }
.sg-cta-h { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.sg-cta .row { margin-top: 14px; gap: 12px 20px; }
.sg-related { margin-top: 8px; }

/* Glossary and blog lists */
.sg-terms { display: grid; gap: 0; max-width: 48rem; }
.sg-terms div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.sg-terms dt a { font-weight: 600; text-decoration: none; }
.sg-terms dd { margin: 4px 0 0; color: var(--text-body); font-size: 15px; line-height: 1.6; }
.sg-posts { list-style: none; padding: 0; display: grid; gap: 24px; max-width: 44rem; }
.sg-posts a { font-size: 19px; text-decoration: none; }
.sg-posts p { margin-top: 4px; color: var(--text-body); }

/* NeetCode difficulty */
.sg-diff { font-weight: 600; font-size: 13px; }
.sg-easy { color: var(--ok-fg); }
.sg-medium { color: var(--warn-fg); }
.sg-hard { color: var(--bad-fg); }

/* The plan generator's form */
.sg-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 24px 0 8px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); max-width: 44rem; }
.sg-form input, .sg-form select { min-height: 44px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit; }
.sg-form .btn { min-height: 44px; }
.sg-pace { margin-bottom: 8px; }
.sg-finish { font-size: 17px; color: var(--text-body); margin: 24px 0 8px; }
.sg-finish strong { color: var(--text); }

/* /mix: the words above the playground */
.sg-mix-how { display: grid; gap: 20px; margin: 24px 0 32px; }
@media (min-width: 900px) { .sg-mix-how { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sg-mix-how p, .sg-mix-how li { color: var(--text-body); font-size: 15px; line-height: 1.65; }
.sg-mix-how ol { padding-left: 20px; display: grid; gap: 4px; }
.sg-mix-how .md-code { font-size: 13px; }
