/* Storybook shell layout */

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg-elev);
  border-right: 1px solid var(--rule);
  padding: 32px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar__brand {
  padding: 0 28px 28px;
  border-bottom: 1px solid var(--rule);
}
.sidebar__brand-mark {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: var(--tr-tight);
  color: var(--primary);
}
.sidebar__brand-sub {
  margin-top: 4px;
  font-size: var(--fs-caption);
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  color: var(--fg-muted);
}
.sidebar__nav {
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__group {
  padding: 16px 28px 6px;
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 28px;
  font-size: var(--fs-body-sm);
  color: var(--fg-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  cursor: pointer;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.nav-item:hover {
  color: var(--fg);
  background: var(--idpe-cobalt-50);
}
.nav-item.is-active {
  color: var(--primary);
  background: var(--idpe-cobalt-50);
  border-left-color: var(--primary);
  font-weight: 600;
}
[data-theme="dark"] .nav-item:hover,
[data-theme="dark"] .nav-item.is-active {
  background: rgba(81,131,221,0.08);
}
.nav-item__num {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--fg-faint);
  font-weight: 500;
  min-width: 22px;
}
.sidebar__footer {
  margin-top: auto;
  padding: 20px 28px;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-caption);
  color: var(--fg-faint);
  line-height: var(--lh-relaxed);
}

/* Main */
.main {
  min-width: 0;
  background: var(--bg);
}
.section {
  display: none;
  padding: 0;
}
.section.is-active { display: block; }

/* Section header */
.section-head {
  border-bottom: 1px solid var(--rule);
  padding: 80px 80px 56px;
  background: var(--bg-elev);
}
.section-head__eyebrow {
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-head__eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}
.section-head__title {
  font-size: var(--fs-display-lg);
  font-weight: 700;
  letter-spacing: var(--tr-tight);
  line-height: var(--lh-display);
  margin: 0 0 20px;
  max-width: 18ch;
}
.section-head__intro {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-relaxed);
  color: var(--fg-muted);
  max-width: 65ch;
  font-weight: 300;
  margin: 0;
}

.section-body {
  padding: 64px 80px 120px;
}

.subsection {
  margin-bottom: 80px;
}
.subsection:last-child { margin-bottom: 0; }
.subsection__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 16px;
  margin-bottom: 32px;
  gap: 32px;
}
.subsection__title {
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: var(--tr-snug);
  margin: 0;
}
.subsection__num {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-caption);
  color: var(--fg-faint);
  letter-spacing: var(--tr-wide);
}
.subsection__desc {
  color: var(--fg-muted);
  max-width: 65ch;
  margin: -16px 0 32px;
  line-height: var(--lh-relaxed);
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250,248,244,0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
  padding: 14px 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
[data-theme="dark"] .topbar {
  background: rgba(10,14,26,0.7);
}
.topbar__crumb {
  font-size: var(--fs-caption);
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar__crumb-sep { color: var(--fg-faint); }
.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar__btn {
  font-family: inherit;
  font-size: var(--fs-caption);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--fg);
  padding: 8px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.topbar__btn:hover { border-color: var(--fg); }
.topbar__btn.is-active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .section-head, .section-body, .topbar { padding-left: 24px; padding-right: 24px; }
  .section-head { padding-top: 48px; padding-bottom: 32px; }
}
