/* ==========================================================================
   Creole Driving Test: styled like the rest of the site.
   The page uses the theme's own header (.hub-head), buttons (.btn) and
   article text (.prose); this file adds the figures, the quiz and the guide cards.
   ========================================================================== */

/* ---------- Header: three plain figures under the intro ---------- */
.cd-figures { display: flex; flex-wrap: wrap; gap: 0.75rem 0; margin: 1.5rem 0 0; }
.cd-figures > div { display: flex; flex-direction: column-reverse; padding: 0 1.5rem; border-left: 1px solid var(--rule); }
.cd-figures > div:first-child { padding-left: 0; border-left: 0; }
.cd-figures dt { color: var(--ink-mute); font-size: 0.88rem; line-height: 1.3; }
.cd-figures dd { margin: 0; font-family: var(--font-display); font-size: var(--step-3); font-weight: 650; line-height: 1.05; letter-spacing: -0.03em; color: var(--lagoon-deep); }
@media (max-width: 599px) {
  .cd-figures { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; }
  .cd-figures > div { padding: 0 0.9rem; }
  .cd-figures dd { font-size: 1.7rem; }
  .cd-figures dt { font-size: 0.8rem; }
  .hub-head__media.cd-hero-media { display: none; } /* phones: get to the quiz sooner */
}

/* Header picture: the page's featured image, or a road-sign placeholder until one is set */
.cd-media-ph { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: 20px; background: var(--paper-deep); overflow: hidden; }
.cd-media-ph__signs { display: flex; align-items: flex-end; gap: 6%; width: 70%; }
.cd-media-ph__signs svg { display: block; width: 100%; height: auto; }
.cd-media-ph__signs span { flex: 1; }
.cd-media-ph__signs span:nth-child(2) { flex: 1.3; transform: translateY(-12%); }
.cd-media-ph__note { position: absolute; left: 0.75rem; bottom: 0.75rem; margin: 0; padding: 0.3rem 0.6rem; border-radius: var(--r-sm); background: rgb(255 255 255 / .85); color: var(--ink-soft); font-size: 0.78rem; }

/* ---------- Quiz area: a tinted band with a white card ---------- */
.cd-band { padding-block: 2rem 2.5rem; background: var(--paper-deep); }
@media (min-width: 720px) { .cd-band { padding-block: 3rem 3.5rem; } }
.cd-app { padding: 1.25rem; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper); scroll-margin-top: calc(var(--header-h) + var(--admin-offset, 0px) + 1rem); }
@media (min-width: 720px) { .cd-app { padding: 2rem 2.25rem; } }
.cd-app svg { display: block; }
.cd-loading, .cd-empty { margin: 0; padding: 1rem 0; color: var(--ink-mute); }

/* ---------- Start screen ---------- */
.cd-exam { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem 1.25rem; align-items: start; padding-bottom: 1.75rem; border-bottom: 1px solid var(--rule); }
.cd-exam__icon { display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 14px; background: var(--lagoon-wash); color: var(--lagoon-deep); }
.cd-exam__icon svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cd-exam h2, .cd-practice h2 { margin: 0 0 0.3rem; font-size: var(--step-2); }
.cd-exam p { max-width: 40rem; margin: 0; color: var(--ink-soft); line-height: 1.55; }
.cd-exam .cd-stats { margin-top: 0.5rem; color: var(--ink-mute); font-size: 0.92rem; }
.cd-exam .btn { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 720px) {
  .cd-exam { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .cd-exam .btn { grid-column: auto; min-width: 11rem; }
}
.cd-practice { padding-top: 1.75rem; }
.cd-practice__head p { margin: 0 0 1.1rem; color: var(--ink-soft); }
.cd-topics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 720px) { .cd-topics { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; } }
.cd-topics li { display: flex; }
.cd-topic { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 0 0 0.85rem; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.cd-topic:hover { border-color: var(--lagoon); box-shadow: 0 10px 22px -18px rgb(12 61 59 / .45); }
.cd-topic:focus-visible { outline: 2px solid var(--lagoon); outline-offset: 2px; }
.cd-topic__art { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; margin-bottom: 0.75rem; background: var(--surface); }
.cd-topic__art svg { width: 52%; height: auto; max-height: 72%; }
.cd-topic__name { padding: 0 0.9rem; font-family: var(--font-display); font-weight: 650; line-height: 1.25; }
.cd-topic:hover .cd-topic__name { color: var(--lagoon-deep); }
.cd-topic__n { padding: 0.15rem 0.9rem 0; color: var(--ink-mute); font-size: 0.88rem; }
.cd-topic__art svg[viewBox="0 0 160 120"] { width: 78%; max-height: none; }
@media (max-width: 719px) {
  /* Phones: compact rows, small sign on the left */
  .cd-topics { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .cd-topic { display: grid; grid-template-columns: 4rem minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 0.9rem; align-items: center; padding: 0.5rem; }
  .cd-topic__art { grid-row: 1 / 3; width: 4rem; height: 4rem; aspect-ratio: auto; margin: 0; border-radius: 10px; }
  .cd-topic__art svg { width: 66%; max-height: 66%; }
  .cd-topic__art svg[viewBox="0 0 160 120"] { width: 92%; }
  .cd-topic__name { align-self: end; padding: 0; }
  .cd-topic__n { align-self: start; padding: 0; }
}
.cd-mistakes { margin: 1.25rem 0 0; }
.cd-textlink { padding: 0.25rem 0; border: 0; background: none; color: var(--lagoon-deep); font: inherit; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Question ---------- */
.cd-run, .cd-done { max-width: 46rem; margin-inline: auto; }
.cd-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; }
.cd-count { margin: 0 auto 0 0; font-weight: 650; }
.cd-count span { color: var(--ink-mute); font-weight: 400; }
.cd-timer { display: flex; align-items: center; gap: 0.6rem; color: var(--ink-soft); font-size: 0.93rem; font-variant-numeric: tabular-nums; }
.cd-timer b { color: var(--ink); }
.cd-timer__bar { position: relative; width: 6rem; height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.cd-timer__bar::after { content: ''; position: absolute; inset: 0 auto 0 0; width: calc(var(--t, 1) * 100%); background: var(--lagoon); }
.cd-timer.is-low, .cd-timer.is-low b { color: var(--coral); }
.cd-timer.is-low .cd-timer__bar::after { background: var(--coral); }
.cd-quit { padding: 0.25rem 0; border: 0; background: none; color: var(--ink-mute); font: inherit; font-size: 0.93rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cd-quit:hover { color: var(--ink); }
.cd-bar { height: 2px; margin: 0.9rem 0 1.5rem; background: var(--rule); }
.cd-bar > span { display: block; height: 100%; background: var(--lagoon); transition: width .25s ease; }
.cd-img { display: grid; place-items: center; margin: 0 0 1.25rem; padding: 1.5rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.cd-img svg { width: 8.5rem; height: 8.5rem; }
.cd-img--scene svg { width: 12rem; height: auto; }
.cd-img img { max-width: 100%; max-height: 14rem; width: auto; height: auto; }
.cd-question { margin: 0 0 1.1rem; font-size: var(--step-2); line-height: 1.25; }
.cd-question:focus { outline: none; }
.cd-choices { display: grid; gap: 0.5rem; }
.cd-choice { display: flex; align-items: flex-start; gap: 0.85rem; width: 100%; min-height: 3.25rem; padding: 0.85rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; text-align: left; line-height: 1.45; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cd-choice:hover:not([disabled]) { border-color: var(--ink-soft); }
.cd-choice:focus-visible { outline: 2px solid var(--lagoon); outline-offset: 2px; }
.cd-choice[disabled] { cursor: default; }
.cd-radio { flex: none; width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; border: 2px solid var(--ink-mute); border-radius: 50%; background: var(--paper); }
.cd-choice.is-picked { border-color: var(--lagoon); background: var(--lagoon-wash); }
.cd-choice.is-picked .cd-radio { border-color: var(--lagoon); background: var(--lagoon); box-shadow: inset 0 0 0 3px var(--lagoon-wash); }
.cd-choice.is-correct { border-color: #2F9E63; background: #EEF8F1; }
.cd-choice.is-correct .cd-radio { border-color: #2F9E63; background: #2F9E63; box-shadow: inset 0 0 0 3px #EEF8F1; }
.cd-choice.is-wrong { border-color: var(--coral); background: #FCEFED; }
.cd-choice.is-wrong .cd-radio { border-color: var(--coral); background: var(--coral); box-shadow: inset 0 0 0 3px #FCEFED; }
.cd-feedback:empty { display: none; }
.cd-feedback { margin-top: 1.1rem; padding: 0.15rem 0 0.15rem 1rem; border-left: 3px solid var(--rule); }
.cd-feedback.is-right { border-left-color: #2F9E63; }
.cd-feedback.is-wrong { border-left-color: var(--coral); }
.cd-feedback p { margin: 0 0 0.3rem; color: var(--ink-soft); line-height: 1.55; }
.cd-feedback p:last-child { margin-bottom: 0; }
.cd-feedback strong { color: var(--ink); }
.cd-next { margin-top: 1.25rem; }
@media (max-width: 599px) {
  .cd-next .btn { width: 100%; justify-content: center; }
  .cd-timer__bar { width: 4rem; }
}
/* ---------- Results ---------- */
.cd-result { padding-bottom: 0.25rem; }
.cd-result__kicker { margin: 0 0 0.35rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); }
.cd-result__title { margin: 0 0 0.5rem; font-size: var(--step-3); }
.is-pass .cd-result__title { color: #23784B; }
.is-fail .cd-result__title { color: var(--coral); }
.cd-result__line { margin: 0; font-size: var(--step-1); color: var(--ink-soft); }
.cd-result__line b { color: var(--ink); }
.cd-result__line b:focus { outline: none; }
.cd-result__detail { max-width: 38rem; margin: 0.35rem 0 0; color: var(--ink-soft); }
.cd-done__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 2.25rem; }
.cd-review-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.6rem; }
.cd-review-head h3 { margin: 0; font-size: var(--step-1); }
.cd-filter { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--ink-soft); font-size: 0.93rem; cursor: pointer; }
.cd-filter input { width: 1.05rem; height: 1.05rem; accent-color: var(--lagoon); }
.cd-review { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.cd-review.is-filtered [data-right] { display: none; }
.cd-review__item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: start; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.cd-review__item:not(:has(.cd-img)) { grid-template-columns: minmax(0, 1fr); }
.cd-img--small { margin: 0; padding: 0.4rem; }
.cd-img--small svg { width: 3rem; height: 3rem; }
.cd-img--small.cd-img--scene svg { width: 4.25rem; height: auto; }
.cd-img--small img { max-width: 4.25rem; max-height: 4.25rem; }
.cd-review__q { margin: 0 0 0.3rem; font-weight: 650; line-height: 1.4; }
.cd-review__q span { color: var(--ink-mute); font-weight: 400; }
.cd-review__a { margin: 0.1rem 0 0; font-size: 0.95rem; }
.cd-review__a.is-right { color: #23784B; }
.cd-review__a.is-wrong { color: var(--coral); }
.cd-review__why { margin: 0.35rem 0 0; color: var(--ink-mute); font-size: 0.92rem; }

/* ---------- Guide text: each section of the page text becomes a card ---------- */
.cd-guide__grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .cd-guide__grid { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.25rem; } }
.cd-guide__card { padding: 1.4rem 1.5rem; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper); }
.cd-guide__card.prose > :first-child { margin-top: 0; }
.cd-guide__card.prose > :last-child { margin-bottom: 0; }
.cd-guide__card.prose h2 { margin: 0 0 0.6rem; font-size: var(--step-1); }
.cd-guide__intro { max-width: var(--measure); margin-bottom: 1.5rem; }

@media (prefers-reduced-motion: reduce) { .cd-bar > span, .cd-topic svg { transition: none; } }
