/* ============================================================
   Review mode. Off unless the page is opened with ?review=1
   (or window.CRICKET_REVIEW is set, which the preview build does).
   Lets a reviewer attach a note to any figure or page and copy
   the lot as text to paste back into a conversation.
   ============================================================ */

.rv { position: fixed; inset: 0; pointer-events: none; z-index: 90; }

/* the floating opener */
.rv__fab {
  position: fixed; right: 16px; bottom: 16px; pointer-events: auto;
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 48px; padding: 0 20px;
  font-family: var(--font-ui); font-size: 1.2rem; line-height: 1;
  color: var(--paper); background: var(--ink);
  border: 1px solid var(--ink); border-radius: 26px;
  box-shadow: 0 4px 14px rgba(40,32,16,.3); cursor: pointer;
}
.rv__fab:hover { background: var(--red); border-color: var(--red); }
.rv__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px;
  background: var(--amber); color: #23201A;
  font-family: var(--font-body); font-size: .82rem; font-weight: 600;
}
.rv__count[data-zero="1"] { display: none; }

/* the sheet */
.rv__scrim {
  position: fixed; inset: 0; background: rgba(20,16,8,.45);
  opacity: 0; transition: opacity .22s ease; pointer-events: none;
}
.rv.open .rv__scrim { opacity: 1; pointer-events: auto; }

.rv__sheet {
  position: fixed; right: 0; bottom: 0; left: 0; pointer-events: auto;
  max-height: 86vh; display: flex; flex-direction: column;
  background: var(--paper-card);
  border-top: 2px solid var(--ink);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 30px rgba(40,32,16,.28);
  transform: translateY(102%); transition: transform .26s cubic-bezier(.3,.8,.4,1);
}
.rv.open .rv__sheet { transform: translateY(0); }
@media (min-width: 721px) {
  .rv__sheet {
    left: auto; width: 440px; right: 16px; bottom: 16px;
    border: 2px solid var(--ink); border-radius: 10px; max-height: 78vh;
  }
  .rv.open .rv__sheet { transform: translateY(0); }
  .rv__sheet { transform: translateY(calc(100% + 24px)); }
}

.rv__head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px 12px; border-bottom: 1px dashed var(--rule);
}
.rv__head h2 { font-family: var(--font-display); font-size: 1.15rem; margin: 0; flex: 1; }
.rv__x {
  border: 1px solid var(--rule); background: transparent; color: var(--ink-soft);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  font-size: 1.1rem; line-height: 1;
}
.rv__x:hover { color: var(--ink); border-color: var(--ink-faint); }

.rv__body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 14px 18px; -webkit-overflow-scrolling: touch;
}

.rv__field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.rv__field label { font-family: var(--font-ui); font-size: 1.08rem; color: var(--ink-faint); }
.rv select, .rv textarea {
  font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 4px; padding: 10px 12px; width: 100%;
  min-height: 44px;
}
.rv textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.rv select:focus, .rv textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; }

.rv__add {
  font-family: var(--font-ui); font-size: 1.15rem;
  min-height: 44px; width: 100%; cursor: pointer;
  color: var(--paper); background: var(--ink);
  border: 1px solid var(--ink); border-radius: 22px;
}
.rv__add:hover { background: var(--red); border-color: var(--red); }
.rv__add:disabled { opacity: .4; cursor: not-allowed; }

.rv__list { list-style: none; margin: 16px 0 0; padding: 0; }
.rv__list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0; border-top: 1px dashed var(--rule);
}
.rv__note { flex: 1; min-width: 0; }
.rv__where { font-family: var(--font-ui); font-size: 1.02rem; color: var(--red); }
.rv__text { font-size: .96rem; line-height: 1.45; margin: 2px 0 0; word-wrap: break-word; }
.rv__del {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--rule); background: transparent;
  color: var(--ink-faint); cursor: pointer; line-height: 1;
}
.rv__del:hover { color: var(--red); border-color: var(--red); }
.rv__empty { font-family: var(--font-ui); font-size: 1.1rem; color: var(--ink-faint); margin: 14px 0 0; }

.rv__foot {
  flex: 0 0 auto;
  padding: 12px 18px 18px; border-top: 1px dashed var(--rule);
  display: flex; flex-direction: column; gap: 10px;
}
.rv__copy {
  font-family: var(--font-ui); font-size: 1.2rem;
  min-height: 48px; width: 100%; cursor: pointer;
  color: var(--paper); background: var(--red);
  border: 1px solid var(--red); border-radius: 24px;
  transition: background .2s ease, border-color .2s ease;
}
.rv__copy:hover { background: var(--ink); border-color: var(--ink); }
.rv__copy[data-done="1"] { background: var(--green); border-color: var(--green); }
.rv__copy:disabled { opacity: .4; cursor: not-allowed; }
.rv__hint { font-family: var(--font-ui); font-size: 1.02rem; color: var(--ink-faint); margin: 0; text-align: center; }
.rv__out { display: none; }
.rv__out[data-show="1"] { display: block; }
.rv__out textarea { min-height: 130px; font-size: .88rem; }
.rv__clear {
  background: none; border: 0; color: var(--ink-faint); cursor: pointer;
  font-family: var(--font-ui); font-size: 1rem; text-decoration: underline;
  align-self: center; min-height: 36px;
}
.rv__clear:hover { color: var(--red); }

/* the per-figure note button, injected into each figure header */
.rv-note {
  font-family: var(--font-ui); font-size: 1.05rem; line-height: 1;
  background: transparent; color: var(--ink-faint);
  border: 1px dashed var(--rule); border-radius: 20px;
  padding: 8px 13px; min-height: 40px; cursor: pointer;
}
.rv-note:hover { color: var(--red); border-color: var(--red); border-style: solid; }
.rv-note[data-has="1"] { color: var(--red); border-color: var(--red); border-style: solid; }

@media (prefers-reduced-motion: reduce) {
  .rv__sheet, .rv__scrim { transition: none; }
}
