/* Library chrome. Built on the proposed tokens, so the page is also a test of them. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
[data-theme="dark"] .lib-nav img, [data-theme="dark"] .w-brand img { filter: brightness(0) invert(1); }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/22px var(--font); -webkit-font-smoothing: antialiased; }
.lib { display: grid; grid-template-columns: 212px minmax(0, 1fr); gap: 0 40px; max-width: 1480px; margin: 0 auto; padding-inline: 24px; }
.lib :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.lib-nav { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; padding-block: 28px; scrollbar-width: thin; }
.lib-nav img { display: block; height: 22px; width: auto; max-width: none; margin-bottom: 20px; }
.lib-nav h2 { margin: 18px 0 4px; font: 500 12px/16px var(--font); color: var(--text-3); }
.lib-nav a { display: block; padding: 4px 8px; margin-left: -8px; border-radius: var(--r-xs); color: var(--text-2); text-decoration: none; }
.lib-nav a:hover { background: var(--hover); color: var(--text); }
.lib-nav a.is-on { color: var(--accent-text); font-weight: 600; }
.lib-find { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--border-control); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: 400 14px/20px var(--font); }
.lib-find::placeholder { color: var(--text-3); opacity: 1; }

.lib-main { min-width: 0; padding-block: 0 96px; }
.lib-hero { padding-block: 24px; }
.lib-hero h1 { margin: 0; font: 600 32px/40px var(--display); letter-spacing: -.02em; text-wrap: balance; }
.lib-hero p { margin: 8px 0 0; max-width: 68ch; font-size: 16px; line-height: 24px; color: var(--text-2); }

.lib-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 60px; padding: 8px 0; background: var(--bg); border-bottom: 1px solid var(--border); }
.lib-dark { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font: 500 14px/20px var(--font); color: var(--text); white-space: nowrap; cursor: pointer; }
.lib-dark svg { width: 16px; height: 16px; color: var(--text-2); }

.lib-group { margin: 56px 0 0; padding-bottom: 4px; font: 600 24px/32px var(--display); letter-spacing: -.015em; }
.lib-sec { padding-top: 28px; }
.lib-sec[hidden], .lib-group[hidden] { display: none; }
.lib-sec > header { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.lib-sec h3 { margin: 0; font: 600 20px/28px var(--display); letter-spacing: -.01em; }
.lib-sec .used { font: 400 13px/18px var(--font); color: var(--text-3); }

.cmp { display: grid; gap: 16px; }
.cmp--side { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.pane { min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.pane-h { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-bottom: 1px solid var(--border); font: 600 13px/18px var(--font); color: var(--text-2); background: var(--sunken); }
.pane--after .pane-h { color: var(--accent-text); }
.pane-b { flex: 1; min-width: 0; padding: 20px 16px; overflow-x: auto; color: var(--text); background: var(--surface); }
.pane--after .pane-b.on-bg { background: var(--bg); }
.pane--before .pane-b { background: #FEFEFE; }
[data-theme="dark"] .pane--before .pane-b { background: #0C0D12; }
.spec-b + .spec-b { margin-top: 20px; }
.spec-l { margin-bottom: 8px; font: 400 12px/16px var(--font); color: #646A7A; }
[data-theme="dark"] .spec-l { color: #979DB0; }
.bf { display: block; }
body[data-view="before"] .cmp, body[data-view="after"] .cmp { grid-template-columns: minmax(0, 1fr); }
body[data-view="before"] .pane--after, body[data-view="after"] .pane--before { display: none; }

.demo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.demo-row + .demo-row { margin-top: 12px; }
.demo-top { align-items: flex-start; }
.demo-col { display: grid; gap: 8px; }
.demo-cap { margin: 20px 0 8px; font: 400 12px/16px var(--font); color: var(--text-3); }
.demo-cap:first-child { margin-top: 0; }
.demo-sides { gap: 16px; }
.demo-sides .w-side { border: 1px solid var(--border); border-radius: var(--r-lg); min-height: 520px; width: 224px; }
.demo-screen { display: grid; grid-template-columns: 232px minmax(0, 1fr); width: 1320px; min-height: 620px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.demo-page { display: grid; gap: 16px; padding: 24px; align-content: start; }
.demo-main { min-width: 0; }

.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; margin-top: 16px; }
.notes h4 { margin: 0 0 6px; font: 600 14px/20px var(--font); }
.notes ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.notes li { position: relative; padding-left: 16px; color: var(--text-2); max-width: 62ch; }
.notes li::before { content: ""; position: absolute; left: 0; top: 10px; width: 6px; height: 2px; background: var(--border-control); }
.ask { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--r-md); background: var(--med-soft); color: var(--text); max-width: 100%; }
.ask b { font-weight: 600; }
.more { margin-top: 12px; border-top: 1px solid var(--border); }
.more summary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 0; color: var(--accent-text); font-weight: 500; cursor: pointer; }
.more-b { display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); gap: 24px; padding: 4px 0 8px; }
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.kv td:first-child { width: 96px; padding-right: 12px; color: var(--text-3); }
.code { position: relative; min-width: 0; }
.code pre { margin: 0; max-height: 300px; overflow: auto; padding: 14px 16px; border-radius: var(--r-md); background: var(--sunken); border: 1px solid var(--border); font: 400 12px/18px var(--mono); color: var(--text); tab-size: 2; }
.code button { position: absolute; top: 8px; right: 8px; background: var(--surface); }

.facts { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.facts th { height: 40px; padding: 0 16px; background: var(--sunken); border-bottom: 1px solid var(--border); color: var(--text-2); font: 500 13px/16px var(--font); text-align: left; white-space: nowrap; }
.facts td { padding: 10px 16px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; vertical-align: top; }
.facts tr:last-child td { border-bottom: 0; }
.facts .num { text-align: right; white-space: nowrap; }
.facts td b { font-weight: 600; }
.facts-wrap { overflow-x: auto; }

.sw { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.sw-i { min-width: 0; font: 400 12px/16px var(--font); color: var(--text-3); }
.sw-i i { display: block; height: 44px; border-radius: var(--r-md); border: 1px solid var(--border); margin-bottom: 6px; }
.sw-i b { display: block; font: 500 13px/18px var(--font); color: var(--text); }
.sw-i code { font: 400 12px/16px var(--mono); }
.sw--s { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.sw--s i { height: 32px; }
.sw-i .both { background: var(--was-light); }
[data-theme="dark"] .sw-i .both { background: var(--was-dark); }
.ty { display: grid; gap: 10px; }
.ty-r { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px; align-items: baseline; }
.ty-r span { color: var(--text-3); font: 400 12px/16px var(--font); }
.ty-r div { overflow-wrap: anywhere; }
.ty-old { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.ty-old span { white-space: nowrap; }
.boxes { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.boxes > div { text-align: center; font: 400 12px/16px var(--font); color: var(--text-3); }
.boxes i { display: block; width: 44px; height: 44px; margin: 0 auto 4px; background: var(--neutral-soft); border: 1px solid var(--border-strong); }
.boxes .bar { width: auto; height: 14px; background: var(--accent-soft); border: 0; border-left: 1px solid var(--accent); border-right: 1px solid var(--accent); }
.boxes .el { width: 88px; height: 56px; border-radius: var(--r-lg); background: var(--surface); }
.boxes .ctl { width: 72px; border-radius: var(--r-md); background: var(--surface); border-color: var(--border-control); }
.demo-cap code, .notes code { font: 400 12px/16px var(--mono); }
.pane-b--flush { padding: 0; }
.zoom { zoom: .86; }
.lib-foot { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--text-2); max-width: 72ch; }
.lib-none { padding: 40px 0; color: var(--text-2); }

@media (max-width: 1100px) { .cmp--side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .lib { grid-template-columns: minmax(0, 1fr); padding-inline: 16px; }
  .lib-nav { position: static; height: auto; padding-block: 20px 0; }
  .lib-nav nav { display: flex; gap: 2px 4px; overflow-x: auto; padding-bottom: 4px; }
  .lib-nav h2 { display: none; }
  .lib-nav a { margin: 0; white-space: nowrap; }
  .lib-nav .lib-find { margin-bottom: 8px; }
  .lib-bar { margin-inline: -16px; padding-inline: 16px; }
  .lib-bar .w-seg button { padding: 0 10px; }
  .lib-wide { display: none; }
  .notes, .more-b { grid-template-columns: minmax(0, 1fr); }
  .ty-r { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .pane-b { padding: 16px; }
  .facts th, .facts td { padding-left: 10px; padding-right: 10px; white-space: normal; }
  .facts .num { white-space: normal; }
}
