/* /swarm: the swarm browser (swarm/swarm.js), on x1.css's tokens. */
.sw { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.sw-head h1 { margin: var(--s4) 0 var(--s2); font-weight: 400; letter-spacing: .04em; font-size: clamp(28px, 4vw, 44px); line-height: 1.1; }
.sw-head > p { max-width: 72ch; margin: 0 0 var(--s3); }
.sw-stats { display: flex; flex-wrap: wrap; gap: var(--s5); margin: var(--s4) 0; }
.sw-crumbs { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; margin-top: var(--s3); }
.sw-crumbs a { color: var(--link); }
.sw-visit .row { gap: var(--s3); margin-bottom: var(--s2); }
.sw-src .legend { margin-top: 6px; }
.sw-glyph { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-ink); font: 700 15px var(--mono); flex: none; }
.sw-glyph.big { width: 56px; height: 56px; font-size: 24px; }

.sw-sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--s4); }
.sw-source { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: var(--s2); }
.sw-source:hover { border-color: var(--line-strong); }
.sw-source:focus-visible, .sw-card:focus-visible { outline: 3px solid var(--electric); outline-offset: 2px; }
.sw-source h3 { margin: 0; font-size: 18px; }
.sw-source .row { gap: var(--s3); flex-wrap: nowrap; }
.sw-source p { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sw-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--dim); margin-top: auto; }
.sw-facts b { color: var(--heading); font-variant-numeric: tabular-nums; }

.sw-tools { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.sw-tools input[type=search] { flex: 1 1 260px; min-width: 0; }
.sw-tools select { flex: 0 1 200px; min-width: 0; }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: var(--s3); }
.sw-grid.small { grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }
.sw-more { display: flex; justify-content: center; margin: var(--s3) 0; }
.sw-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--text); min-width: 0; transition: border-color .15s, transform .15s; }
.sw-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.sw-card .body { padding: var(--s3); display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.sw-card h3 { margin: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-card .meta { display: flex; justify-content: space-between; gap: 8px; }
.sw-card .meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-card .foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.sw-card .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-card.skelcard { padding: var(--s3); }
.sw-thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; background: radial-gradient(circle at 70% 25%, rgb(185 230 17 / .16), transparent 55%), linear-gradient(150deg, var(--card-hi), var(--bg-deep)); overflow: hidden; }
.sw-thumb img { width: 100%; height: 100%; object-fit: contain; }
.sw-thumb img.px, .sw-img.px { image-rendering: pixelated; }
.sw-thumb .sw-glyph { width: 52px; height: 52px; font-size: 22px; }

.sw-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: var(--s5); align-items: start; }
.sw-main { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.sw-title { margin: var(--s2) 0 0; font-weight: 400; letter-spacing: .03em; font-size: clamp(24px, 3.4vw, 36px); overflow-wrap: anywhere; }
.sw-side { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.sw-side .kv { grid-template-columns: 110px minmax(0, 1fr); font-size: 13px; }
.sw-side code { font-size: 12px; overflow-wrap: anywhere; }
.sw-xfer:empty, .sw-verify:empty { display: none; }
.sw-xfer h3 { margin: 0 0 6px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.sw-preview { min-height: 200px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); overflow: hidden; position: relative; }
.sw-preview:focus { outline: none; }
.sw-pstatus { margin: 0; min-height: 1.4em; }
.sw-3d { width: 100%; height: min(62vh, 560px); min-height: 280px; background: radial-gradient(ellipse at 50% 30%, var(--card-hi), var(--bg-deep)); }
.sw-preview > p.small { margin: 0; padding: 6px var(--s3); border-top: 1px solid var(--line); }
.sw-imgbox { display: grid; place-items: center; padding: var(--s3); background: repeating-conic-gradient(var(--card-hi) 0 25%, var(--panel) 0 50%) 0 0 / 16px 16px; max-height: 70vh; overflow: auto; }
.sw-img { max-width: 100%; height: auto; }
.sw-img.px { min-width: min(100%, 256px); }
.sw-audio { display: flex; align-items: center; gap: var(--s3); padding: var(--s5); flex-wrap: wrap; }
.sw-audio audio { flex: 1 1 240px; min-width: 0; }
.sw-text { margin: 0; padding: var(--s3); max-height: 60vh; overflow: auto; font-size: 12px; white-space: pre; background: var(--code-bg); }
.sw-hex > p { padding: var(--s3) var(--s3) 0; margin: 0; }
.sw-split { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: var(--s3); }
.sw-sub { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.sw-files { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); }
.sw-files li { padding: 4px 10px; border-bottom: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.sw-files li:last-child { border-bottom: 0; }
.linkish { background: none; border: 0; padding: 2px 0; color: var(--link); font: inherit; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.linkish:hover { text-decoration: underline; }
.linkish:focus-visible { outline: 2px solid var(--electric); outline-offset: 2px; border-radius: 3px; }
.linkish.dir { color: var(--heading); font-weight: 600; }
.sw-packfiles { margin-top: var(--s4); }

@media (max-width: 900px) {
  .sw-item { grid-template-columns: minmax(0, 1fr); }
  .sw-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .sw-stats { gap: var(--s3) var(--s4); }
  .sw-stats .stat .value { font-size: 22px; }
  .sw-3d { height: 52vh; }
}
.sw-packsum { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s4); padding: var(--s5); align-items: start; }
.sw-packsum > p { grid-column: 1 / -1; margin: 0; }
@media (max-width: 520px) { .sw-packsum { grid-template-columns: minmax(0, 1fr); padding: var(--s4); } }
/* ?thumb=1: the renderer's square */
.sw-thumbbox { width: 512px; height: 512px; background: radial-gradient(ellipse at 50% 30%, #3a3737, #0d0c0c); }
.sw [hidden] { display: none !important; }
.sw-json { border-top: 1px solid var(--line); }
.sw-json summary { padding: 6px var(--s3); cursor: pointer; font-size: 13px; color: var(--dim); }
.sw-texbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px var(--s3); border-bottom: 1px solid var(--line); }
.sw-texbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.chipbtn { border: 1px solid var(--line-strong); background: var(--card); color: var(--text); border-radius: 999px; padding: 4px 10px; font: 600 12px var(--font); cursor: pointer; min-height: 28px; }
.chipbtn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chipbtn.ch-r[aria-pressed="true"] { background: #e5484d; border-color: #e5484d; color: #fff; }
.chipbtn.ch-g[aria-pressed="true"] { background: #30a46c; border-color: #30a46c; color: #fff; }
.chipbtn.ch-b[aria-pressed="true"] { background: #3e63dd; border-color: #3e63dd; color: #fff; }
.chipbtn:focus-visible { outline: 2px solid var(--electric); outline-offset: 2px; }
.sw-tex { display: block; margin: auto; }
.sw-tex.px { image-rendering: pixelated; }
.sw-imgbox { overflow: auto; }
.sw-wave { width: 100%; height: 120px; cursor: pointer; display: block; }
.sw-audio { flex-direction: column; align-items: stretch; }
.sw-audio .row { gap: var(--s3); align-items: center; }
.sw-play { min-width: 52px; font-size: 16px; }
.sw-audio-native { display: none; }
