/* Leaver Report: change-control ledger. Loaded after the template stylesheet. */

:root {
  color-scheme: light;
  --lr-bg: #f4f5f2;
  --lr-surface: #ffffff;
  --lr-raised: #fbfbf9;
  --lr-text: #1b2026;
  --lr-muted: #4a5360;
  --lr-border: #7b8591;
  --lr-hairline: #d9dde2;
  --lr-accent: #1d4f91;
  --lr-accent-hover: #173f75;
  --lr-accent-active: #11315c;
  --lr-on-accent: #ffffff;
  --lr-accent-soft: #e7eef8;
  --lr-success: #1f6b45;
  --lr-success-soft: #e6f2eb;
  --lr-warning: #8a5300;
  --lr-warning-soft: #fbf0dc;
  --lr-danger: #a3302b;
  --lr-danger-soft: #fbe9e7;
  --lr-skeleton: #e3e6ea;
  --lr-focus: #1d4f91;

  --lr-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --lr-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --lr-type-xs: 0.8125rem;
  --lr-type-sm: 0.9375rem;
  --lr-type-body: 1.0625rem;
  --lr-type-lead: 1.1875rem;
  --lr-type-h2: 1.5rem;
  --lr-type-display: 2.25rem;
  --lr-type-title: 2.75rem;

  --lr-space-1: 4px;
  --lr-space-2: 8px;
  --lr-space-3: 12px;
  --lr-space-4: 16px;
  --lr-space-5: 24px;
  --lr-space-6: 32px;
  --lr-space-7: 48px;
  --lr-space-8: 64px;

  --lr-radius-sm: 6px;
  --lr-radius: 10px;
  --lr-radius-lg: 16px;

  --lr-shadow: 0 1px 2px rgb(27 32 38 / 6%), 0 2px 8px rgb(27 32 38 / 5%);
  --lr-shadow-raised: 0 2px 4px rgb(27 32 38 / 6%), 0 14px 36px rgb(27 32 38 / 10%);

  --lr-gutter: 28px;
  --lr-motion: 170ms;
  --lr-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --lr-bg: #12161b;
    --lr-surface: #1a2028;
    --lr-raised: #212934;
    --lr-text: #e9edf2;
    --lr-muted: #aeb7c3;
    --lr-border: #6b7684;
    --lr-hairline: #2f3845;
    --lr-accent: #8fb8f0;
    --lr-accent-hover: #a9c9f4;
    --lr-accent-active: #7aa6e2;
    --lr-on-accent: #0d1b2e;
    --lr-accent-soft: #1f2a3a;
    --lr-success: #8fd6ad;
    --lr-success-soft: #183026;
    --lr-warning: #f0c27a;
    --lr-warning-soft: #342a17;
    --lr-danger: #f5a39b;
    --lr-danger-soft: #3a2220;
    --lr-skeleton: #2a333f;
    --lr-focus: #a9c9f4;
    --lr-shadow: 0 1px 2px rgb(0 0 0 / 30%);
    --lr-shadow-raised: 0 2px 4px rgb(0 0 0 / 30%), 0 14px 36px rgb(0 0 0 / 35%);
  }
}

/* ---------- Base ---------- */

html { background: var(--lr-bg); }

body {
  margin: 0;
  background: var(--lr-bg);
  color: var(--lr-text);
  font: var(--lr-type-body)/1.55 var(--lr-font);
  -webkit-font-smoothing: antialiased;
}

.lr-page {
  box-sizing: border-box;
  width: min(100%, 64rem);
  margin-inline: auto;
  padding: var(--lr-space-7) var(--lr-space-6) var(--lr-space-8);
}

.lr-page *, .lr-page *::before, .lr-page *::after { box-sizing: border-box; }

.lr-page h1, .lr-page h2, .lr-page h3, .lr-page h4, .lr-page p,
.lr-page ul, .lr-page ol, .lr-page dl, .lr-page dd, .lr-page pre { margin: 0; }

.lr-page h1 {
  font-size: var(--lr-type-title);
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.lr-page h2 { font-size: var(--lr-type-h2); line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
.lr-page h3 { font-size: var(--lr-type-lead); line-height: 1.3; font-weight: 700; }
.lr-page h4 {
  font-size: var(--lr-type-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lr-muted { color: var(--lr-muted); }

.lr-id, .lr-page code, .lr-page time {
  font-family: var(--lr-mono);
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.lr-icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lr-link, .lr-page a {
  color: var(--lr-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  border-radius: 2px;
}
.lr-link:hover, .lr-page a:hover { text-decoration-thickness: 2px; color: var(--lr-accent-hover); }
.lr-link:active, .lr-page a:active { color: var(--lr-accent-active); }

.lr-page :focus-visible,
.lr-file-input:focus-visible + .lr-drop {
  outline: 3px solid var(--lr-focus);
  outline-offset: 3px;
}

/* ---------- Header ---------- */

.lr-header { display: grid; gap: var(--lr-space-3); margin-bottom: var(--lr-space-6); }

.lr-intro {
  max-width: 62ch;
  font-size: var(--lr-type-lead);
  line-height: 1.5;
  color: var(--lr-text);
}

.lr-note {
  display: flex;
  align-items: center;
  gap: var(--lr-space-2);
  font-size: var(--lr-type-sm);
  color: var(--lr-muted);
}
.lr-note .lr-icon { width: 16px; height: 16px; }

/* ---------- Slots ---------- */

.lr-slots {
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  align-items: stretch;
  gap: var(--lr-space-3);
}

.lr-slots-arrow {
  align-self: center;
  justify-self: center;
  color: var(--lr-border);
}
.lr-slots-arrow .lr-icon { width: 24px; height: 24px; }

.lr-slot {
  display: grid;
  gap: var(--lr-space-3);
  align-content: start;
  padding: var(--lr-space-5);
  background: var(--lr-surface);
  border: 1px solid var(--lr-hairline);
  border-radius: var(--lr-radius-lg);
  box-shadow: var(--lr-shadow);
}

.lr-slot.is-ready { border-color: var(--lr-success); }
.lr-slot.is-error { border-color: var(--lr-danger); box-shadow: inset 4px 0 0 var(--lr-danger), var(--lr-shadow); }

.lr-slot-tag, .lr-eyebrow {
  font-family: var(--lr-mono);
  font-size: var(--lr-type-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lr-accent);
}

.lr-slot p.lr-muted { font-size: var(--lr-type-sm); }

/* The native input stays focusable but invisible; its label is the drop zone. */
.lr-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.lr-drop {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--lr-space-1);
  min-height: 148px;
  padding: var(--lr-space-5) var(--lr-space-4);
  text-align: center;
  background: var(--lr-raised);
  border: 2px dashed var(--lr-border);
  border-radius: var(--lr-radius);
  cursor: pointer;
  transition: background-color var(--lr-motion) var(--lr-ease), border-color var(--lr-motion) var(--lr-ease);
}
.lr-drop .lr-icon { width: 28px; height: 28px; color: var(--lr-accent); transition: transform var(--lr-motion) var(--lr-ease); }
.lr-drop:hover { background: var(--lr-accent-soft); border-color: var(--lr-accent); }
.lr-drop:hover .lr-icon { transform: translateY(-2px); }
.lr-drop:active { background: var(--lr-accent-soft); border-color: var(--lr-accent-active); }
.lr-slot.is-dragover .lr-drop { background: var(--lr-accent-soft); border-color: var(--lr-accent); border-style: solid; }
.lr-slot.is-ready .lr-drop { border-style: solid; border-color: var(--lr-hairline); min-height: 96px; }
.lr-slot.is-error .lr-drop { border-color: var(--lr-danger); }

.lr-drop-title { font-weight: 650; color: var(--lr-text); }
.lr-drop-hint { font-size: var(--lr-type-sm); color: var(--lr-muted); }

.lr-filename {
  display: flex;
  align-items: center;
  gap: var(--lr-space-2);
  min-height: 24px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.lr-slot.is-ready .lr-filename .lr-icon { color: var(--lr-success); }
.lr-slot.is-error .lr-filename .lr-icon { color: var(--lr-danger); }

.lr-slot-meta {
  min-height: 1.5em;
  font-family: var(--lr-mono);
  font-size: var(--lr-type-xs);
  font-variant-numeric: tabular-nums;
  color: var(--lr-muted);
  overflow-wrap: anywhere;
}

.lr-error {
  display: flex;
  gap: var(--lr-space-2);
  align-items: flex-start;
  color: var(--lr-danger);
  font-size: var(--lr-type-sm);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.lr-error:empty { display: none; }
.lr-error .lr-icon { width: 18px; height: 18px; margin-top: 2px; }

/* ---------- Status line ---------- */

.lr-pair {
  display: flex;
  align-items: center;
  gap: var(--lr-space-2);
  min-height: 48px;
  margin: var(--lr-space-4) 0 var(--lr-space-5);
  padding: var(--lr-space-2) var(--lr-space-4);
  border-radius: var(--lr-radius);
  color: var(--lr-muted);
  font-weight: 550;
  overflow-wrap: anywhere;
}
.lr-pair--busy { color: var(--lr-text); }
.lr-pair--ready { color: var(--lr-success); background: var(--lr-success-soft); }
.lr-pair--error { color: var(--lr-danger); background: var(--lr-danger-soft); }

/* ---------- Buttons ---------- */

.lr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--lr-space-2);
  min-height: 44px;
  min-width: 44px;
  padding: var(--lr-space-2) var(--lr-space-5);
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--lr-radius);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--lr-motion) var(--lr-ease), border-color var(--lr-motion) var(--lr-ease), transform var(--lr-motion) var(--lr-ease);
}
.lr-btn:active { transform: translateY(1px); }
.lr-btn:disabled, .lr-btn[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; transform: none; }

.lr-btn--primary {
  background: var(--lr-accent);
  color: var(--lr-on-accent);
  box-shadow: var(--lr-shadow);
}
.lr-btn--primary:hover { background: var(--lr-accent-hover); }
.lr-btn--primary:active { background: var(--lr-accent-active); }

.lr-btn--secondary {
  background: var(--lr-surface);
  color: var(--lr-accent);
  border-color: var(--lr-accent);
}
.lr-btn--secondary:hover { background: var(--lr-accent-soft); }
.lr-btn--secondary:active { background: var(--lr-accent-soft); border-color: var(--lr-accent-active); }

.lr-btn--quiet {
  background: transparent;
  color: var(--lr-accent);
  padding-inline: var(--lr-space-3);
}
.lr-btn--quiet:hover { background: var(--lr-accent-soft); }
.lr-btn--quiet:active { background: var(--lr-hairline); }

/* ---------- Result slot states ---------- */

#result { min-height: 160px; }

.lr-state {
  display: grid;
  justify-items: center;
  gap: var(--lr-space-2);
  min-height: 160px;
  padding: var(--lr-space-6) var(--lr-space-5);
  text-align: center;
  color: var(--lr-muted);
  border: 1px dashed var(--lr-border);
  border-radius: var(--lr-radius-lg);
  animation: lr-rise var(--lr-motion) var(--lr-ease);
}
.lr-state h2 { font-size: var(--lr-type-lead); color: var(--lr-text); }
.lr-state p { max-width: 52ch; }
.lr-state .lr-icon { width: 32px; height: 32px; color: var(--lr-border); }

.lr-state--error { border-style: solid; border-color: var(--lr-danger); background: var(--lr-danger-soft); }
.lr-state--error .lr-icon, .lr-state--error h2 { color: var(--lr-danger); }

.lr-state--loading { justify-items: stretch; text-align: left; }
.lr-skeleton {
  height: 14px;
  border-radius: var(--lr-radius-sm);
  background: var(--lr-skeleton);
  animation: lr-pulse 1.2s ease-in-out infinite;
}
.lr-skeleton:nth-child(2) { width: 82%; }
.lr-skeleton:nth-child(3) { width: 64%; }

/* ---------- Report ---------- */

.lr-report {
  display: grid;
  gap: var(--lr-space-6);
  padding: var(--lr-space-6);
  background: var(--lr-surface);
  border: 1px solid var(--lr-hairline);
  border-top: 4px solid var(--lr-accent);
  border-radius: var(--lr-radius-lg);
  box-shadow: var(--lr-shadow-raised);
  animation: lr-rise var(--lr-motion) var(--lr-ease);
}

.lr-report-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--lr-space-4) var(--lr-space-6);
  align-items: start;
}
.lr-report-head > :first-child { display: grid; gap: var(--lr-space-2); }
.lr-report-head h2 { font-size: var(--lr-type-display); line-height: 1.1; }

.lr-download { display: grid; justify-items: end; gap: var(--lr-space-1); }
.lr-download .lr-btn { min-width: 13.5rem; }
.lr-download p { font-size: var(--lr-type-xs); color: var(--lr-muted); }

.lr-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--lr-space-1) var(--lr-space-4);
  margin-top: var(--lr-space-2);
  font-size: var(--lr-type-sm);
}
.lr-meta dt { color: var(--lr-muted); font-weight: 600; }
.lr-meta dd { font-family: var(--lr-mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Tally: the diff-gutter signature, in summary form */
.lr-tally {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--lr-space-3);
}
.lr-tally-cell {
  display: grid;
  grid-template-columns: var(--lr-gutter) 1fr;
  align-items: center;
  gap: 0 var(--lr-space-3);
  padding: var(--lr-space-4);
  border-radius: var(--lr-radius);
  background: var(--lr-raised);
  border: 1px solid var(--lr-hairline);
}
.lr-tally-cell strong {
  font-size: var(--lr-type-display);
  line-height: 1;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.lr-tally-cell span:last-child { grid-column: 2; font-size: var(--lr-type-sm); color: var(--lr-muted); font-weight: 600; }
.lr-tally-cell .lr-sign { grid-row: span 2; }
.lr-tally-cell--kept { border-color: var(--lr-accent); background: var(--lr-accent-soft); }
.lr-tally-cell--kept span:last-child { color: var(--lr-text); }

.lr-sign {
  display: inline-grid;
  place-items: center;
  width: var(--lr-gutter);
  height: var(--lr-gutter);
  border-radius: var(--lr-radius-sm);
  font-family: var(--lr-mono);
  font-weight: 800;
  font-size: var(--lr-type-lead);
  line-height: 1;
}
.lr-tally-cell--removed .lr-sign, .lr-entry--removed .lr-sign { color: var(--lr-success); background: var(--lr-success-soft); }
.lr-tally-cell--added .lr-sign, .lr-entry--added .lr-sign { color: var(--lr-warning); background: var(--lr-warning-soft); }
.lr-tally-cell--kept .lr-sign, .lr-entry--kept .lr-sign { color: var(--lr-accent); background: var(--lr-surface); }

.lr-coverage {
  max-width: 70ch;
  padding: var(--lr-space-3) var(--lr-space-4);
  font-size: var(--lr-type-sm);
  color: var(--lr-muted);
  border-left: 3px solid var(--lr-border);
  background: var(--lr-raised);
  border-radius: 0 var(--lr-radius-sm) var(--lr-radius-sm) 0;
}

.lr-category {
  display: grid;
  gap: var(--lr-space-4);
  padding-top: var(--lr-space-5);
  border-top: 1px solid var(--lr-hairline);
}
.lr-category-count {
  font-family: var(--lr-mono);
  font-size: var(--lr-type-xs);
  font-variant-numeric: tabular-nums;
  color: var(--lr-muted);
}

.lr-lists { display: grid; gap: var(--lr-space-5); }
.lr-list-group { display: grid; gap: var(--lr-space-2); align-content: start; min-width: 0; }
.lr-list-group h4 { color: var(--lr-muted); }

.lr-list { list-style: none; padding: 0; display: grid; gap: var(--lr-space-2); }

.lr-entry {
  display: grid;
  grid-template-columns: var(--lr-gutter) 1fr;
  gap: 0 var(--lr-space-3);
  align-items: start;
  padding: var(--lr-space-2) var(--lr-space-3) var(--lr-space-2) var(--lr-space-2);
  border: 1px solid var(--lr-hairline);
  border-radius: var(--lr-radius-sm);
  background: var(--lr-surface);
  min-width: 0;
}
.lr-entry > .lr-sign { grid-row: span 4; }
.lr-entry--removed { box-shadow: inset 3px 0 0 var(--lr-success); }
.lr-entry--added { box-shadow: inset 3px 0 0 var(--lr-warning); }
.lr-entry--kept { box-shadow: inset 3px 0 0 var(--lr-accent); }
.lr-entry--kept .lr-sign { background: var(--lr-accent-soft); }

.lr-entry-label { grid-column: 2; font-weight: 600; overflow-wrap: anywhere; }
.lr-entry-id, .lr-scope {
  grid-column: 2;
  font-family: var(--lr-mono);
  font-size: var(--lr-type-xs);
  font-variant-numeric: tabular-nums;
  color: var(--lr-muted);
  overflow-wrap: anywhere;
}
.lr-scope { color: var(--lr-text); }

.lr-none {
  padding: var(--lr-space-2) var(--lr-space-3);
  font-style: italic;
  color: var(--lr-muted);
  border: 1px dashed var(--lr-hairline);
  border-radius: var(--lr-radius-sm);
}

.lr-footnote { font-size: var(--lr-type-xs); color: var(--lr-muted); max-width: 70ch; }

/* ---------- Recipe ---------- */

.lr-recipe {
  margin-top: var(--lr-space-7);
  background: var(--lr-surface);
  border: 1px solid var(--lr-hairline);
  border-radius: var(--lr-radius-lg);
}
.lr-recipe > summary {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: var(--lr-space-3) var(--lr-space-5);
  font-weight: 700;
  font-size: var(--lr-type-lead);
  cursor: pointer;
  border-radius: var(--lr-radius-lg);
  list-style: none;
}
.lr-recipe > summary::-webkit-details-marker { display: none; }
.lr-recipe > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: var(--lr-space-3);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--lr-motion) var(--lr-ease);
}
.lr-recipe[open] > summary::before { transform: rotate(45deg); }
.lr-recipe > summary:hover { background: var(--lr-accent-soft); }
.lr-recipe > :not(summary) { margin-inline: var(--lr-space-5); }
.lr-recipe > :last-child { margin-bottom: var(--lr-space-5); }
.lr-recipe p, .lr-recipe li { max-width: 68ch; }
.lr-recipe ol { padding-left: 0; list-style: none; display: grid; gap: var(--lr-space-5); margin-top: var(--lr-space-4); }
.lr-recipe h3 { margin: var(--lr-space-5) 0 var(--lr-space-2); }

.lr-step { display: grid; gap: var(--lr-space-2); }

.lr-code-wrap { position: relative; }
.lr-code {
  padding: var(--lr-space-4);
  padding-right: 7rem;
  overflow-x: auto;
  font-family: var(--lr-mono);
  font-size: var(--lr-type-sm);
  line-height: 1.55;
  color: var(--lr-text);
  background: var(--lr-raised);
  border: 1px solid var(--lr-hairline);
  border-radius: var(--lr-radius);
  tab-size: 2;
}
.lr-copy {
  position: absolute;
  top: var(--lr-space-2);
  right: var(--lr-space-2);
  min-width: 6rem;
  background: var(--lr-surface);
  border: 1px solid var(--lr-hairline);
}

/* ---------- Footer from the template: colour only ---------- */

.site-footer { color: var(--lr-muted); border-top-color: var(--lr-hairline); }
.site-footer a { color: var(--lr-accent); }

/* ---------- Motion ---------- */

@keyframes lr-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes lr-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .lr-page *, .lr-page *::before, .lr-page *::after {
    animation: none !important;
    transition: none !important;
  }
  .lr-drop:hover .lr-icon, .lr-btn:active { transform: none; }
}

/* ---------- Layout breakpoints ---------- */

@media (min-width: 1000px) {
  .lr-lists { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 759px) {
  .lr-page { padding: var(--lr-space-5) var(--lr-space-4) var(--lr-space-7); }
  .lr-page h1 { font-size: var(--lr-type-display); }
  .lr-slots { grid-template-columns: 1fr; }
  .lr-slots-arrow { transform: rotate(90deg); }
  .lr-drop { min-height: 120px; }
  .lr-report { padding: var(--lr-space-5) var(--lr-space-4); gap: var(--lr-space-5); }
  .lr-report-head { grid-template-columns: 1fr; }
  .lr-report-head h2 { font-size: var(--lr-type-h2); }
  .lr-meta { grid-template-columns: 1fr; }
  .lr-meta dd { margin-bottom: var(--lr-space-2); }
  .lr-download { justify-items: stretch; }
  .lr-download .lr-btn { width: 100%; }
  .lr-tally { grid-template-columns: 1fr; gap: var(--lr-space-2); }
  .lr-tally-cell strong { font-size: var(--lr-type-h2); }
  .lr-tally-cell--kept { order: -1; }
  .lr-code { padding-right: var(--lr-space-4); padding-top: 56px; }
}
