/* themes/oregonhealing/css/learn-quiz-pages.css
   The quiz pages (/learn/quiz and each quiz's own page), linked after
   learn.css and learn-study-guide.css by learn_quiz_pages_head_extra().
   Owns the .qz-* layout: the body shares the content hero's full container
   width and its left line, so the module headings and the tiles start where
   the header's logo does. The index is a group per module, its heading and
   figure beside a grid of quiz tiles. The small shared parts (.sg-k facts
   line, .sg-btn, .sg-link, .sg-docs document cards) come from
   learn-study-guide.css; colour and type from the .lrn tokens, so a theme
   that re-points them restyles this too. Mobile first: written for 390px,
   widened at 640px and 1024px (the lesson page's split). Every link and
   button is at least 44px tall. */

.qz-wrap { width: min(100% - 32px, 1280px); margin: 0 auto; padding: 4px 0 72px; overflow-x: clip; }
.qz a:focus-visible { outline: 2px solid var(--lrn-accent); outline-offset: 2px; }

/* Index: a group per module; its name, count and figure, then the tiles */
.qz-group + .qz-group { margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--lrn-line); }
.qz-group__side { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "h fig" "n fig"; column-gap: 20px; align-items: start; margin: 0 0 16px; }
.qz-group__h { grid-area: h; margin: 0; font: 700 1.375rem/1.15 var(--lrn-display); color: var(--lrn-ink); }
.qz-group__h a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; text-decoration: none; }
.qz-group__n { grid-area: n; margin: 0; color: var(--lrn-muted); font-size: .9375rem; }
.qz-group__fig { grid-area: fig; width: min(40vw, 150px); margin: 0; }
.qz-group__fig:empty { display: none; }
.qz-tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.qz-tile {
  display: flex; flex-direction: column; min-width: 0;
  padding: 18px 18px 20px; border-radius: 16px; background: var(--lrn-cream);
}
.qz-tile__h { margin: 0 0 14px; font: 700 1.25rem/1.25 var(--lrn-display); color: var(--lrn-ink); text-wrap: balance; }
.qz-tile__h a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; text-decoration: none; }
.qz-tile__links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: auto 0 0; padding-top: 4px; }

/* The "N more" card that closes a tile's document list */
.sg-doc__more {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px;
  color: var(--lrn-green); font-weight: 600; font-size: .9375rem; text-decoration: none;
}
.sg-doc__more svg { width: 18px; height: 18px; }

/* Quiz page: the answer-sheet figure, then the quiz on the logo's line */
.qz-page { display: grid; grid-template-areas: "quiz" "fig"; gap: 24px; }
.qz-page__quiz { grid-area: quiz; min-width: 0; }
.qz-page__fig { grid-area: fig; width: min(100%, 180px); margin: 0; }
.qz-page__fig:empty { display: none; }
/* flow-root holds the floated score figure inside the card, not in its bottom padding */
.qz .lrn-quiz { margin-top: 0; display: flow-root; }
.qz-page__quiz .lrn-quiz :is(.lrn-quiz__lede, .lrn-quiz__why) { max-width: 60ch; }
/* The result: the score figure sits just before the block (outside its
   aria-live region), then the score, the missed list and the retry.
   learn.css hides the block with [hidden]; the grid applies only while it
   shows. */
.qz .lrn-quiz__result:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr); }
.qz-result__fig { width: min(100%, 160px); margin: 0 0 12px; }
.qz-result__fig[hidden] { display: none; }
.qz-result__fig:empty { display: none; }
.qz .lrn-quiz__result .lrn-btn { justify-self: start; }
/* The missed list starts under the floated score figure (from 640px, below) */
.qz .lrn-quiz__result [data-lrn-quiz-missed-wrap] { clear: both; }

/* After the quiz: the lesson and its study guide as tiles, under the quiz column */
.qz-after { margin: 40px 0 0; }
.qz-after__h { margin: 0 0 16px; font: 700 1.375rem/1.15 var(--lrn-display); color: var(--lrn-ink); }
.qz-tiles--after { max-width: 56rem; }
.qz-tile--after { gap: 14px; }
.qz-tile__fig { width: min(100%, 200px); margin: 0; }
.qz-tile__fig:empty { display: none; }
.qz-tile__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.qz-tile__sum { margin: 0 0 14px; color: var(--lrn-body); font-size: .9375rem; line-height: 1.6; }

@media (hover: hover) {
  .qz-group__h a:hover, .qz-tile__h a:hover { text-decoration: underline; text-decoration-color: var(--lrn-line); text-underline-offset: 3px; }
  .sg-doc__more:hover { color: var(--lrn-ink); text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
}

@media (min-width: 640px) {
  .qz-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .qz-tile { padding: 22px 22px 24px; }
  .qz-group__fig { width: 200px; }
  .qz-page__fig { width: 220px; }
  /* The score figure floats right. The result is a plain block here, not the
     grid: a grid is a block formatting context that stands beside the float,
     and a grid item ignores clear, so the missed list stayed in a narrow
     column for its whole length. As a block the score sits left of the
     figure, the missed list clears it, and 33.5rem holds its lines under 75
     real characters (60ch let them run 83 in this smaller type). */
  .qz-result__fig { float: right; width: 160px; margin: 0 0 12px 24px; }
  .qz .lrn-quiz__result:not([hidden]) { display: block; }
  .qz .lrn-quiz__result .lrn-btn { width: fit-content; }
  .qz .lrn-quiz__result [data-lrn-quiz-missed-wrap] { max-width: 33.5rem; }
}

@media (min-width: 1024px) {
  .qz-wrap { padding-bottom: 96px; }
  /* The module's name, count and figure stand in the lesson page's 260px
     left column and stay in view while its tiles scroll past. */
  .qz-group { display: grid; grid-template-columns: 260px minmax(0, 1fr); column-gap: 56px; align-items: start; }
  .qz-group__side { position: sticky; top: 96px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "h" "n" "fig"; row-gap: 4px; margin: 0; }
  .qz-group__fig { width: 100%; max-width: 240px; margin-top: 16px; }
  .qz-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 20px; }
  /* The quiz keeps its 48rem measure on the logo's line; the answer sheet
     stands in a rail on the right and stays in view through the questions. */
  .qz-page { grid-template-columns: minmax(0, 48rem) minmax(0, 1fr); grid-template-areas: "quiz fig"; column-gap: 72px; align-items: start; }
  .qz-page__fig { position: sticky; top: 96px; width: 100%; max-width: 300px; justify-self: end; }
  /* Two tiles at most (the lesson, its guide), so a lone one keeps half the measure */
  .qz-tiles--after { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
