/* ==========================================================================
   Barriers to Being Active Quiz
   Every rule is scoped to .bq-wrapper so nothing here reaches the TEE form
   (afwc-forms.css) or the rest of the site.
   ========================================================================== */

.bq-wrapper {
    --bq-ink: #222;
    --bq-muted: #5c5c5c;
    --bq-rule: rgba(104, 117, 78, 0.35);
    --bq-shade-1: #f6f6f3;
    --bq-shade-2: #ecebe5;
    --bq-selected: rgba(104, 117, 78, 0.22);
    --bq-choice-col: 6.5rem;
    padding-top: 2rem;
    padding-bottom: 4rem;
    color: var(--bq-ink);
}

.bq-wrapper .bq-title {
    color: var(--hpwgreen);
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin: 0 0 1.25rem;
}

.bq-wrapper .bq-directions {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.bq-wrapper .bq-noscript {
    border: 2px solid #8a6d3b;
    background-color: #fcf8e3;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
}

/* Section bar — same look as the TEE page's .headline h5 bars */
.bq-wrapper .headline > div {
    margin: 2.5rem 0 1.5rem;
    border-radius: 0.5rem;
}

.bq-wrapper .headline > div > h2 {
    color: var(--hpwgreen);
    font-size: 1.25rem;
    font-weight: 800;
    padding: 0.5em;
    margin: 0;
}

/* --------------------------------------------------------------------------
   Questions — stacked cards on small screens (default)
   -------------------------------------------------------------------------- */

.bq-wrapper .bq-matrix-head {
    display: none;
}

.bq-wrapper .bq-matrix-prompt {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.bq-wrapper .bq-question {
    border: 1px solid var(--hpwgreen);
    border-radius: 1rem;
    background-color: #fff;
    padding: 1rem;
    margin-bottom: 1rem;
}

.bq-wrapper .bq-question-text {
    font-size: 1rem;
    margin: 0 0 0.75rem;
}

.bq-wrapper .bq-question-num {
    font-weight: 700;
    color: var(--hpwgreen);
}

.bq-wrapper .bq-choices {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.bq-wrapper .bq-choice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--bq-rule);
    border-radius: 0.5rem;
    background-color: var(--bq-shade-1);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.bq-wrapper .bq-choice input {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    accent-color: var(--hpwgreen);
    cursor: pointer;
}

.bq-wrapper .bq-choice-value {
    margin-left: auto;
    min-width: 1.75rem;
    padding: 0 0.4rem;
    border-radius: 1rem;
    background-color: var(--bq-shade-2);
    text-align: center;
    font-weight: 700;
}

.bq-wrapper .bq-choice:hover {
    background-color: rgba(104, 117, 78, 0.12);
}

.bq-wrapper .bq-choice.is-selected {
    background-color: var(--bq-selected);
    border-color: var(--hpwgreen);
    box-shadow: inset 0 0 0 1px var(--hpwgreen);
    font-weight: 700;
}

.bq-wrapper .bq-choice.is-selected .bq-choice-value {
    background-color: #fff;
}

/* Keyboard focus. The site resets outlines on :focus:not(:focus-visible), so
   focus-visible gets an explicit, high-contrast ring that reads on both the
   shaded and the selected background. */
.bq-wrapper .bq-choice input:focus-visible {
    outline: 2px solid var(--bq-ink);
    outline-offset: 2px;
}

.bq-wrapper .bq-choice:has(input:focus-visible) {
    box-shadow: inset 0 0 0 2px var(--bq-ink), inset 0 0 0 4px #fff;
}

/* --------------------------------------------------------------------------
   Questions — matrix layout on wider screens, like the handout
   -------------------------------------------------------------------------- */

@media (min-width: 768px) {
    .bq-wrapper .bq-matrix {
        border: 1px solid var(--hpwgreen);
        border-radius: 1rem;
        background-color: #fff;
    }

    .bq-wrapper .bq-matrix-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) repeat(4, var(--bq-choice-col));
        position: sticky;
        top: var(--wp-admin--admin-bar--height, 0px);
        z-index: 2;
        background-color: var(--hpwgreen);
        color: #fff;
        font-weight: 700;
        border-radius: calc(1rem - 1px) calc(1rem - 1px) 0 0;
    }

    .bq-wrapper .bq-matrix-head > div {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.6rem 0.5rem;
        text-align: center;
        font-size: 0.95rem;
        line-height: 1.2;
    }

    .bq-wrapper .bq-matrix-head .bq-matrix-head-prompt {
        justify-content: flex-start;
        padding-left: 1rem;
        font-size: 1.15rem;
        text-align: left;
    }

    /* The column headings say the same thing visually; keep the prompt for
       screen readers only. */
    .bq-wrapper .bq-matrix-prompt {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .bq-wrapper .bq-question {
        display: grid;
        grid-template-columns: minmax(0, 1fr) calc(4 * var(--bq-choice-col));
        /* Keep a focused row from scrolling under the sticky column headings */
        scroll-margin-top: 4.5rem;
        margin: 0;
        padding: 0;
        border: 0;
        border-top: 1px solid var(--bq-rule);
        border-radius: 0;
        background-color: transparent;
    }

    .bq-wrapper .bq-question:last-child,
    .bq-wrapper .bq-question:last-child .bq-choice:last-child {
        border-bottom-right-radius: calc(1rem - 1px);
    }

    .bq-wrapper .bq-question:last-child {
        border-bottom-left-radius: calc(1rem - 1px);
    }

    .bq-wrapper .bq-question-text {
        display: flex;
        align-self: center;
        margin: 0;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .bq-wrapper .bq-question-num {
        flex: 0 0 1.75rem;
    }

    .bq-wrapper .bq-choices {
        grid-template-columns: repeat(4, var(--bq-choice-col));
        gap: 0;
    }

    .bq-wrapper .bq-choice input {
        scroll-margin-top: 5rem;
    }

    .bq-wrapper .bq-choice {
        justify-content: center;
        gap: 0.4rem;
        min-height: 3.25rem;
        height: 100%;
        border: 0;
        border-radius: 0;
        padding: 0.5rem;
    }

    .bq-wrapper .bq-choice:nth-child(even) {
        background-color: var(--bq-shade-2);
    }

    .bq-wrapper .bq-choice:hover {
        background-color: rgba(104, 117, 78, 0.12);
    }

    .bq-wrapper .bq-choice.is-selected {
        background-color: var(--bq-selected);
        box-shadow: inset 0 0 0 2px var(--hpwgreen);
    }

    /* Column headings carry the wording on wide screens; the label text stays
       in the accessible name. */
    .bq-wrapper .bq-choice-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .bq-wrapper .bq-choice-value {
        order: -1;
        margin-left: 0;
        min-width: 0;
        padding: 0;
        background-color: transparent;
        font-size: 1.05rem;
    }

    .bq-wrapper .bq-choice.is-selected .bq-choice-value {
        background-color: transparent;
    }
}

@media (min-width: 992px) {
    .bq-wrapper {
        --bq-choice-col: 7.5rem;
    }
}

/* --------------------------------------------------------------------------
   Progress + Reset
   -------------------------------------------------------------------------- */

.bq-wrapper .bq-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-top: 1.25rem;
}

.bq-wrapper .bq-progress {
    margin: 0;
    font-weight: 600;
}

.bq-wrapper .bq-progress.is-complete {
    color: var(--hpwgreen);
}

.bq-wrapper .bq-btn-reset {
    min-height: 2.75rem;
    padding: 0.6rem 2rem;
    border: 1px solid var(--hpwgreen);
    border-radius: 4px;
    background-color: #fff;
    color: var(--bq-ink);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.bq-wrapper .bq-btn-reset:hover {
    background-color: rgba(104, 117, 78, 0.1);
}

.bq-wrapper .bq-btn-reset:focus-visible {
    outline: 3px solid var(--bq-ink);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Scoring
   -------------------------------------------------------------------------- */

.bq-wrapper .bq-scoring-note {
    color: var(--bq-muted);
    margin-bottom: 1.5rem;
}

.bq-wrapper .bq-categories {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Two columns filled top to bottom, matching the handout's layout */
@media (min-width: 768px) {
    .bq-wrapper .bq-categories {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(4, auto);
        grid-auto-flow: column;
        gap: 1rem 1.5rem;
    }
}

.bq-wrapper .bq-category {
    border: 1px solid var(--hpwgreen);
    border-radius: 1rem;
    background-color: #fff;
    padding: 1rem;
}

.bq-wrapper .bq-category-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

.bq-wrapper .bq-equation {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
}

.bq-wrapper .bq-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 2.5rem;
}

.bq-wrapper .bq-slot-value {
    display: block;
    width: 100%;
    height: 2.5rem;
    line-height: 2.5rem;
    border-bottom: 2px solid var(--bq-ink);
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--hpwgreen);
}

.bq-wrapper .bq-slot.is-empty .bq-slot-value {
    color: var(--bq-muted);
    font-weight: 400;
    border-bottom-style: dashed;
    border-bottom-color: var(--bq-muted);
}

.bq-wrapper .bq-slot-num {
    font-size: 0.85rem;
    color: var(--bq-muted);
    margin-top: 0.2rem;
}

.bq-wrapper .bq-operator {
    width: 1rem;
    line-height: 2.5rem;
    text-align: center;
    font-size: 1.2rem;
    color: var(--bq-muted);
}

.bq-wrapper .bq-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 5rem;
    margin-left: 0.25rem;
}

.bq-wrapper .bq-total-value {
    display: block;
    width: 100%;
    height: 2.5rem;
    line-height: calc(2.5rem - 4px);
    border: 2px solid var(--hpwgreen);
    border-radius: 0.5rem;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--bq-muted);
}

.bq-wrapper .bq-category.is-complete .bq-total-value {
    background-color: var(--hpwgreen);
    color: #fff;
}

.bq-wrapper .bq-total-caption {
    font-size: 0.85rem;
    color: var(--bq-muted);
    margin-top: 0.2rem;
}

.bq-wrapper .bq-category.is-incomplete .bq-total-caption {
    font-style: italic;
}

/* Narrowest phones (320px): the equation needs ~286px at the sizes above,
   which is more than a card has inside it. */
@media (max-width: 400px) {
    .bq-wrapper .bq-category {
        padding: 0.75rem;
    }

    .bq-wrapper .bq-equation {
        gap: 0.25rem;
    }

    .bq-wrapper .bq-slot {
        min-width: 2.25rem;
    }

    .bq-wrapper .bq-operator {
        width: 0.75rem;
    }

    .bq-wrapper .bq-total {
        min-width: 4.5rem;
        margin-left: 0;
    }

    .bq-wrapper .bq-total-caption {
        font-size: 0.8rem;
    }
}

.bq-wrapper .bq-source {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--bq-muted);
}
