/* site.css: the guide page. Colours are Theme.qml tokens set by desk/theme.js. */
:root {
  /* fallbacks (Catppuccin), overwritten by the script above */
  --base: #29293a; --bar: #2d2e40; --surface: #343547; --surfaceRaised: #42445a;
  --surfaceHover: #4d4f66; --card: rgba(52,53,71,.6); --border: #45475d; --cardBorder: rgba(69,71,93,.35);
  --text: #dde3f7; --textSoft: #c4c9de; --textDim: #a6abc0; --textFaint: #898da1;
  --accent: #cba6f7; --accentDeep: #9e81c0; --accentSoft: rgba(203,166,247,.16); --accentText: #f0e7fd;
  --onAccent: #08080d; --switchKnob: #fbf6fe; --ok: #41b385; --warn: #cb9545; --critical: #d55151;
  --platter: rgba(255,255,255,.065); --platterEdge: rgba(255,255,255,.07); --wash: #fff;
  --wall1: #4a3f66; --wall2: #13131e;

  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --fs-caption: 11px; --fs-label: 12px; --fs-body: 13px; --fs-title: 15px; --fs-heading: 18px; --fs-display: 28px;
  --r-tiny: 6px; --r-small: 9px; --r-medium: 13px; --r: 18px; --r-large: 22px;
  --bar-h: 46px; --border-w: 12px; --frame-r: 16px;
  --curve-spatial: cubic-bezier(.38, 1.21, .22, 1);
  --curve-effects: cubic-bezier(.34, .8, .34, 1);
  --curve-standard: cubic-bezier(.2, 0, 0, 1);
  --d-effects: 200ms; --d-spatial: 420ms;
  --ic-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 11v6M12 7.5v.01'/%3E%3C/svg%3E");
  --ic-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 2.4 18a2 2 0 0 0 1.7 3h15.8a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9.5v4.5M12 17.5v.01'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--bar-h) + 24px); }
html, body { margin: 0; }
body {
  background: var(--wall2);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--onAccent); }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accentText); }

/* ---- The shell frame: bar + border fused into one shape --------------- */
.frame {
  position: fixed; inset: var(--bar-h) var(--border-w) var(--border-w) var(--border-w);
  border-radius: var(--frame-r);
  box-shadow: 0 0 0 100vmax var(--bar);
  pointer-events: none; z-index: 20;
}
.bar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 0 calc(var(--border-w) + 8px);
  background: var(--bar);
  font-size: var(--fs-body);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; white-space: nowrap; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.brand small { color: var(--textDim); font-weight: 400; font-size: var(--fs-label); }
.ws { display: flex; gap: 4px; margin-left: 8px; }
.ws span { font: 500 var(--fs-label)/1 var(--mono); color: var(--textFaint); padding: 6px 9px; border-radius: 999px; }
.ws span.on { background: var(--accent); color: var(--onAccent); }
.spacer { flex: 1; }
.themes { display: flex; gap: 2px; align-items: center; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.themes::-webkit-scrollbar { display: none; }
.themes button {
  all: unset; cursor: pointer; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 7px; height: 32px; box-sizing: border-box; padding: 0 12px; border-radius: 999px;
  color: var(--textDim); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.themes button i { width: 12px; height: 12px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.themes button[aria-pressed="true"] { background: var(--accentSoft); color: var(--accentText); font-weight: 600; }
.themes button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.themes .label { color: var(--textFaint); font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; white-space: nowrap; }

/* StateLayer: hover wash + ripple from the press point */
.sl { position: relative; overflow: hidden; }
/* buttons reset with all: unset lose position; keep the wash inside them */
.sl.sl.sl { position: relative; overflow: hidden; }
.sl::before { content: ""; position: absolute; inset: 0; background: var(--wash); opacity: 0; transition: opacity var(--d-effects) var(--curve-effects); pointer-events: none; }
.sl:hover::before { opacity: .07; }
.ripple { position: absolute; border-radius: 50%; background: var(--wash); opacity: .10; transform: scale(0); pointer-events: none; animation: ripple 520ms var(--curve-standard) forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }


/* ---- Wallpaper inside the frame, like the desktop ------------------- */
.wall { position: fixed; inset: 0; z-index: -1; background: var(--wall2); }
.wall::before { content: ""; position: absolute; inset: 0; background: var(--wallpaper, none) center / cover no-repeat; }
.wall::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--wall2) 52%, transparent), color-mix(in srgb, var(--wall2) 80%, transparent) 70%); }
html { scrollbar-color: var(--surfaceRaised) var(--bar); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---- Hero ------------------------------------------------------------ */
.hero { grid-column: 1 / -1; padding: 40px 0 18px; display: grid; gap: 34px; }
.hero-copy { max-width: 760px; }
.hero h1 { font-size: clamp(34px, 5.4vw, 64px); line-height: 1.02; margin: 0 0 20px; font-weight: 700; letter-spacing: -.03em; text-wrap: balance; text-shadow: 0 2px 24px color-mix(in srgb, var(--wall2) 70%, transparent); }
.hero p { color: var(--text); font-size: 19px; line-height: 1.55; max-width: 62ch; margin: 0; text-wrap: pretty; }
.hero .meta { max-width: none; margin-top: 20px; color: var(--textDim); font: 500 var(--fs-label)/1.4 var(--mono); letter-spacing: .02em; }
.screen { margin: 0; }
.live { position: relative; border-radius: var(--r-large); overflow: hidden; background: var(--bar); aspect-ratio: 16 / 9;
  box-shadow: 0 0 0 1px var(--cardBorder), 0 30px 80px -30px rgba(0,0,0,.7), 0 12px 24px -12px rgba(0,0,0,.4); }
.live > .poster { display: block; width: 100%; height: 100%; object-fit: cover; }
.live.is-live > .poster { display: none; }
.live:fullscreen { border-radius: 0; background: #000; display: flex; align-items: center; justify-content: center; aspect-ratio: auto; }
.live:fullscreen .desk-fit { width: min(100vw, calc(100vh * 16 / 9)); }
.live-ctl { display: flex; align-items: flex-start; gap: 6px; margin-top: 14px; }
.live-ctl[hidden] { display: none; }
.live-keys { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 0; min-width: 0; }
.live-ctl button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; height: 32px; box-sizing: border-box; padding: 0 13px 0 11px; border-radius: 999px;
  background: var(--platter); color: var(--text); font-size: 13px; font-weight: 500; }
.live-ctl .nf { font: normal 13px/1 "NF Icons"; color: var(--accentText); width: 15px; text-align: center; }
.live-ctl button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-ctl button.fs { flex: none; background: var(--accent); color: var(--onAccent); font-weight: 600; }
/* hand-off to an agent, right under the hero copy */
.agent { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 22px 32px; align-items: center;
  background: var(--bar); border-radius: var(--r-large); padding: 24px 26px; box-shadow: 0 1px 0 var(--platterEdge) inset, 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.agent h2 { margin: 0 0 8px; font-size: 26px; letter-spacing: -.02em; }
.hero .agent .agent-copy p { margin: 0; color: var(--textSoft); font-size: 16px; line-height: 1.55; max-width: 46ch; }
.agent-prompt { background: var(--platter); border-radius: var(--r); padding: 16px 18px; }
.hero .agent .agent-prompt p { margin: 0 0 14px; max-width: none; font: 400 13.5px/1.6 var(--mono); color: var(--text); }
.agent-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.agent-repo { font-size: 14px; font-weight: 500; }
@media (max-width: 860px) { .agent { grid-template-columns: minmax(0, 1fr); padding: 20px 18px; } .agent h2 { font-size: 22px; } }
/* "try me" over the middle of the desk, flashing until the first touch, then gone for good */
.live { container-type: inline-size; }
.tryme { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: grid; place-items: center;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--wall2) 55%, transparent), transparent);
  animation: tryme-in 600ms cubic-bezier(.38, 1.21, .22, 1) both; }
.tryme > div { position: relative; display: flex; flex-direction: column; align-items: center; gap: .35em;
  padding: .55em 1.1em .6em; border-radius: 999px; font-size: clamp(14px, 4.2cqw, 54px);
  background: var(--accent); color: var(--onAccent); text-align: center;
  box-shadow: 0 0 0 .08em color-mix(in srgb, var(--onAccent) 25%, transparent) inset, 0 .5em 1.6em -.4em rgba(0,0,0,.7);
  animation: tryme-flash 1.1s cubic-bezier(.34, .8, .34, 1) infinite; }
.tryme b { font-size: 1em; line-height: 1; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.tryme span { font-size: max(.36em, 9px); line-height: 1; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; opacity: .8; }
.tryme > div::before, .tryme > div::after { content: ""; position: absolute; inset: 0; border-radius: inherit;
  border: .06em solid var(--accent); animation: tryme-ring 1.1s ease-out infinite; }
.tryme > div::after { animation-delay: .55s; }
.tryme.gone { animation: tryme-out 260ms cubic-bezier(.34, .8, .34, 1) forwards; }
.tryme[hidden] { display: none; }
@keyframes tryme-in { from { opacity: 0; transform: scale(.7); } }
@keyframes tryme-out { to { opacity: 0; transform: scale(1.15); } }
@keyframes tryme-flash {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  12% { transform: scale(1.07); filter: brightness(1.35) saturate(1.2); }
  30% { transform: scale(.98); filter: brightness(.95); }
  50% { transform: scale(1.02); filter: brightness(1.1); } }
@keyframes tryme-ring { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.35, 1.9); } }
@media (prefers-reduced-motion: reduce) { .tryme, .tryme > div, .tryme > div::before, .tryme > div::after { animation: none; } }
@media (max-width: 640px) {
  .live-ctl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 6px; margin-top: 10px;
    background: var(--bar); border-radius: var(--r); box-shadow: 0 0 0 1px var(--cardBorder); }
  .live-keys { display: contents; }
  .live-ctl button { flex-direction: column; justify-content: center; gap: 5px; padding: 9px 2px 8px; border-radius: var(--r-small);
    background: transparent; font-size: 11px; line-height: 1.15; text-align: center; }
  .live-ctl .nf { font-size: 17px; width: auto; }
  .live-ctl button.fs { grid-column: 1 / -1; flex-direction: row; min-height: 0; padding: 11px; font-size: 13px; margin: 2px 0 0;
    border-radius: var(--r-small); }
}
.gallery .try { all: unset; cursor: pointer; align-self: flex-start; margin-top: 8px; display: inline-flex; align-items: center; height: 32px; box-sizing: border-box; padding: 0 13px; border-radius: 999px;
  background: var(--platter); color: var(--text); font-size: 13px; font-weight: 500; }
.gallery .try:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Gallery --------------------------------------------------------- */
.gallery { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.gallery figure { margin: 0; background: var(--base); border-radius: var(--r); padding: 12px 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.gallery img { display: block; width: 100%; height: auto; border-radius: var(--r-medium); }
.gallery figcaption { display: flex; flex-direction: column; gap: 3px; padding: 0 4px; font-size: 13px; color: var(--textDim); line-height: 1.5; }
.gallery figcaption b { color: var(--text); font-size: var(--fs-title); font-weight: 600; }
.gallery kbd { font-size: 11px; padding: 1px 6px; }
.g-launch { grid-column: span 3; grid-row: span 2; }
.g-launch { justify-content: space-between; }
.g-launch img { margin: auto 0; }
.g-sys { grid-column: span 3; }
.g-set { grid-column: span 3; }
.g-sys, .g-set { flex-direction: row !important; align-items: center; }
.g-sys img, .g-set img { width: 52%; }
.g-calc { grid-column: span 3; }
.g-audio { grid-column: span 3; justify-content: center; }
.g-themes { grid-column: 1 / -1; }

/* ---- Bar anatomy ----------------------------------------------------- */
.barshot { margin: 12px 0 0; background: var(--base); border-radius: var(--r-medium); padding: 6px 10px; overflow: hidden; }
.barshot img { display: block; width: 100%; height: auto; }
.anatomy { list-style: none; padding: 0; margin: 14px 0 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 6px 26px; counter-reset: a; }
.anatomy li { counter-increment: a; position: relative; padding-left: 30px; margin: 4px 0; font-size: 15px; }
.anatomy li::before { content: counter(a); position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--accentSoft); color: var(--accentText); font: 600 11px/20px var(--mono); text-align: center; }

/* ---- Shortcuts as keycap tiles ------------------------------------- */
.keys { background: none; overflow: visible; }
.keys table, .keys tbody { display: block; min-width: 0 !important; }
.keys thead { display: none; }
.keys tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.keys tr { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--platter); border-radius: var(--r-medium); box-shadow: 0 1px 0 var(--platterEdge) inset; }
.keys td, .keys tbody tr:nth-child(even) td { padding: 0; border: 0 !important; font-size: 14px; width: auto; background: none; }
.keys kbd { font-size: 12px; padding: 3px 8px; }

/* ---- Layout ----------------------------------------------------------- */
.page {
  padding: calc(var(--bar-h) + 28px) calc(var(--border-w) + 28px) calc(var(--border-w) + 40px);
  display: grid; grid-template-columns: 220px minmax(0, 1060px); gap: 28px 36px; justify-content: center;
}
nav.toc { position: sticky; top: calc(var(--bar-h) + 24px); align-self: start; max-height: calc(100vh - var(--bar-h) - 60px); overflow: auto; background: var(--bar); border-radius: var(--r-large); padding: 16px 8px; box-shadow: 0 1px 0 var(--platterEdge) inset, 0 18px 50px -24px rgba(0,0,0,.5); }
nav.toc .cap { font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .08em; color: var(--textFaint); margin: 0 0 8px 12px; }
nav.toc { display: flex; flex-direction: column; gap: 4px; }
nav.toc a { display: block; color: var(--textDim); text-decoration: none; font-size: var(--fs-body); padding: 6px 12px; border-radius: var(--r-small); }
nav.toc a:hover { color: var(--text); background: var(--platter); }
nav.toc a.on { color: var(--accentText); background: var(--accentSoft); }
nav.toc a.star::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }

main { min-width: 0; }

section.panel {
  background: var(--surface);
  border-radius: var(--r-large);
  padding: 36px 40px 40px;
  margin: 0 0 24px;
  box-shadow: 0 1px 0 var(--platterEdge) inset, 0 18px 50px -20px rgba(0,0,0,.45);
}
section.panel > h2 {
  display: flex; align-items: baseline; gap: 12px;
  font-size: 30px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 10px; font-weight: 700;
}
section.panel > .lead { color: var(--textSoft); font-size: 17px; margin: 0 0 18px; }
h3 { font-size: 19px; margin: 36px 0 10px; font-weight: 600; letter-spacing: -.01em; }
p, li { color: var(--textSoft); }
strong { color: var(--text); font-weight: 600; }
ul, ol { padding-left: 22px; }
li { margin: 6px 0; }
li::marker { color: var(--textFaint); }
code { font: 400 .86em var(--mono); background: var(--platter); padding: 2px 6px; border-radius: var(--r-tiny); color: var(--text); overflow-wrap: anywhere; }
pre {
  background: var(--base); border: 1px solid var(--cardBorder); border-radius: var(--r-medium);
  padding: 16px 18px; overflow-x: auto; margin: 14px 0 18px;
  font: 400 13px/1.65 var(--mono); color: var(--textSoft);
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; }
pre .c { color: var(--textFaint); }
.tw { overflow-x: auto; margin: 14px 0 18px; border-radius: var(--r-medium); background: var(--platter); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 11px 16px; vertical-align: top; }
td:first-child:nth-last-child(2), th:first-child:nth-last-child(2) { width: 34%; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--text) 3.5%, transparent); }
th { font-size: var(--fs-caption); text-transform: uppercase; letter-spacing: .07em; color: var(--textFaint); font-weight: 600; border-bottom: 1px solid color-mix(in srgb, var(--text) 16%, transparent); }
td { color: var(--textSoft); border-bottom: 1px solid color-mix(in srgb, var(--text) 8%, transparent); }
tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--text); }
td code { white-space: nowrap; overflow-wrap: normal; }
kbd { font: 500 12px var(--mono); background: var(--surfaceRaised); border-radius: var(--r-tiny); padding: 2px 7px; color: var(--text); box-shadow: 0 1px 0 var(--borderStrong); white-space: nowrap; }

.platter:not(.desk *) { background: var(--platter); border-radius: var(--r); padding: 16px 18px; box-shadow: 0 1px 0 var(--platterEdge) inset; }
.callout { display: grid; grid-template-columns: 20px 1fr; gap: 12px; align-items: start; background: var(--accentSoft); border-radius: var(--r-medium); padding: 15px 18px; margin: 18px 0; }
.callout::before { content: ""; width: 20px; height: 20px; margin-top: 2px; background: var(--accent);
  -webkit-mask: var(--ic-info) center / contain no-repeat; mask: var(--ic-info) center / contain no-repeat; }
.callout p { margin: 0; color: var(--text); }
.callout.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); }
.callout.warn::before { background: var(--warn); -webkit-mask-image: var(--ic-warn); mask-image: var(--ic-warn); }

.pill { display: inline-block; font: 500 var(--fs-caption)/1 var(--mono); padding: 5px 9px; border-radius: 999px; background: var(--platter); color: var(--textDim); white-space: nowrap; }
.pill.ok { color: color-mix(in srgb, var(--ok) 35%, var(--text)); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.no { color: color-mix(in srgb, var(--critical) 30%, var(--text)); background: color-mix(in srgb, var(--critical) 12%, transparent); }
.pill.mid { color: color-mix(in srgb, var(--warn) 35%, var(--text)); background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* ---- Style section specimens ----------------------------------------- */
.principles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.principles .platter h4 { margin: 0 0 4px; font-size: var(--fs-title); color: var(--text); }
.principles .platter p { margin: 0; font-size: 14px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; margin: 14px 0; }
.sw { border-radius: var(--r-medium); overflow: hidden; background: var(--platter); }
.sw .chip { height: 54px; border-bottom: 1px solid var(--cardBorder); }
.sw .meta { padding: 8px 10px; }
.sw b { display: block; font: 500 12px var(--mono); color: var(--text); }
.sw span { font: 400 11px var(--mono); color: var(--textFaint); }
.typescale .row { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--cardBorder); }
.typescale .row:last-child { border-bottom: 0; }
.typescale .tok { font: 400 12px var(--mono); color: var(--textFaint); }
.typescale .s { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radii { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0; }
.radii div { width: 92px; height: 70px; background: var(--surfaceRaised); display: grid; place-items: center; font: 400 11px var(--mono); color: var(--textDim); text-align: center; line-height: 1.3; }

.demo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 18px 0; border-radius: var(--r); overflow: hidden; background: var(--wall2); position: relative; min-height: 300px; }
.demo .mbar { height: 40px; background: var(--bar); display: flex; align-items: center; gap: 6px; padding: 0 10px; position: relative; z-index: 2; }
.demo .mbar .clock { margin: 0 auto; font: 500 13px var(--mono); color: var(--text); }
.demo .mbtn { all: unset; cursor: pointer; padding: 5px 10px; border-radius: var(--r-small); font-size: 13px; color: var(--textDim); }
.demo .mbtn.on { background: var(--accentSoft); color: var(--accentText); }
.demo .mframe { position: absolute; inset: 40px 8px 8px 8px; border-radius: 12px; box-shadow: 0 0 0 200px var(--bar); pointer-events: none; z-index: 1; }
.demo .mpanel {
  position: absolute; top: 40px; right: 8px; width: min(280px, calc(100% - 16px)); z-index: 3;
  background: var(--bar); border-radius: 0 0 var(--r) var(--r); padding: 14px;
  clip-path: inset(0 0 100% 30% round 0 0 var(--r) var(--r)); opacity: 0;
  transition: clip-path var(--d-spatial) var(--curve-spatial), opacity var(--d-effects) var(--curve-effects);
}
.demo .mpanel.open { clip-path: inset(0 0 0 0 round 0 0 var(--r) var(--r)); opacity: 1; }
.demo .mpanel .platter { padding: 12px; margin-bottom: 8px; border-radius: var(--r); }
.demo .mpanel .platter:last-child { margin-bottom: 0; }
.meter { height: 6px; border-radius: 3px; background: var(--platter); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.toggle { width: 38px; height: 22px; border-radius: 11px; background: var(--accent); position: relative; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--switchKnob); }
.rowflex { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--text); }
.rowflex small { color: var(--textDim); font-size: 12px; }
.demo .hint { position: absolute; bottom: 18px; left: 22px; z-index: 2; color: var(--textDim); font-size: 13px; max-width: 60%; }

.btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; height: 36px; box-sizing: border-box; padding: 0 18px; border-radius: 999px; background: var(--accent); color: var(--onAccent); font-weight: 600; font-size: 14px; }

.check { list-style: none; padding: 0; }
.check li { padding-left: 30px; position: relative; }
.check li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--accent); }

footer { color: var(--textFaint); font-size: var(--fs-label); padding: 10px 4px 0; }

@media (max-width: 960px) {
  .page { grid-template-columns: minmax(0, 1fr); padding-left: 24px; padding-right: 24px; }
  nav.toc { display: none; }
  .hero { padding-top: 24px; }
}
@media (max-width: 720px) {
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .gallery figure { grid-column: auto !important; grid-row: auto !important; }
  .g-sys, .g-set { flex-direction: column !important; align-items: stretch; }
  .g-sys img, .g-set img { width: 100%; }
  .keys tbody { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  :root { --border-w: 6px; --frame-r: 12px; --bar-h: 50px; }
  .page { padding: calc(var(--bar-h) + 14px) 16px 30px; }
  .ws, .brand small, .themes .label { display: none; }
  .themes button { padding: 0 9px; }
  .themes button .nm { display: none; }
  .themes button[aria-pressed="true"] .nm { display: inline; }
  section.panel { padding: 24px 18px 26px; border-radius: var(--r); }
  section.panel > h2 { font-size: 24px; }
  .hero p { font-size: 17px; }
  .live { border-radius: var(--r-medium); }
  .gallery figure { padding: 10px 10px 12px; }
  .principles { grid-template-columns: minmax(0, 1fr); }
  .typescale .row { grid-template-columns: 1fr; gap: 2px; }
  pre { padding: 14px; font-size: 12px; }
  .tw table { min-width: 560px; }
  td code { overflow-wrap: normal; white-space: nowrap; }
  .demo .hint { max-width: 80%; bottom: 14px; left: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* prose keeps a readable measure inside the wider column */

/* language switch + credit, right end of the bar */
.lang { display: flex; gap: 2px; margin-left: 10px; height: 32px; box-sizing: border-box; padding: 3px; border-radius: 999px; background: var(--platter); flex: none; }
.lang a { display: flex; align-items: center; font-size: 13px; font-weight: 500; color: var(--textDim); text-decoration: none; padding: 0 10px; border-radius: 999px; }
.lang a:hover { color: var(--text); }
.lang a[aria-current="true"] { background: var(--accentSoft); color: var(--accentText); font-weight: 600; }
.by { flex: none; margin-left: 10px; display: inline-flex; align-items: center; gap: 5px; height: 32px; box-sizing: border-box; padding: 0 14px; border-radius: 999px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 13px; white-space: nowrap; background: var(--platter); }
.by:hover { color: var(--text); }
.by .by-l { color: var(--textDim); font-weight: 500; }
@media (max-width: 960px) { .by .by-l { display: none; } }
@media (max-width: 640px) { .lang { margin-left: 6px; } .lang a { padding: 0 8px; } .by { margin-left: 6px; padding: 0 11px; } }
@media (max-width: 640px) {
  .themes { flex: 0 1 auto; }
  .themes button[aria-pressed="true"] .nm { display: none; }
  .themes button { padding: 0 7px; flex-shrink: 0; }
  .themes button i { flex-shrink: 0; }
}
@media (max-width: 480px) { .brand { font-size: 0; gap: 0; } }
