/* FlowLang reference docs — dark theme matching the editor +
   landing page. Two-column layout: namespace nav on the left,
   content on the right. Collapses to a single column on
   viewports under 800 px. */

:root {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --bg-card: #161b22;
  --fg: #e6edf3;
  --fg-muted: #8b949e;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --border: #30363d;
  --code-bg: #1e2937;
  --tag-block: #1f3a5f;
  --tag-flow-level: #4d3a00;
  --tag-entity: #1a4030;
  --tag-condition: #4a3a1c;
  --tag-arn: #4a2a26;
  --tag-number: #2a3a4a;
  --tag-unknown: #2d333b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg);
  background-color: #07080d;
  background-image:
    radial-gradient(
      ellipse 70% 55% at 18% 12%,
      rgba(99, 102, 241, 0.18),
      transparent 65%
    ),
    radial-gradient(
      ellipse 65% 50% at 85% 25%,
      rgba(217, 70, 239, 0.12),
      transparent 60%
    ),
    radial-gradient(
      ellipse 80% 60% at 50% 95%,
      rgba(59, 130, 246, 0.14),
      transparent 65%
    ),
    radial-gradient(
      ellipse 50% 40% at 75% 80%,
      rgba(34, 197, 94, 0.06),
      transparent 70%
    );
  background-attachment: fixed;
  background-repeat: no-repeat;
  min-height: 100vh;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    monospace;
  font-size: 13px;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 8, 13, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  font-size: 15px;
}

.site-header .brand:hover {
  text-decoration: none;
}

.site-header .site-nav a {
  margin-left: 16px;
  color: var(--fg-muted);
}

.site-header .site-nav a:hover {
  color: var(--fg);
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  gap: 32px;
}

.sidebar {
  position: sticky;
  top: 64px;
  align-self: start;
  max-height: calc(100vh - 84px);
  overflow-y: auto;
  padding-right: 8px;
}

.sidebar h2 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--fg-muted);
  letter-spacing: 0.5px;
  margin: 0 0 8px;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  padding: 2px 0;
  font-size: 13px;
}

.sidebar li.active a {
  font-weight: 600;
  color: var(--fg);
}

/* "FlowLang Reference" anchor at the top of every sidebar — the
   way back to the docs index from any deep page. */
.sidebar li.sidebar-overview {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar li.sidebar-overview a {
  font-weight: 600;
  color: var(--fg);
}

/* Back-link at the very top of a sub-section sidebar (e.g. the
   language section sidebar's "← FlowLang Reference" link).
   Visually distinct from the section-overview link so the
   "back" intent reads at a glance. */
.sidebar li.sidebar-back {
  margin-bottom: 6px;
}

.sidebar li.sidebar-back a {
  color: var(--fg-muted);
  font-size: 12.5px;
}

.sidebar li.sidebar-back a:hover {
  color: var(--fg);
}

.sidebar li.sidebar-section-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  padding: 8px 0 2px;
  pointer-events: none;
}

/* Language-section sidebar rules: nested-bullet indentation by
   depth (`lang-toc-d0` through `lang-toc-d3`) so the rhai-book
   TOC's hierarchy survives the conversion. */
.sidebar li.lang-toc-d1 {
  padding-left: 12px;
}

.sidebar li.lang-toc-d2 {
  padding-left: 24px;
}

.sidebar li.lang-toc-d3 {
  padding-left: 36px;
}

.sidebar li.lang-toc-d0.active a,
.sidebar li.lang-toc-d1.active a,
.sidebar li.lang-toc-d2.active a,
.sidebar li.lang-toc-d3.active a {
  font-weight: 600;
  color: var(--fg);
}

/* Banner at the top of every language page explaining the rhai
   relationship. Subtle; doesn't compete with the article content. */
.lang-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-bottom: 24px;
}

.lang-banner a {
  color: var(--accent);
}

.lang-intro {
  color: var(--fg-muted);
  font-size: 14.5px;
  margin-bottom: 24px;
}

ul.lang-toc {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.lang-toc li {
  padding: 3px 0;
  font-size: 14px;
}

ul.lang-toc li.lang-toc-d1 {
  padding-left: 16px;
  font-size: 13.5px;
}

ul.lang-toc li.lang-toc-d2 {
  padding-left: 32px;
  font-size: 13px;
}

ul.lang-toc li.lang-toc-d3 {
  padding-left: 48px;
  font-size: 13px;
}

.content {
  min-width: 0;
}

.content h1 {
  font-size: 28px;
  margin: 0 0 4px;
}

.content h2 {
  font-size: 20px;
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.content h3 {
  font-size: 16px;
  margin: 20px 0 6px;
}

.ns-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.kind-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--fg);
}

.kind-block {
  background: var(--tag-block);
}
.kind-flow-level {
  background: var(--tag-flow-level);
}
.kind-entity {
  background: var(--tag-entity);
}
.kind-condition {
  background: var(--tag-condition);
}
.kind-arn {
  background: var(--tag-arn);
}
.kind-number {
  background: var(--tag-number);
}
.kind-unknown {
  background: var(--tag-unknown);
}

.ns-doc {
  font-size: 15px;
  margin-bottom: 24px;
}

.method-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.method {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  background: var(--bg-card);
}

.method h3 {
  margin-top: 0;
}

.signature {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 8px 12px;
  margin: 8px 0 12px;
  overflow-x: auto;
  color: var(--fg);
}

.method-doc {
  margin-bottom: 12px;
}

.params {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13px;
}

.params th,
.params td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.params th {
  background: var(--bg-alt);
  font-weight: 600;
}

.intro {
  margin-bottom: 32px;
}

/* Section-cards: hero-style links from the docs index to other
   doc surfaces (currently just the language reference). One card
   per section, full-width, hover-highlighted. */
.section-cards {
  display: grid;
  gap: 16px;
  margin-bottom: 32px;
}

.section-card {
  display: block;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--fg);
  transition: border-color 0.12s ease, transform 0.05s ease;
}

.section-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.section-card h2 {
  font-size: 18px;
  margin: 0 0 6px;
  border-bottom: none;
  padding-bottom: 0;
  color: var(--fg);
}

.section-card p {
  margin: 0;
  font-size: 14px;
  color: var(--fg-muted);
}

.intro h1 {
  margin-bottom: 8px;
}

.intro p {
  font-size: 16px;
  color: var(--fg-muted);
}

.catalogue h2 {
  font-size: 18px;
  margin-top: 28px;
}

.ns-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}

p code,
li code,
td code,
.method-doc code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12.5px;
  color: var(--fg);
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }
  .sidebar {
    position: static;
    max-height: none;
  }
}
