/* Editor (app.): section stepper on the left, one section's questions
   on the right. Collapses to one column on narrow screens. */
.editor {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

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

/* —— Stepper: each section is a station on a rail —— */
.stepper__title {
  font-size: var(--text-sm);
  font-weight: 700;
  margin-block-end: var(--space-1);
}

.stepper ol {
  list-style: none;
  padding: 0;
  display: grid;
}

.stepper li {
  max-width: none;
}

.stepper__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target-min);
  padding: var(--space-1);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  text-decoration: none;
}

.stepper__item:hover {
  background: var(--color-paper-dim);
}

.stepper__item:hover .stepper__text {
  text-decoration: underline;
  text-decoration-thickness: var(--border);
  text-underline-offset: var(--underline-offset);
}

/* The rail: drawn by the list item, behind the circle (memory.md:
   a line behind an element is drawn on a sibling or ancestor), and as a
   border, so forced colors keep it. */
.stepper li {
  position: relative;
}

.stepper li + li::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--space-1) + 1.25rem - var(--border) / 2);
  inset-block-start: calc(var(--target-min) / -2);
  block-size: var(--target-min);
  border-inline-start: var(--border) solid var(--color-line);
}

.stepper__num {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2.5rem;
  block-size: 2.5rem;
  flex: none;
  border-radius: 50%;
  border: var(--border) solid var(--color-ink);
  background: var(--color-paper);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Where you are: the circle fills in and the words go bold. */
.stepper__item[aria-current="page"] {
  font-weight: 700;
}

.stepper__item[aria-current="page"] .stepper__num {
  background: var(--color-ink);
  color: var(--color-paper);
}

.stepper__add {
  font-weight: 600;
  width: 100%;
  text-align: start;
}

.stepper__add .stepper__num {
  border-style: dashed;
}

/* "+ Add a section" sits on the rail, where the new section appears. */
.stepper li > form {
  display: block;
}

.stepper__text {
  min-width: 0;
}

/* A station's quiet second line: its state in words. */
.stepper__note {
  display: block;
  font-weight: 400;
  color: var(--color-ink-soft);
  line-height: 1.3;
}

/* Station numbers like "3a" need a little room inside the same circle. */
.stepper__num {
  letter-spacing: -0.02em;
}

/* A branch station hangs off the trunk (design/mockups/paths/spec.md § 2): its circle is indented and a
   short spur joins it to the rail. The rail keeps its x, so the trunk runs straight past. The spur is
   drawn on the list item, never on the circle (memory/design.md), and as a border, so forced colors
   keep it. */
.stepper li.is-branch > .stepper__item {
  padding-inline-start: calc(var(--space-1) + 2.5rem);
}

.stepper li.is-branch::after {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--space-1) + 1.25rem - var(--border) / 2);
  inset-block-start: calc(50% - var(--border) / 2);
  inline-size: 1.75rem;
  border-block-start: var(--border) solid var(--color-line);
}

/* Bookend glyphs sit inside the same circle as the numbers. */
.stepper__num svg {
  inline-size: 1.375rem;
  block-size: 1.375rem;
}

/* —— Canvas —— */
.canvas-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  align-items: baseline;
  justify-content: space-between;
}

.section-kicker {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-ink-soft);
  font-variant-numeric: tabular-nums;
}

/* Question card: visibly a card, Edit always visible (memory.md). */
.qcard {
  border: var(--border) solid var(--color-line);
  border-radius: var(--radius);
  overflow: hidden;
}

.qcard:hover,
.qcard.is-open {
  border-color: var(--color-ink);
}

.qcard__preview {
  padding: var(--space-3);
}

/* Text or list block card: the same card, plus a plain spine (a thicker
   left edge in --color-line). No grip dots: nothing drags. */
.qcard--block {
  border-inline-start-width: calc(var(--border) * 4);
}

/* A fixed slot's preview: the thank-you heading, large, as people read it. */
.qcard__heading {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* The send button's words, as a sentence: never a drawn button that does nothing. */
.send-preview strong {
  font-size: var(--text-lg);
  font-weight: 700;
}

/* The summary's canvas in the page's own order: four labelled parts, a quiet rule above each
   part after the first. */
.page-part + .page-part {
  border-block-start: var(--border) solid var(--color-line);
  padding-block-start: var(--space-4);
}

.qcard__label {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

/* The specimen: looks like the control, but quiet and inert. */
.specimen {
  margin-block-start: var(--space-1);
  border: var(--border) solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-paper-dim);
  min-height: 2.75rem;
}

.specimen--long {
  min-height: 5rem;
}

/* Dropdown: the closed control with its placeholder and arrow. */
.specimen--select {
  position: relative;
  display: flex;
  align-items: center;
  padding-inline: var(--space-2) calc(var(--space-2) * 2 + 0.6em);
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
}

.specimen--select::after {
  content: "";
  position: absolute;
  inset-inline-end: var(--space-2);
  inset-block-start: 50%;
  inline-size: 0.6em;
  block-size: 0.6em;
  border-inline-end: var(--border) solid currentColor;
  border-block-end: var(--border) solid currentColor;
  transform: translateY(-70%) rotate(45deg);
}

/* A dropdown hides its options; the card must not. One quiet run of words. */
.specimen-list {
  margin-block-start: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
  max-width: none;
}

.specimen-list ul {
  display: inline;
  list-style: none;
  padding: 0;
  margin: 0;
}

.specimen-list li {
  display: inline;
  color: var(--color-ink);
  overflow-wrap: anywhere;
}

.specimen-list li:not(:last-child)::after {
  content: " · " / "";
  color: var(--color-ink-soft);
}

.specimen-choices {
  margin-block-start: var(--space-1);
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-1);
}

.specimen-choices li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.specimen-choices li::before {
  content: "";
  inline-size: 1.25rem;
  block-size: 1.25rem;
  flex: none;
  border: var(--border) solid var(--color-ink-soft);
  border-radius: 50%;
}

.specimen-choices--tick li::before {
  border-radius: calc(var(--radius) / 2);
}

/* Toolbar strip: what the card is, and what you can do to it. */
.qcard__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--color-paper-dim);
  border-block-start: var(--border) solid var(--color-line);
}

.qcard__kind {
  flex: 1 1 14rem;
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
}

.qcard__kind b {
  color: var(--color-ink);
  font-weight: 600;
}

.qcard__actions {
  flex-wrap: wrap;
  display: flex;
  gap: var(--space-1);
  margin-inline-start: auto;
}

/* ↑ ↓ — plain visible arrows, full-size targets, no drag-and-drop. */
.move {
  inline-size: var(--target-min);
  block-size: var(--target-min);
  font-size: var(--text-lg);
  font-weight: 700;
  border: var(--border) solid var(--color-ink);
  border-radius: var(--radius);
  background: var(--color-paper);
}

.move:hover {
  background: var(--color-paper-dim);
}

/* A move that can't happen: grayed out like the blocked Next, still in
   place so the row doesn't jump. */
.move:disabled {
  background: var(--color-paper-dim);
  border-color: var(--color-line);
  color: var(--color-ink-disabled);
}

.qcard__settings {
  padding: var(--space-3);
  border-block-start: var(--border) solid var(--color-line);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: var(--space-3);
}

.qcard__settings .field {
  max-width: none;
}

/* Answer rules: a native disclosure that looks openable. */
.rules {
  border: var(--border) solid var(--color-line);
  border-radius: var(--radius);
  padding: var(--space-1) var(--space-2);
}

.rules summary {
  flex-wrap: wrap;
  cursor: pointer;
  font-weight: 600;
  min-height: var(--target-min);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.rules summary span {
  text-decoration: underline;
  text-decoration-thickness: var(--border);
  text-underline-offset: var(--underline-offset);
}

.rules[open] summary {
  margin-block-end: var(--space-2);
}

.rules > div {
  padding-block-end: var(--space-2);
}

/* Your own format: the shape group shows only while it's chosen, and the length fields step aside.
   Pure CSS, so it works with no script. Without :has() everything shows, with a line saying when it applies. */
@supports selector(:has(*)) {
  .rules .shape-field {
    display: none;
  }

  .rules:has(option[value="custom"]:checked) .shape-field {
    display: block;
  }

  .rules:has(option[value="custom"]:checked) .length-rules {
    display: none;
  }

  .shape-field__only {
    display: none;
  }
}

/* The key: three short rows, the letters bold, the meaning beside them (in em, so it grows with the text). */
.shape-key {
  list-style: none;
  padding: 0;
  margin-block: var(--space-1);
}

.shape-key li {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: var(--space-2);
  max-width: none;
}

.shape-key li + li {
  margin-block-start: 0.25rem;
}

.shape-key b {
  color: var(--color-ink);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* The shape reads letter by letter: same face and size, tabular, a little air between the letters. */
.shape-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* "This would fit: 01/05/2026": printed information, not a field, so a grey left edge and never a box. */
.shape-example {
  border-inline-start: calc(var(--border) * 2) solid var(--color-line);
  padding-inline-start: var(--space-2);
  margin-block: var(--space-2);
  font-size: var(--text-base);
}

.shape-example strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.shape-field .field__description + .field__description {
  margin-block-start: var(--space-1);
}

.qcard__done-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: space-between;
}

/* Dashed "add" affordance: clearly a button, clearly for adding. */
.add-question {
  width: 100%;
  min-height: var(--target-min);
  border: var(--border) dashed var(--color-ink);
  border-radius: var(--radius);
  padding: var(--space-3);
  font-size: var(--text-base);
  font-weight: 600;
  text-align: center;
  display: block;
  text-decoration: none;
}

.add-question:hover {
  background: var(--color-paper-dim);
}

/* "+ Add text" and "+ Add a list": side by side when there is room. */
.add-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: var(--space-2);
}

/* —— Cover canvas: the one decision on the page, in a drawn box —— */
.cover-switch {
  border: var(--border) solid var(--color-ink);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.cover-switch .field {
  max-width: none;
}

.cover-status {
  font-weight: 700;
}

/* What a good cover says. Quiet edge, plain words. */
.hint {
  border: var(--border) solid var(--color-line);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.hint ul,
.plain-list {
  list-style: disc;
  padding-inline-start: var(--space-3);
  display: grid;
  gap: var(--space-1);
}

/* What every cover shows that the creator doesn't write. */
.fixed-note {
  border-block-start: var(--border) solid var(--color-line);
  padding-block-start: var(--space-3);
  color: var(--color-ink-soft);
}

/* A bookend canvas quotes what people see. */
.quote {
  border-inline-start: calc(var(--border) * 4) solid var(--color-line);
  padding-inline-start: var(--space-3);
}

.quote > * + * {
  margin-block-start: var(--space-1);
}

/* —— Add-a-question wizard: inline, never a popover —— */
.wizard {
  border: var(--border) solid var(--color-ink);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.wizard__types {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
  gap: var(--space-2);
}

.wizard__type {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  min-height: var(--target-min);
  border: var(--border) solid var(--color-ink);
  border-radius: var(--radius);
  padding: var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  text-align: start;
  line-height: 1.3;
}

.wizard__type:hover {
  background: var(--color-paper-dim);
}

/* The glyph: a miniature of the control itself (icon policy). */
.wizard__type svg {
  inline-size: 2.25rem;
  block-size: 1.75rem;
  flex: none;
}

.wizard__type small {
  display: block;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-ink-soft);
  margin-block-start: 0.25rem;
}

/* At very large text sizes on phones, long words wrap inside the card. */
.wizard__type > span,
.specimen-choices li,
.choice {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* —— "Where do people go next?" on a Choose one (design/mockups/paths/spec.md § 4b) ——
   The go-to rows and the locked "Must this be answered?" show while "It depends on their answer"
   is chosen; the live Yes/No while "Everyone continues" is. No script: :has() swaps them, and a
   browser without :has() simply shows both. */
.where-next {
  border: var(--border) solid var(--color-line);
  border-radius: var(--radius);
  padding: var(--space-3);
  max-width: none;
}

.where-next:has(input[name="branching"][value="0"]:checked) .go-to,
.qcard__settings:has(input[name="branching"][value="0"]:checked) .mandatory-locked,
.qcard__settings:has(input[name="branching"][value="1"]:checked) .mandatory-free {
  display: none;
}

.go-to {
  margin-block-start: var(--space-3);
  display: grid;
  gap: var(--space-2);
}

/* One row per answer: the answer's words, then where it leads. */
.go-to__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(min(16rem, 100%), 1.4fr);
  gap: var(--space-1) var(--space-3);
  align-items: center;
  max-width: none;
}

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

.go-to__row .field__label {
  margin-block-end: 0;
}

.go-to__row .field__error {
  grid-column: 1 / -1;
}

/* After a Done that added answers: what to do now. Ink, bold, no box: the next step, not a mistake. */
.go-to__status {
  font-weight: 700;
}

/* The closed path card: one sentence per answer, an ink edge marking them as the card's flow. */
.routes {
  margin-block-start: var(--space-3);
  border-inline-start: calc(var(--border) * 4) solid var(--color-ink);
  padding-inline-start: var(--space-3);
  display: grid;
  gap: var(--space-1);
}

.routes p {
  max-width: none;
  overflow-wrap: anywhere;
}

/* An answer with nowhere to go yet: the words say it, no color. */
.routes__gap {
  font-weight: 600;
}

/* Off Pro, on a card that still has paths: one quiet line under them (N4). */
.routes__note {
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
}

/* Off Pro: where each answer goes, as text instead of a select. */
.go-to__fixed {
  font-weight: 600;
  min-height: var(--target-min);
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
}

/* Removing the paths: the second step, inside the open card. */
.confirm-step {
  border: var(--border) solid var(--color-ink);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.confirm-step .cluster {
  margin-block-start: var(--space-2);
}

/* A kind that can't be picked here: a box, not a button. The name and its sentence stay soft ink,
   to be read; only the glyph takes the ink-disabled color. */
.wizard__type--blocked {
  background: var(--color-paper-dim);
  border-color: var(--color-line);
  color: var(--color-ink-soft);
}

.wizard__type--blocked:hover {
  background: var(--color-paper-dim);
}

.wizard__type--blocked svg {
  color: var(--color-ink-disabled);
}

@media (forced-colors: active) {
  .wizard__type--blocked,
  .wizard__type--blocked svg {
    color: GrayText;
    border-color: GrayText;
  }
}

/* A section's canvas: who reaches it (S3), and the "Check this" trap (S7). An ink edge, 600. */
.reach-note {
  border-inline-start: calc(var(--border) * 4) solid var(--color-ink);
  padding: var(--space-1) var(--space-3);
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* "After this section": the last thing on a section's canvas, under a quiet rule. */
.after-section {
  border-block-start: var(--border) solid var(--color-line);
  padding-block-start: var(--space-4);
}

.after-section__status {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.after-section select.input {
  max-width: var(--measure);
}

/* Each question card is a Turbo Frame (Edit/Done); the frame is a plain block. */
turbo-frame {
  display: block;
}
