/* ============================================
   Storybook — Component showcase page
   ============================================ */

.storybook {
  padding: 80px var(--space-xl) var(--space-xxl);
  max-width: 1100px;
  margin: 0 auto;
  overflow: auto;
}

body:has(.storybook),
body:has(.storybook) main {
  overflow: auto;
}

.storybook h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
}

.storybook > .subtitle {
  font-size: 15px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xxl);
}

.sb-section {
  margin-bottom: var(--space-xxl);
  padding: var(--space-xl);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-island);
}

.sb-section h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sb-section h2 code {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-muted);
  background: var(--color-gray-10);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.sb-section > .desc {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.sb-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-lg);
}

.sb-row:last-child {
  margin-bottom: 0;
}

.sb-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  min-width: 80px;
  flex-shrink: 0;
}

.sb-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.sb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

.sb-island-demo {
  padding: var(--space-md);
  display: inline-block;
}

.sb-dark {
  background: var(--color-canvas);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

.sb-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-sm);
}

.sb-swatch {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 12px;
  color: var(--color-text-secondary);
}

.sb-swatch-color {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-gray-20);
  flex-shrink: 0;
}

.sb-code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 11px;
  color: var(--color-text-muted);
}

.sb-inline {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sb-spacer {
  width: var(--space-xl);
}

/* Modal demo (inline, not overlay) */
.sb-modal-demo {
  position: relative;
  border: 1px solid var(--color-gray-20);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 400px;
}

.sb-modal-demo .modal-overlay {
  position: relative;
  min-height: 200px;
}

.sb-modal-demo .modal {
  position: relative;
  max-height: none;
}

/* Tooltip demo (force visible) */
.sb-tooltip-demo .tooltip {
  display: flex;
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
}

.sb-tooltip-demo .tooltip--fixed {
  display: flex;
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  width: 100%;
}

/* Dev FAB — bottom-right link to storybook */
.dev-fab {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-surface);
  border: var(--border-hand-drawn);
  border-radius: var(--radius-hand-drawn);
  box-shadow: var(--shadow-hand-drawn);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s, box-shadow 0.15s;
  opacity: 0.6;
}

.dev-fab:hover {
  color: var(--color-primary);
  opacity: 1;
  box-shadow: var(--shadow-hand-drawn-lg);
}
