/**
 * Across UI Docs - Documentation Site Stylesheet
 * Documentation shell wrapper and component spec styling.
 * Production sidebar layout is in across-core.css (.app-sidebar)
 * 
 * @version 2.0.0
 */

/* ============================================
   1. DOCS SHELL LAYOUT
   (Documentation-specific wrapper, not for production apps)
   ============================================ */

.shell {
  min-height: 100vh;
}

.shell-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-bottom: var(--hairline) solid var(--border-dim);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
}

.shell-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1440px;
  padding: 0 var(--space-5);
}

.shell-body {
  max-width: 1440px;
  margin: 0 auto;
  padding-top: 64px; /* Account for fixed header */
  padding-left: 260px; /* Account for fixed sidebar */
  min-height: calc(100vh - 64px);
}

@media (max-width: 768px) {
  .shell-body {
    padding-left: 0; /* No sidebar on mobile */
  }
}

@media (max-width: 480px) {
  .shell-header {
    height: 56px;
  }
  
  .shell-body {
    padding-top: 56px;
    min-height: calc(100vh - 56px);
  }
}


/* ============================================
   2. HEADER COMPONENTS
   ============================================ */

@media (max-width: 480px) {
  .shell-header {
    height: 56px;
  }
}

.shell-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.shell-header__logo {
  display: flex;
  align-items: center;
  height: 28px;
}

.shell-header__logo img {
  height: 28px;
  width: auto;
}

.shell-header__divider {
  width: var(--hairline);
  height: 24px;
  background: var(--border-dim);
}

.shell-header__title {
  font-size: var(--text-nav);
  font-weight: 500;
  color: var(--text-muted);
}

.shell-header__center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 400px;
  margin: 0 var(--space-5);
}

.shell-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Mobile search button - hidden on desktop */
.mobile-search-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--border-subtle);
  border: var(--hairline) solid var(--border-dim);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 18px;
  transition: var(--transition-fast);
}

.mobile-search-btn:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}


/* ============================================
   3. SEARCH
   ============================================ */

.search-container {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  width: 100%;
  background: var(--border-subtle);
  border: var(--hairline) solid var(--border-dim);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: var(--transition-fast);
}

.search-trigger:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--wing-energy);
}

.search-trigger__icon {
  font-size: 16px;
  opacity: 0.6;
  flex-shrink: 0;
}

.search-trigger__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: var(--text-sm);
  color: var(--text-main);
  min-width: 0;
}

.search-trigger__input::placeholder {
  color: var(--text-secondary);
}

.search-trigger__kbd {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 2px 6px;
  background: var(--surface);
  border: var(--hairline) solid var(--border-dim);
  border-radius: 4px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  background: var(--surface-overlay);
  border: var(--hairline) solid var(--border-dim);
  border-radius: 12px;
  max-height: 400px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition-fast);
  z-index: 1000;
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.search-container.is-open .search-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.search-dropdown__results {
  max-height: 320px;
  overflow-y: auto;
  padding: var(--space-2);
}

.search-dropdown__results::-webkit-scrollbar {
  width: 6px;
}

.search-dropdown__results::-webkit-scrollbar-track {
  background: transparent;
}

.search-dropdown__results::-webkit-scrollbar-thumb {
  background: var(--border-dim);
  border-radius: 3px;
}

.search-dropdown__group {
  margin-bottom: var(--space-2);
}

.search-dropdown__group-label {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.search-dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.search-dropdown__item:hover,
.search-dropdown__item.is-focused {
  background: var(--surface-hover);
}

.search-dropdown__item-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-subtle);
  border-radius: 8px;
  font-size: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.search-dropdown__item.is-focused .search-dropdown__item-icon {
  background: var(--brand);
  color: var(--obsidian);
}

.search-dropdown__item-content {
  flex: 1;
  min-width: 0;
}

.search-dropdown__item-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-main);
}

.search-dropdown__item-name strong {
  color: var(--brand);
}

.search-dropdown__item-desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-dropdown__footer {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-top: var(--hairline) solid var(--border-dim);
  background: var(--surface-elevated);
}

.search-dropdown__hint {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.search-dropdown__hint kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 4px;
  background: var(--border-subtle);
  border-radius: 3px;
}

.search-dropdown__empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-secondary);
}

.search-dropdown__empty-icon {
  font-size: 32px;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

/* Mobile: Hide dropdown, use modal instead */
@media (max-width: 640px) {
  .search-container {
    max-width: none;
  }
  
  .search-trigger {
    width: 40px;
    padding: var(--space-2);
    justify-content: center;
    cursor: pointer;
  }
  
  .search-trigger__input,
  .search-trigger__kbd {
    display: none;
  }
  
  .search-dropdown {
    display: none;
  }
}


/* ============================================
   4. SUITE SWITCHER
   ============================================ */

.suite-switcher {
  position: relative;
}

.suite-switcher__trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 8px;
  transition: var(--transition-fast);
}

.suite-switcher__trigger:hover {
  background: var(--border-subtle);
  color: var(--text-main);
}

.suite-switcher__chevron {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.suite-switcher.is-open .suite-switcher__chevron {
  transform: rotate(180deg);
}

.suite-switcher__menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  min-width: 220px;
  background: var(--surface-overlay);
  border: var(--hairline) solid var(--border-dim);
  border-radius: 12px;
  padding: var(--space-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition-fast);
  z-index: 1000;
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
}

.suite-switcher.is-open .suite-switcher__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.suite-switcher__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: 8px;
  transition: var(--transition-fast);
}

.suite-switcher__item:hover {
  background: var(--border-subtle);
}

.suite-switcher__icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 16px;
}

.suite-switcher__icon--work {
  background: rgba(34, 197, 94, 0.15);
  color: var(--work);
}

.suite-switcher__icon--look {
  background: rgba(21, 137, 255, 0.15);
  color: var(--look);
}

.suite-switcher__icon--share {
  background: rgba(255, 94, 0, 0.15);
  color: var(--share);
}

.suite-switcher__details {
  flex: 1;
}

.suite-switcher__name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-main);
}

.suite-switcher__desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}


/* ============================================
   5. DOCS SIDEBAR
   (Documentation navigation - uses Wing mechanics)
   ============================================ */

.shell-sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  width: 260px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: var(--space-5);
  border-right: var(--hairline) solid var(--border-dim);
  background: var(--surface);
  z-index: 50;
}

.shell-sidebar::-webkit-scrollbar {
  width: 6px;
}

.shell-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.shell-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-dim);
  border-radius: 3px;
}

.sidebar-nav__section {
  margin-bottom: var(--space-5);
}

.sidebar-nav__label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
  padding-left: var(--space-3);
}

.sidebar-nav__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Wing mechanics on nav links */
.sidebar-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-nav);
  color: var(--text-muted);
  border-radius: var(--curve-static);
  transition: var(--transition-mech);
  position: relative;
  overflow: hidden;
}

/* Racing bar */
.sidebar-nav__link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--teal));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1;
}

.sidebar-nav__link:hover,
.sidebar-nav__link:focus-visible {
  background: var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--curve-flight);
  box-shadow: -4px 0 20px var(--wing-glow);
}

.sidebar-nav__link:hover::before,
.sidebar-nav__link:focus-visible::before {
  transform: scaleX(1);
}

.sidebar-nav__link.is-active {
  background: var(--wing-energy);
  color: var(--brand);
  border-radius: var(--curve-flight);
}

.sidebar-nav__link.is-active::before {
  transform: scaleX(1);
}

.sidebar-nav__link-icon {
  width: 18px;
  font-size: 16px;
  opacity: 0.7;
}

/* Coming Soon state */
.sidebar-nav__link.is-coming-soon {
  opacity: 0.5;
  pointer-events: none;
}

.sidebar-nav__soon {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--surface-hover);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}


/* ============================================
   6. STAGE (Main Content)
   ============================================ */

.shell-stage {
  grid-area: stage;
  padding: var(--space-8);
  max-width: 900px;
}

@media (max-width: 768px) {
  .shell-stage {
    padding: var(--space-5);
  }
}

.stage-header {
  margin-bottom: var(--space-8);
}

.stage-header__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  margin-bottom: var(--space-3);
}

.stage-header__title {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
}

.stage-header__desc {
  font-size: var(--text-md);
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.6;
}


/* ============================================
   7. COMPONENT SPEC
   ============================================ */

.component-spec {
  margin-bottom: var(--space-10);
  scroll-margin-top: 80px;
}

.component-spec__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: var(--hairline) solid var(--border-dim);
}

.component-spec__title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-main);
}

.component-spec__badges {
  display: flex;
  gap: var(--space-2);
}

.component-spec__desc {
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: var(--space-5);
}

/* Preview Box */
.component-spec__preview {
  background: var(--surface);
  border: var(--hairline) solid var(--border-dim);
  border-radius: 12px 12px 0 0;
  padding: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  position: relative;
}

/* Grid overlay for preview */
.component-spec__preview::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 8px 8px;
  pointer-events: none;
  opacity: 0.5;
  border-radius: 12px 12px 0 0;
}

.component-spec__preview-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  width: 100%; /* Ensure preview content takes full width */
}

/* Placeholder preview for coming soon components */
.component-spec__preview--placeholder {
  flex-direction: column;
  gap: var(--space-3);
  min-height: 120px;
  background: var(--surface-dim);
  border-style: dashed;
}

.component-spec__preview--placeholder::before {
  display: none;
}

.component-spec__preview--placeholder i {
  font-size: 32px;
  color: var(--text-tertiary);
}

.component-spec__preview--placeholder span {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
}

/* Preview layout utilities */
.preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-start;
}

.preview-grid--stack {
  flex-direction: column;
  align-items: stretch;
}

.preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-start;
}

.preview-row > * {
  flex: 1;
  min-width: 150px;
}

/* Coming soon section styling */
.component-spec--coming-soon {
  opacity: 0.6;
}

.component-spec--coming-soon:hover {
  opacity: 0.8;
}

/* Usage Section */
.component-spec__usage {
  background: var(--surface-elevated);
  border: var(--hairline) solid var(--border-dim);
  border-top: none;
  padding: var(--space-5);
}

.component-spec__usage-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.component-spec__usage-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.7;
}

/* Code Block */
.component-spec__code {
  background: #0d0d10;
  border: var(--hairline) solid var(--border-dim);
  border-top: none;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

/* Light theme override for code block background */
body.light-theme .component-spec__code,
.light-theme .component-spec__code {
  background: #1e1e24;
}

@media (prefers-color-scheme: light) {
  body:not(.dark-theme) .component-spec__code {
    background: #1e1e24;
  }
}

.component-spec__code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: var(--hairline) solid var(--border-dim);
}

.component-spec__code-lang {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.component-spec__code-copy {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  border-radius: 4px;
  transition: var(--transition-fast);
}

.component-spec__code-copy:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.component-spec__code-copy.is-copied {
  color: var(--work);
}

.component-spec__code-body {
  padding: var(--space-4);
  overflow-x: auto;
}

.component-spec__code-body pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: #e8eaee;
}

.component-spec__code-body code {
  display: block;
  white-space: pre;
}


/* ============================================
   8. SPOTLIGHT SEARCH
   ============================================ */

.spotlight {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px var(--space-4) var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-fast);
  z-index: 9999;
}

@media (max-width: 768px) {
  .spotlight {
    padding-top: 72px; /* Just below header */
  }
  
  .spotlight__panel {
    max-width: 100%;
    max-height: calc(100vh - 88px);
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .spotlight {
    padding: 64px var(--space-3) var(--space-3);
  }
  
  .spotlight__panel {
    border-radius: 8px;
  }
}

.spotlight.is-open {
  opacity: 1;
  visibility: visible;
}

.spotlight__panel {
  background: var(--surface-overlay);
  border: var(--hairline) solid var(--border-dim);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  overflow: hidden;
  transform: translateY(-16px) scale(0.98);
  transition: var(--transition-mech);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
}

.spotlight.is-open .spotlight__panel {
  transform: translateY(0) scale(1);
}

.spotlight__input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--hairline) solid var(--border-dim);
}

.spotlight__input-icon {
  font-size: 20px;
  color: var(--text-secondary);
}

.spotlight__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: var(--text-md);
  color: var(--text-main);
}

.spotlight__input::placeholder {
  color: var(--text-secondary);
}

.spotlight__input-clear {
  padding: var(--space-1);
  color: var(--text-secondary);
  border-radius: 4px;
  transition: var(--transition-fast);
  opacity: 0;
  visibility: hidden;
}

.spotlight__input-clear.is-visible {
  opacity: 1;
  visibility: visible;
}

.spotlight__input-clear:hover {
  background: var(--border-subtle);
  color: var(--text-muted);
}

.spotlight__results {
  max-height: calc(70vh - 72px);
  overflow-y: auto;
  padding: var(--space-2);
}

.spotlight__results::-webkit-scrollbar {
  width: 6px;
}

.spotlight__results::-webkit-scrollbar-track {
  background: transparent;
}

.spotlight__results::-webkit-scrollbar-thumb {
  background: var(--border-dim);
  border-radius: 3px;
}

.spotlight__group {
  margin-bottom: var(--space-3);
}

.spotlight__group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
}

.spotlight__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.spotlight__item:hover,
.spotlight__item.is-focused {
  background: var(--border-subtle);
}

.spotlight__item.is-focused {
  background: var(--wing-energy);
}

.spotlight__item-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--border-subtle);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.spotlight__item.is-focused .spotlight__item-icon {
  background: var(--brand-dim);
  color: var(--brand);
}

.spotlight__item-content {
  flex: 1;
}

.spotlight__item-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-main);
}

.spotlight__item-desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.spotlight__item-kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 2px 6px;
  background: var(--surface);
  border: var(--hairline) solid var(--border-dim);
  border-radius: 4px;
  color: var(--text-secondary);
}

.spotlight__empty {
  padding: var(--space-8);
  text-align: center;
}

.spotlight__empty-icon {
  font-size: 32px;
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.spotlight__empty-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.spotlight__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: var(--hairline) solid var(--border-dim);
  background: rgba(255, 255, 255, 0.02);
}

.spotlight__footer-hint {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.spotlight__footer-key {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.spotlight__footer-key kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  background: var(--surface);
  border: var(--hairline) solid var(--border-dim);
  border-radius: 3px;
}


/* ============================================
   9. MOBILE MENU TOGGLE
   ============================================ */

.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 8px;
  transition: var(--transition-fast);
}

.mobile-menu-toggle:hover {
  background: var(--border-subtle);
  color: var(--text-main);
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }
}


/* ============================================
   10. TOKENS DISPLAY
   ============================================ */

.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.token-swatch {
  display: flex;
  flex-direction: column;
  border: var(--hairline) solid var(--border-dim);
  border-radius: 8px;
  overflow: hidden;
}

.token-swatch__color {
  height: 48px;
}

.token-swatch__info {
  padding: var(--space-2);
  background: var(--surface);
}

.token-swatch__name {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 2px;
}

.token-swatch__value {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

/* Spacing scale */
.spacing-scale {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.spacing-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.spacing-item__bar {
  height: 8px;
  background: var(--brand);
  border-radius: 2px;
}

.spacing-item__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  min-width: 80px;
}

/* Type scale */
.type-scale {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.type-sample {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: var(--hairline) solid var(--border-dim);
}

.type-sample:last-child {
  border-bottom: none;
}

.type-sample__text {
  flex: 1;
  color: var(--text-main);
}

.type-sample__meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}


/* ============================================
   11. MOBILE RESPONSIVE FIXES
   ============================================ */

/* Header tablet adjustments (768px) */
@media (max-width: 768px) {
  .shell-header__inner {
    padding: 0 var(--space-4);
  }
  
  /* Hide inline search on tablet/mobile - use spotlight instead */
  .shell-header__center {
    flex: 0;
    margin: 0;
    max-width: none;
  }
  
  .search-container {
    display: none;
  }
  
  /* Show mobile search button */
  .mobile-search-btn {
    display: flex;
  }
}

/* Header mobile adjustments (640px) */
@media (max-width: 640px) {
  .shell-header__inner {
    padding: 0 var(--space-3);
  }
  
  .shell-header__left {
    gap: var(--space-2);
  }
  
  .shell-header__logo img {
    height: 22px;
  }
  
  .shell-header__divider,
  .shell-header__title {
    display: none;
  }
  
  .shell-header__right {
    gap: var(--space-2);
  }
}

/* Header small mobile (480px) */
@media (max-width: 480px) {
  .shell-header {
    height: 56px;
  }
  
  .shell-header__inner {
    padding: 0 var(--space-2);
  }
  
  .shell-header__left {
    gap: var(--space-2);
    min-width: 0;
    flex-shrink: 0;
  }
  
  .shell-header__logo img {
    height: 20px;
  }
  
  /* Hide suite switcher text on small mobile */
  .suite-switcher__trigger span {
    display: none;
  }
  
  .suite-switcher__trigger {
    padding: var(--space-1) var(--space-2);
  }
  
  .suite-switcher__chevron {
    margin: 0;
  }
  
  .mobile-menu-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
  }
  
  .mobile-search-btn {
    width: 36px;
    height: 36px;
  }
  
  .shell-header__right {
    gap: var(--space-1);
    flex-shrink: 0;
  }
  
  /* Compact theme switcher - single letter abbreviations */
  .across-theme-switcher {
    padding: 2px;
    gap: 1px;
  }
  
  .across-theme-switcher__btn {
    padding: var(--space-1);
    min-width: 28px;
    text-align: center;
    font-size: 11px;
  }
  
  /* Show only first letter on small mobile */
  .across-theme-switcher__btn {
    font-size: 0;
  }
  
  .across-theme-switcher__btn::first-letter {
    font-size: 11px;
  }
  
  .across-theme-switcher__btn[data-theme-value="light"]::after {
    content: "L";
    font-size: 11px;
    font-weight: 500;
  }
  
  .across-theme-switcher__btn[data-theme-value="dark"]::after {
    content: "D";
    font-size: 11px;
    font-weight: 500;
  }
  
  .across-theme-switcher__btn[data-theme-value="system"]::after {
    content: "S";
    font-size: 11px;
    font-weight: 500;
  }
}

/* Sidebar mobile overlay */
@media (max-width: 768px) {
  .shell-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 280px;
    height: calc(100vh - 64px);
    z-index: var(--z-overlay);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    display: block;
  }
  
  .shell-sidebar.is-open {
    transform: translateX(0);
  }
}

@media (max-width: 480px) {
  .shell-sidebar {
    top: 56px;
    height: calc(100vh - 56px);
    width: 260px;
  }
  
  .sidebar-backdrop {
    top: 56px;
  }
}

/* Stage content mobile */
@media (max-width: 768px) {
  .shell-stage {
    padding: var(--space-4);
  }
  
  .stage-header {
    margin-bottom: var(--space-5);
  }
  
  .stage-header__title {
    font-size: var(--text-xl);
  }
  
  .stage-header__desc {
    font-size: var(--text-base);
  }
}

/* Component spec mobile */
@media (max-width: 768px) {
  .component-spec {
    scroll-margin-top: 80px;
  }
  
  .component-spec__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  
  .component-spec__title {
    font-size: var(--text-lg);
  }
  
  .component-spec__badges {
    flex-wrap: wrap;
  }
}

/* Preview boxes mobile */
@media (max-width: 640px) {
  .component-spec__preview {
    padding: var(--space-4);
    min-height: 120px;
  }
  
  .component-spec__preview-content {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: var(--space-3);
  }
}

/* Code blocks mobile */
@media (max-width: 640px) {
  .component-spec__code-body {
    font-size: 11px;
  }
  
  .component-spec__code-body pre {
    padding: var(--space-3);
  }
}

/* Usage sections mobile */
@media (max-width: 640px) {
  .component-spec__usage {
    padding: var(--space-4);
  }
  
  .component-spec__usage-text code {
    font-size: 10px;
  }
}

/* Token grid mobile */
@media (max-width: 480px) {
  .token-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .token-swatch__color {
    height: 40px;
  }
}

/* Type scale mobile */
@media (max-width: 640px) {
  .type-sample {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}

/* Spacing scale mobile */
@media (max-width: 480px) {
  .spacing-item {
    gap: var(--space-2);
  }
  
  .spacing-item__label {
    min-width: 60px;
    font-size: 10px;
  }
}

/* Spotlight mobile */
@media (max-width: 640px) {
  .spotlight__panel {
    width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
    margin: 80px 16px;
  }
  
  .spotlight__input {
    font-size: 16px; /* Prevents iOS zoom */
  }
}

/* Suite switcher mobile */
@media (max-width: 640px) {
  .suite-switcher__menu {
    right: -60px;
    min-width: 200px;
  }
}

/* Coming soon sections mobile */
@media (max-width: 640px) {
  .component-spec__preview--placeholder {
    min-height: 80px;
  }
  
  .component-spec__preview--placeholder i {
    font-size: 24px;
  }
}

/* Ensure mobile menu toggle is visible */
.mobile-menu-toggle {
  display: none;
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }
}

/* Sidebar backdrop for mobile */
.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    top: 64px;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-overlay) - 1);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .sidebar-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
  }
}


/* ============================================
   12. ADDITIONAL MOBILE FIXES
   ============================================ */

/* Force no horizontal overflow */
html, body {
  overflow-x: hidden;
}

.shell {
  overflow-x: hidden;
}

.shell-stage {
  overflow-x: hidden;
  width: 100%;
  min-width: 0;
}

/* Token grid - force 2 columns on mobile */
@media (max-width: 640px) {
  .token-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }
  
  .token-swatch {
    min-width: 0;
  }
  
  .token-swatch__color {
    height: 56px;
  }
  
  .token-swatch__info {
    padding: var(--space-2);
  }
  
  .token-swatch__name {
    font-size: 11px;
    word-break: break-word;
  }
  
  .token-swatch__value {
    font-size: 9px;
    word-break: break-all;
  }
}

/* Stage padding on small screens */
@media (max-width: 480px) {
  .shell-stage {
    padding: var(--space-3);
  }
  
  .stage-header {
    margin-bottom: var(--space-4);
  }
  
  .stage-header__title {
    font-size: var(--text-xl);
  }
  
  .stage-header__desc {
    font-size: var(--text-sm);
  }
}

/* Component spec full width on mobile */
@media (max-width: 640px) {
  .component-spec {
    margin-bottom: var(--space-6);
  }
  
  .component-spec__header {
    margin-bottom: var(--space-3);
  }
  
  .component-spec__title {
    font-size: var(--text-md);
  }
  
  .component-spec__desc {
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
  }
}

/* Preview content should not overflow */
.component-spec__preview {
  overflow: hidden;
}

.component-spec__preview-content {
  max-width: 100%;
  overflow: hidden;
}

/* Code blocks horizontal scroll */
.component-spec__code-body {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.component-spec__code-body pre {
  min-width: 0;
}

.component-spec__code-body code {
  white-space: pre;
  word-break: normal;
}

/* Header mobile improvements */
@media (max-width: 480px) {
  .shell-header {
    padding: 0 var(--space-2);
    height: 56px;
  }
  
  .shell-header__logo img {
    height: 20px;
  }
  
  .suite-switcher__trigger {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
  }
  
  .suite-switcher__trigger i:last-child {
    display: none;
  }
}

/* Search trigger mobile */
@media (max-width: 480px) {
  .search-trigger {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    justify-content: center;
  }
}

/* Spacing scale mobile fix */
@media (max-width: 640px) {
  .spacing-scale {
    overflow-x: auto;
  }
  
  .spacing-item {
    min-width: max-content;
  }
  
  .spacing-item__bar {
    flex-shrink: 0;
  }
}

/* Button previews stack on mobile */
@media (max-width: 480px) {
  .component-spec__preview-content {
    gap: var(--space-2);
  }
  
  .component-spec__preview .across-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Embedded sidebar preview - constrain size */
@media (max-width: 640px) {
  .component-spec__preview .app-sidebar {
    width: 100%;
    max-width: 240px;
    font-size: 12px;
  }
}

/* Wing demo cards stack */
@media (max-width: 480px) {
  .component-spec__preview .across-card {
    width: 100%;
  }
}

/* Badges wrap properly */
.component-spec__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Input fields full width in preview */
@media (max-width: 480px) {
  .component-spec__preview .across-input {
    width: 100%;
  }
}
