/* Size Material/Octicons SVG icons injected by pymdownx.emoji for the shadcn theme */
.twemoji {
  height: 1em;
  width: 1em;
  vertical-align: -0.125em;
  display: inline-block;
}

/* Round and resize the header logo */
header .size-8 img {
  border-radius: 6px;
  width: 32px !important;
  height: 32px !important;
}

/* Header site name — match logo size */
header a[data-slot="button"] h1 {
  font-size: 1.15rem !important;
  font-weight: 600;
  line-height: 1;
}

/* Align header logo/title with sidebar left edge */
header a[data-slot="button"] {
  padding-left: 0 !important;
  margin-left: -2px;
}

/* Breathing room when admonition follows H2 */
article h2 + .admonition {
  margin-top: 1rem !important;
}

/* Admonitions: left accent border by type */
article .admonition {
  border: none !important;
  border-left: 4px solid #009DD2 !important;
  padding: 12px 14px !important;
}
article .admonition.tip,
article .admonition.hint {
  border-left-color: #0ea5e9 !important;
}
article .admonition.warning,
article .admonition.caution,
article .admonition.attention {
  border-left-color: #f59e0b !important;
}
article .admonition.danger,
article .admonition.error {
  border-left-color: #ef4444 !important;
}
article .admonition.success,
article .admonition.check {
  border-left-color: #10b981 !important;
}

/* Admonition title on its own line — override theme's display:inline on first two p children */
article .admonition > p:first-child,
article .admonition > p:nth-child(2) {
  display: block !important;
  margin: 0 !important;
}
article .admonition > p.admonition-title {
  margin-bottom: 0.3em !important;
}

/* Table header row background */
article table thead tr {
  background-color: rgba(0, 0, 0, 0.04);
}
html.dark article table thead tr {
  background-color: rgba(255, 255, 255, 0.06);
}

/* Active page accent colour #009DD2 — left sidebar and right TOC */
[data-sidebar="menu-button"][data-active="true"] {
  background-color: rgba(0, 157, 210, 0.15) !important;
  border-color: transparent !important;
  color: #009DD2 !important;
}
[view-transition-name="toc"] a[data-active="true"] {
  color: #009DD2 !important;
}

/* Wrap long URLs in article links — preserve normal word breaks */
article a {
  overflow-wrap: break-word;
  word-break: normal;
}
/* Code blocks — visible container with contrast */
article .highlight {
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
}

article .highlight pre {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre;
  word-break: normal;
}

[data-md-color-scheme="slate"] article .highlight,
html.dark article .highlight {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
html.dark article .highlight pre,
html.dark article .highlight code {
  color: rgba(255, 255, 255, 0.85);
}

/* Fallback for pre outside .highlight */
article pre {
  white-space: pre;
  overflow-x: auto;
  word-break: normal;
}

/* Article heading hierarchy */
article h2 {
  font-size: 1.5rem !important;
  font-weight: 600 !important;
  margin-top: 2.5rem !important;
  padding-bottom: 0.375rem !important;
  border-bottom: 1px solid hsl(var(--border)) !important;
}
article h3 {
  font-size: 1.1875rem !important;
  font-weight: 600 !important;
  margin-top: 2rem !important;
  color: hsl(var(--foreground)) !important;
}
article h4 {
  font-size: 1rem !important;
  font-weight: 600 !important;
  margin-top: 1.5rem !important;
}

/* Anchor permalink links: hidden until heading hover */
.headerlink {
  text-decoration: none !important;
  margin-left: 0.35em;
  opacity: 0;
  transition: opacity 0.15s;
}
*:hover > .headerlink {
  opacity: 0.4;
}
.headerlink:hover {
  text-decoration: none !important;
  opacity: 0.7 !important;
}

/* Non-active sidebar page links: medium grey, lighter than folder labels */
[data-sidebar="menu-button"]:not([data-active="true"]) {
  color: #3d4554 !important;
}
html.dark [data-sidebar="menu-button"]:not([data-active="true"]) {
  color: #94a3b8 !important;
}

/* Sidebar page items: consistent size and vertical padding at all depths */
[data-sidebar="menu-button"] {
  font-size: 0.875rem !important;
  padding-top: 3px !important;
  padding-bottom: 3px !important;
  min-height: 26px !important;
  border-radius: 4px !important;
  transition: background 0.1s, color 0.1s !important;
}
[data-sidebar="menu-button"]:not([data-active="true"]):hover {
  background: rgba(0, 0, 0, 0.03) !important;
}
html.dark [data-sidebar="menu-button"]:not([data-active="true"]):hover {
  background: rgba(255, 255, 255, 0.04) !important;
}

/* Header: bottom border separator + positioning context */
header {
  border-bottom: 1px solid hsl(var(--border)) !important;
}
header .container-wrapper {
  position: relative !important;
}

/* Search bar: absolutely centered in header, visually prominent */
/* Search bar: right-aligned at all desktop viewports to avoid tab overlap */
@media (min-width: 768px) {
  #header-search-wrap {
    display: flex !important;
    position: fixed !important;
    right: 48px !important;
    left: auto !important;
    top: calc(var(--header-height) / 2) !important;
    transform: translateY(-50%) !important;
    max-width: 480px !important;
    min-width: 180px !important;
    width: min(480px, calc(100vw - 520px)) !important;
    z-index: 51 !important;
    align-items: center !important;
  }
}
#header-search-wrap > div {
  display: flex !important;
  width: 100% !important;
  flex: none !important;
}
#header-search-wrap button {
  width: 100% !important;
  height: 40px !important;
  background: hsl(var(--muted)) !important;
  border: 1.5px solid rgba(0,0,0,0.15) !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04) !important;
  color: hsl(var(--foreground)) !important;
}
#header-search-wrap button:hover {
  border-color: #009DD2 !important;
}
html.dark #header-search-wrap button {
  background: hsl(var(--card)) !important;
  border-color: rgba(255,255,255,0.2) !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1) !important;
}

/* ============================================================
   HOMEPAGE FULL-WIDTH — when sidebar is hidden
   Uses :has() to detect absence of sidebar element
   ============================================================ */
[data-slot="sidebar-wrapper"]:not(:has([data-slot="sidebar"])) {
  max-width: 100% !important;
  width: 100% !important;
}
[data-slot="sidebar-wrapper"]:not(:has([data-slot="sidebar"])) [data-slot="docs"] {
  width: 100% !important;
  max-width: 100% !important;
}
[data-slot="sidebar-wrapper"]:not(:has([data-slot="sidebar"])) .typography {
  max-width: 100% !important;
}
[data-slot="sidebar-wrapper"]:not(:has([data-slot="sidebar"])) article {
  max-width: 100% !important;
}

/* Article body text: dark charcoal for WCAG AA contrast */
article {
  color: #2d3748;
  line-height: 1.75;
}
html.dark article {
  color: #e2e8f0;
}

/* ============================================================
   SIDEBAR TYPOGRAPHY HIERARCHY
   ============================================================ */

/* L0 Section labels (Getting Started, Reference, etc.)
   Muted uppercase dividers — structural, not interactive */
details.group\/l0 {
  margin-top: 16px !important;
  padding-top: 12px !important;
  border-top: 1px solid hsl(var(--border)) !important;
}
details.group\/l0:first-child {
  border-top: none !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}
details.group\/l0 > summary {
  font-size: 0.6875rem !important;   /* 11px */
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: #6b7280 !important;
}
html.dark details.group\/l0 > summary {
  color: #94a3b8 !important;
}

/* Reduce indentation at deep sidebar levels (3+) to prevent truncation */
details.group\/folder details.group\/folder ul {
  margin-left: 14px !important;
}

/* L1+ Folder labels (expandable groups within sections)
   Slightly bolder than page links — signals expandable */
details.group\/folder > summary {
  font-weight: 500 !important;
  color: #374151 !important;
}
html.dark details.group\/folder > summary {
  color: #e2e8f0 !important;
}

/* ============================================================
   TOC TYPOGRAPHY
   ============================================================ */

/* "On This Page" label */
[view-transition-name="toc"] p,
[view-transition-name="toc"] h2 {
  font-size: 0.6875rem !important;   /* 11px */
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* TOC H2 links */
[view-transition-name="toc"] a[data-depth="2"] {
  font-size: 0.875rem !important;   /* 14px — matches left sidebar page links */
  font-weight: 400 !important;
  color: #374151 !important;
}
html.dark [view-transition-name="toc"] a[data-depth="2"] {
  color: #cbd5e1 !important;
}

/* TOC H3 links — slightly indented, medium weight */
[view-transition-name="toc"] a[data-depth="3"] {
  font-size: 0.8125rem !important;   /* 13px */
  font-weight: 500 !important;
  color: #6b7280 !important;
  padding-left: 1.25rem !important;
}
html.dark [view-transition-name="toc"] a[data-depth="3"] {
  color: #8896a8 !important;
}

/* ============================================================
   HOME PAGE HERO
   ============================================================ */

.kb-hero {
  text-align: center;
  padding: 1.5rem 1rem 1.25rem;
}
.kb-hero h1 {
  font-size: 2rem !important;
  font-weight: 700 !important;
  margin-bottom: 0.5rem !important;
  border-bottom: none !important;
}
.kb-hero h1 .headerlink {
  display: none !important;
}
.kb-hero p {
  color: #6b7280;
  margin-bottom: 1.5rem !important;
}
html.dark .kb-hero p {
  color: #94a3b8;
}
button.kb-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: hsl(var(--background));
  border: 1.5px solid rgba(0,0,0,0.15);
  border-radius: 1rem;
  padding: 0.875rem 1.75rem;
  height: 52px;
  min-width: 400px;
  cursor: pointer;
  color: #6b7280;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: left;
}
button.kb-search-trigger:hover {
  border-color: #009DD2;
  box-shadow: 0 2px 6px rgba(0,157,210,0.12);
}
html.dark button.kb-search-trigger {
  background: hsl(var(--card));
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ============================================================
   HOME PAGE TILE GRID
   ============================================================ */

.kb-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 0 1rem 3rem;
  max-width: min(1200px, calc(100vw - 4rem));
  margin: 0 auto;
}
@media (max-width: 900px) {
  .kb-tile-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .kb-tile-grid { grid-template-columns: 1fr; }
}

.kb-tile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1.25rem 1rem;
  min-height: 160px;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  background: hsl(var(--card));
  text-decoration: none !important;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.kb-tile:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-color: #009DD2;
  transform: translateY(-2px);
}
.kb-tile__icon {
  width: 44px;
  height: 44px;
  background: rgba(0, 157, 210, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.kb-tile__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin: 0;
}
.kb-tile__desc {
  font-size: 0.8125rem;
  color: #6b7280;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-tile__arrow {
  font-size: 0.8125rem;
  color: #009DD2;
  margin-top: 0.25rem;
}

/* Popular articles */
.kb-popular {
  max-width: min(1200px, calc(100vw - 4rem));
  margin: 0 auto;
  padding: 0 1rem 2rem;
}
.kb-popular h2 {
  font-size: 1.125rem !important;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 1rem !important;
  margin-top: 0 !important;
  border-bottom: none !important;
}
.kb-popular__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem 2rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
@media (max-width: 640px) {
  .kb-popular__grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .kb-popular__grid { grid-template-columns: 1fr; }
}
.kb-popular__grid li {
  padding: 0;
  margin: 0;
}
.kb-popular__grid li::before { display: none; }
.kb-popular__grid a {
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  text-decoration: none !important;
  padding: 6px 0;
  display: inline-block;
}
.kb-popular__grid a:hover { color: #009DD2; }

/* CTA */
.kb-cta {
  max-width: min(1200px, calc(100vw - 4rem));
  margin: 1.5rem auto 3rem;
  padding: 1.75rem 2rem;
  background: rgba(0, 119, 168, 0.08);
  border: 1px solid rgba(0, 119, 168, 0.25);
  border-radius: 0.75rem;
  text-align: center;
}
.kb-cta p {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  color: #374151;
}
.kb-cta__btn {
  display: inline-block;
  background: #009DD2;
  color: #fff !important;
  text-decoration: none !important;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 0.5rem;
  transition: background 0.15s, box-shadow 0.15s;
}
.kb-cta__btn:hover {
  background: #0088b8;
  box-shadow: 0 4px 12px rgba(0, 157, 210, 0.3);
}

/* ============================================================
   DARK MODE — HOMEPAGE OVERRIDES
   ============================================================ */
html.dark .kb-tile__desc { color: #94a3b8; }
html.dark .kb-popular h2 { color: #e2e8f0 !important; }
html.dark .kb-popular__grid a { color: #cbd5e1; }
html.dark .kb-popular__grid a:hover { color: #009DD2; }
html.dark .kb-cta p { color: #cbd5e1; }
html.dark .kb-cta {
  background: rgba(0, 157, 210, 0.12);
  border-color: rgba(0, 157, 210, 0.25);
}

/* ============================================================
   TABLE OVERFLOW
   ============================================================ */
article table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================
   TILE GRID — ORPHAN CARD AT 2-COL BREAKPOINT
   ============================================================ */
@media (max-width: 900px) {
  .kb-tile-grid .kb-tile:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* ============================================================
   FOCUS-VISIBLE STYLES
   ============================================================ */
.kb-tile:focus-visible,
.kb-cta__btn:focus-visible,
button.kb-search-trigger:focus-visible {
  outline: 2px solid #009DD2;
  outline-offset: 2px;
}

/* ============================================================
   SECTION LANDING PAGE STYLES
   ============================================================ */
.kb-section-grid ul {
  list-style: none !important;
  padding: 0 !important;
}
.kb-section-grid li {
  padding: 0.75rem 0 !important;
  border-bottom: 1px solid hsl(var(--border)) !important;
  margin: 0 !important;
}
.kb-section-grid li:last-child {
  border-bottom: none !important;
}
.kb-section-grid li::before {
  display: none !important;
}

/* ============================================================
   SEARCH MODAL & RESULTS
   ============================================================ */

/* Dialog backdrop — solid overlay to block content behind */
#search-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5) !important;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
#search-dialog[open] {
  background: #ffffff !important;
}
html.dark #search-dialog[open] {
  background: #1e293b !important;
}
html.dark #search-dialog[open] div {
  background: #1e293b !important;
}
html.dark #search-dialog input {
  color: #f1f5f9 !important;
}
html.dark #search-dialog {
  border-color: #334155 !important;
}

/* Results container */
#mkdocs-search-results {
  max-height: calc(70vh - 60px) !important;
  overflow-y: auto !important;
}

/* Individual result items — compact spacing */
#mkdocs-search-results article {
  padding: 10px 14px !important;
  margin: 0 !important;
  border-radius: 6px !important;
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
  cursor: pointer;
  transition: background 0.1s;
}
#mkdocs-search-results article:last-child {
  border-bottom: none !important;
}
#mkdocs-search-results article:hover {
  background: rgba(0,0,0,0.03) !important;
}
html.dark #mkdocs-search-results article {
  border-bottom-color: rgba(255,255,255,0.06) !important;
}
html.dark #mkdocs-search-results article:hover {
  background: rgba(255,255,255,0.05) !important;
}

/* Result title links — reset margins */
#mkdocs-search-results h3 {
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-bottom: none !important;
  color: #1f2937 !important;
}
html.dark #mkdocs-search-results h3 {
  color: #f1f5f9 !important;
}
#mkdocs-search-results a {
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  color: #1f2937 !important;
  text-decoration: none !important;
}
#mkdocs-search-results a:hover {
  color: #009DD2 !important;
}
html.dark #mkdocs-search-results a {
  color: #f1f5f9 !important;
}

/* Result snippet text — tight to title */
#mkdocs-search-results p {
  font-size: 0.8125rem !important;
  color: #6b7280 !important;
  margin: 2px 0 0 !important;
  padding: 0 !important;
  line-height: 1.45 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}
html.dark #mkdocs-search-results p {
  color: #94a3b8 !important;
}

/* Dark mode dialog */
html.dark #search-dialog {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4) !important;
}
html.dark #search-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(4px) !important;
}

/* ============================================================
   INLINE CODE STYLING
   ============================================================ */
article code {
  background: rgba(0, 0, 0, 0.04) !important;
  padding: 2px 5px !important;
  border-radius: 3px !important;
  font-size: 0.875rem !important;
  overflow-wrap: break-word !important;
  word-break: break-all !important;
}
article pre code {
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
}
html.dark article code {
  background: rgba(255, 255, 255, 0.08) !important;
}
html.dark article pre code {
  background: transparent !important;
}

/* ============================================================
   PREFERS-REDUCED-MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .kb-tile,
  .kb-tile:hover,
  .kb-cta__btn,
  button.kb-search-trigger,
  [data-sidebar="menu-button"],
  .headerlink,
  *:hover > .headerlink {
    transition: none !important;
    transform: none !important;
    animation: none !important;
  }
}

/* ── Images — subtle rounding, shadow, and border ── */
article img:not([class]) {
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin: 1rem 0;
}

[data-md-color-scheme="slate"] article img:not([class]) {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── Video embeds — border, shadow, and rounding ── */
article iframe[src*="vimeo"] {
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin: 1rem 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
}

[data-md-color-scheme="slate"] article iframe[src*="vimeo"] {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ── Arcade embeds — no border/shadow (Arcade provides its own frame) ── */
article iframe[src*="arcade"] {
  margin: 1rem 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
}
