/*
 * Quiz engine styles. The look is the superpower quiz's (bordered question
 * cards, round grey buttons, the spinning logo), with a slider to match for
 * agree/disagree questions. Everything is scoped to .ds-quiz-app so it can't
 * touch the rest of the page.
 */

/* Results stay hidden until the engine shows the reader theirs. Hidden from
   the first paint, so they never flash in before the script runs. */
[class*="ds-quiz-result-"]:not(.ds-quiz-shown) {
    display: none !important;
}

.ds-quiz-app {
    margin: 0;
}

.ds-quiz-form {
    padding: 0;
    border: none;
    margin: 0;
}

/* Each question is its own card. */
.ds-quiz-question {
    padding: 1.25rem 1.5rem 1.5rem;
    border: 1px #D0D5DD solid;
    margin: 1rem 0;
    border-radius: 16px;
    position: relative;
}

.ds-quiz-prompt {
    margin: 0 0 1rem !important;
    line-height: 1.3;
}

/* Multiple choice */
.ds-quiz-option {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}

.ds-quiz-option label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.ds-quiz-option input[type="radio"] {
    margin-right: 10px;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.ds-quiz-option-text {
    margin-bottom: 0 !important;
    font-size: 17px;
    line-height: 1.75rem;
}

/* Agree/disagree slider */
.ds-quiz-scale-labels {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9em;
    line-height: 1.3;
    color: #667085;
    margin-bottom: 0.5rem;
}

.ds-quiz-scale-labels span {
    flex: 1;
}

.ds-quiz-scale-labels span:nth-child(2) {
    text-align: center;
}

.ds-quiz-scale-labels span:nth-child(3) {
    text-align: right;
}

.ds-quiz-app input[type="range"] {
    display: block;
    width: 100%;
    height: 8px;
    margin: 0.75rem 0 0;
    background: #D0D5DD;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.ds-quiz-app input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    background: #667085;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #667085;
    -webkit-appearance: none;
    appearance: none;
    transition: background-color 0.2s;
}

.ds-quiz-app input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #667085;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #667085;
}

.ds-quiz-app input[type="range"]:hover::-webkit-slider-thumb,
.ds-quiz-app input[type="range"]:focus-visible::-webkit-slider-thumb {
    background: #344054;
}

.ds-quiz-app input[type="range"]:focus-visible {
    box-shadow: 0 0 0 3px #F2F4F7;
}

/* The five steps, under the track. */
.ds-quiz-scale-ticks {
    display: flex;
    justify-content: space-between;
    padding: 0 9px;
    margin-top: 6px;
}

.ds-quiz-scale-ticks span {
    display: block;
    width: 2px;
    height: 10px;
    background-color: #D0D5DD;
}

/* Buttons */
.ds-quiz-buttons {
    display: flex;
    gap: 10px;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
}

button.ds-quiz-button {
    padding: 1rem 1.5rem;
    font-family: 'neue-haas-grotesk-text', system-ui, -apple-system, sans-serif !important;
    background: none !important;
    border: 1px #D0D5DD solid;
    border-radius: 4rem !important;
    color: #667085 !important;
    display: inline-flex;
    align-items: center;
    font-size: 1rem !important;
    line-height: 1rem !important;
    cursor: pointer;
}

button.ds-quiz-button:hover {
    background-color: #F2F4F7 !important;
    transition-duration: 0.2s;
    transition-timing-function: linear;
}

button.ds-quiz-button.ds-quiz-submit {
    background: #667085 !important;
    border-color: #667085;
    color: #fff !important;
}

button.ds-quiz-button.ds-quiz-submit:hover {
    background: #475467 !important;
}

/* "Calculating your results..." */
.ds-quiz-loader {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

.ds-quiz-loader[hidden] {
    display: none;
}

.ds-quiz-loader img {
    width: 40px;
    height: auto;
    animation: ds-quiz-spin 1.5s linear infinite;
}

.ds-quiz-loader p {
    margin: 0 !important;
    font-size: 1.25rem;
    color: #555;
}

/* "Your total score: 30", for a quiz with showScore. */
.ds-quiz-score {
    margin: 1.5rem 0 1rem !important;
}

.ds-quiz-score[hidden] {
    display: none;
}

@keyframes ds-quiz-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .ds-quiz-loader img {
        animation: none;
    }
}

@media only screen and (max-width: 768px) {
    .ds-quiz-question {
        padding: 1rem 1.1rem 1.25rem;
    }

    .ds-quiz-option-text {
        font-size: 16px !important;
    }

    .ds-quiz-scale-labels {
        font-size: 0.8em;
    }
}
