/* FAST SCRIPTS documentation — blue/white design system.
   Structure follows a three-column documentation layout: persistent sidebar,
   measured prose column, and a per-page heading rail. */

:root {
  /* Brand blues */
  --blue: #1d4ed8;
  --blue-bright: #2563eb;
  --blue-deep: #1e3a8a;
  --blue-ink: #172554;
  --blue-tint: #eff4ff;
  --blue-tint-strong: #dbe6fe;

  /* Neutrals */
  --ink: #0b1220;
  --body: #40506e;
  --muted: #6b7994;
  --faint: #97a3b8;
  --line: #e3e8f1;
  --line-soft: #eef1f7;
  --surface: #f8fafc;
  --white: #ffffff;

  /* Semantic */
  --amber: #b45309;
  --amber-tint: #fffbeb;
  --amber-line: #fcd34d;
  --green: #047857;
  --green-tint: #ecfdf5;

  /* Metrics */
  --sidebar-w: 268px;
  --rail-w: 232px;
  --topbar-h: 61px;
  --prose-w: 736px;

  --radius: 8px;
  --radius-lg: 12px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --shadow-sm: 0 1px 2px rgba(11, 18, 32, .06);
  --shadow-md: 0 4px 16px rgba(11, 18, 32, .08);
  --shadow-lg: 0 12px 40px rgba(11, 18, 32, .12);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 24px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--white);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--blue); color: #fff; padding: 12px 18px;
  border-radius: 0 0 var(--radius) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: 100%;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--blue-bright), var(--blue-deep));
  color: #fff;
  box-shadow: 0 2px 8px rgba(29, 78, 216, .32);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-text { display: flex; align-items: baseline; gap: 8px; }
.brand-name { font-weight: 700; letter-spacing: -.015em; font-size: 15px; }
.brand-sub {
  font-size: 12px; color: var(--muted); font-weight: 500;
  padding-left: 8px; border-left: 1px solid var(--line);
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-link {
  font-size: 14px; font-weight: 500; color: var(--body);
  padding: 6px 10px; border-radius: 6px;
}
.topbar-link:hover { background: var(--surface); color: var(--ink); text-decoration: none; }

/* ---------------------------------------------------------------- search */

.search-wrap { position: relative; }
.search-input {
  width: 268px; height: 36px;
  padding: 0 34px 0 34px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-input::placeholder { color: var(--faint); }
.search-input:focus {
  outline: none; background: #fff;
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--faint); pointer-events: none;
}
.search-kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; pointer-events: none;
}
.search-input:focus ~ .search-kbd { display: none; }

.search-results {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 460px; max-height: 60vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60;
}
.search-hit {
  display: block; padding: 9px 12px; border-radius: var(--radius);
  color: var(--ink);
}
.search-hit:hover, .search-hit.is-active { background: var(--blue-tint); text-decoration: none; }
.search-hit-title { font-weight: 600; font-size: 14px; }
.search-hit-crumb { font-size: 12px; color: var(--blue); margin-left: 6px; font-weight: 500; }
.search-hit-snippet {
  font-size: 12.5px; color: var(--muted); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.search-hit mark { background: var(--blue-tint-strong); color: var(--blue-ink); border-radius: 2px; padding: 0 1px; }
.search-empty { padding: 18px 14px; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------------------------------------------------------------- layout */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
  align-items: start;
  max-width: 1500px;
  margin: 0 auto;
}

/* --------------------------------------------------------------- sidebar */

.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 30px 16px 30px 24px;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.sidebar-nav { flex: 1; }

.nav-group + .nav-group { margin-top: 26px; }
.nav-group-label {
  margin: 0 0 8px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint);
}
.nav-list { list-style: none; margin: 0; padding: 0; }

.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px; font-weight: 500;
  color: var(--body);
  transition: background .12s, color .12s;
}
.nav-link:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.nav-dot {
  width: 5px; height: 5px; border-radius: 50%; flex: none;
  background: transparent;
  transition: background .12s, transform .12s;
}
.nav-link.is-active { color: var(--blue); background: var(--blue-tint); font-weight: 600; }
.nav-link.is-active .nav-dot { background: var(--blue); transform: scale(1.25); }

.sidebar-foot { padding: 18px 10px 0; margin-top: 22px; border-top: 1px solid var(--line-soft); }
.sidebar-foot-note { margin: 0; font-size: 12px; color: var(--faint); line-height: 1.5; text-wrap: balance; }

/* --------------------------------------------------------------- content */

.content { min-width: 0; padding: 46px 56px 96px; }
.prose { max-width: var(--prose-w); }

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--blue);
}

.prose h1 {
  margin: 0 0 16px;
  font-size: 40px; line-height: 1.12; letter-spacing: -.028em;
  font-weight: 800; color: var(--ink);
}
.lede {
  margin: 0 0 34px;
  font-size: 18.5px; line-height: 1.62; color: var(--muted);
  max-width: 62ch;
}

.prose h2 {
  position: relative;
  margin: 54px 0 16px;
  padding-top: 26px;
  border-top: 1px solid var(--line-soft);
  font-size: 26px; line-height: 1.25; letter-spacing: -.02em;
  font-weight: 700; color: var(--ink);
}
.prose h3 {
  margin: 34px 0 10px;
  font-size: 18px; line-height: 1.4; letter-spacing: -.011em;
  font-weight: 650; color: var(--ink);
}
.prose h4 {
  margin: 26px 0 8px;
  font-size: 15px; font-weight: 650; color: var(--ink);
}

.anchor {
  position: absolute; left: -22px;
  color: var(--line); font-weight: 400;
  opacity: 0; transition: opacity .12s;
}
.prose h2:hover .anchor { opacity: 1; }
.prose h3 .anchor, .prose h4 .anchor { display: none; }

.prose p { margin: 0 0 17px; }
.prose ul, .prose ol { margin: 0 0 17px; padding-left: 22px; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--faint); }
.prose strong { color: var(--ink); font-weight: 650; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 42px 0; }

.prose blockquote {
  margin: 0 0 17px; padding: 2px 0 2px 18px;
  border-left: 3px solid var(--blue-tint-strong);
  color: var(--muted); font-style: italic;
}

/* ------------------------------------------------------------------ code */

code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--blue-tint);
  color: var(--blue-ink);
  padding: .14em .38em;
  border-radius: 4px;
  border: 1px solid rgba(29, 78, 216, .1);
}

pre {
  position: relative;
  margin: 0 0 20px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  font-size: 13.5px; line-height: 1.65;
}
pre code {
  background: none; border: 0; padding: 0; color: var(--ink);
  font-size: inherit;
}

.copy-btn {
  position: absolute; top: 9px; right: 9px;
  display: inline-flex; align-items: center; gap: 5px;
  height: 27px; padding: 0 9px;
  font: 500 11.5px/1 var(--font-sans); color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  cursor: pointer; opacity: 0;
  transition: opacity .14s, color .14s, border-color .14s;
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--blue); border-color: var(--blue-bright); }
.copy-btn.is-copied { color: var(--green); border-color: var(--green); opacity: 1; }

/* Minimal, deliberate token colouring. */
.tok-comment { color: var(--faint); font-style: italic; }
.tok-string  { color: #0e7490; }
.tok-key     { color: var(--blue-deep); font-weight: 600; }
.tok-num     { color: #a21caf; }
.tok-method  { color: var(--blue); font-weight: 700; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; margin: 0 0 22px; }
table {
  width: 100%; border-collapse: collapse;
  font-size: 14.5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
thead th {
  background: var(--surface);
  text-align: left; font-weight: 650; color: var(--ink);
  font-size: 12.5px; letter-spacing: .03em; text-transform: uppercase;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfdff; }
table code { font-size: .84em; }

/* -------------------------------------------------------------- callouts */

.callout {
  display: flex; gap: 13px;
  margin: 0 0 22px; padding: 15px 17px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14.5px;
}
.callout p { margin: 0 0 8px; }
.callout p:last-child { margin-bottom: 0; }
.callout-icon { flex: none; width: 18px; height: 18px; margin-top: 3px; }
.callout-body { min-width: 0; }
.callout-title {
  display: block; font-weight: 700; color: var(--ink);
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 5px;
}

.callout-note { background: var(--blue-tint); border-color: rgba(29,78,216,.18); border-left-color: var(--blue); }
.callout-note .callout-icon, .callout-note .callout-title { color: var(--blue); }

.callout-caution { background: var(--amber-tint); border-color: var(--amber-line); border-left-color: var(--amber); }
.callout-caution .callout-icon, .callout-caution .callout-title { color: var(--amber); }

.callout-tip { background: var(--green-tint); border-color: #a7f3d0; border-left-color: var(--green); }
.callout-tip .callout-icon, .callout-tip .callout-title { color: var(--green); }

/* --------------------------------------------------------------- badges */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  font-size: 12px; font-weight: 600; line-height: 1.65;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-built     { background: var(--green-tint); color: var(--green); border-color: #a7f3d0; }
.badge-simulated { background: var(--blue-tint); color: var(--blue); border-color: var(--blue-tint-strong); }
.badge-experimental { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge-licensed  { background: var(--amber-tint); color: var(--amber); border-color: var(--amber-line); }
.badge-authz     { background: var(--amber-tint); color: var(--amber); border-color: var(--amber-line); }
.badge-cert      { background: var(--amber-tint); color: var(--amber); border-color: var(--amber-line); }
.badge-none      { background: var(--surface); color: var(--muted); border-color: var(--line); }

/* ----------------------------------------------------------------- cards */

.cards { display: grid; gap: 14px; margin: 0 0 24px; }
.cards-2 { grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); }
.cards-3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.card {
  display: block; padding: 17px 18px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; color: inherit;
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
a.card:hover {
  text-decoration: none; border-color: var(--blue-bright);
  box-shadow: var(--shadow-md); transform: translateY(-1px);
}
.card-title { font-weight: 650; color: var(--ink); font-size: 15px; margin: 0 0 5px; }
.card-text { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.card-arrow { color: var(--blue); font-weight: 600; font-size: 13.5px; }

/* ----------------------------------------------------------------- steps */

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 24px; }
.steps > li {
  position: relative; counter-increment: step;
  padding: 0 0 22px 42px;
  border-left: 1px solid var(--line);
  margin-left: 13px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  content: counter(step);
  position: absolute; left: -13px; top: -2px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--blue-tint); color: var(--blue);
  border: 1px solid var(--blue-tint-strong);
  font-size: 12px; font-weight: 700;
}
.step-title { display: block; font-weight: 650; color: var(--ink); margin-bottom: 4px; }

/* ------------------------------------------------------------- key/value */

.kv { margin: 0 0 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.kv-row { display: grid; grid-template-columns: 168px 1fr; gap: 16px; padding: 11px 16px; font-size: 14px; }
.kv-row + .kv-row { border-top: 1px solid var(--line-soft); }
.kv-key { color: var(--muted); font-weight: 500; }
.kv-val { color: var(--ink); min-width: 0; }

/* ------------------------------------------------------------- endpoints */

.endpoint {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 11px 15px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); font-family: var(--font-mono); font-size: 13.5px;
}
.method {
  padding: 2px 8px; border-radius: 5px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  color: #fff; background: var(--blue);
}
.method-get { background: var(--green); }
.endpoint-path { color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------------ misc */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 18px;
  background: var(--blue); color: #fff;
  border-radius: var(--radius); font-weight: 600; font-size: 14.5px;
  box-shadow: 0 1px 2px rgba(29,78,216,.3);
  transition: background .14s, transform .14s;
}
.btn:hover { background: var(--blue-deep); text-decoration: none; transform: translateY(-1px); }
.btn-ghost {
  background: #fff; color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--blue-bright); color: var(--blue); }
.btn-row { display: flex; flex-wrap: wrap; gap: 11px; margin: 0 0 26px; }

.hero-banner {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  margin: 0 0 30px; background: var(--surface);
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 0 0 26px; }
.stat { padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.stat-num { display: block; font-size: 25px; font-weight: 750; color: var(--blue); letter-spacing: -.02em; line-height: 1.2; }
.stat-label { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }

.page-foot {
  max-width: var(--prose-w);
  margin-top: 64px; padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--faint);
}
.page-foot p { margin: 0; }

/* ------------------------------------------------------------------ rail */

.rail {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 46px 24px 40px 8px;
}
.rail-label {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint);
}
.rail-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.rail-item a {
  display: block; padding: 5px 0 5px 14px;
  margin-left: -1px; border-left: 2px solid transparent;
  font-size: 13.5px; line-height: 1.45; color: var(--muted);
}
.rail-item a:hover { color: var(--ink); text-decoration: none; }
.rail-item.is-active a { color: var(--blue); border-left-color: var(--blue); font-weight: 550; }
.rail-l3 a { padding-left: 26px; font-size: 13px; }

/* ------------------------------------------------------------ responsive */

.nav-toggle {
  display: none;
  width: 34px; height: 34px; flex: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  background: none; border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
}
.nav-toggle-bar { width: 15px; height: 1.5px; background: var(--ink); border-radius: 2px; transition: transform .18s, opacity .18s; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:first-child { transform: translateY(3.25px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:last-child { transform: translateY(-3.25px) rotate(-45deg); }

.nav-scrim {
  position: fixed; inset: var(--topbar-h) 0 0; z-index: 39;
  background: rgba(11, 18, 32, .34); backdrop-filter: blur(1px);
}

@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .rail { display: none; }
  .content { padding: 40px 40px 84px; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle { display: flex; }
  .sidebar {
    position: fixed; z-index: 40;
    left: 0; top: var(--topbar-h);
    width: min(85vw, var(--sidebar-w));
    background: #fff;
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%);
    transition: transform .22s ease;
  }
  .sidebar.is-open { transform: none; }
  .content { padding: 32px 22px 72px; }
  .prose h1 { font-size: 31px; }
  .lede { font-size: 17px; }
  .search-input { width: 190px; }
  .search-results { width: min(94vw, 460px); right: -46px; }
  .search-kbd { display: none; }
  .topbar-link { display: none; }
  .brand-sub { display: none; }
}

@media (max-width: 700px) {
  /* Let wide tables scroll inside their wrapper instead of crushing columns. */
  table { min-width: 540px; }
  .table-wrap {
    margin-inline: -4px;
    border-radius: var(--radius);
  }
}

@media (max-width: 560px) {
  .topbar-inner { padding: 0 14px; gap: 10px; }
  .search-input { width: 44px; padding-right: 10px; }
  .search-input:focus { width: min(62vw, 240px); }
  .kv-row { grid-template-columns: 1fr; gap: 3px; }
  .prose h1 { font-size: 27px; }
  .prose h2 { font-size: 22px; }
}

@media print {
  .topbar, .sidebar, .rail, .copy-btn, .nav-scrim { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .content { padding: 0; }
  a { color: inherit; }
}
