/* Docs page layout (not part of the framework). Built from the framework's
   own tokens, so it follows the customizer and light/dark mode. */

/* Anchors land below the mobile bar; on desktop there is no bar */
html { scroll-padding-top: 80px; }
@media (min-width: 992px) { html { scroll-padding-top: 24px; } }

/* ---- Brand + mobile bar (no top bar on desktop: it lives in the sidebar) ---- */
.docs-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  font-family: var(--md-sys-typescale-title-large-font);
  font-size: var(--md-sys-typescale-title-large-size);
  line-height: var(--md-sys-typescale-title-large-line-height);
}
.docs-brand > .material-symbols-rounded { color: var(--md-sys-color-primary); }
.docs-mobilebar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 64px;
  padding: 0 12px 0 4px;
  background-color: var(--md-sys-color-surface-container);
}

/* ---- Layout: a full-height sidebar on the left edge, content beside it ---- */
.docs-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) {
  .docs-layout {
    grid-template-columns: 300px minmax(0, 1fr);
    /* the sidebar's surface, painted on the grid: Bootstrap forces the
       offcanvas-lg background transparent at this width */
    background: linear-gradient(to right, var(--md-sys-color-surface-container-low) 300px, transparent 300px);
  }
}
/* Content sits in a centered column instead of spanning the whole width;
   text inside keeps its own 760px reading measure. */
.docs-main { width: 100%; max-width: 1120px; min-width: 0; margin-inline: auto; padding: 24px 16px 96px; }
@media (min-width: 992px) { .docs-main { padding: 40px 48px 120px; } }

/* Sidebar: an offcanvas below lg, a sticky full-height column above */
.docs-sidebar-head { padding: 16px 16px 8px 20px; }
.docs-sidebar-tools { display: flex; align-items: center; gap: 2px; margin: 12px 0 4px -8px; }
@media (min-width: 992px) {
  .docs-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 32px;
    overscroll-behavior: contain;
    /* Composited from the start: otherwise the first hover transition moves
       the sidebar onto its own layer, which rounds the links' half-pixel text
       the other way, and the text drops 1px and stays there. */
    will-change: transform;
  }
  .docs-sidebar .offcanvas-body { padding: 0; overflow: visible; }
  /* flush with the window edge: no sheet corners or shadow in the column */
  .docs-sidebar.offcanvas-start { border-radius: 0; box-shadow: none; }
}
@media (max-width: 991.98px) {
  /* a modal nav drawer leaves room to tap outside it (M3: 360 max, 56 gutter) */
  .docs-sidebar { --bs-offcanvas-width: min(320px, calc(100vw - 56px)); }
  .docs-sidebar .offcanvas-body { padding-top: 0; }
}
.docs-nav-group + .docs-nav-group { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.docs-nav-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  padding: 6px 16px;
  font-family: var(--md-sys-typescale-title-medium-font);
  font-size: var(--md-sys-typescale-title-medium-size);
  line-height: var(--md-sys-typescale-title-medium-line-height);
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}
.docs-nav-title > .material-symbols-rounded {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--md-sys-shape-corner-small);
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-size: 20px;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}
.docs-nav a { margin-left: 8px; }
.docs-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-family: var(--md-sys-typescale-label-large-font);
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: var(--md-sys-typescale-label-large-weight);
  transition: background-color var(--md-motion-fast-effects), color var(--md-motion-fast-effects);
}
.docs-nav a:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) var(--md-sys-state-hover-state-layer-opacity), transparent); color: var(--md-sys-color-on-surface); }
.docs-nav a.active { background-color: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.docs-nav a > .material-symbols-rounded { font-size: 20px; }

/* ---- Content ---- */
.docs-hero { padding: 24px 0 40px; }
.docs-section { padding-top: 8px; margin-bottom: 80px; }
.docs-section > h2 {
  margin-bottom: 8px;
  font-family: var(--md-sys-typescale-headline-large-font);
  font-size: var(--md-sys-typescale-headline-large-size);
  line-height: var(--md-sys-typescale-headline-large-line-height);
}
.docs-section > h3 {
  margin: 40px 0 8px;
  font-size: var(--md-sys-typescale-title-large-size);
  line-height: var(--md-sys-typescale-title-large-line-height);
  font-weight: 500;
}
.docs-section > h4 { margin: 24px 0 8px; font-size: var(--md-sys-typescale-title-medium-size); font-weight: 500; }
.docs-section > p, .docs-section > ul, .docs-section > ol { max-width: 760px; }
.docs-lead { font-size: var(--md-sys-typescale-body-large-size); line-height: var(--md-sys-typescale-body-large-line-height); color: var(--md-sys-color-on-surface-variant); max-width: 760px; }
.docs-section code:not(pre code) {
  padding: 1px 6px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  font-size: .875em;
  white-space: nowrap;
}
.docs-anchor {
  margin-left: 8px;
  color: var(--md-sys-color-outline);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--md-motion-fast-effects);
}
:is(h2, h3):hover > .docs-anchor, .docs-anchor:focus-visible { opacity: 1; }
.docs-group-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 48px 0 40px;
  padding: 16px 20px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-family: var(--md-sys-typescale-headline-small-font);
  font-size: var(--md-sys-typescale-headline-small-size);
  line-height: var(--md-sys-typescale-headline-small-line-height);
  font-weight: 500;
}
.docs-group-title > .material-symbols-rounded {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--md-sys-shape-corner-large);
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-size: 28px;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.docs-hero + .docs-group-title { margin-top: 8px; }

/* ---- Section header template ----
   h2 · .docs-tags (where it comes from) · .docs-lead (what it's for) ·
   .docs-usage (when to use it / what to use instead) · .docs-from-bs */
.docs-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.docs-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--md-sys-shape-corner-small);
  font-family: var(--md-sys-typescale-label-medium-font);
  font-size: var(--md-sys-typescale-label-medium-size);
  font-weight: var(--md-sys-typescale-label-medium-weight);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  white-space: nowrap;
}
.docs-tag > .material-symbols-rounded { font-size: 16px; }
.docs-tag code { padding: 0 !important; background: none !important; color: inherit !important; font-size: inherit; }
.docs-tag-m3  { background-color: var(--md-sys-color-primary-container);  color: var(--md-sys-color-on-primary-container); }
.docs-tag-bs  { background-color: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }
.docs-tag-add { background-color: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.docs-tag-js  { background-color: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.docs-tag-none { background: none; border: 1px solid var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface-variant); }

.docs-usage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  max-width: 760px;
  margin: 16px 0;
}
.docs-usage > div { padding: 12px 16px; border-radius: var(--md-sys-shape-corner-medium); background-color: var(--md-sys-color-surface-container-low); }
.docs-usage-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  font-family: var(--md-sys-typescale-title-small-font);
  font-size: var(--md-sys-typescale-title-small-size);
  font-weight: var(--md-sys-typescale-title-small-weight);
  color: var(--md-sys-color-on-surface);
}
.docs-usage-title > .material-symbols-rounded { font-size: 20px; }
.docs-usage-do .docs-usage-title > .material-symbols-rounded { color: var(--md-sys-color-success); }
.docs-usage-instead .docs-usage-title > .material-symbols-rounded { color: var(--md-sys-color-tertiary); }
.docs-usage ul { margin: 0; padding-left: 18px; font-size: var(--md-sys-typescale-body-medium-size); color: var(--md-sys-color-on-surface-variant); }
.docs-usage li + li { margin-top: 4px; }
.docs-from-bs {
  max-width: 760px;
  font-size: var(--md-sys-typescale-body-medium-size);
  color: var(--md-sys-color-on-surface-variant);
}
.docs-from-bs > strong { color: var(--md-sys-color-on-surface); font-weight: 500; }

/* ---- Example + code ---- */
.docs-example {
  position: relative;
  margin: 16px 0;
  padding: 24px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-large);
  background-color: var(--md-sys-color-surface);
}
.docs-example.has-code { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.docs-example > :last-child { margin-bottom: 0; }
.docs-example-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.docs-example-row + .docs-example-row { margin-top: 16px; }
.docs-example-tall { min-height: 320px; }

/* Code blocks keep one fixed, neutral palette (GitHub's light and dark
   syntax colors) whatever the theme: token colors taken from the theme
   clashed with each other on some seeds. All pass 4.5:1 (comments 5.7:1+). */
.docs-code {
  --docs-code-bg: #f6f8fa;
  --docs-code-text: #1f2328;
  --docs-code-tag: #116329;
  --docs-code-attr: #0550ae;
  --docs-code-val: #0a3069;
  --docs-code-com: #59636e;
  --docs-code-num: #cf222e;
  --docs-code-border: #d1d9e0;
  position: relative;
  margin: 16px 0;
  border: 1px solid var(--docs-code-border);
  border-radius: var(--md-sys-shape-corner-large);
  background-color: var(--docs-code-bg);
  overflow: hidden;
}
[data-bs-theme=dark] .docs-code {
  --docs-code-bg: #151b23;
  --docs-code-text: #e6edf3;
  --docs-code-tag: #7ee787;
  --docs-code-attr: #79c0ff;
  --docs-code-val: #a5d6ff;
  --docs-code-com: #9198a1;
  --docs-code-num: #ff7b72;
  --docs-code-border: #3d444d;
}
.docs-example.has-code + .docs-code { margin-top: 0; border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.docs-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 0 16px;
}
.docs-code-lang {
  font-size: var(--md-sys-typescale-label-small-size);
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--docs-code-com);
}
.docs-code pre {
  margin: 0;
  padding: 4px 16px 16px;
  max-height: 460px;
  overflow: auto;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
  color: var(--docs-code-text);
}
.tok-tag { color: var(--docs-code-tag); }
.tok-attr { color: var(--docs-code-attr); }
.tok-val { color: var(--docs-code-val); }
.tok-com { color: var(--docs-code-com); font-style: italic; }
.tok-num { color: var(--docs-code-num); }

/* ---- Reference tables & callouts ---- */
.docs-table { margin: 16px 0 24px; font-size: var(--md-sys-typescale-body-medium-size); }
.docs-table th { font-weight: 500; white-space: nowrap; }
.docs-table td:first-child { white-space: nowrap; }
.docs-table code { white-space: nowrap; }
/* phones: a wide reference table scrolls sideways instead of widening the page */
@media (max-width: 575.98px) { .docs-table { display: block; overflow-x: auto; } }
/* Narrow screens: tables scroll sideways instead of widening the page */
@media (max-width: 767.98px) {
  .docs-table { display: block; overflow-x: auto; }
}

.docs-callout {
  max-width: 760px;
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  background-color: var(--md-sys-color-surface-container);
  border-left: 4px solid var(--md-sys-color-primary);
  font-size: var(--md-sys-typescale-body-medium-size);
}
.docs-callout-warning { border-left-color: var(--md-sys-color-warning); }
.docs-callout > :last-child { margin-bottom: 0; }

.docs-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 16px 0; }
.docs-file { padding: 16px; border-radius: var(--md-sys-shape-corner-medium); background: var(--md-sys-color-surface-container-low); }
.docs-file code { font-weight: 500; }
.docs-file p { margin: 4px 0 0; font-size: var(--md-sys-typescale-body-small-size); color: var(--md-sys-color-on-surface-variant); }

/* ---- Media viewer demos ---- */
.docs-viewer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.docs-viewer-grid > a { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: var(--md-sys-shape-corner-medium); background-color: var(--md-sys-color-surface-container-highest); }
.docs-viewer-grid img { display: block; width: 100%; height: 100%; object-fit: cover; }
.docs-viewer-grid > a > * { transition: scale var(--md-motion-default-spatial); }
.docs-viewer-grid > a:hover > * { scale: 1.04; }
.docs-viewer-grid > a:focus-visible { outline: var(--md-focus-ring); outline-offset: 2px; }
.docs-viewer-play::after {
  content: "play_arrow";
  position: absolute;
  inset: 0;
  width: 48px;
  height: 48px;
  margin: auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(0 0 0 / .55);
  color: #fff;
  font-family: "Material Symbols Rounded";
  font-size: 28px;
}
.docs-viewer-tile { display: grid !important; color: var(--md-sys-color-on-surface); text-decoration: none; font-weight: 500; }
.docs-viewer-tile > span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.docs-viewer-tile .material-symbols-rounded { font-size: 32px; color: var(--md-sys-color-primary); }
