/* ============================================================
   FormStepper - shared multi-step form styling
   ============================================================

   Structure only. Every colour, size and shape comes from a --fstep-*
   custom property, so each page themes the stepper to match itself rather
   than inheriting another form's look. Override the tokens on the .fstep
   element (or an ancestor) in the page's own stylesheet.

   Pairs with js/form-stepper.js.
   ============================================================ */

.fstep {
    /* Colour */
    --fstep-accent:        #1EA99B;
    --fstep-accent-deep:   #17857a;
    --fstep-on-accent:     #ffffff;
    --fstep-track:         #e1e6ea;
    --fstep-muted:         #6c757d;
    --fstep-ink:           #2c3e50;
    --fstep-surface:       #ffffff;
    --fstep-alert-bg:      #fdf3f3;
    --fstep-alert-border:  #e6bcbc;
    --fstep-alert-ink:     #96322f;

    /* Shape and size */
    --fstep-mark-size:     34px;
    --fstep-mark-radius:   50%;
    --fstep-mark-font:     0.85rem;
    --fstep-label-font:    0.72rem;
    --fstep-line-height:   3px;
    --fstep-gap:           22px;
}

.fstep-is-hidden {
    display: none !important;
}

/* ---- Step track ---------------------------------------------------- */

.fstep-track {
    display: flex;
    align-items: flex-start;
    list-style: none;
    margin: 0 0 var(--fstep-gap);
    padding: 0;
}

.fstep-item {
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
}

.fstep-item:last-child {
    flex: 0 0 auto;
}

.fstep-item-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    background: none;
    border: 0;
    padding: 0;
    cursor: default;
    font-family: inherit;
    color: var(--fstep-muted);
    transition: color 0.2s ease;
}

.fstep-item.is-visited .fstep-item-btn {
    cursor: pointer;
}

.fstep-item-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--fstep-mark-size);
    height: var(--fstep-mark-size);
    border-radius: var(--fstep-mark-radius);
    border: 2px solid var(--fstep-track);
    background: var(--fstep-surface);
    font-size: var(--fstep-mark-font);
    font-weight: 700;
    line-height: 1;
    color: var(--fstep-muted);
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.fstep-item-label {
    font-size: var(--fstep-label-font);
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
}

.fstep-item-line {
    flex: 1 1 auto;
    height: var(--fstep-line-height);
    min-width: 18px;
    margin: 0 8px;
    /* align with the centre of the marks, not the labels below them */
    margin-bottom: calc(var(--fstep-label-font) + 12px);
    background: var(--fstep-track);
    border-radius: var(--fstep-line-height);
    transition: background-color 0.3s ease;
}

.fstep-item.is-current .fstep-item-btn,
.fstep-item.is-done .fstep-item-btn {
    color: var(--fstep-accent-deep);
}

.fstep-item.is-current .fstep-item-mark {
    background: var(--fstep-accent);
    border-color: var(--fstep-accent);
    color: var(--fstep-on-accent);
}

.fstep-item.is-done .fstep-item-mark {
    background: var(--fstep-accent-deep);
    border-color: var(--fstep-accent-deep);
    color: var(--fstep-on-accent);
}

.fstep-item.is-done .fstep-item-line {
    background: var(--fstep-accent);
}

.fstep-item-btn:focus-visible {
    outline: 2px solid var(--fstep-accent);
    outline-offset: 3px;
    border-radius: 3px;
}

/* ---- Panels -------------------------------------------------------- */

.fstep-panel {
    animation: fstep-fade-in 0.28s ease-out;
}

@keyframes fstep-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fstep-panel-intro {
    color: var(--fstep-muted);
    font-size: 0.88rem;
    margin: 0 0 14px;
}

/* ---- Validation summary -------------------------------------------- */

.fstep-alert {
    background: var(--fstep-alert-bg);
    border: 1px solid var(--fstep-alert-border);
    border-radius: 3px;
    color: var(--fstep-alert-ink);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.88rem;
}

.fstep-alert-title {
    font-weight: 700;
    margin: 0 0 4px;
}

.fstep-alert-list {
    margin: 0;
    padding-left: 20px;
}

/* ---- Navigation ---------------------------------------------------- */

.fstep-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--fstep-track);
}

/* Keeps Next hard right on the first step, where Back is hidden. */
.fstep-nav > [data-fstep-next] {
    margin-left: auto;
}

.fstep-btn {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 8px 20px;
    border-radius: 3px;
    border: 1px solid var(--fstep-accent);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.fstep-btn-next {
    background: var(--fstep-accent);
    color: var(--fstep-on-accent);
}

.fstep-btn-next:hover,
.fstep-btn-next:focus {
    background: var(--fstep-accent-deep);
    border-color: var(--fstep-accent-deep);
}

.fstep-btn-back {
    background: transparent;
    color: var(--fstep-accent-deep);
}

.fstep-btn-back:hover,
.fstep-btn-back:focus {
    background: var(--fstep-track);
}

/* ---- Small screens -------------------------------------------------- */

@media (max-width: 640px) {
    .fstep {
        --fstep-mark-size: 28px;
        --fstep-mark-font: 0.78rem;
        --fstep-label-font: 0.62rem;
    }

    .fstep-item-line {
        min-width: 8px;
        margin-left: 4px;
        margin-right: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fstep-panel {
        animation: none;
    }

    .fstep-item-mark,
    .fstep-item-line,
    .fstep-btn {
        transition: none;
    }
}
