/* Site layout: a top bar over the gallery and component pages, the hero on its grain field,
   category sidebar, captioned cards and the two panel component page. */

:root {
  --top-h: 64px;
  --card: rgba(255, 255, 255, 0.055);
  --card-2: rgba(255, 255, 255, 0.09);
  --bx-r: 28px;
}
html:not([data-theme='light']) { --bg: #0A0A0A; }
[data-theme='light'] { --card: rgba(0, 0, 0, 0.035); --card-2: rgba(0, 0, 0, 0.06); }

/* ---------- Top bar ---------- */

.top {
  position: fixed; z-index: 30; inset: 0 0 auto 0; height: var(--top-h);
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 16px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.top-brand { justify-self: start; display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 780; letter-spacing: -0.035em; color: var(--text); font-variation-settings: var(--round); }
.top-nav { position: absolute; left: 140px; top: 0; height: var(--top-h); display: flex; align-items: center; gap: 2px; }
.top-link { height: 34px; display: flex; align-items: center; padding: 0 13px; border-radius: var(--pill); font-size: 14px; font-weight: 500; color: var(--muted); transition: color .2s, background .2s; }
.top-link:hover { color: var(--text); }
.top-link.on { color: var(--text); }
.top-search {
  display: flex; align-items: center; gap: 8px; width: 220px; height: 38px; padding: 0 8px 0 14px;
  border: 0; border-radius: var(--pill); background: var(--card); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
  transition: background .2s, color .2s;
}
.top-search:hover { background: var(--card-2); color: var(--text-2); }
.top-search .ts-label { flex: 1; min-width: 0; display: flex; gap: 4px; text-align: left; white-space: nowrap; }
.top-search svg { flex: none; transition: transform .45s var(--spring); }
.top-search:hover svg { transform: rotate(-14deg) scale(1.1); }
.ts-roll { position: relative; flex: 1; min-width: 0; height: 1.3em; overflow: hidden; color: var(--faint); }
.ts-roll i { position: absolute; left: 0; top: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-style: normal; animation: ts-in .6s var(--spring) both; }
.ts-roll i.out { animation: ts-out .45s var(--ease) both; }
@keyframes ts-in { from { transform: translateY(70%); opacity: 0; filter: blur(4px); } }
@keyframes ts-out { to { transform: translateY(-70%); opacity: 0; filter: blur(4px); } }
@media (prefers-reduced-motion: reduce) { .ts-roll i, .ts-roll i.out { animation: none; } .ts-roll i.out { display: none; } }
.top-search kbd, .pal kbd { font: 500 11px/1 var(--sans); color: var(--faint); padding: 5px 7px; border-radius: 8px; background: var(--card); }
.top-right { justify-self: end; display: flex; align-items: center; gap: 8px; }
.top-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--card); color: var(--text-2); transition: background .2s, color .2s; }
.top-icon:hover { background: var(--card-2); color: var(--text); }
.top-mark { flex: none; color: var(--text); transition: transform .5s var(--spring); }
.top-brand:hover .top-mark { transform: rotate(-12deg); }
.top-gh { height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 14px 0 12px; border-radius: var(--pill); background: var(--card); color: var(--text-2); font-size: 13px; transition: background .2s, color .2s; }
.top-gh:hover { background: var(--card-2); color: var(--text); }
.top-gh .star-count { font: 500 13px/1 var(--sans); color: var(--text); }

/* Pills: light (primary), line (secondary), plain */
.bx-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 18px;
  border: 0; border-radius: var(--pill); background: var(--card); color: var(--text); font: inherit; font-size: 14px; font-weight: 550; cursor: pointer;
  transition: transform .25s var(--spring), background .2s, opacity .2s;
}
.bx-pill:hover { background: var(--card-2); }
.bx-pill:active { transform: scale(0.97); }
.bx-pill-light { background: var(--text); color: var(--bg); }
.bx-pill-light:hover { background: var(--text); opacity: .88; }
.bx-pill-line { background: none; box-shadow: inset 0 0 0 1px var(--line-2); }
.bx-pill.done { background: var(--card-2); }

/* ---------- Shell under the top bar ---------- */

body { padding-top: var(--top-h); }
@media (min-width: 861px) {
  .side { top: var(--top-h); padding-top: 18px; }
  .side-head { display: none; }
  body.bx-wide .side { display: none; }
  body.bx-wide .shell { padding-left: 0; }
  body.bx-wide .view { max-width: 1240px; padding: 0 32px 120px; }
}

/* ---------- Gallery hero ---------- */

.bx-wide .view { position: relative; }
.bx-wide .sc-hero2 { margin: 88px 0 28px; }
.bx-wide .sc-hero2 p { max-width: 460px; font-size: 16px; line-height: 1.55; font-weight: 420; text-wrap: balance; }
.bx-cta { display: flex; justify-content: center; gap: 8px; margin-top: 28px; }
.bx-wide .hx { margin-top: 0; max-width: 480px; border-radius: var(--pill); border: 0; background: var(--card); padding: 0 6px 0 6px; }
.bx-wide .hx-src { border-radius: var(--pill); background: transparent; }
.bx-wide .hx-glide, .bx-wide .hx-src-btn { border-radius: 50%; }

/* ---------- Filters: one track, a glide under the pick ---------- */

.bx-filters { position: relative; display: inline-flex; gap: 2px; padding: 4px; margin: 96px 0 18px; border-radius: 14px; background: var(--card); max-width: 100%; }
.bx-glide { position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 10px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); transition: transform .45s cubic-bezier(0.32, 0.72, 0, 1), width .45s cubic-bezier(0.32, 0.72, 0, 1); }
.bx-filter {
  position: relative; z-index: 1; height: 34px; padding: 0 14px; border: 0; border-radius: 10px; background: none; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: color .2s; white-space: nowrap;
}
.bx-filter sup { margin-left: 4px; font: 500 10.5px var(--mono); color: var(--faint); vertical-align: 5px; }
.bx-filter:hover { color: var(--text-2); }
.bx-filter.on { color: var(--text); }
.bx-wide .cp-grid-home { margin-top: 0; width: auto; left: auto; transform: none; }

/* ---------- Cards: the demo on a dot grid, a caption under it ---------- */

.bx-item { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.bx-card {
  position: relative; border-radius: 22px; overflow: hidden;
  background-color: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.bx-card .cp-panel-body { min-height: 280px; padding: 40px 24px; display: grid; place-items: center; }
.bx-card .cp-fx-body { min-height: 280px; }
.bx-acts { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; opacity: 0; transform: translateY(-3px); transition: opacity .25s var(--ease), transform .3s var(--ease); }
.bx-card:hover .bx-acts, .bx-card:focus-within .bx-acts { opacity: 1; transform: none; }
.bx-act { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--card-2); color: var(--text-2); cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: color .2s, transform .25s var(--spring); }
.bx-act:hover { color: var(--text); transform: scale(1.06); }
.bx-cap { display: flex; align-items: baseline; gap: 10px; padding: 0 6px; font-size: 13.5px; }
.bx-num { font: 500 11px var(--mono); color: var(--faint); }
.bx-name { color: var(--text-2); font-weight: 520; transition: color .2s; }
.bx-item:hover .bx-name { color: var(--text); }
.bx-kind { margin-left: auto; color: var(--faint); font-size: 12.5px; }
@media (hover: none) { .bx-acts { opacity: 1; transform: none; } }

/* ---------- Component page: stage + side panel ---------- */

.bx-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; margin-top: 24px; align-items: stretch; }
.bx-stage { position: relative; min-height: 560px; border-radius: var(--bx-r); background: var(--card); display: flex; flex-direction: column; }
.bx-stage-top { position: absolute; z-index: 2; inset: 12px 12px auto 12px; display: flex; justify-content: space-between; align-items: center; }
.bx-seg { background: var(--card); border-radius: var(--pill); }
.bx-seg .seg-btn { border-radius: var(--pill); }
.bx-stage-nav { display: flex; gap: 6px; }
.bx-round { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--card); color: var(--text-2); transition: background .2s, color .2s; }
.bx-round:hover { background: var(--card-2); color: var(--text); }
.bx-round[aria-disabled] { opacity: .3; pointer-events: none; }
.bx-panel-preview { position: relative; flex: 1; display: grid; }
.bx-panel-preview .stage-slot { padding: 72px 24px 72px; }
.bx-panel-preview .stage-hint { left: 22px; bottom: 22px; }
.bx-play { position: absolute; right: 14px; bottom: 14px; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--card-2); color: var(--text); cursor: pointer; transition: transform .25s var(--spring); }
.bx-play:hover { transform: scale(1.06); }
.bx-panel-code { padding: 64px 12px 12px; overflow: auto; max-height: 720px; }
.bx-panel-code .code { margin: 0; }

.bx-side { position: sticky; top: calc(var(--top-h) + 12px); align-self: start; min-height: 560px; display: flex; flex-direction: column; gap: 18px; padding: 18px; border-radius: var(--bx-r); background: var(--card); }
.bx-side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bx-side h1 { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; font-variation-settings: var(--round-mid); }
.bx-tag { flex: none; height: 26px; display: flex; align-items: center; padding: 0 10px; border-radius: var(--pill); background: var(--card); color: var(--muted); font-size: 12px; font-weight: 500; }
.bx-desc { margin: -6px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; text-wrap: pretty; }
.bx-rows { display: flex; flex-direction: column; gap: 10px; }
.bx-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.bx-row .platforms { margin: 0; background: var(--card); }
.bx-label { margin: 0 0 8px; font-size: 13.5px; color: var(--text-2); }
.bx-add .cmd { margin: 0; font-size: 11.5px; }
.bx-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.bx-side-foot .bx-pill { width: 100%; }
.bx-side-foot svg { width: 14px; height: 14px; }

.bx-docs { max-width: 900px; margin: 64px auto 0; }
.bx-docs .section-title:first-child { margin-top: 0; }

/* ---------- Built in the open (history.js) ---------- */

.gh { margin: 120px 0 0; }
.gh-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.gh-head h2 { margin: 0; font-size: 32px; line-height: 1.1; font-weight: 700; letter-spacing: -0.035em; font-variation-settings: var(--round); }
.gh-sub { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.gh-card { padding: 18px 20px 16px; border-radius: var(--bx-r); background: var(--surface); margin-bottom: 12px; }
.gh-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 14px; color: var(--text-2); }
@media (max-width: 860px) {
  .gh { margin-top: 80px; }
  .gh-head { flex-direction: column; align-items: flex-start; }
}

/* Git graph: main on the left, pull request branches beside it */
.gh-lanes { color: var(--muted); font-size: 13px; }
.gh-graph { position: relative; margin: 0 -8px; }
.gh-svg { position: absolute; left: 8px; top: 0; overflow: visible; }
.gh-cut { overflow: hidden; }
.gh-fade {
  position: absolute; left: 0; right: 0; bottom: 0; pointer-events: none;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  background: linear-gradient(to bottom, transparent, var(--surface) 92%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45%); mask-image: linear-gradient(to bottom, transparent, #000 45%);
}
.gh-main { stroke: color-mix(in srgb, var(--text) 55%, transparent); }
.gh-node-x circle { fill: var(--bg); stroke: var(--c); stroke-width: 2; }
.gh-node-x path { stroke: var(--c); stroke-width: 1.6; stroke-linecap: round; }
.gh-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gh-closed { color: var(--muted) !important; background: var(--card) !important; }
.gh-node-tag { fill: var(--text); }
.gh-node-pr { fill: var(--c); }
.gh-rows { position: relative; }
.gh-line { fill: none; stroke: var(--c, var(--text)); stroke-width: 2; stroke-linecap: round; opacity: .85; }
.gh-main { stroke: color-mix(in srgb, var(--text) 55%, transparent); }
.gh-dots { stroke-dasharray: 1 6; opacity: .6; }
.gh-node { fill: var(--bg); stroke: var(--c, var(--text)); stroke-width: 2; }
.gh-node-x { fill: none; }
.gh-fold { height: 34px; display: flex; align-items: center; padding-left: var(--gw); font-size: 12.5px; color: var(--faint); }
.gh-row { height: 56px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 0 12px 0 var(--gw); border-radius: 14px; min-width: 0; transition: background .2s; }
.gh-row:hover { background: var(--card); }
.gh-msg { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gh-row-pr .gh-msg { color: var(--text-2); }
.gh-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; }
.gh-meta img { border-radius: 50%; flex: none; }
.gh-meta code { font: 500 11.5px var(--mono); color: var(--muted); }
.gh-tag, .gh-pr { flex: none; height: 20px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: var(--pill); font-size: 11.5px; font-weight: 550; }
.gh-tag { background: var(--text); color: var(--bg); }
.gh-pr { color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }

/* ---------- Footer (footer.js) ---------- */

.foot { position: relative; margin-top: 140px; border-top: 1px solid var(--line); }
.foot-in { max-width: 1240px; margin: 0 auto; padding: 56px 32px 28px; }
@media (min-width: 861px) { body:not(.bx-wide) .foot { margin-left: var(--rail); } }
.foot-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; }
.foot-lead p { margin: 0 0 18px; max-width: 320px; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.foot-cmd { display: inline-flex; align-items: center; gap: 12px; height: 40px; padding: 0 6px 0 14px; border: 0; border-radius: 12px; background: var(--card); cursor: pointer; color: var(--text); }
.foot-cmd code { font: 12.5px var(--mono); }
.foot-cmd span { height: 28px; display: grid; place-items: center; padding: 0 10px; border-radius: 8px; background: var(--card-2); font-size: 12px; color: var(--text-2); }
.foot-cols { display: grid; grid-template-columns: repeat(4, minmax(110px, auto)); gap: 32px; }
.foot-col { display: flex; flex-direction: column; gap: 10px; }
.foot-col p { margin: 0 0 4px; font-size: 12.5px; color: var(--faint); }
.foot-col a { font-size: 14px; color: var(--text-2); transition: color .2s; }
.foot-col a:hover { color: var(--text); }
.foot-word { position: relative; margin: 56px 0 8px; cursor: crosshair; user-select: none; }
.foot-word canvas { display: block; width: 100%; }
.foot-hint { position: absolute; right: 0; bottom: -4px; font-size: 12px; color: var(--faint); opacity: 0; transition: opacity .3s; }
.foot-word:hover .foot-hint { opacity: 1; }
.foot-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--faint); }
.foot-theme { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--card); }
.foot-theme button { height: 28px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.foot-theme button.on { background: var(--card-2); color: var(--text); }
@media (max-width: 860px) {
  .foot { margin-top: 96px; }
  .foot-in { padding: 40px 16px 24px; }
  .foot-top { grid-template-columns: 1fr; gap: 36px; }
  .foot-cols { grid-template-columns: 1fr 1fr; gap: 28px; }
}

/* ---------- Search palette ---------- */

.pal { position: fixed; z-index: 60; inset: 0; display: grid; justify-items: center; align-items: start; padding-top: 14vh; background: rgba(0, 0, 0, 0.5); animation: pal-in .16s var(--ease); }
.pal.out { opacity: 0; transition: opacity .16s; }
@keyframes pal-in { from { opacity: 0; } }
.pal-box { width: min(560px, calc(100vw - 32px)); border-radius: 22px; background: var(--surface); box-shadow: 0 0 0 1px var(--line-2), 0 24px 64px rgba(0, 0, 0, 0.45); overflow: hidden; animation: pal-up .22s var(--ease); }
@keyframes pal-up { from { transform: translateY(8px) scale(0.98); } }
.pal-in { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 14px 0 18px; color: var(--muted); border-bottom: 1px solid var(--line); }
.pal-in input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 15px; }
.pal-list { max-height: 50vh; overflow: auto; padding: 6px; }
.pal-item { display: flex; justify-content: space-between; align-items: center; height: 40px; padding: 0 12px; border-radius: 12px; font-size: 14px; color: var(--text-2); }
.pal-item.on, .pal-item:hover { background: var(--card-2); color: var(--text); }
.pal-kind { font-size: 12px; color: var(--faint); }
.pal-empty { margin: 0; padding: 18px; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- Small screens ---------- */

@media (max-width: 1000px) {
  .top-search { width: 40px; padding: 0; justify-content: center; }
  .top-search .ts-label, .top-search kbd { display: none; }
  .bx-detail { grid-template-columns: 1fr; }
  .bx-side { position: static; min-height: 0; }
  .bx-stage { min-height: 440px; }
}
@media (max-width: 860px) {
  .top { padding: 0 12px 0 60px; grid-template-columns: 1fr auto auto; }
  .top-nav { display: none; }
  .top-cta { display: none; }
  .top-gh { padding: 0 12px; }
  .menu-fab { top: 12px; z-index: 31; }
  .shell { padding-top: 12px; }
  .bx-wide .view { padding: 0; }
  .bx-wide .sc-hero2 { margin-top: 40px; }
  .bx-filters { margin-top: 56px; overflow-x: auto; scrollbar-width: none; }
  .bx-filter { flex: none; }
  .bx-card .cp-panel-body { min-height: 230px; }
}

/* Captions under the cards need a little more air between rows; the grid starts under the hero. */
.bx-wide .cp-grid-home { margin-top: 96px; }
.bx-wide .cp-grid { gap: 14px; }
.bx-wide .cp-col { gap: 22px; }

/* ---------- Logo (logo.js) ---------- */

.side-mark { flex: none; color: var(--text); }

/* ---------- Hero: copy on the left, a dithered grain field on the right (hero-bg.js) ---------- */

.hz { position: relative; margin: 8px 0 0; padding: 84px 0 72px; }
.hz-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.bx-wide .hz .sc-hero2 { position: relative; z-index: 1; margin: 0; max-width: 560px; align-items: flex-start; text-align: left; }
.bx-wide .hz .sc-hero2 .hz-sub { margin: 18px 0 0; max-width: 500px; font-size: 17px; line-height: 1.5; font-weight: 420; color: var(--muted); text-wrap: pretty; }
.hz .bx-cta { justify-content: flex-start; margin-top: 30px; }
.bx-wide .hz .hx { margin: 22px 0 0; width: 100%; }
@media (max-width: 860px) {
  .hz { padding: 40px 0 36px; }
  .hz-bg { opacity: .22; }
}

/* Card captions: the name, and the category on the right. */
.bx-cap { display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 12px 4px 0; font-size: inherit; }
.bx-cap-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.bx-cap .bx-name { font-size: 15px; font-weight: 600; letter-spacing: -0.012em; color: var(--text); }
.bx-cap .bx-kind { font-size: 12px; color: var(--faint); white-space: nowrap; }
.bx-wide .hz .hz-title { margin: 0; font-size: clamp(48px, 6vw, 72px); line-height: 1; font-weight: 760; letter-spacing: -0.045em; color: var(--text); font-variation-settings: 'ROND' 30; }

/* Home gallery: the component's name inside its card, top left, over the demo. */
.bx-in {
  position: absolute; left: 18px; top: 15px; z-index: 3; display: inline-flex; align-items: baseline; gap: 8px;
  color: var(--text); text-decoration: none; font-size: 14px; font-weight: 620; letter-spacing: -0.01em;
}
.bx-in em { font-style: normal; font-weight: 500; font-size: 12.5px; color: var(--faint); }
.bx-in:hover span { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.bx-card { position: relative; }
