/*
 * The app: the logged-in place of quo.systems, set as the site sets a
 * document, so the app and the site read as one. One system of parts, each
 * the same on a page the site writes and in a section the organism draws:
 *
 * - the shell: the page's slim bar (`.qs-appbar`) over the app (`.qs-app`),
 *   the site's numbered mono rail beside one column;
 * - the head (`.qs-ui-head`): the site's mono kicker, a display title one
 *   rung under the site's, a lead, the site's actions;
 * - the table (`.qs-ui-table`), the pill (`.qs-ui-pill`), the prose
 *   (`.qs-ui-prose`), the way back;
 * - the state (`.qs-ui-state`): the mark large over a head, for every moment
 *   that is not content (opening, empty, failed, a stranger, a link);
 * - the loader (`.qs-ui-loader`): the mark small, turning, with its words.
 *
 * The mark is the loader: its broken ring turns and breathes round the red
 * dot, which beats. Paper, ink and hairlines; the one red on the number of
 * the section shown, the one action that matters, and the dot. Every colour
 * is a slot of the tokens, so both themes follow. Classes alone, since the
 * lobes layer styles no element by its name.
 */

/* ---- the page's own frame: a slim bar and the room below -------------- */

.qs-appframe {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--nv-color-bg);
}

.qs-appbar,
[data-quo-note] {
  --rubric-gutter: 1rem;
  --rubric-column: 75rem;
}

@container qs-page (min-width: 48rem) {
  .qs-appbar,
  [data-quo-note] {
    --rubric-gutter: 1.5rem;
  }
}

/* The bar stands on the edge the home's column stands on, the same gutter and the same column, so the bar, the home and the
   note under it share one left edge. */
.qs-appbar {
  display: flex;
  gap: var(--nv-space-3, 0.75rem);
  align-items: center;
  padding-block: var(--nv-space-3, 0.75rem);
  padding-inline: max(var(--rubric-gutter), calc((100% - var(--rubric-column)) / 2 + var(--rubric-gutter)));
  border-block-end: 1px solid var(--nv-color-border);
}

.qs-appbar-mark {
  display: flex;
  flex: none;
  align-items: center;
  color: var(--nv-color-fg);
}

.qs-appbar-mark svg {
  display: block;
  width: auto;
  height: 1.5rem;
}

.qs-appbar-name {
  font-family: var(--nv-font-display);
  font-size: var(--nv-text-2xl, 1.5rem);
  font-weight: var(--nv-weight-normal, 400);
  line-height: 1;
  color: var(--nv-color-fg);
}

.qs-appbar-label,
.qs-appbar-back {
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.qs-appbar-label {
  color: var(--nv-color-fg-muted);
}

.qs-appbar-end {
  display: flex;
  gap: var(--nv-space-4, 1rem);
  align-items: center;
  margin-inline-start: auto;
}

.qs-appbar-back {
  color: var(--nv-color-fg-muted);
  text-decoration: none;
}

.qs-appbar-back:hover,
.qs-appbar-back:focus-visible {
  color: var(--nv-color-accent);
}

/* On a phone the label gives way, and the language shows by its flag alone, its name kept for a reader not
   looking at it, so the bar keeps its mark, its name, the way back and its two switchers on one line. */
@container qs-page (max-width: 30rem) {
  .qs-appbar-label,
  .qs-appbar summary.qs-lang .qs-lang-name {
    display: none;
  }
}

.qs-appmain {
  display: grid;
  min-width: 0;
}

/* The element the screen is drawn in fills the room below the bar, and what it holds fills it, down to the rail's rule. */
.qs-appmain [data-quo-screen] {
  min-width: 0;
}

.qs-appmain [data-quo-screen][data-quo='drawn'] {
  display: grid;
}

:host {
  display: grid;
}

/* ---- the shell: the person's choices at the top, the rail beside one column -------------------------- */

.qs-app-shell {
  display: grid;
  grid-template-rows: 1fr;
  min-height: 100%;
}

/*
 * One grid. On a narrow page: the choices, then the rail as a row of tabs, then the column. On a wide page the choices span the
 * top, ending where the column ends, and the rail stands beside the column, the two in the site's column of 75rem.
 */
.qs-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    'tools'
    'rail'
    'main';
  align-content: start;
  width: 100%;
  min-height: 100%;
  padding-inline: max(var(--rubric-gutter), calc((100% - var(--rubric-column)) / 2 + var(--rubric-gutter)));
}

/* The app stands in the column the site's bar and the home stand in, so the bar, the rail and the note share one left edge. */
.qs-app {
  --rubric-gutter: 1rem;
  --rubric-column: 75rem;
}

@container qs-page (min-width: 48rem) {
  .qs-app {
    --rubric-gutter: 1.5rem;
  }
}

@container qs-page (min-width: 52rem) {
  .qs-app {
    grid-template-columns: 14rem minmax(0, 1fr);
    grid-template-areas:
      'tools tools'
      'rail main';
    column-gap: var(--nv-space-8, 4rem);
  }
}

/* The person's own two choices, the language and the theme: the app's top, its end, one height on one line, as the site's bar. */
.qs-app-tools {
  grid-area: tools;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-block: var(--nv-space-3, 0.75rem);
}

.qs-app-choices {
  display: flex;
  gap: var(--nv-space-3, 0.75rem);
  align-items: center;
  font-family: var(--nv-font-sans);
}

/* The rail is the navigation alone: on a narrow page a row of tabs ruled under, which scrolls sideways where the sections take more
   than the row, its label unsaid, since the tabs say it. */
.qs-app-rail {
  grid-area: rail;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  border-block-end: 1px solid var(--nv-color-border);
  scrollbar-width: thin;
}

.qs-app-rail > .qs-app-label {
  display: none;
}

@container qs-page (min-width: 52rem) {
  .qs-app-rail {
    position: sticky;
    inset-block-start: 0;
    display: block;
    align-self: start;
    padding-block: var(--nv-space-6, 2rem);
    overflow: visible;
    border-block-end: 0;
  }

  .qs-app-rail > .qs-app-label {
    display: block;
    margin-block-end: var(--nv-space-3, 0.75rem);
  }
}

/* A label said quietly in the mono: the rail's, the place's line's, and each name's in it. */
.qs-app-label {
  display: block;
  flex: none;
  margin: 0;
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  font-weight: var(--nv-weight-normal, 400);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nv-color-fg-muted);
}

.qs-app-nav {
  display: flex;
  gap: var(--nv-space-2, 0.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* In the bar a narrow page lays the rail as, an item keeps its words whole: the bar scrolls, no word is cut. */
.qs-app-nav > li {
  flex: none;
}

@container qs-page (min-width: 52rem) {
  .qs-app-nav {
    display: grid;
  }
}

/* An item: its number in the accent's column, its words beside; the one shown carries the site's red bar. */
.qs-app-item {
  position: relative;
  display: grid;
  grid-template-columns: 2.5ch minmax(0, 1fr);
  gap: var(--nv-space-2, 0.5rem);
  align-items: baseline;
  width: 100%;
  padding: var(--nv-space-2, 0.5rem) var(--nv-space-3, 0.75rem);
  font: inherit;
  text-align: start;
  white-space: nowrap;
  text-decoration: none;
  color: var(--nv-color-fg-muted);
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--nv-radius-sm, 0.25rem);
  transition:
    color var(--nv-duration-fast, 120ms) var(--nv-ease-out, ease-out),
    background var(--nv-duration-fast, 120ms) var(--nv-ease-out, ease-out);
}

.qs-app-item:hover {
  color: var(--nv-color-fg);
  background: var(--nv-color-bg-raised-hover);
}

.qs-app-item:focus-visible {
  outline: 2px solid var(--nv-color-accent);
  outline-offset: 1px;
}

.qs-app-item:active {
  transform: translateY(1px);
}

.qs-app-no {
  color: var(--nv-color-fg-subtle, var(--nv-color-fg-muted));
}

.qs-app-on {
  color: var(--nv-color-fg);
  cursor: default;
}

.qs-app-on .qs-app-no {
  color: var(--nv-color-accent);
}

.qs-app-on::before {
  content: '';
  position: absolute;
  inset-block: var(--nv-space-2, 0.5rem);
  inset-inline-start: 0;
  width: 2px;
  background: var(--nv-color-accent);
}

@container qs-page (max-width: 51.99rem) {
  .qs-app-item {
    min-height: 2.75rem;
    align-items: center;
    padding-inline: var(--nv-space-1, 0.25rem) var(--nv-space-2, 0.5rem);
    border-radius: 0;
  }

  .qs-app-on::before {
    inset-block: auto 0;
    inset-inline: 0;
    width: auto;
    height: 2px;
  }
}

.qs-app-words {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qs-app-places .qs-app-item {
  grid-template-rows: auto auto;
}

.qs-app-places .qs-app-sub {
  grid-column: 2;
  font-size: 0.6875rem;
  color: var(--nv-color-fg-subtle, var(--nv-color-fg-muted));
}

/*
 * The switcher: at the app's door, where the walk names no place, the chooser alone, the mark over the
 * places, each ruled as the rail's items are; in a place, under the rail's sections, the other places, the mark hidden.
 */
.qs-app-switcher {
  display: grid;
  justify-items: center;
  gap: var(--nv-space-4, 1rem);
  max-width: 28rem;
  margin-inline: auto;
  padding-block: var(--nv-space-8, 4rem);
}

.qs-app-switcher .qs-ui-mark {
  width: 4.5rem;
  height: 4.5rem;
}

.qs-app-switcher .qs-app-nav {
  display: grid;
  width: 100%;
}

.qs-app-switcher .qs-app-item {
  width: 100%;
  border-block-end: 1px solid var(--nv-color-border, currentColor);
}

/* In a place, the switcher under the rail's sections, in the rail's face and size: told by its own class, since it is drawn in a
   root of its own and inherits nothing of the rail. */
.qs-app-switcher-in {
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  justify-items: stretch;
  max-width: none;
  margin: var(--nv-space-4, 1rem) 0 0;
  padding: 0;
}

.qs-app-switcher-in .qs-app-item {
  border-block-end: 0;
}

/* The column a section stands in, named so a section asks its own width: a container query finds the page's whole width first,
   and the column beside the rail is far narrower. Its top meets the rail's, so the section's kicker and the rail's label share a
   line. */
.qs-app-main {
  grid-area: main;
  container: qs-main / inline-size;
  min-width: 0;
  padding-block: var(--nv-space-6, 2rem) var(--nv-space-10, 6rem);
}

/* ---- a section, its head and its parts ------------------------------- */

.qs-ui-section {
  display: grid;
  gap: var(--nv-space-6, 2rem);
  max-width: 60rem;
  animation: qs-ui-arrive 220ms var(--nv-ease-out, ease-out) both;
}

@keyframes qs-ui-arrive {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.qs-ui-head {
  display: grid;
  gap: var(--nv-space-3, 0.75rem);
  padding-block-end: var(--nv-space-4, 1rem);
}

.qs-ui-title {
  max-width: 22ch;
  margin: 0;
  font-family: var(--nv-font-display);
  font-size: var(--nv-text-5xl, clamp(2rem, 1.4rem + 2.6vw, 3.25rem));
  font-weight: var(--nv-weight-normal, 400);
  line-height: var(--nv-leading-display, 1.05);
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--nv-color-fg);
}

.qs-ui-lead {
  max-width: 60ch;
  margin: 0;
  font-size: var(--nv-text-lg, 1.125rem);
  line-height: var(--nv-leading-normal, 1.5);
  color: var(--nv-color-fg-body);
}

.qs-ui-head .qs-actions,
.qs-ui-state .qs-actions {
  margin: var(--nv-space-2, 0.5rem) 0 0;
}

/*
 * A head whose one act stands on its title's line: the title, and the act
 * at the line's foot beside it. Under 40rem the act stands under the title.
 */
.qs-ui-head-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--nv-space-4, 1rem);
  align-items: end;
  justify-items: start;
}

@container qs-page (min-width: 40rem) {
  .qs-ui-head-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.qs-ui-head .qs-ui-head-row .qs-actions {
  margin: 0;
}

/* ---- a place's page, by the standard's parts ---------------- */

/*
 * A place's page is a head and its regions, one for each seat: a list, one
 * thing, a form, a status, an action, a conversation. A region is ruled
 * above as a clause is, its label the mono kicker, its help a quiet line.
 * The window lays them in a bare section, so each part keeps its own
 * measure and its own room above.
 */
.qs-ui-region {
  display: grid;
  gap: var(--nv-space-3, 0.75rem);
  max-width: 60rem;
  margin: 0;
  padding-block: var(--nv-space-5, 1.5rem);
  border-top: 1px solid var(--nv-color-border);
}

.qs-ui-region > .qs-kicker {
  margin: 0;
}

.qs-ui-help {
  max-width: 60ch;
  margin: 0;
  font-size: var(--nv-text-sm, 0.875rem);
  color: var(--nv-color-fg-muted);
}

.qs-ui-entries {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qs-ui-entry {
  display: grid;
  gap: var(--nv-space-3, 0.75rem);
  padding-block: var(--nv-space-3, 0.75rem);
  border-top: 1px solid var(--nv-color-border-subtle);
}

.qs-ui-entry:first-child {
  border-top: 0;
}

.qs-ui-entry > p {
  margin: 0;
}

.qs-ui-name {
  margin: 0;
  font-size: var(--nv-text-md, 1rem);
  font-weight: var(--nv-weight-medium, 500);
  color: var(--nv-color-fg);
}

.qs-ui-row[aria-current] {
  color: var(--nv-color-accent);
}

.qs-ui-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--nv-space-1, 0.25rem) var(--nv-space-4, 1rem);
  margin: 0;
}

@container qs-page (min-width: 40rem) {
  .qs-ui-fields {
    grid-template-columns: 12rem minmax(0, 1fr);
  }
}

.qs-ui-fields dt {
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  color: var(--nv-color-fg-muted);
}

.qs-ui-fields dd {
  margin: 0 0 var(--nv-space-2, 0.5rem);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--nv-color-fg-body);
}

.qs-ui-from {
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  color: var(--nv-color-fg-muted);
}

.qs-ui-status {
  max-width: 60ch;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--nv-color-fg);
}

.qs-ui-failed {
  padding-inline-start: var(--nv-space-3, 0.75rem);
  border-inline-start: 2px solid var(--nv-color-accent);
}

.qs-ui-told {
  max-width: 60ch;
  margin: 0;
  padding-inline-start: var(--nv-space-3, 0.75rem);
  color: var(--nv-color-fg);
  border-inline-start: 2px solid var(--nv-color-fg);
}

.qs-ui-form {
  max-width: 44rem;
  margin: 0;
}

.qs-ui-form .rubric-field input,
.qs-ui-form .rubric-field select,
.qs-ui-form .rubric-field textarea {
  max-width: none;
}

.qs-ui-form .rubric-field textarea {
  font-family: var(--nv-font-sans);
  line-height: var(--nv-leading-normal, 1.5);
  resize: vertical;
}

.qs-ui-form .qs-action {
  justify-self: start;
  cursor: pointer;
}

.qs-ui-act {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nv-space-3, 0.75rem);
  align-items: center;
  max-width: 60rem;
  padding-block: var(--nv-space-3, 0.75rem);
}

.qs-ui-act .qs-action {
  cursor: pointer;
}

.qs-action.qs-ui-danger {
  color: var(--nv-color-accent);
  border-color: var(--nv-color-accent);
}

/* The act of the reader's own thing, under what it was answered: the press, then a quiet line of when it may be pressed. */
.qs-ui-yourown {
  margin-block-start: var(--nv-space-5, 1.5rem);
}

.qs-ui-yourown .qs-quiet {
  margin: 0;
}

/* The way out of a place, under its section: ruled above, apart from the section's own acts, its press ruled in the red, a quiet line of what it does; asked, the question in its place. */
.qs-app-leave {
  display: grid;
  gap: var(--nv-space-2, 0.5rem);
  max-width: 60rem;
  margin-block-start: var(--nv-space-10, 6rem);
  padding-block-start: var(--nv-space-4, 1rem);
  border-top: 1px solid var(--nv-color-border);
}

.qs-app-leave .qs-ui-act {
  padding-block: 0;
}

/* In a narrow column the line's presses stand as one column the field's width, each the same, never a ragged run. */
@container qs-main (max-width: 30rem) {
  .qs-app-leave .qs-ui-act {
    display: grid;
  }
}

.qs-app-leave .qs-quiet,
.qs-app-leave .qs-ui-ask {
  margin: 0;
}

/*
 * The frame's parts on the app road, the site's page's own (FRAME-51): under the screen's element, in the app's own grid, so
 * they stand in the column the section stands in, the rail's room left empty beside them. Shown once the window hands a place.
 */
/* The app's hold: once the home draws, the screen's element gives its children to the hold, so the page's own parts stand
   after the tree and the port's note at the foot, under them, the hold reaching down the page. */
.qs-app-hold {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.qs-app-hold > [data-quo-screen]:is([data-quo='drawn'], [data-quo='kept']) {
  display: contents;
}

.qs-app-hold > .qs-app-under,
.qs-app-hold > .qs-link-roads {
  order: 1;
}

/* The page's own parts of a place stand only beside a drawn tree, never under the wait. */
.qs-app-hold:has(> [data-quo-screen]:not([data-quo='drawn'], [data-quo='kept'])) > .qs-app-under {
  display: none;
}

.qs-app-hold > [data-quo-screen] > [data-quo-note] {
  order: 2;
  align-self: flex-start;
  margin-block-start: auto;
}

.qs-app.qs-app-under {
  min-height: 0;
}

/* The window's refusal of a link pasted at home, in the home's words, said by the site's page under the home's tree on the
   column's edge, ruled in the red as a failure is. */
.qs-app-hold > .qs-app-said {
  --rubric-gutter: 1rem;
  --rubric-column: 75rem;

  order: 1;
  box-sizing: border-box;
  max-width: none;
  margin: var(--nv-space-4, 1rem) max(var(--rubric-gutter), calc((100% - var(--rubric-column)) / 2 + var(--rubric-gutter))) 0;
}

@container qs-page (min-width: 48rem) {
  .qs-app-hold > .qs-app-said {
    --rubric-gutter: 1.5rem;
  }
}

.qs-app-said[hidden] {
  display: none;
}

.qs-app-under[hidden] {
  display: none;
}

.qs-app-below {
  grid-area: main;
  container: qs-main / inline-size;
  min-width: 0;
  padding-block-end: var(--nv-space-10, 6rem);
}

.qs-app-below .qs-app-place {
  margin-block-start: 0;
}

/* The person's other places on the site, each a walk to it, in the fold above the names. */
.qs-app-elsewhere {
  display: grid;
  gap: var(--nv-space-2, 0.5rem);
}

.qs-app-elsewhere .qs-ui-act {
  padding: 0;
}

/*
 * The place's line: one fold at the column's foot, ruled above, closed until the person opens it. Its head is one line, the label
 * in the mono, what it holds said quietly, and the sign at its end; open, the two names side by side where the column has room,
 * each its label, a quiet line and its field with its press, one height; then the presses, Move to my home at the start, block
 * and leave ruled in the red at the end, each a column the width of the column where it is narrow.
 */
.qs-app-place {
  max-width: 60rem;
  margin-block-start: var(--nv-space-10, 6rem);
  border-block-start: 1px solid var(--nv-color-border-strong);
}

.qs-app-place-head {
  display: flex;
  gap: var(--nv-space-3, 0.75rem);
  align-items: baseline;
  min-height: 3.25rem;
  padding-block: var(--nv-space-4, 1rem);
  cursor: pointer;
  list-style: none;
}

.qs-app-place-head::-webkit-details-marker {
  display: none;
}

.qs-app-place-head:focus-visible {
  outline: 2px solid var(--nv-color-accent);
  outline-offset: 2px;
}

.qs-app-place-what {
  min-width: 0;
  font-size: var(--nv-text-sm, 0.875rem);
  color: var(--nv-color-fg-muted);
}

.qs-app-place-sign {
  margin-inline-start: auto;
  font-family: var(--nv-font-mono);
  color: var(--nv-color-fg-muted);
}

.qs-app-place-sign::before {
  content: '+';
}

.qs-app-place[open] .qs-app-place-sign::before {
  content: '\2212';
}

.qs-app-place-head:hover .qs-app-place-sign,
.qs-app-place-head:hover .qs-app-label {
  color: var(--nv-color-fg);
}

@container qs-main (max-width: 30rem) {
  .qs-app-place-what {
    display: none;
  }
}

.qs-app-place-body {
  display: grid;
  gap: var(--nv-space-6, 2rem);
  padding-block: var(--nv-space-2, 0.5rem) var(--nv-space-4, 1rem);
}

.qs-app-names {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--nv-space-6, 2rem);
}

@container qs-main (min-width: 40rem) {
  .qs-app-names {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--nv-space-6, 2rem) var(--nv-space-8, 4rem);
  }
}

.qs-app-name {
  display: grid;
  align-content: start;
  gap: var(--nv-space-1, 0.25rem);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.qs-app-help {
  margin: 0;
  font-size: var(--nv-text-sm, 0.875rem);
  color: var(--nv-color-fg-muted);
}

.qs-app-name-row {
  display: flex;
  gap: var(--nv-space-2, 0.5rem);
  margin-block-start: var(--nv-space-2, 0.5rem);
}

.qs-app-name-row input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  height: 2.75rem;
}

.qs-app-name-row .qs-action {
  flex: none;
  min-height: 2.75rem;
  cursor: pointer;
}

.qs-app-acts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nv-space-2, 0.5rem);
  justify-content: space-between;
}

.qs-app-acts > .qs-ui-act {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nv-space-2, 0.5rem);
  padding: 0;
}

.qs-app-acts > .qs-ui-act:empty {
  display: none;
}

@container qs-main (max-width: 30rem) {
  .qs-app-acts,
  .qs-app-acts > .qs-ui-act {
    display: grid;
    justify-content: stretch;
    justify-items: stretch;
    width: 100%;
  }

  .qs-app-acts .qs-action {
    width: 100%;
  }

  /* On a phone a name's press stands under its field, the field the column's width, so a long word is never cut. */
  .qs-ui-form .qs-app-name-row {
    flex-wrap: wrap;
  }

  .qs-ui-form .qs-app-name-row .qs-action {
    flex: 1 1 100%;
  }
}

/* The profile's name stands at the column's reading measure. */
.qs-ui-form.qs-app-name {
  max-width: 34rem;
}

/* The link a move gave stands in the fold as a field of its own with its copy beside it. */
.qs-app-field {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nv-space-2, 0.5rem);
  align-items: flex-end;
  margin: 0;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.qs-app-field .rubric-field {
  flex: 1 1 14rem;
}

.qs-app-field .rubric-field input {
  max-width: none;
  height: 2.75rem;
}

.qs-app-field .qs-action {
  min-height: 2.75rem;
  cursor: pointer;
}

.qs-app-place .qs-quiet {
  margin: 0;
}

/* The link a move gave, to copy: the field mono, its text scrolled within it, its copy beside it as a line press is. */
.qs-app-field input[readonly],
.qs-app-name-row input[readonly] {
  font-family: var(--nv-font-mono);
}

/* A question asked in place, before what cannot be taken back: ruled all round in the red, its words, then its yes and its no. */
.qs-ui-ask {
  display: grid;
  gap: var(--nv-space-4, 1rem);
  max-width: 60rem;
  margin-block-start: var(--nv-space-5, 1.5rem);
  padding: var(--nv-space-4, 1rem) var(--nv-space-5, 1.5rem);
  border: 1px solid var(--nv-color-accent);
  border-radius: var(--nv-radius-md);
  min-inline-size: 0;
}

/* A field the yes carries, a link's consent asking the name the person goes by and their word for the place. */
.qs-ui-ask .rubric-field {
  max-width: 40rem;
}

.qs-ui-ask-say {
  max-width: 60ch;
  margin: 0;
  font-family: var(--nv-font-display);
  font-size: var(--nv-text-2xl, 1.75rem);
  line-height: var(--nv-leading-tight, 1.15);
  color: var(--nv-color-fg);
}

/* What the place says with its link and how long it stands, each a line, ruled at their start as a quotation is. */
.qs-ui-ask-lines {
  display: grid;
  gap: var(--nv-space-1, 0.25rem);
  padding-inline-start: var(--nv-space-3, 0.75rem);
  border-inline-start: 2px solid var(--nv-color-border-strong);
}

.qs-ui-ask-line {
  max-width: 60ch;
  margin: 0;
  color: var(--nv-color-fg-body);
}

.qs-ui-ask .qs-app-name input {
  height: 2.75rem;
  margin-block-start: var(--nv-space-2, 0.5rem);
}

.qs-ui-ask .qs-app-names {
  margin-block-start: var(--nv-space-2, 0.5rem);
}

.qs-ui-ask .qs-ui-act {
  padding-block-end: 0;
}

/*
 * What the home says beside a page, in the site's own element and outside
 * the screen: that this browser may clear what the organism holds.
 * A quiet mono line at the foot, on the home's column's edge, never the
 * body's bare paragraph.
 */
[data-quo-note] {
  margin: 0;
  padding-block: var(--nv-space-4, 1rem) var(--nv-space-6, 2rem);
  padding-inline: max(var(--rubric-gutter), calc((100% - var(--rubric-column)) / 2 + var(--rubric-gutter)));
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  line-height: var(--nv-leading-normal, 1.5);
  color: var(--nv-color-fg-subtle);
  align-self: end;
}

/* ---- the table, the pill, the prose, the terms, the way back --------- */

.qs-ui-table-hold {
  overflow-x: auto;
  scrollbar-width: thin;
}

.qs-ui-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--nv-text-sm, 0.875rem);
}

.qs-ui-table th {
  padding: var(--nv-space-2, 0.5rem) var(--nv-space-3, 0.75rem);
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  font-weight: var(--nv-weight-normal, 400);
  letter-spacing: 0.06em;
  text-align: start;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--nv-color-fg-muted);
  border-block-end: 1px solid var(--nv-color-border-strong);
}

.qs-ui-table tbody th {
  text-transform: none;
  letter-spacing: 0;
  color: var(--nv-color-fg);
  border-block-end: 1px solid var(--nv-color-border);
}

.qs-ui-table td {
  padding: var(--nv-space-3, 0.75rem);
  vertical-align: baseline;
  color: var(--nv-color-fg-body);
  border-block-end: 1px solid var(--nv-color-border);
}

.qs-ui-table th:first-child,
.qs-ui-table td:first-child {
  padding-inline-start: 0;
}

.qs-ui-table tbody tr {
  transition: background var(--nv-duration-fast, 120ms) var(--nv-ease-out, ease-out);
}

.qs-ui-table tbody tr:hover {
  background: var(--nv-color-bg-raised-hover);
}

/* A row's number, in the red mono as a clause's is; the cell that holds its title keeps a measure a title reads at. */
.qs-ui-table .qs-ui-no {
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--nv-color-accent);
}

.qs-ui-table td:has(> .qs-ui-titled) {
  min-width: 14rem;
}

/*
 * A row's title and the mark of the reader's own beside it, on one baseline;
 * where the mark has no room it stands under the title, at the title's edge.
 */
.qs-ui-titled {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--nv-space-2, 0.5rem);
  align-items: baseline;
}

.qs-ui-yours {
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  color: var(--nv-color-accent);
}

.qs-ui-num {
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A row's title is a press. It is laid as a flex line, so a title of several lines sits on its first line's baseline beside the cells of its row. */
.qs-ui-row {
  display: inline-flex;
  padding: 0;
  font: inherit;
  font-size: var(--nv-text-md, 1rem);
  font-weight: var(--nv-weight-medium, 500);
  text-align: start;
  color: var(--nv-color-fg);
  cursor: pointer;
  background: none;
  border: 0;
}

.qs-ui-row:hover,
.qs-ui-row:focus-visible {
  color: var(--nv-color-accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.qs-ui-sub {
  margin: var(--nv-space-1, 0.25rem) 0 0;
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  color: var(--nv-color-fg-muted);
}

/* Who filed a row, in a column of its own; where the page is too narrow for it, the name stands under the title instead. */
.qs-ui-table td.qs-ui-by {
  font-size: var(--nv-text-sm, 0.875rem);
  white-space: nowrap;
  color: var(--nv-color-fg);
}

.qs-ui-subby {
  display: none;
}

@container qs-page (max-width: 40rem) {
  .qs-ui-table .qs-ui-by {
    display: none;
  }

  .qs-ui-subby {
    display: inline;
  }
}

/* The same in the app's column, where a section stands beside the rail: the column, not the page, is what is too narrow, and
   below 46rem it holds the table's six columns in no language rubric speaks, the German heads the widest. */
@container qs-main (max-width: 46rem) {
  .qs-ui-table .qs-ui-by {
    display: none;
  }

  .qs-ui-subby {
    display: inline;
  }
}

.qs-ui-pill {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  white-space: nowrap;
  color: var(--nv-color-fg-muted);
  border: 1px solid var(--nv-color-border-strong);
  border-radius: 999px;
}

.qs-ui-pill-other {
  color: var(--nv-color-fg-muted);
}

.qs-ui-pill-denied {
  color: var(--nv-color-fg-muted);
}

.qs-ui-pill-waits,
.qs-ui-pill-built {
  color: var(--nv-color-fg);
  border-color: var(--nv-color-fg);
}

.qs-ui-prose {
  display: grid;
  gap: var(--nv-space-4, 1rem);
  max-width: 64ch;
  font-size: var(--nv-text-lg, 1.125rem);
  line-height: var(--nv-leading-relaxed, 1.65);
  color: var(--nv-color-fg-body);
}

.qs-ui-prose p {
  margin: 0;
}

/* What a thing was answered, ruled above as a clause is: its kicker, then why. */
.qs-ui-answer {
  display: grid;
  gap: var(--nv-space-3, 0.75rem);
  max-width: 60rem;
  padding-block-start: var(--nv-space-5, 1.5rem);
  border-top: 1px solid var(--nv-color-border);
}

.qs-ui-answer .qs-kicker,
.qs-ui-answer .qs-quiet {
  margin: 0;
}

.qs-ui-back {
  justify-self: start;
  padding: var(--nv-space-1, 0.25rem) 0;
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  letter-spacing: 0.04em;
  color: var(--nv-color-fg-muted);
  cursor: pointer;
  background: none;
  border: 0;
}

.qs-ui-back:hover,
.qs-ui-back:focus-visible {
  color: var(--nv-color-accent);
}

/* ---- the mark at work: the state and the loader ---------------------- */

.qs-ui-mark {
  display: block;
  width: 3rem;
  height: 3rem;
  overflow: visible;
}

.qs-ui-mark-track {
  stroke: transparent;
}

.qs-ui-mark-ring {
  stroke: var(--nv-color-fg);
}

.qs-ui-mark-dot {
  fill: var(--nv-color-accent);
}

.qs-ui-mark-turning .qs-ui-mark-track {
  stroke: var(--nv-color-border);
}

.qs-ui-mark-turning .qs-ui-mark-ring,
.qs-ui-mark-turning .qs-ui-mark-dot {
  transform-box: view-box;
  transform-origin: 50% 50%;
}

.qs-ui-mark-turning .qs-ui-mark-ring {
  animation:
    qs-ui-turn 1.4s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite,
    qs-ui-breathe 2.8s ease-in-out infinite;
}

.qs-ui-mark-turning .qs-ui-mark-dot {
  animation: qs-ui-beat 1.4s ease-in-out infinite;
}

@keyframes qs-ui-turn {
  from {
    transform: rotate(-54deg);
  }

  to {
    transform: rotate(306deg);
  }
}

@keyframes qs-ui-breathe {
  0%,
  100% {
    stroke-dasharray: 118 32;
  }

  50% {
    stroke-dasharray: 44 106;
  }
}

@keyframes qs-ui-beat {
  0%,
  100% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .qs-ui-mark-turning .qs-ui-mark-ring {
    animation: qs-ui-turn 4s linear infinite;
  }

  .qs-ui-mark-turning .qs-ui-mark-dot,
  .qs-ui-section {
    animation: none;
  }
}

/* The state: the mark large, then the kicker, the title, the lead, a mono why, the actions; centred, wherever it stands. */
.qs-ui-state {
  display: grid;
  justify-items: center;
  gap: var(--nv-space-3, 0.75rem);
  max-width: 40rem;
  margin-inline: auto;
  padding-block: var(--nv-space-8, 4rem);
  /* The page's gutter, so on a phone its words and its rules never touch the screen's edge. */
  padding-inline: var(--qs-gutter, 1rem);
  text-align: center;
}

.qs-ui-state-waiting {
  cursor: progress;
}

.qs-ui-state .qs-ui-mark {
  width: 4.5rem;
  height: 4.5rem;
  margin-block-end: var(--nv-space-4, 1rem);
}

.qs-ui-state .qs-ui-title {
  max-width: 18ch;
}

.qs-ui-state .qs-ui-lead {
  max-width: 48ch;
}

.qs-ui-note {
  max-width: 60ch;
  margin: 0;
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  overflow-wrap: anywhere;
  color: var(--nv-color-fg-muted);
}

.qs-ui-state .qs-actions {
  justify-content: center;
}

/* A thing the place does not hold: no mark, at the column's start, a part of the page and never the page. */
.qs-ui-state-quiet {
  justify-items: start;
  margin-inline: 0;
  padding-block: var(--nv-space-6, 2rem);
  text-align: start;
}

.qs-ui-state-quiet .qs-actions {
  justify-content: start;
}

/* The steps a stranger is told, numbered as the rail is. */
.qs-ui-steps {
  display: grid;
  gap: var(--nv-space-4, 1rem);
  width: 100%;
  margin: var(--nv-space-4, 1rem) 0;
  padding: 0;
  text-align: start;
  list-style: none;
}

@container qs-page (min-width: 44rem) {
  .qs-ui-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.qs-ui-steps li {
  display: grid;
  /* A step keeps its lines together at the top, whatever the tallest beside it: the titles share one line. */
  align-content: start;
  gap: var(--nv-space-1, 0.25rem);
  padding-block-start: var(--nv-space-3, 0.75rem);
  color: var(--nv-color-fg-body);
  border-block-start: 1px solid var(--nv-color-border-strong);
}

.qs-ui-steps p {
  margin: 0;
}

.qs-ui-step-title {
  font-weight: var(--nv-weight-medium, 500);
  color: var(--nv-color-fg);
}

/* The loader: the mark small and turning, its words beneath, filling the section while it opens. */
.qs-ui-loader {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--nv-space-4, 1rem);
  min-height: 20rem;
}

.qs-ui-loader-words {
  margin: 0;
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nv-color-fg-muted);
}

/* ---- the pages' own moments, chosen by `data-quo` alone --------------- */

/*
 * The screen's element, `[data-quo-screen]`, holds the site's own states until the organism's first tree replaces them:
 * opening (no attribute yet, or `waking`), read as the link being read on the landing; a stranger (`none`); and a failure
 * (`failed`, its why from `data-quo-why`). On the landing, a link the window refused is said beside the element, its hold
 * marked `data-qs-link="failed"`.
 */
.qs-app-waking,
.qs-app-none,
.qs-app-failed,
.qs-link-failed {
  display: none;
}

[data-quo-screen]:not([data-quo]) :is(.qs-app-waking, .qs-link-reading),
[data-quo-screen][data-quo='waking'] :is(.qs-app-waking, .qs-link-reading),
[data-quo-screen][data-quo='none'] .qs-app-none,
[data-quo-screen][data-quo='failed'] .qs-app-failed,
.qs-link[data-qs-link='failed'] > .qs-link-failed {
  display: grid;
}

[data-quo-screen]:is([data-quo='none'], [data-quo='failed']) .qs-link-reading,
.qs-link[data-qs-link='failed'] .qs-link-reading {
  display: none;
}

/*
 * The organism's loader did not load, so nothing will say `data-quo`: the page says it itself, in
 * `data-qs-loader`, and its failure stands in place of the wait, on `/dashboard/` and on `/quo/`.
 */
[data-quo-screen][data-qs-loader='failed'] .qs-app-failed {
  display: grid;
}

[data-quo-screen][data-qs-loader='failed'] :is(.qs-app-waking, .qs-link-reading) {
  display: none;
}

[data-quo-screen][data-quo='failed']::after {
  content: attr(data-quo-why);
  display: block;
  max-width: 40rem;
  margin: calc(-1 * var(--nv-space-6, 2rem)) auto var(--nv-space-8, 4rem);
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  text-align: center;
  overflow-wrap: anywhere;
  color: var(--nv-color-fg-muted);
}

/*
 * The page's bar stands over the app everywhere, its mark and its way back the site's own links, and the person's two choices,
 * the language and the theme, the page's own controls of the home's choice (FRAME-12, FRAME-51): one place for them, at every
 * moment, so no control stands twice.
 */

/*
 * A screen kept from the last visit stands while the organism wakes:
 * the page's top edge says it is being read again, the one red running along
 * it, and only once the wait is longer than a blink. The fresh tree ends it.
 */
.qs-appframe:has([data-quo='kept'])::after {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 20;
  height: 1px;
  content: '';
  background: linear-gradient(90deg, transparent, var(--nv-color-accent), transparent) no-repeat;
  background-size: 28% 100%;
  opacity: 0;
  animation:
    qs-ui-reading-in 0s linear 400ms forwards,
    qs-ui-reading 1.4s ease-in-out 400ms infinite;
}

@keyframes qs-ui-reading-in {
  to {
    opacity: 1;
  }
}

@keyframes qs-ui-reading {
  from {
    background-position: -40% 0;
  }

  to {
    background-position: 140% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .qs-appframe:has([data-quo='kept'])::after {
    background-position: 50% 0;
    background-size: 100% 100%;
    animation: qs-ui-reading-in 0s linear 400ms forwards;
  }
}

/* A line that shows only once a wait runs long. */
.qs-ui-late {
  visibility: hidden;
  animation: qs-ui-late 0s linear 8s forwards;
}

@keyframes qs-ui-late {
  to {
    visibility: visible;
  }
}

/*
 * `/forget/`, the wipe: one centred column, its moments chosen by
 * `data-qs-forget`: what it does with its press (`offer`), the question asked
 * in place of the press (`asking`, and `removing` while the wipe runs, its
 * presses quiet), removed (`done`) and a removal that failed (`failed`), its
 * why a quiet line where there is one.
 */
.qs-forget {
  display: grid;
  width: min(100%, 40rem);
  margin-inline: auto;
}

.qs-forget-act {
  display: grid;
}

.qs-forget-done,
.qs-forget-failed,
.qs-forget .qs-ui-ask,
.qs-forget-why:empty {
  display: none;
}

.qs-forget[data-qs-forget='asking'] .qs-ui-ask,
.qs-forget[data-qs-forget='removing'] .qs-ui-ask,
.qs-forget[data-qs-forget='done'] .qs-forget-done,
.qs-forget[data-qs-forget='failed'] .qs-forget-failed {
  display: grid;
}

.qs-forget[data-qs-forget='asking'] .qs-forget-act > .qs-actions,
.qs-forget[data-qs-forget='removing'] .qs-forget-act > .qs-actions,
.qs-forget[data-qs-forget='done'] .qs-forget-offer,
.qs-forget[data-qs-forget='failed'] .qs-forget-offer {
  display: none;
}

.qs-forget[data-qs-forget='removing'] .qs-ui-ask .qs-action {
  pointer-events: none;
  opacity: 0.5;
}

.qs-forget .qs-ui-ask {
  justify-items: center;
  margin-block-start: 0;
  text-align: center;
}

.qs-forget .qs-ui-ask .qs-ui-act {
  justify-content: center;
}

/* The landing: one centred column where a link is read and the consent drawn. */
.qs-landing {
  display: grid;
  align-content: center;
  min-height: calc(100dvh - 4rem);
  padding: var(--nv-space-6, 2rem) var(--nv-space-4, 1rem);
}

.qs-link {
  display: grid;
  width: min(100%, 40rem);
  margin-inline: auto;
}

/* Once the home draws, its tree is the page, with gutters of its own: the landing's hold gives way, so a consent, and the app a yes
   walks to, stand at the width they lay. */
.qs-landing:has([data-quo-screen]:is([data-quo='drawn'], [data-quo='kept'])) {
  align-content: start;
  min-height: 0;
  padding: 0;
}

.qs-link:has([data-quo-screen]:is([data-quo='drawn'], [data-quo='kept'])) {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/*
 * The landing's own roads beside a link's consent (FRAME-38), under the screen's element and never inside the consent:
 * Open in my home and Copy the link, two controls of one height on one line, the first ruled in the red, never filled,
 * since the consent's yes is the one red press, and the copy in the ink; then the link's QR, small and alone on its line, its words quiet in the mono above it. They stand while the
 * consent waits, and the copy says it is done in its own place, so nothing moves.
 */
.qs-link-roads {
  display: grid;
  justify-items: center;
  gap: var(--nv-space-5, 1.5rem);
  width: min(100%, 40rem);
  margin: var(--nv-space-5, 1.5rem) auto 0;
  padding: 0 var(--nv-space-4, 1rem) var(--nv-space-6, 2rem);
}

.qs-link-roads[hidden] {
  display: none;
}

/* On a narrow page the two stand one under the other, each the column's width, so neither is shorter than the other. */
@container qs-page (max-width: 30rem) {
  .qs-link-roads .qs-actions {
    flex-direction: column;
    align-self: stretch;
    width: 100%;
  }

  .qs-link-roads .qs-action {
    justify-content: center;
  }
}

.qs-link-roads .qs-actions {
  justify-content: center;
  margin: 0;
}

.qs-link-roads .qs-action[data-qs-road='home'] {
  border-color: var(--nv-color-accent);
  color: var(--nv-color-accent);
}

.qs-link-roads button.qs-action {
  display: inline-grid;
  align-items: center;
  justify-items: center;
  cursor: pointer;
}

.qs-link-copy,
.qs-link-copied {
  grid-area: 1 / 1;
}

.qs-link-copied,
[data-qs-copied] > .qs-link-copy {
  visibility: hidden;
}

[data-qs-copied] > .qs-link-copied {
  visibility: visible;
}

.qs-link-qr {
  display: grid;
  justify-items: center;
  gap: var(--nv-space-2, 0.5rem);
  margin: 0;
  color: var(--nv-color-fg);
}

.qs-link-qr figcaption {
  font-family: var(--nv-font-mono);
  font-size: var(--nv-text-xs, 0.75rem);
  letter-spacing: 0.08em;
  color: var(--nv-color-fg-muted);
}

.qs-link-qr svg {
  display: block;
  inline-size: 8.5rem;
  block-size: 8.5rem;
}
