/* The Examples gallery (docs/examples-gallery.md): the public /examples pages, drawn by
   src/examples/examplePages.ts, and the console's Examples view and Connections notice, drawn by
   assets/console-examples.js.

   One stylesheet for both because the card is the same object in both places: the preview band with
   the form drawn small, the category glyph and level tag, the title and tagline, the route strip with
   its sockets, and the actions at the foot. The console draws those pieces from the server's own
   markup (/api/examples answers them), so one set of rules below lays out both. The public pages add
   their own parts (the hero, the filters, the detail page) under names the console never emits; what
   only the console needs is scoped under .examples-view at the end of this file. It reads only the
   shared palette in theme.css, which the public site and the console both link, plus --example-accent,
   the example's own page colour. Buttons are the public chrome's .btn and the console's .app-button:
   this file lays them out and never paints them.

   Each example's accent is the accent of the Webtzm Form page theme its form wears
   (services/hostedFormTheme.ts), light and dark, so a card is coloured like the page it opens. The
   accent is decoration (a tinted band, a glyph, the drawn form's button): no text is ever set in it. */

:where(.example-card, .example-detail, .examples-view) {
  --example-accent: var(--color-brand);
}

/* Elevation: the shared tokens where the page declares them (the console, the landing chrome), the
   editorial sheet's own shadow where it does not. Never a literal colour here. */
:where(.examples-page, .examples-view) {
  --example-shadow: var(--shadow-surface, var(--editorial-shadow));
  --example-shadow-raised: var(--shadow-raised, var(--editorial-shadow));
}

.example-theme--clean {
  --example-accent: #0066dd;
}

html[data-theme="dark"] .example-theme--clean {
  --example-accent: #55a7ff;
}

.example-theme--paper {
  --example-accent: #9a3412;
}

html[data-theme="dark"] .example-theme--paper {
  --example-accent: #f08a4b;
}

.example-theme--midnight {
  --example-accent: #3730a3;
}

html[data-theme="dark"] .example-theme--midnight {
  --example-accent: #8b93ff;
}

.example-theme--soft {
  --example-accent: #7c3aed;
}

html[data-theme="dark"] .example-theme--soft {
  --example-accent: #b794f6;
}

.example-theme--bold {
  --example-accent: #0b0d12;
}

html[data-theme="dark"] .example-theme--bold {
  --example-accent: #ffe14a;
}

.example-theme--mono {
  --example-accent: #27272a;
}

html[data-theme="dark"] .example-theme--mono {
  --example-accent: #e4e4e7;
}

.example-theme--forest {
  --example-accent: #166534;
}

html[data-theme="dark"] .example-theme--forest {
  --example-accent: #4ade80;
}

.example-theme--ocean {
  --example-accent: #0e7490;
}

html[data-theme="dark"] .example-theme--ocean {
  --example-accent: #38bdf8;
}

.example-theme--sunset {
  --example-accent: #c2410c;
}

html[data-theme="dark"] .example-theme--sunset {
  --example-accent: #fb923c;
}

.example-theme--rose {
  --example-accent: #be123c;
}

html[data-theme="dark"] .example-theme--rose {
  --example-accent: #fb7185;
}

.example-theme--slate {
  --example-accent: #334155;
}

html[data-theme="dark"] .example-theme--slate {
  --example-accent: #94a3b8;
}

.example-theme--sand {
  --example-accent: #8a6508;
}

html[data-theme="dark"] .example-theme--sand {
  --example-accent: #e3b341;
}

/* ---- The page ---- */

.examples-page .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* One inset for every band on the page: the public chrome's header and footer read
   --public-chrome-inset from body (assets/styles/public-chrome.css), and the content uses the same
   value, so the wordmark, the content and the footer share one left edge. */
body.examples-page {
  --examples-width: 1200px;
  --public-chrome-inset: max(var(--page-gutter, 24px), calc((100% - var(--examples-width)) / 2));
}

.examples-main {
  display: grid;
  align-content: start;
  gap: 64px;
  min-width: 0;
  margin: 0;
  padding: 48px var(--public-chrome-inset) 64px;
  color: var(--color-ink);
}

@media (max-width: 47.99rem) {
  .examples-main {
    gap: 48px;
    padding-top: 32px;
  }
}

.example-icon {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:is(.examples-page, .examples-view) :is(.examples-option, .example-link, .example-preview, .example-crumbs a, .example-card__title a, .example-board__note summary):focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.examples-kicker {
  margin: 0;
  color: var(--color-brand-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.examples-hero h1,
.example-hero h1 {
  margin: 0;
  color: var(--color-ink);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.examples-hero__summary,
.example-hero__summary {
  max-width: 640px;
  margin: 0;
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1.6;
}

@media (min-width: 48rem) {
  .examples-hero h1,
  .example-hero h1 {
    font-size: 40px;
    line-height: 1.1;
  }
}

@media (min-width: 64rem) {
  .examples-hero h1 {
    font-size: 56px;
    line-height: 1.05;
  }
}

/* The notice every example carries: a slim attention line, flat signal yellow with its icon. */
.examples-callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 720px;
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--color-attention);
  background: var(--color-attention-soft);
}

.examples-callout .example-icon {
  width: 20px;
  height: 20px;
}

.examples-callout p {
  margin: 0;
  color: var(--color-ink);
  font-size: 13px;
  line-height: 1.5;
}

.examples-callout strong {
  font-weight: 600;
}

/* ---- The gallery's hero: what the examples are, and how to read a route ---- */

.examples-hero {
  display: grid;
  gap: 32px;
  min-width: 0;
}

.examples-hero__copy {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.examples-hero__copy .examples-callout {
  margin-top: 8px;
}

.examples-legend {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 24px;
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: var(--example-shadow);
}

.examples-legend h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.examples-legend > p {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.5;
}

.examples-legend__list {
  display: grid;
  gap: 12px;
  margin: 4px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--color-line);
  list-style: none;
}

.examples-legend__list li {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.4;
}

.examples-legend__list .example-socket {
  justify-self: start;
}

/* On a phone the gallery is for choosing: the cards come first and each socket's label says enough. */
@media (max-width: 47.99rem) {
  .examples-legend {
    display: none;
  }
}

@media (min-width: 48rem) and (max-width: 63.99rem) {
  .examples-legend__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 64rem) {
  .examples-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 384px);
    align-items: end;
    gap: 48px;
  }
}

/* ---- Filters: hidden until the script that makes them work has run ---- */

.examples-browse {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.examples-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  min-width: 0;
}

.examples-filters:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 32px;
  min-width: 0;
}

.examples-filter {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.examples-filter__label {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.examples-filter__options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

/* A choice reads its height, type and ring from the shared control contract. */
.examples-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-height);
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: var(--color-ink);
  background: var(--color-surface);
  box-shadow: var(--control-ring);
  font-family: inherit;
  font-size: var(--control-font-size);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.examples-option:hover {
  box-shadow: var(--control-ring-hover);
}

.examples-option[aria-pressed="true"] {
  color: var(--color-brand-ink);
  background: var(--color-brand-soft);
  box-shadow: inset 0 0 0 1px var(--color-brand-line);
}

.examples-option__count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  color: var(--color-muted);
  background: var(--color-surface-sunken);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.examples-option[aria-pressed="true"] .examples-option__count {
  color: var(--color-brand-ink);
  background: var(--color-surface);
}

/* Level is one of three, so it is a segmented control: one track, the chosen segment lifted inside it.
   Each segment is the track's full height, so the target is the whole control height on touch too. */
.examples-filter--level .examples-filter__options {
  flex-wrap: nowrap;
  gap: 0;
  padding: 0 4px;
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: var(--control-ring);
}

.examples-filter--level .examples-option {
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

.examples-filter--level .examples-option::before {
  position: absolute;
  inset: 4px 0;
  border-radius: 8px;
  content: "";
}

.examples-filter--level .examples-option > span {
  position: relative;
}

.examples-filter--level .examples-option:hover::before {
  background: var(--color-surface-sunken);
}

.examples-filter--level .examples-option[aria-pressed="true"] {
  background: transparent;
  box-shadow: none;
}

.examples-filter--level .examples-option[aria-pressed="true"]::before {
  background: var(--color-brand-soft);
  box-shadow: inset 0 0 0 1px var(--color-brand-line);
}

.examples-filter--level .examples-option:focus-visible {
  outline-offset: -2px;
}

.examples-count {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.4;
}

/* On a phone the categories are one row that scrolls sideways, edge to edge, so the cards stay near
   the top of the page. The scroll is the row's own and intended. The console has no public chrome, so
   its view names its own phone gutter for the row to bleed into. */
@media (max-width: 39.99rem) {
  .examples-view {
    --public-chrome-inset: 16px;
  }

  .examples-filters:not([hidden]),
  .examples-filter {
    width: 100%;
  }

  .examples-filter--category .examples-filter__options {
    flex-wrap: nowrap;
    margin-inline: calc(var(--public-chrome-inset) * -1);
    padding: 4px var(--public-chrome-inset);
    overflow-x: auto;
    scroll-padding-inline: var(--public-chrome-inset);
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .examples-filter--category .examples-option {
    scroll-snap-align: start;
  }

  .examples-filter--level .examples-filter__options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .examples-filter--level .examples-option {
    justify-content: center;
    padding: 0 8px;
  }

  /* Three equal segments on a phone leave no room for the counts; the category chips keep theirs. */
  .examples-filter--level .examples-option__count {
    display: none;
  }
}

/* ---- Cards ---- */

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
  min-width: 0;
}

.example-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  overflow: hidden;
  border-radius: 16px;
  color: var(--color-ink);
  background: var(--color-surface);
  box-shadow: var(--example-shadow);
}

.example-card[hidden] {
  display: none;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .examples-page .example-card {
    transition: box-shadow 160ms ease;
  }
}

@media (hover: hover) {
  .examples-page .example-card:hover {
    box-shadow: var(--example-shadow-raised);
  }
}

/* The preview band: the page's own colour, with its form rising from the bottom edge. */
.example-card__preview {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 144px;
  padding: 24px 24px 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--example-accent) 12%, var(--color-surface));
}

.example-card__body {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 24px 24px 16px;
}

.example-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.example-meta__category {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.example-meta__category .example-icon {
  color: var(--example-accent);
}

.example-level {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--color-muted);
  background: var(--color-surface-sunken);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.example-card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
  text-wrap: pretty;
}

.example-card__title a {
  color: inherit;
  text-decoration: none;
}

.example-card__title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* On the public pages the whole card opens the example, through its title link, so the target is the
   card; the actions sit above that layer and keep their own destinations. */
.examples-page .example-card {
  position: relative;
}

.examples-page .example-card__title a::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
}

.example-card__tagline {
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.55;
}

.example-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 16px 24px 24px;
}

.examples-page .example-card__actions {
  position: relative;
  z-index: 1;
}

.example-card__actions > .example-actions {
  flex: 1 1 100%;
}

.example-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.example-actions .btn {
  flex: 1 1 auto;
}

.example-actions .btn .example-icon {
  width: 16px;
  height: 16px;
}

/* The tertiary action: a brand link with an arrow, never a box. */
.example-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  color: var(--color-brand-ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.example-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .example-link .example-icon {
    transition: transform 160ms ease;
  }

  .example-link:hover .example-icon {
    transform: translateX(2px);
  }
}

/* ---- The form drawn small: its address, a title, its answers and its button ---- */

.example-mini {
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(100%, 248px);
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: var(--color-surface);
  box-shadow: var(--example-shadow-raised);
}

.example-mini__bar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  height: 24px;
  padding: 0 8px;
  color: var(--color-muted);
  background: var(--color-surface-sunken);
  font-size: 11px;
  line-height: 1;
}

.example-mini__bar .example-icon {
  width: 12px;
  height: 12px;
}

.example-mini__address {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.example-mini__page {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px 12px 16px;
}

.example-mini__heading {
  width: 56%;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-ink) 72%, transparent);
}

.example-mini__field {
  display: grid;
  gap: 4px;
}

.example-mini__label {
  width: 36%;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-muted) 50%, transparent);
}

.example-mini__field--wide .example-mini__label {
  width: 52%;
}

.example-mini__input {
  height: 12px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--color-line);
}

.example-mini__button {
  width: 64px;
  height: 12px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--example-accent);
}

.example-mini--large {
  width: min(100%, 400px);
  border-radius: 12px 12px 0 0;
}

.example-mini--large .example-mini__bar {
  height: 32px;
  padding: 0 12px;
  gap: 8px;
  font-size: 12px;
}

.example-mini--large .example-mini__page {
  gap: 16px;
  padding: 24px 24px 32px;
}

.example-mini__title {
  color: var(--color-ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.example-mini--large .example-mini__field {
  gap: 8px;
}

.example-mini--large .example-mini__label {
  height: 6px;
}

.example-mini--large .example-mini__input {
  height: 32px;
}

.example-mini--large .example-mini__button {
  width: 128px;
  height: 36px;
}

/* ---- The route: form -> Webtzm -> Google output, with its sockets ---- */

.example-route {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin-top: 4px;
  container-type: inline-size;
}

.example-route__line {
  display: grid;
  grid-template-columns: auto minmax(24px, 1fr) auto;
  align-items: center;
  margin: 0;
  min-width: 0;
}

.example-route__node {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--color-ink);
  background: var(--color-surface-sunken);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.example-route__node .example-icon {
  color: var(--color-brand);
}

.example-route__mark {
  flex: none;
  width: 16px;
  height: 16px;
}

/* The wire: brand blue structure from a socket at the form to a lime terminal at the output. */
.example-route__wire {
  position: relative;
  height: 2px;
  margin: 0 8px;
  background: var(--color-brand-line);
}

.example-route__wire::before {
  position: absolute;
  top: 50%;
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
  left: -4px;
  width: 8px;
  height: 8px;
  background: var(--color-surface);
  box-shadow: inset 0 0 0 2px var(--color-brand-line);
}

.example-route__wire::after {
  position: absolute;
  top: 50%;
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
  right: -4px;
  width: 8px;
  height: 8px;
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-soft);
}

.example-route__sockets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.example-route__label {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.example-route__sockets ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A socket names what a visitor can do on the route, in that ability's purpose accent. */
.example-socket {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--color-brand-ink);
  background: var(--color-brand-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.example-socket::before {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-brand);
  content: "";
}

.example-socket--edit {
  color: var(--color-edit-ink);
  background: var(--color-edit-soft);
}

.example-socket--edit::before {
  background: var(--color-edit);
}

.example-socket--remove {
  color: var(--color-remove-ink);
  background: var(--color-remove-soft);
}

.example-socket--remove::before {
  background: var(--color-remove);
}

.example-socket--read {
  color: var(--color-read-ink);
  background: var(--color-read-soft);
}

.example-socket--read::before {
  background: var(--color-read);
}

/* Too narrow for the two nodes side by side: the route runs down instead of across. The hero's larger
   nodes need more room than a card's, so its threshold is wider. */
@container (max-width: 359px) {
  .example-route--large .example-route__line {
    grid-template-columns: auto;
    justify-items: start;
  }

  .example-route--large .example-route__wire {
    width: 2px;
    height: 16px;
    margin: 4px 0 4px 19px;
  }

  .example-route--large .example-route__wire::before {
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
  }

  .example-route--large .example-route__wire::after {
    top: auto;
    right: auto;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* A card's route needs 330px across: the longest pair, "Webtzm Form page" and "Google Sheet", with a wire
   between them that still reads as one. Below that it runs down, rather than clipping the form's node and
   shrinking the wire to a dot, which is what a 279px threshold did on 300px-wide routes. */
@container (max-width: 329px) {
  .example-route__line {
    grid-template-columns: auto;
    justify-items: start;
  }

  .example-route__wire {
    width: 2px;
    height: 16px;
    margin: 4px 0 4px 19px;
  }

  .example-route__wire::before {
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
  }

  .example-route__wire::after {
    top: auto;
    right: auto;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* ---- Empty and no-match states ---- */

.examples-empty,
.examples-none:not([hidden]) {
  display: grid;
  justify-items: start;
  gap: 16px;
  max-width: 640px;
  padding: 32px;
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: var(--example-shadow);
}

.examples-empty__copy {
  display: grid;
  justify-items: start;
  gap: 12px;
}

.examples-empty h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.examples-empty p,
.examples-none p {
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.6;
}

.example-route-art {
  display: block;
  width: 160px;
  height: 48px;
}

.example-route-art__node {
  fill: var(--color-surface-sunken);
}

.example-route-art__ink {
  fill: none;
  stroke: var(--color-slate-300);
  stroke-width: 2;
  stroke-linecap: round;
}

.example-route-art__wire {
  fill: none;
  stroke: var(--color-brand-line);
  stroke-width: 2;
  stroke-dasharray: 4 6;
  stroke-linecap: round;
}

.example-route-art__end {
  fill: var(--color-success);
}

/* ---- One example: the hero and its companion ---- */

.example-hero {
  display: grid;
  gap: 32px;
  min-width: 0;
}

.example-hero__copy {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.example-hero .example-meta {
  justify-content: flex-start;
  gap: 12px;
}

.example-crumbs {
  min-width: 0;
}

.example-crumbs ol {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.4;
}

.example-crumbs li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.example-crumbs li:first-child {
  flex: none;
}

.example-crumbs li + li::before {
  margin-right: 8px;
  color: var(--color-slate-400);
  content: "/";
}

.example-crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  color: var(--color-brand-ink);
  font-weight: 600;
  text-decoration: none;
}

.example-crumbs a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.example-crumbs [aria-current="page"] {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--color-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.example-route--large {
  max-width: 640px;
  gap: 12px;
  margin-top: 8px;
  padding: 16px;
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: var(--example-shadow);
}

.example-route--large .example-route__node {
  min-height: 36px;
  font-size: 13px;
}

.example-hero__actions {
  display: grid;
  gap: 16px;
  margin-top: 8px;
}

.example-hero__actions .btn {
  flex: 0 0 auto;
}

.example-hero__copy .examples-callout {
  margin-top: 8px;
}

.example-hero__companion {
  min-width: 0;
}

@media (max-width: 39.99rem) {
  .example-hero__actions .btn {
    flex: 1 1 auto;
  }
}

@media (min-width: 64rem) {
  .example-hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 448px);
    align-items: start;
    gap: 48px;
  }

  .example-hero__companion {
    padding-top: 44px;
  }
}

/* A form on its own page: that page, drawn larger, opens it. */
.example-preview {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border-radius: 16px;
  color: var(--color-ink);
  background: var(--color-surface);
  box-shadow: var(--example-shadow);
  text-decoration: none;
}

.example-preview__stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 280px;
  padding: 32px 32px 0;
  background: color-mix(in srgb, var(--example-accent) 12%, var(--color-surface));
}

.example-preview__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 16px 24px;
}

.example-preview__label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-brand-ink);
  font-size: 14px;
  font-weight: 600;
}

.example-preview__hint {
  color: var(--color-muted);
  font-size: 13px;
}

@media (hover: hover) {
  a.example-preview:hover {
    box-shadow: var(--example-shadow-raised);
  }

  a.example-preview:hover .example-preview__label {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  a.example-preview {
    transition: box-shadow 160ms ease;
  }
}

/* A form on an ordinary page: the live form, pasted in, is the companion. The embed code paints its own
   surface, as it does on any site, so this section stands on the canvas rather than framing that frame. */
.example-embed-card {
  display: grid;
  gap: 16px;
  min-width: 0;
  scroll-margin-top: 96px;
}

.example-embed-card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

.example-embed {
  min-width: 0;
}

.example-embed__caption {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.5;
}

.example-unavailable {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  color: var(--color-attention);
  background: var(--color-attention-soft);
}

.example-unavailable .example-icon {
  width: 20px;
  height: 20px;
}

.example-unavailable p {
  margin: 0;
  color: var(--color-ink);
  font-size: 14px;
  line-height: 1.5;
}

/* ---- One example: the sections, in the order a visitor uses them ---- */

.example-section {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.example-section h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
}

/* Try it: numbered stops on one line, because the order is the instruction. */
.example-try__steps {
  display: grid;
  gap: 24px;
  margin: 0;
  padding: 24px;
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: var(--example-shadow);
  list-style: none;
  counter-reset: try-step;
}

.example-try__steps li {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  counter-increment: try-step;
}

.example-try__steps li::before {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--color-brand-ink);
  background: var(--color-brand-soft);
  box-shadow: inset 0 0 0 1px var(--color-brand-line);
  content: counter(try-step);
  font-size: 14px;
  font-weight: 700;
}

.example-try__steps li:not(:last-child)::after {
  position: absolute;
  top: 32px;
  bottom: -24px;
  left: 15px;
  width: 2px;
  background: var(--color-brand-line);
  content: "";
}

.example-try__steps p,
.example-made__steps p {
  margin: 0;
  padding-top: 4px;
  color: var(--color-ink);
  font-size: 16px;
  line-height: 1.55;
}

@media (min-width: 48rem) {
  .example-try__steps {
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 32px;
    padding: 32px;
  }

  .example-try__steps li {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .example-try__steps li:not(:last-child)::after {
    top: 15px;
    right: -32px;
    bottom: auto;
    left: 48px;
    width: auto;
    height: 2px;
  }
}

/* What it shows: a grid of the features a visitor can see working. */
.example-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 16px 24px;
  margin: 0;
  padding: 24px;
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: var(--example-shadow);
  list-style: none;
}

.example-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.example-features .example-icon {
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 50%;
  color: var(--color-success);
  background: var(--color-success-soft);
  stroke-width: 2.4;
}

/* How it was made: the console steps as a route down the page, one rail and a stop per step, ending in
   the lime of a form that is live. */
.example-made {
  gap: 24px;
}

.example-made__intro {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
}

.example-made__intro > p:last-child {
  max-width: 400px;
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.6;
}

.example-made__start {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.example-made__label {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--color-muted);
  background: var(--color-surface-sunken);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.example-made__steps {
  display: grid;
  max-width: 720px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: made-step;
}

.example-made__steps li {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 16px;
  padding-bottom: 24px;
  counter-increment: made-step;
}

.example-made__steps li:last-child {
  padding-bottom: 0;
}

.example-made__steps li::before {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--color-brand-ink);
  background: var(--color-surface);
  box-shadow: inset 0 0 0 2px var(--color-brand-line);
  content: counter(made-step);
  font-size: 13px;
  font-weight: 700;
}

.example-made__steps li:last-child::before {
  color: var(--color-success);
  background: var(--color-success-soft);
  box-shadow: inset 0 0 0 2px var(--color-success);
}

.example-made__steps li:not(:last-child)::after {
  position: absolute;
  top: 32px;
  bottom: 0;
  left: 15px;
  width: 2px;
  background: var(--color-brand-line);
  content: "";
}

@media (min-width: 64rem) {
  .example-made {
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    align-items: start;
    gap: 48px;
  }

  .example-made__intro {
    position: sticky;
    top: 96px;
  }
}

.example-more__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

/* ---- The live boards (assets/examples-board.js) ---- */

.example-board {
  --board-columns: 40px minmax(0, 1fr) minmax(112px, 240px);
}

.example-board--guests {
  --board-columns: minmax(0, 1fr) 120px 72px;
}

@media (max-width: 39.99rem) {
  .example-board {
    --board-columns: 28px minmax(0, 1fr) auto;
  }

  .example-board--guests {
    --board-columns: minmax(0, 1fr) auto 48px;
  }

  .example-board__surface {
    padding: 0 16px;
  }

  .example-board__meter {
    max-width: 64px;
  }
}

.example-board__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.example-board__live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.4;
}

.example-board__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-slate-400);
}

.example-board:is([data-state="ready"], [data-state="empty"]) .example-board__dot {
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-soft);
}

.example-board:is([data-state="error"], [data-state="stale"]) .example-board__dot {
  background: var(--color-attention);
  box-shadow: 0 0 0 3px var(--color-attention-soft);
}

.example-board__surface {
  display: grid;
  min-width: 0;
  padding: 0 24px;
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: var(--example-shadow);
}

.example-board__status {
  margin: 0;
  padding: 16px 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.5;
}

.example-board:is([data-state="error"], [data-state="stale"]) .example-board__status {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--color-ink);
  background: var(--color-attention-soft);
}

.example-board__columns {
  display: grid;
  grid-template-columns: var(--board-columns);
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  border-block: 1px solid var(--color-line);
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.example-board--leaderboard .example-board__columns span:last-child,
.example-board--guests .example-board__columns span:last-child {
  text-align: right;
}

.example-board:not(:is([data-state="loading"], [data-state="ready"], [data-state="stale"])) .example-board__columns {
  display: none;
}

.example-board__list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.example-board__list:empty {
  display: none;
}

.example-board__row {
  display: grid;
  grid-template-columns: var(--board-columns);
  align-items: center;
  gap: 16px;
  min-height: 48px;
  padding: 8px 0;
  border-top: 1px solid var(--color-line);
  font-size: 14px;
}

.example-board__row:first-child {
  border-top: 0;
}

.example-board__rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--color-muted);
  background: var(--color-surface-sunken);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.example-board__rank--top {
  color: var(--color-brand-ink);
  background: var(--color-brand-soft);
}

.example-board__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.example-board__tag {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--color-muted);
  background: var(--color-surface-sunken);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.example-board__tag--yes {
  color: var(--color-set-ink);
  background: var(--color-set-soft);
}

.example-board__tag--maybe {
  color: var(--color-attention);
  background: var(--color-attention-soft);
}

.example-board__score {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* A ranking carries its own weight: each score as a bar against the full marks. */
.example-board__meter {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 160px;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--color-surface-sunken);
  appearance: none;
}

.example-board__meter::-webkit-meter-bar {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--color-surface-sunken);
}

.example-board__meter::-webkit-meter-optimum-value,
.example-board__meter::-webkit-meter-suboptimum-value,
.example-board__meter::-webkit-meter-even-less-good-value {
  border-radius: 999px;
  background: var(--color-brand);
}

.example-board__meter::-moz-meter-bar {
  border-radius: 999px;
  background: var(--color-brand);
}

.example-board__skeleton,
.example-board__empty {
  display: none;
}

.example-board[data-state="loading"] .example-board__skeleton {
  display: grid;
}

.example-board__skeleton span {
  height: 48px;
  border-top: 1px solid var(--color-line);
  background: linear-gradient(var(--color-surface-sunken), var(--color-surface-sunken)) 0 50% / 64% 12px no-repeat;
}

.example-board__skeleton span:first-child {
  border-top: 0;
}

.example-board__skeleton span:nth-child(2) {
  background-size: 48% 12px;
}

.example-board__skeleton span:nth-child(3) {
  background-size: 56% 12px;
}

@media (prefers-reduced-motion: no-preference) {
  .example-board__skeleton span {
    animation: example-board-loading 1.4s ease-in-out infinite alternate;
  }
}

@keyframes example-board-loading {
  from {
    opacity: 1;
  }

  to {
    opacity: .45;
  }
}

/* Empty is a route, not a void: the form, the wire and the Sheet, above what to do. */
.example-board[data-state="empty"] .example-board__empty {
  display: flex;
  order: -1;
  justify-content: center;
  padding-top: 32px;
}

.example-board[data-state="empty"] .example-board__status {
  padding-bottom: 32px;
  color: var(--color-ink);
  text-align: center;
}

.example-board__note {
  border-top: 1px solid var(--color-line);
}

.example-board__note summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  color: var(--color-ink);
  font-size: 14px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.example-board__note summary::-webkit-details-marker {
  display: none;
}

.example-board__note summary::after {
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid var(--color-muted);
  border-bottom: 2px solid var(--color-muted);
  content: "";
  transform: translateY(-2px) rotate(45deg);
}

.example-board__note[open] summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.example-board__note p {
  max-width: 720px;
  margin: 0;
  padding-bottom: 16px;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.6;
}

.example-board__note code {
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ---- The console: its Examples view and the Connections notice ---- */

.examples-view {
  display: grid;
  gap: 24px;
  min-width: 0;
}

/* The console's column is at most 1,024px wide, where three cards would each be too narrow for their
   route to run across (330px, above); two columns give every route its line across, as on /examples. */
/* The notice spans the console column, as the filters and cards below it do. On /examples it sits in
   the hero's text column and keeps its 720px measure; here that left a blank block beside it. */
.examples-view .examples-callout {
  max-width: none;
}

.examples-view .examples-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 378px), 1fr));
}

/* The console's .app-button pair shares the row the way the public .btn pair does. */
.examples-view .example-actions .app-button {
  flex: 1 1 auto;
}

/* One slim line on the Connections home: the rail's Examples mark, the sentence, a quiet link to the
   place and the dismiss. The controls are the console's link buttons; this lays them out. */
.examples-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 0 0 16px;
  padding: 4px 4px 4px 16px;
  border-radius: 12px;
  color: var(--color-ink);
  background: var(--color-brand-soft);
  font-size: 13px;
  line-height: 1.5;
}

.examples-banner__mark {
  color: var(--color-brand);
}

.examples-banner p {
  flex: 1 1 240px;
  min-width: 0;
  margin: 0;
}

.examples-banner__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* An icon-only control is as wide as it is tall, so the target is 44px both ways. */
.examples-banner__dismiss {
  min-width: 44px;
}

.examples-banner__dismiss svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
