/* POLARIS documentation — TAILSIT-inspired, standalone Pandoc HTML.
 * Designed for pandoc --standalone --toc --mathjax output WITHOUT a custom
 * HTML template. The TOC stays in normal flow and never overlays content.
 */

:root {
  --brand: #73a1b1;
  --brand-dark: #426c7c;
  --ink: #26343c;
  --muted: #60717a;
  --border: #d8e2e6;
  --background: #f3f6f7;
  --code-background: #f4f7f8;
  --page-width: 1120px;
}

* { box-sizing: border-box; }
html { background: var(--background); scroll-behavior: smooth; }
body {
  max-width: var(--page-width);
  margin: 40px auto 70px;
  padding: clamp(24px, 5vw, 64px);
  background: #fff;
  border: 1px solid var(--border);
  border-top: 6px solid var(--brand);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(38, 52, 60, .06);
  color: var(--ink);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  overflow-wrap: break-word;
}

/* Title block from Pandoc's default standalone HTML */
#title-block-header {
  padding-bottom: 26px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border);
}
#title-block-header .title { font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.2; margin: 0 0 12px; color: var(--brand-dark); }
#title-block-header .author, #title-block-header .date { color: var(--muted); margin: 2px 0; font-size: .92rem; }
#title-block-header .abstract { margin-top: 18px; color: var(--muted); }
#title-block-header .abstract-title { font-weight: 700; color: var(--ink); }

/* Table of contents: regular document flow, no sticky/fixed positioning */
#TOC {
  position: static;
  float: none;
  width: auto;
  max-width: none;
  max-height: none;
  overflow: visible;
  margin: 0 0 44px;
  padding: 24px 30px;
  background: #f6f9fa;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 5px;
}
#TOC::before { content: "Contents"; display: block; font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; color: var(--brand-dark); }
#TOC ul { margin: 5px 0; padding-left: 24px; }
#TOC li { margin: 3px 0; }
#TOC a { text-decoration: none; color: var(--brand-dark); }
#TOC a:hover, #TOC a:focus { text-decoration: underline; }

/* Section hierarchy */
h1, h2, h3, h4 { line-height: 1.3; color: var(--ink); scroll-margin-top: 22px; }
body > h1 { font-size: 1.7rem; margin: 55px 0 20px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
body > h2 { font-size: 1.3rem; margin: 35px 0 14px; color: var(--brand-dark); }
body > h3 { font-size: 1.1rem; margin: 28px 0 12px; }
p { margin: 0 0 1.1em; }
a { color: var(--brand-dark); }
a:hover { color: #284e5c; }
hr { border: 0; border-top: 1px solid var(--border); margin: 35px 0; }

/* Technical content */
pre, div.sourceCode {
  max-width: 100%;
  overflow-x: auto;
  background: var(--code-background);
  border: 1px solid var(--border);
  border-radius: 5px;
}
pre { padding: 16px 20px; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
div.sourceCode { margin: 20px 0; }
div.sourceCode pre { margin: 0; border: 0; background: transparent; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
:not(pre) > code { padding: 2px 5px; border-radius: 3px; background: var(--code-background); }
.math.display { display: block; max-width: 100%; overflow-x: auto; margin: 24px 0; }
img, svg { max-width: 100%; height: auto; }
table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 22px 0; }
th, td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
th { background: #eaf2f5; }
blockquote { margin: 20px 0; padding: 8px 20px; border-left: 4px solid var(--brand); background: #f6f9fa; }

@media (max-width: 700px) {
  body { margin: 0; padding: 22px 18px 40px; border-left: 0; border-right: 0; border-radius: 0; box-shadow: none; }
  #TOC { padding: 16px 18px; }
  pre { padding: 12px; }
}
@media print {
  html { background: #fff; }
  body { max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
  #TOC { background: #fff; }
  a { color: inherit; }
}
