/* =====================================================================
   lifeprint-quizzes.css
   Stylesheet for the Lifeprint Quiz (LPQ) family:
     e2a — English-to-ASL (image choice)
     a2e — ASL-to-English (text choice with GIF prompt)
     aiq — Additional Information (text Q&A)
   Paired with lifeprint-quizzes.js
   ===================================================================== */

/* Wrapper for any Lifeprint Quiz block */
.lpq {
  max-width: 1340px;          /* keeps native 320px GIFs on 1920-wide */
  margin: 18px auto;
  padding: 10px;
  border: 2px solid #000;
  border-radius: 16px;
  background: #fff;
  box-sizing: border-box;
}

.lpq *,
.lpq *::before,
.lpq *::after { box-sizing: border-box; }

/* Prompt header — wraps naturally when the prompt phrase is long */
.lpq__prompt {
  margin: 0 0 8px 0;
  font-size: 22px;
  font-weight: bold;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: break-word;
}
.lpq__target {
  margin-left: 6px;
  font-size: 24px;   /* 2px larger than the surrounding prompt text */
}

/* Choices grid — defaults to 2x2 */
.lpq__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

/* Choice tile (button) — position:relative so the A/B/C/D label can overlay */
.lpq__choice {
  position: relative;
  display: block;
  width: 100%;
  padding: 6px;
  border: 3px solid #000;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}
.lpq__choice[data-state="wrong"]   { border-color: #cc0000; }
.lpq__choice[data-state="correct"] { border-color: #008a2e; }
.lpq__choice:disabled              { cursor: default; }
.lpq__choice:focus {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}

/* A/B/C/D label — overlaid as a small badge in the tile's top-left corner.
   Currently UNUSED by the e2a (image-choice) quiz — kept available for
   a2e and aiq quizzes where text-based choice labels may help. */
.lpq__choice-label {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  margin: 0;
  padding: 1px 6px;
  background: #fff;
  color: #000;
  border: 2px solid #000;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  line-height: 1.1;
  text-align: center;
  pointer-events: none;  /* clicks pass through to the choice button */
}
/* Hide the letter badge only on IMAGE choices where the GIF gets
   swapped for try-again.png / good-job.png — keeping the letter on
   text choices is helpful so users can see "I tried B already". */
.lpq__choice--image[data-state="correct"] .lpq__choice-label,
.lpq__choice--image[data-state="wrong"]   .lpq__choice-label {
  display: none;
}
.lpq__choice-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 320px;
  margin: 0 auto;
  border-radius: 10px;
}

/* Stage = the prompt-GIF area (used by a2e and av2e variants) */
.lpq__stage {
  text-align: center;
  margin: 0 0 8px 0;
}
.lpq__stage-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 320px;
  margin: 0 auto;
  border: 2px solid #000;
  border-radius: 10px;
  background: #f8f8f8;
}

/* Body = optional wrapper around stage + choices. Block-flow by default
   (stage stacks on top of choices). At narrow-tall breakpoints we flip
   it to flex side-by-side to recover vertical space. */
.lpq__body { display: block; }

/* Text-choice button variant (used by a2e, and later by aiq) */
.lpq__choice--text {
  padding: 14px 12px;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  min-height: 56px;
  line-height: 1.2;
  font-family: inherit;
  color: #000;
}
.lpq__choice--text[data-state="correct"] { background: #d4f5d8; }

/* Wrong-answer text choices: pink tint AND a diagonal strike line.
   The strike line uses a CSS gradient so it works on multi-line buttons
   and remains visible regardless of color vision. */
.lpq__choice--text[data-state="wrong"] {
  background:
    linear-gradient(
      to top right,
      transparent 0%,
      transparent calc(50% - 2px),
      #000 calc(50% - 2px),
      #000 calc(50% + 2px),
      transparent calc(50% + 2px),
      transparent 100%
    ),
    #fde0e0;
  color: #666;
}

/* Prompt status — "Try again." / "Right!" badge that appears to the
   right of the question text. Hidden by default; CSS class drives state. */
.lpq__status {
  display: inline-block;
  margin-left: 12px;
  padding: 1px 10px;
  border: 2px solid currentColor;
  border-radius: 8px;
  font-size: 20px;
  vertical-align: baseline;
  visibility: hidden;
}
.lpq__status[data-state="wrong"] {
  visibility: visible;
  color: #cc0000;
}
.lpq__status[data-state="correct"] {
  visibility: visible;
  color: #008a2e;
}

/* aiq question text — larger for low-vision-friendly reading.
   The aiq questions can be full sentences, so we want them to stand
   out and wrap comfortably. */
.lpq--aiq {
  max-width: 900px;        /* sentence-length answers read better at a
                               moderate width — no need for the full 1340px */
}
.lpq--aiq .lpq__choices--text {
  grid-template-columns: 1fr;  /* always vertical, like a standard
                                   multiple-choice test */
}
.lpq--aiq .lpq__prompt {
  font-size: 26px;
  line-height: 1.35;
}
.lpq--aiq .lpq__status {
  font-size: 22px;
}
/* aiq text choices — larger too, with extra room for the letter badge */
.lpq--aiq .lpq__choice--text {
  font-size: 22px;
  padding: 18px 16px 18px 56px;  /* left padding clears the ABCD badge */
  min-height: 72px;
  text-align: left;
  line-height: 1.3;
}
.lpq--aiq .lpq__choice-label {
  top: 50%;
  transform: translateY(-50%);
  left: 12px;
  padding: 2px 8px;
  font-size: 18px;
}

/* Controls bar */
.lpq__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}
.lpq__btn,
.lpq__pill {
  padding: 8px 12px;
  border: 2px solid #000;
  border-radius: 12px;
  font-weight: bold;
  font-size: 18px;
  line-height: 1.1;
  font-family: inherit;
}
.lpq__btn  { background: #fff; cursor: pointer; }
.lpq__btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.lpq__btn:focus {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}
.lpq__pill { background: #f7f7f7; }

/* =========================================================
   RESPONSIVE LAYOUT
   Default (above):     single-col choices for text quizzes,
                        2x2 fallback for image quizzes
   e2a (image quiz):    2x2 grid by default, 4-in-a-row at >=1024px
   a2e (stage + text):  single-col choices always; body stacked
                        on narrow, side-by-side at >=600px
   aiq (text quiz):     2x2 default, single-col on narrow phones
   ========================================================= */

/* Wide screens: 4-in-a-row for IMAGE choices only (e2a). Text choices
   stay in their per-quiz layout regardless of screen width. */
@media (min-width: 1024px) {
  .lpq__choices--images {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ----- a2e LAYOUT -----
   Stage (GIF prompt) + 4 text choices. Single-column choices at every
   size; on narrow screens the GIF stacks on top, on medium+ the GIF
   sits to the left and the four choices stack vertically to its right. */
.lpq--a2e {
  max-width: 1000px;   /* narrower than default — side-by-side doesn't
                          need 1340px and looks better when centered */
}
.lpq--a2e .lpq__choices--text {
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 600px) {
  .lpq--a2e .lpq__body {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "stage choices"
      "stage controls";
    column-gap: 16px;
    row-gap: 10px;
    align-items: start;
  }
  .lpq--a2e .lpq__stage    { grid-area: stage; margin: 0; }
  .lpq--a2e .lpq__body > .lpq__choices  { grid-area: choices; margin-bottom: 0; }
  .lpq--a2e .lpq__body > .lpq__controls { grid-area: controls; }
}

/* Short landscape (phones in landscape): tighter spacing.
   Side-by-side body layout for a2e is the DEFAULT at >=600px,
   so this rule only handles size-tightening for short viewports. */
@media (orientation: landscape) and (max-height: 520px) {
  .lpq {
    margin: 6px auto;
    padding: 6px;
  }
  .lpq__choices--images {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 4px;
  }
  .lpq__prompt {
    font-size: 18px;
    margin-bottom: 4px;
    text-align: center;
  }
  .lpq__target { font-size: 20px; }
  .lpq__choice { padding: 3px; border-width: 2px; border-radius: 10px; }
  .lpq__choice-label {
    top: 5px; left: 5px;
    padding: 0 4px;
    font-size: 12px;
    border-width: 1px;
  }
  .lpq__btn,
  .lpq__pill {
    padding: 5px 10px;
    font-size: 15px;
    border-radius: 10px;
  }

  /* a2e: tighter GIF and tighter choice tiles on short landscape */
  .lpq--a2e .lpq__body { column-gap: 8px; row-gap: 6px; }
  .lpq--a2e .lpq__stage-img {
    max-width: 200px;
    border-width: 1px;
  }
  .lpq--a2e .lpq__choices--text { gap: 4px; }
  .lpq--a2e .lpq__choice--text {
    padding: 6px 8px;
    font-size: 15px;
    min-height: 0;
  }

  /* aiq overrides for phone landscape — single column, no side-by-side */
  .lpq--aiq .lpq__prompt    { font-size: 18px; line-height: 1.3; }
  .lpq--aiq .lpq__status    { font-size: 16px; }
  .lpq--aiq .lpq__choice--text {
    font-size: 14px;
    padding: 6px 6px 6px 36px;
    min-height: 0;
  }
  .lpq--aiq .lpq__choice-label {
    left: 6px;
    padding: 0 5px;
    font-size: 12px;
    border-width: 1px;
  }
}

/* Phone portrait: keep 2x2, but tighten everything */
@media (max-width: 600px) and (orientation: portrait) {
  .lpq {
    margin: 8px auto;
    padding: 6px;
    border-radius: 12px;
  }
  .lpq__prompt {
    font-size: 18px;
    text-align: center;
  }
  .lpq__target { font-size: 20px; }
  .lpq__choices { gap: 4px; }
  .lpq__choice  { padding: 4px; border-width: 2px; border-radius: 10px; }
  .lpq__choice-label {
    top: 6px; left: 6px;
    padding: 0 5px;
    font-size: 13px;
    border-width: 1px;
  }
  .lpq__stage-img    { max-width: 260px; border-width: 1px; }
  .lpq__choice--text { padding: 10px 8px; font-size: 18px; min-height: 0; }
  .lpq__btn,
  .lpq__pill {
    padding: 6px 10px;
    font-size: 16px;
    border-radius: 10px;
  }

  /* aiq overrides for phone portrait */
  .lpq--aiq .lpq__prompt    { font-size: 20px; line-height: 1.3; text-align: left; }
  .lpq--aiq .lpq__status    { font-size: 18px; }
  .lpq--aiq .lpq__choices   { grid-template-columns: 1fr; gap: 6px; }
  .lpq--aiq .lpq__choice--text {
    font-size: 17px;
    padding: 12px 12px 12px 44px;
    min-height: 0;
  }
  .lpq--aiq .lpq__choice-label {
    left: 8px;
    padding: 1px 6px;
    font-size: 15px;
    border-width: 2px;
  }
}
/* =========================================================
   AV2E -- ASL Video to English practice quiz
   Paste at the bottom of /css/lifeprint-quizzes.css
   ========================================================= */

.lpq--av2e {
  max-width: 1000px;
}

.lpq--av2e .lpq__choices--text {
  grid-template-columns: 1fr;
  gap: 8px;
}

.lpq--av2e .lpq__video-stage {
  text-align: center;
  margin: 0 0 8px 0;
}

.lpq--av2e .lpq__youtube-player {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 16 / 9;
  margin: 0 auto 8px auto;
  border: 2px solid #000;
  border-radius: 10px;
  background: #111;
  overflow: hidden;
}

.lpq--av2e .lpq__youtube-player iframe {
  width: 100% !important;
  height: 100% !important;
  display: block;
  border: 0;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.lpq--av2e .lpq__video-replay {
  margin-top: 4px;
}

@media (min-width: 700px) {
  .lpq--av2e .lpq__body {
    display: grid;
    grid-template-columns: minmax(320px, 480px) 1fr;
    grid-template-areas:
      "stage choices"
      "stage controls";
    column-gap: 16px;
    row-gap: 10px;
    align-items: start;
  }

  .lpq--av2e .lpq__stage {
    grid-area: stage;
    margin: 0;
  }

  .lpq--av2e .lpq__body > .lpq__choices {
    grid-area: choices;
    margin-bottom: 0;
  }

  .lpq--av2e .lpq__body > .lpq__controls {
    grid-area: controls;
  }
}