/* The docs' storybook (/docs/storybook.html): components down the side, the
   story drawn by the web app (/story.html) in a device, then its props and
   code. Builds on site.css's tokens. */

.sb-page { min-height: 100vh; display: flex; flex-direction: column; }
.sb { flex: 1; display: grid; grid-template-columns: 250px minmax(0, 1fr); border-top: 1px solid var(--night3); }

.sb-side { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; padding: 16px 12px 40px; border-right: 1px solid var(--night3); }
.sb-find { width: 100%; padding: 8px 12px; border-radius: 10px; border: 1.5px solid var(--night3); background: var(--night1); color: var(--paper); font: inherit; font-size: 14px; }
.sb-side h3 { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 8px 6px; }
.sb-side a { display: block; padding: 5px 8px; border-radius: 8px; font-size: 14px; color: var(--ink); text-decoration: none; }
.sb-side a:hover { background: var(--night1); color: var(--paper); }
.sb-side a[aria-current="page"] { background: color-mix(in srgb, var(--signal) 12%, transparent); color: var(--signal); font-weight: 600; }

.sb-main { min-width: 0; padding: 24px clamp(16px, 3vw, 40px) 64px; }
.sb-main .crumbs { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.sb-main .crumbs a { color: var(--muted); }
.sb-main h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; color: var(--paper); margin: 0 0 4px; text-wrap: balance; }
.sb-what { margin: 0 0 16px; max-width: 65ch; color: var(--ink); }
.sb-stories { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sb-stories button { border: 1.5px solid var(--night3); background: none; color: var(--ink); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.sb-stories button:hover { border-color: var(--muted); }
.sb-stories button[aria-pressed="true"] { border-color: var(--signal); color: var(--signal); font-weight: 600; }

.sb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--night3); border-bottom: 0; border-radius: 16px 16px 0 0; background: var(--night1); }
.sb-seg { display: inline-flex; background: var(--night2); border-radius: 10px; padding: 3px; }
.sb-seg button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); }
.sb-seg button[aria-pressed="true"] { background: var(--night0); color: var(--paper); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.sb-gap { flex: 1; }
.sb-stage { position: relative; border: 1px solid var(--night3); border-radius: 0 0 16px 16px; padding: 32px 16px; display: grid; place-items: center; overflow-x: auto;
  background: radial-gradient(circle at 1px 1px, var(--night3) 1px, transparent 0) 0 0 / 16px 16px, var(--night0); }
.sb-error { position: absolute; left: 16px; right: 16px; bottom: 12px; margin: 0; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--coral) 14%, var(--night0)); color: var(--paper); font: 13px/1.5 var(--mono); white-space: pre-wrap; }

/* The device: a phone, or a window in the platform's way. */
.sb-device { --w: 390px; --h: 760px; width: var(--w); max-width: 100%; background: #fff; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgb(11 26 51 / .18), 0 0 0 1px rgb(11 26 51 / .08); }
.sb-device.dark { background: #111318; }
.sb-device iframe { display: block; width: 100%; height: var(--h); border: 0; background: transparent; }
.sb-device.window { --w: 780px; --h: 540px; }
.sb-device.phone { border-radius: 40px; border: 10px solid #1b1f27; }
.sb-device.phone .sb-chrome { display: none; }
.sb-chrome { display: flex; align-items: center; height: 32px; padding: 0 14px; flex: none; }
.sb-lights, .sb-ctl { display: none; }
.sb-device.mac { border-radius: 12px; }
.sb-device.mac .sb-chrome { height: 28px; }
.sb-device.mac .sb-lights { display: flex; gap: 8px; }
.sb-lights i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.sb-lights i:nth-child(2) { background: #febc2e; }
.sb-lights i:nth-child(3) { background: #28c840; }
.sb-device.windows { border-radius: 8px; }
.sb-device.windows .sb-ctl { display: flex; margin-left: auto; margin-right: -14px; }
.sb-ctl i { width: 46px; height: 32px; display: grid; place-items: center; font-style: normal; font-size: 12px; color: #6b7280; }
.sb-device.linux { border-radius: 10px; }
.sb-device.linux .sb-ctl { display: flex; margin-left: auto; margin-right: -8px; }
.sb-device.linux .sb-ctl i { width: 28px; }
.sb-device.windows.dark .sb-chrome, .sb-device.linux.dark .sb-chrome { color: #9ca3af; }

.sb-panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.sb-panel { border: 1px solid var(--night3); border-radius: 16px; overflow: hidden; min-width: 0; }
.sb-panel h2 { margin: 0; padding: 10px 14px; font-size: 13px; font-weight: 700; letter-spacing: 0; color: var(--paper); background: var(--night1); border-bottom: 1px solid var(--night3); display: flex; align-items: center; }
.sb-copy { margin-left: auto; border: 1.5px solid var(--night3); background: var(--night0); color: var(--ink); border-radius: 8px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.sb-props { width: 100%; border-collapse: collapse; font-size: 14px; }
.sb-props td { padding: 8px 14px; border-top: 1px solid var(--night2); vertical-align: middle; }
.sb-props tr:first-child td { border-top: 0; }
.sb-props td:first-child { font-family: var(--mono); font-size: 13px; color: var(--paper); width: 32%; }
.sb-props input:not([type="checkbox"]), .sb-props select, .sb-props textarea { width: 100%; padding: 5px 8px; border: 1.5px solid var(--night3); border-radius: 8px; background: var(--night0); color: var(--paper); font: inherit; font-size: 13px; }
.sb-props textarea { font-family: var(--mono); font-size: 12px; resize: vertical; min-height: 60px; }
.sb-props textarea[aria-invalid="true"] { border-color: var(--coral); }
.sb-props .none td { color: var(--muted); font-family: inherit; }
.sb-panel pre { margin: 0; padding: 14px; border: 0; border-radius: 0; background: #0b1a33; font: 13px/1.65 var(--mono); color: #eaf1fb; overflow-x: auto; }
.sb-panel pre code { display: block; background: none; border: 0; padding: 0; color: inherit; font: inherit; white-space: pre; }
.sb-panel pre .k { color: #8fd3ff; }
.sb-panel pre .s { color: #ffd37a; }
.sb-panel pre .n { color: #ffb86b; }
.sb-panel pre .f { color: #c9b6ff; }
.sb-panel pre .t { color: #7ee2b8; }
.sb-log { list-style: none; margin: 0; padding: 8px 14px; font: 12px/1.7 var(--mono); color: var(--muted); border-top: 1px solid var(--night2); min-height: 40px; }
.sb-log b { color: var(--paper); font-weight: 500; }
.sb-more { margin: 14px 0 0; font-size: 14px; }

@media (max-width: 860px) {
  .sb { grid-template-columns: 1fr; }
  .sb-side { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--night3); }
  #sb-tree { display: flex; flex-wrap: wrap; gap: 4px; max-height: 160px; overflow-y: auto; }
  #sb-tree h3 { display: none; }
  .sb-panels { grid-template-columns: 1fr; }
  .sb-device.phone { --h: 680px; border-width: 8px; border-radius: 32px; }
}
