/* builder_flow.css — the gate and the step lock shared by both guided builders.

   MOBILE FIRST, like every other file here: the base block is the 375–430px
   composition and every media query only adds capacity.

   Three things live in this file:
     1. .builder-gate — the plain, non-interactive panel a builder now opens on.
        It says what the form is, what it is not, how long it takes, and carries
        the one control that starts the instrument.
     2. .builder-outline — the visible shape of the journey. It is the answer to
        "what am I actually filling in", and it stays readable while the steps
        themselves are still closed.
     3. The locked/blocked states: a closed chapter is removed outright, and a
        continue control whose chapter is incomplete is visibly held back with a
        sentence saying what is missing.

   Every selector here is either a new class or is scoped behind .builder-flow-on,
   which only js/builder_flow.js ever adds. With JavaScript off this file changes
   nothing about either page. */

/* ---------- The gate ----------
   Deliberately quiet. It is the only thing between the hero and the instrument,
   so it must read as an explanation with a door in it, not as a second hero. */
.builder-gate-lead h2 {
    max-width: 20ch;
}

.builder-gate-lead .lede {
    max-width: 54ch;
}

/* .block is a flex column, so a button dropped into one stretches to the block's
   full width and stops reading as a button. On a phone a full-width control is
   right; from 560px up it takes its own width, like every other .btn on the site. */
.builder-start {
    margin-top: var(--space-8);
    align-self: stretch;
}

@media (min-width: 560px) {
    .builder-start {
        align-self: flex-start;
    }
}

.builder-gate-note {
    margin-top: var(--space-5);
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--color-text-on-dark-muted);
}

.builder-gate-note a {
    color: var(--color-accent-earth-soft);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

@media (hover: hover) {
    .builder-gate-note a:hover { color: var(--color-text-on-dark) }
}

/* Once the instrument is open the door has been used. Hiding the control stops it
   reading as "start again" to someone who scrolls back up mid-configuration; the
   outline beside it becomes the useful thing on this panel instead. */
.builder-flow-started .builder-start,
.builder-flow-started .builder-gate-note {
    display: none;
}

.builder-gate-started {
    display: none;
    margin-top: var(--space-8);
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--color-text-on-dark-muted);
}

.builder-flow-started .builder-gate-started {
    display: block;
}

/* ---------- The outline ----------
   A numbered list of what the visitor is being asked for, before they are asked
   for any of it. Static markup, so it reads with JavaScript off too — the script
   only adds the state classes. */
.builder-outline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.builder-outline-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-paper);
    transition: border-color var(--transition), background var(--transition),
        opacity var(--transition);
}

.builder-outline-num {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--color-accent-earth-soft);
    color: var(--color-accent-earth);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
}

.builder-outline-text {
    min-width: 0;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: 1.4;
    color: var(--color-text);
}

/* The state word carries the state in TEXT as well as in colour, which is the
   same rule the module cards follow. */
.builder-outline-state {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-eyebrow);
    text-transform: uppercase;
    color: var(--color-text-subtle);
    white-space: nowrap;
}

.builder-outline-item.is-locked {
    opacity: .62;
}

.builder-outline-item.is-current {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

.builder-outline-item.is-current .builder-outline-state {
    color: var(--color-accent-link);
}

.builder-outline-item.is-done .builder-outline-num {
    background: var(--color-success);
    color: #fff;
}

.builder-outline-item.is-done .builder-outline-state {
    color: var(--color-success);
}

/* ---------- Closed chapters ----------
   Explicit rather than relying on the UA sheet alone: .section is an author rule,
   and one future `display:` on it would otherwise quietly un-hide every locked
   chapter on the page. */
[data-builder-step][hidden] {
    display: none;
}

/* Opening a chapter is the one moment this file animates. Same language as the
   site's Weighted Block Settle — opacity and transform only, slow, once. Reduced
   motion is handled by the block at the end of this file. */
@keyframes builder-step-in {
    from { opacity: 0; transform: translate3d(0, 22px, 0) }
    to { opacity: 1; transform: none }
}

.builder-flow-on [data-builder-step].is-revealed {
    animation: builder-step-in 720ms var(--ease-out) both;
}

/* ---------- A continue control that will not continue ----------
   It keeps its size and its position: a control that moved or vanished when the
   chapter was incomplete would be harder to understand, not easier. */
.builder-flow-on .wb-next.is-blocked,
.builder-flow-on .hb-next.is-blocked {
    opacity: .55;
    cursor: not-allowed;
}

@media (hover: hover) {
    .builder-flow-on .wb-next.is-blocked:hover,
    .builder-flow-on .hb-next.is-blocked:hover {
        border-color: var(--color-border-strong);
        transform: none;
        box-shadow: none;
    }
}

.builder-flow-on .wb-next.is-blocked:active,
.builder-flow-on .hb-next.is-blocked:active {
    transform: none;
}

/* The sentence saying what is missing. Empty is its resting state — the element
   stays in the DOM so its live region is established before the text arrives. */
.builder-hint {
    margin-top: var(--space-4);
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    line-height: 1.6;
    font-weight: var(--weight-medium);
    color: var(--color-danger);
    background: var(--color-paper);
    border: 1px solid var(--color-danger);
    border-radius: var(--radius);
}

.builder-hint:empty {
    display: none;
}

/* On a graphite chapter the danger red on paper is the only readable pairing that
   does not introduce a second accent, so the plate keeps its light surface. */
.section--graphite .builder-hint {
    background: var(--color-paper);
}

@media (min-width: 768px) {
    .builder-outline-item {
        padding: var(--space-4) var(--space-5);
        gap: var(--space-5);
    }
    .builder-outline-text { font-size: var(--text-base) }
    .builder-outline-num { width: 30px; height: 30px }
    .builder-hint {
        font-size: var(--text-base);
        padding: var(--space-5) var(--space-6);
    }
}

@media (prefers-reduced-motion: reduce) {
    .builder-flow-on [data-builder-step].is-revealed {
        animation: none;
    }
    .builder-outline-item {
        transition: none;
    }
}
