:root {
  /* Documentation shell tokens - purely structural, never theme-reactive,
     so :root is fine for these. */
  --docs-sidebar-width: 260px;
  --docs-header-height: 64px;
  --docs-content-max-width: 1320px;
  --docs-section-gap: var(--cymru-space-16, 4rem);
  --docs-code-radius: var(--cb-radius-md, 8px);

  /* Brand Accents (Welsh NHS Identity Refined) */
  --cb-brand-primary: #005eb8;        /* NHS Wales Blue */
  --cb-brand-primary-hover: #004b94;
  --cb-brand-accent: #d5281b;         /* Dragon Red (used sparingly) */
  --cb-brand-accent-subtle: #fef2f2;
  --cb-brand-teal: #00a499;

  /* Typography Stacks */
  --cb-font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --cb-font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Radii Scale */
  --cb-radius-sm: 6px;
  --cb-radius-md: 8px;
  --cb-radius-lg: 12px;
  --cb-radius-xl: 16px;
  --cb-radius-full: 9999px;
}

/*
 * IMPORTANT: the colour aliases below are deliberately declared on
 * .cy-theme-provider, NOT :root.
 *
 * CyThemeProvider sets data-theme="dark"/"high-contrast" on its own
 * wrapper div (class="cy-theme-provider"), and the library's
 * themes/dark.css and high-contrast.css override --cymru-color-* via a
 * `[data-theme="..."]` selector that matches that SAME div. CSS custom
 * properties resolve `var(...)` against the cascaded value AT THE
 * ELEMENT WHERE THEY'RE DECLARED, not lazily at each point of use - so
 * if these aliases were declared at :root (an ANCESTOR of
 * .cy-theme-provider), `var(--cb-bg-canvas)` etc. would
 * always resolve to the light-theme value baked in at :root, and that
 * frozen value would inherit down through the whole app regardless of
 * which theme is actually active. Redeclaring them here, on the exact
 * element the [data-theme] override targets, means they correctly
 * re-resolve against the active theme's values instead.
 */
.cy-theme-provider {
  /* Actual background/foreground for the whole app - :root/body above
     stay light and static (see the note below the light .cy-theme-provider
     token block), so without these two lines the shell (header,
     sidebar) switches to dark styling via its own explicit rules while
     .cb-shell-main and everything else silently keeps inheriting
     body's hardcoded light background/text colour - exactly the
     washed-out-in-dark-mode bug this fixes. */
  display: block;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--cb-bg-canvas);
  color: var(--cb-text-primary);

  /* Light Mode Surface Palette */
  --cb-bg-canvas: #ffffff;
  --cb-bg-subtle: #f8fafc;            /* Slate 50 */
  --cb-bg-surface: #ffffff;
  --cb-bg-surface-elevated: #ffffff;
  --cb-bg-muted: #f1f5f9;             /* Slate 100 */
  --cb-bg-canvas-dots: #cbd5e1;

  /* Borders & Dividers */
  --cb-border-subtle: #e2e8f0;        /* Slate 200 */
  --cb-border-strong: #cbd5e1;        /* Slate 300 */
  --cb-border-focus: #005eb8;

  /* Foreground / Text Hierarchy */
  --cb-text-primary: #0f172a;         /* Slate 900 */
  --cb-text-secondary: #475569;       /* Slate 600 */
  --cb-text-muted: #556479;           /* Between Slate 500 and 600: 5.5:1 on --cb-bg-muted (Slate 500 was 4.34:1) */
  --cb-text-subtle: #94a3b8;          /* Slate 400 */
  --cb-text-on-accent: #ffffff;

  /* Code / Previews */
  --cb-code-bg: #090d16;
  --cb-code-border: #1e293b;
  --cb-code-header-bg: #0f172a;
  --cb-code-text: #e2e8f0;

  /* Shadows */
  --cb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --cb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --cb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

.cy-theme-provider[data-theme="dark"] {
  /* Dark Mode Surface Elevation (Deep Slate / Obsidian) */
  --cb-bg-canvas: #090d16;            /* Deep Obsidian */
  --cb-bg-subtle: #0f172a;            /* Slate 900 */
  --cb-bg-surface: #131d31;           /* Slate 850 */
  --cb-bg-surface-elevated: #1e293b;  /* Slate 800 */
  --cb-bg-muted: #1e293b;
  --cb-bg-canvas-dots: #334155;

  /* Dark Mode Borders */
  --cb-border-subtle: rgba(255, 255, 255, 0.08);
  --cb-border-strong: rgba(255, 255, 255, 0.16);
  --cb-border-focus: #38bdf8;

  /* Dark Mode Text Hierarchy */
  --cb-text-primary: #f8fafc;         /* Slate 50 */
  --cb-text-secondary: #cbd5e1;       /* Slate 300 */
  --cb-text-muted: #94a3b8;           /* Slate 400 */
  --cb-text-subtle: #64748b;          /* Slate 500 */
  --cb-text-on-accent: #ffffff;

  /* Code Blocks */
  --cb-code-bg: #070a10;
  --cb-code-border: rgba(255, 255, 255, 0.1);
  --cb-code-header-bg: #0d121c;

  /* Shadows */
  --cb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --cb-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
  --cb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
}

body {
  margin: 0;
  background-color: #f0f4f5; /* Light default, overridden by app contents */
  color: #212b32;
  font-family: var(--cb-font-sans);
  letter-spacing: -0.011em;
}

/* Glassmorphism Header & refined accent stripe */
.cb-shell-header {
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 2px solid var(--cb-brand-primary);
  border-bottom: 1px solid var(--cb-border-subtle);
  height: var(--docs-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  color: var(--cb-text-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.cy-theme-provider[data-theme="dark"] .cb-shell-header {
  background-color: rgba(9, 13, 22, 0.8); /* --cb-bg-canvas with opacity */
  border-top: 2px solid var(--cb-border-focus);
}

.cb-shell-header a {
  color: var(--cb-text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.cb-shell-header a:hover {
  color: var(--cb-text-primary);
}

.cb-shell-header .cy-brand-logo,
.cb-shell-header .cy-brand-logo__wordmark {
  color: var(--cb-text-primary);
}

.cb-shell-header__brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cb-version-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: var(--cb-radius-full);
  font-size: 0.65rem;
  font-weight: 600;
  background-color: var(--cb-brand-primary);
  color: var(--cb-text-on-accent);
  letter-spacing: 0.05em;
  font-family: var(--cb-font-mono);
}

.cb-shell-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cb-shell-header__search-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--cb-bg-muted);
  border: 1px solid var(--cb-border-subtle);
  border-radius: var(--cb-radius-md);
  padding: 0.35rem 0.5rem 0.35rem 0.75rem;
  color: var(--cb-text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 0.5rem;
}

.cb-shell-header__search-trigger:hover {
  background: var(--cb-bg-surface);
  border-color: var(--cb-border-strong);
  color: var(--cb-text-primary);
}

.search-text {
  margin-right: 1.5rem;
}

.search-kbd {
  display: inline-block;
  padding: 0.125rem 0.25rem;
  font-family: var(--cb-font-mono);
  font-size: 0.65rem;
  background: var(--cb-bg-surface);
  border: 1px solid var(--cb-border-strong);
  border-radius: 4px;
  color: var(--cb-text-secondary);
}

/* Shell Layout */
.cb-shell-body {
  display: flex;
  min-height: calc(100vh - var(--docs-header-height) - 3px);
}

.cb-shell-sidebar {
  width: var(--docs-sidebar-width);
  background-color: var(--cb-bg-surface);
  border-right: 1px solid var(--cb-border-subtle);
  padding: 1.5rem 1rem;
  flex-shrink: 0;
}

.cb-shell-main {
  flex-grow: 1;
  /* Flex items default to min-width: auto, which refuses to shrink
     below the intrinsic width of their content. A long unwrapped code
     line inside a code block would otherwise force this whole column
     (and the page) wider than the viewport instead of scrolling inside
     the code block's own overflow-x: auto. */
  min-width: 0;
  max-width: var(--docs-content-max-width);
  padding: 2rem 2.5rem;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  background-color: var(--cb-bg-canvas);
  color: var(--cb-text-primary);
}

.cb-shell-toc {
  width: 220px;
  flex-shrink: 0;
  padding: 2rem 1rem 2rem 0;
  display: none;
}

@media (min-width: 1024px) {
  .cb-shell-toc {
    display: block;
  }
}

.cb-toc-sticky {
  position: sticky;
  top: calc(var(--docs-header-height) + 2rem);
}

.cb-toc-title {
  margin-top: 0;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--cb-text-primary);
}

.cb-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--cb-border-subtle);
}

.cb-toc-list li {
  margin-bottom: 0.5rem;
}

.cb-toc-list a {
  display: block;
  padding-left: 1rem;
  color: var(--cb-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.cb-toc-list a:hover {
  color: var(--cb-text-primary);
  border-left: 2px solid var(--cb-brand-primary);
  margin-left: -1px;
}

/* Sidebar Nav Links */
.cb-nav-group {
  margin-bottom: 1.25rem;
}

.cb-nav-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cb-text-muted);
  cursor: pointer;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.25rem;
  list-style: none;
  border-radius: var(--cb-radius-md);
  transition: all 0.2s ease;
}

.cb-nav-group summary:hover {
  background-color: var(--cb-bg-muted);
  color: var(--cb-text-primary);
}

.cb-nav-group__chevron {
  transition: transform 0.2s ease;
}

details[open] > summary .cb-nav-group__chevron {
  transform: rotate(90deg);
}

.cb-nav-group summary::-webkit-details-marker {
  display: none;
}

.cb-nav-item {
  display: block;
  padding: 0.4rem 0.75rem;
  margin: 0.15rem 0;
  color: var(--cb-text-secondary);
  text-decoration: none;
  border-radius: var(--cb-radius-md);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.cb-nav-item:hover {
  background-color: var(--cb-bg-muted);
  color: var(--cb-text-primary);
}

.cb-nav-item.active {
  background-color: var(--cb-bg-muted);
  color: var(--cb-text-primary);
  font-weight: 500;
}

/* Tab Navigation */
.cb-tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 2px solid var(--cb-border-subtle);
  margin-bottom: 1.5rem;
}

.cb-tab-btn {
  background: none;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--cb-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.cb-tab-btn:hover {
  color: var(--cb-text-primary);
}

.cb-tab-btn.active {
  color: var(--cb-text-primary);
  border-bottom-color: var(--cb-brand-primary);
  font-weight: 600;
}

/* Workbench & Playground */
.cb-workbench-preview {
  background: var(--cb-bg-surface);
  border: 1px solid var(--cb-border-subtle);
  border-radius: var(--docs-code-radius);
  padding: 2.5rem 1.5rem;
  background-image: radial-gradient(var(--cb-bg-canvas-dots) 1px, transparent 1px);
  background-size: 16px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  box-shadow: var(--cb-shadow-sm);
}

.cb-playground-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.cb-playground-panel {
  min-width: 0;
  background: var(--cb-bg-surface);
  border: 1px solid var(--cb-border-subtle);
  border-radius: var(--docs-code-radius);
  padding: 1rem;
  box-shadow: var(--cb-shadow-sm);
}

/* Badges */
.cb-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--cb-radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--cb-bg-muted);
  color: var(--cb-text-primary);
  border: 1px solid var(--cb-border-strong);
}

/* ── Icon gallery (CyIcon workbench) ── */
.cb-icon-meta-bar {
  font-size: 0.8rem;
  color: var(--cb-text-muted);
  margin: 0 0 0.5rem;
}

.cb-icon-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.cb-icon-toolbar__search {
  flex: 1 1 260px;
  min-width: 220px;
}

.cb-icon-search-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.6rem;
  border-radius: var(--docs-code-radius);
  border: 1px solid var(--cymru-color-border, #cbd5e1);
  background: var(--cb-bg-surface, #ffffff);
}

.cb-icon-search-field .cy-icon {
  color: var(--cb-text-muted);
  flex-shrink: 0;
}

.cb-icon-search-input {
  flex: 1;
  border: none;
  background: none;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--cb-text-primary);
  outline: none;
}

.cb-icon-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  border: none;
  background: none;
  color: var(--cb-text-muted);
  cursor: pointer;
  border-radius: var(--cb-radius-full);
}

.cb-icon-search-clear:hover {
  color: var(--cb-text-primary);
  background: var(--cb-bg-muted, #f8fafc);
}

.cb-icon-count-badge {
  white-space: nowrap;
}

.cb-icon-domain-group {
  margin-bottom: 2rem;
}

.cb-icon-domain-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.cb-icon-domain-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cb-text-primary);
}

.cb-icon-domain-count {
  font-size: 0.8rem;
  color: var(--cb-text-muted);
}

.cb-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--cymru-space-4, 1rem);
}

.cb-icon-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--cymru-space-2, 0.5rem);
  text-align: center;
  background: var(--cb-bg-surface, #ffffff);
  border: 1px solid var(--cymru-color-border, #e2e8f0);
  border-radius: var(--docs-code-radius);
  padding: 0.85rem 0.5rem;
  cursor: pointer;
  color: inherit;
  box-shadow: var(--cb-shadow-sm);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.cb-icon-tile:hover {
  transform: translateY(-2px);
  border-color: var(--cymru-cyan-700, #12a3c9);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.cb-icon-tile:focus-visible {
  outline: 2px solid var(--cymru-cyan-700, #12a3c9);
  outline-offset: 2px;
}

.cb-icon-tile--active {
  border-color: var(--cb-brand-primary);
  background: var(--cb-bg-muted, #f8fafc);
}

.cb-icon-tile--copied {
  border-color: var(--cymru-color-success, #007f3b);
}

.cb-icon-tile__name {
  font-size: var(--cymru-font-size-xs, 0.75rem);
  word-break: break-word;
  color: var(--cb-text-muted);
}

.cb-icon-tile__toast {
  position: absolute;
  top: -0.6rem;
  right: -0.4rem;
  background: var(--cymru-color-success, #007f3b);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--cb-radius-full);
  box-shadow: var(--cb-shadow-sm);
}

/* Responsive */
@media (max-width: 768px) {
  .cb-shell-body {
    flex-direction: column;
  }
  .cb-playground-grid {
    grid-template-columns: 1fr;
  }
  .cb-icon-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Home hero CTA buttons */
.cb-demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-radius: var(--cb-radius-md);
  font-weight: 500;
  text-decoration: none;
  transition: all 150ms ease;
  font-size: 0.875rem;
}

.cb-demo-btn--primary {
  background-color: var(--cb-brand-primary);
  color: #ffffff;
  border: 1px solid transparent;
}

.cb-demo-btn--primary:hover {
  background-color: var(--cb-brand-primary-hover);
}

.cb-demo-btn--secondary {
  background-color: var(--cb-bg-surface);
  color: var(--cb-text-primary);
  border: 1px solid var(--cb-border-strong);
}

.cb-demo-btn--secondary:hover {
  background-color: var(--cb-bg-muted);
}

/* Home quick-start */
.cb-quickstart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.cb-quickstart__step-title {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

/* ── Header actions (search / theme toggle stubs) ── */
.cb-shell-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cb-shell-header__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--cb-text-primary);
  background: transparent;
  border: none;
  border-radius: var(--docs-code-radius);
  opacity: 0.85;
  cursor: pointer;
}

.cb-shell-header__icon-btn:hover {
  opacity: 1;
  background: var(--cb-bg-muted);
}

.cb-shell-header__icon-btn:focus-visible {
  outline: 2px solid var(--cb-border-focus);
  outline-offset: 2px;
  opacity: 1;
}

/* ── Mobile hamburger + off-canvas sidebar drawer ── */
.cb-shell-header__hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  color: var(--cb-text-primary);
  background: transparent;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--docs-code-radius);
  order: -1;
  margin-inline-end: 0.5rem;
}

.cb-shell-header__hamburger:hover {
  background: var(--cb-bg-muted);
}

.cb-shell-header__hamburger:focus-visible {
  outline: 2px solid var(--cb-border-focus);
  outline-offset: 2px;
}

.cb-shell-header__nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.cb-shell-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 39;
}

@media (max-width: 768px) {
  .cb-shell-header__hamburger {
    display: inline-flex;
  }

  .cb-shell-header__nav {
    display: none;
  }

  .cb-shell-sidebar {
    position: fixed;
    top: var(--docs-header-height);
    left: 0;
    bottom: 0;
    width: min(80vw, 300px);
    z-index: 40;
    overflow-y: auto;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 200ms ease;
  }

  .cb-shell-sidebar--open {
    transform: translateX(0);
  }
}

/* ── Playground property controls ── */
.cb-property-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cb-text-muted);
  margin-bottom: 0.35rem;
}

.cb-property-select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: var(--docs-code-radius);
  border: 1px solid var(--cymru-color-border, #cbd5e1);
  background: var(--cb-bg-surface, #ffffff);
  color: var(--cb-text-primary);
  font-size: 0.9rem;
}

.cb-property-toggle-group {
  display: inline-flex;
  border: 1px solid var(--cymru-grey-300, #cbd5e1);
  border-radius: var(--docs-code-radius);
  overflow: hidden;
}

.cb-property-toggle {
  padding: 0.4rem 0.9rem;
  border: none;
  background: var(--cb-bg-surface, #ffffff);
  color: var(--cb-text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  border-right: 1px solid var(--cymru-grey-300, #cbd5e1);
}

.cb-property-toggle:last-child {
  border-right: none;
}

.cb-property-toggle.active {
  /* cymru-cyan-700 with white text is only
     2.95:1 - fails WCAG AA's 4.5:1. cyan-900 passes at 6.16:1. Only
     this text-bearing usage changes; the brighter cyan-700 stays as
     the accent for non-text uses (borders, the switch track) where
     the more lenient 3:1 threshold applies and the brighter, more
     "brand" tone reads better. */
  background: var(--cymru-cyan-900, #0a6a84);
  color: #ffffff;
  font-weight: 600;
}

.cb-property-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cb-property-switch {
  position: relative;
  width: 2.5rem;
  height: 1.4rem;
  border-radius: 999px;
  border: none;
  background: var(--cymru-grey-300, #cbd5e1);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 150ms ease;
}

.cb-property-switch.on {
  /* cyan-700 gives only 2.95:1 for the white thumb against the track -
     borderline against WCAG 1.4.11's 3:1 non-text threshold. cyan-900
     gives a safer 6.16:1. */
  background: var(--cymru-cyan-900, #0a6a84);
}

.cb-property-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.1rem;
  height: 1.1rem;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 150ms ease;
}

.cb-property-switch.on .cb-property-switch__thumb {
  transform: translateX(1.1rem);
}

/* ── Preview / generated code panel captions ── */
.cb-panel-caption {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cb-text-muted);
  margin-bottom: 0.5rem;
}

.cb-open-in-github {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

/* ── Static content pages (Getting Started, Design Tokens, Installation) ── */
.cb-page-header {
  margin-bottom: var(--docs-section-gap, 4rem);
}

.cb-page-title {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.cb-page-description {
  color: var(--cb-text-muted);
  max-width: 60ch;
  margin: 0;
}

.cb-section {
  margin-bottom: 3rem;
}

.cb-section-title {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
}

.cb-section-description {
  color: var(--cb-text-muted);
  margin: 0 0 1rem;
}

.cb-section pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--docs-code-radius);
  overflow-x: auto;
  font-size: 0.85rem;
}

.cb-api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.cb-api-table th {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 2px solid var(--cymru-grey-300, #cbd5e1);
}

.cb-api-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--cymru-grey-200, #e2e8f0);
}

.cb-api-table__name {
  font-family: monospace;
  font-weight: 600;
  /* Theme-aware link colour (AA in light, dark and high-contrast). The old
     fixed sky-700 (#0369a1) passed on white but not on the dark surface. */
  color: var(--cymru-color-link, #0369a1);
}

.cb-api-table__type,
.cb-api-table__default {
  font-family: monospace;
  color: var(--cb-text-muted);
}

/* ── Older per-example blocks (component doc pages predating the
     Preview/Properties/Generated-code workbench pattern) ── */
.cb-example {
  border: 1px solid var(--cymru-grey-200, #e2e8f0);
  border-radius: var(--docs-code-radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.cb-example__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cb-text-muted);
  padding: 0.6rem 1rem;
  background: var(--cb-bg-muted, #f8fafc);
  border-bottom: 1px solid var(--cymru-grey-200, #e2e8f0);
}

.cb-example__preview {
  padding: 1.5rem;
  background-color: var(--cb-bg-surface, #ffffff);
  background-image: radial-gradient(var(--cymru-color-border, #e1e7eb) 1px, transparent 1px);
  background-size: 16px 16px;
}

.cb-example__code {
  margin: 0;
  padding: 1rem;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.85rem;
  overflow-x: auto;
}

/* ── Misc small helpers ── */
.cb-demo-outline {
  border: 1px dashed var(--cymru-grey-400, #94a3b8);
  border-radius: var(--docs-code-radius);
}

.cb-demo-btn--warning {
  /* #d97706 (Tailwind amber-600) with white text is only 3.19:1 against
     WCAG AA's 4.5:1 requirement - amber-700 (#b45309) passes at 5.02:1
     while staying visually a "warning" amber. */
  background: #b45309;
  color: #ffffff;
  border: none;
}

/* ── Prev/next page navigation ── */
.cb-page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: var(--docs-section-gap, 4rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--cymru-color-border, #e2e8f0);
}

.cb-page-nav__link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--cymru-color-border, #e2e8f0);
  border-radius: var(--docs-code-radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.cb-page-nav__link:hover {
  border-color: var(--cymru-cyan-700, #12a3c9);
  background: var(--cb-bg-muted);
}

.cb-page-nav__link:focus-visible {
  outline: 2px solid var(--cymru-cyan-700, #12a3c9);
  outline-offset: 2px;
}

.cb-page-nav__link--next {
  text-align: right;
  align-items: flex-end;
}

.cb-page-nav__direction {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cb-text-muted);
}

.cb-page-nav__title {
  font-weight: 600;
  color: var(--cb-text-primary);
}

@media (max-width: 640px) {
  .cb-page-nav {
    grid-template-columns: 1fr;
  }

  .cb-page-nav__link--next {
    text-align: left;
    align-items: flex-start;
    grid-row: 1;
  }
}

/* ── Search modal (Ctrl+K) ── */
/* CyDialog supplies the surface, border, shadow, top-layer and backdrop; the
   search box wants the body flush to the edges. */
.cb-search-dialog {
  --cy-dialog-max-width: 36rem;
  margin-block-start: 12vh;
}

.cb-search-dialog .cy-dialog__body {
  padding: 0;
}

.cb-search-modal {
  display: flex;
  flex-direction: column;
  color: var(--cb-text-primary);
}

.cb-search-modal__input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--cymru-color-border, #e2e8f0);
  color: var(--cb-text-muted);
  flex-shrink: 0;
}

.cb-search-modal__input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--cb-text-primary);
  font-size: 1rem;
}

/* demo.css loads after cymrublazor.css, so an unconditional
   `outline: none` here would tie on specificity with the library's
   global :focus-visible rule and win on cascade order, silently
   defeating the keyboard focus ring (WCAG 2.4.7). Only suppress the
   default outline for mouse/pointer focus, exactly like the library's
   own :focus:not(:focus-visible) pattern. */
.cb-search-modal__input:focus:not(:focus-visible) {
  outline: none;
}

.cb-search-modal__esc {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--cymru-color-border, #cbd5e1);
  border-radius: 4px;
  color: var(--cb-text-muted);
}

.cb-search-modal__results {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  overflow-y: auto;
}

.cb-search-modal__result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--docs-code-radius);
  text-decoration: none;
  color: inherit;
}

.cb-search-modal__result--active,
.cb-search-modal__result:hover {
  background: var(--cb-bg-muted);
}

.cb-search-modal__result-category {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  /* cymru-cyan-700 (the usual accent) is only 2.95:1
     against white - fails WCAG AA's 4.5:1 for text this size. cyan-900
     passes at 6.16:1. The 3:1-threshold, non-text uses of
     --cymru-cyan-700 elsewhere (active-state borders, indicators)
     are unaffected and unchanged. */
  color: var(--cymru-cyan-900, #0a6a84);
}

.cb-search-modal__result-title {
  font-weight: 600;
}

.cb-search-modal__result-desc {
  flex-basis: 100%;
  font-size: 0.8rem;
  color: var(--cb-text-muted);
}

.cb-search-modal__empty,
.cb-search-modal__hint {
  margin: 0;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--cb-text-muted);
  font-size: 0.9rem;
}

/* ── Blazor WASM boilerplate ──────────────────────────────────────────────
   Standard framework markup rendered by index.html (#blazor-error-ui,
   .loading-progress/.loading-progress-text) - these CSS rules ship by
   default in the SDK's project template, but this project's index.html
   was heavily customised and this stylesheet never carried them over.
   Without display:none here, #blazor-error-ui showed on every single
   page load regardless of whether an error actually occurred, since a
   plain <div> defaults to display:block.
   ========================================================================== */

#blazor-error-ui {
  background: lightyellow;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

#blazor-error-ui .reload {
  color: inherit;
  text-decoration: underline;
  margin-inline-start: 0.5rem;
}

.loading-progress {
  position: relative;
  display: block;
  width: 8rem;
  height: 8rem;
  margin: 20vh auto 1rem;
}

.loading-progress circle {
  fill: none;
  stroke: var(--cymru-color-border, #e2e8f0);
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: var(--cymru-color-primary, #325083);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
  position: absolute;
  text-align: center;
  font-weight: 600;
  inset: calc(20vh + 3.7rem) 0 auto 0;
}

.loading-progress-text::after {
  content: var(--blazor-load-percentage-text, "Loading");
}

/* ── CySidebar workbench stage ──
   A self-contained "app window" for the CySidebar preview: the sidebar on one
   side, a content area with live status and actions on the other. */
.cb-sidebar-stage {
  display: flex;
  width: 100%;
  min-height: 340px;
  position: relative;
  overflow: hidden;
  background: var(--cb-bg-surface);
  border: 1px solid var(--cb-border-subtle);
  border-radius: var(--docs-code-radius);
  box-shadow: var(--cb-shadow-sm);
}

.cb-sidebar-stage__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--cb-bg-subtle);
  color: var(--cb-text-primary);
}

.cb-sidebar-stage__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.cb-sidebar-stage__status,
.cb-sidebar-stage__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cb-sidebar-stage__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--cb-border-subtle);
  border-radius: 999px;
  background: var(--cb-bg-surface);
  color: var(--cb-text-muted);
  font-size: 0.8rem;
}

.cb-sidebar-stage__chip strong {
  color: var(--cb-text-primary);
}

.cb-sidebar-stage__hint {
  margin: auto 0 0;
  font-size: 0.8rem;
  color: var(--cb-text-muted);
}

/* Sub-headings inside the Properties panel */
.cb-property-group-title {
  margin: 0.5rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--cb-border-subtle);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cb-text-muted);
}

.cb-property-group-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.cb-property-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--cb-text-muted);
}
