/*
 * Request Meals Page - Mobile First
 * Large text and touch targets: many visitors are seniors.
 */

.request-main {
    max-width: 800px;
}

.request-intro {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-5);
}

/* The four parts of the form, numbered because they are filled in order */
.request-progress {
    margin: 0 0 var(--space-8);
}

.request-progress ol {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    padding: 0;
    margin: 0;
    list-style: none;
    counter-reset: parts;
}

.request-progress a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    background: var(--color-stone);
    color: var(--color-ink);
    font-weight: var(--font-weight-semibold);
    font-size: 16px;
    line-height: 1.2;
    text-decoration: none;
    counter-increment: parts;
}

.request-progress a::before {
    content: counter(parts);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--color-forest);
    color: var(--color-white);
    font-size: 14px;
}

.request-progress a:hover {
    background: var(--color-leaf-tint);
}

/* What happens after the form is sent */
.request-aside {
    margin-top: var(--space-12);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    background: var(--color-stone);
}

.request-page .request-aside h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-5);
}

.request-steps {
    display: grid;
    gap: var(--space-5);
    margin: 0 0 var(--space-6);
    padding: 0;
    list-style: none;
    counter-reset: next;
}

.request-steps li {
    position: relative;
    padding-left: 2.25rem;
    counter-increment: next;
}

.request-steps li::before {
    content: counter(next);
    position: absolute;
    left: 0;
    top: -0.05em;
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: var(--font-weight-bold);
    line-height: 1;
    color: var(--color-primary);
}

.request-steps h3 {
    font-size: var(--font-size-lg);
    color: var(--color-ink);
    margin-bottom: var(--space-1);
}

.request-steps p {
    font-size: var(--font-size-md);
    color: var(--color-ink-soft);
    margin: 0;
}

.request-aside .btn {
    white-space: normal;
    background: var(--color-white);
}

.request-aside .btn:hover,
.request-aside .btn:focus {
    background: var(--color-primary);
}

@media (min-width: 600px) {
    .request-progress ol {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .request-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        gap: var(--space-16);
        align-items: start;
    }

    .request-aside {
        position: sticky;
        top: calc(var(--navbar-height) + var(--space-10));
        margin-top: 0;
    }
}

.form-section {
    scroll-margin-top: calc(var(--mobile-menu-header-space) + var(--space-4));
}

.form-section + .form-section {
    margin-top: var(--space-4);
    padding-top: var(--space-8);
    border-top: 1px solid var(--color-stone-line);
}

.request-page .form-section-title {
    margin-bottom: var(--space-2);
    font-size: var(--font-size-2xl);
}

.form-section-intro {
    margin-bottom: var(--space-5);
    color: var(--color-gray-700);
    font-size: var(--font-size-md);
}

.req {
    color: #b42318;
    font-weight: var(--font-weight-bold);
}

.optional {
    font-weight: var(--font-weight-normal);
    color: var(--color-gray-700);
}

.request-form .form-group {
    margin-bottom: var(--space-8);
    border: 0;
    padding: 0;
    min-width: 0;
}

.request-form .form-group[hidden],
.request-form .form-hint[hidden],
.request-form .req[hidden],
.request-form .optional[hidden] {
    display: none;
}

.request-form button[disabled] {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.request-form .form-label {
    display: block;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-gray-900);
    margin-bottom: var(--space-2);
    float: none;
    width: auto;
    padding: 0;
}

.request-form .form-hint {
    font-size: var(--font-size-md);
    color: var(--color-gray-700);
    margin: 0 0 var(--space-2);
}

.request-form .form-input {
    display: block;
    width: 100%;
    min-height: 56px;
    padding: var(--space-3) var(--space-4);
    font-size: 20px;
    line-height: 1.4;
    color: var(--color-gray-900);
    background: var(--color-white);
    border: 2px solid var(--color-gray-500);
    border-radius: var(--radius-lg);
}

.request-form textarea.form-input {
    min-height: 140px;
}

.request-form .form-input:focus,
.request-form .choice input:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
    border-color: var(--color-primary);
}

.request-form .form-input.is-invalid {
    border-color: #b42318;
}

.request-form .form-error {
    color: #b42318;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    margin: var(--space-2) 0 0;
}

/* Radio and checkbox rows: the whole row is clickable */
.request-form .choice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-lg);
    border: 2px solid var(--color-gray-200);
    border-radius: var(--radius-lg);
    cursor: pointer;
}

.request-form .choice:hover {
    border-color: var(--color-primary);
}

/* The chosen answer stands out from the rest */
.request-form .choice:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-leaf-tint);
}

.request-form .choice input {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    margin-top: 2px;
    accent-color: var(--color-primary);
}

.request-form .choice.consent {
    background: var(--color-stone);
    border-color: var(--color-stone-line);
}

/* Honeypot: off screen, not display:none, so simple bots still fill it */
.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-error-summary {
    border: 3px solid #b42318;
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-8);
    background: #fef3f2;
}

.form-error-summary h2 {
    font-size: var(--font-size-xl);
    color: #b42318;
    margin-bottom: var(--space-3);
}

.form-error-summary a {
    color: #b42318;
    font-size: var(--font-size-lg);
    text-decoration: underline;
}

.request-thanks {
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    font-size: var(--font-size-lg);
}

.request-thanks-title {
    font-size: var(--font-size-3xl);
    color: var(--color-primary);
    margin-bottom: var(--space-4);
}

.request-thanks .btn {
    margin-top: var(--space-4);
    white-space: normal;
}

/*
 * Desktop layout (Refs #32): every row lines up.
 * - One column grid for the whole form: two equal columns with the same gap.
 *   Paired inputs take one column each; choice tiles use the same gap, so their
 *   edges meet the input edges (2 across for diet needs, 3 across for the
 *   three-option questions, so no row is left half empty).
 * - Paired fields share their rows through subgrid: label, hint, input and
 *   error each sit on a common track, so inputs line up even when only one
 *   of the pair has a hint (the empty hint track just reserves the space).
 * - The name row is full width when only "Your name" is shown ("Myself"),
 *   and a pair when the meals are for someone else.
 * Phones and tablets keep the single column below.
 */
@media (min-width: 1024px) {
    .request-form {
        --form-col-gap: var(--space-8);
    }

    .request-form .form-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(4, auto);
        column-gap: var(--form-col-gap);
        margin-bottom: var(--space-8);
    }

    .request-form .form-row > .form-group {
        display: grid;
        grid-row: 1 / span 4;
        grid-template-rows: subgrid;
        align-content: start;
        margin-bottom: 0;
    }

    .request-form .form-row > .form-group[hidden] {
        display: none;
    }

    /* Labels sit on the input side of their track, so a two-line label next to
       a one-line label still keeps both inputs level */
    .request-form .form-row > .form-group > .form-label {
        grid-row: 1;
        align-self: end;
    }

    .request-form .form-row > .form-group > .form-hint {
        grid-row: 2;
    }

    .request-form .form-row > .form-group > .form-input {
        grid-row: 3;
        align-self: start;
    }

    .request-form .form-row > .form-group > .form-error {
        grid-row: 4;
    }

    .request-form .form-row--single > .form-group {
        grid-column: 1 / -1;
    }

    /* Choice lists: tiles on the same gap as the inputs, equal height per row */
    .request-form .choice-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: var(--form-col-gap);
        row-gap: var(--space-3);
    }

    .request-form .choice-grid--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .request-form .choice-grid > legend,
    .request-form .choice-grid > .form-error {
        grid-column: 1 / -1;
    }

    .request-form .choice-grid > .choice {
        margin-bottom: 0;
    }
}
