/* Lab: docs shell in the spirit of 23rd.dev/docs */

html:has(body.lab-page),
body.lab-page {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #080808;
}

body.lab-page > .preloader {
  display: none !important;
}

body.lab-page > .navbar,
body.lab-page .site-langs,
body.lab-page .alex-ai-widget {
  display: none !important;
}

body.lab-page .page-wrapper,
body.lab-page .main-wrapper {
  min-height: 0;
  height: 100%;
}

.lab-controls {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  inset-inline-start: max(0.75rem, env(safe-area-inset-left));
  z-index: 60;
  display: inline-flex;
  gap: 0.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.lab-page .lab-controls .back-button,
.lab-menu {
  position: static;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

body.lab-page .lab-controls .back-button:hover,
.lab-menu:hover,
.lab-menu[aria-expanded="true"] {
  background: transparent;
  color: #fff;
}

body.lab-page .lab-controls .back-button:active,
.lab-menu:active {
  transform: scale(0.96);
}

body.lab-page .lab-controls .back-button:focus-visible,
.lab-menu:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

body.lab-page .lab-controls .back-button__icon {
  width: 1.125rem;
  height: 1.125rem;
}

.lab-menu {
  display: none;
}

.lab-menu__icon {
  position: relative;
  display: block;
  width: 1.125rem;
  height: 1.125rem;
}

.lab-menu__icon span {
  position: absolute;
  top: 50%;
  left: 1px;
  width: 1rem;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 180ms ease;
}

.lab-menu__icon span:first-child {
  transform: translateY(-3px);
}

.lab-menu__icon span:last-child {
  transform: translateY(3px);
}

.lab-menu[aria-expanded="true"] .lab-menu__icon span:first-child {
  transform: rotate(45deg);
}

.lab-menu[aria-expanded="true"] .lab-menu__icon span:last-child {
  transform: rotate(-45deg);
}

.lab-shell {
  box-sizing: border-box;
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  left: 0.75rem;
  z-index: 1;
  display: flex;
  height: auto;
  padding: 0;
  gap: 0.75rem;
}

.lab-sidebar {
  flex: 0 0 13.5rem;
  width: 13.5rem;
  min-width: 13.5rem;
  padding: 5.25rem 0.75rem 1.5rem;
  overflow: auto;
  border-radius: 16px;
  background: #101010;
}

.lab-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: #101010;
}

.lab-nav {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.lab-nav__group {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.lab-nav__title {
  margin: 0 0 0.35rem 0.45rem;
  color: rgba(255, 255, 255, 0.34);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lab-nav__link {
  display: block;
  width: 100%;
  padding: 0.42rem 0.55rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.48);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.lab-nav__link:hover {
  color: rgba(255, 255, 255, 0.86);
}

.lab-nav__link.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.lab-nav__link:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.lab-main {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.lab-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #0c0c0b;
}

.lab-frame,
.lab-image {
  display: none;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0c0c0b;
}

.lab-frame {
  opacity: 0;
}

.lab-stage.is-frame .lab-frame,
.lab-stage.is-image .lab-image {
  display: block;
}

.lab-stage.is-frame.is-ready .lab-frame {
  opacity: 1;
}

.lab-image {
  object-fit: contain;
  padding: 0;
}

.lab-backdrop {
  display: none;
}

@media screen and (max-width: 900px) {
  .lab-controls {
    top: max(0.75rem, env(safe-area-inset-top));
    inset-inline-start: max(0.75rem, env(safe-area-inset-left));
  }

  .lab-shell {
    top: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    left: 0.5rem;
  }

  .lab-menu {
    display: inline-flex;
  }

  .lab-sidebar {
    position: fixed;
    top: 0.5rem;
    bottom: 0.5rem;
    inset-inline-start: 0.5rem;
    z-index: 40;
    flex: 0 0 0;
    width: min(18rem, calc(100vw - 1rem));
    min-width: min(18rem, calc(100vw - 1rem));
    padding: 5rem 0.85rem 1.5rem;
    border: 0;
    border-radius: 14px;
    background: #101010;
    transform: translateX(calc(-100% - 1rem));
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1);
  }

  .lab-shell.is-nav-open .lab-sidebar {
    transform: none;
  }

  .lab-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    border: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }

  .lab-shell.is-nav-open .lab-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.lab-page .lab-controls .back-button,
  .lab-menu,
  .lab-menu__icon span,
  .lab-sidebar,
  .lab-backdrop {
    transition: none;
  }
}
