/* ---------------- Shared vocabulary highlighter ---------------- */

.vocab-demo {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.vocab-toggle {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
  margin-bottom: 16px;
}
.vocab-toggle:hover { border-color: var(--accent); }
.vocab-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-wash);
}

.vocab-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 640px) {
  .vocab-block { grid-template-columns: 1fr; }
}

.vocab-col {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.vocab-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.vocab-col p { margin: 0; font-size: 0.95rem; }

.shared-term {
  border-radius: 3px;
  padding: 0 2px;
  transition: background 0.25s ease, color 0.25s ease;
}
.vocab-block.active .shared-term {
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 600;
}

.vocab-caption { margin-top: 12px; margin-bottom: 0; font-size: 0.85rem; }

/* ---------------- Before / after comparison slider ---------------- */

.compare-slider {
  position: relative;
  height: 230px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 20px 0 8px;
  cursor: ew-resize;
  user-select: none;
}

/* "after" is the full base layer, always fully visible underneath.
   "before" lives inside .compare-reveal, an overflow:hidden wrapper whose
   width tracks the handle — its inner panel is pinned to a fixed pixel
   width matching the slider itself, so content never restyles or
   re-centers as the wrapper narrows, it's simply not painted past the
   wrapper's edge. This physically stops rendering outside the box rather
   than relying on a clip shape lining up with centered content, which is
   what caused the two panels' text to overlap before. */

.compare-base {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  background: linear-gradient(135deg, #2a2419, #221d15);
}

.compare-reveal {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50%;
  overflow: hidden;
  z-index: 2;
}

.compare-reveal-inner {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  box-sizing: border-box;
  background: linear-gradient(135deg, #2e1a14, #23140f);
  /* width is set in JS to match the slider's own pixel width, so this
     panel's centered content stays in a fixed position relative to the
     slider regardless of how narrow .compare-reveal itself gets */
}

.stamp-wrap-static { width: 150px; height: 92px; }
.stamp-wrap-static .stamp-mark { width: 100%; height: 100%; opacity: 1; transform: rotate(-6deg); }

.compare-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.compare-confidence {
  font-size: 0.85rem;
  color: var(--text);
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  z-index: 5;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(193, 68, 45, 0.6);
  transform: translateX(-1.5px);
  cursor: ew-resize;
}
.compare-handle:focus-visible { outline: none; }
.compare-handle:focus-visible .compare-handle-grip {
  box-shadow: 0 0 0 4px var(--accent-wash), 0 2px 10px rgba(0, 0, 0, 0.35);
}
.compare-handle-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  border: 2px solid var(--paper);
  animation: handleHint 1.8s ease-in-out 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
.compare-handle:hover .compare-handle-grip,
.compare-handle:focus-visible .compare-handle-grip {
  transform: translate(-50%, -50%) scale(1.1);
}

/* A brief, one-time wiggle so the handle reads as draggable rather than
   decorative — otherwise a thin vertical line easily gets missed. */
@keyframes handleHint {
  0%, 100% { transform: translate(-50%, -50%) translateX(0); }
  25% { transform: translate(-50%, -50%) translateX(-10px); }
  75% { transform: translate(-50%, -50%) translateX(10px); }
}
@media (prefers-reduced-motion: reduce) {
  .compare-handle-grip { animation: none; }
}

@media (max-width: 640px) {
  .compare-slider { height: 300px; }
}
