/* ============================================================
   QUIZ — template-quiz.php

   Covers both states of the page: the six questions and the
   result. The result reuses .archive-item from archive.css, so
   only its wrapper and the two buttons are here.

   The radio inputs are visually hidden and their labels are the
   control. That keeps the keyboard behaviour a real radio group
   gives for free — arrow keys, one tab stop, the right role —
   which a div with a click handler would have to reimplement.
   ============================================================ */

.quiz,
.quiz-result {
    max-width: 860px;
    margin: 0 auto;
    padding: clamp(24px, 4vw, 48px) clamp(20px, 4vw, 56px);
}

.quiz-result {
    max-width: 1480px;
}

/* ------------------------------------------------------------
   Progress — revealed by assets/js/quiz.js
   ------------------------------------------------------------ */
.quiz-progress[hidden] {
    display: none;
}

.quiz-progress {
    margin-bottom: 28px;
}

.quiz-progress__bar {
    height: 4px;
    border-radius: 999px;
    background: var(--c-border);
    overflow: hidden;
}

.quiz-progress__bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: var(--c-accent);
    transition: width 0.28s ease;
}

.quiz-progress__label {
    margin: 8px 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--c-ink-faint);
}

/* ------------------------------------------------------------
   One question
   ------------------------------------------------------------ */
.quiz-step {
    margin: 0 0 32px;
    padding: 0;
    border: 0;
}

/* With the script running, all but the current step are out of the
   document — including out of the tab order, which display:none does
   and a visibility swap would not. */
.quiz-step[hidden] {
    display: none;
}

.quiz-step__q {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0;
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--c-ink);
}

.quiz-step__n {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-badge);
    background: var(--c-accent);
    color: #fff;
    font-size: 0.92rem;
}

.quiz-step__answers {
    display: grid;
    gap: 10px;
}

@media (min-width: 640px) {
    .quiz-step__answers {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Hidden, not display:none — a display:none radio is removed from the
   accessibility tree and stops being reachable by keyboard. */
.quiz-radio {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.quiz-answer {
    display: block;
    padding: 16px 18px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-lg);
    background: var(--c-surface);
    color: var(--c-ink);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

.quiz-answer:hover {
    border-color: var(--c-accent);
    transform: translateY(-2px);
}

.quiz-radio:checked + .quiz-answer {
    border-color: var(--c-accent);
    background: var(--c-accent);
    color: #fff;
}

/* The label is the visible control, so the focus ring has to move onto
   it — the input it belongs to is a pixel in the corner. */
.quiz-radio:focus-visible + .quiz-answer {
    outline: 2px solid var(--c-accent);
    outline-offset: 3px;
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.quiz-actions,
.quiz-result__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.quiz-result__actions {
    justify-content: center;
}

.quiz-btn {
    display: inline-block;
    padding: 13px 26px;
    border: 1px solid var(--c-accent);
    border-radius: var(--radius-md);
    background: var(--c-accent);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s ease;
}

.quiz-btn:hover {
    background: var(--c-accent-deep);
    border-color: var(--c-accent-deep);
    color: #fff;
}

.quiz-btn--ghost {
    background: transparent;
    color: var(--c-accent);
}

.quiz-btn--ghost:hover {
    background: transparent;
    color: var(--c-accent-deep);
}

/* Hidden once the script takes over: it submits on the last answer, so
   a button that says "покажи резултата" would never be reached. */
.quiz-actions[hidden] {
    display: none;
}

.quiz-result__list {
    margin-bottom: 8px;
}

/* ------------------------------------------------------------
   Front page invitation
   ------------------------------------------------------------ */
.quiz-cta {
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 56px) clamp(32px, 5vw, 64px);
}

.quiz-cta__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: clamp(22px, 3vw, 34px) clamp(22px, 4vw, 40px);
    border-radius: var(--radius-lg);
    background: var(--c-topbar-bg);
    color: var(--c-topbar-ink);
}

.quiz-cta__text {
    margin: 0;
    max-width: 56ch;
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.4vw, 1.6rem);
    font-weight: 700;
}

/* A span inside the heading paragraph rather than a second <p>, so the
   two lines are one label to a screen reader — hence the explicit block. */
.quiz-cta__note {
    display: block;
    margin: 6px 0 0;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--c-topbar-ink-soft);
}

@media (prefers-reduced-motion: reduce) {
    .quiz-answer,
    .quiz-btn,
    .quiz-progress__bar span {
        transition: none;
    }

    .quiz-answer:hover {
        transform: none;
    }
}
