/* Pinch: meet chapters. Reactions table and the three-way Venn. */

/* ---------- shared bits ---------- */
.rx-chip {
  display: inline-block; font-size: 13px; font-weight: 600; line-height: 1;
  padding: 6px 10px; border-radius: 999px; background: var(--el); color: var(--on-el);
}
.rx-x { font-family: var(--f-mono); color: var(--ink-3); font-size: 13px; }
.rx-pair { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rx-k {
  display: block; font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 4px;
}
.chip .chip-n { font-family: var(--f-mono); font-size: 11px; opacity: .65; margin-left: 7px; }
.needs {
  font-family: var(--f-mono); font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 4px 8px; border-radius: 6px; border: 1.5px dashed currentColor; margin-left: 6px;
}
.needs-heat { color: var(--heat); }
.needs-time { color: var(--ink-2); }

/* ---------- reactions table ---------- */
.rx-lab { padding-left: 8px; padding-right: 8px; }
.rx-lab > .lab-tag, .rx-lab > h3, .rx-lab > .hint, .rx-lab > .chips, .rx-lab > .note { margin-left: 8px; margin-right: 8px; }
.rx-lab > .lab-tag { margin-left: 8px; }
@media (min-width: 720px) {
  .rx-lab { padding-left: 28px; padding-right: 28px; }
  .rx-lab > .lab-tag, .rx-lab > h3, .rx-lab > .hint, .rx-lab > .chips, .rx-lab > .note { margin-left: 0; margin-right: 0; }
}
.rx-lab > .chips { margin-bottom: 14px; }
.rx-scroll { overflow-x: auto; max-width: 100%; padding: 4px 0 8px; }
.rx-grid {
  display: grid; grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 1px; width: 100%; min-width: 324px; max-width: 640px;
}
@media (min-width: 720px) { .rx-grid { gap: 3px; } }
.rx-corner, .rx-void { aspect-ratio: 1; }
.rx-h {
  aspect-ratio: 1; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); border-bottom: 2px solid var(--el);
  border-radius: 6px; transition: background .18s, transform .18s;
}
.rx-h b {
  font-family: var(--f-display); font-weight: 750; font-size: 11px; letter-spacing: -.02em;
  color: color-mix(in srgb, var(--el) 78%, var(--ink));
  font-variation-settings: "SOFT" 100;
}
@media (min-width: 720px) { .rx-h b { font-size: 15px; } .rx-h { border-radius: 8px; } }
.rx-h.on { background: var(--el); transform: scale(1.08); }
.rx-h.on b { color: var(--on-el); }

.rx-cell, .rx-dot { aspect-ratio: 1; position: relative; min-width: 0; }
.rx-cell {
  border: 0; padding: 0; cursor: pointer; border-radius: 6px;
  background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
  transition: transform .22s cubic-bezier(.3,1.6,.5,1), opacity .2s, filter .2s;
}
.rx-cell.self { background: var(--a); }
.rx-cell.self::after {
  content: ""; position: absolute; inset: 27%; border-radius: 50%;
  border: 2px solid var(--card); opacity: .9;
}
@media (min-width: 720px) { .rx-cell { border-radius: 9px; } }
.rx-cell:hover { transform: scale(1.18) rotate(-4deg); z-index: 3; }
.rx-cell:active { transform: scale(.94); }
.rx-cell:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; z-index: 3; }
.rx-cell[aria-pressed="true"] { outline: 2.5px solid var(--ink); outline-offset: 1.5px; transform: scale(1.12); z-index: 2; }
.rx-cell.dim { opacity: .14; filter: saturate(.4); }
.rx-dot::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px;
  border-radius: 50%; background: var(--ink); opacity: .16;
}
#rx-count { margin: 6px 8px 0; }
@media (min-width: 720px) { #rx-count { margin: 8px 0 0; } }

.rx-card {
  position: relative; overflow: hidden; margin: 18px 8px 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 16px 18px;
}
@media (min-width: 720px) { .rx-card { margin: 20px 0 0; padding: 26px 24px 22px; } }
.rx-bar { position: absolute; left: 0; right: 0; top: 0; height: 7px; background: linear-gradient(90deg, var(--a) 50%, var(--b) 50%); }
.rx-top { margin-bottom: 14px; }
.rx-top h4 {
  font-family: var(--f-display); font-weight: 720; font-size: clamp(26px, 5vw, 36px);
  letter-spacing: -.02em; line-height: 1.05; margin: 0 0 10px; font-variation-settings: "SOFT" 100;
}
.rx-cols { display: grid; gap: 14px; }
@media (min-width: 860px) { .rx-cols { grid-template-columns: repeat(3, 1fr); gap: 26px; } }
.rx-cols p { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.rx-card.pop { animation: rx-pop .3s cubic-bezier(.3,1.4,.5,1); }
@keyframes rx-pop { from { opacity: .4; transform: translateY(8px); } }

/* ---------- three-way Venn ---------- */
#venn-lab > .chips { margin-bottom: 10px; }
#venn-pick { margin-top: 4px; }
.venn-stage { max-width: 520px; margin: 6px auto 14px; }
.venn-svg { display: block; width: 100%; height: auto; isolation: isolate; overflow: visible; }
.venn-c { cursor: pointer; mix-blend-mode: multiply; }
.venn-c circle {
  fill: var(--c, transparent); fill-opacity: .38;
  stroke: var(--c, var(--ink-3)); stroke-width: 2.5; stroke-linejoin: round;
  transition: fill .35s, stroke .35s, fill-opacity .35s;
}
.venn-c:hover circle { fill-opacity: .5; }
.venn-c.empty { cursor: default; }
.venn-c.empty circle { fill-opacity: 0; stroke: var(--ink-3); stroke-opacity: .6; stroke-dasharray: 6 7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .venn-c { mix-blend-mode: screen; } }
:root[data-theme="dark"] .venn-c { mix-blend-mode: screen; }

.venn-name { font-family: var(--f-display); font-weight: 720; font-size: 21px; fill: var(--ink); letter-spacing: -.01em; pointer-events: none; font-variation-settings: "SOFT" 100; }
.venn-name.ghost { fill: var(--ink-3); font-weight: 500; font-size: 16px; }
.venn-lens { font-family: var(--f-mono); font-size: 10px; font-weight: 600; fill: var(--ink); pointer-events: none; }
.venn-lens.none { fill: var(--ink-2); font-weight: 500; opacity: .75; }
.venn-core { fill: var(--card); fill-opacity: 0; stroke: var(--ink); stroke-width: 2; stroke-opacity: 0; transition: fill-opacity .3s, stroke-opacity .3s; pointer-events: none; }
.venn-core.soft { fill-opacity: .72; }
.venn-core.lit { fill-opacity: .92; stroke-opacity: .85; }
.venn-mid { font-family: var(--f-display); text-anchor: middle; pointer-events: none; transform-box: fill-box; transform-origin: center; }
.venn-mid.hit { font-weight: 760; font-size: 17px; fill: var(--ink); font-variation-settings: "SOFT" 100; }
.venn-mid.miss { font-weight: 500; font-style: italic; font-size: 13px; fill: var(--ink-2); }
.venn-mid.pop { animation: venn-pop .4s cubic-bezier(.3,1.6,.5,1); }
@keyframes venn-pop { from { opacity: 0; transform: scale(.7); } }

#venn-pick .chip.el::before {
  content: ""; display: inline-block; width: .7em; height: .7em; border-radius: 50%;
  background: var(--el); margin-right: 7px; vertical-align: -1px;
}
#venn-pick .chip.el[aria-pressed="true"]::before { background: var(--on-el); }

.venn-result {
  margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; min-height: 96px;
}
.venn-result .rx-pair { margin-bottom: 10px; }
.venn-result h4 { font-family: var(--f-display); font-weight: 720; font-size: clamp(24px, 4.4vw, 30px); letter-spacing: -.02em; margin: 0 0 6px; font-variation-settings: "SOFT" 100; }
.venn-result p { margin: 0 0 10px; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.venn-result .vr-lead { color: var(--ink); font-weight: 600; }
.vr-pairs { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14.5px; }
.vr-pairs span { color: var(--ink-2); }
.vr-pairs span::before { content: "· "; color: var(--ink-3); }

.next-line {
  font-family: var(--f-display); font-style: italic; font-size: clamp(18px, 2.4vw, 22px);
  color: var(--ink-2); margin: 8px 0 0; max-width: 34em;
}

@media (prefers-reduced-motion: reduce) {
  .rx-cell, .rx-h, .venn-c circle, .venn-core { transition: none; }
  .rx-card.pop, .venn-mid.pop { animation: none; }
}
