/* ============================================================
   CyberSentriq developer hub — guides layout, prose and code tabs.

   Brand colour, type, spacing, radius and shadow come from the shared
   --cs-* / --fs-* / --space-* / --radius-* / --shadow-* tokens in
   /_/css/colors_and_type.css. Only the guides' own layout and component
   rules live here. Served from the reserved /_/ asset prefix.
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--fg-link); text-decoration: none; }

/* Keyboard skip link, visible only when focused. */
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 30;
  background: var(--cs-cobalt-blue); color: #fff; padding: 9px 14px;
  border-radius: var(--radius-md); font-size: 14px; font-weight: 600;
  transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* ---------- Header (solid brand band, mirrors the landing) ---------- */
header.band { background: var(--cs-grey-950); position: sticky; top: 0; z-index: 10; }
.nav { padding: 15px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav .logo { display: inline-flex; align-items: center; }
.nav .logo img { height: 26px; display: block; }
.nav-actions { display: flex; align-items: center; gap: 18px; }
.navlink { font-size: 14px; font-weight: 500; color: var(--cs-cyan-blue); opacity: .85; padding: 8px 2px; transition: .15s; }
.navlink:hover { opacity: 1; color: #fff; }
.navlink-active { opacity: 1; color: #fff; box-shadow: inset 0 -2px 0 var(--cs-sky-blue); }
.btn { display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-body); font-weight: 600; font-size: 15px; line-height: 1.2; padding: 8px 14px; border-radius: 8px; cursor: pointer; border: none; transition: .15s; white-space: nowrap; }
.btn-pri { background: #2563eb; color: #fff; }
.btn-pri:hover { background: #1d4ed8; }

/* ---------- Shell: sidebar + content ---------- */
.guide-shell {
  max-width: 1180px; margin: 0 auto; padding: 0 28px;
  display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 48px;
  align-items: start;
}

.guide-sidebar {
  position: sticky; top: 78px; align-self: start;
  padding: 34px 0 24px; border-right: 1px solid var(--border);
  padding-right: 22px; min-height: 60vh;
}
.sidebar-eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--cs-storm-grey); margin-bottom: 12px;
}
/* Category header in the sidebar; the eyebrow labels the whole nav, these label
   each group within it (a touch smaller, spaced above its list). */
.sidebar-section {
  font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--cs-storm-grey); margin: 18px 0 6px;
}
.sidebar-section:first-of-type { margin-top: 2px; }
.sidebar-list { list-style: none; display: flex; flex-direction: column; gap: 2px; counter-reset: g; }
.sidebar-list li { counter-increment: g; }
.sidebar-list a {
  display: block; padding: 8px 12px; border-radius: var(--radius-md);
  font-size: 14px; color: var(--fg-2); line-height: 1.35; transition: .12s;
}
.sidebar-list a::before { content: counter(g) ". "; color: var(--cs-storm-grey); font-variant-numeric: tabular-nums; }
.sidebar-list a:hover { background: var(--cs-grey-50); color: var(--fg); }
.sidebar-list a.active { background: var(--cs-cyan-blue); color: var(--cs-midnight-blue); font-weight: 600; }
.sidebar-list a.active::before { color: var(--cs-cobalt-blue); }
.sidebar-env {
  margin-top: 22px; display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--cs-storm-grey);
}
.env-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cs-success); }

.guide-main { padding: 34px 0 40px; min-width: 0; }

.breadcrumb { font-size: 13px; color: var(--cs-storm-grey); display: flex; gap: 8px; align-items: center; margin-bottom: 18px; }
.breadcrumb a { color: var(--cs-storm-grey); }
.breadcrumb a:hover { color: var(--cs-cobalt-blue); }

.guide-more { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--border); }
.guide-more a { font-size: 14px; font-weight: 600; color: var(--cs-cobalt-blue); }

/* ---------- Prose ---------- */
.prose { max-width: 76ch; }
.prose h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -.5px; color: var(--cs-midnight-blue); }
.prose > .lede { font-size: 17px; color: var(--fg-2); margin: 14px 0 6px; }
.prose h2 { font-family: var(--font-display); font-weight: 700; font-size: 23px; letter-spacing: -.3px; color: var(--cs-midnight-blue); margin: 42px 0 10px; padding-top: 8px; scroll-margin-top: 90px; }
.prose h3 { font-family: var(--font-body); font-weight: 700; font-size: 17px; color: var(--cs-grey-900); margin: 28px 0 8px; scroll-margin-top: 90px; }
.prose p { color: var(--fg-1); margin: 12px 0; }
.prose ul, .prose ol { margin: 12px 0 12px 22px; color: var(--fg-1); }
.prose li { margin: 6px 0; }
.prose li > code, .prose p > code, .prose td > code, .prose h3 > code {
  font-family: var(--font-mono); font-size: 13px; background: var(--cs-grey-50);
  border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 1px 5px; color: var(--cs-midnight-blue);
}
/* Inline links in rendered guide prose stay underlined for readability, but the
   guide index cards are also anchors inside .prose — the card (its border/hover)
   is the click affordance, so exclude .guide-card from the underline. Without
   this the card's eyebrow, title and description all inherit the link underline. */
.prose a:not(.btn):not(.guide-card) { color: var(--cs-cobalt-blue); text-decoration: underline; text-underline-offset: 2px; }
.prose a:not(.btn):not(.guide-card):hover { color: var(--cs-midnight-blue); }
.prose strong { color: var(--cs-grey-900); font-weight: 700; }

/* Step markers for numbered flows */
.prose h2.step { display: flex; align-items: center; gap: 12px; }
.prose h2.step .n {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--cs-cobalt-blue); color: #fff; font-family: var(--font-body);
  font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}

/* Callouts */
.note, .warn, .papercut {
  border-radius: var(--radius-lg); padding: 14px 16px; margin: 18px 0;
  font-size: 14.5px; line-height: 1.55; border: 1px solid;
}
.note { background: var(--cs-cyan-blue); border-color: #bfe6fb; color: var(--cs-midnight-blue); }
.warn { background: #fdf5e6; border-color: var(--cs-warning-300); color: var(--cs-warning-fg); }
.papercut { background: #fdeeee; border-color: var(--cs-error-300); color: #7a2420; }
.note strong, .warn strong, .papercut strong { color: inherit; }
.note p, .warn p, .papercut p { color: inherit; margin: 6px 0; }
.note :first-child, .warn :first-child, .papercut :first-child { margin-top: 0; }
.note :last-child, .warn :last-child, .papercut :last-child { margin-bottom: 0; }

/* Fact / reference tables */
.prose table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 14px; display: block; overflow-x: auto; }
.prose table thead th { text-align: left; background: var(--cs-grey-50); color: var(--cs-storm-grey); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.prose table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--fg-1); vertical-align: top; }
.prose table td:first-child { white-space: nowrap; }

/* Category header on the index, above each group of cards. */
.guide-section-title {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  color: var(--cs-midnight-blue); margin: 30px 0 2px;
}
.guide-section-title:first-of-type { margin-top: 14px; }
/* Cards on the index */
.guide-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0 8px; }
.guide-card {
  display: block; border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; transition: .15s;
}
.guide-card:hover { background: var(--cs-grey-50); border-color: transparent; transform: translateY(-2px); }
.guide-card .gc-step { font-size: 12px; font-weight: 700; color: var(--cs-cobalt-blue); letter-spacing: .4px; }
.guide-card h3 { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--cs-midnight-blue); margin: 4px 0 4px; }
.guide-card p { font-size: 13.5px; color: var(--fg-2); margin: 0; }

/* ---------- Code tabs ---------- */
.code-tabs, .prose .code-block { margin: 18px 0; border: 1px solid var(--cs-grey-100); border-radius: var(--radius-lg); overflow: hidden; background: var(--cs-grey-1000); }
.code-tabs .tablist { display: none; gap: 2px; padding: 8px 8px 0; background: var(--cs-grey-950); align-items: center; }
.code-tabs.enhanced .tablist { display: flex; flex-wrap: wrap; }
.code-tabs .tab {
  font-family: var(--font-body); font-size: 13px; font-weight: 600; color: #aeb4c7;
  background: transparent; border: none; border-radius: 8px 8px 0 0; padding: 8px 13px; cursor: pointer; transition: .12s;
}
.code-tabs .tab:hover { color: #fff; background: rgba(255,255,255,.06); }
.code-tabs .tab[aria-selected="true"] { color: #fff; background: var(--cs-grey-1000); }
.code-tabs .tab:focus-visible { outline: 2px solid var(--cs-sky-blue); outline-offset: -2px; }

/* Copy-to-clipboard buttons on guide code blocks (progressive enhancement,
   injected by /_/js/guides.js — a page with JS disabled shows no button and is
   otherwise unaffected). Unlike the landing page's light .copy-btn
   (index.html), the guide button sits on the dark code chrome: it is styled
   to blend in like the tab row (muted text, near-transparent background) and
   overlays the block rather than reserving space for itself. */
.copy-btn {
  font-family: var(--font-body); font-size: 12px; font-weight: 600; color: #aeb4c7;
  background: rgba(255, 255, 255, .06); border: 1px solid transparent; border-radius: var(--radius-md);
  padding: 5px 10px; cursor: pointer; transition: .15s; flex-shrink: 0;
}
.copy-btn:hover { color: #fff; background: rgba(255, 255, 255, .10); }
.copy-btn:focus-visible { outline: 2px solid var(--cs-sky-blue); outline-offset: 1px; }
.copy-btn.is-copied { color: var(--cs-sky-blue); background: rgba(255, 255, 255, .10); }

/* The copy button overlays the top-right corner of its code block and
   reserves no layout space: both a standalone .code-block figure and a
   .code-tabs group are positioned hosts, and the button is pinned inside
   them. At rest it is invisible so it never covers the first line of code;
   it reveals on hover/focus-within of the block, and always for keyboard
   focus on the button itself so it stays reachable without a pointer. */
.prose .code-block, .code-tabs { position: relative; }
.code-block .copy-btn, .code-tabs .copy-btn {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  opacity: 0; transition: opacity .15s, color .15s, background .15s;
}
.code-block:hover .copy-btn, .code-block:focus-within .copy-btn,
.code-tabs:hover .copy-btn, .code-tabs:focus-within .copy-btn,
.code-block .copy-btn:focus-visible, .code-tabs .copy-btn:focus-visible {
  opacity: 1;
}

.code-tabs .panel { margin: 0; }
.code-tabs .panel figcaption, .code-block .code-lang {
  font-family: var(--font-body); font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: #8891a8;
}
.code-tabs .panel figcaption { padding: 10px 16px 0; }
.code-tabs.enhanced .panel figcaption { display: none; }

/* A lone fenced block (a JSON response, a shell one-liner) rendered by guides.go
   as a <figure class="code-block"> with a static language caption above the
   <pre> — a single-block equivalent of the .code-tabs panel caption, but never
   a clickable tab since there is only one language. Omitted entirely (see
   guides.go) when the fence carries no language info string. Styled as the
   card's toolbar bar (matching .code-tabs .tablist) rather than a floating
   caption, so the block reads as one integrated card. */
.code-block .code-lang { display: block; margin: 0; padding: 8px 16px; background: var(--cs-grey-950); }

/* Standalone code blocks (a lone JSON response, a shell one-liner) rendered by
   goldmark as <pre><code>. This also sets the base for the panels inside a
   .code-tabs group; the group rules below strip the per-block chrome. */
.prose pre {
  background: var(--cs-grey-1000); border: 1px solid var(--cs-grey-100); border-radius: var(--radius-lg);
  margin: 16px 0; padding: 14px 16px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.55; color: #e6e9f2;
}
.prose pre code { font-family: inherit; background: none; border: none; padding: 0; color: inherit; white-space: pre; font-size: 13px; }
.code-tabs pre, .code-block pre { border: none; border-radius: 0; margin: 0; background: transparent; }
/* Non-enhanced (no-JS) fallback: separate each language block visibly. */
.code-tabs:not(.enhanced) .panel + .panel { border-top: 1px solid var(--cs-grey-900); }

@media (max-width: 900px) {
  .guide-shell { grid-template-columns: 1fr; gap: 0; }
  .guide-sidebar { position: static; border-right: none; border-bottom: 1px solid var(--border); padding: 20px 0; min-height: 0; }
  .guide-cards { grid-template-columns: 1fr; }
  .navlink { display: none; }
  .navlink-active { display: inline-block; }
}

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); margin-top: 60px; background: #fff; }
.fbot { max-width: 1180px; margin: 0 auto; padding: 22px 28px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; align-items: center; }
.fbot p { font-size: 12.5px; color: var(--cs-storm-grey); }
.fbot a { color: var(--cs-storm-grey); text-decoration: none; }
.fbot a:hover { color: var(--cs-cobalt-blue); }
