/* Reactions (D-023) and notices (D-024). The heart stays in ink like the
   rest of the interface: the drawings are the only colour on screen (D-011). */

/* ---------- The reactions block ---------- */
.reactions {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.reactions form { max-width: none; background: none; border: 0; padding: 0; border-radius: 0; }
.reactions-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.85rem; min-width: 0; }
.heart-form { display: contents; }
button.heart {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
button.heart:hover { background: var(--hover); border-color: var(--faint); }
button.heart[aria-pressed="true"] { border-color: var(--ink); }
button.heart .icon { width: 1.35rem; height: 1.35rem; }
button.heart[aria-pressed="true"] .icon { animation: heart-pop 0.35s var(--ease); }
@keyframes heart-pop { 40% { transform: scale(1.25); } }
.heart-line { margin: 0; min-width: 0; color: var(--ink); font-size: 0.92rem; overflow-wrap: anywhere; }
.heart-line.muted { color: var(--muted); }

.notes-sheet { display: grid; gap: 0.85rem; align-content: start; min-width: 0; }
.notes-sheet[hidden] { display: none; }
.note-form { margin-top: 0.4rem; }
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.notes-head h2 { margin: 0; font-size: 1.35rem; }
ol.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.15rem 0.5rem;
  padding: 0.75rem 0.5rem 0.65rem 0.95rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.note-text {
  grid-column: 1;
  margin: 0;
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.3;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.note-meta { grid-column: 1; margin: 0; color: var(--muted); font-size: 0.8rem; }
.note-author { color: var(--ink); font-weight: 600; }
.note-delete { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.reactions button.small {
  min-height: 2.75rem;
  padding: 0 0.7rem;
  border: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}
.reactions button.small:hover { color: var(--danger); background: var(--hover); }
.reactions button.small .icon { width: 1.05rem; height: 1.05rem; }
.reactions button.small > span:not(.sr-only) { display: none; }
@media (min-width: 40rem) {
  .reactions button.small > span:not(.sr-only) { display: inline; }
}
.notes-empty { margin: 0; }

.note-form { display: grid; gap: 0.5rem; }
.note-form label { font-size: 0.85rem; }
.note-form textarea { resize: vertical; min-height: 4.5rem; line-height: 1.4; }
.note-form button { justify-self: start; }
.note-form button .icon { width: 1.1rem; height: 1.1rem; }
.note-hint { margin: 0; font-size: 0.8rem; }
.note-error { margin: 0; color: var(--danger); font-size: 0.9rem; }
[data-reactions] [aria-busy="true"] { opacity: 0.6; }

/* ---------- In the room viewer: a bar under the label, notes in a panel ---------- */
.room-viewer .reactions.compact {
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  gap: 0;
}
.room-viewer .reactions.compact .reactions-bar { justify-content: center; }
.room-viewer .reactions.compact .heart-line { font-size: 0.85rem; color: var(--muted); }
.notes-open {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
}
.notes-open:hover { color: var(--ink); background: var(--hover); text-decoration: none; }
.notes-open .icon { width: 1.2rem; height: 1.2rem; }
.notes-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  color: var(--ink);
}
.notes-close:hover { background: var(--hover); }
.reactions.compact .notes-sheet {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 0.85rem;
  align-content: start;
  max-height: min(78dvh, 40rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.75rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom));
  background: var(--wall);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -18px 40px -20px #00000059;
  text-align: left;
  animation: sheet-up 0.3s var(--ease) both;
}
@keyframes sheet-up { from { transform: translateY(1.5rem); opacity: 0; } }
@media (min-width: 48rem) {
  .reactions.compact .notes-sheet {
    left: auto;
    right: var(--gutter);
    bottom: var(--gutter);
    width: min(26rem, calc(100vw - 2 * var(--gutter)));
    border: 1px solid var(--line);
    border-radius: 18px;
    padding-bottom: 1.25rem;
  }
}

/* ---------- A heart count on cards ---------- */
span.heart-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0 0 0 0.55rem;
  vertical-align: baseline;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.heart-badge .icon { width: 0.85rem; height: 0.85rem; }
span.heart-badge > span { display: inline; margin: 0; font-size: inherit; color: inherit; }

/* ---------- The notifications page ---------- */
.notices .card { display: grid; gap: 0.85rem; margin-bottom: 1.5rem; }
.notices-state { margin: 0; }
.notices-state.on { display: flex; align-items: center; gap: 0.5rem; color: var(--ok); font-weight: 600; }
.notices-state.on[hidden] { display: none; }
.notices-state.error { color: var(--danger); }
.notices .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.notices .actions:not(:has(button:not([hidden]))) { display: none; }
.notices button.ink { background: var(--ink); color: var(--paper); border: 0; }
.notices button.ink:hover { background: color-mix(in srgb, var(--ink) 85%, var(--wall)); }
.notices button[aria-busy="true"] { opacity: 0.6; }
.notices-prefs { margin-bottom: 2rem; }
.notices-prefs .help { margin: 0; font-size: 0.85rem; }
.notices-privacy { max-width: 34rem; color: var(--muted); }
.notices-privacy h2 { color: var(--ink); font-size: 1.35rem; margin: 0 0 0.5rem; }
.notices-privacy p { margin: 0 0 0.75rem; }
