/*
 * Studio Docs — Contentstack docs-style theme.
 *
 * Three-column layout (top header / left nav / content / right TOC) with
 * typography + color tokens chosen to visually approximate
 * contentstack.com/docs/studio.
 */

/* ── Reset + tokens ──────────────────────────────────────────────────── */

* { box-sizing: border-box; }

:root {
  --cs-bg:           #ffffff;
  --cs-bg-soft:      #f6f8fa;
  --cs-bg-sidebar:   #fafbfc;
  --cs-border:       #e4e8ed;
  --cs-border-soft:  #eef0f3;
  --cs-text:         #1f2937;
  --cs-text-muted:   #6b7280;
  --cs-text-soft:    #4b5563;
  --cs-heading:      #0f172a;
  --cs-link:         #6c5ce7;
  --cs-link-hover:   #5a4bd1;
  --cs-accent:       #6c5ce7;
  --cs-code-bg:      #f3f4f6;
  --cs-code-text:    #be185d;
  --cs-pre-bg:       #0f172a;
  --cs-pre-text:     #e2e8f0;

  --cs-note-bg:      #eff6ff;
  --cs-note-border:  #3b82f6;
  --cs-tip-bg:       #ecfdf5;
  --cs-tip-border:   #10b981;
  --cs-warn-bg:      #fffbeb;
  --cs-warn-border:  #f59e0b;
  --cs-additional-bg:      #f5f3ff;
  --cs-additional-border:  #8b5cf6;

  --cs-header-h:     56px;
  --cs-sidebar-w:    272px;
  --cs-toc-w:        260px;
  --cs-content-max:  760px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--cs-text);
  background: var(--cs-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Top header ──────────────────────────────────────────────────────── */

.cs-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--cs-header-h);
  background: var(--cs-bg);
  border-bottom: 1px solid var(--cs-border);
  display: flex;
  align-items: center;
  /* Bar spans the full viewport (the border-bottom should), but the inner
     content aligns with .cs-shell's max-width: 1440px gutter so the brand
     sits above the sidebar's left edge instead of hugging the viewport edge. */
  padding-left:  max(24px, calc((100vw - 1440px) / 2));
  padding-right: max(24px, calc((100vw - 1440px) / 2));
  z-index: 100;
}

.cs-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--cs-heading);
  text-decoration: none;
  font-size: 15px;
}

.cs-header-brand-mark {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.cs-header-brand-name {
  color: var(--cs-heading);
  font-weight: 600;
}

.cs-header-nav {
  margin-left: 32px;
  display: flex;
  gap: 18px;
  font-size: 14px;
}

.cs-header-nav a {
  color: var(--cs-text-soft);
  text-decoration: none;
}

.cs-header-nav a:hover { color: var(--cs-heading); }

.cs-header-spacer { flex: 1; }

.cs-header-action {
  font-size: 13px;
  color: var(--cs-text-soft);
  text-decoration: none;
  border: 1px solid var(--cs-border);
  padding: 5px 10px 5px 8px;
  border-radius: 6px;
  background: var(--cs-bg);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cs-header-action:hover {
  color: var(--cs-heading);
  border-color: #cbd5e1;
}

.cs-header-action-mark { display: block; flex-shrink: 0; }
.cs-header-action-ext { color: var(--cs-text-muted); flex-shrink: 0; }

/* ── Three-column shell ──────────────────────────────────────────────── */

.cs-shell {
  display: grid;
  grid-template-columns: var(--cs-sidebar-w) 1fr var(--cs-toc-w);
  max-width: 1440px;
  margin: 0 auto;
  padding-top: var(--cs-header-h);
}

/* ── Left sidebar ────────────────────────────────────────────────────── */

.cs-sidebar {
  position: sticky;
  top: var(--cs-header-h);
  align-self: start;
  height: calc(100vh - var(--cs-header-h));
  overflow-y: auto;
  padding: 24px 12px 48px 24px;
  border-right: 1px solid var(--cs-border-soft);
  background: var(--cs-bg-sidebar);
  font-size: 14px;
}

/* Search — style only the input's border + focus ring, and shrink
   Pagefind's UI-scale so its own clear button naturally fits.
   DO NOT override Pagefind's form/results layout — that cascades into
   the result cards and collapses their line-height. */
.cs-search {
  margin-bottom: 20px;
  padding-right: 4px;
  /* Pagefind's default scale is 1 which assumes a ~60px input; ours is
     smaller, so scale everything down proportionally. */
  --pagefind-ui-scale: 0.75;
  --pagefind-ui-primary: #8b5cf6;
  --pagefind-ui-text: #1f2937;
  --pagefind-ui-background: #ffffff;
  --pagefind-ui-border: #e5e7eb;
  --pagefind-ui-tag: #f3f4f6;
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 6px;
  --pagefind-ui-font: inherit;
}
.cs-search .pagefind-ui__search-input:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.15);
}
/* Clear button — style it as a plain × icon (reset the browser's default
   button border + background). */
.cs-search .pagefind-ui__search-clear {
  font-size: 0 !important;
  color: transparent !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.cs-search .pagefind-ui__search-clear::before {
  content: "×";
  font-size: 20px;
  line-height: 1;
  color: #6b21a8;
  font-weight: 600;
  display: inline-block;
  vertical-align: middle;
}
.cs-search .pagefind-ui__search-clear:hover::before {
  color: #4c1d95;
}
/* Pagefind adds .pagefind-ui__suppressed to the clear button both when the
   input is empty (correct — nothing to clear) AND after results render
   (a quirk of this Pagefind version). We only want to override the second
   case. `:has()` lets us key on the input's own state — if the input has
   text (not showing placeholder), unsuppress the clear. */
.cs-search:has(.pagefind-ui__search-input:not(:placeholder-shown))
  .pagefind-ui__search-clear.pagefind-ui__suppressed {
  opacity: 1 !important;
  pointer-events: auto !important;
}

pre {
  position: relative;
}
.cs-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease;
}
pre:hover .cs-copy-btn { opacity: 1; }
.cs-copy-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }

.cs-page-meta {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--cs-border-soft);
  font-size: 13px;
  color: #6b7280;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.cs-page-meta-link {
  color: #6b21a8;
  text-decoration: none;
}
.cs-page-meta-link:hover { text-decoration: underline; }
.cs-page-meta-date { color: #9ca3af; }

.cs-sidebar-group { margin-bottom: 18px; }

.cs-sidebar-role-header {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b21a8;
  padding: 12px 12px 8px 4px;
  margin-top: 14px;
  margin-bottom: 6px;
  border-top: 1px solid #e5e7eb;
}

.cs-sidebar-role-header:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 4px;
}


.cs-sidebar-group-title-link {
  color: inherit;
  text-decoration: none;
  display: block;
  margin: -6px -10px 2px;
  padding: 6px 10px;
  border-radius: 6px;
}

.cs-sidebar-group-title-link:hover {
  color: var(--cs-heading);
  background: rgba(108, 92, 231, 0.06);
}

.cs-sidebar-group-title-link.active {
  color: var(--cs-link);
  background: rgba(108, 92, 231, 0.10);
}

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

.cs-sidebar-list li { margin: 0; }

.cs-sidebar-link {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--cs-text-soft);
  text-decoration: none;
  line-height: 1.4;
}

.cs-sidebar-link:hover {
  background: rgba(108, 92, 231, 0.06);
  color: var(--cs-heading);
}

.cs-sidebar-link.active {
  background: rgba(108, 92, 231, 0.10);
  color: var(--cs-link);
  font-weight: 600;
}

/* ── Content ─────────────────────────────────────────────────────────── */

.cs-content {
  padding: 36px 48px 96px;
  min-width: 0;
}

.docs-content {
  max-width: var(--cs-content-max);
  margin: 0 auto;
}

.docs-content > :first-child { margin-top: 0; }

.docs-content h1,
.docs-content h2,
.docs-content h3,
.docs-content h4,
.docs-content h5,
.docs-content h6 {
  color: var(--cs-heading);
  font-weight: 700;
  line-height: 1.25;
  scroll-margin-top: calc(var(--cs-header-h) + 16px);
}

.docs-content h1 {
  font-size: 32px;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.docs-content h2 {
  font-size: 24px;
  margin: 40px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--cs-border-soft);
}

.docs-content h3 {
  font-size: 18px;
  margin: 28px 0 10px;
}

.docs-content h4 {
  font-size: 15px;
  margin: 22px 0 8px;
}

.docs-content p {
  margin: 0 0 16px;
  color: var(--cs-text);
}

.docs-content ul,
.docs-content ol {
  margin: 0 0 16px;
  padding-left: 26px;
}

.docs-content li { margin: 4px 0; }

.docs-content a {
  color: var(--cs-link);
  text-decoration: none;
  border-bottom: 1px solid rgba(108, 92, 231, 0.25);
}

.docs-content a:hover {
  color: var(--cs-link-hover);
  border-bottom-color: var(--cs-link-hover);
}

.docs-content hr {
  border: none;
  border-top: 1px solid var(--cs-border-soft);
  margin: 32px 0;
}

.docs-content strong { color: var(--cs-heading); }

/* Inline + block code */

.code, code {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  background: var(--cs-code-bg);
  color: var(--cs-code-text);
  padding: 2px 6px;
  border-radius: 4px;
}

.docs-content a .code, .docs-content a code {
  color: inherit;
}

pre {
  background: var(--cs-pre-bg);
  color: var(--cs-pre-text);
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.55;
  margin: 16px 0;
}

pre .code, pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* Callouts */

.note, .tip, .warning, .additional-resource {
  border-left: 4px solid;
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 6px 6px 0;
  font-size: 14.5px;
  line-height: 1.55;
}

.note               { background: var(--cs-note-bg);       border-color: var(--cs-note-border); }
.tip                { background: var(--cs-tip-bg);        border-color: var(--cs-tip-border); }
.warning            { background: var(--cs-warn-bg);       border-color: var(--cs-warn-border); }
.additional-resource{ background: var(--cs-additional-bg); border-color: var(--cs-additional-border); }

.note strong, .tip strong, .warning strong, .additional-resource strong {
  display: inline;
}

blockquote {
  margin: 16px 0;
  padding: 4px 18px;
  border-left: 3px solid var(--cs-border);
  color: var(--cs-text-soft);
  background: var(--cs-bg-soft);
  border-radius: 0 6px 6px 0;
}

/* Tables */

.cs-table-wrapper {
  margin: 18px 0;
  overflow-x: auto;
  border: 1px solid var(--cs-border);
  border-radius: 8px;
}

.cs-table table {
  width: 100%;
  min-width: 640px;   /* keep columns readable — wrapper scrolls if container is narrower */
  border-collapse: collapse;
  font-size: 14px;
}

.cs-table th,
.cs-table td {
  border-bottom: 1px solid var(--cs-border-soft);
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  /* Only break at natural word boundaries — never split words mid-character. */
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  /* Floor each column so a narrow middle column can't be squeezed to
     one-word-per-line by neighbours holding long code identifiers. */
  min-width: 140px;
}

.cs-table thead th {
  background: var(--cs-bg-soft);
  font-weight: 600;
  color: var(--cs-heading);
  border-bottom: 1px solid var(--cs-border);
}

.cs-table tr:last-child td { border-bottom: none; }

/* Inline code in table cells: never split an identifier. If a token is
   longer than its cell, let it overflow — the table wrapper's
   overflow-x: auto will show a horizontal scrollbar only for the
   table(s) that genuinely need it, not fragment `app/[[...slug]]/page.tsx`
   into pieces. */
.cs-table td code,
.cs-table td .code {
  font-size: 0.86em;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

/* Images */

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.2em 0;
  border-radius: 6px;
}

/* Video

   Walkthrough players. The width/height attributes on the element reserve the
   16:9 box up front so the page doesn't jump. Players are preload="metadata" —
   enough for the browser to size the video and show its first frame, without
   pulling the whole file until someone hits play. */

video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.2em 0;
  border-radius: 6px;
  background: #000;
}

.cs-video-note {
  margin: -0.5em 0 1.8em;
  font-size: 0.9rem;
  color: var(--cs-text-muted);
}


/* ── Right TOC ───────────────────────────────────────────────────────── */

.cs-toc {
  position: sticky;
  top: var(--cs-header-h);
  align-self: start;
  height: calc(100vh - var(--cs-header-h));
  overflow-y: auto;
  padding: 40px 20px 48px 16px;
  font-size: 14px;
  border-left: 1px solid var(--cs-border-soft);
}

.cs-toc-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cs-text-muted);
  margin: 0 0 14px;
  padding-left: 12px;
}

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

.cs-toc-list li { margin: 0; }

.cs-toc-list a {
  display: block;
  padding: 7px 12px;
  color: var(--cs-text-soft);
  text-decoration: none;
  line-height: 1.5;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
}

.cs-toc-list a:hover {
  color: var(--cs-link);
  background: rgba(108, 92, 231, 0.05);
  border-left-color: var(--cs-link);
}

.cs-toc-list .cs-toc-h3 a {
  padding-left: 26px;
  font-size: 13.5px;
  color: var(--cs-text-muted);
}

/* ── Deck-style components (port of Studio Overview Deck patterns) ──── */

.cs-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cs-link);
  margin: 8px 0 0;
}

/* When marked wraps a bare <span class="cs-eyebrow"> in a <p>, kill the
   stack-up between the paragraph and the following heading so the
   eyebrow visually attaches to its headline. */
.docs-content p:has(> .cs-eyebrow:only-child) {
  margin: 0 0 4px;
}
.docs-content p:has(> .cs-eyebrow:only-child) + h1,
.docs-content p:has(> .cs-eyebrow:only-child) + h2,
.docs-content p:has(> .cs-eyebrow:only-child) + h3 {
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
}

.docs-content h1.cs-hero,
.docs-content h2.cs-hero {
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
  padding: 0;
  border: none;
}

.cs-hero .cs-accent       { color: var(--cs-link); }
.cs-hero .cs-accent-teal  { color: #0d9488; }
.cs-hero .cs-accent-red   { color: #dc2626; }

.cs-lede {
  font-size: 17px;
  line-height: 1.55;
  color: var(--cs-text-soft);
  max-width: 720px;
  margin: 0 0 28px;
}

/* Stat / unlock card grid */
.cs-stat-grid {
  display: grid;
  gap: 14px;
  margin: 22px 0 28px;
}
.cs-stat-grid.cs-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cs-stat-grid.cs-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cs-stat-grid.cs-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .cs-stat-grid.cs-cols-3,
  .cs-stat-grid.cs-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .cs-stat-grid { grid-template-columns: 1fr !important; }
}

.cs-stat-card {
  background: var(--cs-bg);
  border: 1px solid var(--cs-border);
  border-radius: 12px;
  padding: 18px 18px 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.cs-stat-card .cs-stat-figure {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--cs-link);
  letter-spacing: -0.01em;
}

.cs-stat-card .cs-stat-figure.cs-warn { color: #dc2626; }

.cs-stat-card .cs-stat-label {
  font-weight: 600;
  color: var(--cs-heading);
  margin-top: 8px;
  font-size: 15px;
}

.cs-stat-card .cs-stat-note {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--cs-text-muted);
  line-height: 1.5;
}

.cs-stat-card.cs-highlight {
  background: rgba(108, 92, 231, 0.06);
  border-color: rgba(108, 92, 231, 0.25);
}

/* Stepper with chevron separators */
.cs-stepper {
  display: grid;
  grid-template-columns: repeat(var(--cs-stepper-cols, 5), 1fr);
  align-items: stretch;
  gap: 22px;
  margin: 22px 0 28px;
  list-style: none;
  padding: 0;
}

.cs-stepper li {
  position: relative;
  background: var(--cs-bg);
  border: 1px solid var(--cs-border);
  border-radius: 12px;
  padding: 12px 12px 14px;
  margin: 0;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.cs-stepper li::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: -16px;
  transform: translateY(-50%);
  color: var(--cs-text-muted);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.cs-stepper li:last-child::after { content: none; }

.cs-stepper-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cs-text-muted);
  margin-bottom: 6px;
}

.cs-stepper-title {
  font-weight: 600;
  color: var(--cs-heading);
  font-size: 14.5px;
  line-height: 1.35;
}

.cs-stepper li.cs-done {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}
.cs-stepper li.cs-done .cs-stepper-tag { color: #047857; }

@media (max-width: 900px) {
  .cs-stepper { grid-template-columns: 1fr; }
  .cs-stepper li::after {
    content: "↓";
    top: auto;
    right: 50%;
    bottom: -16px;
    transform: translateX(50%);
  }
}

/* Two-track section (Engineering once / Marketing every page after) */
.cs-track {
  background: var(--cs-bg);
  border: 1px solid var(--cs-border);
  border-radius: 14px;
  padding: 20px 22px 24px;
  margin: 16px 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.cs-track-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.cs-track-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cs-link);
}

.cs-track-title .cs-track-sub {
  font-weight: 500;
  color: var(--cs-text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 8px;
}

.cs-track-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(108, 92, 231, 0.10);
  color: var(--cs-link);
}

.cs-track-badge.cs-track-badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

/* Positioning comparison row */
.cs-positioning {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  background: var(--cs-bg);
  border: 1px solid var(--cs-border);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 10px 0;
  align-items: baseline;
}

.cs-positioning-label {
  font-weight: 700;
  color: var(--cs-heading);
}

.cs-positioning-note {
  color: var(--cs-text-soft);
  font-size: 14.5px;
}

.cs-positioning.cs-winner {
  background: var(--cs-link);
  border-color: var(--cs-link);
}
.cs-positioning.cs-winner .cs-positioning-label,
.cs-positioning.cs-winner .cs-positioning-note {
  color: #ffffff;
}

@media (max-width: 700px) {
  .cs-positioning { grid-template-columns: 1fr; gap: 4px; }
}

/* Compact callout strip (e.g. "Engineers freed for product …") */
.cs-callout-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 14px 20px;
  margin: 18px 0 8px;
  font-size: 14.5px;
}

.cs-callout-strip strong { color: #ffffff; }
.cs-callout-strip .cs-callout-strip-aside { color: #5eead4; font-weight: 600; }

@media (max-width: 700px) {
  .cs-callout-strip { flex-direction: column; align-items: flex-start; }
}

/* ── Mobile hamburger toggle (pure CSS, no JS) ─────────────────────── */

.cs-nav-toggle { position: absolute; left: -9999px; }
.cs-nav-burger { display: none; }
.cs-nav-backdrop { display: none; }

/* ── Responsive ──────────────────────────────────────────────────────── */

/* Below 1180px: drop the right TOC, keep header + sidebar + content */
@media (max-width: 1180px) {
  .cs-shell { grid-template-columns: var(--cs-sidebar-w) 1fr; }
  .cs-toc { display: none; }
}

/* Below 900px: collapse to single column. Sidebar becomes a slide-in
   drawer triggered by the hamburger. */
@media (max-width: 900px) {
  .cs-shell { grid-template-columns: 1fr; }

  .cs-nav-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    color: var(--cs-text-soft);
    cursor: pointer;
    margin-right: 6px;
  }
  .cs-nav-burger:hover { background: var(--cs-bg-soft); color: var(--cs-heading); }

  .cs-sidebar {
    position: fixed;
    top: var(--cs-header-h);
    left: 0;
    width: min(280px, 85vw);
    height: calc(100vh - var(--cs-header-h));
    background: var(--cs-bg);
    border-right: 1px solid var(--cs-border);
    box-shadow: 4px 0 18px rgba(15, 23, 42, 0.08);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 90;
    overflow-y: auto;
  }
  .cs-nav-toggle:checked ~ .cs-shell .cs-sidebar { transform: translateX(0); }

  .cs-nav-backdrop {
    display: block;
    position: fixed;
    inset: var(--cs-header-h) 0 0 0;
    background: rgba(15, 23, 42, 0.40);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 80;
  }
  .cs-nav-toggle:checked ~ .cs-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Close drawer when any sidebar link is clicked — use :has() if supported,
     else the user can tap the backdrop. */
  body:has(.cs-sidebar-link:active) .cs-nav-toggle { /* placeholder for future */ }
}

/* Below 700px: tighten content typography for phone reading */
@media (max-width: 700px) {
  :root { --cs-header-h: 52px; }
  body { font-size: 15.5px; line-height: 1.6; }

  .cs-content { padding: 24px 18px 64px; }
  .docs-content { max-width: 100%; }

  .cs-header { padding: 0 14px; }
  .cs-header-nav { gap: 12px; font-size: 13px; }
  .cs-header-brand { font-size: 14px; }
  .cs-header-brand-name { display: none; }   /* keep just the mark in small headers */

  .docs-content h1 { font-size: 26px; }
  .docs-content h2 { font-size: 21px; margin: 32px 0 12px; padding-bottom: 6px; }
  .docs-content h3 { font-size: 17px; }

  .cs-hero,
  .docs-content h1.cs-hero,
  .docs-content h2.cs-hero { font-size: 28px; line-height: 1.2; }

  pre { font-size: 12.5px; padding: 12px 14px; }
  .code, code { font-size: 0.85em; }

  /* Tables — break out to viewport edges and shrink type on phone. */
  .cs-table-wrapper {
    margin: 16px -18px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
  .cs-table table { font-size: 13px; }
  .cs-table th, .cs-table td { padding: 8px 12px; }

  /* Deck components — collapse grids and steppers to single column */
  .cs-stat-grid.cs-cols-2,
  .cs-stat-grid.cs-cols-3,
  .cs-stat-grid.cs-cols-4 { grid-template-columns: 1fr; }

  .cs-stepper { grid-template-columns: 1fr !important; gap: 28px; }
  .cs-stepper li::after {
    content: "↓";
    top: auto;
    right: 50%;
    bottom: -22px;
    transform: translateX(50%);
  }

  .cs-positioning { grid-template-columns: 1fr; gap: 4px; padding: 14px 16px; }

  .cs-callout-strip {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    font-size: 13.5px;
  }
}

/* --------------------------------------------------------------------
   Digital Concierge chat widget — fix low-contrast code rendering.

   The widget loads its own stylesheet from dc-agents.contentstack.com
   and colors code text `rgb(226, 232, 240)` (slate-200), meant for a
   dark background, but its chat bubble ships light — so code renders
   near-invisible. Verified against DOM: chatbot-message-markdown class
   lives in the regular DOM (no shadow root), so this override wins.

   CSS-module class names carry a hash suffix that can change per widget
   version (`messages-module__chatbot-message-markdown___D0xqwx`), so
   selectors use `[class*="..."]` on the stable middle segment.
   -------------------------------------------------------------------- */

[class*="chatbot-message-markdown"] pre,
[class*="chatbot-message-markdown"] code {
  color: #0f172a !important;                    /* slate-900 — dark ink */
  background: #f1f5f9 !important;               /* slate-100 — subtle chip */
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
}

[class*="chatbot-message-markdown"] pre {
  padding: 12px 14px !important;
  border-radius: 6px !important;
  overflow-x: auto !important;
  white-space: pre !important;
}

[class*="chatbot-message-markdown"] :not(pre) > code {
  padding: 1px 5px !important;
  border-radius: 4px !important;
  background: #e0e7ff !important;              /* indigo-100 — inline chip */
  color: #3730a3 !important;                    /* indigo-800 */
}

@media (prefers-color-scheme: dark) {
  [class*="chatbot-message-markdown"] pre,
  [class*="chatbot-message-markdown"] code {
    color: #f1f5f9 !important;                  /* slate-100 */
    background: #1e293b !important;             /* slate-800 */
  }
  [class*="chatbot-message-markdown"] :not(pre) > code {
    background: #312e81 !important;            /* indigo-900 */
    color: #c7d2fe !important;                  /* indigo-200 */
  }
}

/* ── Sidebar tracks (developer / author / evaluator) ─────────────────── */
.cs-sidebar-tracks-switcher{display:flex;gap:4px;padding:8px 12px 12px;border-bottom:1px solid var(--cs-border,#e5e5e5);margin-bottom:8px;flex-wrap:wrap}
.cs-sidebar-tracks-switcher button{font:inherit;font-size:11px;font-weight:600;padding:5px 10px;border-radius:99px;cursor:pointer;background:transparent;border:1px solid currentColor;color:var(--cs-text-muted,#666);opacity:0.7}
.cs-sidebar-tracks-switcher button[aria-pressed="true"]{background:var(--cs-accent,#8a38f5);border-color:var(--cs-accent,#8a38f5);color:#fff;opacity:1}
.cs-sidebar-track[hidden]{display:none}
.cs-sidebar-section{margin:16px 0 8px}
.cs-sidebar-track-note{font-size:11.5px;color:var(--cs-text-muted,#75726f);padding:0 12px 10px;line-height:1.45}
.cs-sidebar-section-title{font-size:13.5px;font-weight:650;color:var(--cs-text,#1a1a1a);padding:14px 12px 6px;margin:0}
.cs-sidebar-section-title-link{color:inherit;text-decoration:none}
.cs-sidebar-section-title-link.active{color:var(--cs-accent,#8a38f5)}
.cs-sidebar-group--depth-1{margin-left:8px;border-left:1px solid var(--cs-border,#e5e5e5);padding-left:8px}
.cs-sidebar-group--depth-2{margin-left:8px;border-left:1px solid var(--cs-border,#e5e5e5);padding-left:8px}
.cs-sidebar-group-title{font-size:12px;font-weight:650;padding:4px 12px;margin-bottom:2px;color:var(--cs-text,#1a1a1a)}
