/* Rating-study additions on top of style.css (which stays the shared base:
   colors, overlays, progress bar, the three panes at 36% / rest / 26%). */

#figure-image { cursor: zoom-in; }

/* ---------- caption labels: the theme's purple (--accent2) on a light
   tint, so they stand apart from the blue buttons and selections ---------- */
:root { --caption-tint: #f1ebf8; }
.caption-tag {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--caption-tint);
  color: var(--accent2);
  font-weight: 700;
  white-space: nowrap;
}
#captions-pane .card h2 { margin-bottom: 10px; }
#captions-pane .card h2 .caption-tag { font-size: 0.9rem; }
#captions-pane .card .source-label { margin-left: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
#captions-pane .card p { margin: 0; font-size: 1.02rem; line-height: 1.5; }
#captions-pane .card {
  border: 2px solid transparent;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
#captions-pane .card.is-linked {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.35);
}

/* ---------- question blocks ---------- */
.q-block { padding: 14px 0 16px; border-top: 1px solid var(--border); scroll-margin-top: 48px; }
.q-block:first-child { border-top: none; padding-top: 0; }
.q-title { margin: 0 0 10px; font-size: 0.92rem; font-weight: 600; color: var(--text); }
.q-block.is-missing .q-title::before { content: "* "; color: var(--danger); }

/* ---------- 1-5 rating grid: one row per caption ---------- */
.rate-grid {
  display: grid;
  grid-template-columns: 82px repeat(5, minmax(0, 1fr));
  row-gap: 2px;
}
/* End-point labels on one line above the numbers: "1 = ..." at the left,
   "5 = ..." at the right. */
.rate-anchors {
  grid-column: 2 / -1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 2px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.rate-anchors span:last-child { text-align: right; }
.rate-head {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 3px 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}
.rate-row { display: contents; }
.rate-slot, .rate-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  transition: background 0.12s ease;
}
.rate-slot { justify-content: flex-start; border-radius: 8px 0 0 8px; }
.rate-slot .caption-tag { padding: 2px 8px; font-size: 0.74rem; }
.rate-cell:last-child { border-radius: 0 8px 8px 0; }
.rate-row:hover > .rate-slot, .rate-row:hover > .rate-cell,
.rate-row:focus-within > .rate-slot, .rate-row:focus-within > .rate-cell { background: #f3f4fe; }
.rate-row.is-missing > .rate-slot, .rate-row.is-missing > .rate-cell { background: #fdecec; }

.rate-cell label { position: relative; display: flex; justify-content: center; width: 100%; }
.rate-cell input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.rate-cell span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: all 0.12s ease;
}
.rate-cell input:hover + span { border-color: var(--accent); color: var(--accent); }
.rate-cell input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 700;
}
.rate-cell input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- choice rows (reuse the study's pill buttons) ---------- */
/* Label on its own line: four "Caption X" pills do not fit beside it in the
   26% pane. */
.choice-block .rank-row { flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 12px; }
.choice-block .rank-label { flex: none; font-size: 0.85rem; }
.choice-block .rank-row.is-missing .rank-label { color: var(--danger); }
.choice-block .choice-options span { padding: 7px 12px; font-size: 0.84rem; }
/* The caption picked in one row is unavailable in the other. */
.choice-options input[type="radio"]:disabled { cursor: not-allowed; }
.choice-options input[type="radio"]:disabled + span {
  background: #f0f0f0;
  border-color: #e8e8e8;
  color: #c4c4c4;
  cursor: not-allowed;
}
.q-block .field { margin-bottom: 0; }

/* The message from "Next" stays in view while the pane scrolls to the first
   unanswered block. */
#form-error:not(:empty) {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -20px 10px;
  padding: 10px 20px;
  background: white;
  border-bottom: 1px solid var(--border);
}

/* ---------- enlarged figure ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 20, 40, 0.85);
  cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
