/* ==========================================================================
 * BMX showcase - the demo application's own styling
 * ==========================================================================
 *
 * Note what is NOT here: any styling of the components themselves. The
 * showcase deliberately uses BMX exactly as a customer would - attributes and
 * tokens only - so that anything looking wrong on this page is a real defect
 * rather than something the demo page papered over.
 *
 * The shell reads the same `--bmx-*` tokens the library does, which is how
 * changing the theme picker retints the entire page and not just the widgets.
 * ========================================================================== */

* { box-sizing: border-box; }

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--bmx-surface-sunken);
  color: var(--bmx-text);
  font-family: var(--bmx-font-family);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bmx-primary-soft-text); }

/* -- Layout ---------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-block-size: 100vh;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; block-size: auto; border-inline-end: 0; border-block-end: 1px solid var(--bmx-border); }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; }
}

.sidebar {
  position: sticky;
  inset-block-start: 0;
  block-size: 100vh;
  overflow-y: auto;
  padding: 22px 18px;
  border-inline-end: 1px solid var(--bmx-border);
  background: var(--bmx-surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block-end: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  inline-size: 34px;
  block-size: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--bmx-primary-solid), var(--bmx-accent-solid));
  color: var(--bmx-primary-on-solid);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
}

.brand-name { font-weight: 650; letter-spacing: -0.01em; }
.brand-sub { color: var(--bmx-text-subtle); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; }

.sidebar-heading {
  margin: 18px 0 6px;
  color: var(--bmx-text-subtle);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sidebar-nav a {
  display: block;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--bmx-text-muted);
  text-decoration: none;
  font-size: 13.5px;
}

.sidebar-nav a:hover { background: var(--bmx-surface-hover); color: var(--bmx-text); }
/* The section currently in view, set by the scrollspy in showcase.js. It is a
 * *position* indicator, not a "this one is built" one - four links wearing it at
 * once is four answers to "where am I", which is none. */
.sidebar-nav a.is-active { background: var(--bmx-primary-soft); color: var(--bmx-primary-soft-text); font-weight: 550; }
.sidebar-nav a.is-soon { opacity: 0.5; cursor: default; }
.sidebar-nav a.is-soon:hover { background: none; color: var(--bmx-text-muted); }

.main { min-inline-size: 0; }

/* -- Toolbar --------------------------------------------------------------- */

.toolbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 12px 26px;
  border-block-end: 1px solid var(--bmx-border);
  background: color-mix(in oklab, var(--bmx-surface) 88%, transparent);
  backdrop-filter: blur(12px);
}

.control {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--bmx-text-muted);
}

.control select,
.control input[type='search'] {
  padding: 5px 9px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md);
  background: var(--bmx-surface);
  color: var(--bmx-text);
  font: inherit;
  font-size: 12.5px;
}

.control label { user-select: none; }

.spacer { flex: 1 1 auto; }

/* -- Hero ------------------------------------------------------------------ */

.hero {
  padding: 46px 26px 30px;
  border-block-end: 1px solid var(--bmx-border);
  background:
    radial-gradient(1100px 300px at 12% -40%, color-mix(in oklab, var(--bmx-primary) 20%, transparent), transparent 70%),
    radial-gradient(900px 280px at 88% -30%, color-mix(in oklab, var(--bmx-accent) 16%, transparent), transparent 70%),
    var(--bmx-surface);
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.hero p {
  margin: 0;
  max-inline-size: 62ch;
  color: var(--bmx-text-muted);
  font-size: 15.5px;
}

/* The hero's paragraphs have no margin of their own, so a second one needs the
 * gap put back rather than inheriting a collapse that was never there. */
.hero p + p { margin-block-start: 12px; }

.pills { display: flex; flex-wrap: wrap; gap: 7px; margin-block-start: 18px; }

.pill {
  padding: 3px 11px;
  border: 1px solid var(--bmx-border);
  border-radius: 999px;
  background: var(--bmx-surface-raised);
  color: var(--bmx-text-muted);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.02em;
}

/* -- Sections -------------------------------------------------------------- */

.content { padding: 26px; display: grid; gap: 22px; max-inline-size: 1180px; }

.section {
  border: 1px solid var(--bmx-border);
  border-radius: 14px;
  background: var(--bmx-surface);
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-block-end: 1px solid var(--bmx-border);
}

.section-head h2 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.section-head p { margin: 0; flex: 1 1 260px; color: var(--bmx-text-muted); font-size: 13px; }

.demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
}

.demo.column { flex-direction: column; align-items: flex-start; }

.demo-label {
  inline-size: 100%;
  margin-block-end: -4px;
  color: var(--bmx-text-subtle);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/*
 * The sentence *after* a demonstration.
 *
 * Not `.demo-label`, which is a heading: uppercased and letter-spaced, which is
 * right for two or three words above a demo and unreadable for the sentence
 * underneath it explaining what just happened. These pages are the argument for
 * the library, and a paragraph set in small caps is not read.
 */
.demo-note {
  inline-size: 100%;
  max-inline-size: 78ch;
  margin-block-start: 2px;
  color: var(--bmx-text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.demo-note code,
.demo-label code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--bmx-surface-sunken);
  font-family: var(--bmx-font-family-mono);
  font-size: 0.92em;
}

/*
 * The live readout under a demonstration - what the form would receive, what
 * the event carried, what the component decided. Monospaced, because every one
 * of them is a value rather than prose, and a value in the body face invites
 * the reader to skim it.
 */
.demo-out {
  inline-size: 100%;
  min-block-size: 1.3em;
  color: var(--bmx-success-soft-text);
  font-family: var(--bmx-font-family-mono);
  font-size: 12.5px;
  line-height: 1.5;
}

/*
 * The panel a context menu is demonstrated on.
 *
 * It has to be big enough that a right-click near its edges shows the menu
 * flipping and clamping - a 40-pixel strip would only ever demonstrate the easy
 * case, which is the one nobody doubts.
 */
.menu-canvas {
  display: grid;
  place-items: center;
  inline-size: 100%;
  min-block-size: 9rem;
  border: 1px dashed var(--bmx-border);
  border-radius: var(--bmx-radius-lg);
  background: var(--bmx-surface-sunken);
  color: var(--bmx-text-muted);
  font-size: 13px;
  user-select: none;
}

/*
 * The menu bar and the document it drives.
 *
 * The document is a real element whose classes the View menu changes, not a
 * picture of one: a menu demonstration that only logs what was chosen proves
 * the menu opens and nothing else, and what a visitor wants to know is whether
 * choosing something in it *does* anything.
 */
.menu-bar {
  display: flex;
  gap: 2px;
  inline-size: 100%;
  padding: 4px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md) var(--bmx-radius-md) 0 0;
  border-block-end: 0;
  background: var(--bmx-surface-sunken);
}

.doc {
  inline-size: 100%;
  min-block-size: 8.5rem;
  max-block-size: 14rem;
  padding: 12px 14px;
  border: 1px solid var(--bmx-border);
  border-radius: 0 0 var(--bmx-radius-md) var(--bmx-radius-md);
  background: var(--bmx-surface);
  color: var(--bmx-text);
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
  counter-reset: doc-line;
}

.doc p {
  margin: 0;
  white-space: pre;
  overflow-x: auto;
}

/* Word wrap, off by default so that turning it on is visible. */
.doc.is-wrapped p {
  white-space: pre-wrap;
  overflow-x: visible;
}

.doc.is-numbered p::before {
  counter-increment: doc-line;
  content: counter(doc-line);
  display: inline-block;
  inline-size: 2ch;
  margin-inline-end: 12px;
  color: var(--bmx-text-subtle);
  text-align: right;
  user-select: none;
}

.doc.is-mono { font-family: var(--bmx-font-family-mono); font-size: 12.5px; }
.doc.is-serif { font-family: Georgia, 'Times New Roman', serif; }

.doc p.is-new {
  animation: bmx-doc-in var(--bmx-duration-base, 190ms) var(--bmx-ease-emphasis, ease-out);
  color: var(--bmx-success-soft-text);
}

@keyframes bmx-doc-in {
  from { opacity: 0; translate: 0 -4px; }
  to { opacity: 1; translate: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .doc p.is-new { animation: none; }
}

/*
 * The records table and the drawer's detail list.
 *
 * A plain table, deliberately: it costs nothing against the demo budget, and
 * the argument the section is making is about the drawer beside a list rather
 * than about a list component this library does not yet have.
 */
.records {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.records th,
.records td {
  padding: 9px 12px;
  border-block-end: 1px solid var(--bmx-border);
  text-align: start;
}

.records th {
  color: var(--bmx-text-subtle);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.records .num { text-align: end; font-family: var(--bmx-font-family-mono); }

.records tbody tr {
  cursor: pointer;
  transition: background-color var(--bmx-duration-fast, 120ms) var(--bmx-ease-standard, ease);
}

.records tbody tr:hover { background: var(--bmx-surface-hover); }

.records tbody tr:focus-visible {
  outline: var(--bmx-focus-ring-width) solid var(--bmx-focus-ring-color);
  outline-offset: -2px;
}

.records .tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--bmx-radius-pill);
  background: var(--bmx-surface-sunken);
  color: var(--bmx-text-muted);
  font-size: 11.5px;
}

.records .tag.is-paid { background: var(--bmx-success-soft); color: var(--bmx-success-soft-text); }
.records .tag.is-late { background: var(--bmx-danger-soft); color: var(--bmx-danger-soft-text); }

.record { margin: 0; display: grid; grid-template-columns: 9rem 1fr; gap: 8px 16px; font-size: 13px; }
.record dt { color: var(--bmx-text-muted); }
.record dd { margin: 0; }

/*
 * A box the reader can drag narrower, for the toolbar demonstration.
 *
 * `resize` needs a scroll container to act on, hence the `overflow`. The
 * padding at the bottom is for the resize handle itself, which would otherwise
 * sit on top of the toolbar's own border.
 */
.resizable {
  inline-size: 100%;
  min-inline-size: 12rem;
  max-inline-size: 100%;
  padding-block-end: 10px;
  overflow: auto;
  resize: horizontal;
}

/* --------------------------------------------------------------------------
 * The records browser
 *
 * A splitter, a breadcrumb and a pagination control doing one job. Everything
 * inside the panes is plain markup on purpose: the section is about the three
 * components, and a demonstration that spent its element budget on a table
 * would have less room to make its point with.
 * ----------------------------------------------------------------------- */

.folders {
  block-size: 320px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md);
  overflow: hidden;
}

.folders-tree {
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
  background: var(--bmx-surface-sunken);
  block-size: 100%;
}

.tree-item {
  display: block;
  inline-size: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--bmx-radius-sm);
  background: transparent;
  color: var(--bmx-text-subtle);
  font: inherit;
  font-size: 13px;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.tree-item:hover {
  background: var(--bmx-surface-hover);
  color: var(--bmx-text);
}

.tree-item.is-current {
  background: var(--bmx-surface);
  color: var(--bmx-text);
  font-weight: 500;
}

.folders-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  block-size: 100%;
  min-inline-size: 0;
}

.folders-table {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow: auto;
  font-size: 13px;
}

.folders-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 12px;
  padding: 6px 2px;
  border-block-end: 1px solid var(--bmx-border);
  color: var(--bmx-text-subtle);
}

.folders-row:last-child {
  border-block-end: 0;
}

.folders-name {
  color: var(--bmx-text);
}

.folders-who,
.folders-when {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
 * The toolbar's document
 *
 * Small, and it has to visibly change: a toolbar demonstration that only prints
 * which button was pressed proves the button works and nothing about the bar.
 * ----------------------------------------------------------------------- */

.tb-doc {
  inline-size: 100%;
  min-block-size: 5.5rem;
  padding: 12px 14px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md);
  background: var(--bmx-surface);
  color: var(--bmx-text);
  font-size: 13px;
  line-height: 1.6;
}

.tb-doc p,
.tb-doc ul,
.tb-doc ol {
  margin: 0;
}

.tb-doc ul,
.tb-doc ol {
  padding-inline-start: 1.4em;
}

.tb-doc.is-bold { font-weight: 700; }
.tb-doc.is-italic { font-style: italic; }
.tb-doc.is-underline { text-decoration: underline; text-underline-offset: 0.18em; }

.tb-image {
  display: grid;
  place-items: center;
  block-size: 3.25rem;
  margin-block-start: 10px;
  border: 1px dashed var(--bmx-border);
  border-radius: var(--bmx-radius-sm);
  color: var(--bmx-text-subtle);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
 * Inside a tab panel and an accordion panel
 * ----------------------------------------------------------------------- */

.panel-lead {
  margin: 0;
}

.panel-note {
  margin: 8px 0 0;
  color: var(--bmx-text-subtle);
  font-size: 13px;
  line-height: 1.6;
}

.panel-link {
  margin-inline-start: 6px;
  color: var(--bmx-primary);
}

.mini {
  margin-block-start: 10px;
  padding: 4px 10px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md);
  background: var(--bmx-surface);
  color: var(--bmx-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.mini:hover:not(:disabled) {
  background: var(--bmx-surface-hover);
}

.mini:disabled {
  cursor: default;
  opacity: 0.6;
}

/*
 * The splitter demonstration needs a height, because a splitter has none of its
 * own: every pane in it is filled by whoever is using it, so the component is
 * told how tall it is rather than working it out. The border is on the wrapper
 * so the panes can scroll inside it without a second frame appearing.
 */
.split-demo {
  block-size: 220px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md);
  overflow: hidden;
}

.split-pane {
  padding: 14px 16px;
}

.split-pane p {
  margin: 8px 0 0;
  color: var(--bmx-text-subtle);
  font-size: 13px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
 * Inside a popover
 * ----------------------------------------------------------------------- */

.po-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.po-heading {
  margin: 0;
  font-size: 14px;
}

.po-body {
  margin: 0;
  color: var(--bmx-text-subtle);
  line-height: 1.55;
}

.code-toggle {
  display: flex;
  justify-content: flex-end;
  padding: 0 20px 12px;
}

.code-toggle button {
  padding: 4px 10px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md);
  background: var(--bmx-surface-sunken);
  color: var(--bmx-text-muted);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.code-toggle button:hover { background: var(--bmx-surface-hover); color: var(--bmx-text); }

pre.code {
  margin: 0;
  padding: 16px 20px;
  border-block-start: 1px solid var(--bmx-border);
  background: var(--bmx-surface-sunken);
  color: var(--bmx-text-muted);
  font-family: var(--bmx-font-family-mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-x: auto;
}

pre.code[hidden] { display: none; }

/* -- Playground ------------------------------------------------------------ */

.playground { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0; }

@media (max-width: 860px) {
  .playground { grid-template-columns: 1fr; }
  .playground-controls { border-inline-start: 0; border-block-start: 1px solid var(--bmx-border); }
}

.playground-stage {
  display: grid;
  place-items: center;
  min-block-size: 210px;
  padding: 26px;
  /* A faint dot grid, so the stage reads as a canvas without competing with
   * the component sitting on it. */
  background:
    radial-gradient(color-mix(in oklab, var(--bmx-border) 70%, transparent) 1px, transparent 1px) 0 0 / 18px 18px,
    var(--bmx-surface);
}

.playground-controls {
  padding: 16px;
  border-inline-start: 1px solid var(--bmx-border);
  background: var(--bmx-surface-sunken);
  display: grid;
  gap: 9px;
  align-content: start;
  max-block-size: 460px;
  overflow-y: auto;
}

.field { display: grid; gap: 3px; font-size: 12px; }
.field > span { color: var(--bmx-text-subtle); font-weight: 600; letter-spacing: 0.02em; }

.field select,
.field input[type='text'],
.field input[type='number'] {
  padding: 5px 8px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-sm);
  background: var(--bmx-surface);
  color: var(--bmx-text);
  font: inherit;
  font-size: 12px;
}

.field.check { display: flex; align-items: center; gap: 7px; }
.field.check input { accent-color: var(--bmx-primary-solid); }

.event-log {
  margin: 0;
  padding: 12px 20px;
  border-block-start: 1px solid var(--bmx-border);
  background: var(--bmx-surface-sunken);
  color: var(--bmx-text-muted);
  font-family: var(--bmx-font-family-mono);
  font-size: 12px;
  max-block-size: 130px;
  overflow-y: auto;
}

.event-log b { color: var(--bmx-success-soft-text); font-weight: 600; }

/* -- Misc ------------------------------------------------------------------ */

.note {
  margin: 0;
  padding: 12px 20px;
  border-block-start: 1px solid var(--bmx-border);
  background: var(--bmx-info-soft);
  color: var(--bmx-info-soft-text);
  font-size: 12.5px;
}

.demo-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  inline-size: 100%;
}

.demo-form input {
  padding: 7px 10px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md);
  background: var(--bmx-surface);
  color: var(--bmx-text);
  font: inherit;
  font-size: 13px;
}

.demo-form output {
  color: var(--bmx-success-soft-text);
  font-family: var(--bmx-font-family-mono);
  font-size: 12px;
}

footer.site {
  padding: 26px;
  border-block-start: 1px solid var(--bmx-border);
  color: var(--bmx-text-subtle);
  font-size: 12.5px;
}

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* -- Effects gallery controls ---------------------------------------------- */

.fx-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 14px 20px;
  border-block-end: 1px solid var(--bmx-border);
  background: var(--bmx-surface-sunken);
}

.fx-controls .control {
  gap: 9px;
}

.fx-controls input[type='range'] {
  accent-color: var(--bmx-primary-solid);
  inline-size: 130px;
}

.fx-controls output {
  min-inline-size: 4.5ch;
  color: var(--bmx-text);
  font-family: var(--bmx-font-family-mono);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
 * Family cards, on the overview page
 * ----------------------------------------------------------------------- */

.families {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 16px;
  padding: 20px;
}

.family {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md);
  background: var(--bmx-surface-raised);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

a.family:hover {
  border-color: var(--bmx-primary-solid);
  background: var(--bmx-surface-hover);
}

.family h3 { margin: 0; font-size: 15px; }
.family p { margin: 0; color: var(--bmx-text-muted); font-size: 13px; line-height: 1.5; }

.family.is-soon { opacity: 0.55; }

.family-status {
  margin-block-start: auto;
  padding-block-start: 8px;
  font-size: 12px;
  color: var(--bmx-text-subtle);
}

.family-status.is-ready { color: var(--bmx-success-soft-text); }

/* The brand block is a link once there is more than one page to go home to. */
a.brand { text-decoration: none; color: inherit; }
a.brand:hover .brand-name { color: var(--bmx-primary-soft-text); }

/* A family heading that has a page behind it. */
.sidebar-heading a { color: inherit; text-decoration: none; }
.sidebar-heading a:hover { color: var(--bmx-text); }

/* The page you are on, distinct from the section you are in. Weight rather than
 * a background, so it does not compete with `.is-active` two pixels below it. */
.sidebar-nav a.is-page { color: var(--bmx-text); }
.sidebar-heading.is-page a { color: var(--bmx-primary-soft-text); }

/* --------------------------------------------------------------------------
 * The skeleton demonstration's card
 *
 * The placeholder and the real content are laid out identically on purpose:
 * the point of the demonstration is that nothing below the card moves when the
 * content lands, and that only holds if the two are the same shape.
 * ----------------------------------------------------------------------- */

.sk-card {
  padding: var(--bmx-space-4);
  border: 1px solid var(--bmx-border);
  border-radius: var(--bmx-radius-md);
  background: var(--bmx-surface-raised);

  /* A width as well as a maximum: inside a column flex container the card
   * would otherwise shrink to its widest unbreakable child, which for a card
   * made of placeholder bars is almost nothing. */
  inline-size: 100%;
  max-inline-size: 26rem;
}

.sk-card.is-hidden {
  display: none;
}

.sk-card-head {
  display: flex;
  align-items: center;
  gap: var(--bmx-space-3);
  margin-block-end: var(--bmx-space-3);

  /* Both heads are given the same height so the demonstration's own claim -
   * that nothing below the card moves when the content lands - is true rather
   * than nearly true. The placeholder is only as good as the guess it makes
   * about the shape of what is coming. */
  min-block-size: 2.75rem;
}

.sk-card-name {
  flex: 1 1 auto;
  min-inline-size: 0;
}

.sk-avatar {
  display: grid;
  place-items: center;
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border-radius: 999px;
  background: var(--bmx-primary-soft);
  color: var(--bmx-primary-soft-text);
  font-weight: 600;
  font-size: 0.8125rem;
}

.sk-card-name strong {
  display: block;
  font-size: 0.9375rem;
}

.sk-role {
  display: block;
  color: var(--bmx-text-muted);
  font-size: 0.8125rem;
}

.sk-body {
  margin: 0;
  color: var(--bmx-text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}


/* --------------------------------------------------------------------------
 * Badge, chip and avatar sections
 * ----------------------------------------------------------------------- */

/*
 * The positioning context a badge attached with `for` needs.
 *
 * This is the consumer's half of the arrangement and it is deliberately here
 * rather than in the component: the badge describes the button through
 * `aria-describedby` and is a sibling of it, so where it sits on the page is a
 * layout question the page answers.
 */
.badge-anchor {
  position: relative;
  display: inline-flex;
}

.badge-anchor bmx-badge {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  transform: translate(35%, -35%);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  block-size: 2.25rem;
  padding-inline: 0.875rem;
  border: 1px solid var(--bmx-border, #d5dae2);
  border-radius: var(--bmx-radius-md, 0.5rem);
  background: var(--bmx-surface, #fff);
  color: var(--bmx-text, #0f172a);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.icon-button:hover {
  background: var(--bmx-surface-sunken, #f4f6f9);
}

.icon-button:focus-visible {
  outline: 2px solid var(--bmx-focus, #1971c2);
  outline-offset: 2px;
}


/* --------------------------------------------------------------------------
 * The composer scenario
 * ----------------------------------------------------------------------- */

.composer {
  border: 1px solid var(--bmx-border, #d5dae2);
  border-radius: var(--bmx-radius-lg, 0.75rem);
  background: var(--bmx-surface, #fff);
  overflow: hidden;
}

.composer-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-block-end: 1px solid var(--bmx-border, #d5dae2);
  background: var(--bmx-surface-sunken, #f7f9fb);
}

.composer-from {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-inline-size: 0;
}

.composer-sub {
  font-size: 0.8125rem;
  color: var(--bmx-text-muted, #5b6472);
}

.composer-thread {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-inline-start: auto;
}

.composer-thread-label,
.composer-field-label {
  font-size: 0.8125rem;
  color: var(--bmx-text-muted, #5b6472);
  white-space: nowrap;
}

.composer-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-block-end: 1px solid var(--bmx-border, #d5dae2);
}

.composer-field-label {
  padding-block-start: 0.4rem;
  inline-size: 3.5rem;
  flex: 0 0 auto;
}

/*
 * The chip set takes the room that is left, and is allowed to be narrow.
 *
 * `min-inline-size: 0` is the half of this that is easy to forget: a flex item
 * will not shrink below its content's intrinsic width without it, so a row of
 * seven recipients would push the button off the end instead of wrapping.
 */
.composer-row bmx-chip-set {
  flex: 1 1 auto;
  min-inline-size: 0;
}

.composer-add,
.composer-icon {
  flex: 0 0 auto;
  block-size: 2rem;
  padding-inline: 0.75rem;
  border: 1px solid var(--bmx-border, #d5dae2);
  border-radius: var(--bmx-radius-md, 0.5rem);
  background: var(--bmx-surface, #fff);
  color: var(--bmx-text, #0f172a);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.composer-add:hover,
.composer-icon:hover {
  background: var(--bmx-surface-sunken, #f4f6f9);
}

.composer-add:focus-visible,
.composer-icon:focus-visible {
  outline: 2px solid var(--bmx-focus, #1971c2);
  outline-offset: 2px;
}

.composer-foot {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1rem;
}

/*
 * The positioning context the attached badge needs.
 *
 * The badge describes the button through `aria-describedby` and is its
 * sibling, so where it sits is the page's business rather than the
 * component's — which is the whole point of `for`.
 */
.composer-attach {
  position: relative;
  display: inline-flex;
}

.composer-attach bmx-badge {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  transform: translate(40%, -40%);
}

.composer-readout {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-block-start: 0.875rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--bmx-radius-md, 0.5rem);
  background: var(--bmx-surface-sunken, #f4f6f9);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.ro-line {
  display: block;
}

.ro-tag {
  display: inline-block;
  inline-size: 3.25rem;
  margin-inline-end: 0.5rem;
  color: var(--bmx-text-muted, #5b6472);
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .composer-head,
  .composer-row {
    flex-wrap: wrap;
  }

  .composer-thread {
    margin-inline-start: 0;
  }
}

/* --------------------------------------------------------------------------
 * Display page
 * ----------------------------------------------------------------------- */

.badge-demo {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  align-items: flex-start;
}

.badge-code {
  font-size: 0.75rem;
  color: var(--bmx-text-muted, #5b6472);
}

.filter-label {
  font-size: 0.8125rem;
  color: var(--bmx-text-muted, #5b6472);
}

.filter-input {
  block-size: 2rem;
  padding-inline: 0.625rem;
  border: 1px solid var(--bmx-border, #d5dae2);
  border-radius: var(--bmx-radius-md, 0.5rem);
  background: var(--bmx-surface, #fff);
  color: var(--bmx-text, #0f172a);
  font: inherit;
  font-size: 0.8125rem;
  inline-size: 12rem;
}

.filter-input:focus-visible {
  outline: 2px solid var(--bmx-focus, #1971c2);
  outline-offset: 1px;
}

.stepper-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2rem;
  block-size: 2rem;
  border-radius: var(--bmx-radius-md, 0.5rem);
  background: var(--bmx-surface-sunken, #f4f6f9);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
 * Applications page
 * ----------------------------------------------------------------------- */

.work-slide {
  margin: 0;
}

.work-art {
  block-size: 12rem;
  border-radius: var(--bmx-radius-lg, 0.75rem);
}

.art-1 { background: linear-gradient(135deg, #3b5bdb, #0b7285); }
.art-2 { background: linear-gradient(135deg, #2b8a3e, #0c6b58); }
.art-3 { background: linear-gradient(135deg, #a9450b, #862e9c); }
.art-4 { background: linear-gradient(135deg, #b02525, #a9450b); }
.art-5 { background: linear-gradient(135deg, #0b7285, #2b8a3e); }
.art-6 { background: linear-gradient(135deg, #862e9c, #3b5bdb); }

.work-slide figcaption {
  margin-block-start: 0.625rem;
  font-size: 0.875rem;
  color: var(--bmx-text-muted, #5b6472);
}

.mini {
  display: flex;
  align-items: center;
  justify-content: center;
  block-size: 6rem;
  border: 1px solid var(--bmx-border, #d5dae2);
  border-radius: var(--bmx-radius-md, 0.5rem);
  background: var(--bmx-surface-sunken, #f7f9fb);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
 * Applications - the three tier-4 components on one screen
 *
 * The chart and the diary side by side above a strip, and a single breakpoint
 * rather than a system of them: below a laptop the two stack, because a diary
 * squeezed into a third of a phone is a diary nobody reads.
 * ----------------------------------------------------------------------- */

.team-grid {
  display: grid;
  grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  inline-size: 100%;
}

@media (max-width: 60rem) {
  .team-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.team-chart,
.team-diary {
  min-inline-size: 0;
}

.team-chart {
  padding: 0.5rem;
  border: 1px solid var(--bmx-border, #d5dae2);
  border-radius: var(--bmx-radius-md, 0.5rem);
  background: var(--bmx-surface, #fff);
  overflow: auto;
}

.mini-card {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.75rem;
  block-size: 5rem;
  border: 1px solid var(--bmx-border, #d5dae2);
  border-radius: var(--bmx-radius-md, 0.5rem);
  background: var(--bmx-surface-sunken, #f7f9fb);
  text-align: center;
}

.mini-card figcaption {
  font-size: 0.875rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
 * Groups - the toolbar scenario's sample paragraph
 * ----------------------------------------------------------------------- */

.bar-sample {
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--bmx-border, #d5dae2);
  border-radius: var(--bmx-radius-md, 0.5rem);
  background: var(--bmx-surface, #fff);
  font-size: 1rem;
  line-height: 1.5;
}

.bar-sample.is-bold { font-weight: 700; }
.bar-sample.is-italic { font-style: italic; }
.bar-sample.is-underline { text-decoration: underline; }
.bar-sample.is-list { font-family: var(--bmx-font-mono, ui-monospace, monospace); font-size: 0.875rem; }
.bar-sample.is-board { letter-spacing: 0.04em; }
