/**
 * Chooser flow: the accumulating question stack, its "Clear all" link, and the question
 * tooltip.
 *
 * Written with logical properties so it works in both directions unchanged; the .rtl twin
 * only carries what direction-neutral CSS cannot express.
 *
 * Every rule that hides a question is scoped under .chooser-flow-enabled, which the
 * script adds. Without JavaScript the class never lands and all the questions stay on
 * the page.
 */

.chooser-flow {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 40px;
    align-self: stretch;
    width: 100%;
}

.chooser-flow .chooser-questions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 40px;
    align-self: stretch;
    width: 100%;
}

.chooser-flow-enabled .chooser-question[hidden] {
    display: none;
}

/* ----------------------------------------------------------------- clear all */

.chooser-clear-all {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    color: #00B5D3;
    font-family: Inter;
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 120%;
    text-decoration: underline;
}

.chooser-clear-all[hidden] {
    display: none;
}

/* The stack sits 40px from its neighbours; the link belongs to the stack above it. */
.chooser-flow .chooser-questions + .chooser-clear-all {
    margin-top: -16px;
}

/* A borderless control still needs a visible focus ring. */
.chooser-clear-all:focus-visible,
.chooser-question-answer:focus-visible,
.chooser-question-tooltip:focus-visible {
    outline: 2px solid #00B5D3;
    outline-offset: 2px;
}

/* ------------------------------------------------------------------- tooltip */

/*
 * The icon is injected inside the question's first block element, so it sits at the end
 * of that line rather than dropping below it. Keeping it inline-block with the bubble
 * positioned against it is what lets the bubble escape the line box.
 */
.chooser-question-tooltip {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-inline-start: 6px;
    vertical-align: -2px;
    border-radius: 50%;
    border: 1px solid rgba(0, 43, 70, 0.50);
    cursor: help;
    position: relative;
}

/* The "i". Drawn rather than shipped as an icon file, to stay one request lighter. */
.chooser-question-tooltip::before {
    content: "i";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Inter;
    font-size: 10px;
    font-style: normal;
    font-weight: 600;
    line-height: 1;
    color: rgba(0, 43, 70, 0.70);
}

.chooser-question-tooltip:hover,
.chooser-question-tooltip:focus-visible {
    border-color: #00B5D3;
}

.chooser-question-tooltip:hover::before,
.chooser-question-tooltip:focus-visible::before {
    color: #00B5D3;
}

/*
 * A real bubble rather than a title attribute: it shows at once instead of after the
 * browser's own delay, it can be styled, and it still reaches a screen reader because it
 * is only visually hidden, never display:none.
 */
.chooser-question-tooltip-bubble {
    position: absolute;
    z-index: 5;
    bottom: calc(100% + 8px);
    inset-inline-start: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    padding: 8px 12px;
    border-radius: 5px;
    background: #002B46;
    color: #FFF;
    font-family: Inter;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 140%;
    text-align: start;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease-in-out;
}

/* The little arrow under the bubble. */
.chooser-question-tooltip-bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    inset-inline-start: 50%;
    margin-inline-start: -5px;
    border: 5px solid transparent;
    border-top-color: #002B46;
}

.chooser-question-tooltip:hover .chooser-question-tooltip-bubble,
.chooser-question-tooltip:focus .chooser-question-tooltip-bubble,
.chooser-question-tooltip:focus-visible .chooser-question-tooltip-bubble {
    opacity: 1;
    visibility: visible;
}

/*
 * RTL flips translateX, so the transform is restated rather than inherited. The bubble is
 * centred on the icon in both directions.
 */
[dir="rtl"] .chooser-question-tooltip-bubble {
    transform: translateX(50%);
}

[dir="rtl"] .chooser-question-tooltip-bubble::after {
    margin-inline-start: 0;
    margin-inline-end: -5px;
}

/* ------------------------------------------------------------------ messages */

.chooser-results-message {
    color: var(--text, #002A46);
    font-family: Inter;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 150%;
}

.chooser-results-message p {
    margin: 0;
}

.chooser-results-message p + p {
    margin-top: 12px;
}

/* Editors only; never rendered for a visitor. */
.chooser-empty-notice {
    align-self: stretch;
    padding: 16px;
    border-radius: 5px;
    border: 1px dashed rgba(0, 43, 70, 0.40);
    color: rgba(0, 43, 70, 0.70);
    font-family: Inter;
    font-size: 15px;
}

@media (max-width: 768px) {

    .chooser-flow,
    .chooser-flow .chooser-questions {
        gap: 32px;
    }

    .chooser-clear-all {
        font-size: 15px;
    }
}
