/* flow.css: layout for the start screen and the question steps only.
   Components (buttons, options, switches, fields, stepper, progress, quotes, motif)
   come from styles.css and are not restyled here. */

/* ---------- Start ---------- */

.flow-start {
  padding-top: 24px;
}

.flow-notice {
  margin-bottom: 16px;
}
.flow-notice p {
  color: var(--ink);
}

.flow-hero {
  display: grid;
  justify-items: center;
  gap: 28px;
  text-align: center;
}

.flow-hero__copy {
  display: grid;
  justify-items: center;
  gap: 20px;
  max-width: 820px;
}

.flow-hero__promise {
  font-size: 18px;
  line-height: 1.55;
  color: var(--body);
  max-width: 56ch;
  margin-inline: auto;
}

.flow-motif {
  margin-block: 4px;
}

.flow-hero__quote {
  text-align: left;
  width: 100%;
  max-width: 560px;
}

.flow-resume {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  text-align: left;
}
.flow-resume__actions {
  gap: 8px;
}

.flow-hero__actions {
  display: flex;
  justify-content: center;
}

.flow-hero__privacy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.flow-hero__privacy .icon {
  flex: none;
  color: var(--green-700);
}

/* ---------- Steps ---------- */

.flow-step {
  padding-top: 32px;
}

.flow-step__head {
  display: grid;
  gap: 16px;
}

.flow-step__progress {
  margin-bottom: 8px;
}

/* Progress (or the step 0 eyebrow) with the quiet Start over at its right. */
.flow-step__topline {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}
.flow-step__topline > :first-child {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}
.flow-step__topline .start-over {
  flex: none;
  margin-block: -10px;
  margin-inline-end: -6px;
}

.flow-step__title {
  scroll-margin-top: 120px;
}

.flow-step__help {
  color: var(--body);
}

/* Long sourced help (Q6): a fold on short screens only. Tall screens show the help and hide the button. */
.flow-step__helptoggle {
  display: none;
}
@media (max-height: 599.98px) {
  .flow-step__helptoggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    min-height: 44px;
    margin: -10px 0 -6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--green-700);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .flow-step__helptoggle span {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  }
  .flow-step__helptoggle .icon {
    flex: none;
    transform: rotate(90deg);
  }
  .flow-step__helpbox.is-open .flow-step__helptoggle {
    display: none;
  }
  .flow-step__helpbox:not(.is-open) .flow-step__help {
    display: none;
  }
}

.flow-step__intro {
  margin-top: 24px;
}

.flow-step__parts {
  display: grid;
  gap: 32px;
  margin-top: 28px;
}

.flow-part {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.flow-part__label {
  display: block;
  padding: 0;
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}

.flow-options {
  display: grid;
  gap: 10px;
}

.flow-options--compact {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.flow-field {
  max-width: 420px;
}

/* The message for an unanswered part sits inside that part, under its label. */
.flow-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bad-bg);
  color: var(--bad-ink);
  font-weight: 500;
  scroll-margin: 96px 0 120px;
}
.flow-error[hidden] {
  display: none;
}
.flow-error .icon {
  flex: none;
  margin-top: 2px;
}
.flow-field .flow-error {
  margin: 8px 0 0;
}
.flow-tokens .flow-error {
  margin: 0 0 12px;
}
.flow-options__cite {
  margin-top: 12px;
}
.flow-options__cite .cite {
  margin-left: 6px;
}

.flow-source {
  margin-top: 20px;
}

.flow-step__why {
  margin-top: 40px;
}
.flow-step__why-lead {
  margin: 0 0 10px;
  color: var(--muted);
}

/* Question 2: ten incidents across six stages */

.flow-tokens__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 0 12px;
}
.flow-tokens__counter {
  margin: 0;
}
.flow-tokens__counter.is-full {
  color: var(--green-700);
}

.flow-tokens__rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.flow-tokens__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.flow-tokens__row.is-off {
  opacity: .55;
}

.flow-tokens__stage {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
.flow-tokens__n {
  flex: none;
  width: 16px;
}
.flow-tokens__label {
  min-width: 0;
}

.flow-tokens__row .stepper {
  flex: none;
}

.flow-tokens__unsure {
  width: fit-content;
  min-width: 160px;
}

/* Questions 7 and 10: switches */

.flow-switches {
  display: grid;
  gap: 10px;
}

.flow-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.flow-switch:hover {
  border-color: #c4c4c4;
}
.flow-switch:has(input:checked) {
  border-color: var(--green-900);
  background: var(--mint-50);
}

.flow-switch__text {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.flow-switch__title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}
.flow-switch__sub {
  font-size: 13px;
  line-height: 1.45;
  color: var(--body);
}
.flow-switch--signal .flow-switch__text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

.flow-switches__cite .cite {
  margin-left: 0;
}

/* Footer with Back and Next */

.flow-step__footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 40px;
  padding: 12px 0;
}
/* A solid bar, edge to edge across the gutters, so nothing scrolled under it shows through. */
.flow-step__footer::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 calc(-1 * var(--gutter));
  background: #ffffff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 16px -12px rgba(0, 0, 0, .18);
}

/* Next stays clickable on an unanswered step: it shows what is missing. */
.flow-step__footer .btn[aria-disabled="true"] {
  cursor: pointer;
}

.flow-step__footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 420px) {
  .flow-step__footer .btn {
    padding: 0 16px;
  }
  .flow-tokens__row {
    gap: 10px;
  }
}

/* Phones and short landscape screens: the question and its first answers come first. */
@media (max-width: 767.98px), (max-height: 500px) {
  .flow-start {
    padding-top: 12px;
  }
  .flow-hero {
    gap: 16px;
  }
  .flow-hero__copy {
    gap: 14px;
  }
  .flow-hero__promise {
    font-size: 16px;
  }
  /* The start button (or the resume card) follows the promise; the quote and privacy line follow it. */
  .flow-hero__quote {
    order: 3;
  }
  .flow-hero__privacy {
    order: 4;
  }
  /* 24px: on a short screen the step opens 12px into this padding, past the nav button's shadow. */
  .flow-step {
    padding-top: 24px;
  }
  .flow-step__head {
    gap: 12px;
  }
  .flow-step__parts {
    margin-top: 20px;
  }
  .flow-step__footer {
    margin-top: 24px;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .flow-start .display {
    font-size: 32px;
  }
  .flow-step__title {
    font-size: 24px;
  }
  .flow-hero .motif {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flow-switch {
    transition: none;
  }
}
