/*
 * chrome.css — the Design Playground's application chrome.
 *
 * Authored plain CSS against token names, never utilities. The chrome sits on
 * top of pages that carry their own design system, and a utility name here
 * would collide with the same name there.
 *
 * Every value resolves to `--qxa-*` (the pinned application theme) or to a
 * standard token scoped onto the chrome's own elements. Prefixes: `qxc-` for
 * the chrome, `qxv-` for the viewer's own controls.
 *
 * Simulation seams (`.sim-view`, the in-page router) are not lifted.
 */

/* ------------------------------------------------------------------ */
/* Metrics                                                             */
/* ------------------------------------------------------------------ */

:root {
  --qxc-w: 17rem;          /* the sidebar's width */
  --qxc-ham: 2.25rem;      /* the floating hamburger's box */
  --qxc-gutter: 0.75rem;   /* its inset from the top-left corner */
  --qxc-ease: 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
  --qxc-topbar: calc(var(--qxc-ham) + var(--qxc-gutter) * 2); /* sidebar head, viewer bar, gallery bar */
  --qxc-stroke: 1px;
  --qxc-stroke-md: 2px;
  --qxc-track: 0.06em;
  --qxc-control: 1.75rem;  /* viewer selects and buttons */
  --qxc-display: 2.25rem;  /* status-page titles */
}

/* ------------------------------------------------------------------ */
/* The shell                                                           */
/* ------------------------------------------------------------------ */

/*
 * On the live site the document root carries `.qxc-shell`, so `--qxc-inset`
 * publishes to any page that references it. Font and colour stay off the
 * root: those would inherit into a host gallery.
 *
 * THE CLEARANCE CONTRACT — a floating control sits over whatever is in the
 * top-left corner. The chrome PUBLISHES the control's footprint and the page
 * references it with a zero fallback. A page framed in the viewer gets no
 * chrome, nothing is published, and the page sits flush.
 */
.qxc-shell {
  min-height: 100vh;
  background: var(--qxa-stage);
  --qxc-inset: 0px;
}

.qxc-shell[data-sidebar='closed'] {
  --qxc-inset: calc(var(--qxc-gutter) * 2 + var(--qxc-ham));
}

/* Application views opt in by carrying the attribute; they have no background
   of their own, so the inset moves the content and nothing else. */
[data-app-inset] {
  padding-inline-start: var(--qxc-inset, 0px);
  transition: padding-inline-start var(--qxc-ease);
}

/*
 * A prototype at its direct URL takes no chrome at all — including the
 * floating hamburger. On the live site the structural guard is that a
 * prototype's build never includes these files; `data-chrome="off"` is the
 * same rule, visible.
 */
.qxc-shell[data-chrome='off'] .qxc-ham,
.qxc-shell[data-chrome='off'] .qxc-sidebar,
.qxc-shell[data-chrome='off'] .qxc-scrim {
  display: none;
}

.qxc-shell[data-chrome='off'] {
  --qxc-inset: 0px;
}

.qxc-shell[data-chrome='off'] .qxc-main {
  margin-inline-start: 0;
}

.qxc-ham,
.qxc-ham *,
.qxc-ham *::before,
.qxc-ham *::after,
.qxc-appbar,
.qxc-appbar *,
.qxc-appbar *::before,
.qxc-appbar *::after,
.qxc-gallery-spy,
.qxc-gallery-spy *,
.qxc-gallery-spy *::before,
.qxc-gallery-spy *::after,
.qxc-sidebar,
.qxc-sidebar *,
.qxc-sidebar *::before,
.qxc-sidebar *::after,
.qxc-scrim,
.qxc-scrim *,
.qxc-scrim *::before,
.qxc-scrim *::after,
.qxv-root,
.qxv-root *,
.qxv-root *::before,
.qxv-root *::after {
  box-sizing: border-box;
}

.qxc-main {
  min-height: 100vh;
  margin-inline-start: var(--qxc-w);
  transition: margin-inline-start var(--qxc-ease);
}

[data-sidebar='closed'] .qxc-main {
  margin-inline-start: 0;
}

/* Viewer and gallery: the page itself never scrolls; the canvas is the scrollport. */
.qxc-shell[data-surface='viewer'],
.qxc-shell[data-surface='viewer'] body.qxc-main,
.qxc-shell[data-surface='gallery'],
.qxc-shell[data-surface='gallery'] body.qxc-main {
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* The floating hamburger                                              */
/* ------------------------------------------------------------------ */

.qxc-ham {
  position: fixed;
  top: var(--qxc-gutter);
  left: var(--qxc-gutter);
  z-index: 70;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--qxc-ham);
  height: var(--qxc-ham);
  padding: 0;
  background: var(--qxa-panel);
  border: var(--qxc-stroke) solid var(--qxa-line);
  border-radius: var(--radius-sm);
  color: var(--qxa-text);
  box-shadow: var(--qxa-shadow-soft);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, left var(--qxc-ease);
}

.qxc-ham:hover {
  background: var(--qxa-raise);
  border-color: var(--qxa-line-strong);
}

.qxc-ham:focus-visible {
  outline: var(--qxc-stroke-md) solid var(--qxa-text);
  outline-offset: var(--space-3xs);
}

.qxc-ham svg {
  width: var(--space-md);
  height: var(--space-md);
}

[data-sidebar='open'] .qxc-ham {
  left: calc(var(--qxc-w) - var(--qxc-gutter) - var(--qxc-ham));
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

[data-sidebar='open'] .qxc-ham:hover {
  background: var(--qxa-raise);
}

/* ------------------------------------------------------------------ */
/* The sidebar                                                         */
/* ------------------------------------------------------------------ */

.qxc-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: var(--qxc-w);
  background: var(--qxa-panel);
  border-inline-end: var(--qxc-stroke) solid var(--qxa-line);
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--qxa-text);
  transition: transform var(--qxc-ease);
}

[data-sidebar='closed'] .qxc-sidebar {
  transform: translateX(-100%);
}

.qxc-head {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-sm);
  height: var(--qxc-topbar);
  padding-inline: var(--space-sm) calc(var(--qxc-gutter) + var(--qxc-ham) + var(--space-sm));
  color: var(--qxa-text);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  border-bottom: var(--qxc-stroke) solid var(--qxa-line);
}

.qxc-mark {
  flex-shrink: 0;
  display: block;
  width: var(--space-lg);
  height: var(--space-lg);
}

.qxc-head:hover {
  text-decoration: none;
}

/* ---- the universal menu ---- */

.qxc-menu {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  padding: var(--space-sm);
}

.qxc-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: calc((var(--space-2xs) + var(--space-xs)) / 2) var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--qxa-text-muted);
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.qxc-item:hover {
  background: var(--qxa-raise);
  color: var(--qxa-text);
  text-decoration: none;
}

.qxc-item:focus-visible {
  outline: var(--qxc-stroke-md) solid var(--qxa-text);
  outline-offset: calc(var(--space-3xs) * -1);
}

.qxc-item[aria-current='page'] {
  background: var(--qxa-select);
  color: var(--qxa-on-select);
  font-weight: var(--font-weight-medium);
}

.qxc-item svg,
.qxc-kind {
  flex-shrink: 0;
  width: var(--space-md);
  height: var(--space-md);
}

.qxc-item svg {
  opacity: 0.85;
}

/* ---- the explorer tree ---- */

.qxc-tree {
  --qxc-tree-label: 2.5rem;
  isolation: isolate;
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 0 var(--space-xl);
  background: var(--qxa-well);
  border-top: var(--qxc-stroke) solid var(--qxa-line);
}

.qxc-group {
  isolation: isolate;
  padding-inline: var(--space-sm);
}

.qxc-group + .qxc-group {
  margin-top: var(--space-sm);
}

.qxc-group-label {
  position: sticky;
  top: 0;
  z-index: 2;
  isolation: isolate;
  transform: translateZ(0);
  display: flex;
  align-items: center;
  height: var(--qxc-tree-label);
  margin: 0 calc(var(--space-sm) * -1);
  padding-inline: var(--space-sm);
  background: var(--qxa-well);
  color: var(--qxa-text-quiet);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--qxc-track);
  text-transform: uppercase;
}

.qxc-clear {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--qxc-control);
  height: var(--qxc-control);
  margin-inline-start: auto;
  padding: 0;
  background: var(--qxa-panel);
  border: var(--qxc-stroke) solid var(--qxa-line);
  border-radius: var(--radius-sm);
  color: var(--qxa-text-muted);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.qxc-clear:hover {
  background: var(--qxa-raise);
  border-color: var(--qxa-line-strong);
  color: var(--qxa-text);
}

.qxc-clear:focus-visible {
  outline: var(--qxc-stroke-md) solid var(--qxa-text);
  outline-offset: calc(var(--space-3xs) * -1);
}

.qxc-clear svg {
  width: 14px;
  height: 14px;
}

.qxc-branch {
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.qxc-node {
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: var(--space-3xs);
}

.qxc-node > .qxc-link {
  flex: 1;
  min-width: 0;
}

.qxc-link {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: calc((var(--space-2xs) + var(--space-xs)) / 2) var(--space-sm);
  border-radius: var(--radius-sm);
  color: var(--qxa-text-muted);
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.qxc-link:hover {
  background: var(--qxa-raise);
  color: var(--qxa-text);
  text-decoration: none;
}

.qxc-link:focus-visible {
  outline: var(--qxc-stroke-md) solid var(--qxa-text);
  outline-offset: calc(var(--space-3xs) * -1);
}

.qxc-link[aria-current='page'] {
  background: var(--qxa-select);
  color: var(--qxa-on-select);
}

.qxc-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qxc-tag {
  flex-shrink: 0;
  margin-inline-start: var(--space-sm);
  padding: 2px 8px;
  background: transparent;
  border: var(--qxc-stroke) solid var(--qxa-line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--font-weight-regular);
  letter-spacing: 0;
  text-transform: lowercase;
  color: var(--qxa-text-quiet);
  line-height: var(--line-height-normal);
}

.qxc-link[aria-current='page'] .qxc-tag {
  background: transparent;
  border-color: currentColor;
  color: inherit;
}

.qxc-tree .qxc-kind {
  position: relative;
  z-index: 0;
  overflow: hidden;
}

.qxc-mount {
  flex-shrink: 0;
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-sm);
  color: var(--qxa-text-quiet);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  transition: background 120ms ease, color 120ms ease;
}

.qxc-mount:hover,
.qxc-mount:focus-visible {
  background: var(--qxa-raise);
  color: var(--qxa-text);
  text-decoration: none;
  outline: none;
}

.qxc-empty {
  margin: 0;
  padding: var(--space-sm);
  color: var(--qxa-text-quiet);
}

.qxc-empty-mark {
  display: grid;
  place-items: center;
  width: var(--space-xl);
  height: var(--space-xl);
  margin-bottom: var(--space-sm);
  background: var(--qxa-panel);
  border: var(--qxc-stroke) solid var(--qxa-line);
  border-radius: var(--radius-sm);
  color: var(--qxa-text-quiet);
}

.qxc-empty-mark svg {
  width: var(--space-md);
  height: var(--space-md);
}

.qxc-empty p {
  margin: 0;
}

.qxc-empty p + p {
  margin-top: var(--space-xs);
}

.qxc-empty a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.qxc-empty a:hover {
  color: var(--qxa-text);
}

.qxc-more {
  margin: 0;
}

.qxc-recent-foot {
  margin: 0;
}

.qxc-divider {
  margin: var(--space-lg) 0 0;
  border: 0;
  border-top: var(--qxc-stroke) solid var(--qxa-line);
}

.qxc-recent-foot .qxc-empty {
  padding-top: var(--space-md);
}

.qxc-more-button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: calc((var(--space-2xs) + var(--space-xs)) / 2) var(--space-sm);
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--qxa-text-quiet);
  font: inherit;
  font-size: var(--font-size-xs);
  text-align: start;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.qxc-more-button:hover {
  background: var(--qxa-raise);
  color: var(--qxa-text);
}

.qxc-more-button:focus-visible {
  outline: var(--qxc-stroke-md) solid var(--qxa-text);
  outline-offset: calc(var(--space-3xs) * -1);
}

/* ---- empty and miss stages (viewers + the site 404) ---- */

.qxc-status {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 28rem;
  margin: auto;
  padding: var(--space-xl) var(--space-lg);
  font-family: var(--font-sans);
  text-align: center;
}

.qxc-status-page {
  justify-content: center;
  min-height: 100vh;
  max-width: none;
  padding-inline: max(var(--space-lg), var(--qxc-inset, 0px));
  background: var(--qxa-stage);
  color: var(--qxa-text);
}

.qxc-status-page .qxc-status-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 28rem;
}

.qxc-status-mark {
  display: grid;
  place-items: center;
  width: var(--space-4xl);
  height: var(--space-4xl);
  margin: 0 0 var(--space-lg);
  background: var(--qxa-panel);
  border: var(--qxc-stroke) solid var(--qxa-line);
  border-radius: 50%;
}

.qxc-status-mark img {
  display: block;
  width: var(--space-2xl);
  height: var(--space-2xl);
}

.qxc-status-kicker {
  margin: 0 0 var(--space-xs);
  color: var(--qxa-text-quiet);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--qxc-track);
  text-transform: uppercase;
}

.qxc-status-title {
  margin: 0 0 var(--space-sm);
  color: var(--qxa-text);
  font-family: var(--font-heading);
  font-size: var(--qxc-display);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.qxc-status-lead {
  margin: 0;
  color: var(--qxa-text-muted);
  font-size: var(--font-size-md);
  line-height: var(--line-height-relaxed);
}

.qxc-status-detail {
  margin: var(--space-sm) 0 0;
  color: var(--qxa-text-muted);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.qxc-status-detail code {
  padding: 0 var(--space-2xs);
  background: var(--qxa-well);
  border-radius: calc(var(--radius) * 0.4);
  color: var(--qxa-text);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
}

.qxc-status-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.qxc-status-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--qxc-control);
  padding-inline: var(--space-sm);
  background: var(--qxa-fill);
  border: var(--qxc-stroke) solid transparent;
  border-radius: var(--radius-sm);
  color: var(--qxa-on-select);
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

.qxc-status-action:hover {
  color: var(--qxa-on-select);
  text-decoration: none;
}

.qxc-status-action-quiet {
  background: var(--qxa-panel);
  border-color: var(--qxa-line);
  color: var(--qxa-text);
}

.qxc-status-action-quiet:hover {
  background: var(--qxa-raise);
  color: var(--qxa-text);
}

.qxc-status[data-state='empty'] .qxc-status-when-error,
.qxc-status[data-state='error'] .qxc-status-when-empty,
.qxc-status[data-state='error'] .qxc-status-actions,
[data-chrome='off'] .qxc-status-actions {
  display: none;
}

/* ---- the foot ---- */

.qxc-foot {
  flex-shrink: 0;
  margin: 0;
  position: relative;
  z-index: 1;
  padding: var(--space-sm) var(--space-lg);
  border-top: var(--qxc-stroke) solid var(--qxa-line);
  background: var(--qxa-panel);
  color: var(--qxa-text-quiet);
  font-size: var(--font-size-xs);
}

.qxc-foot a {
  color: var(--qxa-text-quiet);
}

/* ------------------------------------------------------------------ */
/* Narrow screens: the sidebar becomes an overlay drawer               */
/* ------------------------------------------------------------------ */

.qxc-scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--qxa-scrim);
  border: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--qxc-ease);
}

@media (max-width: 60rem) {
  .qxc-main {
    margin-inline-start: 0;
  }

  .qxc-sidebar {
    box-shadow: var(--qxa-shadow);
  }

  [data-sidebar='open'] .qxc-scrim {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ------------------------------------------------------------------ */
/* The viewer                                                          */
/* ------------------------------------------------------------------ */

.qxv-root {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
}

.qxv-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  height: var(--qxc-topbar);
  padding-inline: var(--space-lg);
  padding-inline-start: calc(var(--space-lg) + var(--qxc-inset, 0px));
  background: var(--qxa-well);
  border-bottom: var(--qxc-stroke) solid var(--qxa-line);
  font-size: var(--font-size-sm);
  color: var(--qxa-text);
  transition: padding-inline-start var(--qxc-ease);
}

.qxv-brand {
  display: flex;
  align-items: baseline;
  gap: var(--space-2xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.qxv-version {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--qxa-text-quiet);
}

.qxv-divider {
  width: var(--qxc-stroke);
  height: var(--font-size-xl);
  background: var(--qxa-line-strong);
}

.qxv-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--qxa-text-muted);
}

.qxv-badge {
  flex-shrink: 0;
  padding: var(--space-3xs) var(--space-xs);
  border: var(--qxc-stroke) solid var(--qxa-line-strong);
  border-radius: calc(var(--radius) * 0.4);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--qxa-text-quiet);
  text-transform: uppercase;
}

.qxv-controls {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2xs);
  margin-inline-start: auto;
}

.qxv-field {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  color: var(--qxa-text-quiet);
  font-size: var(--font-size-xs);
}

.qxv-field select {
  height: var(--qxc-control);
  padding-inline: var(--space-xs);
  background: var(--qxa-well);
  border: var(--qxc-stroke) solid var(--qxa-line-strong);
  border-radius: var(--radius-sm);
  color: var(--qxa-text);
  font-family: var(--font-sans);
  font-size: var(--font-size-xs);
}

.qxv-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  height: var(--qxc-control);
  padding-inline: var(--space-xs);
  background: var(--qxa-well);
  border: var(--qxc-stroke) solid var(--qxa-line-strong);
  border-radius: var(--radius-sm);
  color: var(--qxa-text-muted);
  font-family: var(--font-sans);
  font-size: var(--font-size-xs);
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.qxv-button:hover {
  background: var(--qxa-raise);
  color: var(--qxa-text);
  text-decoration: none;
}

.qxv-button:focus-visible {
  outline: var(--qxc-stroke-md) solid var(--qxa-text);
  outline-offset: var(--space-3xs);
}

.qxv-button[aria-pressed='true'] {
  background: var(--qxa-select);
  border-color: var(--qxa-select);
  color: var(--qxa-on-select);
}

.qxv-button svg {
  width: var(--space-sm);
  height: var(--space-sm);
}

.qxv-canvas {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: var(--space-2xl);
  overflow: auto;
  background-color: var(--qxa-stage);
  background-image: radial-gradient(var(--qxa-canvas-dot) 1px, transparent 1px);
  background-size: 16px 16px;
  background-position: -1px -1px;
}

.qxv-empty {
  max-width: 30rem;
  text-align: center;
  color: var(--qxa-text-muted);
}

.qxv-empty h2 {
  margin: 0 0 var(--space-2xs);
  font-family: var(--font-heading);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--qxa-text);
}

.qxv-empty p {
  margin: 0 0 var(--space-sm);
  line-height: var(--line-height-relaxed);
}

.qxv-empty code {
  padding: var(--space-3xs) var(--space-2xs);
  background: var(--qxa-well);
  border-radius: calc(var(--radius) * 0.4);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

.qxv-shell {
  flex-shrink: 0;
  background: var(--qxa-bezel);
  box-shadow: var(--qxa-shadow);
  padding: var(--qxv-thickness);
  border-radius: var(--qxv-outer);
  transition: width var(--qxc-ease), padding var(--qxc-ease), border-radius var(--qxc-ease);
}

.qxv-shell[data-bezel='none'] {
  --qxv-thickness: 0px;
  --qxv-outer: var(--radius-sm);
  background: transparent;
  box-shadow: var(--qxa-shadow);
}

.qxv-shell[data-bezel='phone'] {
  --qxv-thickness: 12px;
  --qxv-outer: 44px;
}

.qxv-shell[data-bezel='laptop'] {
  --qxv-thickness: 8px;
  --qxv-outer: 14px;
}

.qxv-frame {
  overflow: hidden;
  border-radius: calc(var(--qxv-outer) - var(--qxv-thickness));
}

/* ------------------------------------------------------------------ */
/* Shared app bars (viewer navbar, gallery navbar)                     */
/* ------------------------------------------------------------------ */

.qxc-appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-sm);
  height: var(--qxc-topbar);
  padding-inline: var(--space-lg);
  padding-inline-start: max(var(--space-lg), var(--qxc-inset, 0px));
  min-width: 0;
  background: var(--qxa-panel);
  border-bottom: var(--qxc-stroke) solid var(--qxa-line);
  font-family: 'Geist Variable', ui-sans-serif, system-ui, sans-serif;
  font-size: var(--font-size-sm);
  color: var(--qxa-text);
  transition: padding-inline-start var(--qxc-ease);
}

.qxc-appbar-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--font-weight-semibold);
  color: var(--qxa-text);
}

.qxc-appbar-meta {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--qxa-text-quiet);
}

.qxc-appbar-badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border: var(--qxc-stroke) solid var(--qxa-line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--qxa-text-quiet);
}

.qxc-appbar-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2xs);
  margin-inline-start: auto;
  min-width: 0;
}

.qxc-appbar-link,
.qxc-appbar-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  height: var(--qxc-control);
  padding-inline: var(--space-xs);
  background: transparent;
  border: var(--qxc-stroke) solid var(--qxa-line);
  border-radius: var(--radius-sm);
  color: var(--qxa-text-muted);
  font-family: inherit;
  font-size: var(--font-size-xs);
  text-decoration: none;
  cursor: pointer;
}

.qxc-appbar-link:hover,
.qxc-appbar-button:hover {
  background: var(--qxa-raise);
  color: var(--qxa-text);
  text-decoration: none;
}

.qxc-appbar-button[aria-pressed='true'] {
  background: var(--qxa-select);
  border-color: var(--qxa-select);
  color: var(--qxa-on-select);
}

.qxc-appbar-link .icon,
.qxc-appbar-button .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Theme toggle shows the theme it will switch to. */
.qxc-appbar-button[data-behavior='theme-toggle'] .icon-moon,
.qxc-appbar-button[data-behavior='theme-toggle'][aria-pressed='true'] .icon-sun {
  display: block;
}

.qxc-appbar-button[data-behavior='theme-toggle'] .icon-sun,
.qxc-appbar-button[data-behavior='theme-toggle'][aria-pressed='true'] .icon-moon {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Gallery section spy (right rail, pinned like the navbar)            */
/* ------------------------------------------------------------------ */

.qxc-gallery-layout {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xl);
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: var(--space-lg);
  padding-bottom: var(--space-3xl);
}

.qxc-gallery-layout > main {
  flex: 1;
  min-width: 0;
}

.qxc-gallery-spy {
  position: sticky;
  top: calc(var(--qxc-topbar) + var(--space-md));
  flex-shrink: 0;
  display: none;
  width: 11.5rem;
  max-height: calc(100vh - var(--qxc-topbar) - var(--space-xl));
  overflow-y: auto;
  padding: var(--space-sm);
  background: var(--qxa-well);
  border: var(--qxc-stroke) solid var(--qxa-line);
  border-radius: var(--radius-sm);
  font-family: 'Geist Variable', ui-sans-serif, system-ui, sans-serif;
  font-size: var(--font-size-xs);
}

.qxc-gallery-spy a {
  display: block;
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-sm);
  color: var(--qxa-text-muted);
  text-decoration: none;
}

.qxc-gallery-spy a:hover {
  background: var(--qxa-raise);
  color: var(--qxa-text);
  text-decoration: none;
}

.qxc-gallery-spy a[aria-current='true'] {
  background: var(--qxa-select);
  color: var(--qxa-on-select);
}

@media (min-width: 56.25rem) {
  .qxc-gallery-spy {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qxc-sidebar,
  .qxc-main,
  .qxc-ham,
  .qxc-scrim,
  .qxc-appbar,
  .qxv-shell,
  [data-app-inset] {
    transition: none;
  }
}
