/* Guides: the editor's system, set for reading */
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { display: flex; flex-direction: column; min-height: 100vh; height: auto; }
.topbar { position: sticky; top: 0; z-index: 10; }
.mode-toggle a { border: 1px solid transparent; display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: 6px; color: var(--text-muted); font-weight: 500; font-size: 13px; text-decoration: none; }
.mode-toggle a:hover { color: var(--text); background: var(--surface-3); }
.page { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 48px 24px 80px; }
.page a:not(.btn) { color: var(--accent); text-underline-offset: 3px; }

.article { display: grid; grid-template-columns: minmax(0, 680px) 200px; column-gap: 80px; }
.article-header, .article-body { grid-column: 1; }
.article-header { margin-bottom: 32px; }
.page h1 { font-size: 34px; line-height: 42px; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.article-description, .lead { margin-top: 12px; font-size: 17px; line-height: 27px; color: var(--text-muted); }
.article-byline, .author-title { margin-top: 12px; color: var(--text-dim); font-size: 13px; }
.page .article-byline a { color: inherit; }

.toc { padding: 14px 16px; grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 88px; align-self: start; font-size: 13px; }
.toc p { font-weight: 500; color: var(--text); margin-bottom: 8px; }
.toc ul { list-style: none; }
.page .toc a { display: block; padding: 4px 0; color: var(--text-dim); text-decoration: none; }
.page .toc a:hover { color: var(--text); text-decoration: underline; }

.article-body, .geo-content, .author-profile { font-size: 16px; line-height: 26px; }
.geo-content, .author-profile, .guides-index { max-width: 680px; }
.page p + p, .page ul + p, .page section > * + *, .author-bio p + p { margin-top: 16px; }
.page section + section, .geo-content > section, .practice-cta, .next-queries, .author-topics, .author-articles { margin-top: 48px; }
.intro { margin-bottom: 0; }
.article-body > section:first-of-type { margin-top: 40px; }
.page h2 { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.01em; }
.page h3 { font-size: 17px; line-height: 26px; font-weight: 600; }
.page section > .question-block, .page section > .rule-block { margin-top: 32px; }
.question-block > * + *, .rule-block > * + * { margin-top: 12px; }
.article-body ul, .article-body ol, .geo-content ul { padding-left: 20px; }
.article-body li + li, .geo-content li + li { margin-top: 8px; }
.page code { font: 500 0.875em/1.4 var(--mono); padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }

/* Code, coloured exactly like the editor */
.sql {
  overflow: hidden;
  --astro-code-foreground: var(--text);
  --astro-code-background: var(--bg-elev);
  --astro-code-token-keyword: var(--accent);
  --astro-code-token-string: var(--code-string);
  --astro-code-token-string-expression: var(--code-string);
  --astro-code-token-constant: var(--code-number);
  --astro-code-token-comment: var(--text-dim);
  --astro-code-token-function: var(--text);
  --astro-code-token-parameter: var(--text);
  --astro-code-token-punctuation: var(--text-muted);
  --astro-code-token-link: var(--text);
}
.sql pre { padding: 16px; overflow-x: auto; font: 400 13.5px/22px var(--mono); }
.sql pre code { padding: 0; background: none; font: inherit; }
.sql-result { border-top: 1px solid var(--border); background: var(--bg); }
.sql-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 8px 8px 16px; color: var(--text-dim); font-size: 13px; line-height: 20px; }
.sql-scroll, .comparison-table-wrapper, .page figure:has(> table) { overflow-x: auto; }
.page table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 20px; }
.page th, .page td { padding: 8px 16px; text-align: left; border-top: 1px solid var(--border); }
.page th { color: var(--text-muted); font-weight: 500; }
.sql td, .sql th { font-family: var(--mono); white-space: nowrap; }
.sql td.null { color: var(--text-dim); }
td.check { color: var(--success); }
td.cross { color: var(--text-dim); }
figcaption { color: var(--text-dim); font-size: 13px; margin-bottom: 8px; }

/* Notes are text with a label, not boxes */
.use-case { color: var(--text-muted); }
.use-case strong { color: var(--text); font-weight: 600; }
.use-case.warning { padding: 12px 16px; border: 1px solid var(--edge-hint); border-radius: 8px; background: color-mix(in oklab, var(--edge-hint) 10%, var(--bg)); }

.faq-question { margin-top: 24px; font-weight: 600; }
.faq-answer { margin-top: 4px; color: var(--text-muted); }
.practice-cta { padding: 24px; border-color: var(--edge-go); box-shadow: 0 3px 0 var(--edge-go); }
.practice-cta p { margin: 8px 0 16px; color: var(--text-muted); }

/* Guide list and author */
.guides-index section { margin-top: 40px; }
.guides-index h2 { font-size: 17px; line-height: 24px; font-weight: 700; }
.guides-index ul { list-style: none; margin-top: 8px; }
.page .guides-index li a { display: block; padding: 14px 18px; text-decoration: none; color: var(--text); transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease); }
.guides-index li + li { margin-top: 13px; }
.page .guides-index li a:hover { border-color: var(--edge-go); transform: translateY(-1px); box-shadow: 0 4px 0 var(--edge-go); }
.page .guides-index li a:active { transform: translateY(3px); box-shadow: none; }
.guide-title { display: block; font-size: 17px; line-height: 26px; font-weight: 600; }
.guides-index a:hover .guide-title { text-decoration: underline; }
.guide-about { display: block; color: var(--text-muted); line-height: 22px; }
.author-avatar, .author-links svg { display: none; }
.author-bio { margin-top: 24px; }
.author-links { display: flex; gap: 16px; margin-top: 16px; }
.topic-tags { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin-top: 8px; color: var(--text-muted); }
.author-articles .article-list { list-style: none; margin-top: 8px; }
.author-articles a { display: block; padding: 8px 0; }
.author-articles strong { font-weight: 500; }
.article-date { display: block; color: var(--text-dim); font-size: 13px; line-height: 20px; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; padding: 24px; border-top: 1px solid var(--border); font-size: 13px; }
.site-footer a { color: var(--text-dim); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 960px) {
  .article { grid-template-columns: minmax(0, 680px); justify-content: center; }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .page { padding: 32px 16px 64px; }
  .topbar { position: static; grid-template-columns: 1fr auto; row-gap: 8px; }
  .mode-toggle { grid-row: 2; grid-column: 1 / -1; }
  .mode-toggle a { flex: 1; justify-content: center; min-height: 44px; }
  .btn { min-height: 44px; }
  .site-footer a { padding: 12px 0; }
  .page h1 { font-size: 26px; line-height: 34px; }
}
