/* ============================================================
   /grammar/pictures/ — the sentence lessons of "Grammar in Pictures".
   Lesson page: a rule box per group (the video's own teaching lines), a
   grid of picture cards (tap = hear the sentence), and the two-choice quiz
   that js/picture-lesson.js draws into #gp-app with the lt-* chrome from
   leveltest.css. The index page borrows the Picture Dictionary's hub-card
   classes (picture-dictionary.css) and needs nothing from this file.

   --gp-c is the group's color, set inline on each .gp-section from the
   lesson data; everything highlighted in that group takes it.
   ============================================================ */

.gp-page { --gp-c: var(--esl-action); }

.gp-facts {
  margin: var(--esl-space-2) 0 0;
  color: var(--esl-ink-muted);
  font-size: var(--esl-fs-sm);
}

/* ---- tools ---- */
.gp-quizbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esl-space-2);
  margin: var(--esl-space-4) 0 var(--esl-space-2);
}
.gp-quizbar .lt-btn { border: 1px solid var(--esl-action); cursor: pointer; font: inherit; font-weight: 700; }
.gp-quizbar .lt-btn[disabled] { opacity: .45; cursor: default; }
.gp-trline {
  margin: 0 0 var(--esl-space-4);
  color: var(--esl-ink-muted);
  font-size: var(--esl-fs-sm);
}
/* site.js fills the select after load; reserving its populated width keeps
   the line from re-wrapping (the Picture Dictionary legend does the same). */
.gp-trline .select-list-action { min-width: 13.5rem; }

/* ---- a group ---- */
.gp-section { margin: var(--esl-space-6) 0 0; scroll-margin-top: 5rem; }
/* .esl-linkgroup sets its own display, which beats the UA's [hidden] rule —
   the jump links are hidden with the sections while a quiz runs. */
.gp-section[hidden],
.gp-jump[hidden] { display: none; }
.gp-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--esl-space-2) var(--esl-space-3);
  margin: 0 0 var(--esl-space-3);
}
.gp-group__quiz {
  font: inherit;
  font-size: var(--esl-fs-sm);
  font-weight: 700;
  padding: 4px 12px;
  border: 1px solid var(--esl-border-strong);
  border-radius: var(--esl-radius-pill);
  background: var(--esl-surface);
  color: var(--esl-ink-soft);
  cursor: pointer;
}
.gp-group__quiz:hover,
.gp-group__quiz:focus-visible { border-color: var(--esl-action); color: var(--esl-action); }

/* The rule box: what the word is for, then the lines that explain it. */
.gp-lesson {
  margin: 0 0 var(--esl-space-4);
  padding: var(--esl-space-3) var(--esl-space-4);
  border: 1px solid var(--esl-border);
  border-left: 5px solid var(--gp-c);
  border-radius: var(--esl-radius);
  background: var(--esl-surface);
}
.gp-rule {
  margin: 0;
  font-size: var(--esl-fs-lg);
  font-weight: 700;
  line-height: 1.35;
}
.gp-rule__note { margin: var(--esl-space-1) 0 0; color: var(--esl-ink-muted); }
.gp-teach { margin: var(--esl-space-3) 0 0; padding-top: var(--esl-space-3); border-top: 1px dashed var(--esl-border); }
.gp-teach > p { margin: 0 0 var(--esl-space-1); }
.gp-teach > p:last-child { margin-bottom: 0; }
.gp-say { margin-top: var(--esl-space-2) !important; }
.gp-say:first-child { margin-top: 0 !important; }
.gp-ex { padding-left: 1.7rem; position: relative; font-weight: 600; }
.gp-ex--reply { font-weight: 400; color: var(--esl-ink-muted); }
.gp-ex--no { font-weight: 400; }
.gp-mark {
  position: absolute;
  left: 0;
  top: .12em;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  font-size: .8rem;
  line-height: 1.25rem;
  text-align: center;
  font-weight: 700;
  color: #fff;
}
.gp-ex--ok .gp-mark { background: var(--esl-success); }
.gp-ex--no .gp-mark { background: var(--esl-error); }
.gp-not { color: var(--esl-error); font-weight: 700; }
.gp-sub { padding-left: 1.7rem; color: var(--esl-ink-muted); font-style: italic; }
.gp-tiles { display: flex; flex-wrap: wrap; gap: var(--esl-space-2); padding-left: 1.7rem; }
.gp-tile {
  padding: 2px 12px;
  border: 1px solid var(--esl-border);
  border-radius: var(--esl-radius-pill);
  background: #fff;
  font-weight: 600;
}

/* The highlighted part of a sentence, and the wrong part of a mistake. */
.gp-hl { color: var(--gp-c); font-weight: 700; }
.gp-x {
  color: var(--esl-error);
  font-weight: 700;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

/* ---- picture cards: 3 / 2 across ---- */
.gp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--esl-space-3);
}
.gp-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 2px;
  padding: var(--esl-space-2);
  border: 1px solid var(--esl-border);
  border-radius: var(--esl-radius-lg);
  background: #fff;
  box-shadow: var(--esl-shadow-sm);
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.gp-card:hover,
.gp-card:focus-visible,
.gp-card.is-playing { border-color: var(--esl-action); box-shadow: var(--esl-shadow-md); }
.gp-thumb { display: block; position: relative; margin-bottom: var(--esl-space-1); }
.gp-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: var(--esl-radius);
}
.gp-hear,
.gp-trans {
  position: absolute;
  bottom: 6px;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, .88);
  font-size: 1rem;
  line-height: 1.9rem;
  text-align: center;
}
.gp-hear { left: 6px; pointer-events: none; }
.gp-trans { right: 6px; cursor: pointer; }
.gp-trans:hover,
.gp-trans:focus-visible { background: var(--esl-action-soft); outline: 2px solid var(--esl-action); }
.gp-card.is-playing .gp-hear { background: var(--esl-action-soft); }
.gp-card__ctx { color: var(--esl-ink-muted); font-size: var(--esl-fs-sm); }
.gp-card__text { font-size: var(--esl-fs-lg); font-weight: 700; line-height: 1.3; }
.gp-card__follow { color: var(--esl-ink-muted); line-height: 1.35; }

/* A practice round keeps its answers folded away until asked for. */
.gp-answers { margin: var(--esl-space-3) 0 0; }
.gp-answers > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--esl-ink-soft);
  margin-bottom: var(--esl-space-3);
}
.gp-start { cursor: pointer; border: 0; font: inherit; font-weight: 700; }

/* ---- the quiz (#gp-app) ---- */
#gp-app:not(:empty) { margin: var(--esl-space-3) 0 var(--esl-space-5); }
.gp-qhead { display: flex; justify-content: flex-end; margin: 0 0 var(--esl-space-2); }
.gp-qhead .lt-btn { cursor: pointer; font: inherit; font-weight: 700; padding: 6px 14px; }
.gp-q { text-align: center; }
.gp-q__img {
  display: block;
  width: min(100%, 300px);
  height: auto;
  aspect-ratio: 1 / 1;
  margin: 0 auto var(--esl-space-3);
  border-radius: var(--esl-radius);
}
.gp-q__ctx { margin: 0 0 var(--esl-space-1); font-size: var(--esl-fs-lg); }
.gp-choices { max-width: 34rem; margin: 0 auto; }
.gp-choice {
  display: flex;
  align-items: center;
  gap: var(--esl-space-3);
  font: inherit;
  font-size: var(--esl-fs-lg);
  color: inherit;
  position: relative;
}
.gp-choice__key {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 1px solid var(--esl-border-strong);
  font-size: var(--esl-fs-sm);
  font-weight: 700;
  line-height: 1.8rem;
  text-align: center;
  color: var(--esl-ink-muted);
  background: var(--esl-surface);
}
.gp-choice .gp-hl { color: var(--esl-action); }
.gp-choice.lt-choice--right { border: 2px solid var(--esl-success); background: var(--esl-success-soft); }
.gp-choice.lt-choice--wrong { border: 2px solid var(--esl-error); background: var(--esl-error-soft); font-weight: 400; }
.gp-choice.lt-choice--right .gp-choice__key { background: var(--esl-success); border-color: var(--esl-success); color: #fff; }
.gp-choice.lt-choice--wrong .gp-choice__key { background: var(--esl-error); border-color: var(--esl-error); color: #fff; }
.gp-choice.lt-choice--right .gp-hl { color: #15803d; }
.gp-choice.lt-choice--wrong .gp-hl {
  color: var(--esl-error);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
.gp-nextrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--esl-space-3);
  margin-top: var(--esl-space-3);
}
.gp-nextrow .lt-btn { border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.gp-nextrow .lt-btn[disabled] { opacity: .4; cursor: default; }
.gp-nextrow label { color: var(--esl-ink-muted); font-size: var(--esl-fs-sm); cursor: pointer; }
#gp-app .lt-result__cta .lt-btn { cursor: pointer; font: inherit; font-weight: 700; }

/* ---- previous / next lesson ---- */
.gp-pn {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--esl-space-3);
  margin: var(--esl-space-6) 0 var(--esl-space-4);
}
.gp-pn__link {
  display: flex;
  align-items: center;
  gap: var(--esl-space-3);
  padding: var(--esl-space-3);
  border: 1px solid var(--esl-border);
  border-radius: var(--esl-radius);
  background: var(--esl-surface);
  text-decoration: none;
  font-weight: 700;
}
.gp-pn__link:hover { border-color: var(--esl-action); }
.gp-pn__next { grid-column: 2; justify-content: flex-end; text-align: right; }
.gp-pn__img { width: 64px; height: 64px; border-radius: var(--esl-radius-sm); flex: none; }
.gp-pn__kicker { display: block; color: var(--esl-ink-muted); font-size: var(--esl-fs-sm); font-weight: 400; }

@media (max-width: 860px) {
  .gp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .gp-grid { gap: var(--esl-space-2); }
  .gp-card { padding: 6px; }
  .gp-card__text { font-size: var(--esl-fs-base); }
  .gp-card__follow { font-size: var(--esl-fs-sm); }
  .gp-lesson { padding: var(--esl-space-3); }
  .gp-pn { grid-template-columns: 1fr; }
  .gp-pn__next { grid-column: 1; }
  .gp-choice { font-size: var(--esl-fs-base); }
}
@media print {
  .gp-quizbar, .gp-trline, .gp-group__quiz, .gp-hear, .gp-trans, .gp-pn, #gp-app, .gp-start { display: none !important; }
  .gp-answers > summary { display: none; }
  .gp-card { break-inside: avoid; box-shadow: none; }
}
