/* workspace/history/history-2.css: presentation styles for the compare section (labelled selects,
   summary, changed chapters, inline diffs) and the restore dialog. Loaded after history.css.
   Uses var(--token) from tokens.css only. */

/* ---- compare section: a card holding the controls and the result ---- */
.ws-history-compare-section {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; background: var(--card-bg);
  border: 1px solid var(--hairline); border-radius: 8px;
}
.ws-history-compare-section .ws-history-eyebrow { margin: 0; }
.ws-compare-controls { display: flex; flex-direction: column; gap: 6px; }
.ws-compare-field { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ws-compare-field-label { flex: none; width: 36px; font-size: 13px; color: var(--ink-soft); }
#ws-compare-from, #ws-compare-to { flex: 1 1 auto; width: 100%; min-width: 0; text-overflow: ellipsis; }
#ws-btn-compare { align-self: flex-end; min-width: 96px; }

/* ---- summary and result ---- */
.ws-compare-summary { padding-top: 8px; border-top: 1px solid var(--hairline); font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }
.ws-compare-summary[hidden], .ws-compare-view[hidden] { display: none; }
.ws-compare-view { display: flex; flex-direction: column; gap: 4px; }
.ws-compare-empty { margin: 0; font-size: 13px; color: var(--ink-faint); }
.ws-compare-structure { margin: 0 0 4px; padding: 0; list-style: none; }
.ws-compare-struct-row { padding: 2px 0 2px 14px; font-size: 13px; color: var(--ink-soft); text-indent: -14px; }
.ws-compare-struct-row::before { content: "\2022"; display: inline-block; width: 14px; text-indent: 0; color: var(--ink-faint); }
.ws-compare-chapter { padding: 8px 0 2px; border-top: 1px solid var(--hairline); }
.ws-compare-chapter-head { display: flex; flex-direction: column; }
.ws-compare-chapter-title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.ws-compare-chapter-status { font-size: 12px; color: var(--ink-faint); }
.ws-compare-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-left: -12px; }
.ws-compare-chapter-top { display: flex; align-items: center; gap: 6px; }
.ws-compare-chapter-top .ws-back { flex: none; margin-left: -12px; }
.ws-compare-chapter-top .ws-compare-chapter-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- hunks: the changed passage in the manuscript serif, insertions and deletions marked ---- */
.ws-hunk { padding: 8px 0 2px 12px; border-left: 2px solid var(--hairline-2); margin: 6px 0 2px; }
.ws-hunk-ins { border-left-color: var(--chip-high-fg); }
.ws-hunk-del { border-left-color: var(--caution-fg); }
.ws-hunk-head { margin-bottom: 4px; font-size: 12px; color: var(--ink-faint); }
.ws-hunk-inline { font: 15px/1.6 var(--font-serif); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.ws-hunk-seg-eq { color: var(--ink-soft); }
.ws-hunk-seg-plus { color: var(--chip-high-fg); background: var(--chip-high-bg); text-decoration: underline; text-decoration-color: var(--chip-high-fg); text-underline-offset: 3px; border-radius: 2px; }
.ws-hunk-seg-minus { color: var(--caution-fg); background: var(--caution-bg); text-decoration: line-through; border-radius: 2px; }
.ws-hunk > button { margin: 4px 0 0 -12px; }

/* ---- restore dialog: a small modal card ---- */
.ws-restore-dialog {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 20px 22px 18px; overflow: auto;
  font: 14px/1.5 var(--font-ui); color: var(--ink); background: var(--paper); border: 1px solid var(--hairline-2);
  border-radius: 10px; box-shadow: var(--shadow);
}
.ws-restore-dialog h3 { margin: 0 0 6px; font: 600 19px/1.25 var(--font-serif); }
.ws-restore-lede { margin: 0 0 14px; color: var(--ink-soft); overflow-wrap: anywhere; }
.ws-restore-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-soft); }
#ws-restore-scope {
  min-height: 44px; padding: 8px 10px; font: 15px var(--font-ui); color: var(--ink); background: var(--card-bg);
  border: 1px solid var(--hairline-2); border-radius: 6px;
}
.ws-restore-note { margin-top: 10px; padding: 6px 10px; font-size: 13px; color: var(--caution-fg); background: var(--caution-bg); border-radius: 6px; }
.ws-restore-note[hidden] { display: none; }
.ws-restore-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.ws-restore-dialog .ws-primary { color: var(--on-accent, var(--paper)); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.ws-restore-dialog .ws-primary:hover { color: var(--on-accent, var(--paper)); background: var(--accent); filter: brightness(.92); }
.ws-restore-dialog .ws-ghost { color: var(--accent-text); background: transparent; border-color: transparent; }
.ws-restore-dialog :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 760px) {
  #ws-restore-scope { font-size: 16px; }
  .ws-restore-actions button { flex: 1 1 auto; }
}
