/* Luxembourg Citizenship Quiz — v2.0
 * Styled to match the TCLAS / Clausen theme design system.
 * Uses theme CSS custom properties where available, with fallbacks.
 * Fallback hex values reflect the current Ciel Bleu palette.
 * Border-radius uses --radius (8px) global token. Progress bar uses 0 intentionally.
 */

/* ── Box-sizing reset scoped to quiz ───────────────────────────────────── */

.cq_quiz_container *,
.cq_quiz_container *::before,
.cq_quiz_container *::after,
.cq_sidebar *,
.cq_sidebar *::before,
.cq_sidebar *::after {
    box-sizing: border-box;
}

/* ── Outer container ────────────────────────────────────────────────────── */

.cq_quiz_container {
    max-width: 640px;
    margin: 0 auto;
    font-family: inherit;
    color: var(--c-body-text, #1a1a1a);
}

/* ── Progress bar ──────────────────────────────────────────────────────── */

.cq_progress_wrapper {
    width: 100%;
    height: 6px;
    background: var(--c-or-pale, #EBF5FC);
    border-radius: 0; /* Sharp corners */
    margin-bottom: 2rem;
    overflow: hidden;
}

.cq_progress_bar {
    height: 100%;
    background: var(--c-crimson, #E31E26);
    border-radius: 0; /* Sharp corners */
    transition: width 0.35s ease;
}

/* ── Question text ─────────────────────────────────────────────────────── */

.cq_question_text {
    font-size: 1.2rem;
    line-height: 1.6;
    font-weight: normal;
    margin: 0 0 1.5rem;
    color: var(--c-ardoise, #0A2540);
}

/* ── Form Inputs ────────────────────────────────────────────────────────── */

.cq_form_group {
    margin-bottom: 1rem;
}

.cq_form_group label {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
    color: var(--c-ardoise, #0A2540);
}

.cq_label_hint {
    font-weight: normal;
    font-size: 0.85em;
    opacity: 0.75;
}

.cq_input_field,
.cq_select_field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--c-border, #ddd);
    border-radius: var(--radius, 8px);
    font-size: 1rem;
    font-family: inherit;
    background-color: #fff;
    color: var(--c-ardoise, #0A2540);
}

/* ── Born-before-1969 checkbox ──────────────────────────────────────────── */

.cq_checkbox_label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--c-ardoise, #0A2540);
    margin-bottom: 0.4rem;
}

.cq_checkbox {
    width: 1.25rem;
    height: 1.25rem;
    min-width: 1.25rem;
    margin-top: 0.1rem;
    accent-color: var(--c-crimson, #E31E26);
    cursor: pointer;
}

.cq_checkbox_label + .cq_label_hint {
    margin-top: 0;
    margin-left: 1.85rem; /* indent under checkbox */
}

/* ── Born-before-1969 pill toggle ──────────────────────────────────────── */

.cq_toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-bottom: 0.25rem;
}

.cq_toggle__track {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    background: var(--c-border, #ccc);
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.cq_toggle[aria-checked="true"] .cq_toggle__track {
    background: var(--c-crimson, #E31E26);
}

.cq_toggle__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.cq_toggle[aria-checked="true"] .cq_toggle__thumb {
    transform: translateX(24px);
}

.cq_toggle__label {
    font-size: 1rem;
    font-weight: bold;
    color: var(--c-ardoise, #0A2540);
}

.cq_input_field:focus-visible,
.cq_select_field:focus-visible {
    outline: 3px solid var(--c-crimson, #E31E26);
    outline-offset: 2px;
    border-color: var(--c-crimson, #E31E26);
    box-shadow: 0 0 0 5px rgba(227, 30, 38, 0.18);
}

/* ── Button container ──────────────────────────────────────────────────── */

.cq_button_container {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

/* ── Option buttons ────────────────────────────────────────────────────── */

.cq_option_btn {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--c-ardoise, #0A2540);
    border: 1px solid var(--c-border, #ddd);
    border-radius: var(--radius, 8px);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cq_option_btn:hover {
    background: var(--c-ardoise, #0A2540);
    border-color: var(--c-ardoise, #0A2540);
    color: var(--c-or-pale, #EBF5FC);
}

/* ── Color-coded answer buttons ───────────────────────────────────────── */

.cq_option_btn--yes {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
}

.cq_option_btn--yes:hover {
    background: #1b5e20;
    border-color: #1b5e20;
    color: #fff;
}

.cq_option_btn--no {
    background: #c62828;
    border-color: #c62828;
    color: #fff;
}

.cq_option_btn--no:hover {
    background: #b71c1c;
    border-color: #b71c1c;
    color: #fff;
}

.cq_option_btn--neutral {
    background: #546e7a;
    border-color: #546e7a;
    color: #fff;
}

.cq_option_btn--neutral:hover {
    background: #37474f;
    border-color: #37474f;
    color: #fff;
}

.cq_submit_btn {
    background: var(--c-ardoise, #0A2540);
    color: var(--c-or-pale, #EBF5FC);
    text-align: center;
    font-weight: bold;
}

.cq_submit_btn:hover {
    background: var(--c-crimson, #E31E26);
    border-color: var(--c-crimson, #E31E26);
    color: #fff;
}

/* Disabled while a send is in flight, and left disabled after a successful
   one — so it needs to look spent rather than merely unresponsive. */
.cq_submit_btn:disabled,
.cq_submit_btn:disabled:hover {
    background: var(--c-ardoise, #0A2540);
    border-color: var(--c-ardoise, #0A2540);
    color: var(--c-or-pale, #EBF5FC);
    opacity: 0.55;
    cursor: default;
}

/* ── Restart + Back buttons ────────────────────────────────────────────── */

.cq_restart_btn,
.cq_back_btn {
    display: inline-block;
    align-self: flex-start;
    background: transparent;
    color: var(--c-ardoise, #0A2540);
    border: 1px solid var(--c-ardoise, #0A2540);
    border-radius: var(--radius, 8px);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.cq_restart_btn:hover,
.cq_back_btn:hover {
    background: var(--c-ardoise, #0A2540);
    color: var(--c-or-pale, #EBF5FC);
}

/* ── Focus styles ──────────────────────────────────────────────────────── */

.cq_option_btn:focus-visible,
.cq_restart_btn:focus-visible,
.cq_back_btn:focus-visible,
.cq_toggle:focus-visible {
    outline: 3px solid var(--c-crimson, #E31E26);
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(227, 30, 38, 0.18);
}

/* ── Outcome screen body text ──────────────────────────────────────────── */

.cq_outcome_body {
    margin: 0 0 1.5rem;
    line-height: 1.75;
    color: var(--c-ardoise, #0A2540);
    font-size: 0.975rem;
}

/* ── Member CTA box ────────────────────────────────────────────────────── */

.cq_cta_box {
    background: var(--c-or-pale, #EBF5FC);
    border-left: 3px solid var(--c-crimson, #E31E26);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.cq_cta_text {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--c-ardoise, #0A2540);
}

.cq_cta_btn {
    text-decoration: none;
    text-align: center;
}

/* ── Legal disclaimer ──────────────────────────────────────────────────── */

.cq_disclaimer {
    font-size: 0.825rem;
    line-height: 1.6;
    color: #555;
    border-top: 1px solid var(--c-border, #ddd);
    padding-top: 1rem;
    margin-bottom: 1.5rem;
}

.cq_disclaimer a {
    color: var(--c-crimson, #E31E26);
    text-decoration: underline;
}

.cq_disclaimer a:hover {
    color: var(--c-ardoise, #0A2540);
}

/* ── Email results section ─────────────────────────────────────────────── */

.cq_email_section {
    border-top: 1px solid var(--c-border, #ddd);
    padding-top: 1.25rem;
    margin-top: 0.25rem;
}

.cq_email_label {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--c-ardoise, #0A2540);
    margin: 0 0 0.75rem;
    display: block;
}

.cq_email_status {
    font-size: 0.875rem;
    color: #555;
    margin: 0.5rem 0 0;
    min-height: 1.2em;
}

/* ── Newsletter opt-in ─────────────────────────────────────────────────── */
/* Deliberately unchecked and visually secondary to the results button:
   asking for your results is not the same as asking for our newsletter. */

.cq_optin {
    margin: 0.875rem 0 1rem;
}

/* Two-column grid rather than a flex row with a guessed indent: the note
   lines up with the label text whatever width the browser gives the box. */
.cq_optin__label {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.5rem;
    row-gap: 0.3rem;
    align-items: start;
    cursor: pointer;
}

.cq_optin__checkbox {
    grid-column: 1;
    margin: 0.25em 0 0;
}

.cq_optin__text {
    grid-column: 2;
    color: var(--c-ardoise, #0A2540);
}

.cq_optin__note {
    grid-column: 2;
    margin: 0;
    color: #555;
}

/* Visible to screen readers only. */
.cq_sr_only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   LINEAGE TRACKER SIDEBAR
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Grid layout (quiz + sidebar) ──────────────────────────────────────── */

.cq_layout--with-sidebar {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 2rem;
    align-items: start;
    max-width: 920px;
    margin: 0 auto;
}

/* ── Sidebar card ──────────────────────────────────────────────────────── */

.cq_sidebar {
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--c-or-pale, #FAF9F6);
    border: 1px solid var(--c-border, #DDD5C4);
    border-radius: var(--radius, 8px);
}

.cq_sidebar__title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-muted, #626D78);
    margin: 0 0 1rem;
    font-weight: 700;
}

/* ── Timeline list ─────────────────────────────────────────────────────── */

.cq_lineage_list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

/* Vertical connector line */
.cq_lineage_list::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--c-border, #DDD5C4);
}

/* ── Timeline node ─────────────────────────────────────────────────────── */

.cq_lineage_node {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.4rem 0;
    position: relative;
}

.cq_lineage_node:first-child { padding-top: 0; }
.cq_lineage_node:last-child  { padding-bottom: 0; }

/* Circle marker */
.cq_lineage_node__dot {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--c-border, #DDD5C4);
    border: 2px solid var(--c-or-pale, #FAF9F6);
    position: relative;
    z-index: 1;
    margin-top: 1px;
}

/* Node states */
.cq_lineage_node--done .cq_lineage_node__dot {
    background: var(--c-vert, #3D6B4F);
}

.cq_lineage_node--active .cq_lineage_node__dot {
    background: var(--c-ardoise, #2B6282);
    animation: lcq-pulse 2s ease-in-out infinite;
}

.cq_lineage_node--lux .cq_lineage_node__dot {
    background: var(--c-crimson, #8B3A3A);
}

@keyframes lcq-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(43, 98, 130, 0.2); }
    50%      { box-shadow: 0 0 0 6px rgba(43, 98, 130, 0.08); }
}

@media (prefers-reduced-motion: reduce) {
    .cq_lineage_node--active .cq_lineage_node__dot {
        animation: none;
        box-shadow: 0 0 0 3px rgba(43, 98, 130, 0.2);
    }
}

/* Node content */
.cq_lineage_node__info {
    flex: 1;
    min-width: 0;
}

.cq_lineage_node__label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--c-ardoise, #2B6282);
    text-transform: capitalize;
    display: block;
    line-height: 1.3;
}

/* Fact tags (small pills) */
.cq_lineage_node__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.2rem;
}

.cq_lineage_tag {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    background: rgba(43, 98, 130, 0.08);
    color: var(--c-muted, #626D78);
    white-space: nowrap;
}

.cq_lineage_tag--lux {
    background: rgba(139, 58, 58, 0.12);
    color: var(--c-crimson, #8B3A3A);
    font-weight: 600;
}

.cq_lineage_tag--pre69 {
    background: rgba(61, 107, 79, 0.1);
    color: var(--c-vert, #3D6B4F);
}

/* ── Mobile inline summary (shown on outcome screen) ──────────────────── */

.cq_lineage_inline {
    background: var(--c-or-pale, #FAF9F6);
    border: 1px solid var(--c-border, #DDD5C4);
    border-radius: var(--radius, 8px);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.cq_lineage_inline__title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-muted, #626D78);
    margin: 0 0 0.75rem;
    font-weight: 700;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

/* Desktop: hide the inline summary (sidebar handles it) */
@media (min-width: 768px) {
    .cq_lineage_inline {
        display: none;
    }
}

/* Mobile: hide sidebar, show inline summary on outcomes */
@media (max-width: 767px) {
    .cq_layout,
    .cq_layout--with-sidebar {
        display: block;
    }

    .cq_sidebar {
        display: none !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   1969 EXPLANATION DEMO
   ══════════════════════════════════════════════════════════════════════════ */

.cq_demo_wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--c-or-pale, #EBF5FC);
    border-radius: var(--radius, 8px);
}

.cq_demo_column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cq_demo_title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid currentColor;
}

.cq_demo_column--valid .cq_demo_title {
    color: #2e7d32;
    border-bottom-color: #2e7d32;
}

.cq_demo_column--broken .cq_demo_title {
    color: #c62828;
    border-bottom-color: #c62828;
}

.cq_demo_tree {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cq_demo_gen {
    animation: fadeIn 0.5s ease-in-out;
}

.cq_demo_gen--broken {
    opacity: 0.6;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cq_demo_person {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem;
    background: #fff;
    border-radius: 6px;
    border: 2px solid #ddd;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.3;
}

.cq_demo_column--valid .cq_demo_person {
    border-color: #2e7d32;
    background: rgba(46, 125, 50, 0.05);
}

.cq_demo_column--broken .cq_demo_person {
    border-color: #c62828;
}

.cq_demo_person--broken {
    background: rgba(198, 40, 40, 0.08);
}

.cq_demo_person--ancestor {
    font-weight: 700;
    padding: 0.9rem 0.75rem;
}

.cq_demo_person--you {
    font-weight: 700;
    border-width: 3px;
}

.cq_demo_icon {
    font-size: 1.5rem;
    display: block;
}

.cq_demo_year {
    font-size: 0.75rem;
    color: #666;
    font-weight: normal;
}

.cq_demo_arrow {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    position: relative;
    animation: slideDown 0.5s ease-in-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: scaleY(0);
    }
    to {
        opacity: 1;
        transform: scaleY(1);
    }
}

.cq_demo_arrow::before {
    content: '↓';
    font-size: 1.2rem;
    font-weight: bold;
}

.cq_demo_arrow--valid::before {
    color: #2e7d32;
}

.cq_demo_arrow--broken::before {
    color: #c62828;
}

.cq_demo_arrow__label {
    position: absolute;
    right: 0;
    background: #fff;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid currentColor;
}

.cq_demo_arrow--valid .cq_demo_arrow__label {
    color: #2e7d32;
    border-color: #2e7d32;
    background: rgba(46, 125, 50, 0.08);
}

.cq_demo_arrow--broken .cq_demo_arrow__label {
    color: #c62828;
    border-color: #c62828;
    background: rgba(198, 40, 40, 0.08);
}

.cq_demo_outcome {
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.cq_demo_column--valid .cq_demo_outcome {
    color: #fff;
    background: #2e7d32;
}

.cq_demo_outcome--article23 {
    color: #fff;
    background: #ff9800;
}

.cq_demo_explainer {
    background: #fff;
    padding: 1rem;
    border-left: 3px solid var(--c-crimson, #E31E26);
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    color: var(--c-ardoise, #0A2540);
}

.cq_demo_explainer strong {
    color: var(--c-crimson, #E31E26);
}

.cq_demo_explainer em {
    font-style: italic;
    color: #c62828;
    font-weight: 600;
}

@media (max-width: 600px) {
    .cq_demo_wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .cq_demo_arrow__label {
        position: static;
        display: block;
        margin: 0.25rem 0;
    }
}
