/* SavComponents documentation site. Built on the library tokens, so the customiser re-themes the docs too. */

/* Stack Sans Notch is the signature of Saverio Morelli: only .credit-name uses it */
@font-face { font-family: "Stack Sans Notch"; src: url("../fonts/stack-sans-notch.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }

:root {
  /* the site follows the chosen style: only Tilt leans the shapes (--lean), radius and borders come from the style */
  --lean: 0;
  --top-h: 60px;
  --side-w: 248px;
  --rail-w: 3.6rem;
  --accent-2: #ff7a59;
  --code-bg: #f3f4f9;
  --code-text: #2a2f45;
  --tk-tag: #c2185b;
  --tk-attr: #6a4fd8;
  --tk-str: #0a7f5c;
  --tk-punct: #8a90a6;
  --tk-com: #8a90a6;
}
.sav-style-tilt { --lean: 1; }
.sav-style-soft:not(.sav-style-tilt), .sav-style-sharp, .sav-style-brutal, .sav-style-glass { --lean: 0; }
.sav-theme-dark {
  --code-bg: #121624;
  --code-text: #d6dbea;
  --tk-tag: #ff7eb3;
  --tk-attr: #b4a6ff;
  --tk-str: #6fe0b4;
  --tk-punct: #7c84a0;
  --tk-com: #6b7390;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 16px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: color-mix(in oklab, var(--sav-color-primary) var(--sav-tint, 62%), var(--sav-color-text)); }
code { font-family: var(--sav-font-mono); font-size: .86em; padding: .1em .35em; border-radius: var(--sav-radius-sm); background: var(--sav-color-surface-2); color: var(--sav-color-text); }
kbd { font-family: var(--sav-font-mono); font-size: .75em; padding: .1em .4em; border: 1px solid var(--sav-color-border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--sav-color-surface); color: var(--sav-color-text-muted); }
.muted { color: var(--sav-color-text-muted); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 1rem; }

/* ---------- tilted rectangles: a nod to the saveriomorelli.com icon.
   The shape behind rotates, the text never does. */
.tilt { position: relative; isolation: isolate; }
.tilt::before { content: ""; position: absolute; z-index: -1; inset: var(--tilt-inset, 0); background: var(--tilt-bg, var(--sav-color-primary)); transform: rotate(calc(var(--tilt, -2deg) * var(--lean))); transition: transform .25s var(--sav-easing), background .25s; }
/* box with a rotated layer behind it: ::after is the box, ::before the tilted layer */
.layered { position: relative; isolation: isolate; background: none; border: 0; }
.layered::after { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--sav-color-surface); background-image: var(--sav-sheen, none); border: var(--sav-border-width) solid var(--sav-color-border); border-radius: var(--sav-radius); box-shadow: var(--sav-shadow-sm); -webkit-backdrop-filter: var(--sav-backdrop, none); backdrop-filter: var(--sav-backdrop, none); }
/* without the lean the layer behind is hidden: hover shows on the border instead */
.layered:hover::after { border-color: color-mix(in oklab, var(--sav-color-primary) calc(60% * (1 - var(--lean))), var(--sav-color-border)); }
.layered::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--layer-bg, color-mix(in oklab, var(--sav-color-primary) 14%, transparent)); border-radius: var(--sav-radius); transform: rotate(calc(var(--layer-tilt, 1.2deg) * var(--lean))); transition: transform .3s var(--sav-easing), background .3s; }

/* ---------- top bar */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem;
  background: color-mix(in oklab, var(--sav-color-bg) 84%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--sav-color-border);
}
.brand { display: flex; align-items: center; gap: .65rem; color: var(--sav-color-text); text-decoration: none; font-size: 1.1rem; letter-spacing: -.01em; white-space: nowrap; }
.brand b { font-weight: 800; }
.logo { width: 28px; height: 28px; flex: none; background: url("logo.svg") center / contain no-repeat; transition: transform .3s var(--sav-easing); }
.brand:hover .logo { transform: rotate(-10deg); }
.ver-pick { margin-left: -.4rem; }
.ver-btn { font-variant-numeric: tabular-nums; }
.ver-old { margin-bottom: 1.5rem; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
/* the search box is drawn like the library's fields: a layer that follows the style (leans in Tilt and straightens while typing, ink in Brutal, glass in Glass) */
.menu-btn { display: none; }

/* ---------- layout */
.layout { display: flex; }
.side {
  position: sticky; top: var(--top-h); flex: none; width: var(--side-w); height: calc(100vh - var(--top-h)); overflow-y: auto; overflow-x: hidden;
  padding: 1.25rem .9rem 2rem; border-right: 1px solid var(--sav-color-border);
  transition: width .25s var(--sav-easing), padding .25s var(--sav-easing);
}
/* the fold handle on the edge of a column (the sidebar, the builder options), like the vertical tabs: a small round button half outside the border */
.edge-fold { display: grid; place-items: center; width: 1.65rem; height: 1.65rem; padding: 0; border: 1px solid var(--sav-color-border); border-radius: var(--sav-knob-radius, 50%);
  background: var(--sav-color-surface); color: var(--sav-color-text-muted); box-shadow: var(--sav-shadow-sm); cursor: pointer; transform: rotate(var(--sav-knob-tilt, 0deg));
  transition: color .15s, left .25s var(--sav-easing); }
.edge-fold:hover { color: var(--sav-color-primary); }
.edge-fold:focus-visible { outline: 2px solid var(--sav-color-focus); outline-offset: 2px; }
.edge-fold sav-icon { font-size: .95rem; width: .95rem; height: .95rem; transition: transform .25s var(--sav-easing); }
/* sidebar: expanded with names, or collapsed to a rail of icons (the names stay for screen readers and as tooltips) */
.side-fold { display: none; }
/* every link has its icon before the name (folded to a rail, only the icon stays) */
.side a .si { display: grid; flex: none; place-items: center; color: var(--sav-color-text-muted); }
.side a.on .si { color: inherit; }
.side a .si :is(svg, sav-icon) { width: 1.05rem; height: 1.05rem; font-size: 1.05rem; }
.side a .sl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-collapsed .side a .si :is(svg, sav-icon) { width: 1.15rem; height: 1.15rem; font-size: 1.15rem; }
@media (min-width: 861px) {
  .side-fold { display: grid; position: fixed; z-index: 16; top: calc(var(--top-h) + .85rem); left: calc(var(--side-w) - .83rem); }
  .side-collapsed .side-fold { left: calc(var(--rail-w) - .83rem); }
  .side-collapsed .side-fold sav-icon { transform: rotate(180deg); }
  .side-collapsed .side { width: var(--rail-w); padding-inline: .4rem; scrollbar-width: none; }
  .side-collapsed .side::-webkit-scrollbar { display: none; }
  .side-collapsed .side-group { margin-bottom: .5rem; }
  .side-collapsed .side-title { height: 1px; margin: .55rem .55rem .6rem; padding: 0; overflow: hidden; color: transparent; background: var(--sav-color-border); }
  .side-collapsed .side-group:first-child .side-title { display: none; }
  .side-collapsed .side a { display: grid; place-items: center; padding: .5rem 0; }
  .side-collapsed .side a .si { display: grid; }
  .side-collapsed .side a .sl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .side-collapsed .side a.side-ext { display: grid; justify-content: center; }
  .side-collapsed .side a.side-ext > svg { display: none; }
}
@media (prefers-reduced-motion: reduce) { .side, .edge-fold, .edge-fold sav-icon { transition: none !important; } }
.side-group { margin-bottom: 1.25rem; }
.side-title { padding: 0 .65rem; margin-bottom: .35rem; font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--sav-color-text-muted); }
.side a { position: relative; isolation: isolate; display: flex; align-items: center; gap: .6rem; padding: .36rem .65rem; color: var(--sav-color-text); text-decoration: none; font-size: .92rem; }
.side a::before { content: ""; position: absolute; inset: 1px 2px; z-index: -1; border-radius: var(--sav-radius-sm); background: var(--sav-color-surface-2); transform: rotate(0) scaleX(0); transform-origin: left; transition: transform .22s var(--sav-easing), background .22s; }
.side a:hover::before { transform: rotate(calc(-1.5deg * var(--lean))) scaleX(1); }
/* the current page looks like the selected vertical tab of the chosen style (the same --sav-tab-vertical-* tokens) */
/* the current page looks like the selected vertical tab of the chosen style (the same --sav-tab-vertical-* tokens): a raised card in Soft and Sharp */
.side a.on { color: var(--sav-tab-vertical-active-fg, var(--sav-color-text)); font-weight: 600; }
.side a.on::before { background: var(--sav-tab-vertical-active-bg, var(--sav-color-surface)); background-image: var(--sav-sheen, none);
  box-shadow: var(--sav-tab-vertical-active-shadow, var(--sav-tab-vertical-active-line, 0 0 0 var(--sav-border-width) var(--sav-color-border), var(--sav-shadow-sm))); transform: rotate(calc(-1.5deg * var(--lean))) scaleX(1); }
.side-empty { padding: 0 .65rem; color: var(--sav-color-text-muted); font-size: .9rem; }
.main { flex: 1; min-width: 0; max-width: 980px; padding: 2.25rem 3rem 3rem; outline: none; overflow-x: clip; }

/* ---------- home */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 3.5rem; align-items: center; padding: 1.75rem 0 3.5rem; }
/* the logo, big, only on the overview: a tinted tile leans behind it like the cards */
.hero-brand { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.4rem; }
.hero-logo { position: relative; isolation: isolate; display: inline-flex; padding: 14px; flex: none; }
.hero-logo::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: var(--sav-radius-lg); background: color-mix(in oklab, var(--sav-color-primary) 16%, var(--sav-color-surface));
  border: var(--sav-border-width) solid color-mix(in oklab, var(--sav-color-primary) 30%, transparent); box-shadow: var(--sav-shadow-sm); transform: rotate(calc(-6deg * var(--lean))); transition: transform .4s var(--sav-easing); }
.hero-logo img { display: block; width: 88px; height: 88px; transition: transform .4s var(--sav-easing); }
.hero-brand:hover .hero-logo img { transform: rotate(-10deg) scale(1.04); }
.hero-brand:hover .hero-logo::before { transform: rotate(calc(6deg * var(--lean))); }
.hero-name { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -.02em; line-height: 1; color: var(--sav-color-text); }
.hero-name b { font-weight: 800; color: color-mix(in oklab, var(--sav-color-primary) var(--sav-tint, 62%), var(--sav-color-text)); }
@media (prefers-reduced-motion: reduce) { .hero-logo img, .hero-logo::before { transition: none; } }
.hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.4rem); line-height: 1.12; letter-spacing: -.035em; margin: 1.1rem 0; font-weight: 800; }
.hl { display: inline-block; padding: 0 .18em; margin: .06em 0; color: var(--sav-color-on-primary); --tilt: -2.5deg; }
.chip { display: inline-block; padding: .25rem .6rem; font-size: .76rem; font-weight: 700; letter-spacing: .02em; color: var(--sav-color-text); --tilt-bg: color-mix(in oklab, var(--sav-color-primary) 16%, transparent); --tilt: 2deg; }
.lead { font-size: 1.08rem; color: var(--sav-color-text-muted); line-height: 1.6; max-width: 40rem; }
.hero .row { margin-top: 1.6rem; }
.hero-demo { position: relative; isolation: isolate; padding: 1.25rem; }
.hero-demo::before { content: ""; position: absolute; z-index: -1; inset: 0; background: var(--sav-color-primary); transform: rotate(calc(7deg * var(--lean))); }
.hero-demo::after { content: ""; position: absolute; z-index: -2; inset: -6% 4% 6% -4%; border: 2px solid color-mix(in oklab, var(--sav-color-primary) 45%, transparent); transform: rotate(calc(-4deg * var(--lean))); }
.sampler { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--sav-color-border); border: 1px solid var(--sav-color-border); box-shadow: var(--sav-shadow-lg); }
.sampler > * { background: var(--sav-color-surface); }
.sampler-head { grid-column: 1 / -1; display: grid; gap: .1rem; padding: .85rem 1.1rem; }
.sampler-head b { font-size: 1rem; }
.sampler-head span { font-size: .82rem; color: var(--sav-color-text-muted); }
.cell { grid-column: 1 / -1; display: grid; gap: .55rem; align-content: start; padding: .85rem 1.1rem 1rem; min-width: 0; }
.cell.half { grid-column: span 1; }
.spec { justify-self: start; font-family: var(--sav-font-mono); font-size: .72rem; color: color-mix(in oklab, var(--sav-color-primary) var(--sav-tint, 62%), var(--sav-color-text)); text-decoration: none; }
.spec:hover { text-decoration: underline; }
.sampler .row { margin-top: 0; }
.cell > :is(sav-progress-ring, sav-rating, sav-switch, sav-radio-group) { justify-self: start; }
.avatars { display: flex; }
.avatars sav-avatar + sav-avatar { margin-left: -.3rem; }
.avatars sav-avatar { --ring: 0 0 0 2px var(--sav-color-surface); } /* the ring follows the avatar shape */
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; padding: 2rem 0 2.75rem; border-top: 1px solid var(--sav-color-border); }
.features h3 { margin: .8rem 0 .3rem; font-size: 1rem; }
.features p { margin: 0; color: var(--sav-color-text-muted); font-size: .9rem; line-height: 1.5; }
.f-ic { display: inline-flex; width: 2.3rem; height: 2.3rem; align-items: center; justify-content: center; color: oklch(from var(--sav-color-primary) calc(l * var(--sav-indicator-l, 1)) c h); --tilt: 10deg; --tilt-bg: color-mix(in oklab, var(--sav-color-primary) 14%, transparent); }
.f-ic svg, .cc-ic svg { width: 1.25rem; height: 1.25rem; }
.sec-title { font-size: 1.4rem; letter-spacing: -.02em; margin: .5rem 0 1.1rem; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.comp-card { display: flex; align-items: flex-start; gap: .8rem; padding: .9rem 1rem; color: var(--sav-color-text); text-decoration: none; --layer-tilt: 0deg; }
.comp-card:hover { --layer-tilt: -3deg; --layer-bg: var(--sav-color-primary); }
.comp-card b { display: block; font-size: .95rem; }
.comp-card small { display: block; font-family: var(--sav-font-mono); font-size: .72rem; color: var(--sav-color-text-muted); margin-top: .1rem; }
.cc-ic { flex: none; display: inline-flex; width: 2.1rem; height: 2.1rem; align-items: center; justify-content: center; color: oklch(from var(--sav-color-primary) calc(l * var(--sav-indicator-l, 1)) c h); --tilt: 10deg; --tilt-bg: var(--sav-color-surface-2); }
.comp-card:hover .cc-ic { --tilt: 0deg; }

/* ---------- doc pages */
.doc-head { margin-bottom: 1.75rem; }
/* the label above a page title is the library's sav-label, so it follows the chosen style */
.eyebrow { margin-bottom: .2rem; }
.doc-head h1 { font-size: 2.3rem; letter-spacing: -.03em; margin: .7rem 0 .4rem; }
.tagline { margin: 0 0 .5rem; }
.main h2 { position: relative; font-size: 1.3rem; letter-spacing: -.015em; margin: 2.4rem 0 .9rem; padding-left: 1.05rem; }
.main h2::before { content: ""; position: absolute; left: 0; top: .42em; width: .5em; height: .5em; background: var(--sav-color-primary); transform: rotate(calc(10deg * var(--lean))); }
.main h3 { font-size: 1rem; margin: 1.5rem 0 .6rem; }
.main p { line-height: 1.65; }
.demo { --layer-tilt: .8deg; margin-bottom: .4rem; }
.demo-view { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: 1.75rem 1.5rem; }
.demo-view > :is(sav-code-block, sav-alert, sav-input, sav-textarea, sav-select, sav-progress-bar, sav-range, sav-range-dual, sav-number-input, sav-tabs, sav-accordion, sav-breadcrumb, sav-header, sav-skeleton, sav-divider, p, form, div:not(.row)) { flex-basis: 100%; }
.demo-view > :is(sav-input, sav-select, sav-textarea) { max-width: 26rem; }
.demo-view > sav-number-input { max-width: 16rem; }
.demo-view > p { margin: 0; }
.demo .doc-code { --sav-radius: 0px; margin: 0; }
.demo .doc-code::part(base) { border-width: 1px 0 0; }
.doc-code { margin: .25rem 0; }
.code { position: relative; background: var(--code-bg); border: 1px solid var(--sav-color-border); border-radius: var(--sav-radius); }
.code pre { margin: 0; padding: 1rem 3.25rem 1rem 1.25rem; overflow-x: auto; font-family: var(--sav-font-mono); font-size: .82rem; line-height: 1.65; color: var(--code-text); tab-size: 2; }
.code .copy { position: absolute; top: .5rem; right: .5rem; }
.tk-t { color: var(--tk-tag); font-style: normal; }
.tk-a { color: var(--tk-attr); font-style: normal; }
.tk-s { color: var(--tk-str); font-style: normal; }
.tk-p { color: var(--tk-punct); font-style: normal; }
.tk-c { color: var(--tk-com); }
.tk-k { color: var(--tk-tag); font-style: normal; }
.tbl { overflow-x: auto; border: 1px solid var(--sav-color-border); border-radius: var(--sav-radius); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .65rem .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--sav-color-border); }
th { background: var(--sav-color-surface-2); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--sav-color-text-muted); }
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }
td:nth-child(2) { color: var(--sav-color-text-muted); }
.pager { display: flex; justify-content: space-between; gap: 1.25rem; margin: 3rem 0 0; }
.pager a { flex: 1; max-width: 48%; padding: .9rem 1.1rem; text-decoration: none; color: var(--sav-color-text); font-weight: 600; --layer-tilt: 0deg; }
.pager a:hover { --layer-tilt: -2deg; --layer-bg: var(--sav-color-primary); }
.pager a { display: flex; align-items: center; gap: .9rem; }
.pager a svg { width: 1.25rem; height: 1.25rem; flex: none; color: var(--sav-color-text-muted); transition: transform .2s var(--sav-easing), color .2s; }
.pager a:hover svg { color: var(--sav-color-primary); transform: translateX(-3px); }
.pager a.nx:hover svg { transform: translateX(3px); }
.pager a.nx { text-align: right; margin-left: auto; justify-content: flex-end; }
.pager a.nx:hover { --layer-tilt: 2deg; }
.pager small { display: block; font-weight: 400; font-size: .78rem; color: var(--sav-color-text-muted); }

/* account */
.account-slot { display: inline-flex; }
.user-btn { padding: 2px; border: 0; background: none; cursor: pointer; border-radius: var(--sav-avatar-radius, 50%); }
.user-btn:focus-visible { outline: 2px solid var(--sav-color-primary); }
.title-row { display: flex; align-items: center; gap: .6rem; }
.small { font-size: .85rem; }
.stack { display: grid; gap: 1rem; }
.form-err:empty { display: none; }
.done-box { display: grid; justify-items: center; text-align: center; gap: .3rem; padding: .5rem 0 1rem; }
.done-box > svg { width: 2.6rem; height: 2.6rem; color: var(--sav-color-primary); }
.done-box h3 { margin: .3rem 0 0; }
.auth-tabs { --sav-tab-padding: 1.1rem 0 0; }
/* SavAccount: its mark (leaning square with a person cut out, a small tile) in the colours of the theme */
.sav-mark { display: block; width: 1.15em; height: 1.15em; flex: none; }
.sav-mark path { fill: color-mix(in oklab, var(--sav-color-primary) 55%, var(--sav-color-text)); }
.sav-mark rect { fill: var(--sav-color-primary); }
.sav-mark-wrap { display: inline-flex; }
.sav-head { display: flex; align-items: flex-start; gap: .75rem; }
.sav-head > .sav-mark { width: 2rem; height: 2rem; margin-top: .15rem; }
.sav-head h3 { margin: 0 0 .2rem; }
.sav-head p { margin: 0; }
.auth-tabs::part(nav) { width: 100%; display: flex; }
.acc-head { display: flex; align-items: center; gap: 1.25rem; }
.acc-head h1 { margin: .5rem 0 .2rem; }
.acc-head p { margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.acc-tabs { margin-top: 1.5rem; }
.tab-actions { margin-bottom: 1rem; }
.empty { display: grid; justify-items: center; gap: .35rem; padding: 2.5rem 1rem; text-align: center; color: var(--sav-color-text-muted); }
.empty > svg { width: 2rem; height: 2rem; }
.empty b { color: var(--sav-color-text); }
.empty p { margin: 0 0 .6rem; max-width: 26rem; }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.fav-card { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .6rem .6rem 1rem; --layer-tilt: 0deg; }
.fav-card:hover { --layer-tilt: -2deg; }
.fav-card a { display: flex; align-items: center; gap: .8rem; color: var(--sav-color-text); text-decoration: none; min-width: 0; }
.fav-card b { display: block; } .fav-card small { display: block; font-family: var(--sav-font-mono); font-size: .72rem; color: var(--sav-color-text-muted); }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.item-card { display: grid; gap: .85rem; padding: 1.1rem; align-content: start; --layer-tilt: .8deg; }
.item-top { display: flex; gap: .8rem; align-items: center; }
.item-name b { display: block; } .item-name small { color: var(--sav-color-text-muted); font-size: .78rem; }
.item-preview, .play-preview { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: center; min-height: 4.5rem; padding: 1rem; background: var(--sav-color-bg); border: 1px dashed var(--sav-color-border); }
.item-preview > :is(sav-input, sav-textarea, sav-range, sav-range-dual, sav-alert, sav-card, sav-progress-bar), .play-preview > :is(sav-input, sav-textarea, sav-range, sav-range-dual, sav-alert, sav-card, sav-progress-bar) { flex: 1 1 100%; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
/* admin */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { display: flex; gap: .8rem; align-items: center; padding: 1rem; --layer-tilt: -.8deg; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.1; } .stat small { color: var(--sav-color-text-muted); font-size: .78rem; }
.adm-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.adm-bar sav-input { flex: 1 1 16rem; max-width: 24rem; }
.adm-user { display: flex; align-items: center; gap: .6rem; }
.adm-user b { display: block; } .adm-user small { color: var(--sav-color-text-muted); }
.adm-table td { vertical-align: middle; }
.nowrap { white-space: nowrap; }
.pager-row { margin-top: .9rem; }
/* playground */
.play { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: 1.25rem; padding: 1.25rem; --layer-tilt: .6deg; }
.play-knobs { display: grid; gap: .8rem; align-content: start; }
.play-bools { display: grid; gap: .5rem; }
.play-out { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; align-content: start; min-width: 0; }
.play-actions { justify-content: flex-end; }
@media (max-width: 760px) { .play { grid-template-columns: 1fr; } .acc-head { flex-direction: column; align-items: flex-start; } }

/* examples page */
.ex-toc { display: flex; flex-wrap: wrap; gap: .6rem .5rem; margin-top: 1rem; }
.uses { margin: -.4rem 0 .9rem; font-size: .85rem; color: var(--sav-color-text-muted); }
.uses code { font-size: .78rem; }
.demo-view > .ex { flex-basis: 100%; }
.demo-view > sav-card.ex { flex-basis: auto; width: 100%; }
.ex-row { display: flex; align-items: center; gap: .85rem; max-width: 30rem; padding: .75rem 1rem; border: 1px solid var(--sav-color-border); border-radius: var(--sav-radius); background: var(--sav-color-surface); }

/* shapes demo */
.shape-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; width: 100%; }
.shape-col { display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; }
.shape-col > b { font-family: var(--sav-font-mono); font-size: .8rem; color: var(--sav-color-text-muted); }
.shape-col > :is(sav-alert, sav-card) { align-self: stretch; }
@media (max-width: 700px) { .shape-row { grid-template-columns: 1fr; } }

/* styles page */
.style-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.style-panel { padding: 1.5rem; display: grid; gap: 1rem; align-content: start; background: var(--sav-color-bg); color: var(--sav-color-text); border: 1px solid var(--sav-color-border); border-radius: var(--sav-radius); }
.style-panel.sav-style-glass { background: radial-gradient(circle at 15% 20%, #ff9a8b 0, transparent 45%), radial-gradient(circle at 85% 30%, #8ec5ff 0, transparent 45%), radial-gradient(circle at 50% 95%, #b8a4ff 0, transparent 50%), var(--sav-color-bg); }
.style-name { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.style-name b { font-size: 1.05rem; }
.style-name code { font-size: .75rem; }

/* demo helpers */
.demo-form { display: grid; gap: 1rem; max-width: 26rem; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; width: 100%; }
.demo-skel { display: flex; gap: 1rem; align-items: center; width: 100%; }
sav-button.fancy::part(base) { background: linear-gradient(135deg, #ff7a59, #5b4cf0); letter-spacing: .04em; text-transform: uppercase; }

/* theming page */
.tokens { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .4rem; }
.tok { display: flex; align-items: center; gap: .55rem; padding: .45rem .65rem; border: 1px solid var(--sav-color-border); border-radius: var(--sav-radius-sm); background: var(--sav-color-surface); font-size: .8rem; min-width: 0; }
.tok code { background: none; padding: 0; flex: none; }
.tok .tv { color: var(--sav-color-text-muted); font-family: var(--sav-font-mono); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; }
.sw { width: 1rem; height: 1rem; flex: none; border-radius: 4px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }

/* customiser */
.themer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.3rem; padding-top: .4rem; }
.themer .t-sec { min-width: 0; }
.t-lbl { font-size: var(--sav-font-size-sm); font-weight: 600; margin-bottom: .5rem; }
/* presets: as many columns as fit the panel (never wider than it), each name shortened with … if it must */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.25rem), 1fr)); gap: .5rem; }
.preset { min-width: 0; }
.preset::part(base) { min-width: 0; max-width: 100%; justify-content: flex-start; }
.pv { display: flex; } .pv i { width: .95rem; height: .95rem; border-radius: 50%; box-shadow: 0 0 0 2px var(--sav-color-surface); } .pv i + i { margin-left: -.25rem; }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .75rem; }
.preset::part(label) { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: .85rem; }
.t-preview { display: grid; gap: .6rem; padding: 1rem; border-radius: var(--sav-radius); background: var(--sav-color-surface-2); }
.t-preview .t-lbl { margin: 0; }

/* glass needs something colourful behind it: soft patches in the blues of the logo */
html.sav-style-glass body { background: radial-gradient(circle at 8% 8%, color-mix(in oklab, var(--sav-color-primary) 22%, transparent) 0, transparent 42%), radial-gradient(circle at 92% 28%, color-mix(in oklab, #4ca2f0 16%, transparent) 0, transparent 40%), radial-gradient(circle at 45% 95%, color-mix(in oklab, #7dd3ff 14%, transparent) 0, transparent 45%), var(--sav-color-bg); background-attachment: fixed; }

/* footer */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 4rem; padding: 1.5rem 0 2rem; border-top: 1px solid var(--sav-color-border); color: var(--sav-color-text-muted); font-size: .85rem; }
.credit { display: inline-flex; align-items: baseline; gap: .35rem; color: var(--sav-color-text-muted); text-decoration: none; }
.credit:hover { color: var(--sav-color-text); }
.credit-name { font-family: "Stack Sans Notch", var(--sav-font); font-size: 1.05rem; color: var(--sav-color-text); }

/* ---------- responsive */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; }
  .hero-logo { padding: 10px; } .hero-logo img { width: 64px; height: 64px; }
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; margin-left: -.4rem; }
  .side { position: fixed; z-index: 15; left: 0; top: var(--top-h); background: var(--sav-color-bg); transform: translateX(-100%); visibility: hidden; transition: transform .25s var(--sav-easing), visibility .25s; }
  .nav-open .side { transform: none; visibility: visible; box-shadow: var(--sav-shadow-lg); }
  .main { padding: 1.5rem 16px 2rem; }
  .search-key { display: none; }
  /* on small screens the search takes only the room that is left, so the top bar never overflows */
  .search-wrap { flex: 1 1 0; min-width: 0; }
  #search { width: 100%; min-width: 0; }
  .top { padding: 0 16px; gap: .6rem; }
  .top-actions { flex: 1; min-width: 0; }
}
@media (max-width: 560px) {
  .ver-pick, .brand > span:not(.logo), .cz-text { display: none; }
  #customizeBtn { flex: none; }
  .hero-demo { padding: .75rem; }
  .hero-demo::before { transform: rotate(calc(4deg * var(--lean))); }
  .hero-demo::after { inset: -3% 2% 3% -2%; transform: rotate(calc(-2.5deg * var(--lean))); }
  .features { grid-template-columns: 1fr; }
  .doc-head h1 { font-size: 1.9rem; }
  .demo-view { padding: 1.25rem 1rem; }
}

/* top bar: style picker and search (the library's sav-search, with its own suggestions) */
.style-pick { width: 8.5rem; flex: none; }
.search-wrap { position: relative; display: flex; align-items: center; gap: .4rem; }
#search { width: 15rem; min-width: 0; }
.search-key { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem; border: 1px solid var(--sav-color-border-strong); border-radius: 4px;
  color: var(--sav-color-text-muted); font: 600 .72rem/1 var(--sav-font-mono, monospace); }

/* playground: names with a help tip */
.knob-l { display: inline-flex; align-items: center; gap: .25rem; }
.tilt-sec { display: grid; gap: .8rem; }

/* icon explorer */
.icon-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1rem; }
.icon-tools sav-input { flex: 1 1 18rem; max-width: 28rem; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr)); gap: .4rem; width: 100%; }
.icon-cell { position: relative; isolation: isolate; display: grid; justify-items: center; gap: .4rem; padding: .85rem .3rem .6rem; border: 0; background: none; color: var(--sav-color-text); cursor: pointer; font: inherit; }
.icon-cell::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--sav-color-surface-2); transition: transform .2s var(--sav-easing), background .2s; }
.icon-cell:hover::before, .icon-cell:focus-visible::before { transform: rotate(calc(-3deg * var(--lean))); background: color-mix(in oklab, var(--sav-color-primary) 18%, transparent); }
.icon-cell sav-icon { font-size: 1.5rem; }
.icon-cell span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; color: var(--sav-color-text-muted); font-family: var(--sav-font-mono); }
@media (max-width: 860px) { .style-pick { width: 7rem; } }
@media (max-width: 560px) { .style-pick { display: none; } }

/* ---------- versions page */
.ver-card { position: relative; display: grid; gap: .4rem; margin: 1.5rem 0; padding: 1.25rem 1.4rem; }
.ver-title { margin: 0; font-size: 1.35rem; }
.ver-card h3 { margin: .8rem 0 .2rem; font-size: 1rem; }
.ver-list { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; line-height: 1.55; }
.ver-rel { border-top: var(--sav-border-width) solid var(--sav-color-border); }
.ver-rel-sum { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ver-rel-sum code { font-size: .8rem; }
.ver-rel p { margin: .2rem 0 .6rem; }
.ver-rel .ver-list { margin-bottom: .6rem; }

/* ---------- accessibility section */
.a11y-sum { display: flex; align-items: center; gap: .5rem; margin: .4rem 0 .8rem; font-weight: 600; color: var(--sav-color-success); }
.a11y-sum.has-fail { color: var(--sav-color-danger); }
.a11y-t th small { display: block; font-weight: 500; font-size: .7rem; color: var(--sav-color-text-muted); }
.a11y-t td:nth-child(n+3) { white-space: nowrap; }
.a11y-r { display: inline-block; min-width: 2.4em; margin-right: .25rem; padding: .05rem .3rem; border-radius: var(--sav-radius-sm); font-size: .78rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.a11y-r.pass { color: color-mix(in oklab, var(--sav-color-success) 70%, var(--sav-color-text)); background: color-mix(in oklab, var(--sav-color-success) 14%, transparent); }
.a11y-r.fail { color: color-mix(in oklab, var(--sav-color-danger) 75%, var(--sav-color-text)); background: color-mix(in oklab, var(--sav-color-danger) 16%, transparent); }
.a11y-notes { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .55rem; }
.a11y-n { display: grid; grid-template-columns: 7.5rem 1fr; gap: .8rem; align-items: start; line-height: 1.5; }
.a11y-st { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 700; }
.a11y-ok .a11y-st { color: color-mix(in oklab, var(--sav-color-success) 70%, var(--sav-color-text)); }
.a11y-partial .a11y-st { color: color-mix(in oklab, var(--sav-color-warning) 70%, var(--sav-color-text)); }
.a11y-you .a11y-st { color: var(--sav-color-text-muted); }
@media (max-width: 640px) { .a11y-n { grid-template-columns: 1fr; gap: .1rem; } }
.fav-slot sav-favourite-button { font-size: 1.15rem; }

/* playground: custom colour = a switch with the colour square next to it (faded while off) */

/* overview: components by group, with a filter */
.comp-tools { display: grid; gap: .7rem; margin: 0 0 1.4rem; }
.comp-tools sav-input { max-width: 22rem; }
.comp-group { margin-bottom: 1.8rem; }
.grp-title { display: flex; align-items: center; gap: .5rem; margin: 0 0 .8rem; font-size: 1.05rem; }
.cc-t { min-width: 0; display: grid; }
.cc-d { margin-top: .3rem; font-size: .8rem; line-height: 1.4; color: var(--sav-color-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-ic sav-icon { font-size: 1.25rem; }
/* the icon tiles: a stronger tint so even thin icons read well */
.cc-ic, .f-ic { --tilt-bg: color-mix(in oklab, var(--sav-color-primary) 22%, var(--sav-color-surface)); }
.comp-card[hidden], .comp-group[hidden] { display: none; }

/* loading skeleton (plain HTML in index.html, so it shows before sav.js has loaded); same look as sav-skeleton */
.sk { display: block; height: 1rem; margin-bottom: .7rem; border-radius: var(--sav-radius-sm); background: linear-gradient(90deg, var(--sav-color-surface-2) 30%, color-mix(in oklab, var(--sav-color-surface-2), var(--sav-color-text) 8%) 50%, var(--sav-color-surface-2) 70%);
      background-size: 300% 100%; animation: sk-sheen 1.6s ease-in-out infinite; }
.sk-page { padding-top: .5rem; }
.sk-h1 { width: 55%; height: 2.6rem; margin-bottom: 1.4rem; } .sk-h2 { width: 38%; height: 1.7rem; margin: 2.2rem 0 1rem; }
.sk-row { display: flex; gap: .75rem; margin: 1.4rem 0 1.8rem; } .sk-btn { width: 8.5rem; height: 2.6rem; margin: 0; }
.sk-card { height: 14rem; border-radius: var(--sav-radius); } .sk-card.sk-short { height: 8rem; margin-top: 1.2rem; }
.side .sk-t { width: 38%; height: .6rem; margin: 0 .65rem .9rem; } .side .sk-l { height: .85rem; margin: 0 .65rem .95rem; max-width: calc(100% - 1.3rem); }
@keyframes sk-sheen { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* phones: the search is a button; open, the field covers the whole header with an X to close it */
.search-toggle, .search-close { display: none; }
@media (max-width: 640px) {
  .search-toggle { display: inline-flex; flex: none; }
  .top-actions { justify-content: flex-end; } /* with the field folded into a button, the buttons sit on the right */
  .search-wrap { display: none; }
  .search-open .search-wrap { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; gap: .5rem; padding: 0 16px; background: var(--sav-color-bg); }
  .search-open .search-wrap #search { flex: 1 1 0; width: auto; }
  .search-open .search-close { display: inline-flex; flex: none; margin-right: -.4rem; }
}
/* phones: Customise shows only its brush, so the button is square like the others */
@media (max-width: 560px) { #customizeBtn::part(base) { width: var(--_h, 2rem); padding: 0; } #customizeBtn::part(label) { display: none; } }

/* ---------------------------------------------------------------- component builder (#builder, docs/builder.js) */
.main.wide { max-width: 1680px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
/* the three columns have their own box, so the side columns stop sticking where they end; the code goes under them */
.bld { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.bld-cols { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1.25rem; align-items: start; }
/* the options folded away: the preview takes the whole width */
.bld-cols.panel-off { grid-template-columns: minmax(0, 1fr) 3.4rem !important; }
/* the options column: a fold handle on its left border; folded, it becomes a rail with an icon for each section */
.bld-panel > .edge-fold { position: absolute; z-index: 3; top: .9rem; left: -.83rem; }
.bld-panel > .edge-fold sav-icon { transform: rotate(180deg); }
.panel-off .bld-panel > .edge-fold sav-icon { transform: none; }
.bld-rail { display: none; flex-direction: column; align-items: center; gap: .25rem; padding: 2.6rem 0 .75rem; }
.panel-off .bld-rail { display: flex; }
.panel-off .bld-scroll { display: none; }
.bld-rail button { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; padding: 0; border: 0; border-radius: var(--sav-radius-sm); background: none; color: var(--sav-color-text-muted); cursor: pointer; }
.bld-rail button:hover, .bld-rail button:focus-visible { color: var(--sav-color-text); background: var(--sav-color-surface-2); }
.bld-rail sav-icon { font-size: 1.15rem; }
/* the top bar: which component (a searchable list with groups and icons, previous / next), then how the preview looks */
.bld-top { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; padding: .85rem 1rem; --layer-tilt: .3deg; }
.bld-choose { display: flex; align-items: center; gap: .45rem; flex: 1 1 24rem; min-width: 0; }
.bld-pick-select { flex: 1; min-width: 0; max-width: 24rem; }
.bld-count { white-space: nowrap; margin-left: .25rem; }
.bld-panel { position: sticky; top: calc(var(--top-h, 3.5rem) + 1rem); max-height: calc(100vh - var(--top-h, 3.5rem) - 2rem); display: flex; flex-direction: column; --layer-tilt: .5deg; }
/* the framed box stays still (its background is a layer of the box): only the list inside scrolls */
.bld-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .4rem 1rem 1rem; scrollbar-width: thin; }
.bld-ic { position: relative; isolation: isolate; display: inline-grid; place-items: center; flex: none; width: 1.8rem; height: 1.8rem; color: var(--sav-color-primary); }
.bld-ic::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: var(--sav-radius-sm); background: color-mix(in oklab, var(--sav-color-primary) 14%, transparent); transform: rotate(calc(-8deg * var(--lean))); }
.bld-ic svg, .bld-ic sav-icon { width: 1.05rem; height: 1.05rem; }
.bld-main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; gap: 1rem; min-width: 0; align-self: stretch; } /* the preview fills the height of the side columns, the event log under it */
/* event log: what the component fired while you used it, newest first */
.bld-log { padding: .7rem 1rem; --layer-tilt: .3deg; min-width: 0; }
.bld-log-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.bld-log-t { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .5rem; min-width: 0; }
.bld-log-t sav-icon { color: var(--sav-color-primary); }
.bld-log-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: 2px; max-height: 11rem; overflow: auto; font-size: .85rem; }
.bld-log-list:empty { display: none; }
.bld-log-list li { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: baseline; gap: .6rem; padding: .3rem .5rem; border-radius: var(--sav-radius-sm); background: var(--sav-color-surface-2); animation: bld-ev .35s var(--sav-easing); }
.bld-log-list li:first-child { background: color-mix(in oklab, var(--sav-color-primary) 12%, var(--sav-color-surface-2)); }
.bld-log-list .ev { font-weight: 700; }
.bld-log-list .from, .bld-log-list .when { color: var(--sav-color-text-muted); font-size: .8rem; white-space: nowrap; }
.bld-log-list .data { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sav-color-text-muted); background: none; padding: 0; }
@keyframes bld-ev { from { opacity: 0; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .bld-log-list li { animation: none; } }
@media (max-width: 560px) { .bld-log-list li { grid-template-columns: auto minmax(0, 1fr); } .bld-log-list .from, .bld-log-list .when { display: none; } }
.bld-about { margin: 0 0 .5rem; }
/* code-like fields (HTML inside, data) in a monospaced font */
sav-textarea.mono { font-family: var(--sav-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); --sav-font-size-md: .82rem; }
.bld-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex: 1 1 auto; }
.bld-bar sav-select { width: 8.5rem; }
.bld-sp { flex: 1; }
/* the stage holds a device of real size: when the page has less room it scrolls, sideways or down, instead of shrinking the device */
.bld-stage { display: block; min-height: 20rem; max-height: max(32rem, 82vh); padding: 1.5rem 1.25rem .75rem; border: 1px dashed var(--sav-color-border); border-radius: var(--sav-radius); background: var(--sav-color-surface-2); overflow: auto; overscroll-behavior: contain; }
.bld-stage.bg-dots { background-color: var(--sav-color-surface-2); background-image: radial-gradient(color-mix(in oklab, var(--sav-color-text) 18%, transparent) 1px, transparent 1.4px); background-size: 14px 14px; }
.bld-frame { width: 100%; min-height: 17rem; display: grid; place-items: center; padding: 2rem 1.5rem; background: var(--sav-color-bg); color: var(--sav-color-text); border: 1px solid var(--sav-color-border); border-radius: var(--sav-radius);
  box-shadow: var(--sav-shadow-sm); transition: max-width .3s var(--sav-easing); font-family: var(--sav-font-family, inherit); }
.bg-surface .bld-frame { background: var(--sav-color-surface); }
.bg-dots .bld-frame { background: transparent; border-style: dashed; box-shadow: none; }
.bld-frame.bg-colour { background: radial-gradient(circle at 15% 20%, #ff9a8b 0, transparent 45%), radial-gradient(circle at 85% 30%, #8ec5ff 0, transparent 45%), radial-gradient(circle at 50% 90%, #b8f2c9 0, transparent 50%), var(--sav-color-bg); }
/* devices: a body like the real one around a screen of the real size (set by builder.js); the screen scrolls its own content */
.bld-device { position: relative; width: max-content; margin: 0 auto; padding: 12px; border-radius: 16px; background: linear-gradient(160deg, #2b3042, #161a26);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .08), 0 0 0 1px rgb(0 0 0 / .35), 0 18px 44px rgb(0 0 0 / .28); }
.bld-device > .bld-frame { display: flex; min-height: 0; overflow: auto; border: 0; border-radius: 6px; box-shadow: none; transition: none; }
.bld-device > .bld-frame > .bld-preview { margin: auto; }
/* desktop: a monitor with a chin and a stand */
.dev-desktop .bld-device { padding: 10px 10px 24px; margin-bottom: 34px; }
.dev-desktop .bld-device::after { content: ""; position: absolute; left: 50%; top: 100%; width: 150px; height: 30px; transform: translateX(-50%);
  background: linear-gradient(#262b3b, #151925); clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%); border-radius: 0 0 6px 6px; }
/* tablet: even bezel, rounder corners */
.dev-tablet .bld-device { padding: 16px; border-radius: 30px; }
.dev-tablet .bld-device > .bld-frame { border-radius: 14px; }
/* phone: thin bezel, very round corners and the camera island (on the side when turned) */
.dev-phone .bld-device { padding: 10px; border-radius: 44px; }
.dev-phone .bld-device > .bld-frame { padding: 2.5rem 1rem 1.25rem; border-radius: 34px; }
.dev-phone .bld-device::before { content: ""; position: absolute; z-index: 2; top: 20px; left: 50%; width: 84px; height: 22px; border-radius: 11px; background: #05060a; transform: translateX(-50%); }
.dev-phone.turned .bld-device > .bld-frame { padding: 1rem 2.75rem 1rem 3.25rem; }
.dev-phone.turned .bld-device::before { top: 50%; left: 20px; width: 22px; height: 84px; transform: translateY(-50%); }
.bld-zoomer { display: inline-flex; align-items: center; gap: .35rem; }
.bld-zoom { position: sticky; left: 0; display: block; margin-top: .75rem; text-align: center; font-size: .72rem; pointer-events: none; }
.bld-preview { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: center; width: 100%; }
/* most components take the whole width of the preview; small ones keep their own size; fields stay at a readable width */
.bld-preview > * { flex: 1 1 100%; min-width: 0; max-width: 100%; }
.bld-preview > :is(sav-button, sav-button-group, sav-badge, sav-tag, sav-chip, sav-chip-group, sav-avatar, sav-icon, sav-spinner, sav-rating, sav-switch, sav-checkbox,
  sav-copy-button, sav-favourite-button, sav-new-label, sav-label, sav-flag, sav-tooltip, sav-info-tip, sav-dropdown, sav-progress-ring, sav-theme-choice, sav-radio-group) { flex: 0 0 auto; }
.bld-preview > :is(sav-input, sav-textarea, sav-select, sav-number-input, sav-date-picker, sav-time-picker, sav-password, sav-search, sav-otp, sav-language-choice, sav-country-choice, sav-range, sav-range-dual) { max-width: 32rem; }
/* the code goes under the three columns, across the whole width */
.bld-code { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; padding: 1rem; --layer-tilt: .4deg; min-width: 0; }
.bld-code-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; }
.bld-setup { font-size: .85rem; }
.bld-setup code { word-break: break-all; }
.bld-code .doc-code { margin: 0; }
.bld-panel-head { display: flex; align-items: center; gap: .65rem; padding: .7rem 0 .4rem; }
.bld-panel-head b { display: block; }
.bld-panel-head code { font-size: .78rem; color: var(--sav-color-text-muted); background: none; padding: 0; }
.bld-sec { display: grid; grid-template-columns: minmax(0, 1fr); gap: .85rem; padding-top: .1rem; }
.bld-bools { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .75rem; }
.bld-evs { display: grid; gap: .4rem; }
.bld-sw { display: inline-block; width: .95rem; height: .95rem; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); vertical-align: middle; }
.sav-style-tilt .bld-sw, .sav-style-sharp .bld-sw { border-radius: 0; transform: rotate(calc(-10deg * var(--lean))); }
.bld-shapes svg { width: 1rem; height: 1rem; display: inline-block; vertical-align: -.15em; margin-right: .25rem; }
.bld-tok { display: flex; align-items: flex-end; gap: .4rem; }
.bld-tok sav-range { flex: 1; }
.bld-tok:not(.on) sav-range { opacity: .65; }
.bld-x { flex: none; visibility: hidden; }
.bld-tok.on .bld-x { visibility: visible; }
@media (max-width: 1380px) { .bld-cols { grid-template-columns: minmax(0, 1fr) 20rem; } }
/* narrower: a slimmer options column, then (phones) the options go under the preview */
@media (max-width: 1180px) {
  .bld-cols { grid-template-columns: minmax(0, 1fr) 18rem; }
}
@media (max-width: 860px) {
  .bld-cols { grid-template-columns: minmax(0, 1fr); }
  .bld-panel { position: relative; top: auto; max-height: none; }
  .bld-panel > .edge-fold, .bld-rail { display: none !important; }
  .panel-off .bld-scroll { display: block; }
  .bld-cols.panel-off { grid-template-columns: minmax(0, 1fr) !important; }
  .bld-scroll { overflow: visible; }
  .bld-hide-sm { display: none; }
  .bld-stage { padding: .75rem .75rem 1.6rem; }
  .bld-top { padding: .7rem .75rem; }
  .bld-choose { flex-basis: 100%; }
  .bld-pick-select { max-width: none; }
}

/* the sidebar link that leaves the documentation (demo site): an external-link icon after the text */
.side a.side-ext { display: flex; align-items: center; gap: .6rem; }
.side a.side-ext svg { width: .85em; height: .85em; flex: none; color: var(--sav-color-text-muted); }

/* ---------------------------------------------------------------- reference: attributes, slots, events, methods (docs/reference.js) */
.ref-h { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.ref-h h2 { margin-bottom: .4rem !important; }
.ref-intro { margin-top: 0; font-size: .92rem; }
.ref-list { border-top: 1px solid var(--sav-color-border); }
.ref-card::part(header) { padding-block: .7rem; align-items: flex-start; }
.ref-card::part(content) { padding-bottom: 1.1rem; }
.ref-sum { display: grid; gap: .2rem; font-weight: 400; }
.ref-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .5rem; }
.ref-name code { font-weight: 600; font-size: .88rem; }
.ref-type { font-size: .8rem; color: var(--sav-color-text-muted); }
.ref-desc { font-size: .9rem; color: var(--sav-color-text-muted); line-height: 1.5; }
.ref-desc a { color: inherit; }
.ref-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; min-width: 0; }
.ref-body > p { margin: 0; }
.ref-body .doc-code { margin: 0; }
.ref-prev { display: flex; flex-wrap: wrap; gap: .75rem; }
.ref-case { flex: 1 1 13rem; display: grid; grid-template-rows: 1fr auto; gap: .4rem; margin: 0; min-width: 0; }
.ref-view { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem; min-height: 4.5rem; padding: 1rem; background: var(--sav-color-bg); border: 1px dashed var(--sav-color-border); border-radius: var(--sav-radius-sm); }
.ref-view > :is(sav-input, sav-textarea, sav-select, sav-range, sav-range-dual, sav-number-input, sav-alert, sav-card, sav-progress-bar, sav-date-picker, sav-time-picker, sav-password, sav-search, sav-otp, sav-container, sav-image, sav-video, sav-audio, sav-showcase, sav-heading) { flex: 1 1 100%; }
.ref-case figcaption { font-family: var(--sav-font-mono, ui-monospace, monospace); font-size: .76rem; color: var(--sav-color-text-muted); text-align: center; word-break: break-word; }
.ref-live { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; align-items: stretch; }
.ref-live > p { margin: 0; align-self: center; }
.ref-runs { display: grid; gap: .6rem; align-content: start; }
.ref-log { display: grid; align-content: start; gap: .25rem; min-height: 4.5rem; padding: .7rem .8rem; border-radius: var(--sav-radius-sm); background: var(--sav-color-surface-2); font-size: .8rem; overflow-wrap: anywhere; }
.ref-log code { background: none; padding: 0; }
.ref-log > div:first-child code { color: var(--sav-color-text); font-weight: 600; }
@media (max-width: 640px) { .ref-live { grid-template-columns: 1fr; } }

/* code in tabs (HTML · JavaScript · TypeScript…): a real tab bar joined to the code block under it */
.code-tabs { --sav-tab-padding: 0; }
.code-tabs::part(nav) { gap: 0; padding: 0 .6rem; background: var(--sav-color-surface); border-top: 1px solid var(--sav-color-border); }
.code-tabs::part(tab) { padding: .6rem .85rem; font-size: var(--sav-font-size-sm); }
.code-tabs .doc-code { margin: 0; --sav-radius: 0px; }
.code-tabs .doc-code::part(base) { border-width: 0; }
/* on its own (builder, reference): the bar and the code make one framed box */
.code-tabs.boxed { border: 1px solid var(--sav-color-border); border-radius: var(--sav-radius); overflow: hidden; }
.code-tabs.boxed::part(nav) { border-top: 0; }
/* the content of a plain sav-details clips what sticks out: a little room on the sides keeps the focus ring of the fields whole */
.bld-acc sav-details::part(content) { padding-inline: 5px; }
.bld-acc sav-details::part(header) { padding-inline: 5px; }
.bld-ic-now { margin-left: auto; width: 1.1rem; height: 1.1rem; color: var(--sav-color-primary); }
.knob-l:has(.bld-ic-now) { display: flex; align-items: center; gap: .3rem; }
/* a notice under the description of a component (browser support and the like) */
.doc-notice { display: block; max-width: 46rem; margin-top: 1rem; }
/* browser support: the oldest version of each browser, then the differences */
.bs-list { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.bs-b { display: inline-flex; align-items: baseline; gap: .35rem; padding: .3rem .6rem; border-radius: var(--sav-radius-sm); background: var(--sav-color-surface-2); font-size: .85rem; font-variant-numeric: tabular-nums; }
.bs-ok .a11y-st { color: color-mix(in oklab, var(--sav-color-success) 70%, var(--sav-color-text)); }
.bs-differs .a11y-st { color: color-mix(in oklab, var(--sav-color-warning) 70%, var(--sav-color-text)); }
.bs-fallback .a11y-st { color: color-mix(in oklab, var(--sav-color-primary) 62%, var(--sav-color-text)); }

/* data fields (charts): a table (UI) or the JSON */
.data-ed { display: grid; gap: .45rem; min-width: 0; }
.de-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.de-top > .knob-l { font-size: .8125rem; font-weight: 650; color: var(--sav-color-text); }
.data-ed[data-mode="ui"] > sav-textarea, .data-ed[data-mode="json"] > .de-ui { display: none; }
.de-ui { display: grid; gap: .5rem; min-width: 0; }
.de-scroll { overflow-x: auto; min-width: 0; padding-bottom: .1rem; }
.de-grid { display: grid; grid-template-columns: minmax(4.5rem, 1.2fr) repeat(var(--de-cols, 1), minmax(3.75rem, 1fr)) 2rem; gap: .35rem; align-items: center; }
.de-map, .de-dates { grid-template-columns: minmax(8rem, 1.8fr) minmax(4rem, 1fr) 2rem; }
.de-row { display: contents; }
.de-h { font-size: .75rem; font-weight: 600; color: var(--sav-color-text-muted); padding-inline: .15rem; }
.de-series { display: grid; gap: .35rem; padding-bottom: .5rem; border-bottom: 1px solid var(--sav-color-border); }
.de-srow { display: grid; grid-template-columns: minmax(0, 1fr) 2rem; gap: .35rem; align-items: center; }
.de-hn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de-grid sav-input, .de-grid sav-select, .de-grid sav-country-choice, .de-grid sav-date-picker { min-width: 0; }
.de-adds { display: flex; flex-wrap: wrap; gap: .4rem; }
.de-note { margin: 0; font-size: .8rem; color: var(--sav-color-text-muted); }

/* what is inside (builder): a form per item (UI) or the HTML */
.kid-ed { display: grid; gap: .45rem; min-width: 0; }
.kid-ed[data-mode="ui"] > sav-textarea, .kid-ed[data-mode="html"] > .ke-ui { display: none; }
.ke-ui { display: grid; gap: .4rem; min-width: 0; }
.ke-item { display: grid; gap: .45rem; min-width: 0; margin-inline-start: calc(var(--lvl, 0) * .9rem); padding: .3rem; border: 1px solid var(--sav-color-border); border-radius: var(--sav-radius-md, .5rem); background: var(--sav-color-surface); }
.ke-item[data-open] { border-color: var(--sav-color-border-strong); }
.ke-row { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.ke-row > sav-input, .ke-row > sav-search { flex: 1; min-width: 0; }
.ke-k { flex: none; min-width: 4.5rem; box-sizing: border-box; text-align: center; padding: .1rem .4rem; border-radius: var(--sav-radius-sm); background: var(--sav-color-surface-2); color: var(--sav-color-text-muted); font-size: .68rem; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; }
.ke-name { flex: 1; min-width: 0; padding-inline: .3rem; font-size: .8rem; color: var(--sav-color-text-muted); }
.ke-more-b::part(base) { transition: transform calc(var(--sav-duration, .2s) * var(--sav-motion, 1)); }
.ke-item[data-open] .ke-more-b { transform: rotate(180deg); }
.ke-more { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .5rem; padding: .15rem .2rem .2rem; }
.ke-more[hidden] { display: none; }
.ke-more > sav-input, .ke-more > sav-textarea { grid-column: 1 / -1; }
.ke-bools, .ke-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.ke-tools { gap: .35rem; }

/* the table in the builder: its columns, then a grid of cells */
.tb-col { display: grid; grid-template-columns: minmax(0, 1fr) auto 2rem; gap: .4rem; align-items: center; }
.tb-grid { grid-template-columns: repeat(var(--de-cols, 1), minmax(4.75rem, 1fr)) 2rem; }

/* home: the banner of SavComponents Academy */
.academy-banner { display: block; margin: 2rem 0 .5rem; }
.ab { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1.25rem 1.5rem; align-items: center; }
.ab-ic { display: block; width: 6rem; height: 6rem; }
.ab-t { display: grid; gap: .7rem; min-width: 0; }
.ab-go { display: grid; gap: .55rem; justify-items: stretch; }
@media (max-width: 760px) { .ab { grid-template-columns: auto minmax(0, 1fr); } .ab-go { grid-column: 1 / -1; display: flex; flex-wrap: wrap; } .ab-ic { width: 4.5rem; height: 4.5rem; } }
