/*
  Form controls in the "Bold jersey" look: text boxes, drop-downs, radio
  buttons, form buttons and error messages. Shared by the sign-up, login and
  admin pages. Colours come from the tokens in site.css.
*/

/* Buttons without a .button class (e.g. admin filters): a plain outlined button. */
button {
    min-height: 44px;
    padding: 8px 16px;
    border: 2px solid var(--navy);
    border-radius: 4px;
    background: var(--white);
    color: var(--navy);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    background: var(--selected-bg);
}

/* The login form: label, email box and button stacked, full width of their card. */
.stacked-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stacked-form label {
    font-weight: 700;
}

.stacked-form .button {
    width: 100%;
    margin-top: 12px;
}

/* Text boxes and drop-downs */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 18px 0;
}

.field > label,
.radio-group > legend {
    font-weight: 700;
    line-height: 1.35;
}

.field input,
.field select,
.field textarea,
.stacked-form input[type="email"],
.stacked-form input[type="text"] {
    width: 100%;
    min-height: 50px;
    padding: 10px 12px;
    border: 2px solid var(--input-border);
    border-radius: 4px;
    background: var(--white);
    color: var(--text);
    font: inherit;
}

.field textarea {
    min-height: 96px;
    resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.stacked-form input:hover {
    border-color: var(--navy);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.stacked-form input:focus {
    border-color: var(--navy);
    outline: 3px solid var(--red);
    outline-offset: 1px;
}

.field [aria-invalid="true"] {
    border-color: var(--error);
    background: var(--error-bg);
}

.optional,
.hint {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 400;
}

.hint {
    margin: 8px 0 12px;
    line-height: 1.5;
}

/* A hint right under a field belongs to it. */
.field + .hint {
    margin-top: -8px;
}

/* Radio buttons: each choice is a big, tappable box. */

.radio-group {
    margin: 18px 0;
    padding: 0;
    border: 0;
}

.radio-group > legend {
    margin-bottom: 8px;
    padding: 0;
}

.radio-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (min-width: 600px) {
    .radio-choices { grid-template-columns: repeat(4, 1fr); }
}

.radio {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    padding: 10px 14px;
    border: 2px solid var(--input-border);
    border-radius: 4px;
    background: var(--white);
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}

.radio:hover {
    border-color: var(--navy);
}

.radio input {
    flex: none;
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: var(--red-btn);
    cursor: pointer;
}

.radio:has(input:checked) {
    border-color: var(--navy);
    background: var(--selected-bg);
}

.radio-group[aria-describedby] .radio {
    border-color: var(--error);
}

/* Error messages */

.form-error {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 6px solid var(--error);
    border-radius: 4px;
    background: var(--error-bg);
    color: var(--error-text);
    font-weight: 700;
}

.field-error {
    margin: 0;
    padding-left: 10px;
    border-left: 4px solid var(--error);
    color: var(--error);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
}

/* Sign-up form (also the admin pages' edit forms) */

.signup-form {
    max-width: 680px;
}

.form-section {
    min-width: 0;
    margin: 24px 0;
    padding: 0 18px 8px;
    border: 0;
    border-top: 6px solid var(--red);
    background: var(--white);
    box-shadow: var(--card-shadow);
}

/* The section name as a navy band across the top of the card. */
.form-section > legend {
    float: left;
    width: calc(100% + 36px);
    margin: 0 -18px 4px;
    padding: 10px 18px;
    background: var(--navy);
    color: var(--white);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.form-section > legend + * {
    clear: both;
}

@media (min-width: 600px) {
    .form-section { padding: 0 28px 12px; }

    .form-section > legend {
        width: calc(100% + 56px);
        margin: 0 -28px 8px;
        padding: 12px 28px;
    }
}

/* "Add another child" and "Remove child". */
.button-secondary-small {
    min-height: 44px;
    margin: 4px 0 12px;
    padding: 8px 16px;
    border: 2px solid var(--navy);
    border-radius: 4px;
    background: var(--white);
    color: var(--navy);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.button-secondary-small:hover {
    background: var(--navy);
    color: var(--white);
}

.signup-form .actions .button {
    width: 100%;
}

@media (min-width: 600px) {
    .signup-form .actions .button {
        width: auto;
        min-width: 240px;
    }
}

/* The Cloudflare Turnstile checkbox, just above the Sign up button. */
.signup-form .bot-check {
    margin: 24px 0 8px;
}

/* Hidden from people, still in the page. */
.visually-hidden,
.hp-field {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* A form that sits inline, e.g. the Log out button in the header. */
.inline-form {
    display: inline;
    margin: 0;
}

/* A button that looks like a link (the header's Log out). */
.link-button {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--link);
    text-decoration: underline;
}

.link-button:hover {
    background: none;
}
