/* ---------------------------------------------------------------
   Demo infrastructure — code blocks, component demos, syntax
   highlighting, and preview controls. Reusable across any site
   that showcases ln components.
   --------------------------------------------------------------- */

/* --- Syntax token definitions (mapped to ln semantic tokens) --- */
:root {
  background-color: var(--surface);
  overscroll-behavior-y: none;
  --syntax-keyword:     var(--primary-text);
  --syntax-string:      var(--success-text);
  --syntax-comment:     var(--c-muted);
  --syntax-function:    var(--info-text);
  --syntax-constant:    var(--warning-text);
  --syntax-operator:    var(--c-muted);
  --syntax-punctuation: var(--c-subtle);
  --syntax-tag:         var(--danger-text);
  --syntax-attribute:   var(--secondary-text);
}

[data-lastpass-icon-root] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    z-index: -1 !important;
}

/* --- Code block: highlighted code with line numbers, header, and language badge --- */

.code-block {
  position: relative;
  overflow: hidden;
  margin-bottom: var(--s4);
}

.code-block:last-child {
  margin-bottom: 0;
}

.code-block__header {
  display: flex;
  align-items: center;
  gap: var(--s1);
  padding: var(--s-h) var(--s2);
  background: color-mix(in srgb, var(--surface-raised) 80%, var(--surface));
  outline: 1px solid var(--border);
  outline-offset: -1px;
  font-family: var(--f-mono);
  font-size: var(--t-meta-s);
  line-height: var(--s2);
  color: var(--c-muted);
  letter-spacing: 0.02em;
}

.home-showcase__panel .code-block__header {
    display: none;
  background: transparent;
  outline: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: -1px;
}

.code-block__header > i {
  font-size: 0.875rem;
  flex: none;
  color: var(--c-subtle);
}

.code-block__lang {
  margin-left: auto;
  font-size: 0.6875rem;
  line-height: var(--s2);
  color: var(--c-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code-block__copy {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--c-subtle);
}

.code-block__copy:hover {
  color: var(--text);
}

.code-block__copy--copied {
  color: var(--secondary-text);
}

.code-block__copy--copied:hover {
  color: var(--secondary-text);
}

.code-block__copy > i {
  font-size: 0.875rem;
}

/* Override _code.scss's pre styles when inside .code-block */
.code-block__body {
  margin: 0;
  padding: var(--s1) 0;
  overflow: hidden;
  text-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 0.8125rem;
  line-height: 0;
  color: var(--text);
  tab-size: 2;
  counter-reset: line;
  background: transparent;
  border-radius: 0;
  margin-bottom: 0;
}

.code-block__body code {
  display: block;
  padding: 0;
  background: none;
  border-radius: 0;
  font-family: inherit;
  font-size: inherit;
}

.code-block__line {
  display: block;
  padding: 0 var(--s2) 0 2.5rem;
  position: relative;
  line-height: 1.5rem;
}

.code-block__line::before {
  content: counter(line);
  counter-increment: line;
  position: absolute;
  left: 0;
  width: 1.75rem;
  text-align: right;
  color: var(--c-disabled);
  font-variant-numeric: tabular-nums;
  user-select: none;
  pointer-events: none;
}

.code-block__line--highlight {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  box-shadow: inset 3px 0 0 var(--primary-text);
}

/* --- Component demo: code block + live preview grouped together --- */

.component-demo {
  outline: 1px solid var(--border);
  outline-offset: -1px;
  margin-bottom: var(--s4);
}

.component-demo:last-child {
  margin-bottom: 0;
}

.component-demo__preview {
  background: var(--surface);
  outline: 1px solid var(--border);
  outline-offset: -1px;
}

.component-demo__preview a:hover {
  text-decoration: none;
}

.component-demo__preview-inner {
  padding: var(--s3);
}

.component-demo__preview-sizer--full {
  width: 100%;
}

.component-demo__preview-sizer--narrow {
  max-width: 500px;
}

.component-demo__preview-sizer--xs {
  max-width: 320px;
}

.component-demo__preview-sizer--sm {
  max-width: 400px;
}

.component-demo .code-block {
  position: static;
  margin-bottom: 0;
  outline: 0;
}

/* --- Preview diagnostic toolbar --- */

.preview-diagnostic {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s1);
  padding: var(--s-h) var(--s1);
  background: var(--surface-raised);
  outline: 1px solid var(--border);
  outline-offset: -1px;
}

.preview-rhythm-check {
  display: flex;
  align-items: center;
  gap: var(--s1);
}

.preview-rhythm-check__label {
  font-family: var(--f-mono);
  font-size: var(--t-meta-s);
  line-height: var(--t-meta-lh);
  color: var(--c-muted);
  white-space: nowrap;
}

.preview-grid-toggle {
  display: inline-flex;
  color: var(--c-muted);
  cursor: pointer;
}

.preview-grid-toggle > i {
  font-size: 14px;
}

.preview-grid-toggle:hover {
  color: var(--text);
}

.preview-grid-toggle[aria-pressed="true"] {
  color: var(--primary-text);
}

/* --- Floating utility buttons: force circles --- */

.grid-toggle {
  border-radius: 50%;
}

.grid-toggle > i {
  font-size: 1rem;
}

/* --- Syntax token colors (scoped to .code-block to avoid polluting prose specimens) --- */

.code-block .hljs-keyword,
.code-block .hljs-selector-tag,
.code-block .hljs-built_in,
.code-block .hljs-type,
.code-block .hljs-meta .hljs-keyword {
  color: var(--syntax-keyword);
}

.code-block .hljs-string,
.code-block .hljs-regexp,
.code-block .hljs-addition,
.code-block .hljs-template-variable {
  color: var(--syntax-string);
}

.code-block .hljs-comment,
.code-block .hljs-doctag,
.code-block .hljs-quote {
  color: var(--syntax-comment);
  font-style: italic;
}

.code-block .hljs-title,
.code-block .hljs-title\.function_,
.code-block .hljs-section {
  color: var(--syntax-function);
}

.code-block .hljs-number,
.code-block .hljs-literal,
.code-block .hljs-variable\.constant_,
.code-block .hljs-symbol,
.code-block .hljs-link {
  color: var(--syntax-constant);
}

.code-block .hljs-operator,
.code-block .hljs-deletion {
  color: var(--syntax-operator);
}

.code-block .hljs-punctuation {
  color: var(--syntax-punctuation);
}

.code-block .hljs-tag,
.code-block .hljs-name {
  color: var(--syntax-tag);
}

.code-block .hljs-attr,
.code-block .hljs-attribute,
.code-block .hljs-property {
  color: var(--syntax-attribute);
}

.code-block .hljs-variable,
.code-block .hljs-params {
  color: var(--text);
}

.code-block .hljs-meta {
  color: var(--c-muted);
}

.code-block .hljs-emphasis { font-style: italic; }
.code-block .hljs-strong   { font-weight: 600; }

/* --- Scroll offset for navbar --- */

.docs-page-content h2[id],
.docs-page-content h3[id] {
  scroll-margin-top: calc(48px + var(--s3));
}

/* --- Section number indicators --- */

.docs-section-number {
  font-family: var(--f-mono);
  font-size: var(--t-meta-s);
  line-height: normal;
  vertical-align: baseline;
  color: var(--primary-text);
  margin-right: var(--s1);
}

/* --- Heading anchor links --- */

.docs-heading-anchor {
  color: var(--primary-text);
  text-decoration: none;
  margin-left: var(--s1);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--e-standard);
  font-size: 1.25rem;
  line-height: normal;
  vertical-align: baseline;
  font-family: var(--f-mono);
}

h2:hover > .docs-heading-anchor,
h3:hover > .docs-heading-anchor,
.docs-heading-anchor:focus {
  opacity: 1;
}

/* --- Placeholder blocks for demos (stands in for real images) --- */

.docs-placeholder {
  background-color: var(--border);
  width: 100%;
}

.docs-placeholder--4x3 {
  aspect-ratio: 4/3;
}

.docs-placeholder--square {
  aspect-ratio: 1;
}

.docs-placeholder--fill {
  height: 100%;
}

/* --- Gallery placeholder images --- */

.docs-gallery-img {
  width: 100%;
  aspect-ratio: 4/3;
  display: grid;
  place-items: center;
  font: 600 1.5rem/1 var(--f-ui);
  color: var(--c-subtle);
}

.docs-gallery-img--1 { background-color: color-mix(in srgb, var(--primary) 20%, var(--surface-sunken)); }
.docs-gallery-img--2 { background-color: color-mix(in srgb, var(--success) 20%, var(--surface-sunken)); }
.docs-gallery-img--3 { background-color: color-mix(in srgb, var(--warning) 20%, var(--surface-sunken)); }
/* ---------------------------------------------------------------
   Docs site layout — shell, navigation, cards, sections, and
   page-specific helpers. Styles unique to this documentation site.
   --------------------------------------------------------------- */

/* --- Docs shell layout --- */

.docs-shell {
    background-color: var(--surface);
}

.docs-shell,
.home-full-width {
  --container-wide: 1320px;
}

.docs-shell__header {
  position: sticky;
  top: 0;
  z-index: 100000;
  background: var(--surface);
  box-shadow: var(--sh4);
}

.docs-shell__header-inner {
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--s2);
  height: 4rem;
}

.docs-shell__body {
  max-width: var(--container-wide);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100svh - 48px);
}

.docs-shell__sidebar {
  overflow-y: hidden;
  padding-top: var(--s4);
  padding-bottom: var(--s4);
  position: sticky;
  top: 48px;
  height: calc(100svh - 48px);
}

.docs-shell__sidebar:hover {
  overflow-y: auto;
}

.docs-shell__main {
  margin-bottom: var(--s4);
  padding: var(--s4);
  min-width: 0;
}

@media (min-width: 768px) {
  .docs-page-content > article:has(> .docs-toc) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px;
    column-gap: var(--s4);
  }

  .docs-page-content > article > .docs-toc {
    grid-column: 2;
    grid-row: 1 / span 99;
  }
}

@media (max-width: 1024px) {
  .docs-shell__body {
    grid-template-columns: 1fr;
  }

  .docs-shell__sidebar {
    position: fixed;
    top: 4rem;
    bottom: 0;
    left: 0;
    width: 240px;
    z-index: 200;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--dur-base) var(--e-exit),
                visibility var(--dur-base) var(--e-exit);
    height: auto;
    border-right: none;
    background: var(--canvas);
  }

  .docs-shell[data-sidebar="open"] .docs-shell__sidebar {
    transform: translateX(0);
    visibility: visible;
    box-shadow: var(--sh4);
    transition: transform var(--dur-base) var(--e-enter),
                visibility var(--dur-base) var(--e-enter),
                box-shadow var(--dur-base) var(--e-enter);
  }

  .docs-shell[data-sidebar="open"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    z-index: 199;
  }
}

/* --- Right sidebar: on-this-page navigation --- */

.docs-toc {
  position: sticky;
  top: calc(48px + var(--s3));
  max-height: calc(100svh - 48px - var(--s4));
  overflow-y: hidden;
}

.docs-toc:hover {
  overflow-y: auto;
}

@media (max-width: 767px) {
  .docs-toc {
    position: static;
    max-height: none;
    margin-bottom: var(--s4);
    padding-bottom: var(--s4);
    box-shadow: inset 0 -1px 0 var(--border);
  }
}

.docs-toc__title {
  font-family: var(--f-mono);
  font-size: var(--t-meta-s);
  line-height: var(--t-meta-lh);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  margin-bottom: var(--s1);
}

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

.docs-toc__item {
  margin: 0;
}

.docs-toc__item--h3 {
  padding-left: var(--s2);
}

.docs-toc__link {
  display: block;
  font-size: var(--t-body-sm-s);
  line-height: 1.5rem;
  color: var(--c-muted);
  text-decoration: none;
  padding-left: var(--s2);
  border-left: 3px solid transparent;
  margin-left: -1px;
}

.docs-toc__link:hover {
  color: var(--text);
}

.docs-toc__link.is-active {
  color: var(--primary-text);
  font-weight: 500;
  border-left-color: var(--primary);
}

/* --- Side navigation --- */

.docs-sidenav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-sidenav-section {
  margin-bottom: var(--s3);
}

.docs-sidenav-group {
  display: block;
  font-size: var(--t-meta-s);
  line-height: var(--t-meta-lh);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  padding-left: var(--s4);
  padding-right: var(--s4);
  margin-bottom: var(--s1);
}

.docs-sidenav-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-sidenav-link {
  display: block;
  padding-left: var(--s4);
  padding-right: var(--s4);
  font-size: var(--t-body-sm-s);
  line-height: 1.5rem;
  color: var(--text);
  text-decoration: none;
}

.docs-sidenav-link:hover {
  color: var(--link);
}

.docs-sidenav-link--active {
  color: var(--primary);
}

/* --- Feature cards grid --- */

.docs-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s4);
}

.docs-card {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  border-radius: var(--r-md);
  padding: var(--s4);
}

.docs-card h3:first-child {
  margin-top: 0;
}

.docs-card p:last-child {
  margin-bottom: 0;
}

/* --- Component category cards (links) --- */

.docs-card-link {
  text-decoration: none;
  display: block;
}

/* --- Components overview grid (narrower min card than feature grid) --- */

.docs-components-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s4);
}

/* --- Muted description text inside a card --- */

.docs-card-description {
  margin-bottom: 0;
  color: var(--c-muted);
}

/* --- Sidebar toggle button (mobile only) --- */

.docs-sidebar-toggle {
  display: none;
  place-items: center;
  width: var(--s4);
  height: var(--s4);
  padding: 0;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
}

.docs-sidebar-toggle > i {
  font-size: 1rem;
}

.docs-sidebar-toggle:hover {
  color: var(--text);
  background: var(--surface-raised);
}

@media (max-width: 1024px) {
  .docs-sidebar-toggle {
    display: inline-grid;
  }
}

/* --- Site logo --- */

.docs-site-logo {
  display: inline-flex;
  text-decoration: none;
  margin-top: -4px;
}

.docs-site-logo__img {
  display: block;
  height: 1rem;
  width: auto;
}

.docs-site-logo__img--dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .docs-site-logo__img--light {
    display: none;
  }
  :root:not([data-theme="light"]) .docs-site-logo__img--dark {
    display: block;
  }
}

:root[data-theme="dark"] .docs-site-logo__img--light {
  display: none;
}

:root[data-theme="dark"] .docs-site-logo__img--dark {
  display: block;
}

/* --- Main nav links (desktop) --- */

.docs-shell__nav {
  display: flex;
  align-items: center;
  gap: var(--s-h);
}

.docs-shell__nav-link {
  font-family: var(--f-ui);
  font-size: var(--t-body-sm-s);
  line-height: var(--t-body-sm-lh);
  font-weight: 500;
  color: var(--c-muted);
  text-decoration: none;
  padding: var(--s1) var(--s2);
  transition: color var(--dur-fast) var(--e-standard);
}

.docs-shell__nav-link:hover {
  color: var(--text);
}

.docs-shell__nav-link.is-active {
  color: var(--text);
}

/* --- Header actions (search, GitHub, theme toggle) --- */

.docs-shell__actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-left: auto;
}

/* --- Search bar --- */

.docs-search {
  position: relative;
}

.docs-search__results {
  position: absolute;
  top: 100%;
  right: 0;
  width: 280px;
  max-height: 320px;
  overflow-y: auto;
  margin-top: var(--s1);
  padding: var(--s1) 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh3);
  list-style: none;
  z-index: 300;
}

.docs-search__result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s1) var(--s2);
  cursor: pointer;
  font-size: var(--t-body-sm-s);
  line-height: var(--t-body-sm-lh);
  color: var(--text);
}

.docs-search__result:hover,
.docs-search__result--active {
  background: var(--surface-raised);
}

.docs-search__result-group {
  font-size: var(--t-body-xs-s);
  color: var(--c-muted);
  margin-left: var(--s2);
  flex-shrink: 0;
}

.docs-search__empty {
  position: absolute;
  top: 100%;
  right: 0;
  width: 280px;
  margin-top: var(--s1);
  padding: var(--s3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh3);
  font-size: var(--t-body-sm-s);
  color: var(--c-muted);
  text-align: center;
  z-index: 300;
}

.docs-shell__github {
  display: inline-flex;
  align-items: center;
  color: var(--c-muted);
  text-decoration: none;
  transition: color var(--dur-fast) var(--e-standard);
}

.docs-shell__github:hover {
  color: var(--text);
}

.docs-shell__github > i {
  font-size: 1rem;
}

.docs-shell__theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--c-muted);
  font-size: 1rem;
  line-height: 1;
}

.docs-shell__theme-toggle > i {
  font-size: 1rem;
}

.docs-shell__theme-toggle:hover {
  color: var(--text);
}

/* --- Nav toggle button (mobile only, distinct from sidebar toggle) --- */

.docs-nav-toggle {
  display: none;
  place-items: center;
  width: var(--s4);
  height: var(--s4);
  padding: 0;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
}

.docs-nav-toggle > i {
  font-size: 1rem;
}

.docs-nav-toggle:hover {
  color: var(--text);
  background: var(--surface-raised);
}

/* --- Mobile nav panel (dropdown below header) --- */

.docs-shell__nav-panel {
  display: none;
}

@media (max-width: 1024px) {
  .docs-shell__nav {
    display: none;
  }

  .docs-search__input {
    width: 100%;
  }

  .docs-search {
    position: static;
  }

  .docs-search__results,
  .docs-search__empty {
    right: auto;
    left: var(--s1);
    width: calc(100% - var(--s1) * 2);
  }

  .docs-nav-toggle {
    display: inline-grid;
  }

  .docs-shell[data-nav="open"] .docs-shell__nav-panel {
    display: block;
    padding: var(--s2) 1.5rem var(--s3);
    border-top: 1px solid var(--border);
  }

  .docs-shell__nav-panel-link {
    display: block;
    padding: var(--s2) var(--s3);
    font-family: var(--f-ui);
    font-size: var(--t-body-sm-s);
    line-height: var(--t-body-sm-lh);
    font-weight: 500;
    color: var(--c-muted);
    text-decoration: none;
    border-radius: var(--r-md);
  }

  .docs-shell__nav-panel-link:hover {
    color: var(--text);
    background: var(--surface-raised);
  }

  .docs-shell__nav-panel-link.is-active {
    color: var(--text);
  }

  .docs-search--panel {
    margin-top: var(--s2);
  }

  .docs-search--panel .docs-search__input {
    width: 100%;
    height: 36px;
    font-size: var(--t-body-sm-s);
  }
}

/* --- Prose specimen wrapper --- */

.docs-section {
  padding-bottom: var(--s4);
  margin-bottom: var(--s4);
}

.docs-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  box-shadow: none;
}

.docs-prose-specimen {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  border-radius: var(--r-md);
  padding: var(--s4);
  margin-bottom: var(--s4);
}

.docs-prose-specimen:last-child {
  margin-bottom: 0;
}

/* --- Horizontal scroll container (tables, wide code) --- */

.docs-scroll-x {
  overflow-x: auto;
}

/* --- Font-role demo spans --- */

.docs-font-sample {
  display: block;
  font-size: 1rem;
  line-height: 1.5rem;
}

.docs-font-sample[data-font="prose"] {
  font-family: var(--f-prose);
}

.docs-font-sample[data-font="ui"] {
  font-family: var(--f-ui);
}

.docs-font-sample[data-font="mono"] {
  font-family: var(--f-mono);
}

/* --- Type scale table sample column --- */

.type-sample {
  display: block;
}

.type-sample[data-font="prose"] { font-family: var(--f-prose); }
.type-sample[data-font="ui"]    { font-family: var(--f-ui); }
.type-sample[data-font="mono"]  { font-family: var(--f-mono); }

.type-sample[data-token="display-1"]  { font-size: var(--t-display-1-s);  line-height: var(--t-display-1-lh); }
.type-sample[data-token="display-2"]  { font-size: var(--t-display-2-s);  line-height: var(--t-display-2-lh); }
.type-sample[data-token="h1"]         { font-size: var(--t-h1-s);         line-height: var(--t-h1-lh); }
.type-sample[data-token="h2"]         { font-size: var(--t-h2-s);         line-height: var(--t-h2-lh); }
.type-sample[data-token="h3"]         { font-size: var(--t-h3-s);         line-height: var(--t-h3-lh); }
.type-sample[data-token="h4"]         { font-size: var(--t-h4-s);         line-height: var(--t-h4-lh); }
.type-sample[data-token="h5"]         { font-size: var(--t-h5-s);         line-height: var(--t-h5-lh); }
.type-sample[data-token="h6"]         { font-size: var(--t-h6-s);         line-height: var(--t-h6-lh); }
.type-sample[data-token="lead"]       { font-size: var(--t-lead-s);       line-height: var(--t-lead-lh); }
.type-sample[data-token="body-prose"] { font-size: var(--t-body-prose-s); line-height: var(--t-body-prose-lh); }
.type-sample[data-token="body-lg"]    { font-size: var(--t-body-lg-s);    line-height: var(--t-body-lg-lh); }
.type-sample[data-token="body"]       { font-size: var(--t-body-s);       line-height: var(--t-body-lh); }
.type-sample[data-token="body-sm"]    { font-size: var(--t-body-sm-s);    line-height: var(--t-body-sm-lh); }
.type-sample[data-token="body-xs"]    { font-size: var(--t-body-xs-s);    line-height: var(--t-body-xs-lh); }
.type-sample[data-token="meta"]       { font-size: var(--t-meta-s);       line-height: var(--t-meta-lh); }
.type-sample[data-token="code"]       { font-size: var(--t-code-s);       line-height: var(--t-code-lh); }

/* --- Fixed button toolbar --- */

.docs-fixed-buttons {
  position: fixed;
  bottom: var(--s3);
  right: var(--s3);
  z-index: 10000;
  display: flex;
  gap: var(--s1);
  align-items: center;
}

.docs-fixed-buttons > .grid-toggle,
.docs-fixed-buttons > .toc-toggle,
.docs-fixed-buttons > .back-to-top {
  position: static;
  z-index: auto;
}

/* --- TOC toggle (desktop only) --- */

.toc-toggle {
  display: none;
}

@media (min-width: 768px) {
  .toc-toggle {
    display: inline-grid;
    place-items: center;
    width: var(--s4);
    height: var(--s4);
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--c-muted);
    cursor: pointer;
  }

  .toc-toggle > i {
    font-size: 1rem;
  }

  .toc-toggle:hover {
    color: var(--text);
    background: var(--surface-raised);
  }

  .toc-toggle[aria-pressed="true"] {
    color: var(--primary-text);
  }

  .hide-toc .docs-toc {
    display: none;
  }

  .hide-toc .docs-page-content > article:has(> .docs-toc) {
    grid-template-columns: 1fr;
  }
}

/* --- Back to top (mobile only) --- */

.back-to-top {
  display: none;
  place-items: center;
  width: var(--s4);
  height: var(--s4);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--c-muted);
  cursor: pointer;
}

.back-to-top > i {
  font-size: 1rem;
}

.back-to-top:hover {
  color: var(--text);
}

@media (max-width: 767px) {
  .back-to-top {
    display: inline-grid;
  }
}

/* --- Demo helpers --- */

.docs-height-container {
  height: 200px;
}

.docs-z-stack {
  position: relative;
  height: 120px;
}

.docs-z-stack__layer {
  position: absolute;
  width: 120px;
}

.docs-z-stack__layer--1 { top: 0; left: 0; }
.docs-z-stack__layer--2 { top: 16px; left: 40px; }
.docs-z-stack__layer--3 { top: 32px; left: 80px; }

/* --- Home page --- */

/* Hero background grid — decorative, low opacity, behind content */
.home-hero.show-grid::before {
  opacity: 0.35;
  z-index: 0;
}

.home-hero__inner {
    position: relative;
    z-index: 1;
}


/* 1. home-accent — purple accent color for highlighted words */
.home-accent {
  color: var(--primary-text);
}

/* 2. home-specimen — hero specimen panel container */
.home-specimen {
  overflow: hidden;
}

/* 3. home-specimen__header — specimen header bar */
.home-specimen__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s1) var(--s2) calc(var(--s1) - var(--bd1));
  font: var(--t-meta-s)/var(--t-meta-lh) var(--f-mono);
  color: var(--c-muted);
  border-bottom: var(--bd1) solid light-dark(color-mix(in srgb, var(--border) 90%, white), color-mix(in srgb, var(--border) 90%, black));
}

/* 4. home-specimen__body — specimen body with stacked components */
.home-specimen__body {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4);
}

/* 5. home-ticker — ticker band overflow/color handling */
.home-ticker {
  overflow: hidden;
  color: var(--on-primary);
  white-space: nowrap;
}

.home-principles {
    gap: 1px;
}

/* 6. home-principle__header — card eyebrow flex layout */
.home-principle__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
}

.home-principle__header code {
  background: none;
  font-size: 0.75rem;
}

/* 7. home-principle__number — purple number in card header */
.home-principle__number {
  font: 0.75rem/var(--t-body-sm-lh) var(--f-mono);
  font-weight: 600;
  color: var(--primary-text);
}

.home-principle__accent {
  margin-bottom: var(--s3);
}

.home-principle__header {
  margin-bottom: calc(-1 * var(--s-h));
}

/* 8. home-principle__accent — small purple dash at card bottom */
.home-principle__accent::after {
  content: "";
  display: block;
  width: var(--s3);
  height: 2px;
  margin-top: calc(var(--s3) - 2px);
  background: var(--primary);
}

/* Card eyebrow code — preserve original case */
.home-principle__eyebrow code {
  text-transform: none;
}

/* 9. home-showcase__panel — code showcase 2-col grid */
.home-showcase__panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 48rem) {
  .home-showcase__panel {
    grid-template-columns: 1fr;
  }
}

/* 10. home-showcase__preview — live preview area */
.home-showcase__preview {
  display: flex;
  align-items: flex-start;
  padding: 3rem;
  background: var(--surface);
  border-left: 1px solid var(--border);
}

.home-showcase__preview > * {
  width: 100%;
}

/* The code side needs flush code block — remove its border-radius and margin */
.home-showcase__panel .code-block {
  margin-bottom: 0;
  border-radius: 0;
}

/* 11. home-specimen-row — type specimen row */
.home-specimen-row {
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  padding: calc(var(--s2) - var(--bd1)) 0 var(--s2);
  border-top: var(--bd1) solid var(--border);
}

.home-specimen-row:first-child {
  border-top: none;
  padding-top: var(--s2);
}

/* 12. home-specimen-meta — measurement labels */
.home-specimen-meta {
  flex: 0 0 5rem;
  font: var(--t-meta-s)/var(--t-meta-lh) var(--f-mono);
  color: var(--c-muted);
  text-align: right;
}

/* 13. home-specimen-sample — sample text container */
.home-specimen-sample {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@layer base {
  .home-specimen-sample {
    line-height: var(--t-body-lh);
  }
}

/* home-stats__item — vertical border between stats */
.home-stats__item {
  border-left: var(--bd1) solid var(--border);
  padding-left: var(--s3);
}

/* Stat values — larger on home page */
.home-stats__value {
  font-size: var(--t-h1-s);
  line-height: var(--t-h1-lh);
}

/* home-install — install command bar */
.home-install {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s2);
  background: var(--surface-sunken);
  outline: var(--bd1) solid var(--border);
  outline-offset: calc(-1 * var(--bd1));
  font: var(--t-body-sm-s)/var(--t-body-sm-lh) var(--f-mono);
  color: var(--c-muted);
  max-width: max-content;
}

.home-install__prompt {
  color: var(--c-subtle);
  user-select: none;
}

.home-install__command {
  flex: 1;
  color: var(--text);
}

/* Responsive: scale display text on small screens */
@media (max-width: 48rem) {
  .text-display-1 {
    font-size: var(--t-display-2-s);
    line-height: var(--t-display-2-lh);
  }
  .text-display-2 {
    font-size: var(--t-h1-s);
    line-height: var(--t-h1-lh);
  }

  .home-specimen-meta {
    flex: 0 0 4rem;
    font-size: 0.625rem;
  }

  .home-stats__item {
    border-left: none;
    padding-left: 0;
  }

  .home-stats__value {
    font-size: var(--t-h2-s);
    line-height: var(--t-h2-lh);
  }
}

.docs-docs .docs-footer {
  border-top: 1px solid var(--border);
  margin-top: -1px;
}

/* Site footer padding */
.docs-footer__inner {
  padding: var(--s4) var(--gutter);
}

/* Baseline toggle dot and color states */
.home-baseline-toggle__dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.home-baseline-toggle {
  --_text: var(--primary-text) !important;
  border-color: var(--primary-border) !important;
  color: var(--primary-text) !important;
  width: 120px;
  justify-content: start;
  z-index: 99999;
}

.home-baseline-toggle--on {
  --_text: var(--secondary-text) !important;
  border-color: var(--secondary-border) !important;
  color: var(--secondary-text) !important;
}

/* --- 404 page --- */

.docs-not-found {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: calc(100vh - 4rem);
  padding: var(--s6) var(--s3);
}

/* --- About page --- */

.about-page__rule {
  width: 5rem;
  height: 2px;
  background: var(--primary);
  margin-top: var(--s3);
}

.about-page__body {
  margin-top: var(--s4);
}

.about-page__body p + p {
  margin-top: var(--s3);
}

/* --- Section index pages --- */

.docs-index-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-index-list li {
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--border);
}

.docs-index-list li:first-child {
  border-top: 1px solid var(--border);
}

.docs-index-list a {
  font-weight: var(--fw-semibold);
  font-size: var(--t-body-lg-s);
  line-height: var(--t-body-lg-lh);
}

.docs-index-list span {
  display: block;
  color: var(--c-muted);
  margin-top: calc(var(--s1) / 2);
}

