/* topic_compare renderer: figure left, feature buttons + copy right. */

.tcw {
  --tcw-a: #7b3fb5;
  --tcw-b: #e8731a;
  --tcw-ink: #1c1b19;
  --tcw-muted: #6b6560;
  --tcw-line: #ddd6cc;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 20px 24px;
  align-items: start;
  color: var(--tcw-ink);
  text-align: left;
}

.tcw__head {
  grid-column: 1 / -1;
}

.tcw__title {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.tcw__description {
  margin: 0;
  color: var(--tcw-muted);
}

.tcw__figure {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--tcw-line);
  border-radius: 10px;
  background: #3d4f51;
}

.tcw__plot {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 80vh;
}

.tcw__decor,
.tcw__layer,
.tcw__overlay {
  position: absolute;
  inset: 0;
}

.tcw__decor,
.tcw__overlay {
  pointer-events: none;
}

.tcw__overlay {
  z-index: 3;
}

.tcw__tile {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  transform-origin: 0 0;
  transform: translate3d(var(--x, 0), var(--y, 0), 0) scale(var(--s, 1)) translate(-50%, -50%);
  transition: transform 0.9s cubic-bezier(0.22, 0.8, 0.24, 1);
}

.tcw.is-moving .tcw__tile {
  will-change: transform;
}

.tcw.is-instant .tcw__tile {
  transition: none;
}

.tcw__box {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tcw__tile--A .tcw__box {
  background: rgba(123, 63, 181, 0.4);
  box-shadow: inset 0 0 0 2px rgba(123, 63, 181, 0.9);
}

.tcw__tile--B .tcw__box {
  background: rgba(232, 115, 26, 0.4);
  box-shadow: inset 0 0 0 2px rgba(232, 115, 26, 0.9);
}

.tcw__tile.is-repeat .tcw__box {
  outline: 2px dashed rgba(28, 27, 25, 0.55);
  outline-offset: -4px;
}

.tcw__img {
  position: absolute;
  inset: 3px;
  background-image: var(--tcw-sprite);
  background-repeat: no-repeat;
  border-radius: 4px;
}

.tcw__tile:hover {
  z-index: 2;
}

.tcw__tile:hover .tcw__box,
.tcw__tile:focus-visible .tcw__box {
  transform: scale(var(--hs, 3));
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.tcw__baseline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--tcw-line);
}

.tcw__cat {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--tcw-muted);
}

.tcw__cat.is-tilted {
  transform: rotate(-40deg);
  transform-origin: 100% 0;
}

.tcw__share {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  font-family: "Economica", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.tcw__share.is-compact {
  padding: 1px 5px;
  font-size: 0.8rem;
}

.tcw__share--A {
  background: var(--tcw-a);
}

.tcw__share--B {
  background: var(--tcw-b);
}

.tcw__zero {
  position: absolute;
  background: var(--tcw-line);
}

.tcw__zero--x {
  top: 0;
  bottom: 0;
  width: 1px;
}

.tcw__zero--y {
  left: 0;
  right: 0;
  height: 1px;
}

.tcw__axis {
  position: absolute;
  font-family: "Economica", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--tcw-accent, #FC851D);
  white-space: nowrap;
  line-height: 1;
}

.tcw__axis--x-min {
  left: 22px;
  bottom: 2px;
}

.tcw__axis--x-max {
  right: 0;
  bottom: 2px;
}

.tcw__axis--y-min,
.tcw__axis--y-max {
  left: 2px;
}

.tcw__axis--y-min {
  bottom: 22px;
}

.tcw__axis--y-max {
  top: 2px;
}

.tcw__mean {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 3px 10px;
  border: 2px solid #fff;
  border-radius: 10px;
  color: #fff;
  font-family: "Economica", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.tcw__mean--A {
  background: var(--tcw-a);
}

.tcw__mean--B {
  background: var(--tcw-b);
}

.tcw__side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tcw__buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tcw__button {
  appearance: none;
  padding: 10px 14px;
  border: 2px solid #5e7478;
  border-radius: 12px;
  background: #3d4f51;
  color: #ffffff;
  font-family: "Economica", sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.tcw__button:hover {
  border-color: #FC851D;
}

.tcw__button.is-active {
  background: #FC851D;
  border-color: #FC851D;
  color: #2e3d3f;
}

.tcw__copy-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  line-height: 1.3;
}

.tcw__copy-text {
  margin: 0 0 10px;
  line-height: 1.55;
}

.tcw__empty {
  margin: 0;
  color: var(--tcw-muted);
}

@media (max-width: 900px) {
  .tcw {
    grid-template-columns: minmax(0, 1fr);
  }
}

section.topic-compare {
  --tcw-a: #7b3fb5;
  --tcw-b: #e8731a;
  --tcw-accent: #FC851D;
  --tcw-line: #5e7478;
  --tcw-panel: #2e3d3f;
  margin: 28px 0;
  padding: 22px 20px 24px;
  box-sizing: border-box;
  border: 2px solid var(--tcw-line);
  border-radius: 18px;
  background-color: var(--tcw-panel);
  color: #ffffff;
  font-family: "Fira Sans", sans-serif;
}

section.topic-compare .tcw {
  color: #ffffff;
}

section.topic-compare .tcw__title {
  font-family: "Mouse Memoirs", sans-serif;
  color: var(--tcw-accent);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

section.topic-compare .tcw__description,
section.topic-compare .tcw__copy-text,
section.topic-compare .tcw__empty {
  font-family: "Fira Sans", sans-serif;
  font-size: 18px;
  font-weight: 200;
  line-height: 1.45;
  color: #ffffff;
}

section.topic-compare .tcw__cat {
  font-family: "Economica", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}

section.topic-compare .tcw__copy-title {
  font-family: "Mouse Memoirs", sans-serif;
  color: var(--tcw-accent);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.15;
}

section.topic-compare .tcw__figure {
  color: #ffffff;
  border: 2px solid var(--tcw-line);
}

section.topic-compare .tcw__zero,
section.topic-compare .tcw__baseline {
  background: rgba(255, 255, 255, 0.28);
}
