/* ═══════════════════════════════════════════════════════════════════════════
   css/reading-revision.css — styles for js/reading-revision-compare.js
   (lane cc-impl-1 F3, 2026-10-10).

   WHAT   The "Compare" button state, the compare panel, its legend, and the
          two-colour canvas laid over the page inside the plan viewer.
   FLAG   reading_revision_compare_enabled. With the flag off the script creates
          no element, so no rule here matches anything: every selector is
          prefixed .rdg-rev- and nothing existing is restyled.
   USED BY js/reading-revision-compare.js only.

   THEMES The plan viewer is dark by default and light when <html> carries the
          class `light` (it is a class, not a data attribute). Surfaces come
          from the --rdg-rev-* variables below, set once per theme.

   COLOURS The three compare colours are FIXED, not themed, and are the same
          values as probe/reading/readgraph/revoverlay.py and the canvas:
              only in OLD   red   #dc2626  rgb(220, 38, 38)
              only in NEW   blue  #2563eb  rgb( 37, 99,235)
              in both       grey  #787878  rgb(120,120,120)
          They are not taken from --blue / --primary, which are teal in this
          app. Red against blue stays separable for red-green colour-blind
          readers (it is red against green that does not); the legend also
          names each colour in words.
   ═══════════════════════════════════════════════════════════════════════════ */

.rdg-rev-panel,
.rdg-rev-canvas {
  --rdg-rev-old: #dc2626;
  --rdg-rev-new: #2563eb;
  --rdg-rev-same: #787878;
}

.rdg-rev-panel {
  --rdg-rev-bg: #1a1a1a;
  --rdg-rev-fg: #e0e0e0;
  --rdg-rev-muted: #999;
  --rdg-rev-line: #333;
  --rdg-rev-raise: #242424;
  --rdg-rev-raise-hover: #2e2e2e;
  --rdg-rev-on-bg: #e0e0e0;
  --rdg-rev-on-fg: #141414;
  --rdg-rev-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

.light .rdg-rev-panel {
  --rdg-rev-bg: #fff;
  --rdg-rev-fg: #333;
  --rdg-rev-muted: #666;
  --rdg-rev-line: #ddd;
  --rdg-rev-raise: #f3f3f3;
  --rdg-rev-raise-hover: #e6e6e6;
  --rdg-rev-on-bg: #333;
  --rdg-rev-on-fg: #fff;
  --rdg-rev-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

/* ═══ CANVAS — exactly over the page image, inside the zoom/pan wrapper ═══ */
.rdg-rev-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;      /* pan, zoom and drawing still reach the wrapper */
  background: #fff;
}

/* ═══ TOOLBAR BUTTON (also carries .pmv-btn) ═══ */
.rdg-rev-btn[aria-pressed="true"] {
  border-color: var(--rdg-rev-new, #2563eb);
  box-shadow: inset 0 -2px 0 var(--rdg-rev-old, #dc2626);
}

/* ═══ PANEL ═══ */
.rdg-rev-panel {
  position: absolute;
  top: 50px;
  right: 12px;
  z-index: 20;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: calc(100% - 62px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 12px;
  background: var(--rdg-rev-bg);
  color: var(--rdg-rev-fg);
  border: 1px solid var(--rdg-rev-line);
  border-radius: var(--radius, 10px);
  box-shadow: var(--rdg-rev-shadow);
  font-family: var(--font, 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  font-size: 12.5px;
  line-height: 1.45;
}

.rdg-rev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rdg-rev-title {
  font-size: 13px;
  font-weight: 700;
}

.rdg-rev-x {
  background: none;
  border: 0;
  color: var(--rdg-rev-muted);
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 6px;
}
.rdg-rev-x:hover { background: var(--rdg-rev-raise-hover); color: var(--rdg-rev-fg); }

/* Mode switch: Both / Old only / New only / Off */
.rdg-rev-modes {
  display: flex;
  border: 1px solid var(--rdg-rev-line);
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
  margin-bottom: 10px;
}

.rdg-rev-mode {
  flex: 1;
  background: var(--rdg-rev-raise);
  color: var(--rdg-rev-fg);
  border: 0;
  border-right: 1px solid var(--rdg-rev-line);
  padding: 6px 4px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.rdg-rev-mode:last-child { border-right: 0; }
.rdg-rev-mode:hover:not(:disabled) { background: var(--rdg-rev-raise-hover); }
.rdg-rev-mode:disabled { color: var(--rdg-rev-muted); cursor: default; opacity: .6; }
.rdg-rev-mode.rdg-rev-on {
  background: var(--rdg-rev-on-bg);
  color: var(--rdg-rev-on-fg);
}

/* Legend */
.rdg-rev-legend {
  border: 1px solid var(--rdg-rev-line);
  border-radius: var(--radius-sm, 8px);
  padding: 8px;
  margin-bottom: 10px;
}

.rdg-rev-legend-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 5px;
}

.rdg-rev-swatch {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  border-radius: 3px;
  border: 1px solid rgba(128, 128, 128, .5);
}
.rdg-rev-swatch-old { background: var(--rdg-rev-old); }
.rdg-rev-swatch-new { background: var(--rdg-rev-new); }
.rdg-rev-swatch-same { background: var(--rdg-rev-same); }

.rdg-rev-legend-text { overflow-wrap: anywhere; }

.rdg-rev-swap {
  margin-top: 4px;
  background: var(--rdg-rev-raise);
  color: var(--rdg-rev-fg);
  border: 1px solid var(--rdg-rev-line);
  border-radius: 6px;
  padding: 4px 10px;
  font: inherit;
  cursor: pointer;
}
.rdg-rev-swap:hover { background: var(--rdg-rev-raise-hover); }

/* Status: what was compared, what share differs, or why nothing is drawn */
.rdg-rev-status {
  margin-bottom: 10px;
  padding: 8px;
  background: var(--rdg-rev-raise);
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font-mono, 'JetBrains Mono', 'SF Mono', Consolas, monospace);
  font-size: 11.5px;
}
.rdg-rev-status-line + .rdg-rev-status-line { margin-top: 4px; }
.rdg-rev-busy { opacity: .75; }

.rdg-rev-label {
  font-weight: 700;
  margin-bottom: 2px;
}

.rdg-rev-note {
  color: var(--rdg-rev-muted);
  font-size: 11.5px;
  margin-bottom: 6px;
}

/* Bid list */
.rdg-rev-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--rdg-rev-line);
  border-radius: var(--radius-sm, 8px);
  margin-bottom: 10px;
}
.rdg-rev-list > .rdg-rev-note { padding: 8px; margin: 0; }

.rdg-rev-bid {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  color: var(--rdg-rev-fg);
  border: 0;
  border-bottom: 1px solid var(--rdg-rev-line);
  padding: 7px 8px;
  font: inherit;
  cursor: pointer;
}
.rdg-rev-bid:last-child { border-bottom: 0; }
.rdg-rev-bid:hover { background: var(--rdg-rev-raise-hover); }
.rdg-rev-bid.rdg-rev-on {
  background: var(--rdg-rev-raise);
  box-shadow: inset 3px 0 0 var(--rdg-rev-fg);
}

.rdg-rev-bid-name {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rdg-rev-bid-meta {
  display: block;
  color: var(--rdg-rev-muted);
  font-family: var(--font-mono, 'JetBrains Mono', 'SF Mono', Consolas, monospace);
  font-size: 10.5px;
}

/* Honest limits, always printed */
.rdg-rev-limits {
  color: var(--rdg-rev-muted);
  font-size: 10.5px;
  line-height: 1.4;
  border-top: 1px solid var(--rdg-rev-line);
  padding-top: 8px;
}

.rdg-rev-panel button:focus-visible,
.rdg-rev-btn:focus-visible {
  outline: 2px solid var(--rdg-rev-new, #2563eb);
  outline-offset: 1px;
}
