/* public/css/components/history-review.css
 * HistoryReview: the one-time history review page (#694, U11 of #574, REQ-0008).
 * Approved mockup: docs/design/mockups/claude-history-review-574.html (variant B: swipe plus
 * Keep/Trash buttons, Undo, progress, the next card peeking). The hr-* rules below are lifted
 * from the mockup; the overlay shell, scrolling, motion and error line are additions the
 * mockup's static frames do not need. Canopy v2: --v2-* tokens only.
 * Overlay sits at z-index 1150, like PhotoCompare: above sheets (1000).
 */

/* ── Overlay shell + resets (the SPA button defaults do not apply here) ── */
.hr-overlay { position: fixed; inset: 0; z-index: 1150; display: none; overflow: hidden; overscroll-behavior: contain; background: var(--v2-bg-primary); color: var(--v2-text-primary); font-family: var(--v2-font-body); }
.hr-overlay.is-open { display: block; }
.hr-overlay:focus { outline: none; }
.hr-overlay *, .hr-overlay *::before, .hr-overlay *::after { box-sizing: border-box; }
:where(.hr-overlay) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
:where(.hr-overlay) :where(h2, h3, p) { margin: 0; }
.hr-screen { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; position: relative; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); background: var(--v2-bg-primary); }

/* ── Top row: Back, "12 of 140", Undo; the progress bar under them ── */
.hr-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px var(--v2-space-md) 0; min-height: 58px; }
.hr-back { justify-self: start; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; min-width: 44px; padding: 0 10px 0 4px; border-radius: var(--v2-radius-full); color: var(--v2-text-secondary); font-size: 14px; font-weight: 600; }
.hr-back svg { width: 20px; height: 20px; }
.hr-undo { justify-self: end; min-height: 44px; min-width: 44px; padding: 0 6px; font-size: 14px; font-weight: 600; color: var(--v2-accent-botanical); }
.hr-undo[disabled] { color: var(--v2-text-tertiary); opacity: .5; cursor: default; }
.hr-back:focus-visible, .hr-undo:focus-visible, .hr-btn:focus-visible, .hr-start:focus-visible, .hr-done:focus-visible { outline: 2px solid var(--v2-accent-botanical); outline-offset: 2px; }
.hr-count { font-size: 14px; font-weight: 600; color: var(--v2-text-secondary); font-variant-numeric: tabular-nums; }
.hr-count b { color: var(--v2-text-primary); font-weight: 700; }
.hr-bar { margin: 0 var(--v2-space-md); height: 4px; border-radius: var(--v2-radius-full); background: var(--v2-border-soft); overflow: hidden; }
.hr-bar > i { display: block; height: 100%; background: var(--v2-accent-botanical); border-radius: inherit; transition: width var(--v2-transition-base) var(--v2-ease-out); }

/* ── The card stack ── */
.hr-stage { flex: 1; display: flex; flex-direction: column; padding: var(--v2-space-md); min-height: 0; position: relative; }
.hr-card { flex: 1; display: flex; flex-direction: column; background: var(--v2-bg-card); border: 1px solid var(--v2-border-soft); border-radius: var(--v2-radius-xl); box-shadow: var(--v2-elev-1); overflow: hidden; min-height: 0; position: relative; z-index: 1; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
/* the next card peeks out underneath, so it reads as a stack you work through */
.hr-under { position: absolute; left: calc(var(--v2-space-md) + 10px); right: calc(var(--v2-space-md) + 10px); bottom: 6px; height: 40px; border-radius: var(--v2-radius-xl); background: var(--v2-bg-card); border: 1px solid var(--v2-border-soft); }
.hr-media { height: 230px; flex: none; position: relative; background-color: var(--v2-bg-secondary); background-size: cover; background-position: center; }
.hr-media--bed, .hr-media--plant { height: 150px; display: flex; align-items: center; justify-content: center; background: var(--v2-bg-secondary); color: var(--v2-text-tertiary); }
.hr-media--bed svg, .hr-media--plant svg { width: 56px; height: 56px; }
.hr-body { padding: var(--v2-space-md) var(--v2-space-md) var(--v2-space-sm); display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.hr-body--top { padding-top: 22px; }
.hr-kind { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--v2-text-tertiary); }
.hr-name { font-family: var(--v2-font-display); font-weight: 700; font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; margin-top: -6px; overflow-wrap: anywhere; }
.hr-note { font-size: 19px; line-height: 1.4; font-weight: 500; color: var(--v2-text-primary); overflow-wrap: anywhere; }
.hr-from { margin-top: auto; font-size: 13px; font-weight: 600; color: var(--v2-text-tertiary); }
.hr-flag { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.35; font-weight: 600; color: var(--v2-pop-slate-text); background: var(--v2-pop-slate-bg); border-radius: var(--v2-radius-md); padding: 10px 12px; }
.hr-flag svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.hr-wait { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--v2-space-lg); text-align: center; font-size: 15px; font-weight: 600; color: var(--v2-text-tertiary); }

/* ── Under the card: the hint, the two buttons, the stop line ── */
.hr-hint { display: flex; justify-content: space-between; padding: 0 var(--v2-space-lg) 10px; font-size: 13px; font-weight: 600; color: var(--v2-text-secondary); }
.hr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 var(--v2-space-md) var(--v2-space-sm); }
.hr-btn { height: 56px; border-radius: var(--v2-radius-lg); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 17px; font-weight: 700; transition: box-shadow var(--v2-transition-fast) var(--v2-ease-out); }
.hr-btn svg { width: 22px; height: 22px; }
.hr-btn--keep { background: var(--v2-accent-botanical); color: var(--v2-text-on-accent); }
.hr-btn--trash { background: var(--v2-pop-coral-bg); color: var(--v2-pop-coral-text); border: 1.5px solid var(--v2-pop-coral-muted); }
.hr-btn[disabled] { opacity: .5; cursor: default; }
.hr-stop { text-align: center; font-size: 13px; line-height: 1.35; color: var(--v2-text-tertiary); padding: 0 var(--v2-space-lg) calc(var(--v2-space-md) + 6px); }
.hr-error { text-align: center; font-size: 13px; line-height: 1.35; font-weight: 600; color: var(--v2-pop-coral-text); padding: 0 var(--v2-space-lg) calc(var(--v2-space-md) + 6px); }

/* ── Mid-swipe: the card follows the finger; the stamp fades in with distance ── */
.hr-card--drag { box-shadow: var(--v2-elev-3); }
.hr-card--spring { transition: transform var(--v2-transition-base) var(--v2-ease-spring); }
.hr-stamp { z-index: 2; position: absolute; top: 18px; padding: 6px 12px; border: 3px solid; border-radius: var(--v2-radius-md); font-size: 20px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; background: var(--v2-bg-card); opacity: 0; pointer-events: none; }
.hr-stamp--keep { left: 16px; color: var(--v2-pop-sage); border-color: var(--v2-pop-sage); transform: rotate(-8deg); }
.hr-stamp--trash { right: 16px; color: var(--v2-pop-coral-text); border-color: var(--v2-pop-coral-text); transform: rotate(8deg); }
.hr-btn--keep.hr-btn--lit { box-shadow: 0 0 0 3px var(--v2-pop-sage-bg); }
.hr-btn--trash.hr-btn--lit { box-shadow: 0 0 0 3px var(--v2-pop-coral-muted); }
/* a decided card flies off the side it went; purely decorative, the next card is already in place */
.hr-card--ghost { position: absolute; inset: var(--v2-space-md); z-index: 3; pointer-events: none; animation: hr-fly var(--v2-transition-base) var(--v2-ease-exit) forwards; }
.hr-card--ghost.hr-card--out-keep { --hr-fly-x: 130%; --hr-fly-r: 14deg; }
.hr-card--ghost.hr-card--out-trash { --hr-fly-x: -130%; --hr-fly-r: -14deg; }
@keyframes hr-fly { to { transform: translateX(var(--hr-fly-x)) rotate(var(--hr-fly-r)); opacity: 0; } }

/* ── Opening and finished pages ── */
.hr-page { flex: 1; display: flex; flex-direction: column; padding: 56px var(--v2-space-lg) var(--v2-space-lg); gap: var(--v2-space-md); min-height: 0; overflow-y: auto; }
.hr-top + .hr-page { padding-top: 0; }
.hr-page h2 { font-family: var(--v2-font-display); font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.hr-lead { font-size: 18px; line-height: 1.4; color: var(--v2-text-secondary); }
.hr-facts { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.hr-facts li { display: flex; gap: 12px; font-size: 17px; line-height: 1.35; }
.hr-facts svg { width: 24px; height: 24px; flex: none; color: var(--v2-accent-botanical); margin-top: 1px; }
.hr-start { margin-top: auto; height: 60px; border-radius: var(--v2-radius-lg); background: var(--v2-accent-botanical); color: var(--v2-text-on-accent); font-size: 19px; font-weight: 700; width: 100%; flex: none; }
.hr-sub { text-align: center; font-size: 13px; color: var(--v2-text-tertiary); }
.hr-tally { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
.hr-tally div { border-radius: var(--v2-radius-lg); padding: 18px 16px; display: flex; flex-direction: column; gap: 2px; }
.hr-tally b { font-size: 44px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.hr-tally span { font-size: 15px; font-weight: 600; }
.hr-tally .hr-tally-keep { background: var(--v2-pop-sage-bg); color: var(--v2-pop-sage); }
.hr-tally .hr-tally-trash { background: var(--v2-pop-coral-bg); color: var(--v2-pop-coral-text); }
.hr-done { height: 56px; border-radius: var(--v2-radius-lg); background: var(--v2-bg-card); border: 1.5px solid var(--v2-border-strong); font-size: 17px; font-weight: 700; width: 100%; margin-top: auto; flex: none; }
.hr-page .hr-error { padding: 0; }

@media (prefers-reduced-motion: reduce) {
  .hr-bar > i, .hr-btn, .hr-card--spring { transition: none; }
  .hr-card--ghost { display: none; }
}
