/* ============================================================
   GSD User Guides — shared stylesheet
   Matches the Research/GSD index.html dark aesthetic.
   ============================================================ */

:root {
  --bg: #04060c;
  --panel: #080c16;
  --panel-raised: #0c1220;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
  --text: #c8d0e0;
  --text-bright: #e6ecf5;
  --dim: rgba(255,255,255,0.45);
  --faint: rgba(255,255,255,0.28);
  --gold: #C4A35A;
  --gold-light: #e0cc80;
  --blue: #4a7aba;
  --green: #4CAF50;
  --amber: #E89848;
  --purple: #9a6ad8;
  --red: #d76868;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 2rem; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.75;
  font-size: 16px;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); text-decoration: underline; }

code, pre, tt, kbd, samp {
  font-family: 'DejaVu Sans Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.88em;
}

/* ============ Header ============ */
header.guide-header {
  background: linear-gradient(135deg, #0a0806 0%, #1a1408 25%, #2a1e0a 50%, #0a0806 100%);
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  border-bottom: 3px solid var(--gold);
  position: relative;
}
header.guide-header .crumbs {
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--faint);
  margin-bottom: 1.2rem;
  letter-spacing: 0.04em;
}
header.guide-header .crumbs a { color: rgba(255,255,255,0.55); }
header.guide-header .crumbs a:hover { color: var(--gold); }
header.guide-header .crumbs .sep { margin: 0 0.45rem; color: var(--faint); }
header.guide-header h1 {
  font-size: 2rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.01em;
}
header.guide-header .subtitle {
  color: var(--gold);
  font-size: 1rem;
  font-style: italic;
  margin-top: 0.4rem;
}
header.guide-header .meta {
  color: var(--dim);
  font-size: 0.8rem;
  margin-top: 0.8rem;
  font-family: system-ui, sans-serif;
}
header.guide-header .meta a { color: var(--gold); }

/* ============ Page layout ============ */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; gap: 1.5rem; }
  aside.toc { position: static !important; max-height: none !important; }
}

/* ============ TOC sidebar ============ */
aside.toc {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem 1rem;
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
}
aside.toc::before {
  content: "Contents";
  display: block;
  font-weight: 600;
  color: var(--text-bright);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-bottom: 0.6rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
aside.toc ul { list-style: none; padding-left: 0; }
aside.toc ul ul { padding-left: 0.9rem; margin-top: 0.15rem; }
aside.toc li { margin: 0.15rem 0; }
aside.toc a {
  color: var(--dim);
  display: block;
  padding: 0.2rem 0.4rem;
  border-left: 2px solid transparent;
  line-height: 1.35;
}
aside.toc a:hover {
  color: var(--gold);
  border-left-color: var(--gold);
  text-decoration: none;
}

/* Scrollbar polish */
aside.toc::-webkit-scrollbar { width: 6px; }
aside.toc::-webkit-scrollbar-track { background: transparent; }
aside.toc::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
aside.toc::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ============ Main content ============ */
main.content {
  min-width: 0;
  max-width: 780px;
}

main.content section { margin-bottom: 1.5rem; }

main.content h1 {
  font-family: system-ui, sans-serif;
  font-size: 1.6rem;
  color: #fff;
  font-weight: 500;
  margin: 2.5rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--gold);
  letter-spacing: 0.005em;
}
main.content section:first-child h1 { margin-top: 0; }

main.content h2 {
  font-family: system-ui, sans-serif;
  font-size: 1.22rem;
  color: var(--gold-light);
  font-weight: 500;
  margin: 2rem 0 0.6rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
main.content h3 {
  font-family: system-ui, sans-serif;
  font-size: 1.02rem;
  color: var(--text-bright);
  font-weight: 600;
  margin: 1.5rem 0 0.45rem;
}
main.content h4 {
  font-family: system-ui, sans-serif;
  font-size: 0.92rem;
  color: var(--gold);
  font-weight: 600;
  margin: 1.2rem 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

main.content p { margin: 0.7rem 0; font-size: 0.95rem; }

main.content ul, main.content ol {
  padding-left: 1.4rem;
  margin: 0.6rem 0;
}
main.content li { margin: 0.3rem 0; font-size: 0.94rem; }
main.content li p { margin: 0.2rem 0; }

main.content em { color: var(--text-bright); }
main.content strong { color: var(--text-bright); font-weight: 600; }

main.content blockquote {
  border-left: 3px solid var(--gold);
  margin: 1rem 0;
  padding: 0.3rem 0 0.3rem 1rem;
  color: var(--dim);
  font-style: italic;
}

/* ============ Code ============ */
main.content code {
  background: rgba(196,163,90,0.1);
  color: var(--gold-light);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  border: 1px solid rgba(196,163,90,0.15);
}

main.content pre {
  background: #0a0e18;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.82rem;
  line-height: 1.5;
}
main.content pre code {
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0;
}

/* pandoc sourceCode syntax highlighting */
.sourceCode { background: transparent; }
.sourceCode .kw { color: #9a6ad8; }   /* keyword */
.sourceCode .dt { color: #4a9bd4; }   /* data type */
.sourceCode .st { color: #8fc97f; }   /* string */
.sourceCode .co { color: rgba(255,255,255,0.35); font-style: italic; }  /* comment */
.sourceCode .dv { color: #E89848; }   /* decimal value */
.sourceCode .fu { color: var(--gold-light); }  /* function */
.sourceCode .cf { color: #d76868; }   /* control flow */
.sourceCode .op { color: var(--text); }  /* operator */
.sourceCode .va { color: #4a9bd4; }   /* variable */
.sourceCode .ot { color: #8fc97f; }   /* other/attribute */
.sourceCode .er { color: var(--red); }
.sourceCode .bu { color: var(--gold); }  /* builtin */
.sourceCode .cn { color: #E89848; }   /* constant */

/* ============ Tables ============ */
main.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.87rem;
  font-family: system-ui, sans-serif;
}
main.content thead {
  background: rgba(196,163,90,0.08);
  border-bottom: 2px solid var(--gold);
}
main.content th, main.content td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
main.content th { color: var(--gold-light); font-weight: 600; }
main.content tbody tr:hover { background: rgba(255,255,255,0.015); }

/* ============ Callouts (tcolorbox environments) ============ */
main.content div.gsdtip,
main.content div.gsdwarning,
main.content div.gsdimportant,
main.content div.gsdnote,
main.content div.gsdsuccess,
main.content div.gsdscenario {
  margin: 1.2rem 0;
  padding: 1rem 1.1rem 1rem 1.3rem;
  border-radius: 4px;
  border-left: 4px solid var(--gold);
  background: rgba(196,163,90,0.06);
  position: relative;
}
main.content div.gsdtip::before,
main.content div.gsdwarning::before,
main.content div.gsdimportant::before,
main.content div.gsdnote::before,
main.content div.gsdsuccess::before,
main.content div.gsdscenario::before {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

main.content div.gsdtip {
  border-left-color: var(--green);
  background: rgba(76,175,80,0.07);
}
main.content div.gsdtip::before { content: "Tip"; color: var(--green); }

main.content div.gsdwarning {
  border-left-color: var(--amber);
  background: rgba(232,152,72,0.07);
}
main.content div.gsdwarning::before { content: "Warning"; color: var(--amber); }

main.content div.gsdimportant {
  border-left-color: var(--red);
  background: rgba(215,104,104,0.08);
}
main.content div.gsdimportant::before { content: "Important"; color: var(--red); }

main.content div.gsdnote {
  border-left-color: var(--blue);
  background: rgba(74,122,186,0.07);
}
main.content div.gsdnote::before { content: "Note"; color: var(--blue); }

main.content div.gsdsuccess {
  border-left-color: var(--green);
  background: rgba(76,175,80,0.08);
}
main.content div.gsdsuccess::before { content: "Success"; color: var(--green); }

main.content div.gsdscenario {
  border-left-color: var(--purple);
  background: rgba(154,106,216,0.07);
}
main.content div.gsdscenario::before { content: "Scenario"; color: var(--purple); }

/* Generic tcolorbox fallback (raw \begin{tcolorbox}) */
main.content div.tcolorbox {
  margin: 1.2rem 0;
  padding: 1rem 1.1rem 1rem 1.3rem;
  border-radius: 4px;
  border-left: 4px solid var(--blue);
  background: rgba(74,122,186,0.07);
}
main.content div.tcolorbox p:last-child { margin-bottom: 0; }

main.content div.gsdtip p:last-child,
main.content div.gsdwarning p:last-child,
main.content div.gsdimportant p:last-child,
main.content div.gsdnote p:last-child,
main.content div.gsdsuccess p:last-child,
main.content div.gsdscenario p:last-child { margin-bottom: 0; }

/* pandoc-emitted title block header (hidden; we have our own header) */
header#title-block-header { display: none; }

/* titlepage stuff from the tex sources - hide/minimize */
div.titlepage { display: none; }
div.frontmatter, div.mainmatter, div.backmatter { display: contents; }
div.center { text-align: center; }

/* ============ Footer ============ */
footer.guide-footer {
  max-width: 1180px;
  margin: 2rem auto 0;
  padding: 1.8rem 1.5rem 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--dim);
  border-top: 1px solid var(--border);
  font-family: system-ui, sans-serif;
}
footer.guide-footer a { color: var(--gold); }
footer.guide-footer .license { margin-top: 0.5rem; color: var(--faint); font-size: 0.72rem; }
