/* Shared demo shell layout with desktop sidebar + mobile flyout */
:root {
  --demo-shell-nav-width: 230px;
}

body[data-demo-shell] {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg, #01060F);
  color: var(--text, #E2E8F0);
  min-height: 100vh;
  /* Header height set to 64px to match the design spec for consistent spacing and alignment with navigation elements */
  --demo-header-height: 64px;
}

body[data-demo-shell] .demo-shell {
  display: grid;
  grid-template-columns: var(--demo-shell-nav-width) 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

body[data-demo-shell] nav[data-standard-nav] {
  width: var(--demo-shell-nav-width);
  padding: 1.75rem 1.25rem;
  background: rgba(2, 8, 23, 0.85);
  border-right: 1px solid var(--border, rgba(148, 163, 184, 0.22));
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  backdrop-filter: blur(22px);
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(2, 6, 23, 0.45);
}

body[data-demo-shell] nav[data-standard-nav] .logo {
  font-weight: 700;
  color: #ffffff;
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

body[data-demo-shell] nav[data-standard-nav] a {
  display: block;
  padding: 0.7rem 0.95rem;
  border-radius: 0.75rem;
  text-decoration: none;
  color: var(--muted, rgba(148, 163, 184, 0.92));
  font-weight: 500;
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

body[data-demo-shell] nav[data-standard-nav] a:hover,
body[data-demo-shell] nav[data-standard-nav] a.active {
  background: rgba(56, 189, 248, 0.16);
  color: #ffffff;
  transform: translateX(4px);
}

body[data-demo-shell] nav[data-standard-nav] .nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--qm-subtle, #94A3B8);
  font-weight: 600;
  padding: 0 0.95rem 0.5rem;
  opacity: 0.85;
}

body[data-demo-shell] nav[data-standard-nav] .demo-exit {
  margin-top: auto;
  margin-bottom: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 0.95rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 8, 23, 0.72);
  color: rgba(226, 232, 240, 0.92);
  font-weight: 600;
  text-decoration: none;
  transition: border 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

body[data-demo-shell] nav[data-standard-nav] .demo-exit:hover,
body[data-demo-shell] nav[data-standard-nav] .demo-exit:focus-visible {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.18);
  color: #ffffff;
  transform: translateX(3px);
  box-shadow: 0 14px 32px rgba(56, 189, 248, 0.25);
  outline: none;
}

body[data-demo-shell] .demo-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 90;
  padding: 0.85rem 1.2rem;
  background: rgba(4, 12, 28, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 18px 42px rgba(2, 6, 23, 0.35);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

body[data-demo-shell] .demo-header .demo-nav-toggle {
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.75);
  color: #E2E8F0;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

body[data-demo-shell] .demo-header .demo-nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

body[data-demo-shell][data-demo-nav-open="true"] .demo-header .demo-nav-toggle span:nth-of-type(1) {
  transform: translateY(7px) rotate(45deg);
}

body[data-demo-shell][data-demo-nav-open="true"] .demo-header .demo-nav-toggle span:nth-of-type(2) {
  opacity: 0;
}

body[data-demo-shell][data-demo-nav-open="true"] .demo-header .demo-nav-toggle span:nth-of-type(3) {
  transform: translateY(-7px) rotate(-45deg);
}

body[data-demo-shell] .demo-header .demo-nav-toggle:hover,
body[data-demo-shell] .demo-header .demo-nav-toggle:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.45);
  border-color: rgba(56, 189, 248, 0.6);
  outline: none;
}

body[data-demo-shell] .demo-header .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body[data-demo-shell] .demo-header .demo-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #E0F2FE;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

body[data-demo-shell] .demo-header .demo-brand::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #38BDF8, #1D4ED8);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
}

body[data-demo-shell] .demo-header .demo-exit-shortcut {
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(15, 23, 42, 0.65);
  color: #CFFAFE;
  text-decoration: none;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

body[data-demo-shell] .demo-header .demo-exit-shortcut::after {
  content: '↗';
  font-size: 0.85rem;
}

body[data-demo-shell] .demo-header .demo-exit-shortcut:hover,
body[data-demo-shell] .demo-header .demo-exit-shortcut:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(56, 189, 248, 0.35);
  border-color: rgba(56, 189, 248, 0.45);
  outline: none;
}

body[data-demo-shell] .demo-main {
  padding: 2.4rem 3rem 3.5rem;
  overflow-x: hidden;
  min-height: 100vh;
}

body[data-demo-shell] .demo-nav-overlay {
  display: none;
}

@media (max-width: 1080px) {
  body[data-demo-shell] .demo-shell {
    display: block;
  }

  body[data-demo-shell] nav[data-standard-nav] {
    position: fixed;
    top: var(--demo-header-height);
    left: 0;
    height: calc(100vh - var(--demo-header-height));
    width: min(320px, 82vw);
    transform: translateX(-110%);
    transition: transform 260ms ease;
    box-shadow: 0 40px 80px rgba(2, 6, 23, 0.5);
    overflow-y: auto;
    padding: 2rem 1.5rem 3rem;
    border-right: 1px solid rgba(56, 189, 248, 0.18);
  }

  body[data-demo-shell][data-demo-nav-open="true"] nav[data-standard-nav] {
    transform: translateX(0);
  }

  body[data-demo-shell] nav[data-standard-nav] .nav-section {
    width: 100%;
  }

  body[data-demo-shell] nav[data-standard-nav] .demo-exit {
    margin-top: 1.5rem;
    width: 100%;
    justify-content: center;
  }

  body[data-demo-shell] .demo-main {
    padding: 2.25rem 1.75rem 3.25rem;
  }

  body[data-demo-shell] .demo-header {
    display: flex;
  }

  body[data-demo-shell] .demo-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(4, 12, 28, 0.68);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
    z-index: 80;
  }

  body[data-demo-shell][data-demo-nav-open="true"] .demo-nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 720px) {
  body[data-demo-shell] .demo-main {
    padding: 1.9rem 1.4rem 2.75rem;
  }
}
