/* Standalone stylesheet for the User Guide (/guide). Deliberately NOT
   linking /assets/style.css - that file's selectors are keyed to the exact
   dashboard/admin DOM shape (.panel, .grid, .sub-nav, ...) which a
   sidebar+article layout would risk colliding with. Instead this file
   defines its own :root with the SAME variable names/values as the main
   app's refreshed palette (internal/api/static/style.css), kept in sync by
   hand - there's no build step to share them, same convention already used
   for roboticFaultKinds between app.js and the Go backend. If you refresh
   style.css's palette, refresh the values here too. */

:root {
  color-scheme: dark;
  --bg: #0b0f16;
  --panel: #141a24;
  --panel-alt: #182130;
  --card: #1c2530;
  --border: #2a3444;
  --border-strong: #3a4a60;
  --accent: #4da3ff;
  --accent-glow: #7fd1ff;
  --ok: #34d399;
  --warn: #f2b84b;
  --err: #ef5350;
  --text: #eef1f6;
  --muted: #8a94a6;
  --muted-dim: #626c7c;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .45);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: var(--border-strong) var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.55; }

.brand-logo {
  width: 24px;
  height: 24px;
  margin-right: 0.5rem;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  margin-right: 0.4rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.guide-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
  align-items: start;
}

.guide-toc {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 1.25rem 1rem 2rem;
  background: var(--panel);
  border-right: 1px solid var(--border);
}
.guide-toc-brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}
.guide-toc-brand span {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: 1.9rem;
  margin-top: -0.15rem;
}
.guide-toc-back {
  display: inline-block;
  margin: 0.9rem 0 1.1rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  transition: border-color .15s ease, color .15s ease;
}
.guide-toc-back:hover { border-color: var(--accent); color: var(--text); }

.guide-toc-group { margin-bottom: 1rem; }
.guide-toc-group-label {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-dim);
  font-weight: 600;
  margin: 0 0 0.35rem 0.15rem;
}
.guide-toc a {
  display: block;
  padding: 0.32rem 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background .12s ease, color .12s ease;
}
.guide-toc a:hover { color: var(--text); background: var(--panel-alt); }
.guide-toc a.active { color: var(--accent); background: var(--panel-alt); font-weight: 600; }

.guide-content {
  padding: 2.2rem clamp(1.2rem, 4vw, 4rem) 8rem;
  max-width: 860px;
}

.guide-content h1, .guide-content h2, .guide-content h3, .guide-content h4 { scroll-margin-top: 1.2rem; }

.guide-content h1 {
  display: flex;
  align-items: center;
  font-size: 1.9rem;
  margin: 0 0 0.4rem;
}
.guide-content .lead {
  color: var(--muted);
  font-size: 1.02rem;
  margin: 0 0 2.2rem;
}
.guide-content h2 {
  font-size: 1.35rem;
  margin: 2.6rem 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.guide-content h2:first-child { margin-top: 0; }
.guide-content h3 { font-size: 1.05rem; color: var(--text); margin: 1.4rem 0 0.5rem; }
.guide-content h4 { font-size: 0.92rem; color: var(--accent-glow); margin: 1.1rem 0 0.4rem; text-transform: uppercase; letter-spacing: .03em; }
.guide-content p { margin: 0 0 0.9rem; }
.guide-content ul, .guide-content ol { margin: 0 0 1rem; padding-left: 1.3rem; }
.guide-content li { margin-bottom: 0.35rem; }
.guide-content a { color: var(--accent); }
.guide-content code {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-size: 0.88em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.guide-content pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
}
.guide-content pre code { background: none; border: none; padding: 0; }

.callout {
  display: flex;
  gap: 0.7rem;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  border: 1px solid var(--border);
  background: var(--panel);
}
.callout .icon { width: 1.2em; height: 1.2em; margin-top: 0.1rem; flex: none; }
.callout-tip { border-color: color-mix(in oklab, var(--accent) 40%, var(--border)); }
.callout-tip .icon { color: var(--accent); }
.callout-warn { border-color: color-mix(in oklab, var(--warn) 45%, var(--border)); }
.callout-warn .icon { color: var(--warn); }
.callout-note .icon { color: var(--muted); }

/* Every ordered list in the guide gets the numbered-badge treatment (not
   just a hand-picked ".step-list" subset) - this is what lets docs/guide's
   Markdown source use plain "1. ..." lists for cookbook/workflow steps
   instead of hand-written HTML. */
.guide-content ol { counter-reset: step; list-style: none; padding-left: 0; }
.guide-content ol > li {
  counter-increment: step;
  position: relative;
  padding: 0.2rem 0 0.2rem 2.4rem;
  margin-bottom: 1rem;
}
.guide-content ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--accent);
  color: #061a2a;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Likewise, every table (incl. plain GFM Markdown tables) gets the
   reference-table treatment - no separate ".ref-table" class needed in
   the Markdown source. */
.guide-content table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.4rem; font-size: 0.86rem; }
.guide-content table th, .guide-content table td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); }
.guide-content table th { color: var(--muted); font-weight: 600; }
.guide-content table code { white-space: nowrap; }

.led-legend { display: flex; flex-direction: column; gap: 0.6rem; margin: 1rem 0 1.4rem; }
.led-legend-row { display: flex; align-items: center; gap: 0.7rem; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.55rem 0.8rem; }
.led-legend-row .led { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.led-legend-row .led-fault { background: var(--warn); }
.led-legend-row .led-writing { background: var(--err); }
.led-legend-row .led-busy { background: var(--ok); }
.led-legend-row .led-idle { background: var(--ok); opacity: .55; }
.led-legend-row .led-off { background: var(--border-strong); }
.led-legend-row strong { min-width: 90px; }
.led-legend-row span.desc { color: var(--muted); font-size: 0.86rem; }

.panel-tour { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0 1.4rem; }
.panel-tour-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.8rem 1rem; background: var(--panel); }
.panel-tour-item h4 { margin: 0 0 0.4rem; display: flex; align-items: center; color: var(--text); text-transform: none; letter-spacing: 0; }
.panel-tour-item p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.faq-item { border-top: 1px solid var(--border); padding: 0.9rem 0; }
.faq-item:first-child { border-top: none; }
.faq-item h4 { margin: 0 0 0.35rem; color: var(--text); text-transform: none; letter-spacing: 0; }

footer.guide-footer { color: var(--muted-dim); font-size: 0.8rem; margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }

@media (max-width: 900px) {
  .guide-shell { grid-template-columns: 1fr; }
  .guide-toc { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .guide-content { padding: 1.5rem 1.1rem 4rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
